/* ============================================================
   KIC CRM — design tokens + components
   Dual theme: Mission Control (dark) + Daybook (light)
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&family=Inter+Tight:wght@500;600;700;800&family=JetBrains+Mono:wght@400;500;600&display=swap');

:root {
  /* Type */
  --f-ui:    'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --f-disp:  'Inter Tight', 'Inter', sans-serif;
  --f-mono:  'JetBrains Mono', 'SF Mono', Menlo, monospace;

  /* Spacing */
  --s-1: 4px; --s-2: 8px; --s-3: 12px; --s-4: 16px;
  --s-5: 20px; --s-6: 24px; --s-7: 32px; --s-8: 40px;
  --s-9: 56px; --s-10: 80px;

  /* Radius */
  --r-1: 2px; --r-2: 4px; --r-3: 6px; --r-4: 8px; --r-5: 12px; --r-pill: 9999px;

  /* Density (overridden by [data-density]) */
  --row-h: 36px;
  --pad-card: 20px;
  --pad-cell: 12px 14px;
  --gap-grid: 16px;

  /* Layout */
  --sb-w: 240px;
  --sb-w-compact: 64px;
  --top-h: 56px;

  /* Accent (overridden by [data-accent]) */
  --accent:        #f97316; /* KIC orange */
  --accent-soft:   rgba(249,115,22,.12);
  --accent-ring:   rgba(249,115,22,.35);
  --accent-on:     #2a1305;

  --gold:          #c9a84c;

  /* Status colors — same in both themes (intent-driven) */
  --c-new:   #6366f1;   /* indigo */
  --c-review:#3b82f6;   /* blue */
  --c-kiv:   #9d6cff;   /* violet */
  --c-inv:   #14a87a;   /* emerald */
  --c-hold:  #b89039;   /* amber */
  --c-dorm:  #6b7280;   /* gray */
  --c-rej:   #ef4444;   /* red */
  --c-hot:   #ff6a3d;
  --c-warm:  #f5a524;
  --c-cool:  #3b82f6;

  --t-fast: 130ms;
  --t-med:  220ms;
  --ease: cubic-bezier(.2,0,0,1);
}

/* ── Density modifiers ──────────────────────────────────── */
[data-density="compact"]     { --row-h: 30px; --pad-card: 14px; --pad-cell: 8px 12px; --gap-grid: 12px; }
[data-density="comfortable"] { --row-h: 44px; --pad-card: 24px; --pad-cell: 16px 18px; --gap-grid: 20px; }

/* ── Accent modifiers ───────────────────────────────────── */
[data-accent="gold"]   { --accent:#c9a84c; --accent-soft:rgba(201,168,76,.14); --accent-ring:rgba(201,168,76,.4); --accent-on:#231a05; }
[data-accent="teal"]   { --accent:#0ea5a5; --accent-soft:rgba(14,165,165,.14); --accent-ring:rgba(14,165,165,.4); --accent-on:#06302f; }
[data-accent="indigo"] { --accent:#6366f1; --accent-soft:rgba(99,102,241,.14); --accent-ring:rgba(99,102,241,.4); --accent-on:#1a1d4a; }

/* ── Theme: dark (default) — Mission Control ────────────── */
[data-theme="dark"] {
  --bg:            #0a1226;
  --surface:       #0f1830;
  --surface-2:     #15203c;
  --surface-3:     #1b294a;
  --surface-hi:    #233561;
  --text:          #e6ecff;
  --text-2:        #a8b3d4;
  --text-3:        #6a7596;
  --line:          #1f2b4a;
  --line-2:        #2a3a64;
  --line-strong:   #3a4c7f;
  --selected:      rgba(249,115,22,.10);
  --hover:         rgba(166,179,212,.06);
  --shadow-soft:   0 1px 0 rgba(255,255,255,.02), 0 8px 24px -8px rgba(0,0,0,.5);
  --shadow-pop:    0 12px 40px -8px rgba(0,0,0,.7), 0 0 0 1px var(--line-2);
  --kbd-bg:        #1b294a;
  --kbd-line:      #314673;
}

/* ── Theme: light — Daybook ─────────────────────────────── */
[data-theme="light"] {
  --bg:            #f6f2ea;
  --surface:       #fbf8f2;
  --surface-2:     #f1ece1;
  --surface-3:     #e7e0d2;
  --surface-hi:    #ddd3c0;
  --text:          #1a1612;
  --text-2:        #4d4639;
  --text-3:        #7e7361;
  --line:          #e4dccb;
  --line-2:        #d6cdb8;
  --line-strong:   #b8ad94;
  --selected:      rgba(249,115,22,.12);
  --hover:         rgba(26,22,18,.04);
  --shadow-soft:   0 1px 0 rgba(255,255,255,.6), 0 6px 20px -10px rgba(60,40,15,.18);
  --shadow-pop:    0 12px 36px -8px rgba(60,40,15,.25), 0 0 0 1px var(--line-2);
  --kbd-bg:        #efe9d8;
  --kbd-line:      #cdc2a8;
}

/* ── Base ───────────────────────────────────────────────── */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--f-ui);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
button, input, select, textarea { font-family: inherit; color: inherit; }
button { background: none; border: 0; cursor: pointer; padding: 0; }
a { color: inherit; text-decoration: none; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.eyebrow {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.1em;
  text-transform: uppercase; color: var(--text-3);
}
.h-display {
  font-family: var(--f-disp); font-weight: 700;
  letter-spacing: -0.02em; line-height: 1.1;
}
.txt-2 { color: var(--text-2); }
.txt-3 { color: var(--text-3); }
.divider { height: 1px; background: var(--line); margin: var(--s-4) 0; }
.vline { width: 1px; background: var(--line); align-self: stretch; }

/* ── App grid ───────────────────────────────────────────── */
.app {
  display: grid;
  grid-template-columns: var(--sb-w) 1fr;
  grid-template-rows: var(--top-h) 1fr;
  grid-template-areas: "sb top" "sb main";
  height: 100vh;
  width: 100vw;
}
[data-sidebar="compact"] .app { grid-template-columns: var(--sb-w-compact) 1fr; }
[data-sidebar="bracketed"] .app { grid-template-columns: 200px 1fr; }

/* ── Sidebar ────────────────────────────────────────────── */
.sb {
  grid-area: sb;
  background: var(--surface);
  border-right: 1px solid var(--line);
  display: flex; flex-direction: column;
  padding: 14px 10px 12px;
  overflow: hidden;
  position: relative;
}
.sb__brand {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px 18px;
}
.sb__brand-mark {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent); color: var(--accent-on);
  border-radius: var(--r-2);
  font-family: var(--f-disp); font-weight: 800; font-size: 14px;
  letter-spacing: -.04em;
  flex-shrink: 0;
}
.sb__brand-name {
  font-family: var(--f-disp); font-weight: 800; font-size: 15px;
  letter-spacing: -.01em; color: var(--text);
}
.sb__brand-sub {
  font-size: 9.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-3);
  margin-top: 1px;
}
[data-sidebar="compact"] .sb__brand-name,
[data-sidebar="compact"] .sb__brand-sub { display: none; }
[data-sidebar="bracketed"] .sb__brand-mark { display: none; }

.sb__section {
  display: flex; flex-direction: column; gap: 1px;
  margin-bottom: var(--s-4);
}
.sb__section-label {
  font-size: 9.5px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-3);
  padding: 12px 10px 6px;
}
[data-sidebar="compact"] .sb__section-label { display: none; }
.sb__item {
  display: flex; align-items: center; gap: 10px;
  padding: 8px 10px;
  border-radius: var(--r-3);
  color: var(--text-2);
  font-size: 13.5px; font-weight: 500;
  cursor: pointer;
  transition: color var(--t-fast), background var(--t-fast);
  position: relative;
}
.sb__item:hover { background: var(--hover); color: var(--text); }
.sb__item--active {
  background: var(--accent-soft);
  color: var(--accent);
  font-weight: 600;
}
.sb__item--active::before {
  content: ""; position: absolute; left: -10px; top: 8px; bottom: 8px;
  width: 3px; background: var(--accent); border-radius: 0 var(--r-1) var(--r-1) 0;
}
.sb__item-icon { width: 16px; height: 16px; flex-shrink: 0; }
.sb__item-count {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 10.5px; font-weight: 600;
  color: var(--text-3);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: var(--r-pill);
}
.sb__item--active .sb__item-count { color: var(--accent); background: transparent; }
[data-sidebar="compact"] .sb__item { justify-content: center; padding: 10px; }
[data-sidebar="compact"] .sb__item-label,
[data-sidebar="compact"] .sb__item-count { display: none; }
[data-sidebar="bracketed"] .sb__item-icon { display: none; }
[data-sidebar="bracketed"] .sb__item { padding: 7px 10px; }
[data-sidebar="bracketed"] .sb__item--active::before { left: 0; }

.sb__recent {
  margin-top: auto;
  border-top: 1px solid var(--line);
  padding-top: 10px;
}
[data-sidebar="compact"] .sb__recent { display: none; }

.sb__recent-item {
  display: block; padding: 5px 10px;
  font-size: 12.5px; color: var(--text-2);
  cursor: pointer; border-radius: var(--r-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.sb__recent-item:hover { background: var(--hover); color: var(--text); }
.sb__recent-flag {
  font-family: var(--f-mono); font-size: 10px;
  color: var(--text-3); margin-right: 6px;
}

/* ── Topbar ─────────────────────────────────────────────── */
.top {
  grid-area: top;
  display: flex; align-items: center;
  padding: 0 var(--s-5);
  gap: var(--s-4);
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  z-index: 30;
}
.top__crumbs {
  display: flex; align-items: center; gap: 6px;
  font-size: 13px; color: var(--text-2);
}
.top__crumb-sep { color: var(--text-3); }
.top__crumb-current {
  color: var(--text); font-weight: 600;
}
.top__back {
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-2);
  color: var(--text-2);
}
.top__back:hover { background: var(--hover); color: var(--text); }
.top__back:disabled { opacity: .35; cursor: not-allowed; }

.top__search {
  flex: 1;
  max-width: 520px;
  position: relative;
  margin: 0 var(--s-3);
}
.top__search-input {
  width: 100%;
  height: 32px;
  padding: 0 12px 0 34px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
  color: var(--text);
  font-size: 13px;
  outline: none;
  transition: border-color var(--t-fast);
}
.top__search-input:focus { border-color: var(--accent); }
.top__search-icon {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  color: var(--text-3); pointer-events: none;
}
.top__search-kbd {
  position: absolute; right: 8px; top: 50%; transform: translateY(-50%);
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--text-3); pointer-events: none;
}
.top__right { display: flex; align-items: center; gap: 6px; margin-left: auto; }
.top__icon-btn {
  width: 30px; height: 30px;
  display: flex; align-items: center; justify-content: center;
  border-radius: var(--r-2); color: var(--text-2);
  position: relative;
}
.top__icon-btn:hover { background: var(--hover); color: var(--text); }
.top__icon-dot {
  position: absolute; top: 6px; right: 6px;
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent);
  border: 2px solid var(--surface);
}
.top__user {
  margin-left: var(--s-3);
  display: flex; align-items: center; gap: 8px;
  padding: 4px 10px 4px 4px;
  border-radius: var(--r-pill);
}
.top__user:hover { background: var(--hover); }
.top__avatar {
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--accent); color: var(--accent-on);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 700;
}
.top__user-name { font-size: 12.5px; font-weight: 600; }
.top__user-role { font-size: 10px; color: var(--text-3); letter-spacing: .04em; text-transform: uppercase; }

/* ── Main ───────────────────────────────────────────────── */
.main {
  grid-area: main;
  overflow: auto;
  background: var(--bg);
  position: relative;
}
.page {
  padding: var(--s-6) var(--s-7);
  max-width: 1480px;
}
.page--full { max-width: none; padding: 0; }

.page-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  margin-bottom: var(--s-6);
  gap: var(--s-4);
}
.page-title {
  font-family: var(--f-disp); font-weight: 700;
  font-size: 28px; letter-spacing: -0.02em; line-height: 1.1;
}
.page-sub {
  margin-top: 4px;
  color: var(--text-2); font-size: 13.5px;
}

/* ── Cards ──────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  padding: var(--pad-card);
  position: relative;
}
.card--bare { padding: 0; overflow: hidden; }
.card--ghost { background: transparent; }
.card__head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  gap: var(--s-3);
}
.card__title {
  font-size: 11px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-2);
}
.card__sub { font-size: 12px; color: var(--text-3); }
.card__body { padding: 16px 18px; }

/* ── Grid helpers ───────────────────────────────────────── */
.grid { display: grid; gap: var(--gap-grid); }
.grid-4 { grid-template-columns: repeat(4, 1fr); }
.grid-3 { grid-template-columns: repeat(3, 1fr); }
.grid-2 { grid-template-columns: 1fr 1fr; }
.grid-2-3 { grid-template-columns: 2fr 3fr; }
.grid-3-2 { grid-template-columns: 3fr 2fr; }
.grid-1-2 { grid-template-columns: 1fr 2fr; }
.row { display: flex; gap: var(--s-3); align-items: center; }
.row-tight { display: flex; gap: 6px; align-items: center; }
.col { display: flex; flex-direction: column; gap: var(--s-3); }
.spread { display: flex; justify-content: space-between; align-items: center; gap: var(--s-3); }
.stack > * + * { margin-top: var(--s-3); }

/* ── Buttons ────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px;
  font-size: 13px; font-weight: 600;
  border-radius: var(--r-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--text);
  transition: background var(--t-fast), border-color var(--t-fast), transform var(--t-fast);
  white-space: nowrap;
}
.btn:hover { background: var(--surface-3); border-color: var(--line-2); }
.btn:active { transform: scale(.97); }
.btn--primary {
  background: var(--accent); color: var(--accent-on);
  border-color: var(--accent);
  font-weight: 700;
}
.btn--primary:hover { background: var(--accent); filter: brightness(1.06); }
.btn--ghost { background: transparent; border-color: transparent; color: var(--text-2); }
.btn--ghost:hover { background: var(--hover); color: var(--text); border-color: transparent; }
.btn--sm { padding: 4px 8px; font-size: 12px; }
.btn--icon { width: 30px; height: 30px; padding: 0; justify-content: center; }
.btn-kbd {
  font-family: var(--f-mono); font-size: 10.5px;
  background: var(--kbd-bg); border: 1px solid var(--kbd-line);
  color: var(--text-2);
  padding: 1px 5px; border-radius: var(--r-1);
  margin-left: auto;
}

/* ── Stat cards ─────────────────────────────────────────── */
.stat {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  padding: 14px 18px;
  position: relative;
  overflow: hidden;
}
.stat__label {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3);
}
.stat__value {
  font-family: var(--f-disp); font-weight: 800;
  font-size: 30px; letter-spacing: -.02em; line-height: 1.1;
  margin-top: 4px;
  font-variant-numeric: tabular-nums;
}
.stat__sub {
  font-family: var(--f-mono); font-size: 11.5px;
  color: var(--text-3);
  margin-top: 6px;
  display: flex; gap: 10px; align-items: center;
}
.stat__delta--up { color: var(--c-inv); }
.stat__delta--dn { color: var(--c-rej); }
.stat__delta--neutral { color: var(--text-3); }
.stat__bar {
  height: 3px; background: var(--surface-2);
  border-radius: var(--r-pill);
  margin-top: 12px; overflow: hidden;
}
.stat__bar-fill {
  height: 100%; background: var(--accent);
  border-radius: var(--r-pill);
  transition: width var(--t-med);
}

/* ── Chips ──────────────────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 2px 7px;
  font-size: 10.5px; font-weight: 700; letter-spacing: .06em;
  text-transform: uppercase;
  border-radius: var(--r-1);
  white-space: nowrap;
  border: 1px solid transparent;
  background: var(--surface-2);
  color: var(--text-2);
}
.chip--new    { color: var(--c-new);    background: rgba(99,102,241,.10);  border-color: rgba(99,102,241,.28); }
.chip--review { color: var(--c-review); background: rgba(59,130,246,.10);  border-color: rgba(59,130,246,.28); }
.chip--kiv    { color: var(--c-kiv);    background: rgba(157,108,255,.10); border-color: rgba(157,108,255,.28); }
.chip--inv    { color: var(--c-inv);    background: rgba(20,168,122,.10);  border-color: rgba(20,168,122,.28); }
.chip--hold   { color: var(--c-hold);   background: rgba(184,144,57,.10);  border-color: rgba(184,144,57,.28); }
.chip--dorm   { color: var(--c-dorm);   background: rgba(107,114,128,.10); border-color: rgba(107,114,128,.28); }
.chip--rej    { color: var(--c-rej);    background: rgba(239,68,68,.10);   border-color: rgba(239,68,68,.28); }
.chip--hot    { color: var(--c-hot);    background: rgba(255,106,61,.10);  border-color: rgba(255,106,61,.28); }
.chip--warm   { color: var(--c-warm);   background: rgba(245,165,36,.10);  border-color: rgba(245,165,36,.28); }
.chip--cool   { color: var(--c-cool);   background: rgba(59,130,246,.10);  border-color: rgba(59,130,246,.28); }
.chip--accent { color: var(--accent);   background: var(--accent-soft);    border-color: var(--accent-ring); }

.chip-dot {
  width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex-shrink: 0;
}

/* ── Country pill (no emoji flags) ──────────────────────── */
.geo {
  display: inline-flex; align-items: center; gap: 4px;
  font-family: var(--f-mono);
  font-size: 10.5px; font-weight: 600;
  color: var(--text-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  padding: 1px 6px;
  border-radius: var(--r-1);
  letter-spacing: .03em;
}
.geo-bar {
  width: 3px; height: 10px;
  border-radius: var(--r-1);
  flex-shrink: 0;
}
.geo--sg .geo-bar { background: #ed1c24; }
.geo--my .geo-bar { background: #ffcc00; }
.geo--au .geo-bar { background: #00843d; }
.geo--hk .geo-bar { background: #de2910; }
.geo--id .geo-bar { background: #ff0000; }
.geo--th .geo-bar { background: #2d2a4a; }
.geo--us .geo-bar { background: #3c5aa6; }
.geo--uk .geo-bar { background: #cf142b; }
.geo--other .geo-bar { background: var(--text-3); }

/* ── Source provenance tag ──────────────────────────────── */
.src {
  display: inline-flex; align-items: center; gap: 5px;
  font-family: var(--f-mono);
  font-size: 10px; font-weight: 600;
  color: var(--text-3);
  padding: 1px 6px 1px 4px;
  border-radius: var(--r-1);
  background: var(--surface-2);
  border: 1px dashed var(--line-2);
  letter-spacing: .04em;
  text-transform: uppercase;
  white-space: nowrap;
}
.src::before {
  content: ""; width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-3);
}
.src--zapier::before { background: #ff4f00; }
.src--scrape::before { background: #14a87a; }
.src--manual::before { background: #6366f1; }
.src--forward::before { background: #f5a524; }
.src--api::before { background: #0ea5a5; }
.src--discovery::before { background: #9d6cff; }

/* ── Table ──────────────────────────────────────────────── */
.tbl {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 13px;
}
.tbl thead th {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase;
  color: var(--text-3);
  text-align: left;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  white-space: nowrap;
}
.tbl tbody td {
  padding: var(--pad-cell);
  border-bottom: 1px solid var(--line);
  vertical-align: middle;
  color: var(--text);
}
.tbl tbody tr { transition: background var(--t-fast); cursor: pointer; }
.tbl tbody tr:hover { background: var(--hover); }
.tbl tbody tr.is-selected { background: var(--selected); }
.tbl td.num { font-family: var(--f-mono); text-align: right; font-variant-numeric: tabular-nums; }
.tbl td.center { text-align: center; }

/* ── Kanban ─────────────────────────────────────────────── */
.kan {
  display: grid;
  grid-template-columns: repeat(7, minmax(260px, 1fr));
  gap: 12px;
  padding-bottom: 8px;
  overflow-x: auto;
}
.kan-col {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  display: flex; flex-direction: column;
  min-height: 200px;
  max-height: calc(100vh - 280px);
}
.kan-col__head {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}
.kan-col__title {
  font-size: 10.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-2);
}
.kan-col__count {
  margin-left: auto;
  font-family: var(--f-mono);
  font-size: 11px; color: var(--text-3);
}
.kan-col__total {
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--text-3);
  border-top: 1px solid var(--line);
  padding: 8px 12px;
  display: flex; justify-content: space-between;
}
.kan-col__list {
  padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
  overflow-y: auto;
  flex: 1;
}
.deal-card {
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-3);
  padding: 10px 12px;
  cursor: pointer;
  transition: background var(--t-fast), border-color var(--t-fast);
}
.deal-card:hover { background: var(--surface-3); border-color: var(--line-2); }
.deal-card.is-active { background: var(--surface-3); border-color: var(--accent); }
.deal-card__name {
  font-weight: 600; font-size: 13px; color: var(--text);
  margin-bottom: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.deal-card__meta {
  display: flex; align-items: center; gap: 6px;
  font-size: 11px; color: var(--text-3);
  font-family: var(--f-mono);
  margin-bottom: 6px;
}
.deal-card__row {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px;
}
.deal-card__size {
  font-family: var(--f-mono); font-weight: 600;
  color: var(--text);
}
.deal-card__lead {
  margin-left: auto;
  width: 18px; height: 18px;
  border-radius: 50%;
  background: var(--surface-3);
  color: var(--text-2);
  font-size: 9.5px; font-weight: 700;
  display: flex; align-items: center; justify-content: center;
  letter-spacing: 0;
}

/* col theme per status */
.kan-col[data-status="New"]         .deal-card { border-left-color: var(--c-new); }
.kan-col[data-status="Under Review"] .deal-card { border-left-color: var(--c-review); }
.kan-col[data-status="KIV"]          .deal-card { border-left-color: var(--c-kiv); }
.kan-col[data-status="Invested"]     .deal-card { border-left-color: var(--c-inv); }
.kan-col[data-status="On Hold"]      .deal-card { border-left-color: var(--c-hold); }
.kan-col[data-status="Dormant"]      .deal-card { border-left-color: var(--c-dorm); }
.kan-col[data-status="Rejected"]     .deal-card { border-left-color: var(--c-rej); }

/* ── Filter bar ─────────────────────────────────────────── */
.filter-bar {
  display: flex; align-items: center; gap: 8px;
  flex-wrap: wrap;
  margin-bottom: var(--s-4);
}
.fchip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 5px 10px;
  font-size: 12px; font-weight: 500;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-2);
  border-radius: var(--r-3);
  cursor: pointer;
}
.fchip:hover { background: var(--surface-2); }
.fchip.is-active {
  background: var(--accent-soft);
  border-color: var(--accent-ring);
  color: var(--accent);
}
.fchip-cnt {
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--text-3);
}
.fchip.is-active .fchip-cnt { color: var(--accent); }
.seg {
  display: inline-flex;
  padding: 2px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-3);
}
.seg__item {
  padding: 4px 10px;
  font-size: 11.5px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2);
  border-radius: var(--r-2);
}
.seg__item:hover { color: var(--text); }
.seg__item.is-active { background: var(--surface); color: var(--text); box-shadow: 0 1px 0 rgba(0,0,0,.08); }

/* ── Command palette ────────────────────────────────────── */
.cmd-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,10,25,.6);
  backdrop-filter: blur(6px);
  z-index: 100;
  display: flex; align-items: flex-start; justify-content: center;
  padding-top: 88px;
}
[data-theme="light"] .cmd-backdrop { background: rgba(40,30,15,.35); }

.cmd {
  width: 100%; max-width: 580px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-5);
  box-shadow: var(--shadow-pop);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.cmd__input {
  width: 100%;
  padding: 16px 20px 16px 48px;
  background: transparent;
  border: 0;
  font-size: 16px;
  color: var(--text);
  outline: none;
  border-bottom: 1px solid var(--line);
  position: relative;
}
.cmd__wrap { position: relative; }
.cmd__wrap::before {
  content: "";
  position: absolute; left: 20px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px;
  background: var(--text-3);
  -webkit-mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M11 19a8 8 0 1 1 0-16 8 8 0 0 1 0 16ZM21 21l-4.3-4.3' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round'/></svg>") center/contain no-repeat;
          mask: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'><path d='M11 19a8 8 0 1 1 0-16 8 8 0 0 1 0 16ZM21 21l-4.3-4.3' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round'/></svg>") center/contain no-repeat;
}
.cmd__list { max-height: 400px; overflow-y: auto; padding: 6px; }
.cmd__section {
  font-size: 10px; font-weight: 700; letter-spacing: .14em;
  text-transform: uppercase; color: var(--text-3);
  padding: 12px 14px 6px;
}
.cmd__item {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 12px;
  border-radius: var(--r-3);
  cursor: pointer;
  font-size: 13.5px;
}
.cmd__item.is-active { background: var(--accent-soft); color: var(--accent); }
.cmd__item-icon { width: 16px; height: 16px; color: var(--text-3); flex-shrink: 0; }
.cmd__item.is-active .cmd__item-icon { color: var(--accent); }
.cmd__item-label { flex: 1; }
.cmd__item-meta {
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--text-3);
}
.cmd__foot {
  display: flex; gap: 16px; align-items: center;
  padding: 10px 16px;
  border-top: 1px solid var(--line);
  background: var(--surface-2);
  font-size: 11px; color: var(--text-3);
}
.cmd-kbd {
  font-family: var(--f-mono); font-size: 10px;
  background: var(--kbd-bg); border: 1px solid var(--kbd-line);
  color: var(--text-2);
  padding: 1px 5px; border-radius: var(--r-1);
}

/* ── Drawer (deal detail) ───────────────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0;
  background: rgba(5,10,25,.45);
  z-index: 90;
  animation: fade .12s var(--ease);
}
[data-theme="light"] .drawer-backdrop { background: rgba(40,30,15,.30); }
.drawer {
  position: fixed; right: 0; top: 0; bottom: 0;
  width: min(720px, 86vw);
  background: var(--bg);
  border-left: 1px solid var(--line-2);
  box-shadow: var(--shadow-pop);
  z-index: 95;
  display: flex; flex-direction: column;
  animation: slide-in .22s var(--ease);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes slide-in {
  from { transform: translateX(40px); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ── Tweaks panel ───────────────────────────────────────── */
.tweaks {
  position: fixed; right: 16px; bottom: 16px;
  width: 280px;
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: var(--r-5);
  box-shadow: var(--shadow-pop);
  z-index: 120;
  overflow: hidden;
}
.tweaks__head {
  padding: 10px 14px;
  border-bottom: 1px solid var(--line);
  display: flex; justify-content: space-between; align-items: center;
  cursor: grab;
}
.tweaks__title {
  font-family: var(--f-disp); font-weight: 700; font-size: 13px;
}
.tweaks__body { padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.tweaks__row { display: flex; flex-direction: column; gap: 6px; }
.tweaks__label {
  font-size: 10px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase; color: var(--text-3);
}
.tweaks__opts { display: flex; gap: 4px; }
.tweaks__opt {
  flex: 1;
  padding: 6px 8px;
  font-size: 11.5px; font-weight: 600;
  border: 1px solid var(--line);
  border-radius: var(--r-2);
  color: var(--text-2);
  background: var(--surface-2);
  cursor: pointer;
}
.tweaks__opt.is-active {
  background: var(--accent-soft); color: var(--accent);
  border-color: var(--accent-ring);
}
.tweaks__swatches { display: flex; gap: 8px; }
.tweaks__swatch {
  width: 26px; height: 26px; border-radius: 50%;
  border: 2px solid var(--line);
  cursor: pointer;
  position: relative;
}
.tweaks__swatch.is-active { border-color: var(--text); }
.tweaks__swatch.is-active::after {
  content: ""; position: absolute; inset: -5px;
  border: 1px solid var(--text); border-radius: 50%;
}

/* ── Toast ──────────────────────────────────────────────── */
.toast-stack {
  position: fixed; top: 70px; right: 16px;
  z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-left: 3px solid var(--accent);
  border-radius: var(--r-3);
  padding: 10px 16px 10px 12px;
  font-size: 13px;
  min-width: 240px;
  box-shadow: var(--shadow-pop);
  animation: slide-in .2s var(--ease);
}

/* ── Inbox ──────────────────────────────────────────────── */
.inbox {
  display: grid;
  grid-template-columns: 380px 1fr;
  height: calc(100vh - var(--top-h));
}
.inbox__list {
  border-right: 1px solid var(--line);
  background: var(--surface);
  overflow-y: auto;
}
.inbox__filters {
  display: flex; gap: 4px;
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0;
  background: var(--surface);
  z-index: 2;
}
.inbox__filter {
  padding: 4px 8px;
  font-size: 11px; font-weight: 600; letter-spacing: .04em;
  text-transform: uppercase;
  color: var(--text-2);
  border-radius: var(--r-2);
  cursor: pointer;
}
.inbox__filter.is-active { background: var(--accent-soft); color: var(--accent); }
.inbox__row {
  padding: 12px 14px;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  display: flex; gap: 10px;
  position: relative;
}
.inbox__row:hover { background: var(--hover); }
.inbox__row.is-active { background: var(--selected); }
.inbox__row.is-active::before {
  content: ""; position: absolute; left: 0; top: 0; bottom: 0;
  width: 3px; background: var(--accent);
}
.inbox__row-unread {
  width: 6px; height: 6px; margin-top: 7px;
  border-radius: 50%;
  background: var(--accent);
  flex-shrink: 0;
}
.inbox__row-body { flex: 1; min-width: 0; }
.inbox__row-from {
  display: flex; align-items: center; gap: 8px;
  font-size: 11.5px; color: var(--text-3);
  font-family: var(--f-mono);
  margin-bottom: 2px;
}
.inbox__row-subj {
  font-size: 13.5px; font-weight: 600;
  color: var(--text);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 3px;
}
.inbox__row-snip {
  font-size: 12px; color: var(--text-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.inbox__row-meta {
  display: flex; gap: 6px; margin-top: 6px;
}
.inbox__row-time {
  font-family: var(--f-mono); font-size: 10.5px;
  color: var(--text-3);
  margin-left: auto;
  margin-top: 1px;
}
.inbox__detail {
  background: var(--bg);
  overflow-y: auto;
  padding: var(--s-7);
}

/* ── Confidence ring ────────────────────────────────────── */
.ring {
  width: 36px; height: 36px;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--f-mono);
  font-size: 11px; font-weight: 700;
}

/* ── Heat bar (small inline bar chart) ──────────────────── */
.heat {
  display: grid; grid-template-columns: 100px 1fr 60px;
  gap: 10px; align-items: center;
  padding: 6px 0;
  font-size: 12px;
}
.heat__name { color: var(--text); }
.heat__bar { height: 6px; background: var(--surface-2); border-radius: var(--r-pill); overflow: hidden; }
.heat__bar-fill { height: 100%; background: var(--accent); border-radius: var(--r-pill); }
.heat__val { font-family: var(--f-mono); font-size: 11px; color: var(--text-2); text-align: right; }

/* ── Activity / timeline ────────────────────────────────── */
.tl { display: flex; flex-direction: column; }
.tl-item {
  display: grid; grid-template-columns: 16px 70px 1fr;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
  align-items: flex-start;
}
.tl-item:last-child { border-bottom: 0; }
.tl-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--accent);
  margin-top: 6px;
  position: relative;
  margin-left: 4px;
}
.tl-dot::before {
  content: ""; position: absolute;
  left: 50%; top: 100%;
  width: 1px; height: 36px;
  background: var(--line);
  transform: translateX(-50%);
}
.tl-item:last-child .tl-dot::before { display: none; }
.tl-time { font-family: var(--f-mono); font-size: 10.5px; color: var(--text-3); margin-top: 3px; text-align: right; }
.tl-body { font-size: 12.5px; color: var(--text); }
.tl-body strong { color: var(--text); font-weight: 600; }

/* ── Misc ───────────────────────────────────────────────── */
.scroll-x { overflow-x: auto; }
.muted { color: var(--text-3); }
.tag-list { display: flex; flex-wrap: wrap; gap: 5px; }
.kbd {
  font-family: var(--f-mono); font-size: 10.5px;
  background: var(--kbd-bg); border: 1px solid var(--kbd-line);
  color: var(--text-2);
  padding: 1px 5px; border-radius: var(--r-1);
}
.dl {
  display: grid; grid-template-columns: 140px 1fr;
  gap: 6px 16px;
  font-size: 13px;
}
.dl dt {
  font-size: 10.5px; font-weight: 700; letter-spacing: .1em;
  text-transform: uppercase; color: var(--text-3);
  padding-top: 4px;
}
.dl dd { margin: 0; color: var(--text); }

.avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10.5px; font-weight: 700;
  background: var(--surface-3); color: var(--text-2);
}
.avatar--xs { width: 20px; height: 20px; font-size: 9.5px; }
.avatar--sm { width: 22px; height: 22px; font-size: 9.5px; }
.avatar--lg { width: 40px; height: 40px; font-size: 13px; }
.avatar--D { background: rgba(99,102,241,.15);  color: #818cf8; }
.avatar--E { background: rgba(20,168,122,.18);  color: #34d399; }
.avatar--K { background: rgba(249,115,22,.18);  color: #fb923c; }
.avatar--A { background: rgba(245,165,36,.18);  color: #fbbf24; }
[data-theme="light"] .avatar--D { color: #4f46e5; background: rgba(99,102,241,.15); }
[data-theme="light"] .avatar--E { color: #0f7a52; background: rgba(20,168,122,.15); }
[data-theme="light"] .avatar--K { color: #c4530a; background: rgba(249,115,22,.15); }
[data-theme="light"] .avatar--A { color: #a37013; background: rgba(245,165,36,.15); }

.avatar-stack { display: inline-flex; }
.avatar-stack .avatar:not(:first-child) { margin-left: -6px; border: 2px solid var(--surface); }

/* ── Empty / placeholder ────────────────────────────────── */
.placeholder {
  border: 1px dashed var(--line-2);
  border-radius: var(--r-4);
  padding: 24px;
  text-align: center;
  color: var(--text-3);
  font-size: 13px;
  background: repeating-linear-gradient(
    45deg,
    transparent, transparent 8px,
    var(--surface-2) 8px, var(--surface-2) 9px
  );
}

/* ── Scrollbars ─────────────────────────────────────────── */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--surface-3); border-radius: var(--r-pill); border: 2px solid transparent; background-clip: padding-box; }
::-webkit-scrollbar-thumb:hover { background: var(--line-strong); background-clip: padding-box; border: 2px solid transparent; }

/* ── Sources panel rows (Advisory/Portfolio detail) ─────── */
.src-row {
  display: block;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  cursor: pointer;
  font-size: 12.5px;
}
.src-row:last-child { border-bottom: 0; }
.src-row:hover .src-row__title { color: var(--accent); }
.src-row__title {
  font-size: 13px;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  transition: color var(--t-fast);
}
.src-row__sub {
  font-size: 11px;
  color: var(--text-3);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.src-row__excerpt {
  font-size: 11.5px;
  color: var(--text-2);
  line-height: 1.45;
  margin-top: 3px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ── Pipeline list view ─────────────────────────────────── */
.pipe-list {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  overflow: hidden;
}

/* ── Swimlane ───────────────────────────────────────────── */
.swim { display: flex; flex-direction: column; gap: 8px; }
.swim-lane {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-4);
  overflow: hidden;
}
.swim-lane__head {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 14px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--line);
}
.swim-lane__name {
  font-family: var(--f-disp); font-weight: 700;
  font-size: 14px;
}
.swim-lane__meta {
  font-family: var(--f-mono); font-size: 11px; color: var(--text-3);
}
.swim-lane__body {
  display: flex; gap: 8px;
  padding: 8px;
  overflow-x: auto;
}
.swim-cell {
  min-width: 200px;
  flex: 1;
  background: var(--surface-2);
  border-radius: var(--r-3);
  padding: 8px;
  display: flex; flex-direction: column; gap: 6px;
}
.swim-cell__head {
  font-size: 9.5px; font-weight: 700; letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 2px;
}
