/* Koino design tokens — aligned to koino.capital website (green + black, soft).
 *
 * Was: amber/blue-leaning oklch palette. Now: pure black surfaces, teal-green
 * primary (--a #00d4aa from koino.capital), purple secondary for status.
 * Token NAMES preserved so the rest of the app inherits automatically without
 * touching every component. */
:root {
  --bg-base: #050505;
  --bg-elevated: #0d0d0d;
  --bg-raised: #151515;
  --bg-overlay: #1a1a1a;
  --border-subtle: #1a1a1a;
  --border-strong: #2a2a2a;
  --text-primary: #e8e8e8;
  --text-secondary: #888888;
  --text-tertiary: #555555;
  --text-quaternary: #3a3a3a;

  --accent-money: #00d4aa;
  --accent-money-dim: rgba(0, 212, 170, 0.4);
  --accent-heat: #f59e0b;
  --accent-status: #7c3aed;
  --state-danger: #ef4444;
  --state-warning: #f59e0b;
  --state-info: #3b82f6;

  --tier-bronze: #A97142;
  --tier-silver: #C0C0C8;
  --tier-gold: #D9A441;
  --tier-platinum: #E5E4E2;
  --tier-diamond: #B9F2FF;

  --row-h: 32px;
  --radius-sm: 6px;
  --radius-md: 8px;
  --radius-lg: 12px;
  --radius-xl: 14px;

  --shadow-floating: 0 8px 30px rgba(0, 212, 170, 0.08), 0 20px 50px -20px rgba(0,0,0,0.7);
  --shadow-inset: inset 0 1px 0 rgba(255,255,255,0.04);

  --font-ui: "Inter", ui-sans-serif, system-ui, -apple-system, sans-serif;
  --font-display: "Inter", ui-sans-serif, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;

  --ease-out: cubic-bezier(0.32, 0.72, 0, 1);
  --ease-spring: cubic-bezier(0.4, 1.6, 0.4, 1);

  /* Modal/overlay backdrop — overridden per theme */
  --dim-overlay: rgba(0,0,0,0.45);
}

/* ── Light theme — "warm paper" ───────────────────────────────────────────
   Applied when <html data-theme="light"> is set (via applyTheme() or
   the anti-FOUC inline script in index.html reading localStorage).
   Dark is the default (:root values above); this block overrides only
   on explicit opt-in so dark mode needs no extra attribute.
   ──────────────────────────────────────────────────────────────────────── */
html[data-theme="light"] {
  /* Surfaces — warm paper hierarchy */
  --bg-base:     #FAF7F2; /* cream paper — main workspace */
  --bg-elevated: #F4EFE6; /* sidebar / header strips — slightly deeper */
  --bg-raised:   #FFFFFF; /* cards, panels — float above page */
  --bg-overlay:  #EDE8DF; /* inputs, wells — sunken */

  /* Borders — warm taupe */
  --border-subtle: #E5DFD3;
  --border-strong: #CCC5B5;

  /* Text — near-black with warmth */
  --text-primary:   #1A1A1F;
  --text-secondary: #5C5C66;
  --text-tertiary:  #9A9AA3;
  --text-quaternary: #C0BEB8;

  /* Brand / semantic — muted for legibility on light bg */
  --accent-money:     #007A66; /* teal, darkened from #00d4aa for contrast */
  --accent-money-dim: rgba(0, 122, 102, 0.12);
  --accent-heat:      #B8842A; /* amber/ochre */
  --accent-status:    #5B21B6; /* purple — accessible on light */
  --state-danger:     #C73E3A; /* warm red */
  --state-warning:    #B8842A;
  --state-info:       #1D4ED8;

  /* Shadows — subtle on light */
  --shadow-floating: 0 4px 16px rgba(0,0,0,0.07), 0 12px 36px -12px rgba(0,0,0,0.10);
  --shadow-inset:    inset 0 1px 0 rgba(0,0,0,0.05);

  /* Backdrop dim — warm tint */
  --dim-overlay: rgba(50,40,30,0.35);
}

[data-density="compact"] {
  --row-h: 30px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-ui);
  background: var(--bg-base);
  color: var(--text-primary);
  font-size: 13px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: "ss01", "cv11";
  letter-spacing: -0.005em;
}

button { font-family: inherit; cursor: pointer; border: 0; background: transparent; color: inherit; padding: 0; }
input, textarea { font-family: inherit; color: inherit; }

.tabular { font-variant-numeric: tabular-nums; font-feature-settings: "tnum"; }
.mono { font-family: var(--font-mono); }

::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border-subtle); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--border-strong); }

/* App shell */
.app {
  display: grid;
  grid-template-columns: 220px 1fr;
  height: 100vh;
  width: 100vw;
  overflow: hidden;
  transition: grid-template-columns 220ms var(--ease-out);
}
.app[data-mobile="on"] { grid-template-columns: 1fr; transition: none; }

/* Collapsed sidebar — column shrinks, all labels hide, icons stay. */
html[data-sidebar-collapsed="1"] .app                  { grid-template-columns: 60px 1fr; }
html[data-sidebar-collapsed="1"] .app[data-mobile="on"]{ grid-template-columns: 1fr; }

/* Sidebar */
.sidebar {
  background: var(--bg-base);
  border-right: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.sb-brand {
  padding: 14px 14px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
  border-bottom: 1px solid var(--border-subtle);
}
.sb-brand-mark {
  width: 22px; height: 22px;
  border-radius: 6px;
  background: linear-gradient(135deg, var(--accent-money), var(--accent-money-dim));
  display: grid; place-items: center;
  font-weight: 800; font-size: 12px; color: #051a10;
  font-family: var(--font-display);
}
.sb-brand-name { font-weight: 600; font-size: 13px; letter-spacing: -0.01em; }
.sb-brand-meta { color: var(--text-tertiary); font-size: 11px; }

.sb-section {
  padding: 14px 8px 4px 12px;
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-quaternary);
  font-weight: 500;
}
.sb-nav { display: flex; flex-direction: column; gap: 1px; padding: 0 6px; }
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 6px 8px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 450;
  transition: background 120ms var(--ease-out), color 120ms var(--ease-out);
  text-align: left;
  width: 100%;
}
.sb-item:hover { background: var(--bg-elevated); color: var(--text-primary); }
.sb-item.active {
  background: var(--bg-elevated);
  color: var(--text-primary);
  box-shadow: var(--shadow-inset);
}
.sb-item .ic { width: 16px; height: 16px; opacity: 0.85; flex-shrink: 0; }
.sb-item .badge {
  margin-left: auto;
  font-size: 10.5px;
  padding: 1px 5px;
  border-radius: 10px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-variant-numeric: tabular-nums;
}
.sb-item.active .badge { background: var(--bg-overlay); }
.sb-item .kbd {
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-quaternary);
}

.sb-spacer { flex: 1; }

.sb-user {
  border-top: 1px solid var(--border-subtle);
  padding: 10px 12px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sb-avatar {
  width: 26px; height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, oklch(0.55 0.13 280), oklch(0.40 0.10 250));
  display: grid; place-items: center;
  font-size: 11px; font-weight: 600; color: #fff;
  flex-shrink: 0;
}
.sb-user-info { flex: 1; min-width: 0; }
.sb-user-name { font-size: 12.5px; font-weight: 500; }
.sb-user-role { font-size: 10.5px; color: var(--text-tertiary); display: flex; align-items: center; gap: 6px; }

.role-switch {
  display: flex;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 2px;
  margin: 8px 12px;
}
.role-switch button {
  flex: 1;
  padding: 5px 8px;
  font-size: 11px;
  border-radius: 4px;
  color: var(--text-tertiary);
  font-weight: 500;
}
.role-switch button.active {
  background: var(--bg-raised);
  color: var(--text-primary);
}

/* ── Sidebar collapse toggle ──────────────────────────────────────────────── */
/* Brand row wraps SidebarBrand + chevron button on one line. */
.sb-brand-row {
  display: flex;
  align-items: stretch;
  border-bottom: 1px solid var(--border-subtle);
}
.sb-brand-row .sb-brand {
  flex: 1;
  border-bottom: none;
  min-width: 0;
}
.sb-collapse-toggle {
  width: 28px;
  flex-shrink: 0;
  display: grid; place-items: center;
  color: var(--text-tertiary);
  border: none; background: none;
  cursor: pointer;
  margin-right: 4px;
  border-radius: var(--radius-sm, 4px);
  transition: background 120ms var(--ease-out), color 120ms var(--ease-out);
}
.sb-collapse-toggle:hover {
  background: var(--bg-elevated);
  color: var(--text-primary);
}

/* ── COLLAPSED MODE — sidebar at 60px, icon-only ──────────────────────────── */
/* Layout: each item centers its icon, all text/badges hide. The sidebar
   itself is the grid column (60px), so we don't set width on .sidebar. */
.sidebar[data-collapsed="1"] {
  align-items: stretch;
}
/* Brand: show the mark only, hide name/agency text, move chevron below mark. */
.sidebar[data-collapsed="1"] .sb-brand-row {
  flex-direction: column;
  align-items: center;
  padding: 6px 0 4px;
  gap: 4px;
}
.sidebar[data-collapsed="1"] .sb-brand {
  padding: 4px 0;
  border-bottom: none;
  justify-content: center;
}
.sidebar[data-collapsed="1"] .sb-brand > div:not(.sb-brand-mark) { display: none; }
.sidebar[data-collapsed="1"] .sb-collapse-toggle {
  width: 30px; height: 22px; margin: 0;
}
/* Section labels become hairline dividers in collapsed mode. */
.sidebar[data-collapsed="1"] .sb-section {
  padding: 10px 12px 4px;
  font-size: 0;
  letter-spacing: 0;
}
.sidebar[data-collapsed="1"] .sb-section::before {
  content: "";
  display: block;
  border-top: 1px solid var(--border-subtle);
}
/* Nav rows: center icon, hide everything else. */
.sidebar[data-collapsed="1"] .sb-nav { padding: 0 8px; }
.sidebar[data-collapsed="1"] .sb-item {
  justify-content: center;
  padding: 8px 0;
  gap: 0;
}
.sidebar[data-collapsed="1"] .sb-item > span,
.sidebar[data-collapsed="1"] .sb-item > .badge,
.sidebar[data-collapsed="1"] .sb-item > .kbd {
  display: none;
}
/* Role-switch hides in collapsed mode (it's a power-user preview tool,
   not worth the vertical real estate). */
.sidebar[data-collapsed="1"] .role-switch { display: none; }
/* "Customize…" entry: icon only, italic span hides. */
.sidebar[data-collapsed="1"] .sb-item-composer > span { display: none; }
/* Bottom user row: avatar only, hide name + role + settings cog. */
.sidebar[data-collapsed="1"] .sb-user {
  justify-content: center;
  padding: 10px 0;
}
.sidebar[data-collapsed="1"] .sb-user-info,
.sidebar[data-collapsed="1"] .sb-user > .icon-btn { display: none; }

/* Workspace */
.workspace {
  background: var(--bg-base);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

/* Liquid-glass topbar pill — floats just inside the workspace edge,
   no divider, slim, blurry. */
.topbar {
  position: sticky;
  top: 10px;
  z-index: 30;
  margin: 10px 14px 8px;
  height: 40px;
  display: flex;
  align-items: center;
  padding: 0 10px 0 14px;
  gap: 8px;
  flex-shrink: 0;
  border-radius: 999px;
  background: color-mix(in oklch, var(--bg-elevated) 72%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid color-mix(in oklch, var(--border-subtle) 75%, transparent);
  box-shadow:
    0 1px 0 color-mix(in oklch, var(--text-primary) 5%, transparent) inset,
    0 10px 28px -14px rgba(0,0,0,0.65),
    0 0 0 1px color-mix(in oklch, var(--text-primary) 2%, transparent);
}

.crumbs {
  display: flex;
  align-items: center;
  gap: 4px;
  color: var(--text-tertiary);
  font-size: 12px;
}
.crumbs .sep { color: var(--text-quaternary); display: inline-flex; opacity: 0.7; }
.crumbs .here { color: var(--text-primary); font-weight: 500; }
.topbar-spacer { flex: 1; }

/* Inside the pill, kill extra borders/backgrounds on action buttons so they
   feel native to the glass surface */
.topbar .cmdk-trigger {
  background: color-mix(in oklch, var(--bg-base) 50%, transparent);
  border: 1px solid color-mix(in oklch, var(--border-subtle) 60%, transparent);
  height: 28px;
}
.topbar .lb-pill, .topbar .icon-btn {
  background: transparent;
  border: 1px solid transparent;
}
.topbar .icon-btn:hover, .topbar .lb-pill:hover {
  background: color-mix(in oklch, var(--bg-base) 60%, transparent);
  border-color: color-mix(in oklch, var(--border-subtle) 60%, transparent);
}
.topbar .topbar-action {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 28px;
  padding: 0 10px;
  border-radius: 8px;
  background: transparent;
  border: 1px solid color-mix(in oklch, var(--border-subtle) 60%, transparent);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 130ms, border-color 130ms, color 130ms;
}
.topbar .topbar-action:hover {
  background: color-mix(in oklch, var(--bg-base) 60%, transparent);
  border-color: color-mix(in oklch, var(--border-subtle) 90%, transparent);
  color: var(--text-primary);
}
.topbar .live-badge { margin-left: 6px; height: 22px; }
.topbar .aep-pill { background: color-mix(in oklch, var(--accent-heat) 18%, transparent); }

/* Liquid-glass OS selector (Auto Quoter Setup → install command) */
.os-glass-bar {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
  padding: 6px;
  border-radius: 14px;
  background: linear-gradient(145deg,
    color-mix(in oklch, white 6%, transparent),
    color-mix(in oklch, white 1%, transparent));
  border: 1px solid color-mix(in oklch, white 8%, transparent);
  backdrop-filter: blur(20px) saturate(140%);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  box-shadow:
    inset 0 1px 0 color-mix(in oklch, white 10%, transparent),
    inset 0 -1px 0 color-mix(in oklch, black 25%, transparent),
    0 8px 24px color-mix(in oklch, black 30%, transparent);
}
.os-glass-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease, border-color 140ms ease;
}
.os-glass-btn:hover {
  background: color-mix(in oklch, white 4%, transparent);
  color: var(--text-primary);
}
.os-glass-btn.is-active {
  background: linear-gradient(145deg,
    color-mix(in oklch, var(--accent-money) 28%, transparent),
    color-mix(in oklch, var(--accent-money) 12%, transparent));
  border-color: color-mix(in oklch, var(--accent-money) 45%, transparent);
  color: var(--text-primary);
  box-shadow:
    inset 0 1px 0 color-mix(in oklch, white 18%, transparent),
    0 4px 12px color-mix(in oklch, var(--accent-money) 35%, transparent);
}
.os-glass-label {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.os-glass-sub {
  font-size: 10px;
  color: var(--text-tertiary);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.os-glass-btn.is-active .os-glass-sub { color: color-mix(in oklch, var(--accent-money) 70%, var(--text-secondary)); }

/* Section sub-nav pill — for combining related pages within a screen */
.section-pill {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  margin: 4px 0 14px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--bg-elevated) 70%, transparent);
  -webkit-backdrop-filter: blur(16px) saturate(160%);
  backdrop-filter: blur(16px) saturate(160%);
  border: 1px solid color-mix(in oklch, var(--border-subtle) 70%, transparent);
  font-size: 12px;
}
.section-pill > button {
  padding: 5px 12px;
  border-radius: 999px;
  background: transparent;
  border: 0;
  color: var(--text-tertiary);
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: all 120ms;
}
.section-pill > button:hover { color: var(--text-primary); }
.section-pill > button.active {
  background: color-mix(in oklch, var(--text-primary) 8%, var(--bg-base));
  color: var(--text-primary);
  box-shadow: 0 1px 0 color-mix(in oklch, var(--text-primary) 4%, transparent) inset, 0 1px 4px rgba(0,0,0,0.2);
}

/* Page padding: less space at top now that topbar is a floating pill */
.page > .page-pad { padding-top: 6px; }

/* When sidebar is collapsed (mobile), pull pill margins in */
@media (max-width: 820px) {
  .topbar { margin: 8px; padding: 0 8px; height: 38px; }
}

.cmdk-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 8px 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  color: var(--text-tertiary);
  font-size: 12px;
  min-width: 200px;
}
.cmdk-trigger:hover { border-color: var(--border-strong); color: var(--text-secondary); }
.cmdk-trigger .kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 1px 5px;
  background: var(--bg-raised);
  border-radius: 3px;
  margin-left: auto;
  color: var(--text-tertiary);
}

.lb-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 4px 10px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 20px;
  font-size: 12px;
  font-variant-numeric: tabular-nums;
}
.lb-pill .rank { color: var(--text-primary); font-weight: 600; }
.lb-pill .delta-up { color: var(--accent-money); display: flex; align-items: center; gap: 2px; }
.lb-pill .delta-dn { color: var(--state-danger); display: flex; align-items: center; gap: 2px; }
.lb-pill:hover { border-color: var(--border-strong); }

.aep-pill {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 3px 9px;
  background: oklch(0.30 0.10 30);
  border: 1px solid oklch(0.45 0.18 30);
  border-radius: 20px;
  font-size: 11px;
  color: oklch(0.92 0.06 30);
  font-weight: 500;
}
.aep-pill .dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--accent-heat);
  animation: pulse 1.6s var(--ease-out) infinite;
}

.icon-btn {
  width: 28px; height: 28px;
  display: grid; place-items: center;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
}
.icon-btn:hover { background: var(--bg-elevated); color: var(--text-primary); }

/* Page area */
.page { flex: 1; overflow: auto; }
.page-pad { padding: 18px 22px 28px; max-width: 100%; }

.page-h {
  display: flex; align-items: flex-end; gap: 16px;
  margin-bottom: 16px;
}
.page-title {
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  font-family: var(--font-display);
}
.page-sub { color: var(--text-tertiary); font-size: 12.5px; margin-top: 2px; }

/* KPI cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.kpi {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  padding: 14px 16px 12px;
  position: relative;
  overflow: hidden;
}
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
  font-weight: 500;
}
.kpi-val {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.025em;
  margin-top: 6px;
  font-variant-numeric: tabular-nums;
}
.kpi-val.money { color: var(--text-primary); }
.kpi-meta {
  display: flex; align-items: center; gap: 8px;
  margin-top: 4px;
  font-size: 11.5px;
  color: var(--text-tertiary);
}
.kpi-meta .up { color: var(--accent-money); }
.kpi-meta .dn { color: var(--state-danger); }
.kpi-spark {
  position: absolute;
  right: 10px; top: 12px;
  width: 70px; height: 28px;
  opacity: 0.85;
}
.kpi.hero { grid-column: span 2; }
.kpi.hero .kpi-val { font-size: 56px; line-height: 1; margin-top: 10px; letter-spacing: -0.04em; }
.kpi.hero .kpi-spark { width: 130px; height: 56px; }

/* Tier chip */
.tier {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  padding: 2px 7px 2px 5px;
  border-radius: 4px;
  border: 1px solid transparent;
  white-space: nowrap;
}
.tier .gem {
  width: 7px; height: 7px;
  border-radius: 1px;
  transform: rotate(45deg);
  flex-shrink: 0;
}
.tier-bronze { color: var(--tier-bronze); border-color: color-mix(in oklch, var(--tier-bronze) 35%, transparent); background: color-mix(in oklch, var(--tier-bronze) 10%, transparent); }
.tier-bronze .gem { background: var(--tier-bronze); }
.tier-silver { color: var(--tier-silver); border-color: color-mix(in oklch, var(--tier-silver) 30%, transparent); background: color-mix(in oklch, var(--tier-silver) 8%, transparent); }
.tier-silver .gem { background: var(--tier-silver); }
.tier-gold { color: var(--tier-gold); border-color: color-mix(in oklch, var(--tier-gold) 35%, transparent); background: color-mix(in oklch, var(--tier-gold) 10%, transparent); }
.tier-gold .gem { background: var(--tier-gold); }
.tier-platinum { color: var(--tier-platinum); border-color: color-mix(in oklch, var(--tier-platinum) 30%, transparent); background: color-mix(in oklch, var(--tier-platinum) 8%, transparent); }
.tier-platinum .gem { background: var(--tier-platinum); }
.tier-diamond { color: var(--tier-diamond); border-color: color-mix(in oklch, var(--tier-diamond) 35%, transparent); background: color-mix(in oklch, var(--tier-diamond) 10%, transparent); }
.tier-diamond .gem { background: var(--tier-diamond); }

/* Generic chips */
.chip {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 10.5px;
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--bg-raised);
  color: var(--text-secondary);
  font-weight: 500;
  white-space: nowrap;
}
.chip-money { background: color-mix(in oklch, var(--accent-money) 15%, transparent); color: var(--accent-money); }
.chip-heat { background: color-mix(in oklch, var(--accent-heat) 15%, transparent); color: var(--accent-heat); }
.chip-status { background: color-mix(in oklch, var(--accent-status) 15%, transparent); color: var(--accent-status); }
.chip-info { background: color-mix(in oklch, var(--state-info) 15%, transparent); color: var(--state-info); }
.chip-danger { background: color-mix(in oklch, var(--state-danger) 15%, transparent); color: var(--state-danger); }

.dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.dot-live { background: var(--accent-money); box-shadow: 0 0 0 0 var(--accent-money); animation: pulse 1.4s var(--ease-out) infinite; }
.dot-warn { background: var(--state-warning); }
.dot-danger { background: var(--state-danger); }
.dot-idle { background: var(--text-quaternary); }

@keyframes pulse {
  0% { box-shadow: 0 0 0 0 currentColor; opacity: 1; }
  70% { box-shadow: 0 0 0 6px transparent; opacity: 0.6; }
  100% { box-shadow: 0 0 0 0 transparent; opacity: 1; }
}

/* Cards / panels */
.panel {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: border-color 120ms var(--ease-out);
  /* Allow panels to shrink inside multi-column grids — without min-width:0
     a wide child (input, table row, long word) pushes the panel past its
     grid track and the rightmost neighbor clips. */
  min-width: 0;
}
.panel:hover { border-color: var(--border-strong); }
.panel-h {
  padding: 9px 12px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.panel-h h3 { margin: 0; font-size: 12.5px; font-weight: 600; letter-spacing: -0.01em; }
.panel-h .meta { color: var(--text-tertiary); font-size: 11px; margin-left: auto; }

.btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 10px;
  border-radius: var(--radius-md);
  font-size: 12px;
  font-weight: 500;
  background: var(--bg-raised);
  color: var(--text-primary);
  border: 1px solid var(--border-subtle);
  transition: background 120ms var(--ease-out);
}
.btn:hover { background: var(--bg-overlay); }
.btn-primary {
  background: var(--accent-money);
  color: #001a14;
  border-color: transparent;
  font-weight: 600;
}
.btn-primary:hover {
  background: #00ebbe;
  box-shadow: 0 4px 16px rgba(0, 212, 170, 0.18);
}
.btn-ghost { background: transparent; border-color: transparent; color: var(--text-secondary); }
.btn-ghost:hover { background: var(--bg-elevated); color: var(--text-primary); }

/* Pipeline list */
.list { display: flex; flex-direction: column; }
.list-h, .row {
  display: grid;
  align-items: center;
  height: var(--row-h);
  padding: 0 14px;
  font-size: 12.5px;
  border-bottom: 1px solid color-mix(in oklch, var(--border-subtle) 60%, transparent);
  gap: 10px;
}
.list-h {
  color: var(--text-tertiary);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
  background: var(--bg-base);
}
.row { transition: background 100ms var(--ease-out); }
.row:hover { background: var(--bg-raised); }
.row.sel { background: color-mix(in oklch, var(--accent-money) 8%, var(--bg-raised)); }

.cell-truncate { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }

/* Make every cell in .list-h / .row able to shrink so a long string doesn't
   force its column to push neighbors out. Combine with .cell-truncate or
   inline `overflow:hidden;text-overflow:ellipsis;white-space:nowrap` on cells
   that should truncate. Without min-width:0 the implicit auto min-width
   (= content) means fixed-pixel sibling tracks overlap the flex tracks. */
.list-h > *, .row > * { min-width: 0; }

/* Opt-in "card mode" for any .list inside .list-responsive when the panel is
   narrow (≤900px). Each .row becomes a flex-wrap card; the .list-h is
   hidden because the labels live next to the values. Applied to settings
   tables (connectors vault, devices, agents) so they don't overlap below
   half-screen. Pages that want this just add className="list-responsive". */
.list-responsive .list-h, .list-responsive .row {
  /* Force shrinkable tracks even when inline gridTemplateColumns is rigid. */
  grid-template-columns: var(--list-cols, none);
}
@media (max-width: 900px) {
  .list-responsive .list-h { display: none; }
  .list-responsive .row {
    display: flex;
    flex-wrap: wrap;
    column-gap: 14px;
    row-gap: 4px;
    height: auto;
    min-height: var(--row-h);
    padding: 10px 14px;
    align-items: center;
  }
  .list-responsive .row > * {
    flex: 1 1 auto;
    min-width: 0;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
  }
  .list-responsive .row > *.list-actions { flex: 0 0 auto; margin-left: auto; }
}

.avatar-xs {
  width: 18px; height: 18px;
  border-radius: 50%;
  font-size: 9.5px;
  font-weight: 600;
  display: inline-grid; place-items: center;
  flex-shrink: 0;
  color: #fff;
  font-family: var(--font-display);
}

/* AI rail */
.airail {
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.airail-h {
  padding: 10px 14px;
  display: flex; align-items: center; gap: 8px;
  border-bottom: 1px solid var(--border-subtle);
}
.airail-h .title { font-size: 12px; font-weight: 600; letter-spacing: -0.005em; }
.airail-h .meta { font-size: 10.5px; color: var(--text-tertiary); margin-left: auto; }
.airail-body { flex: 1; overflow: auto; padding: 14px; display: flex; flex-direction: column; gap: 14px; }
.airail-foot { padding: 10px; border-top: 1px solid var(--border-subtle); }
.airail-input {
  width: 100%;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 8px 10px;
  font-size: 12.5px;
  outline: none;
  color: var(--text-primary);
}
.airail-input:focus { border-color: var(--accent-money-dim); }

.ai-msg {
  display: flex; flex-direction: column; gap: 6px;
}
.ai-msg .who { font-size: 10.5px; color: var(--text-tertiary); display: flex; align-items: center; gap: 6px; }
.ai-msg .body { font-size: 12.5px; line-height: 1.5; color: var(--text-secondary); }
.ai-msg.assistant .body { color: var(--text-primary); }
.ai-trace {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-tertiary);
  padding: 8px 10px;
  display: flex; flex-direction: column; gap: 4px;
}
.ai-trace .step { display: flex; gap: 8px; align-items: center; }
.ai-trace .step .ok { color: var(--accent-money); }
.ai-trace .step .ms { margin-left: auto; }

.ai-artifact {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  padding: 10px 12px;
  font-size: 12.5px;
}
.ai-artifact-h {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px;
  color: var(--text-tertiary);
  margin-bottom: 6px;
}

/* Cmd K modal */
.cmdk-overlay {
  position: fixed; inset: 0;
  background: rgba(8,10,12,0.55);
  backdrop-filter: blur(4px);
  display: grid; place-items: start center;
  padding-top: 12vh;
  z-index: 100;
  animation: fade 140ms var(--ease-out);
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.cmdk {
  width: 560px; max-width: 92vw;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-floating);
  overflow: hidden;
  animation: rise 160ms var(--ease-out);
}
@keyframes rise { from { transform: translateY(8px); opacity: 0; } to { transform: none; opacity: 1; } }
.cmdk-input {
  width: 100%;
  background: transparent;
  border: 0;
  padding: 14px 16px;
  font-size: 14px;
  outline: none;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-subtle);
}
.cmdk-section { padding: 6px 0; }
.cmdk-section-title {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-quaternary);
  padding: 6px 14px;
  font-weight: 500;
}
.cmdk-item {
  display: flex; align-items: center; gap: 10px;
  padding: 7px 14px;
  font-size: 13px;
  color: var(--text-secondary);
  cursor: pointer;
}
.cmdk-item.sel { background: var(--bg-raised); color: var(--text-primary); }
.cmdk-item .kbd { margin-left: auto; font-family: var(--font-mono); font-size: 10.5px; color: var(--text-tertiary); }

/* In-call overlay */
.incall {
  position: fixed; inset: 0;
  background: rgba(8,10,12,0.7);
  z-index: 80;
  display: grid; place-items: center;
  padding: 20px;
  animation: fade 160ms var(--ease-out);
}
.incall-card {
  width: 880px; max-width: 96vw;
  height: 600px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-floating);
  overflow: hidden;
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  grid-template-rows: auto 1fr;
  grid-auto-flow: row;
}

/* Card stack */
.cardstack {
  position: relative;
  width: 320px;
  height: 480px;
  margin: 0 auto;
}
.swipe-card {
  position: absolute;
  inset: 0;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-xl);
  padding: 18px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  box-shadow: var(--shadow-floating);
}

/* Mobile frame */
.mobile-stage {
  display: grid; place-items: center;
  height: 100%;
  background: var(--bg-base);
}
.mobile-frame {
  width: 360px; height: 720px;
  background: var(--bg-base);
  border: 1px solid var(--border-strong);
  border-radius: 36px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  position: relative;
  box-shadow: var(--shadow-floating);
}
.m-statusbar {
  height: 36px;
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 22px;
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.m-content { flex: 1; overflow: auto; padding: 0 16px 12px; }
.m-tabbar {
  height: 60px;
  border-top: 1px solid var(--border-subtle);
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  align-items: center;
}
.m-tab {
  display: flex; flex-direction: column; align-items: center; gap: 3px;
  font-size: 10px;
  color: var(--text-tertiary);
}
.m-tab.active { color: var(--accent-money); }

/* Org tree */
.tree-svg { width: 100%; height: 100%; display: block; }
.tree-node circle { transition: all 200ms var(--ease-out); cursor: pointer; }

/* Coaching annotation, etc - reusable */
.divider { height: 1px; background: var(--border-subtle); margin: 12px 0; }

.scrollh { overflow-x: auto; }

/* Animation helpers */
.fade-in { animation: fade 200ms var(--ease-out); }
.rise-in { animation: rise 240ms var(--ease-out); }

/* selection */
::selection { background: color-mix(in oklch, var(--accent-money) 35%, transparent); color: var(--text-primary); }

/* ──────────────────────────────────────────────────────────────────────────
   Modal + form primitives (used by Pipeline filter, New-lead, Bulk-assign,
   In-call overlay)
   ────────────────────────────────────────────────────────────────────────── */
.modal {
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-floating);
  max-height: 86vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.modal-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border-subtle);
}
.modal-t { font-size: 13.5px; font-weight: 500; display: inline-flex; gap: 8px; align-items: center; }
.modal-body { padding: 14px; overflow-y: auto; display: flex; flex-direction: column; gap: 10px; }
.modal-foot {
  padding: 10px 14px;
  border-top: 1px solid var(--border-subtle);
  display: flex; justify-content: flex-end; gap: 8px;
}

.field { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.field-l { font-size: 11px; color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 500; }
.field-h { font-size: 11px; color: var(--text-quaternary); }

/* Auto-wrap container for rows of fields. Drop-in replacement for
   `display: grid; gridTemplateColumns: 1fr 1fr 1fr` etc. — fields stay
   readable at full width and wrap to fewer columns inside narrow panels
   instead of clipping the rightmost input. */
.field-row {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
  align-items: end;
}

.text-input {
  background: var(--bg-base);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  color: var(--text-primary);
  padding: 7px 10px;
  font-size: 12.5px;
  font-family: var(--font-ui);
  outline: none;
  transition: border-color 120ms;
  /* Grid/flex children default to min-content sizing — without these two
     lines, a long placeholder like "+15125550199" pushes the cell wider
     than its column allocation and clips the next input (the bug Ian hit
     on the Carriers tab's ZIP field). */
  min-width: 0;
  width: 100%;
  box-sizing: border-box;
}
.text-input:focus { border-color: var(--accent-money); }
.text-input[type="range"] { padding: 0; background: transparent; border: 0; }
select.text-input { appearance: none; padding-right: 26px; background-image: linear-gradient(45deg, transparent 50%, var(--text-tertiary) 50%), linear-gradient(135deg, var(--text-tertiary) 50%, transparent 50%); background-position: calc(100% - 14px) 50%, calc(100% - 9px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }

/* ── Client Book: scoped density overrides ──────────────────────────────
   Default `.kpi` runs 28px values + 14/16/12 padding which dominates the
   table-first surface of the book. Tighten only inside `.book-clients`
   so the global KPI strip on Today / P&L / etc. is untouched. */
.book-clients .kpi { padding: 8px 10px 7px; }
.book-clients .kpi-label { font-size: 9.5px; letter-spacing: 0.08em; }
.book-clients .kpi-val { font-size: 18px; margin-top: 2px; letter-spacing: -0.02em; }
.book-clients .kpi-meta { font-size: 10.5px; margin-top: 2px; }
/* Filter dropdowns: shrink-to-content instead of stretching the row.
   Search input takes remaining space. Heights aligned via the same
   compact padding. */
.book-clients .filter-search { flex: 1 1 220px; max-width: 320px; font-size: 12px; padding: 5px 9px; }
.book-clients select.text-input { width: auto; min-width: 0; font-size: 12px; padding: 5px 24px 5px 9px; background-position: calc(100% - 10px) 50%, calc(100% - 6px) 50%; }

.chip-danger { background: color-mix(in oklch, var(--state-danger) 14%, transparent); color: var(--state-danger); border-color: color-mix(in oklch, var(--state-danger) 30%, transparent); }

/* ── Quote tool: responsive grid helpers ────────────────────────────────── */
/* Two-column outer (profile | results) — wraps to single column when there
   isn't room. Uses container-query-style auto-fit so it adapts to the panel
   width, not the viewport. */
.quote-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(420px, 100%), 1fr));
  gap: 14px;
}
/* Auto-fit field row — every field gets a sensible minimum width and the
   grid reflows when the card narrows. Used inside profile sections. */
.quote-fields {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 8px;
}
.quote-fields--narrow { grid-template-columns: repeat(auto-fit, minmax(110px, 1fr)); }
.quote-fields--wide   { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.quote-fields .field-wide { grid-column: span 2; }
@container (max-width: 380px) { .quote-fields .field-wide { grid-column: span 1; } }

/* Recommendation banner — visible "best pick + why" surface */
.quote-pick {
  background: color-mix(in oklch, var(--accent-money) 10%, var(--bg-elevated));
  border: 1px solid color-mix(in oklch, var(--accent-money) 35%, var(--border-subtle));
  border-radius: 8px;
  padding: 12px 14px;
  margin: 10px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 14px;
}
.quote-pick-h { font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--accent-money); font-weight: 600; }
.quote-pick-name { font-size: 16px; font-weight: 700; color: var(--text-primary); margin-top: 2px; }
.quote-pick-why { font-size: 11.5px; color: var(--text-secondary); line-height: 1.55; margin-top: 6px; }
.quote-pick-why .reason-row { display: flex; gap: 8px; margin-top: 4px; align-items: baseline; }
.quote-pick-why .reason-row .reason-tag {
  font-size: 9.5px; text-transform: uppercase; letter-spacing: 0.06em;
  background: color-mix(in oklch, var(--accent-money) 18%, transparent);
  color: var(--accent-money); padding: 2px 6px; border-radius: 3px; white-space: nowrap; flex-shrink: 0;
}
.quote-pick-price { font-size: 22px; font-weight: 700; color: var(--accent-money); text-align: right; line-height: 1; }
.quote-pick-class { font-size: 10.5px; color: var(--text-tertiary); margin-top: 4px; text-align: right; }
.quote-pick-source { font-size: 10px; color: var(--text-quaternary); margin-top: 8px; grid-column: 1 / -1; font-family: var(--font-mono, monospace); }

/* Carrier result row — wraps cleanly on narrow widths */
.quote-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) auto;
  gap: 10px 12px;
  align-items: center;
  padding: 11px 13px;
  margin-bottom: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}
.quote-row.is-best {
  background: color-mix(in oklch, var(--accent-money) 8%, var(--bg-raised));
  border-color: color-mix(in oklch, var(--accent-money) 40%, transparent);
}
.quote-row.is-decline {
  border-color: color-mix(in oklch, var(--state-danger) 25%, transparent);
  opacity: 0.78;
}
.quote-row .qr-name { font-weight: 600; font-size: 13px; min-width: 0; }
.quote-row .qr-meta { font-size: 10.5px; color: var(--text-quaternary); margin-top: 2px; }
.quote-row .qr-reason { font-size: 11px; color: var(--text-tertiary); line-height: 1.5; min-width: 0; }
.quote-row .qr-price { font-size: 16px; font-weight: 700; text-align: right; min-width: 110px; }
.quote-row .qr-price-best { color: var(--accent-money); }
.quote-row .qr-class { font-size: 10.5px; color: var(--text-tertiary); margin-top: 2px; text-align: right; }

@media (max-width: 720px) {
  .quote-row { grid-template-columns: 1fr; gap: 4px; padding: 10px 12px; }
  .quote-row .qr-price, .quote-row .qr-class { text-align: left; min-width: 0; }
}

/* ──────────────────────────────────────────────────────────────────────────
   Responsive — let the desktop app fold gracefully onto phone widths
   ────────────────────────────────────────────────────────────────────────── */
@media (max-width: 1100px) {
  .app { grid-template-columns: 220px 1fr !important; }
  .kpi-row { grid-template-columns: repeat(2, 1fr) !important; }
  .calls-grid, .team-grid, .org-grid, .tiering-grid, .rec-grid, .book-grid, .cards-2col {
    grid-template-columns: 1fr !important;
  }
}

@media (max-width: 820px) {
  .sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 50; transform: translateX(-100%); transition: transform 200ms var(--ease-out); width: 240px; }
  .app[data-mobile-nav="open"] .sidebar { transform: translateX(0); }
  .app { grid-template-columns: 1fr !important; }
  .topbar .crumbs { display: none; }
  .topbar .cmdk-trigger span:not(.kbd) { display: none; }
  .topbar .cmdk-trigger { width: 32px; padding: 0; justify-content: center; }
  .topbar .lb-pill { display: none; }
  .page-pad { padding: 14px !important; }
  .page-h { flex-wrap: wrap; gap: 8px; }
  .kpi-row { grid-template-columns: 1fr 1fr !important; }
  .kpi.hero { grid-column: 1 / -1; }
}

@media (max-width: 520px) {
  .kpi-row { grid-template-columns: 1fr !important; }
  .list-h, .row { font-size: 11.5px; }
  .modal { width: calc(100vw - 24px) !important; }
  .cmdk { width: calc(100vw - 24px); }
  .tweaks-panel { display: none; }
}

/* ──────────────────────────────────────────────────────────────────────────
   Slide-out panel (lead detail, notifications)
   ────────────────────────────────────────────────────────────────────────── */
.slideout-overlay {
  position: fixed; inset: 0; z-index: 60;
  background: var(--dim-overlay);
  -webkit-backdrop-filter: blur(2px); backdrop-filter: blur(2px);
  display: flex; justify-content: flex-end;
  animation: fade 160ms var(--ease-out);
}
.slideout {
  width: 440px;
  max-width: 100vw;
  height: 100vh;
  background: var(--bg-elevated);
  border-left: 1px solid var(--border-subtle);
  box-shadow: -20px 0 40px -20px rgba(0,0,0,0.7);
  display: flex; flex-direction: column;
  animation: slidein 240ms var(--ease-out);
}
@keyframes slidein {
  from { transform: translateX(100%); }
  to   { transform: translateX(0); }
}
.slideout-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--border-subtle);
}
.slideout-body { flex: 1; overflow-y: auto; padding: 16px; display: flex; flex-direction: column; gap: 6px; }
.slideout-foot {
  border-top: 1px solid var(--border-subtle);
  padding: 12px 14px;
  display: flex; gap: 8px; justify-content: flex-end;
}

/* ──────────────────────────────────────────────────────────────────────────
   Spend congruency strip — under page header on Today / Queue
   ────────────────────────────────────────────────────────────────────────── */
.spend-strip {
  display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px;
  margin: -4px 0 12px;
  background: color-mix(in oklch, var(--accent-money) 4%, var(--bg-elevated));
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  font-size: 11.5px;
}
.spend-strip .spend-l { color: var(--text-tertiary); text-transform: uppercase; letter-spacing: 0.04em; font-size: 10.5px; }
.spend-strip .spend-v { color: var(--text-primary); font-weight: 500; font-variant-numeric: tabular-nums; }
.spend-strip .spend-v.money { color: var(--accent-money); }
.spend-strip .spend-v.warn  { color: var(--state-warning); }
.spend-strip .spend-sep    { color: var(--text-quaternary); margin: 0 2px; }

/* keyboard helpers */
.kbd.mono { font-family: var(--font-mono); }

/* extra responsive — Settings + dispatch + queue + today + kanban grids fold */
@media (max-width: 1100px) {
  .settings-grid, .dispatch-grid, .queue-grid, .today-grid, .kanban-grid {
    grid-template-columns: 1fr !important;
  }
}
@media (max-width: 820px) {
  .slideout { width: 100vw; }
  .spend-strip { gap: 6px; padding: 6px 8px; }
}

/* P7 (2026-05-11) — Settings → Profile responsive grids. The form uses
   2 / 3 / 4 column layouts on desktop; collapse to single column below
   720px so fields stay legible on phones + small split-screens. */
@media (max-width: 720px) {
  .profile-grid-2,
  .profile-grid-3,
  .profile-grid-4 {
    grid-template-columns: 1fr !important;
  }
}

/* ──────────────────────────────────────────────────────────────────────────
   Recruiting workbench — tab strip + multi-pane layouts
   ────────────────────────────────────────────────────────────────────────── */
.rec-tabs {
  display: flex;
  gap: 2px;
  padding: 2px;
  margin-bottom: 14px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-md);
  width: fit-content;
}
.rec-tab {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 6px 14px;
  font-size: 12.5px;
  color: var(--text-tertiary);
  background: transparent;
  border: 0;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background 120ms, color 120ms;
}
.rec-tab:hover { color: var(--text-secondary); }
.rec-tab.active {
  background: var(--bg-raised);
  color: var(--text-primary);
  font-weight: 500;
}
.rec-tab-n {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 16px; padding: 0 5px;
  background: var(--bg-overlay);
  color: var(--text-tertiary);
  border-radius: 8px;
  font-size: 10px; font-weight: 500; font-variant-numeric: tabular-nums;
}
.rec-tab.active .rec-tab-n {
  background: var(--accent-money);
  color: oklch(0.18 0.005 260);
}

@media (max-width: 1100px) {
  .rec-detail-grid, .seq-grid { grid-template-columns: 1fr !important; }
  .convo-grid { grid-template-columns: 280px 1fr !important; }
  .convo-grid > *:nth-child(3) { display: none !important; }  /* hide profile pane on tablet */
}
@media (max-width: 820px) {
  .convo-grid { grid-template-columns: 1fr !important; height: auto !important; }
  .convo-grid > *:nth-child(1) { max-height: 220px; overflow-y: auto; }
  .rec-tabs { flex-wrap: wrap; }
}

/* Live / demo badge in topbar */
.live-badge {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 8px;
  margin-left: 8px;
  font-size: 10px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  border-radius: 999px;
  border: 1px solid var(--border-subtle);
}
.live-badge .dot { width: 5px; height: 5px; border-radius: 50%; }
.live-badge.on  { color: var(--accent-money); background: color-mix(in oklch, var(--accent-money) 10%, transparent); border-color: color-mix(in oklch, var(--accent-money) 30%, transparent); }
.live-badge.on .dot { background: var(--accent-money); animation: pulseDot 2s ease-in-out infinite; }
.live-badge.off { color: var(--text-tertiary); }
.live-badge.off .dot { background: var(--text-quaternary); }
@keyframes pulseDot {
  0%, 100% { opacity: 1; transform: scale(1); }
  50%       { opacity: 0.4; transform: scale(1.4); }
}

/* ──────────────────────────────────────────────────────────────────────────
   Login screen
   ────────────────────────────────────────────────────────────────────────── */
.login-shell {
  min-height: 100vh;
  display: grid;
  place-items: center;
  background: radial-gradient(circle at 30% 20%, color-mix(in oklch, var(--accent-money) 6%, var(--bg-base)), var(--bg-base) 60%);
  padding: 20px;
  font-family: var(--font-ui);
}
.login-card {
  width: 100%;
  max-width: 380px;
  padding: 24px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 14px;
  box-shadow: var(--shadow-floating);
}
.login-foot {
  position: fixed;
  bottom: 16px;
  font-size: 11px;
  color: var(--text-quaternary);
  letter-spacing: 0.04em;
}

/* AI rail typing dots */
.ai-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--text-tertiary);
  animation: aiDotPulse 1.2s ease-in-out infinite;
}
.ai-dot:nth-child(2) { animation-delay: 0.2s; }
.ai-dot:nth-child(3) { animation-delay: 0.4s; }
@keyframes aiDotPulse {
  0%, 100% { opacity: 0.3; transform: translateY(0); }
  50%       { opacity: 1;   transform: translateY(-3px); }
}

/* ──────────────────────────────────────────────────────────────────────────
   Toasts
   ────────────────────────────────────────────────────────────────────────── */
.toast-host {
  position: fixed; bottom: 20px; right: 20px; z-index: 200;
  display: flex; flex-direction: column; gap: 8px;
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: 8px;
  min-width: 280px; max-width: 400px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  box-shadow: var(--shadow-floating);
  font-size: 12.5px;
  animation: toastIn 200ms var(--ease-out);
}
.toast-success { border-left: 3px solid var(--accent-money); }
.toast-error    { border-left: 3px solid var(--state-danger); }
.toast-info     { border-left: 3px solid var(--state-info); }
@keyframes toastIn {
  from { opacity: 0; transform: translateX(20px); }
  to   { opacity: 1; transform: translateX(0); }
}

/* Skeleton loader */
.skel { display: inline-block; background: linear-gradient(90deg, var(--bg-raised) 0%, var(--bg-overlay) 50%, var(--bg-raised) 100%); background-size: 200% 100%; animation: skelShine 1.4s ease-in-out infinite; border-radius: 4px; }
.skel-line { height: 12px; }
@keyframes skelShine { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

/* Empty state */
.empty-state { padding: 48px 24px; text-align: center; color: var(--text-tertiary); }
.empty-state-icon { display: inline-flex; padding: 10px; background: color-mix(in oklch, var(--accent-money) 8%, transparent); border-radius: 50%; }
.empty-state-title { margin-top: 14px; font-size: 14px; font-weight: 500; color: var(--text-primary); }
.empty-state-sub  { margin-top: 4px; font-size: 12.5px; max-width: 360px; margin-left: auto; margin-right: auto; line-height: 1.5; }

/* Onboarding tour */
.tour-overlay { position: fixed; bottom: 24px; right: 24px; z-index: 150; }
.tour-card    { width: 360px; padding: 18px; background: var(--bg-elevated); border: 1px solid var(--accent-money); border-radius: 12px; box-shadow: var(--shadow-floating); animation: tourPop 240ms var(--ease-out); }
@keyframes tourPop { from { opacity: 0; transform: translateY(12px) scale(0.96); } to { opacity: 1; transform: translateY(0) scale(1); } }

/* Autodial floating bar */
.autodial-bar {
  position: fixed;
  left: 50%;
  bottom: 18px;
  transform: translateX(-50%);
  z-index: 80;
  width: min(880px, calc(100vw - 28px));
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 14px;
  border-radius: 999px;
  background: color-mix(in oklch, var(--bg-elevated) 88%, transparent);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
  backdrop-filter: blur(20px) saturate(180%);
  border: 1px solid color-mix(in oklch, var(--border-subtle) 75%, transparent);
  box-shadow:
    0 1px 0 color-mix(in oklch, var(--text-primary) 5%, transparent) inset,
    0 18px 40px -18px rgba(0,0,0,0.7);
  animation: rise 240ms var(--ease-out);
}

/* Training hub — when Coaching/Calls/Training panes render inside the
   Training shell, suppress their inner page-pad + page-header + dashboard
   sub-nav strip. Without this we stack two titles, pad twice, and surface
   manager-dashboard nav (Floor / NIGO / Dispatch) under a Training tab. */
.training-embed > .page-pad { padding: 0; }
.training-embed > .page-pad > .page-h:first-child { display: none; }
.training-embed > .page-pad > .section-pill { display: none; }
.training-embed > .page-pad > .kpi-row { margin-top: 0; }

/* coaching-embed (CoachingPane inside PageTraining): strip the duplicate
   page-pad + page-h title, but KEEP the SectionPill so the user always has
   a way back to Team Board / NIGO / Recruiting / Dispatch. The old class
   used .training-embed and hid this pill, trapping the user (bug fix 2026-05-16). */
.coaching-embed > .page-pad { padding: 0; }
.coaching-embed > .page-pad > .page-h:first-child { display: none; }
.coaching-embed > .page-pad > .kpi-row { margin-top: 0; }

.coaching-kpi-row {
  grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
  gap: 8px;
}
.coaching-kpi-row .kpi {
  padding: 10px 12px;
  container-type: inline-size;
}
.coaching-kpi-row .kpi-label {
  font-size: 10px;
  letter-spacing: 0.04em;
}
.coaching-kpi-row .kpi-val {
  font-size: clamp(18px, 3vw, 25px);
  font-size: clamp(18px, 12cqw, 25px);
  line-height: 1.08;
  overflow-wrap: anywhere;
}
.coaching-kpi-row .kpi-meta {
  font-size: 10.5px;
  gap: 5px;
}
.coaching-shell-grid {
  align-items: start;
}
.coaching-card-grid {
  padding: 6px;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 6px;
}
.coaching-card {
  min-width: 0;
  padding: 6px 8px;
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
}
.coaching-card-head {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
}
.coaching-card-name {
  font-size: 11.5px;
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.coaching-card-meta,
.coaching-card-impact {
  font-size: 10px;
  color: var(--text-tertiary);
}
.coaching-card-focus {
  margin-top: 4px;
  color: var(--accent-status);
  font-size: 11px;
  font-weight: 600;
  line-height: 1.25;
}
.coaching-card-evidence {
  margin-top: 2px;
  color: var(--text-secondary);
  font-size: 10.5px;
  line-height: 1.35;
}
.coaching-card-actions {
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 4px;
  justify-content: space-between;
  flex-wrap: wrap;
}
.coaching-card-impact span {
  color: var(--accent-money);
}
.coaching-card-btn {
  min-height: 24px;
  padding: 3px 6px;
  font-size: 10px;
  white-space: nowrap;
}
.coaching-impact-chip {
  max-width: 100%;
  overflow-wrap: anywhere;
  white-space: normal;
}

/* Training section pill — promote it to feel like a real horizontal tab strip */
.training-tabs.section-pill { margin: 4px 0 16px; padding: 4px; font-size: 13px; }
.training-tabs.section-pill > button { padding: 7px 16px; font-size: 13px; }

/* Skeleton shimmer — used by Shared.Skeleton */
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }
@media (prefers-reduced-motion: reduce) {
  @keyframes shimmer { 0%, 100% { background-position: 0 0; } }
}

/* ─── Global text-wrap discipline ─────────────────────────────────────── */
.panel, .kpi, .row, .list-h, .modal,
.os-glass-bar, .os-glass-btn,
.tier, .chip, .meta {
  min-width: 0;
}
.panel, .kpi, .row, .modal {
  overflow-wrap: anywhere;
  word-break: break-word;
}
.panel pre, .panel code, .modal pre, .modal code {
  overflow-wrap: anywhere;
  word-break: break-all;
  white-space: pre-wrap;
}
.cell-truncate {
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
  min-width: 0;
}

/* CRM nested embed */
.crm-nested-recruiting > .page-pad { padding: 0; }
.crm-nested-recruiting > .page-pad > .page-h:first-child { display: none; }

/* Empty-state mono tag */
.koino-empty {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-quaternary);
  letter-spacing: 0.02em;
  font-weight: 400;
}
.koino-empty::before { content: "// "; opacity: 0.6; }

/* ============================================================
   Today Hero — gamified 3-band entry row
   Added 2026-06-16. Sits above the existing sub-tabs.
   ============================================================ */
.today-hero {
  display: grid;
  grid-template-columns: minmax(0, 1.1fr) minmax(0, 1fr) minmax(0, 1.3fr);
  gap: 12px;
  margin-bottom: 14px;
}
@media (max-width: 980px) {
  .today-hero { grid-template-columns: 1fr; gap: 10px; }
}
.today-band {
  background: var(--bg-raised);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-width: 0;
}
.today-band-head {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.today-band-head > span:first-of-type { color: var(--text-secondary); }
.today-band-meta { margin-left: auto; font-weight: 500; font-size: 10.5px; text-transform: none; letter-spacing: 0; color: var(--text-quaternary); }
.today-band-edit {
  margin-left: auto;
  background: transparent;
  border: none;
  color: var(--text-tertiary);
  font-size: 11px;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 4px;
}
.today-band-edit:hover { background: var(--bg-overlay); color: var(--text-secondary); }

/* COMMIT band */
.commit-band.is-locked {
  background: color-mix(in oklch, var(--accent-money) 6%, var(--bg-raised));
  border-color: color-mix(in oklch, var(--accent-money) 30%, var(--border-subtle));
}
.commit-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.commit-cell {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 8px 10px;
  background: var(--bg-base, var(--bg-overlay));
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  min-width: 0;
}
.commit-cell-readonly { background: transparent; }
.commit-cell-label {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
}
.commit-cell-input {
  background: transparent;
  border: none;
  font: inherit;
  font-size: 18px;
  font-weight: 600;
  color: var(--text-primary);
  padding: 0;
  width: 100%;
  outline: none;
}
.commit-cell-input:disabled { color: var(--accent-money); cursor: default; }
.commit-cell-val { font-size: 18px; font-weight: 600; color: var(--text-primary); }
.commit-cell-sub { font-size: 10.5px; color: var(--text-quaternary); }
.commit-lock-btn { align-self: flex-start; }

/* LOG band */
.log-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.log-tap {
  --tap-tone: var(--text-secondary);
  appearance: none;
  background: var(--bg-base, var(--bg-overlay));
  border: 1px solid var(--border-subtle);
  border-radius: 8px;
  padding: 14px 10px 10px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  color: var(--tap-tone);
  transition: transform 60ms ease, box-shadow 120ms ease, background 120ms ease;
  user-select: none;
}
.log-tap:hover {
  background: color-mix(in oklch, var(--tap-tone) 6%, var(--bg-raised));
  border-color: color-mix(in oklch, var(--tap-tone) 30%, var(--border-subtle));
}
.log-tap:active { transform: scale(0.96); }
.log-tap-count {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1;
}
.log-tap-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-tertiary);
}
.log-feed {
  display: flex;
  flex-direction: column;
  gap: 4px;
  max-height: 220px;
  overflow-y: auto;
}
.log-feed-empty {
  font-size: 11.5px;
  color: var(--text-quaternary);
  padding: 14px 0;
  text-align: center;
  font-style: italic;
}
.log-feed-row {
  display: grid;
  grid-template-columns: 14px minmax(60px, auto) 1fr auto;
  gap: 8px;
  align-items: center;
  font-size: 11.5px;
  padding: 4px 0;
}
.log-feed-who { font-weight: 600; color: var(--text-secondary); }
.log-feed-what { color: var(--text-secondary); }
.log-feed-when { color: var(--text-quaternary); font-size: 10.5px; }

/* HYPE band */
.hype-rail {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}
.hype-rail-rep { grid-template-columns: repeat(2, minmax(0, 1fr)); }
@media (max-width: 560px) {
  .hype-rail { grid-template-columns: 1fr; }
}
.hype-tile {
  background: var(--bg-base, var(--bg-overlay));
  border: 1px solid var(--border-subtle);
  border-radius: 6px;
  padding: 10px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.hype-tile-hero {
  grid-column: span 2;
  background: linear-gradient(135deg,
    color-mix(in oklch, var(--accent-money) 10%, var(--bg-raised)),
    var(--bg-raised));
  border-color: color-mix(in oklch, var(--accent-money) 25%, var(--border-subtle));
}
.hype-tile-num {
  font-size: 22px;
  font-weight: 700;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  line-height: 1.1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.hype-tile-label {
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-top: 2px;
}
.hype-tile-sub { font-size: 10.5px; color: var(--text-quaternary); }
.hype-tile-empty { color: var(--text-quaternary); }
.hype-tile-peers { grid-column: span 2; padding-bottom: 6px; }
.hype-peers-list {
  list-style: none;
  margin: 4px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.hype-peers-list li {
  display: grid;
  grid-template-columns: 18px 1fr auto;
  gap: 6px;
  align-items: baseline;
  font-size: 12px;
  padding: 2px 0;
}
.hype-peers-list li.is-me {
  color: var(--accent-money);
  font-weight: 600;
}
.hype-peer-rank { color: var(--text-tertiary); font-variant-numeric: tabular-nums; font-size: 11px; }
.hype-peer-name { color: var(--text-secondary); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hype-peer-val { color: var(--text-secondary); font-variant-numeric: tabular-nums; font-size: 11.5px; }
.streak-flame {
  display: inline-block;
  font-size: 18px;
  margin-right: 4px;
  filter: drop-shadow(0 0 4px color-mix(in oklch, var(--accent-heat) 60%, transparent));
}
