/* ============================================================
   CRM — design tokens
   ============================================================ */
:root {
  color-scheme: light;

  --plane:        #f6f6f4;
  --surface:      #ffffff;
  --surface-2:    #fbfbfa;
  --surface-3:    #f0f0ed;
  --ink:          #0b0b0b;
  --ink-2:        #52514e;
  --muted:        #898781;
  --border:       rgba(11, 11, 11, 0.10);
  --border-strong:rgba(11, 11, 11, 0.18);
  --grid:         #e8e7e2;
  --shadow:       0 1px 2px rgba(11,11,11,.05), 0 8px 24px rgba(11,11,11,.06);
  --shadow-lg:    0 2px 4px rgba(11,11,11,.06), 0 24px 64px rgba(11,11,11,.14);

  /* categorical slot 1 — every single-series chart uses this */
  --series-1:     #2a78d6;
  --series-1-wash:#e8f0fc;

  /* ordinal blue ramp (validated --ordinal, light) */
  --ord-1: #86b6ef;
  --ord-2: #5598e7;
  --ord-3: #2a78d6;
  --ord-4: #1c5cab;
  --ord-5: #104281;

  /* status — fixed, never themed */
  --good:     #0ca30c;
  --warning:  #fab219;
  --serious:  #ec835a;
  --critical: #d03b3b;
  --good-text:#006300;
  --good-wash:    #e6f6e6;
  --warning-wash: #fdf3de;
  --critical-wash:#fbe9e9;

  --accent:      #2a78d6;
  --accent-ink:  #ffffff;
  --accent-wash: #e8f0fc;

  --r-sm: 5px;  --r-md: 8px;  --r-lg: 12px;  --r-xl: 16px;
  --row-h: 40px;
  --font: system-ui, -apple-system, "Segoe UI", sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, monospace;
}

:root[data-theme="dark"] {
  color-scheme: dark;
  --plane:        #0e0f13;
  --surface:      #16181d;
  --surface-2:    #1b1e24;
  --surface-3:    #23262d;
  --ink:          #ffffff;
  --ink-2:        #c3c2b7;
  --muted:        #8d8c86;
  --border:       rgba(255, 255, 255, 0.10);
  --border-strong:rgba(255, 255, 255, 0.18);
  --grid:         #24262c;
  --shadow:       0 1px 2px rgba(0,0,0,.4), 0 8px 24px rgba(0,0,0,.4);
  --shadow-lg:    0 2px 4px rgba(0,0,0,.5), 0 24px 64px rgba(0,0,0,.6);

  --series-1:     #3987e5;
  --series-1-wash:#16283f;

  --ord-1: #b7d3f6;
  --ord-2: #86b6ef;
  --ord-3: #5598e7;
  --ord-4: #2a78d6;
  --ord-5: #184f95;

  --good-text:#0ca30c;
  --good-wash:    #102a12;
  --warning-wash: #33290f;
  --critical-wash:#331616;

  --accent:      #3987e5;
  --accent-ink:  #ffffff;
  --accent-wash: #16283f;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13.5px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--plane);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
::-webkit-scrollbar { width: 11px; height: 11px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 3px solid var(--plane); }
::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ============================================================
   Splash
   ============================================================ */
#splash {
  position: fixed; inset: 0; z-index: 999;
  display: grid; place-items: center;
  background: var(--plane);
  transition: opacity .3s;
}
#splash.gone { opacity: 0; pointer-events: none; }
.splash-inner { text-align: center; }
.splash-mark {
  width: 46px; height: 46px; border-radius: 11px; margin: 0 auto 16px;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 19px;
}
.splash-bar { width: 190px; height: 3px; border-radius: 2px; background: var(--surface-3); overflow: hidden; margin: 14px auto 0; }
.splash-bar > i { display: block; height: 100%; width: 30%; background: var(--accent); border-radius: 2px; animation: slide 1.1s ease-in-out infinite; }
@keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(333%); } }
#splash small { color: var(--muted); display: block; margin-top: 10px; }

/* ============================================================
   Shell
   ============================================================ */
#app { display: none; height: 100vh; grid-template-columns: 218px 1fr; }
#app.ready { display: grid; }

.sidebar {
  background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; min-height: 0;
}
.brand { display: flex; align-items: center; gap: 9px; padding: 14px 14px 12px; }
.brand-mark {
  width: 27px; height: 27px; border-radius: 7px; flex: none;
  background: var(--accent); color: var(--accent-ink);
  display: grid; place-items: center; font-weight: 700; font-size: 12.5px;
}
.brand-name { font-weight: 620; font-size: 13.5px; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.brand-sub { font-size: 10.5px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.nav { padding: 4px 8px; overflow-y: auto; flex: 1; min-height: 0; }
.nav-label { font-size: 10px; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); padding: 14px 8px 5px; font-weight: 600; }
.nav-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 7px 8px; border: 0; border-radius: var(--r-sm);
  background: transparent; cursor: pointer; text-align: left;
  color: var(--ink-2); font-size: 13px; font-weight: 500;
}
.nav-item:hover { background: var(--surface-3); color: var(--ink); }
.nav-item.active { background: var(--accent-wash); color: var(--accent); font-weight: 600; }
.nav-item svg { width: 15px; height: 15px; flex: none; stroke-width: 1.8; }
.nav-count { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.nav-item.active .nav-count { color: var(--accent); }
.nav-count.alert { background: var(--critical); color: #fff; padding: 0 5px; border-radius: 9px; font-weight: 600; }

.sidebar-foot { border-top: 1px solid var(--border); padding: 9px; display: flex; gap: 6px; align-items: center; }

.main { display: flex; flex-direction: column; min-width: 0; min-height: 0; }
.topbar {
  height: 52px; flex: none; display: flex; align-items: center; gap: 10px;
  padding: 0 16px; border-bottom: 1px solid var(--border); background: var(--surface);
}
.topbar h1 { font-size: 15px; font-weight: 620; margin: 0; letter-spacing: -.01em; }
.topbar .sub { font-size: 12px; color: var(--muted); }
.spacer { flex: 1; }
.view-wrap { flex: 1; overflow: auto; min-height: 0; }
.view { padding: 18px; max-width: 1500px; }
.view.flush { padding: 0; max-width: none; height: 100%; }

/* ============================================================
   Primitives
   ============================================================ */
.btn {
  display: inline-flex; align-items: center; gap: 6px; justify-content: center;
  padding: 6px 11px; border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); cursor: pointer; font-size: 12.5px; font-weight: 550;
  white-space: nowrap; color: var(--ink);
}
.btn:hover { background: var(--surface-3); }
.btn:active { transform: translateY(.5px); }
.btn svg { width: 14px; height: 14px; stroke-width: 1.9; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--surface-3); }
.btn.danger { color: var(--critical); border-color: var(--border-strong); }
.btn.danger:hover { background: var(--critical-wash); }
.btn.sm { padding: 3.5px 8px; font-size: 11.5px; }
.btn.icon { padding: 6px; }
.btn[disabled] { opacity: .45; pointer-events: none; }

.input, .select, .textarea {
  width: 100%; padding: 6px 9px; border-radius: var(--r-sm);
  border: 1px solid var(--border-strong); background: var(--surface);
  font-size: 12.5px; outline: none;
}
.input:focus, .select:focus, .textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }
.textarea { resize: vertical; min-height: 62px; line-height: 1.5; }
.select { cursor: pointer; appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 12px, calc(100% - 9px) 12px;
  background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; padding-right: 26px; }
label.fl { display: block; font-size: 11px; font-weight: 600; color: var(--ink-2); margin-bottom: 4px; letter-spacing: .01em; }
.field { margin-bottom: 12px; }

.search-box { position: relative; flex: 1; max-width: 440px; }
.search-box svg { position: absolute; left: 9px; top: 50%; transform: translateY(-50%); width: 14px; height: 14px; color: var(--muted); stroke-width: 2; pointer-events: none; }
.search-box .input { padding-left: 29px; padding-right: 54px; }
.search-box kbd { position: absolute; right: 8px; top: 50%; transform: translateY(-50%); }
kbd { font-family: var(--font); font-size: 10px; color: var(--muted); background: var(--surface-3); border: 1px solid var(--border); border-radius: 4px; padding: 1px 5px; }

.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); }
.card-head { padding: 13px 15px 0; display: flex; align-items: flex-start; gap: 10px; }
.card-title { font-size: 12.5px; font-weight: 620; margin: 0; }
.card-sub { font-size: 11.5px; color: var(--muted); margin: 1px 0 0; }
.card-body { padding: 12px 15px 15px; }

.chip {
  display: inline-flex; align-items: center; gap: 4px; padding: 1.5px 7px;
  border-radius: 20px; font-size: 11px; font-weight: 550;
  background: var(--surface-3); color: var(--ink-2); border: 1px solid var(--border);
  white-space: nowrap;
}
.chip .x { cursor: pointer; opacity: .5; font-size: 13px; line-height: 1; }
.chip .x:hover { opacity: 1; }
.chip.good { background: var(--good-wash); color: var(--good-text); border-color: transparent; }
.chip.warn { background: var(--warning-wash); color: var(--ink); border-color: transparent; }
.chip.crit { background: var(--critical-wash); color: var(--critical); border-color: transparent; }
.chip.accent { background: var(--accent-wash); color: var(--accent); border-color: transparent; }
.chip.dot::before { content:''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; flex: none; }

.stage-pill { display:inline-flex; align-items:center; gap:5px; font-size: 11.5px; font-weight: 600; white-space: nowrap; }
.stage-pill::before { content:''; width: 7px; height: 7px; border-radius: 2px; background: var(--sc, var(--muted)); flex: none; }

.empty { text-align: center; padding: 54px 20px; color: var(--muted); }
.empty svg { width: 30px; height: 30px; opacity: .4; margin-bottom: 10px; stroke-width: 1.5; }
.empty h3 { margin: 0 0 4px; font-size: 14px; color: var(--ink-2); font-weight: 600; }
.empty p { margin: 0; font-size: 12.5px; }

.mono { font-family: var(--mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.tnum { font-variant-numeric: tabular-nums; }
.dim { color: var(--muted); }
.truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
hr.sep { border: 0; border-top: 1px solid var(--border); margin: 14px 0; }

/* ============================================================
   Dashboard
   ============================================================ */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); gap: 12px; margin-bottom: 14px; }
.kpi { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 13px 15px; }
.kpi-label { font-size: 11px; color: var(--muted); font-weight: 600; letter-spacing: .03em; text-transform: uppercase; display: flex; align-items: center; gap: 5px; }
.kpi-value { font-size: 25px; font-weight: 630; letter-spacing: -.025em; margin-top: 5px; line-height: 1.1; }
.kpi-foot { font-size: 11.5px; color: var(--muted); margin-top: 3px; }
.kpi-foot .up { color: var(--good-text); font-weight: 600; }
.kpi-foot .down { color: var(--critical); font-weight: 600; }
.kpi.clickable { cursor: pointer; }
.kpi.clickable:hover { border-color: var(--border-strong); }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(272px, 1fr)); gap: 14px; }

/* charts */
.bar-row { display: grid; grid-template-columns: 128px 1fr 62px; align-items: center; gap: 10px; padding: 3.5px 0; }
.bar-row .lbl { font-size: 12px; color: var(--ink-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 100%; }
.bar-row .val { font-size: 12px; text-align: right; font-variant-numeric: tabular-nums; color: var(--ink-2); }
.bar-row:hover .lbl, .bar-row:hover .val { color: var(--ink); }
svg.chart { display: block; width: 100%; overflow: visible; }
svg.chart text { font-family: var(--font); }
.axis-line { stroke: var(--grid); stroke-width: 1; }
.grid-line { stroke: var(--grid); stroke-width: 1; }
.tick { font-size: 10.5px; fill: var(--muted); }

.tooltip {
  position: fixed; z-index: 200; pointer-events: none;
  background: var(--surface); border: 1px solid var(--border-strong);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  padding: 8px 10px; font-size: 12px; max-width: 250px;
  opacity: 0; transition: opacity .1s;
}
.tooltip.on { opacity: 1; }
.tooltip .tt-t { font-weight: 620; margin-bottom: 3px; }
.tooltip .tt-r { display: flex; gap: 12px; justify-content: space-between; color: var(--ink-2); }
.tooltip .tt-r b { font-variant-numeric: tabular-nums; color: var(--ink); font-weight: 600; }

.legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 10px; }
.legend-item { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--ink-2); }
.legend-swatch { width: 9px; height: 9px; border-radius: 2px; flex: none; }

.table-toggle { display: flex; gap: 2px; background: var(--surface-3); border-radius: var(--r-sm); padding: 2px; }
.table-toggle button { border: 0; background: transparent; padding: 2.5px 8px; border-radius: 4px; font-size: 11px; cursor: pointer; color: var(--muted); font-weight: 550; }
.table-toggle button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px rgba(0,0,0,.07); }

table.data { width: 100%; border-collapse: collapse; font-size: 12px; }
table.data th { text-align: left; font-weight: 600; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; padding: 5px 8px; border-bottom: 1px solid var(--border); }
table.data td { padding: 5px 8px; border-bottom: 1px solid var(--grid); }
table.data td.num, table.data th.num { text-align: right; font-variant-numeric: tabular-nums; }
table.data tr:last-child td { border-bottom: 0; }

/* ============================================================
   Leads table (virtualised)
   ============================================================ */
.leads-shell { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.toolbar {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 9px 16px;
  border-bottom: 1px solid var(--border); background: var(--surface); flex-wrap: wrap;
}
.filter-bar { flex: none; display: flex; align-items: center; gap: 6px; padding: 7px 16px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; min-height: 36px; }
.filter-bar .lbl { font-size: 11px; color: var(--muted); font-weight: 600; }

.dropdown { position: relative; }
.dropdown-panel {
  position: absolute; top: calc(100% + 5px); left: 0; z-index: 60; min-width: 226px;
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-md);
  box-shadow: var(--shadow-lg); padding: 5px; max-height: 340px; overflow: auto;
}
.dropdown-panel.right { left: auto; right: 0; }
.dd-search { padding: 4px; position: sticky; top: -5px; background: var(--surface); }
.dd-item { display: flex; align-items: center; gap: 8px; padding: 5px 8px; border-radius: 4px; cursor: pointer; font-size: 12.5px; }
.dd-item:hover { background: var(--surface-3); }
.dd-item input { margin: 0; accent-color: var(--accent); }
.dd-item .n { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.dd-sep { border-top: 1px solid var(--border); margin: 4px 0; }
.dd-head { font-size: 10px; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); padding: 6px 8px 3px; font-weight: 650; }

.tbl-scroll { flex: 1; overflow: auto; min-height: 0; position: relative; }
.tbl-head {
  position: sticky; top: 0; z-index: 10; display: flex;
  background: var(--surface); border-bottom: 1px solid var(--border-strong);
  font-size: 10.5px; font-weight: 650; color: var(--muted);
  text-transform: uppercase; letter-spacing: .04em;
}
.tbl-head .th { padding: 8px 10px; display: flex; align-items: center; gap: 4px; cursor: pointer; user-select: none; overflow: hidden; }
.tbl-head .th:hover { color: var(--ink); }
.tbl-head .th.no-sort { cursor: default; }
.tbl-head .th .arrow { opacity: 0; font-size: 9px; }
.tbl-head .th.sorted .arrow { opacity: 1; color: var(--accent); }
.tbl-head .th.sorted { color: var(--ink); }

.vrow {
  display: flex; align-items: center; border-bottom: 1px solid var(--grid);
  height: var(--row-h); cursor: pointer; position: absolute; left: 0; right: 0;
  background: var(--surface);
}
.vrow:hover { background: var(--surface-2); }
.vrow.sel { background: var(--accent-wash); }
.vrow.active { box-shadow: inset 2.5px 0 0 var(--accent); }
.vrow .td { padding: 0 10px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; }
.vrow .td.c { display: flex; align-items: center; gap: 6px; }
.vrow .co { font-weight: 550; }
.vrow input[type=checkbox] { accent-color: var(--accent); cursor: pointer; }
.vspacer { position: relative; }

.bulkbar {
  flex: none; display: flex; align-items: center; gap: 8px; padding: 8px 16px;
  background: var(--accent-wash); border-bottom: 1px solid var(--border); font-size: 12.5px;
}
.bulkbar b { font-variant-numeric: tabular-nums; }
.statusbar { flex: none; display: flex; align-items: center; gap: 12px; padding: 6px 16px; border-top: 1px solid var(--border); background: var(--surface); font-size: 11.5px; color: var(--muted); }

/* ============================================================
   Drawer
   ============================================================ */
.scrim { position: fixed; inset: 0; background: rgba(11,11,11,.34); z-index: 90; opacity: 0; transition: opacity .18s; }
.scrim.on { opacity: 1; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(560px, 96vw); z-index: 100;
  background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column;
  transform: translateX(100%); transition: transform .2s cubic-bezier(.32,.72,0,1);
}
.drawer.on { transform: none; }
.drawer-head { flex: none; padding: 14px 16px; border-bottom: 1px solid var(--border); }
.drawer-body { flex: 1; overflow-y: auto; min-height: 0; }
.drawer-foot { flex: none; padding: 9px 16px; border-top: 1px solid var(--border); display: flex; gap: 8px; align-items: center; background: var(--surface-2); }

.tabs { display: flex; gap: 2px; padding: 0 16px; border-bottom: 1px solid var(--border); flex: none; background: var(--surface); }
.tab { border: 0; background: transparent; padding: 8px 10px; font-size: 12.5px; font-weight: 550; color: var(--muted); cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.tab:hover { color: var(--ink); }
.tab.on { color: var(--accent); border-bottom-color: var(--accent); font-weight: 620; }
.tab .n { font-size: 10.5px; opacity: .75; margin-left: 3px; }
.tab-panel { padding: 15px 16px; }

.quick-actions { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 11px; }
.detail-grid { display: grid; grid-template-columns: 96px 1fr; gap: 7px 12px; font-size: 12.5px; align-items: baseline; }
.detail-grid dt { color: var(--muted); font-size: 11.5px; }
.detail-grid dd { margin: 0; word-break: break-word; }

.timeline { position: relative; padding-left: 20px; }
.timeline::before { content: ''; position: absolute; left: 5.5px; top: 5px; bottom: 5px; width: 1px; background: var(--grid); }
.tl-item { position: relative; padding-bottom: 15px; }
.tl-item::before {
  content: ''; position: absolute; left: -18px; top: 4px; width: 8px; height: 8px;
  border-radius: 50%; background: var(--surface); border: 2px solid var(--muted);
}
.tl-item.call::before { border-color: var(--series-1); }
.tl-item.email::before { border-color: var(--ord-2); }
.tl-item.meeting::before { border-color: var(--good); }
.tl-item.note::before { border-color: var(--warning); }
.tl-item.stage::before { border-color: var(--accent); background: var(--accent); }
.tl-head { display: flex; align-items: baseline; gap: 7px; flex-wrap: wrap; }
.tl-type { font-size: 11.5px; font-weight: 650; }
.tl-time { font-size: 11px; color: var(--muted); margin-left: auto; }
.tl-body { font-size: 12.5px; color: var(--ink-2); margin-top: 2px; white-space: pre-wrap; word-break: break-word; }

.task-item { display: flex; gap: 9px; padding: 8px 0; border-bottom: 1px solid var(--grid); align-items: flex-start; }
.task-item:last-child { border-bottom: 0; }
.task-item input[type=checkbox] { margin-top: 2px; accent-color: var(--accent); cursor: pointer; width: 15px; height: 15px; }
.task-item.done .task-title { text-decoration: line-through; color: var(--muted); }
.task-title { font-size: 12.5px; font-weight: 500; }
.task-meta { font-size: 11px; color: var(--muted); margin-top: 1px; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.task-meta .overdue { color: var(--critical); font-weight: 650; }
.task-meta .today { color: var(--good-text); font-weight: 650; }

/* ============================================================
   Pipeline
   ============================================================ */
.kanban { display: flex; gap: 12px; padding: 16px; height: 100%; overflow-x: auto; align-items: flex-start; }
.kcol { flex: none; width: 272px; display: flex; flex-direction: column; max-height: 100%;
        background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); }
.kcol.drop { border-color: var(--accent); background: var(--accent-wash); }
.kcol-head { padding: 10px 12px 8px; border-bottom: 1px solid var(--border); flex: none; }
.kcol-title { display: flex; align-items: center; gap: 7px; font-size: 12.5px; font-weight: 620; }
.kcol-title .swatch { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.kcol-title .n { margin-left: auto; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; background: var(--surface-3); padding: 0 6px; border-radius: 9px; }
.kcol-sum { font-size: 11px; color: var(--muted); margin-top: 3px; font-variant-numeric: tabular-nums; }
.kcol-body { overflow-y: auto; padding: 8px; display: flex; flex-direction: column; gap: 7px; min-height: 60px; }
.kcard { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-md); padding: 9px 10px; cursor: grab; }
.kcard:hover { border-color: var(--border-strong); box-shadow: var(--shadow); }
.kcard.dragging { opacity: .4; }
.kcard-title { font-size: 12.5px; font-weight: 600; }
.kcard-sub { font-size: 11.5px; color: var(--muted); margin-top: 1px; }
.kcard-foot { display: flex; align-items: center; gap: 6px; margin-top: 7px; flex-wrap: wrap; }
.avatar { width: 19px; height: 19px; border-radius: 50%; display: grid; place-items: center; font-size: 9.5px; font-weight: 700; background: var(--accent-wash); color: var(--accent); flex: none; }

/* ============================================================
   Modal / palette / toast
   ============================================================ */
.modal-wrap { position: fixed; inset: 0; z-index: 150; display: grid; place-items: center; padding: 20px; }
.modal {
  background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-xl);
  box-shadow: var(--shadow-lg); width: min(520px, 100%); max-height: 86vh; display: flex; flex-direction: column;
}
.modal.wide { width: min(880px, 100%); }
.modal-head { padding: 15px 18px 11px; border-bottom: 1px solid var(--border); display: flex; align-items: center; gap: 10px; }
.modal-head h2 { margin: 0; font-size: 14.5px; font-weight: 630; }
.modal-body { padding: 16px 18px; overflow-y: auto; }
.modal-foot { padding: 11px 18px; border-top: 1px solid var(--border); display: flex; gap: 8px; justify-content: flex-end; background: var(--surface-2); border-radius: 0 0 var(--r-xl) var(--r-xl); }

.cmdk { position: fixed; inset: 0; z-index: 160; display: flex; justify-content: center; padding-top: 12vh; }
.cmdk-box { background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--r-lg); box-shadow: var(--shadow-lg); width: min(600px, 92vw); max-height: 62vh; display: flex; flex-direction: column; }
.cmdk-box input { border: 0; padding: 14px 16px; font-size: 14.5px; outline: none; background: transparent; border-bottom: 1px solid var(--border); }
.cmdk-list { overflow-y: auto; padding: 6px; }
.cmdk-item { padding: 8px 11px; border-radius: var(--r-sm); cursor: pointer; display: flex; align-items: center; gap: 10px; font-size: 13px; }
.cmdk-item.on { background: var(--accent-wash); }
.cmdk-item .k { margin-left: auto; font-size: 10.5px; color: var(--muted); }

.toasts { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 300; display: flex; flex-direction: column; gap: 7px; align-items: center; }
.toast {
  background: var(--ink); color: var(--plane); padding: 8px 14px; border-radius: 20px;
  font-size: 12.5px; font-weight: 550; box-shadow: var(--shadow-lg);
  display: flex; align-items: center; gap: 9px; animation: pop .18s;
}
.toast .u { color: var(--warning); cursor: pointer; font-weight: 650; }
@keyframes pop { from { opacity: 0; transform: translateY(8px); } }

.progress { height: 4px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.progress > i { display: block; height: 100%; background: var(--accent); border-radius: 3px; transition: width .2s; }

.settings-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--grid); }
.settings-row:last-child { border-bottom: 0; }
.settings-row .info { flex: 1; }
.settings-row .info b { font-size: 12.5px; font-weight: 600; display: block; }
.settings-row .info span { font-size: 11.5px; color: var(--muted); }

.list-editor { display: flex; flex-direction: column; gap: 6px; }
.list-editor .le-row { display: flex; align-items: center; gap: 7px; }
.list-editor .le-row .input { flex: 1; }
.drag-handle { cursor: grab; color: var(--muted); user-select: none; padding: 0 2px; }

@media (max-width: 880px) {
  #app { grid-template-columns: 56px 1fr; }
  .brand-text, .nav-label, .nav-item span, .nav-count { display: none; }
  .nav-item { justify-content: center; }
  .brand { justify-content: center; padding: 14px 0; }
}
@media print {
  .sidebar, .toolbar, .filter-bar, .drawer, .scrim, .statusbar { display: none !important; }
  body, .view-wrap { overflow: visible; }
}
