/*
 * theme.css — Pabbly CRM. Opens dark, like the Sales.AI console the team
 * already works in (dense and calm, like Linear), with a light mode behind
 * the switch. One blue for actions; the stage, action-status and intent
 * colours are --x- tokens read by app.css.
 */

:root {
  color-scheme: dark;
  --canvas: #111113;
  --surface: #1a1a1d;
  --surface-2: #232327;
  --border: #2c2c31;
  --border-strong: #4a4a52;
  --ink: #ededf0;
  --muted: #a1a1aa;
  --accent: #5b8cff;
  --accent-hover: #7aa2ff;
  --accent-ink: #0b1020;
  --accent-text: #8db0ff;
  --accent-strong: #c2d4ff;
  --accent-soft: #1c2740;
  --accent-border: #34497a;
  --success: #3fa66a;
  --success-ink: #04140a;
  --success-soft: #15291d;
  --success-strong: #74d6a0;
  --warning: #d99a2b;
  --warning-ink: #1a1000;
  --warning-soft: #2e2410;
  --warning-strong: #f0be5a;
  --danger: #e5534b;
  --danger-ink: #1a0302;
  --danger-soft: #33191a;
  --danger-strong: #f59a93;
  --chart-1: #5b8cff;
  --chart-2: #45c9b6;
  --chart-3: #e8b04a;
  --chart-4: #be98f5;
  --chart-5: #ec8a8f;
  --chart-6: #74aff5;

  --x-st-new: #9aa6f5;
  --x-st-contacting: #e8b04a;
  --x-st-discussion: #45c9b6;
  --x-st-evaluating: #be98f5;
  --x-st-deciding: #74aff5;
  --x-won: #62c98a;
  --x-lost: #ec8a8f;
  --x-disq: #a3adb8;
  --x-act-ours: #f5a35a;
  --x-act-wait: #a1a1aa;
  --x-act-sched: #57c8e0;
  --x-act-hold: #de96c8;
  --x-act-overdue: #f27c74;
  --x-int-unknown: #a1a1aa;
  --x-int-interested: #62c98a;
  --x-int-conditional: #e8b04a;
  --x-int-not: #ec8a8f;
  --x-nav: #161618;
  --x-nav-active: #25272f;
  --x-callout: #18202f;
  --x-callout-border: #2d3b5a;
  --x-callout-ink: #c9d3e8;

  --font-display: "Inter Variable", ui-sans-serif, system-ui, sans-serif;
  --font-body: "Inter Variable", ui-sans-serif, system-ui, sans-serif;
  --font-sans: "Inter Variable", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono Variable", ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  --display-weight: 700;
  --display-tracking: -0.015em;
  --eyebrow-tracking: 0.06em;

  --radius-btn: 0.5rem;
  --radius-card: 0.75rem;
  --radius-input: 0.5rem;
  --shadow-card: none;
  --shadow-btn: none;
  --shadow-raised: 0 24px 64px rgba(0, 0, 0, 0.5);
  --card-pad: 1.25rem;
  --btn-weight: 600;
}

html[data-theme="light"] {
  color-scheme: light;
  --canvas: #f5f6f8;
  --surface: #ffffff;
  --surface-2: #eef0f3;
  --border: #dde1e7;
  --border-strong: #b3bac5;
  --ink: #15181e;
  --muted: #5b6270;
  --accent: #2f62e6;
  --accent-hover: #2753c4;
  --accent-ink: #ffffff;
  --accent-text: #2453c9;
  --accent-strong: #1e46ae;
  --accent-soft: #e6edfd;
  --accent-border: #b4c7f5;
  --success: #1e8a4c;
  --success-ink: #ffffff;
  --success-soft: #e2f3e8;
  --success-strong: #17703d;
  --warning: #b86e00;
  --warning-ink: #ffffff;
  --warning-soft: #fbefd9;
  --warning-strong: #8f5500;
  --danger: #c9372f;
  --danger-ink: #ffffff;
  --danger-soft: #fbe5e3;
  --danger-strong: #a52a23;
  --chart-1: #2f62e6;
  --chart-2: #0b8577;
  --chart-3: #b07408;
  --chart-4: #7e46c6;
  --chart-5: #a8474c;
  --chart-6: #2671c9;

  --x-st-new: #4453c4;
  --x-st-contacting: #8f5c00;
  --x-st-discussion: #0a7366;
  --x-st-evaluating: #7440bd;
  --x-st-deciding: #1f5fb0;
  --x-won: #23803f;
  --x-lost: #a8434a;
  --x-disq: #5f6873;
  --x-act-ours: #a84e00;
  --x-act-wait: #5b6270;
  --x-act-sched: #0b6a82;
  --x-act-hold: #8e3f79;
  --x-act-overdue: #b8322b;
  --x-int-unknown: #5b6270;
  --x-int-interested: #23803f;
  --x-int-conditional: #8f5c00;
  --x-int-not: #a8434a;
  --x-nav: #ffffff;
  --x-nav-active: #e9eef9;
  --x-callout: #eef3fd;
  --x-callout-border: #c4d3f3;
  --x-callout-ink: #23345a;
}

/*
 * app.css — Pabbly CRM's own rules: the app shell, the mobile drawer, and the
 * colour tags for stage, lifecycle, action status and intent. Tokens only.
 */

/* ---- Shell ---------------------------------------------------------------- */
.shell { display: flex; min-height: 100vh; }
.sidebar {
  width: 15rem; flex: none; display: flex; flex-direction: column; gap: 1.5rem;
  padding: 1.25rem 0.875rem; background: var(--x-nav); border-right: 1px solid var(--border);
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.main { flex: 1 1 auto; min-width: 0; }
.navopen { position: absolute; opacity: 0; pointer-events: none; }
.mobilebar { display: none; }
.scrim { display: none; }
@media (width < 64rem) {
  .sidebar { position: fixed; inset: 0 auto 0 0; z-index: 60; height: 100%; transform: translateX(-100%); transition: transform 200ms ease; box-shadow: var(--shadow-raised); }
  .navopen:checked ~ .shell .sidebar { transform: none; }
  .navopen:checked ~ .shell .scrim { display: block; position: fixed; inset: 0; z-index: 55; background: color-mix(in srgb, var(--canvas) 70%, transparent); }
  .mobilebar { display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1rem; border-bottom: 1px solid var(--border); background: var(--x-nav); position: sticky; top: 0; z-index: 40; }
}
html.reduced-motion .sidebar { transition: none; }

.nav-label { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); padding: 0 0.625rem 0.375rem; }
.nav-item {
  display: flex; align-items: center; gap: 0.625rem; padding: 0.5rem 0.625rem; border-radius: 0.5rem;
  color: var(--muted); font-size: 0.875rem; font-weight: 500; min-height: 2.25rem;
}
.nav-item:hover { background: var(--surface-2); color: var(--ink); text-decoration: none; }
.nav-item[aria-current="page"] { background: var(--x-nav-active); color: var(--ink); font-weight: 600; }
.nav-count { margin-left: auto; font-size: 0.75rem; font-weight: 700; padding: 0 0.45rem; border-radius: 999px; background: var(--accent); color: var(--accent-ink); }

/* ---- "Viewing as" switcher (demo mode) ------------------------------------- */
.switcher { border: 1px solid var(--border); border-radius: 0.75rem; background: var(--surface); }
.switcher-head {
  display: flex; align-items: center; gap: 0.625rem; padding: 0.625rem 0.625rem; border-radius: 0.75rem;
  cursor: pointer; user-select: none; line-height: 1.25;
}
.switcher-head:hover { background: var(--surface-2); }
.switcher[open] > .switcher-head { border-bottom: 1px solid var(--border); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.switcher-chev { display: inline-flex; color: var(--muted); }
.switcher-menu { display: flex; flex-direction: column; gap: 0.125rem; padding: 0.5rem 0.375rem; max-height: 60vh; overflow-y: auto; }
.switch-label { font-size: 0.6875rem; font-weight: 600; color: var(--muted); padding: 0.5rem 0.5rem 0.25rem; }
.switch-item {
  display: flex; align-items: center; gap: 0.625rem; width: 100%; padding: 0.375rem 0.5rem; border-radius: 0.5rem;
  color: var(--ink); line-height: 1.25; cursor: pointer;
}
.switch-item:hover { background: var(--surface-2); }
.switch-item[aria-current="true"] { background: var(--x-nav-active); }
.switch-item[aria-current="true"] .icon { color: var(--accent-text); }

/* ---- Tags ------------------------------------------------------------------ */
/* width: auto undoes the platform's small round .dot, which shares the class name. */
.pill {
  display: inline-flex; align-items: center; gap: 0.375rem; width: auto; height: 1.5rem; padding: 0 0.6rem;
  flex-shrink: 0; vertical-align: middle;
  border-radius: 999px; font-size: 0.75rem; font-weight: 600; white-space: nowrap; line-height: 1;
}
.pill.dot::before { content: ""; width: 0.4rem; height: 0.4rem; border-radius: 999px; background: currentColor; flex: none; }
.pc-new { color: var(--x-st-new); background: color-mix(in srgb, var(--x-st-new) 15%, transparent); }
.pc-contacting { color: var(--x-st-contacting); background: color-mix(in srgb, var(--x-st-contacting) 15%, transparent); }
.pc-discussion { color: var(--x-st-discussion); background: color-mix(in srgb, var(--x-st-discussion) 15%, transparent); }
.pc-evaluating { color: var(--x-st-evaluating); background: color-mix(in srgb, var(--x-st-evaluating) 15%, transparent); }
.pc-deciding { color: var(--x-st-deciding); background: color-mix(in srgb, var(--x-st-deciding) 15%, transparent); }
.pc-open { color: var(--ink); background: color-mix(in srgb, var(--ink) 10%, transparent); }
.pc-won { color: var(--x-won); background: color-mix(in srgb, var(--x-won) 15%, transparent); }
.pc-lost { color: var(--x-lost); background: color-mix(in srgb, var(--x-lost) 15%, transparent); }
.pc-disqualified { color: var(--x-disq); background: color-mix(in srgb, var(--x-disq) 15%, transparent); }
.pc-ours { color: var(--x-act-ours); background: color-mix(in srgb, var(--x-act-ours) 15%, transparent); }
.pc-overdue { color: var(--x-act-overdue); background: color-mix(in srgb, var(--x-act-overdue) 15%, transparent); }
.pc-wait { color: var(--x-act-wait); background: color-mix(in srgb, var(--x-act-wait) 15%, transparent); }
.pc-sched { color: var(--x-act-sched); background: color-mix(in srgb, var(--x-act-sched) 15%, transparent); }
.pc-hold { color: var(--x-act-hold); background: color-mix(in srgb, var(--x-act-hold) 15%, transparent); }
.pc-none { color: var(--x-act-overdue); background: color-mix(in srgb, var(--x-act-overdue) 12%, transparent); }
.pc-closed { color: var(--muted); background: color-mix(in srgb, var(--muted) 15%, transparent); }
.pc-unknown { color: var(--x-int-unknown); background: color-mix(in srgb, var(--x-int-unknown) 15%, transparent); }
.pc-interested { color: var(--x-int-interested); background: color-mix(in srgb, var(--x-int-interested) 15%, transparent); }
.pc-conditional { color: var(--x-int-conditional); background: color-mix(in srgb, var(--x-int-conditional) 15%, transparent); }
.pc-not_interested { color: var(--x-int-not); background: color-mix(in srgb, var(--x-int-not) 15%, transparent); }

.dot-mark { width: 0.55rem; height: 0.55rem; border-radius: 999px; flex: none; background: currentColor; }
.tx-new { color: var(--x-st-new); }
.tx-contacting { color: var(--x-st-contacting); }
.tx-discussion { color: var(--x-st-discussion); }
.tx-evaluating { color: var(--x-st-evaluating); }
.tx-deciding { color: var(--x-st-deciding); }
.tx-ours { color: var(--x-act-ours); }
.tx-overdue { color: var(--x-act-overdue); }
.tx-wait { color: var(--x-act-wait); }
.tx-sched { color: var(--x-act-sched); }
.tx-hold { color: var(--x-act-hold); }
.tx-won { color: var(--x-won); }
.tx-lost { color: var(--x-lost); }

/* ---- Stage track on the lead page ------------------------------------------ */
.track { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 0.375rem; }
.track-bar { height: 0.375rem; border-radius: 999px; background: var(--border); }
.track-bar.bg-new { background: var(--x-st-new); }
.track-bar.bg-contacting { background: var(--x-st-contacting); }
.track-bar.bg-discussion { background: var(--x-st-discussion); }
.track-bar.bg-evaluating { background: var(--x-st-evaluating); }
.track-bar.bg-deciding { background: var(--x-st-deciding); }

/* ---- Pipeline columns ------------------------------------------------------- */
.col-head { padding: 0.25rem 0.25rem 0.5rem; border-bottom: 3px solid var(--border); }
.col-head.bd-new { border-bottom-color: var(--x-st-new); }
.col-head.bd-contacting { border-bottom-color: var(--x-st-contacting); }
.col-head.bd-discussion { border-bottom-color: var(--x-st-discussion); }
.col-head.bd-evaluating { border-bottom-color: var(--x-st-evaluating); }
.col-head.bd-deciding { border-bottom-color: var(--x-st-deciding); }
.lead-card { display: flex; flex-direction: column; gap: 0.4rem; padding: 0.7rem 0.8rem; border-radius: 0.6rem; background: var(--surface); border: 1px solid var(--border); color: var(--ink); }
.lead-card:hover { border-color: var(--border-strong); text-decoration: none; }

/* ---- Work-queue tiles ------------------------------------------------------- */
.qtile { border-top-width: 3px; border-top-style: solid; }
.qtile.q-ours { border-top-color: var(--x-act-ours); }
.qtile.q-overdue { border-top-color: var(--x-act-overdue); }
.qtile.q-sched { border-top-color: var(--x-act-sched); }
.qtile.q-evaluating { border-top-color: var(--x-st-evaluating); }
.qtile.q-hold { border-top-color: var(--x-act-hold); }
.qtile.q-wait { border-top-color: var(--x-act-wait); }

/* ---- Diary ------------------------------------------------------------------ */
.ev { display: grid; place-items: center; width: 2rem; height: 2rem; border-radius: 999px; flex: none; font-size: 0.625rem; font-weight: 700; letter-spacing: 0.02em; }
.ev-email { color: var(--accent-text); background: var(--accent-soft); }
.ev-whatsapp { color: var(--x-won); background: color-mix(in srgb, var(--x-won) 15%, transparent); }
.ev-call { color: var(--x-st-contacting); background: color-mix(in srgb, var(--x-st-contacting) 15%, transparent); }
.ev-demo { color: var(--x-act-sched); background: color-mix(in srgb, var(--x-act-sched) 15%, transparent); }
.ev-in { color: var(--x-st-discussion); background: color-mix(in srgb, var(--x-st-discussion) 15%, transparent); }
.ev-note { color: var(--muted); background: var(--surface-2); }
.ev-system { color: var(--muted); background: var(--surface-2); }
.ev-close { color: var(--x-lost); background: color-mix(in srgb, var(--x-lost) 15%, transparent); }

/* ---- Callout ---------------------------------------------------------------- */
.callout { background: var(--x-callout); border: 1px solid var(--x-callout-border); color: var(--x-callout-ink); border-radius: 0.75rem; padding: 0.875rem 1rem; }
.callout-title { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; }

.kicker { font-size: 0.6875rem; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }

/* ---- Collapsible sections ---------------------------------------------------- */
/* Boxed: How it works, and the side cards on Today. */
.fold { border: 1px solid var(--border); border-radius: 0.75rem; background: var(--surface); }
.fold-head {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.875rem 1rem; min-height: 3.25rem;
  border-radius: 0.75rem; cursor: pointer; user-select: none;
}
.fold-head.fold-head-sm { padding: 0.75rem 1rem; min-height: 2.75rem; }
.fold-head:hover { background: var(--surface-2); }
.fold[open] > .fold-head { border-bottom: 1px solid var(--border); border-bottom-left-radius: 0; border-bottom-right-radius: 0; }
.fold-chev { margin-left: auto; display: inline-flex; color: var(--muted); transition: transform 160ms ease; }
.fold[open] .fold-chev, .fold-plain[open] > summary .fold-chev { transform: rotate(180deg); }
html.reduced-motion .fold-chev { transition: none; }
.fold-body { display: flex; flex-direction: column; gap: 0.75rem; padding: 1rem; }

/* Plain: the work groups on Today — just the heading row folds the list. */
.fold-plain-head {
  display: flex; align-items: center; gap: 0.5rem; padding: 0.375rem 0.5rem; margin: 0 -0.5rem;
  border-radius: 0.5rem; cursor: pointer; user-select: none;
}
.fold-plain-head:hover { background: var(--surface-2); }
.fold-plain-head .fold-chev { margin-left: 0.25rem; }

/* Lists arriving after a filter change settle in place. */
.fade-row { animation: fade-up 240ms ease both; }
html.reduced-motion .fade-row { animation: none; }
