/* Pathfinder Pipeline CRM. Light default, dark via OS or toggle. */
:root {
  color-scheme: light;
  --page: #f4f4f1;
  --surface: #ffffff;
  --surface-2: #f9f9f7;
  --surface-3: #f0efec;
  --ink: #0b0b0b;
  --ink-2: #52514e;
  --ink-3: #898781;
  --line: #e1e0d9;
  --line-2: #c3c2b7;
  --ring: rgba(11,11,11,0.10);
  --primary: #0051a0;
  --primary-ink: #ffffff;
  --primary-soft: #e4edf8;
  --primary-text: #003f7d;

  --st-lead: #8fb3dc;
  --st-contacted: #4f86c6;
  --st-quoting: #0051a0;
  --st-quoted: #003366;
  --st-bound: #0ca30c;
  --st-lost: #898781;

  --bt-personal: #0051a0;
  --bt-commercial: #eb6834;
  --bt-lhb: #1baf7a;

  --good: #0ca30c;      --good-soft: #e4f5e4;   --good-text: #006300;
  --warn: #fab219;      --warn-soft: #fff3d6;   --warn-text: #8a5a00;
  --serious: #ec835a;   --serious-soft: #fde9e1; --serious-text: #9a3f17;
  --crit: #d03b3b;      --crit-soft: #fbe3e3;   --crit-text: #a52626;

  --radius: 12px;
  --radius-sm: 8px;
  --shadow: 0 1px 2px rgba(11,11,11,0.05), 0 4px 16px rgba(11,11,11,0.06);
  --shadow-lg: 0 8px 40px rgba(11,11,11,0.18);
  --font: "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-head: "Montserrat", "Inter", system-ui, sans-serif;
  --sidebar-w: 232px;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --page: #0f0f0e; --surface: #1a1a19; --surface-2: #212120; --surface-3: #2a2a28;
    --ink: #ffffff; --ink-2: #c3c2b7; --ink-3: #898781; --line: #2c2c2a; --line-2: #383835;
    --ring: rgba(255,255,255,0.10);
    --primary: #2f7fd6; --primary-soft: #14294a; --primary-text: #9cc3f2;
    --st-lead: #8fb3dc; --st-contacted: #4f86c6; --st-quoting: #2f7fd6; --st-quoted: #1b4f8c;
    --good-soft: #10300f; --good-text: #5fd45f;
    --warn-soft: #3a2c08; --warn-text: #ffd166;
    --serious-soft: #3d1f14; --serious-text: #ffb199;
    --crit-soft: #3d1414; --crit-text: #ff8a8a;
    --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.3);
    --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
  }
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --page: #0f0f0e; --surface: #1a1a19; --surface-2: #212120; --surface-3: #2a2a28;
  --ink: #ffffff; --ink-2: #c3c2b7; --ink-3: #898781; --line: #2c2c2a; --line-2: #383835;
  --ring: rgba(255,255,255,0.10);
  --primary: #2f7fd6; --primary-soft: #14294a; --primary-text: #9cc3f2;
  --st-lead: #8fb3dc; --st-contacted: #4f86c6; --st-quoting: #2f7fd6; --st-quoted: #1b4f8c;
  --good-soft: #10300f; --good-text: #5fd45f;
  --warn-soft: #3a2c08; --warn-text: #ffd166;
  --serious-soft: #3d1f14; --serious-text: #ffb199;
  --crit-soft: #3d1414; --crit-text: #ff8a8a;
  --shadow: 0 1px 2px rgba(0,0,0,0.3), 0 4px 16px rgba(0,0,0,0.3);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.6);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: var(--font); font-size: 14px; line-height: 1.45; color: var(--ink); background: var(--page);
  -webkit-font-smoothing: antialiased; overflow-x: hidden;
}
a { color: var(--primary-text); text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3 { margin: 0; font-weight: 650; letter-spacing: -0.01em; }
h1, h2, .tile .value, .login-box h2 { font-family: var(--font-head); font-weight: 700; }
h1 { font-size: 22px; } h2 { font-size: 16px; } h3 { font-size: 13px; color: var(--ink-2); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
.muted { color: var(--ink-3); }
.num { font-variant-numeric: tabular-nums; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }

/* ---------- Layout ---------- */
.app { display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: 56px 1fr; min-height: 100vh; }
.topbar {
  grid-column: 1 / -1; position: sticky; top: 0; z-index: 30; display: flex; align-items: center; gap: 12px; padding: 0 16px;
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: calc(var(--sidebar-w) - 16px); color: inherit; text-decoration: none; }
.brand .logo { height: 28px; width: auto; display: block; }
.brand-sub { font-family: var(--font-head); font-weight: 700; font-size: 10.5px; letter-spacing: .12em; text-transform: uppercase; color: var(--primary-text); border-left: 1px solid var(--line-2); padding-left: 12px; line-height: 1.1; }
.logo-light { display: none; }
.login-logo { margin-bottom: 20px; } .login-logo .logo { height: 44px; width: auto; display: block; }
.boot .logo { height: 40px; width: auto; animation: pulse 1s ease-in-out infinite; }
/* dark mode: keep the real logo, sit it on a white tile so the mark stays readable */
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .logo-dark { background: #fff; padding: 4px 8px; border-radius: 8px; box-sizing: content-box; } }
:root[data-theme="dark"] .logo-dark { background: #fff; padding: 4px 8px; border-radius: 8px; box-sizing: content-box; }
.search { flex: 1; max-width: 520px; position: relative; }
.search input {
  width: 100%; height: 36px; padding: 0 12px 0 36px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface-2); outline: none;
}
.search input:focus { border-color: var(--primary); background: var(--surface); box-shadow: 0 0 0 3px var(--primary-soft); }
.search svg { position: absolute; left: 11px; top: 10px; width: 16px; height: 16px; color: var(--ink-3); }
.search kbd { position: absolute; right: 10px; top: 9px; font: 11px var(--font); color: var(--ink-3); border: 1px solid var(--line); border-radius: 5px; padding: 1px 6px; background: var(--surface); }
.search-results { position: absolute; top: 42px; left: 0; right: 0; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); overflow: hidden; z-index: 40; }
.search-results button { display: flex; width: 100%; gap: 10px; align-items: center; padding: 9px 12px; border: 0; background: none; text-align: left; border-bottom: 1px solid var(--line); }
.search-results button:last-child { border-bottom: 0; }
.search-results button:hover { background: var(--surface-2); }
.search-results .who { margin-left: auto; color: var(--ink-3); font-size: 12px; white-space: nowrap; }
.topbar .spacer { flex: 1; }
.viewer { display: flex; align-items: center; gap: 8px; height: 36px; padding: 0 10px 0 6px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.viewer select { border: 0; background: transparent; outline: none; font-weight: 600; max-width: 160px; }
.avatar { width: 26px; height: 26px; border-radius: 50%; display: inline-grid; place-items: center; font-size: 11px; font-weight: 700; color: #fff; background: var(--primary); flex: none; }
.avatar.sm { width: 20px; height: 20px; font-size: 9px; }
.icon-btn { width: 36px; height: 36px; border: 1px solid var(--line); background: var(--surface); border-radius: 10px; display: grid; place-items: center; color: var(--ink-2); }
.icon-btn:hover { background: var(--surface-2); }
.icon-btn svg { width: 18px; height: 18px; }

.sidebar { position: sticky; top: 56px; height: calc(100vh - 56px); padding: 14px 10px; background: var(--surface); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 4px; }
.nav-btn {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 9px 12px; border: 0; border-radius: 9px; background: none; color: var(--ink-2); font-weight: 500; text-align: left;
}
.nav-btn svg { width: 18px; height: 18px; flex: none; }
.nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-btn.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.nav-btn .badge { margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: 10px; background: var(--crit); color: #fff; font-size: 11px; font-weight: 700; display: grid; place-items: center; }
.sidebar .foot { margin-top: auto; padding: 10px 12px; font-size: 11px; color: var(--ink-3); line-height: 1.5; }

.main { padding: 22px 24px 60px; min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; flex-wrap: wrap; }
.page-head .sub { color: var(--ink-3); margin-top: 2px; }

/* ---------- Buttons ---------- */
.btn { display: inline-flex; align-items: center; gap: 6px; height: 36px; padding: 0 14px; border-radius: 9px; border: 1px solid var(--line); background: var(--surface); font-weight: 600; white-space: nowrap; }
.btn:hover { background: var(--surface-2); }
.btn.primary { background: var(--primary); border-color: var(--primary); color: #fff; letter-spacing: .02em; }
.btn.primary:hover { filter: brightness(1.06); }
.btn.sm { height: 30px; padding: 0 10px; font-size: 13px; }
.btn.xs { height: 26px; padding: 0 9px; font-size: 12px; border-radius: 7px; }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.good { background: var(--good-soft); border-color: transparent; color: var(--good-text); }
.btn.danger { background: var(--crit-soft); border-color: transparent; color: var(--crit-text); }
.btn svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 9px; background: var(--surface); padding: 3px; gap: 2px; }
.seg button { border: 0; background: none; padding: 5px 11px; border-radius: 6px; font-weight: 500; color: var(--ink-2); font-size: 13px; }
.seg button.active { background: var(--primary-soft); color: var(--primary-text); font-weight: 600; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-btn { border: 1px solid var(--line); background: var(--surface); border-radius: 999px; padding: 4px 11px; font-size: 12.5px; font-weight: 500; color: var(--ink-2); display: inline-flex; align-items: center; gap: 6px; }
.chip-btn.active { background: var(--ink); color: var(--surface); border-color: var(--ink); }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex: none; }

/* ---------- Stat tiles ---------- */
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); gap: 12px; margin-bottom: 20px; }
.tile { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px 16px; min-height: 92px; display: flex; flex-direction: column; gap: 4px; }
.tile .label { font-size: 12px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.tile .value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.15; }
.tile .sub { font-size: 12.5px; color: var(--ink-2); }
.tile.alert .value { color: var(--crit-text); }
.tile.ok .value { color: var(--good-text); }
.progress { height: 6px; border-radius: 3px; background: var(--surface-3); position: relative; overflow: visible; margin-top: 6px; }
.progress > i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 3px; background: var(--primary); }
.progress > b { position: absolute; top: -3px; width: 2px; height: 12px; background: var(--ink-3); }
.progress.good > i { background: var(--good); }

/* ---------- Cards / panels ---------- */
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; }
.panel + .panel { margin-top: 16px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; }
@media (max-width: 980px) { .grid-2, .grid-3 { grid-template-columns: 1fr; } }

/* ---------- Board ---------- */
.board-toolbar { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 14px; }
.board { display: grid; grid-template-columns: repeat(4, minmax(230px, 1fr)); gap: 12px; align-items: start; }
.col { background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--radius); min-height: 220px; display: flex; flex-direction: column; }
.col.over { outline: 2px solid var(--primary); outline-offset: -2px; background: var(--primary-soft); }
.col-head { display: flex; align-items: center; gap: 8px; padding: 10px 12px 8px; border-bottom: 1px solid var(--line); }
.col-head .bar { width: 4px; height: 16px; border-radius: 2px; }
.col-head .n { margin-left: auto; font-size: 12px; color: var(--ink-3); font-weight: 600; }
.col-head .sum { font-size: 11.5px; color: var(--ink-3); width: 100%; padding-left: 12px; }
.col-body { padding: 8px; display: flex; flex-direction: column; gap: 8px; flex: 1; }
.col-empty { padding: 20px 8px; text-align: center; color: var(--ink-3); font-size: 12.5px; border: 1px dashed var(--line-2); border-radius: 10px; }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 10px; padding: 10px 12px; cursor: grab; box-shadow: 0 1px 1px rgba(11,11,11,0.03); transition: box-shadow .12s, transform .12s; }
.card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.card.dragging { opacity: 0.45; }
.card .top { display: flex; align-items: flex-start; gap: 8px; }
.card .client { font-weight: 650; line-height: 1.25; flex: 1; }
.card .prem { font-weight: 650; font-size: 13px; white-space: nowrap; color: var(--ink-2); }
.card .line { font-size: 12.5px; color: var(--ink-2); display: flex; align-items: center; gap: 6px; margin-top: 3px; }
.card .meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; align-items: center; }
.card .foot { display: flex; align-items: center; justify-content: space-between; margin-top: 10px; gap: 6px; }
.card .age { font-size: 11.5px; color: var(--ink-3); }
.card .who { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-3); }
.pill { display: inline-flex; align-items: center; gap: 4px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; white-space: nowrap; background: var(--surface-3); color: var(--ink-2); }
.pill.overdue { background: var(--crit-soft); color: var(--crit-text); }
.pill.week { background: var(--warn-soft); color: var(--warn-text); }
.pill.xdate { background: var(--serious-soft); color: var(--serious-text); }
.pill.good { background: var(--good-soft); color: var(--good-text); }
.pill.info { background: var(--primary-soft); color: var(--primary-text); }
.pill svg { width: 12px; height: 12px; }
.stage-pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 8px; border-radius: 6px; font-size: 11.5px; font-weight: 600; color: #fff; }
.drop-bar { visibility: hidden; position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%) translateY(120px); display: flex; gap: 12px; z-index: 50; transition: transform .18s; }
.drop-bar.show { visibility: visible; transform: translateX(-50%) translateY(0); }
.drop-zone { width: 200px; height: 64px; border-radius: 14px; display: grid; place-items: center; font-weight: 700; color: #fff; box-shadow: var(--shadow-lg); border: 2px dashed rgba(255,255,255,0.6); }
.drop-zone.bound { background: var(--good); } .drop-zone.lost { background: var(--st-lost); }
.drop-zone.over { transform: scale(1.06); border-style: solid; }
.closed-strip { margin-top: 18px; }
.closed-strip .row { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.closed-strip .row:last-child { border-bottom: 0; }

/* ---------- Tables ---------- */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; border: 1px solid var(--line); border-radius: var(--radius); background: var(--surface); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th, td { padding: 8px 10px; text-align: left; border-bottom: 1px solid var(--line); white-space: nowrap; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); font-weight: 600; background: var(--surface-2); position: sticky; top: 0; cursor: pointer; user-select: none; }
th.sorted { color: var(--primary-text); }
td.r, th.r { text-align: right; }
tbody tr:hover { background: var(--surface-2); }
tbody tr.click { cursor: pointer; }
tr.total td { font-weight: 700; background: var(--surface-2); border-top: 2px solid var(--line-2); }
td .mini-prog { display: inline-block; width: 70px; height: 5px; background: var(--surface-3); border-radius: 3px; vertical-align: middle; margin-left: 8px; position: relative; overflow: hidden; }
td .mini-prog i { position: absolute; left: 0; top: 0; bottom: 0; background: var(--primary); border-radius: 3px; }
.table-foot { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; font-size: 12.5px; color: var(--ink-2); }

/* ---------- Charts ---------- */
.hbar-row { display: grid; grid-template-columns: 110px 1fr 150px; align-items: center; gap: 10px; padding: 6px 0; font-size: 13px; }
.hbar-row .track { height: 14px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.hbar-row .track i { display: block; height: 100%; border-radius: 4px 4px 4px 4px; }
.hbar-row .val { text-align: right; color: var(--ink-2); }
.hbar-row .lbl { display: flex; align-items: center; gap: 8px; font-weight: 500; }
.legend { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12px; color: var(--ink-2); margin-top: 8px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.goal-chart { display: grid; gap: 10px; }
.goal-row { display: grid; grid-template-columns: 120px 1fr 90px; gap: 10px; align-items: center; font-size: 13px; }
.goal-row .track { height: 16px; background: var(--surface-3); border-radius: 4px; position: relative; }
.goal-row .track i { position: absolute; left: 0; top: 0; bottom: 0; border-radius: 4px; background: var(--primary); }
.goal-row .track i.w { background: var(--st-lead); opacity: 0.7; }
.goal-row .track b { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--ink-3); }
.goal-row .pct { text-align: right; font-weight: 600; }
.feed { display: flex; flex-direction: column; }
.feed .item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; align-items: flex-start; }
.feed .item:last-child { border-bottom: 0; }
.feed .when { margin-left: auto; color: var(--ink-3); font-size: 12px; white-space: nowrap; }

/* ---------- Alerts page ---------- */
.alert-section { margin-bottom: 18px; }
.alert-section .row { display: grid; grid-template-columns: 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--line); }
.alert-section .row:last-child { border-bottom: 0; }
.alert-section .row .l { min-width: 0; }
.alert-section .row .t { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.alert-section .row .d { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; }
.alert-section .actions { display: flex; gap: 6px; }
.count-badge { display: inline-grid; place-items: center; min-width: 24px; height: 24px; padding: 0 7px; border-radius: 12px; font-size: 12px; font-weight: 700; }

/* ---------- Drawer ---------- */
.scrim { position: fixed; inset: 0; background: rgba(11,11,11,0.35); z-index: 60; opacity: 0; pointer-events: none; transition: opacity .15s; }
.scrim.show { opacity: 1; pointer-events: auto; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: 540px; max-width: 100vw; background: var(--surface); z-index: 70; transform: translateX(100%); transition: transform .2s; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.drawer.show { transform: none; }
.drawer-head { padding: 16px 20px 12px; border-bottom: 1px solid var(--line); }
.drawer-head .row1 { display: flex; align-items: flex-start; gap: 10px; }
.drawer-head h2 { font-size: 18px; flex: 1; }
.drawer-head .id { font-size: 12px; color: var(--ink-3); }
.drawer-body { overflow-y: auto; padding: 16px 20px 40px; flex: 1; }
.stepper { display: flex; gap: 4px; margin-top: 12px; }
.stepper button { flex: 1; height: 30px; border: 0; border-radius: 6px; background: var(--surface-3); color: var(--ink-2); font-size: 12px; font-weight: 600; }
.stepper button.done { background: var(--primary-soft); color: var(--primary-text); }
.stepper button.cur { background: var(--primary); color: #fff; }
.stepper button.cur.bound { background: var(--good); } .stepper button.cur.lost { background: var(--st-lost); }
.quick-row { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }
.numbers { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 14px 0; }
.numbers > div { background: var(--surface-2); border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; }
.numbers .k { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--ink-3); font-weight: 600; }
.numbers .v { font-weight: 700; font-size: 14px; margin-top: 2px; }
.fields { display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; }
.field { display: flex; flex-direction: column; gap: 4px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 11.5px; font-weight: 600; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; }
.field input, .field select, .field textarea { height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); outline: none; width: 100%; }
.field textarea { height: auto; min-height: 72px; padding: 8px 10px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.field .req { color: var(--crit); }
.field .hint { font-size: 11.5px; color: var(--ink-3); }
.section-title { margin: 20px 0 10px; display: flex; align-items: center; justify-content: space-between; }
.activity .item { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); font-size: 13px; }
.activity .item:last-child { border-bottom: 0; }
.activity .ic { width: 24px; height: 24px; border-radius: 50%; background: var(--surface-3); display: grid; place-items: center; flex: none; font-size: 11px; }
.activity .when { color: var(--ink-3); font-size: 12px; margin-left: auto; white-space: nowrap; }
.note-box { display: flex; gap: 8px; margin-top: 10px; }
.note-box input { flex: 1; height: 36px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); outline: none; }
.note-box input:focus { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.followup-quick { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 80; display: none; align-items: flex-start; justify-content: center; padding: 60px 16px; overflow-y: auto; }
.modal.show { display: flex; }
.modal .box { background: var(--surface); border-radius: 16px; width: 560px; max-width: 100%; box-shadow: var(--shadow-lg); border: 1px solid var(--line); }
.modal .box-head { padding: 18px 22px 0; display: flex; align-items: center; justify-content: space-between; }
.modal .box-body { padding: 16px 22px 22px; }
.modal .box-foot { padding: 14px 22px; border-top: 1px solid var(--line); display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.stage-seg { display: flex; gap: 4px; }
.stage-seg button { flex: 1; height: 34px; border: 1px solid var(--line); background: var(--surface); border-radius: 8px; font-weight: 600; font-size: 12.5px; color: var(--ink-2); }
.stage-seg button.active { background: var(--primary); border-color: var(--primary); color: #fff; }
details.more { margin-top: 14px; }
details.more summary { cursor: pointer; font-weight: 600; color: var(--primary-text); list-style: none; display: flex; align-items: center; gap: 6px; font-size: 13px; }
details.more summary::-webkit-details-marker { display: none; }
details.more[open] summary svg { transform: rotate(90deg); }
details.more summary svg { width: 14px; height: 14px; transition: transform .12s; }
details.more .fields { margin-top: 12px; }

/* ---------- Settings ---------- */
.settings-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
@media (max-width: 980px) { .settings-grid { grid-template-columns: 1fr; } }
.list-editor { display: flex; flex-direction: column; gap: 6px; }
.list-editor .li { display: grid; grid-template-columns: 1fr auto; gap: 6px; align-items: center; }
.list-editor .li.three { grid-template-columns: 1fr 160px 90px auto; }
.list-editor .li.producer { grid-template-columns: 1fr 150px 120px auto; }
.list-editor input, .list-editor select { height: 34px; padding: 0 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); outline: none; width: 100%; }
.list-editor input:focus, .list-editor select:focus { border-color: var(--primary); }
.list-editor .x { width: 30px; height: 30px; border: 0; background: none; color: var(--ink-3); border-radius: 6px; font-size: 16px; }
.list-editor .x:hover { background: var(--crit-soft); color: var(--crit-text); }
.list-editor .hdr { font-size: 11px; color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }

/* ---------- Toast / misc ---------- */
.toast { position: fixed; left: 50%; bottom: 28px; transform: translateX(-50%) translateY(80px); background: var(--ink); color: var(--surface); padding: 10px 16px; border-radius: 10px; font-weight: 500; z-index: 90; box-shadow: var(--shadow-lg); transition: transform .18s; display: flex; gap: 12px; align-items: center; }
.toast.show { transform: translateX(-50%) translateY(0); }
.toast button { background: none; border: 0; color: var(--st-lead); font-weight: 700; }
.empty { padding: 36px; text-align: center; color: var(--ink-3); }
.demo-banner { font-size: 11.5px; color: var(--ink-3); background: var(--surface-2); border: 1px dashed var(--line-2); border-radius: 8px; padding: 6px 10px; margin-bottom: 16px; }
.inline-select { height: 28px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface); padding: 0 8px; font-size: 12.5px; }

/* ---------- Mobile ---------- */
@media (max-width: 860px) {
  .app { grid-template-columns: minmax(0, 1fr); }
  .topbar { min-width: 0; gap: 8px; padding: 0 10px; }
  #newDealBtn span { display: none; }
  #newDealBtn { padding: 0 10px; }
  #themeBtn, #syncState { display: none; }
  .board-toolbar .muted { display: none; }
  .alert-section .row { grid-template-columns: 1fr; }
  .alert-section .actions { flex-wrap: wrap; }
  .toast { bottom: 84px; max-width: calc(100vw - 24px); }
  .sidebar { position: fixed; top: auto; bottom: 0; left: 0; right: 0; height: auto; flex-direction: row; justify-content: space-around; padding: 6px 4px calc(6px + env(safe-area-inset-bottom)); border-right: 0; border-top: 1px solid var(--line); z-index: 30; }
  .sidebar .foot { display: none; }
  .nav-btn { flex-direction: column; gap: 3px; padding: 6px 4px; font-size: 10.5px; width: auto; position: relative; }
  .nav-btn .badge { position: absolute; top: 0; right: 4px; margin: 0; min-width: 16px; height: 16px; font-size: 10px; }
  .brand { min-width: 0; gap: 8px; } .brand-sub { display: none; } .brand .logo { height: 24px; }
  .search { display: none; }
  .search.mobile-open { display: block; position: fixed; top: 56px; left: 8px; right: 8px; z-index: 35; }
  .viewer select { max-width: 110px; }
  .main { padding: 16px 12px 90px; }
  .board { display: flex; overflow-x: auto; scroll-snap-type: x mandatory; gap: 10px; padding-bottom: 8px; }
  .col { min-width: 84vw; scroll-snap-align: start; }
  .tiles { grid-template-columns: 1fr 1fr; }
  .tile .value { font-size: 20px; }
  .numbers { grid-template-columns: repeat(3, 1fr); }
  .fields { grid-template-columns: 1fr; }
  .drawer { width: 100vw; }
  .hbar-row { grid-template-columns: 90px 1fr 110px; }
  .goal-row { grid-template-columns: 90px 1fr 60px; }
  .page-head h1 { font-size: 19px; }
}
@media print { .sidebar, .topbar, .drop-bar, .toast { display: none !important; } .app { grid-template-columns: 1fr; } }

/* ---------- Login / boot ---------- */
.login { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; background: var(--page); padding: 16px; }
.login[hidden] { display: none; }
.login-box { width: 380px; max-width: 100%; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 28px 28px 24px; box-shadow: var(--shadow); }
.login-err { margin-top: 10px; background: var(--crit-soft); color: var(--crit-text); border-radius: 8px; padding: 8px 10px; font-size: 13px; }
.boot { position: fixed; inset: 0; z-index: 99; display: grid; place-items: center; background: var(--page); }
.boot[hidden] { display: none; }
@keyframes pulse { 0%,100% { opacity: .5 } 50% { opacity: 1 } }
.viewer-menu { position: absolute; right: 0; top: 42px; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); min-width: 220px; z-index: 50; padding: 6px; }
.viewer-menu .who { padding: 8px 10px; font-size: 12px; color: var(--ink-3); border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.viewer-menu button { display: block; width: 100%; text-align: left; border: 0; background: none; padding: 8px 10px; border-radius: 7px; font-weight: 500; }
.viewer-menu button:hover { background: var(--surface-2); }
.sync { font-size: 11px; color: var(--ink-3); }
.sync.err { color: var(--crit-text); }
.card.locked { cursor: default; }

.nav-btn[hidden], .sync:empty { display: none !important; }
.nav-btn .badge[hidden] { display: none !important; }

/* ---------- Line picker (multi-select) ---------- */
.picker { position: relative; }
.picker-btn { width: 100%; min-height: 36px; display: flex; align-items: center; gap: 6px; padding: 4px 8px 4px 6px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); text-align: left; }
.picker-btn:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.picker-btn.invalid { border-color: var(--crit); box-shadow: 0 0 0 3px var(--crit-soft); }
.picker-btn:disabled { opacity: .7; cursor: default; }
.picker-btn svg { width: 14px; height: 14px; margin-left: auto; color: var(--ink-3); flex: none; }
.picker-chips { display: flex; flex-wrap: wrap; gap: 4px; flex: 1; }
.pick-chip { background: var(--primary-soft); color: var(--primary-text); border-radius: 6px; padding: 2px 8px; font-size: 12.5px; font-weight: 600; }
.picker-pop { position: absolute; left: 0; right: 0; top: calc(100% + 4px); z-index: 90; background: var(--surface); border: 1px solid var(--line); border-radius: 10px; box-shadow: var(--shadow-lg); padding: 8px; }
.picker-search { width: 100%; height: 32px; padding: 0 10px; border: 1px solid var(--line); border-radius: 7px; background: var(--surface-2); outline: none; margin-bottom: 6px; }
.picker-search:focus { border-color: var(--primary); }
.pick-groups { max-height: 280px; overflow-y: auto; }
.pick-group-h { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; padding: 8px 6px 4px; display: flex; align-items: center; gap: 6px; }
.pick-opt { display: flex; align-items: center; gap: 8px; padding: 5px 6px; border-radius: 6px; cursor: pointer; font-size: 13.5px; }
.pick-opt:hover { background: var(--surface-2); }
.pick-opt input { width: 15px; height: 15px; accent-color: var(--primary); }
.picker-foot { display: flex; justify-content: flex-end; padding-top: 6px; border-top: 1px solid var(--line); margin-top: 4px; }
.card .line .line-text { flex: 1; min-width: 0; }
.field .pick-opt, .field .pick-opt span { text-transform: none; letter-spacing: 0; font-size: 13.5px; font-weight: 500; color: var(--ink); }
.field .pick-group-h { font-size: 11px; }

/* ---------- duplicate-company notes ---------- */
.dup-note { margin-top: 6px; border-radius: 8px; padding: 8px 10px; font-size: 12.5px; line-height: 1.4; }
.dup-note.block { background: var(--crit-soft); color: var(--crit-text); }
.dup-note.warn { background: var(--warn-soft); color: var(--warn-text); }
.dup-note a { color: inherit; text-decoration: underline; font-weight: 600; }
.field input.invalid { border-color: var(--crit); box-shadow: 0 0 0 3px var(--crit-soft); }

/* ---------- Team dashboard on a phone ---------- */
.team-cards { display: none; }
.grid-2 > .panel, .grid-3 > .panel { min-width: 0; }
.panel .table-wrap { max-width: 100%; }
@media (max-width: 860px) {
  .team-table { display: none; }
  .team-cards { display: grid; gap: 10px; }
  .team-card { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 12px 14px; cursor: pointer; }
  .team-card.total { background: var(--surface-2); cursor: default; }
  .tc-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
  .tc-head strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .tc-go { font-weight: 700; font-size: 15px; }
  .tc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px 10px; }
  .tc-grid div { display: flex; flex-direction: column; }
  .tc-grid span { font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; color: var(--ink-3); font-weight: 600; }
  .tc-grid b { font-size: 14px; font-variant-numeric: tabular-nums; }
  .legend { flex-direction: column; gap: 6px; }
  .hbar-row .val { font-size: 12px; }
}
