/* ══════════════════════════════════════════════════════════════
   harvey · nymm — dashboard styles
   Built on the nymm system ("Swiss Editorial / Pure Architecture").

   Rules the whole sheet follows:

   1. Two hues carry meaning: the nymm purple marks the brand and
      "where you are" (active tab, selection, focus, primary action);
      STATUS colours mark state. Everything else is paper and ink.
   2. Structure comes from 1px solid dividers, alignment and type —
      never from drop shadows. Shadows exist only on things that
      float (toasts).
   3. Every figure is monospaced and tabular, so columns of numbers
      line up and a changing value doesn't shift the layout.

   Light is nymm exactly. Dark is the same design re-tokenised on
   onyx; purple used as text is lifted there so it stays legible.
   Nothing but the values in :root / [data-theme] changes.
   ══════════════════════════════════════════════════════════════ */

/* Local faces — the offline fallback. Plus Jakarta Sans and JetBrains
   Mono come from Google Fonts (index.html); without a network, Geist
   and Geist Mono take over with no layout change worth noticing. */
@font-face {
  font-family: 'Newsreader'; font-style: normal; font-weight: 400 500;
  font-display: swap; src: url('/fonts/newsreader.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist'; font-style: normal; font-weight: 400 600;
  font-display: swap; src: url('/fonts/geist.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono'; font-style: normal; font-weight: 400 500;
  font-display: swap; src: url('/fonts/geist-mono.woff2') format('woff2');
}

/* ── Tokens ──────────────────────────────────────────────────── */

:root {
  --serif: 'Newsreader', Georgia, Cambria, 'Times New Roman', serif;
  --sans: 'Plus Jakarta Sans', 'Geist', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'JetBrains Mono', 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --r-sm: 2px;
  --r-md: 2px;
  --gut: clamp(16px, 3.4vw, 40px);
  --ease: cubic-bezier(0.16, 1, 0.3, 1);

  /* Light — nymm editorial paper. */
  --bg:            #F8F7F4;
  --bg-subtle:     #F0EDE5;
  --panel:         #FFFFFF;
  --panel-raised:  #F5F3EE;
  --border:        #DCD8CE;
  --hair:          #E6E3D8;
  --border-strong: #C4BFB2;
  --rule:          #0B0B0E;   /* the heavy 1px rule over a ledger */
  --text:          #0B0B0E;
  --text-body:     #272730;
  --text-2:        #5E5D68;
  --text-3:        #727080;   /* nymm faint, nudged to AA for small meta text */
  --text-4:        #8A8895;   /* decorative only: nav numbers, glyph field */
  --ink:           #0B0B0E;
  --ink-contrast:  #F8F7F4;
  --ink-soft:      #EDEAE2;

  /* Rebecca Purple. --accent is purple-as-text/line (lifted on dark);
     --accent-fill sits behind white text and never lifts. */
  --accent:         #663399;
  --accent-deep:    #522288;
  --accent-fill:    #663399;
  --accent-fill-hover: #522288;
  --accent-surface: rgba(102, 51, 153, 0.07);
  --accent-line:    rgba(102, 51, 153, 0.30);
  --on-accent:      #FFFFFF;

  --s-good:   #2E6A4C;  --s-good-bg:   #EAF2EC;  --s-good-line:   #CADDD1;
  --s-wait:   #8A5B0E;  --s-wait-bg:   #F8EFDC;  --s-wait-line:   #E8D7B0;
  --s-bad:    #A03A36;  --s-bad-bg:    #F9E9E7;  --s-bad-line:    #ECCDC9;
  --s-active: #2D5C88;  --s-active-bg: #E8EFF6;  --s-active-line: #CBD9E8;
  --s-note:   #663399;  --s-note-bg:   rgba(102,51,153,0.07); --s-note-line: rgba(102,51,153,0.26);
  --red: var(--s-bad);

  --shadow: 0 10px 30px rgba(11, 11, 14, 0.12);
  color-scheme: light;
}

/* Dark — onyx and graphite. Declared twice on purpose: once for an
   explicit choice, once for the system preference when the user hasn't
   chosen. A single selector list can't do both, because the explicit
   one must win over the media query. */
:root[data-theme='dark'] {
  --bg:            #0B0B0E;
  --bg-subtle:     #111116;
  --panel:         #141419;
  --panel-raised:  #1B1B22;
  --border:        #2A2A33;
  --hair:          #212129;
  --border-strong: #3B3B46;
  --rule:          #6E6C7A;
  --text:          #F3F1EC;
  --text-body:     #DAD8D2;
  --text-2:        #B1AFBA;
  --text-3:        #8E8C99;
  --text-4:        #5F5D6A;
  --ink:           #F3F1EC;
  --ink-contrast:  #0B0B0E;
  --ink-soft:      #24242C;

  --accent:         #A47DDB;
  --accent-deep:    #663399;
  --accent-fill:    #663399;
  --accent-fill-hover: #7A4BB0;
  --accent-surface: rgba(164, 125, 219, 0.10);
  --accent-line:    rgba(164, 125, 219, 0.38);
  --on-accent:      #FFFFFF;

  --s-good:   #7DBE98;  --s-good-bg:   rgba(125,190,152,0.11);  --s-good-line:   rgba(125,190,152,0.28);
  --s-wait:   #D8AD62;  --s-wait-bg:   rgba(216,173,98,0.11);   --s-wait-line:   rgba(216,173,98,0.28);
  --s-bad:    #E08A80;  --s-bad-bg:    rgba(224,138,128,0.11);  --s-bad-line:    rgba(224,138,128,0.28);
  --s-active: #86AEDB;  --s-active-bg: rgba(134,174,219,0.11);  --s-active-line: rgba(134,174,219,0.28);
  --s-note:   #A47DDB;  --s-note-bg:   rgba(164,125,219,0.11);  --s-note-line:   rgba(164,125,219,0.30);

  --shadow: 0 10px 32px rgba(0, 0, 0, 0.6);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg:#0B0B0E; --bg-subtle:#111116; --panel:#141419; --panel-raised:#1B1B22;
    --border:#2A2A33; --hair:#212129; --border-strong:#3B3B46; --rule:#6E6C7A;
    --text:#F3F1EC; --text-body:#DAD8D2; --text-2:#B1AFBA; --text-3:#8E8C99; --text-4:#5F5D6A;
    --ink:#F3F1EC; --ink-contrast:#0B0B0E; --ink-soft:#24242C;
    --accent:#A47DDB; --accent-deep:#663399; --accent-fill:#663399; --accent-fill-hover:#7A4BB0;
    --accent-surface:rgba(164,125,219,0.10); --accent-line:rgba(164,125,219,0.38); --on-accent:#FFFFFF;
    --s-good:#7DBE98; --s-good-bg:rgba(125,190,152,0.11); --s-good-line:rgba(125,190,152,0.28);
    --s-wait:#D8AD62; --s-wait-bg:rgba(216,173,98,0.11); --s-wait-line:rgba(216,173,98,0.28);
    --s-bad:#E08A80; --s-bad-bg:rgba(224,138,128,0.11); --s-bad-line:rgba(224,138,128,0.28);
    --s-active:#86AEDB; --s-active-bg:rgba(134,174,219,0.11); --s-active-line:rgba(134,174,219,0.28);
    --s-note:#A47DDB; --s-note-bg:rgba(164,125,219,0.11); --s-note-line:rgba(164,125,219,0.30);
    --shadow:0 10px 32px rgba(0,0,0,0.6);
    color-scheme: dark;
  }
}

* { margin: 0; padding: 0; box-sizing: border-box; }
::selection { background: var(--ink); color: var(--ink-contrast); }

html { scroll-behavior: smooth; -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--sans);
  background: var(--bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.55;
  letter-spacing: -0.006em;
  min-height: 100dvh;
  position: relative;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  transition: background-color .25s var(--ease), color .25s var(--ease);
}
a { color: inherit; text-decoration: underline; text-underline-offset: 3px;
    text-decoration-color: var(--border-strong); text-decoration-thickness: 1px;
    transition: color .2s var(--ease), text-decoration-color .2s var(--ease); }
a:hover { color: var(--accent); text-decoration-color: var(--accent); }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-sm); }
.code {
  font-family: var(--mono); font-size: 12px; letter-spacing: 0;
  background: var(--panel-raised); border: 1px solid var(--hair);
  border-radius: var(--r-sm); padding: 0 4px;
}

/* ── ASCII glyph field (decorative) ──────────────────────────── */

.glyph-field {
  position: absolute; top: 132px; left: 22px; z-index: 0;
  margin: 0; pointer-events: none; user-select: none;
  font-family: var(--mono); font-size: 11px; line-height: 2.25; letter-spacing: 0.08em;
  color: var(--text-4); opacity: .55; white-space: pre;
  display: none;
}
/* Only where there's a real empty margin beside the content column. */
@media (min-width: 1720px) { .glyph-field { display: block; } }

/* ── Masthead ────────────────────────────────────────────────── */

header {
  position: relative; z-index: 1;
  display: flex; align-items: center; justify-content: space-between;
  gap: 16px; padding: 16px var(--gut) 14px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
}
.brand { display: flex; align-items: center; gap: 12px; min-width: 0; }
.brand-mark { color: var(--text); flex: none; display: block; transition: transform .3s var(--ease); }
.brand:hover .brand-mark { transform: translateX(2px); }
.brand-lockup { display: grid; line-height: 1; }
.brand-over {
  font-family: var(--mono); font-size: 8.5px; letter-spacing: 0.22em;
  color: var(--text-3); margin-bottom: 4px; white-space: nowrap;
}
.brand-word {
  font-family: var(--sans); font-size: 19px; font-weight: 700;
  letter-spacing: -0.05em; line-height: 1; color: var(--text);
}
.brand-tag {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.2em; color: var(--text-3);
  padding-left: 14px; margin-left: 4px; border-left: 1px solid var(--border);
  align-self: stretch; display: flex; align-items: center; white-space: nowrap;
}
.brand-tag i { font-style: normal; color: var(--accent); margin: 0 .5em; }

.header-controls { display: flex; align-items: center; gap: 8px; flex: none; }
.harvey-status {
  display: flex; align-items: center; gap: 8px;
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--text-2); padding-right: 6px; white-space: nowrap;
}
.status-dot { width: 6px; height: 6px; border-radius: 50%; flex: none; background: var(--text-3); }
.status-dot.running { background: var(--s-good); box-shadow: 0 0 0 3px var(--s-good-bg); }
.status-dot.stopped { background: var(--text-3); }
.status-dot.offline { background: var(--s-bad); box-shadow: 0 0 0 3px var(--s-bad-bg); }

.icon-btn, .refresh-btn {
  display: inline-flex; align-items: center; gap: 8px;
  background: var(--bg-subtle); border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-body); font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.14em; text-transform: uppercase;
  padding: 7px 11px; cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease), background-color .2s var(--ease);
}
.icon-btn::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.icon-btn:hover, .refresh-btn:hover { color: var(--text); border-color: var(--text-2); background: var(--panel); }

/* ── Nav ─────────────────────────────────────────────────────── */

nav {
  position: relative; z-index: 1;
  display: flex; gap: 4px; padding: 0 var(--gut);
  border-bottom: 1px solid var(--rule);
  background: var(--bg);
  overflow-x: auto; scrollbar-width: none;
}
nav::-webkit-scrollbar { display: none; }
nav button {
  position: relative; flex: none;
  display: inline-flex; align-items: baseline; gap: 6px;
  background: none; border: none;
  color: var(--text-body); font-family: var(--sans); font-size: 13px; font-weight: 500;
  letter-spacing: -0.01em;
  padding: 14px 10px 15px; cursor: pointer; white-space: nowrap;
  transition: color .2s var(--ease);
}
nav button:first-child { margin-left: -10px; }
.nav-num {
  font-family: var(--mono); font-size: 9.5px; font-weight: 500; letter-spacing: 0.04em;
  color: var(--text-4); font-variant-numeric: tabular-nums;
  transition: color .2s var(--ease);
}
nav button::after {
  content: ''; position: absolute; left: 10px; right: 10px; bottom: 9px; height: 1px;
  background: var(--accent); transform: scaleX(0); transform-origin: left;
  transition: transform .25s var(--ease);
}
nav button:hover { color: var(--text); }
nav button:hover::after, nav button.active::after { transform: scaleX(1); }
nav button.active { color: var(--text); font-weight: 600; }
nav button.active .nav-num { color: var(--accent); font-weight: 600; }
.nav-count {
  display: none; margin-left: 2px; padding: 0 5px; border-radius: var(--r-sm);
  font-family: var(--mono); font-size: 10px; font-weight: 600; line-height: 16px;
  background: var(--s-wait-bg); color: var(--s-wait); border: 1px solid var(--s-wait-line);
  font-variant-numeric: tabular-nums; align-self: center;
}
.nav-count.on { display: inline-block; }

/* ── Pipeline ticker ─────────────────────────────────────────── */

.marquee {
  position: relative; z-index: 1;
  background: var(--bg-subtle); border-bottom: 1px solid var(--border);
  overflow: hidden; padding: 8px 0;
}
.marquee-track {
  display: flex; align-items: center; gap: 22px; width: max-content;
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--text-2); white-space: nowrap;
  animation: ticker 70s linear infinite;
}
.marquee-track b { color: var(--accent); font-weight: 500; }
@keyframes ticker { to { transform: translateX(-50%); } }

main {
  position: relative; z-index: 1;
  padding: 44px var(--gut) 96px; max-width: 1360px; margin: 0 auto;
}

.section { display: none; }
.section.active { display: block; animation: rise .28s var(--ease); }
@keyframes rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Headings ────────────────────────────────────────────────── */

.section-head { margin-bottom: 34px; max-width: 76ch; }
.section-head.split {
  max-width: none;
  display: flex; align-items: flex-end; justify-content: space-between; gap: 16px 24px;
  flex-wrap: wrap;
}
.section-head.split > div:first-child { max-width: 76ch; min-width: 0; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; }

.eyebrow {
  font-family: var(--mono); font-size: 10.5px; font-weight: 500;
  letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 14px;
}
.eyebrow b { font-weight: 600; letter-spacing: 0.08em; }
.section-head h2 {
  font-family: var(--serif); font-size: clamp(32px, 3.6vw, 46px); font-weight: 400;
  letter-spacing: -0.035em; line-height: 1.08; color: var(--text);
}
.section-head p {
  font-size: 14.5px; color: var(--text-2); margin-top: 12px; line-height: 1.65;
  max-width: 64ch; text-wrap: pretty;
}
.subhead {
  font-family: var(--mono); font-size: 10px; font-weight: 500;
  letter-spacing: 0.2em; text-transform: uppercase; color: var(--text-3);
  border-bottom: 1px solid var(--border); padding-bottom: 8px; margin: 38px 0 14px;
}

/* ── Today: an asymmetric two-column screen ──────────────────── */

.today-grid { display: grid; grid-template-columns: minmax(0,1fr) 300px; gap: 40px; align-items: start; }
.today-rail { display: flex; flex-direction: column; gap: 28px; position: sticky; top: 22px; }
.rail-block > .subhead { margin-top: 0; }

@media (max-width: 1080px) {
  .today-grid { grid-template-columns: 1fr; gap: 28px; }
  .today-rail { position: static; }
}

/* The action queue — the only thing on the page with real weight */
.queue { border-top: 1px solid var(--rule); }
.queue-item {
  display: flex; align-items: flex-start; gap: 18px;
  padding: 18px 2px 18px 0; border-bottom: 1px solid var(--border);
}
.queue-item::before {
  content: ''; width: 2px; align-self: stretch; flex: none; margin-right: 2px;
  background: var(--text-3);
}
.queue-item.warn::before { background: var(--s-wait); }
.queue-item.bad::before  { background: var(--s-bad); }
.queue-item.good::before { background: var(--s-good); }
.queue-item .qtext { flex: 1; min-width: 0; }
.queue-item .qtitle { font-size: 15.5px; font-weight: 600; letter-spacing: -0.02em; }
.queue-item .qdetail {
  font-size: 13.5px; color: var(--text-2); margin-top: 4px;
  max-width: 68ch; text-wrap: pretty;
}
.queue-item .btn { flex: none; margin-top: 1px; }

.queue-clear {
  display: flex; align-items: center; gap: 14px;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--border);
  padding: 24px 2px;
}
.queue-clear .glyph { color: var(--s-good); font-size: 17px; line-height: 1; }
.queue-clear .qtitle { font-size: 15.5px; font-weight: 600; letter-spacing: -0.02em; }
.queue-clear .qdetail { font-size: 13.5px; color: var(--text-2); margin-top: 3px; max-width: 60ch; }

/* Rail figures — a stacked ledger, not glowing tiles */
.figures { border-top: 1px solid var(--rule); }
/* A subhead already draws a rule; a second one right under it reads as a
   mistake. Anything that follows a subhead drops its own top border. */
.subhead + * > .figures,
.subhead + .figures,
.subhead + * > .activity-feed,
.subhead + .activity-feed { border-top: none; }
.figure {
  display: flex; align-items: baseline; justify-content: space-between; gap: 12px;
  padding: 10px 0; border-bottom: 1px solid var(--hair);
}
.figure .k { font-size: 13px; color: var(--text-2); }
.figure .v {
  font-family: var(--mono); font-size: 15px; font-weight: 500; font-variant-numeric: tabular-nums;
  color: var(--text); letter-spacing: -0.02em;
}
.figure .v.zero { color: var(--text-3); font-weight: 400; }
.figure-note { font-size: 11.5px; color: var(--text-3); margin-top: 8px; }

/* Stat ledger (usage, discover) */
.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0;
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--border);
  margin-bottom: 16px;
}
.stat-card { padding: 16px 20px 18px 0; border-right: 1px solid var(--hair); }
.stat-card + .stat-card { padding-left: 20px; }
.stat-card:last-child { border-right: none; }
.stat-card .label {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 10px;
}
.stat-card .value {
  font-family: var(--mono); font-size: 28px; font-weight: 400;
  letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums;
}
.stat-card .breakdown { margin-top: 12px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.chip { font-family: var(--mono); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.chip b { color: var(--text-2); font-weight: 500; }

/* ── Panels ──────────────────────────────────────────────────── */

.card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 26px 28px; margin-bottom: 16px;
  transition: border-color .2s var(--ease);
}
.card h2 { font-size: 16px; font-weight: 600; margin-bottom: 14px; letter-spacing: -0.025em; }
.card .lede { font-size: 13.5px; color: var(--text-2); margin: -4px 0 18px; max-width: 66ch; line-height: 1.6; }

/* nymm card index ("P.01") on the long, static panels */
#settings, #controls { counter-reset: panel; }
#settings > .card > h2::before,
#controls .control-panel > .card > h2::before {
  counter-increment: panel;
  content: 'P.' counter(panel, decimal-leading-zero);
  display: block; margin-bottom: 12px;
  font-family: var(--mono); font-size: 10px; font-weight: 600;
  letter-spacing: 0.2em; color: var(--accent);
}

.sub-card {
  border: 1px solid var(--hair); border-radius: var(--r-sm);
  background: var(--bg); padding: 18px 18px 16px; margin-bottom: 12px;
}
.sub-card:last-child { margin-bottom: 0; }
.sub-card-title { font-weight: 600; letter-spacing: -0.015em; margin-bottom: 4px; }
.sub-card .lede { margin-top: 4px; }

/* ── Buttons ─────────────────────────────────────────────────── */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font-family: var(--sans); font-size: 13px; font-weight: 600; letter-spacing: -0.01em;
  padding: 9px 16px; border-radius: var(--r-sm); border: 1px solid transparent;
  cursor: pointer; white-space: nowrap; text-decoration: none;
  transition: background-color .2s var(--ease), border-color .2s var(--ease), color .2s var(--ease);
}
.btn:active:not(:disabled) { transform: translateY(0.5px); }
.btn:disabled { opacity: .45; cursor: not-allowed; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover:not(:disabled) { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); color: var(--on-accent); }
/* nymm's arrow on full-size primary actions, nudging on hover */
.btn-primary:not(.btn-sm)::after { content: '→'; transition: transform .2s var(--ease); }
.btn-primary:not(.btn-sm):hover:not(:disabled)::after { transform: translateX(3px); }
.desk-actions .btn-primary::after { content: none; }
.btn-secondary { background: transparent; border-color: var(--border); color: var(--text); }
.btn-secondary:hover:not(:disabled) { border-color: var(--ink); background: var(--panel); color: var(--text); }
.btn-danger { background: transparent; border-color: var(--s-bad-line); color: var(--s-bad); }
.btn-danger:hover:not(:disabled) { background: var(--s-bad-bg); border-color: var(--s-bad); color: var(--s-bad); }
.btn-sm { padding: 6px 12px; font-size: 12px; }
.btn-group { display: flex; gap: 10px; margin-top: 18px; flex-wrap: wrap; }
.btn kbd { background: rgba(255,255,255,.14); border-color: rgba(255,255,255,.32); color: inherit; }
.btn-secondary kbd { background: var(--panel-raised); border-color: var(--border); color: var(--text-3); }

kbd {
  font-family: var(--mono); font-size: 10px; padding: 1px 5px;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  background: var(--panel); color: var(--text-2);
}

/* ── Status: the only coloured thing besides the brand ───────── */

.badge, .email-tag {
  display: inline-flex; align-items: center;
  font-family: var(--mono); font-size: 10px; font-weight: 500; letter-spacing: 0.06em;
  text-transform: uppercase; line-height: 1.5;
  padding: 1px 6px; border-radius: var(--r-sm); border: 1px solid transparent;
  white-space: nowrap; vertical-align: 1px;
}
.badge.t-waiting { background: var(--s-wait-bg);   color: var(--s-wait);   border-color: var(--s-wait-line); }
.badge.t-active  { background: var(--s-active-bg); color: var(--s-active); border-color: var(--s-active-line); }
.badge.t-good    { background: var(--s-good-bg);   color: var(--s-good);   border-color: var(--s-good-line); }
.badge.t-bad     { background: var(--s-bad-bg);    color: var(--s-bad);    border-color: var(--s-bad-line); }
.badge.t-idle    { background: var(--panel-raised);color: var(--text-3);   border-color: var(--border); }
.badge.t-note    { background: var(--s-note-bg);   color: var(--s-note);   border-color: var(--s-note-line); }

/* Settings uses .email-tag for "is this key set?" chips */
.email-tag { margin-left: 6px; }
.email-tag:empty { display: none; }
.email-tag.verified { background: var(--s-good-bg); color: var(--s-good); border-color: var(--s-good-line); }
.email-tag.risky    { background: var(--s-wait-bg); color: var(--s-wait); border-color: var(--s-wait-line); }
.email-tag.guess    { background: var(--panel-raised); color: var(--text-3); border-color: var(--border); }
.verified { color: var(--s-good); }

/* ── Tables ──────────────────────────────────────────────────── */

.table-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); overflow: auto;
}
.card .table-card { border-color: var(--hair); }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th {
  text-align: left; font-family: var(--mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-3);
  padding: 11px 16px 10px; border-bottom: 1px solid var(--border);
  white-space: nowrap; position: sticky; top: 0; background: var(--panel);
}
td {
  padding: 11px 16px; border-bottom: 1px solid var(--hair);
  font-variant-numeric: tabular-nums; vertical-align: top;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr { transition: background-color .15s var(--ease); }
tbody tr:hover td { background: var(--panel-raised); }
td a { text-decoration: none; }
td a:hover { text-decoration: underline; }
.muted { color: var(--text-3); }
.num { font-family: var(--mono); text-align: right; }

/* ── Signals ─────────────────────────────────────────────────── */

.sig-summary { display: flex; border-top: 1px solid var(--rule); border-bottom: 1px solid var(--border); margin-bottom: 30px; }
.sig-stat { padding: 16px 28px 18px 0; min-width: 132px; }
.sig-stat + .sig-stat { padding-left: 28px; border-left: 1px solid var(--hair); }
.sig-stat .n { font-family: var(--mono); font-size: 28px; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.sig-stat .k {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--text-3); margin-top: 10px;
}
.sig-stat.confirmed .n { color: var(--s-good); }
.sig-stat.proposed .n  { color: var(--s-wait); }
.sig-stat.rejected .n  { color: var(--text-3); }

.sig-group { margin-bottom: 30px; }
.sig-group-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px 20px; margin-bottom: 14px; flex-wrap: wrap; }
.sig-group-head h3 { font-family: var(--serif); font-size: 24px; font-weight: 400; letter-spacing: -0.03em; line-height: 1.15; }
.sig-group-head p { font-size: 13.5px; color: var(--text-2); margin-top: 4px; max-width: 62ch; text-wrap: pretty; }

.sig-row { display: flex; gap: 20px; align-items: flex-start; padding: 16px 22px; border-bottom: 1px solid var(--hair); }
.sig-row:last-child { border-bottom: none; }
.sig-row.rejected { opacity: .5; }
.sig-row .sig-main { flex: 1; min-width: 0; }
.sig-row .sig-label { font-size: 14px; font-weight: 600; letter-spacing: -0.015em; }
.sig-row .sig-code { font-family: var(--mono); font-size: 10px; color: var(--accent); margin-left: 8px; letter-spacing: 0.04em; }
.sig-row .sig-desc { font-size: 13px; color: var(--text-2); margin-top: 5px; max-width: 68ch; text-wrap: pretty; }
.sig-row .sig-meta { display: flex; gap: 7px; flex-wrap: wrap; margin-top: 10px; align-items: center; }
.sig-row .sig-decide { display: flex; gap: 6px; flex: none; }

.cost-chip {
  font-family: var(--mono); font-size: 10px; padding: 1px 6px; border-radius: var(--r-sm);
  border: 1px solid var(--border); color: var(--text-3); background: var(--bg);
}
.cost-chip.free { color: var(--s-good); background: var(--s-good-bg); border-color: var(--s-good-line); }
.cost-chip.paid { color: var(--s-wait); background: var(--s-wait-bg); border-color: var(--s-wait-line); }

/* ── Cohort builder ──────────────────────────────────────────── */

.cohort-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(230px, 100%), 1fr)); gap: 8px; }
.cohort-pick {
  display: flex; align-items: center; gap: 10px; padding: 9px 12px;
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--bg);
  font-size: 13px; cursor: pointer; user-select: none;
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.cohort-pick:hover { border-color: var(--text-2); }
.cohort-pick:has(input:checked) { border-color: var(--accent); background: var(--accent-surface); }
.cohort-pick input { accent-color: var(--accent-fill); }
.cohort-pick .n { margin-left: auto; font-family: var(--mono); font-size: 11px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.cohort-size { font-family: var(--mono); font-size: 38px; letter-spacing: -0.045em; line-height: 1; font-variant-numeric: tabular-nums; color: var(--accent); }

/* ── Decisions desk ──────────────────────────────────────────── */

.desk { display: grid; grid-template-columns: 264px minmax(0,1fr); gap: 16px; align-items: start; }
.desk-list { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); overflow: hidden auto; max-height: 620px; }
.desk-item { padding: 12px 14px; border-bottom: 1px solid var(--hair); border-left: 2px solid transparent; cursor: pointer; transition: background-color .15s var(--ease); }
.desk-item:last-child { border-bottom: none; }
.desk-item:hover { background: var(--panel-raised); }
.desk-item.active { background: var(--accent-surface); border-left-color: var(--accent); }
.desk-item .to { font-family: var(--mono); font-size: 11.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.desk-item .sub { font-size: 12px; color: var(--text-3); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.desk-pane { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md); padding: 30px 36px; min-width: 0; }
.desk-pane .to-line { font-family: var(--mono); font-size: 11px; color: var(--text-3); letter-spacing: 0.02em; overflow-wrap: anywhere; }
.desk-pane .to-line b { color: var(--text); font-weight: 500; }
.desk-pane .subject { font-family: var(--serif); font-size: 30px; font-weight: 400; letter-spacing: -0.03em; margin: 14px 0 18px; line-height: 1.15; overflow-wrap: anywhere; }
.desk-pane .body {
  font-size: 15px; line-height: 1.75; white-space: pre-wrap; max-width: 64ch; color: var(--text-body);
  padding: 20px 0 20px 20px; border-left: 2px solid var(--accent);
  border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair);
  overflow-wrap: anywhere;
}
.desk-actions { display: flex; align-items: center; gap: 10px; margin-top: 20px; flex-wrap: wrap; }

@media (max-width: 900px) { .desk { grid-template-columns: 1fr; } .desk-list { max-height: 220px; } }

/* ── Discovery providers ─────────────────────────────────────── */

.prov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(280px, 100%), 1fr)); gap: 12px; margin-bottom: 30px; }
.prov-card {
  display: flex; flex-direction: column; gap: 9px; padding: 20px 20px; cursor: pointer;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md);
  transition: border-color .2s var(--ease), background-color .2s var(--ease);
}
.prov-card:hover { border-color: var(--ink); }
.prov-card.selected { border-color: var(--accent); background: var(--accent-surface); box-shadow: inset 0 2px 0 var(--accent); }
.prov-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.prov-card h3 { font-size: 15px; font-weight: 600; letter-spacing: -0.025em; }
.prov-card .blurb { font-size: 13px; color: var(--text-2); text-wrap: pretty; }
.prov-card .row { display: flex; gap: 8px; font-size: 12px; }
.prov-card .row .k {
  color: var(--text-3); min-width: 48px; flex: none;
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.16em; text-transform: uppercase; padding-top: 2px;
}
.prov-card .row .v { color: var(--text-2); min-width: 0; overflow-wrap: anywhere; }
.prov-card .caveat {
  font-size: 12px; color: var(--s-wait); background: var(--s-wait-bg);
  border-left: 2px solid var(--s-wait); padding: 8px 11px;
  border-radius: 0 var(--r-sm) var(--r-sm) 0; text-wrap: pretty;
}

.estimate-box { border: 1px solid var(--hair); border-radius: var(--r-md); padding: 18px 20px; margin-bottom: 16px; background: var(--bg); }
.estimate-box .amount { font-family: var(--mono); font-size: 30px; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.estimate-box .amount.free { color: var(--s-good); }
.estimate-box .amount.paid { color: var(--s-wait); }
.query-list { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-top: 12px; line-height: 1.75; max-height: 150px; overflow-y: auto; overflow-wrap: anywhere; }

/* ── Forms ───────────────────────────────────────────────────── */

.form-group { margin-bottom: 16px; }
.form-label {
  display: block; font-family: var(--mono); font-size: 9.5px; font-weight: 500;
  letter-spacing: 0.18em; text-transform: uppercase; color: var(--text-2); margin-bottom: 7px;
}
.form-label .email-tag { text-transform: uppercase; }
.form-input {
  width: 100%; padding: 9px 12px; font-family: var(--sans); font-size: 13.5px;
  background: var(--bg); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: border-color .2s var(--ease), box-shadow .2s var(--ease), background-color .2s var(--ease);
}
.form-input:hover { border-color: var(--border-strong); }
.form-input:focus { outline: none; border-color: var(--accent); background: var(--panel); box-shadow: 0 0 0 3px var(--accent-surface); }
.form-input:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.form-input::placeholder { color: var(--text-3); }
.form-row { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 130px; }

.test-result { font-size: 13px; margin-top: 10px; padding: 10px 13px; border-radius: var(--r-sm); border: 1px solid transparent; }
.test-result.success { background: var(--s-good-bg); color: var(--s-good); border-color: var(--s-good-line); }
.test-result.error   { background: var(--s-bad-bg);  color: var(--s-bad);  border-color: var(--s-bad-line); }
.test-result.pending { background: var(--panel-raised); color: var(--text-2); border-color: var(--border); }

/* ── Setup checklist & progress ──────────────────────────────── */

.progress-wrap { margin-bottom: 18px; }
.progress-label { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; margin-bottom: 8px; }
.progress-label .pct { font-family: var(--mono); font-variant-numeric: tabular-nums; }
.progress-label .text { color: var(--text-2); }
.progress-bar { height: 2px; background: var(--border); border-radius: 0; overflow: hidden; }
.progress-fill { height: 100%; transition: width .5s var(--ease); }
.progress-fill.green { background: var(--accent); }
.progress-fill.yellow { background: var(--s-wait); }

.check-item { display: flex; gap: 11px; padding: 11px 0; border-bottom: 1px solid var(--hair); }
.check-item:last-child { border-bottom: none; }
.check-icon {
  width: 15px; height: 15px; flex: none; margin-top: 2px; border-radius: var(--r-sm);
  display: flex; align-items: center; justify-content: center; font-size: 9px;
}
.check-icon.done { background: var(--s-good-bg); color: var(--s-good); border: 1px solid var(--s-good-line); }
.check-icon.pending { border: 1px solid var(--border-strong); color: var(--text-3); }
.check-info { flex: 1; min-width: 0; }
.check-label { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.check-label.done { color: var(--text-3); font-weight: 400; }
.check-help { font-size: 12.5px; color: var(--text-2); margin-top: 3px; text-wrap: pretty; }
.optional-tag {
  font-family: var(--mono); font-size: 9px; font-weight: 500; letter-spacing: 0.16em; text-transform: uppercase;
  color: var(--text-3); margin-left: 8px; vertical-align: 1px;
}

details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before { content: '+ '; font-family: var(--mono); color: var(--accent); }
details[open] summary::before { content: '– '; }

/* ── Campaigns, conversations, activity ──────────────────────── */

.campaign-card, .convo-card {
  background: var(--panel); border: 1px solid var(--border);
  border-radius: var(--r-md); padding: 24px 26px; margin-bottom: 14px;
  transition: border-color .2s var(--ease);
}
.campaign-card:hover, .convo-card:hover { border-color: var(--border-strong); }
.campaign-card h3, .convo-card h3 { font-size: 16px; font-weight: 600; margin-bottom: 8px; letter-spacing: -0.025em; }
.campaign-card .meta, .convo-card .meta {
  font-size: 12px; color: var(--text-3); display: flex; gap: 8px 14px; flex-wrap: wrap; align-items: center;
  margin-bottom: 18px; padding-bottom: 14px; border-bottom: 1px solid var(--hair);
}

.email-step { border-left: 1px solid var(--border); padding: 2px 0 2px 18px; margin-bottom: 18px; }
.email-step:hover { border-left-color: var(--accent); }
.email-step .step-num {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.18em; text-transform: uppercase;
  color: var(--accent); margin-bottom: 6px;
}
.email-step .subject { font-size: 14px; font-weight: 600; letter-spacing: -0.015em; margin-bottom: 6px; }
.email-step .body { font-size: 13.5px; color: var(--text-2); line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; }

.thread-msg { max-width: 78%; padding: 12px 15px; border-radius: var(--r-md); margin-bottom: 10px; font-size: 13.5px; line-height: 1.65; overflow-wrap: anywhere; }
.thread-msg.sent { background: var(--accent-surface); border: 1px solid var(--accent-line); margin-left: auto; }
.thread-msg.received { background: var(--bg); border: 1px solid var(--border); }
.thread-msg .sender {
  font-family: var(--mono); font-size: 9.5px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--text-3); margin-bottom: 5px;
}

.activity-feed { border-top: 1px solid var(--rule); }
.activity-item { display: flex; gap: 16px; padding: 10px 0; border-bottom: 1px solid var(--hair); font-size: 13px; align-items: baseline; }
.activity-item:last-child { border-bottom: none; }
.activity-item .time { font-family: var(--mono); font-size: 11px; color: var(--text-3); min-width: 112px; flex: none; font-variant-numeric: tabular-nums; }
.activity-item .agent {
  font-family: var(--mono); font-size: 10px; letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent); min-width: 72px; flex: none;
}
.activity-item .action { color: var(--text-body); min-width: 0; overflow-wrap: anywhere; }

/* ── Help & misc ─────────────────────────────────────────────── */

.help-section { margin-bottom: 40px; max-width: 78ch; }
.help-section h2 { font-family: var(--serif); font-size: 26px; font-weight: 400; letter-spacing: -0.03em; margin-bottom: 12px; line-height: 1.15; }
.help-section p { font-size: 14px; color: var(--text-2); line-height: 1.7; margin-bottom: 10px; max-width: 70ch; }
.help-section code { font-family: var(--mono); font-size: 12px; background: var(--panel-raised); border: 1px solid var(--hair); border-radius: var(--r-sm); padding: 1px 5px; }
.help-section pre { background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 15px 18px; overflow-x: auto; font-family: var(--mono); font-size: 12px; line-height: 1.7; margin-bottom: 10px; }
.help-section details { border-bottom: 1px solid var(--hair); }
.help-section details:first-of-type { border-top: 1px solid var(--rule); }
.help-section details summary { padding: 13px 0; font-weight: 600; letter-spacing: -0.015em; transition: color .2s var(--ease); }
.help-section details summary:hover { color: var(--accent); }
.faq-body { font-size: 13.5px; color: var(--text-2); line-height: 1.7; padding: 0 0 16px 18px; }
.faq-body p { margin-bottom: 6px; }

/* The featured passage: serif lead with nymm's purple vertical rule */
.help-feature { border-left: 2px solid var(--accent); padding: 4px 0 6px 30px; margin-bottom: 52px; }
.help-feature h2 {
  font-family: var(--mono); font-size: 10.5px; font-weight: 600; letter-spacing: 0.24em;
  text-transform: uppercase; color: var(--accent); margin-bottom: 16px;
}
.help-feature p:first-of-type {
  font-family: var(--serif); font-size: clamp(20px, 1.9vw, 25px); line-height: 1.35;
  letter-spacing: -0.025em; color: var(--text); max-width: 46ch; margin-bottom: 16px;
}
.feature-tag {
  font-family: var(--mono); font-size: 10.5px; letter-spacing: 0.24em; text-transform: uppercase;
  color: var(--text-3); margin-top: 18px;
}

.file-table { width: 100%; font-size: 13px; border-collapse: collapse; }
.file-table td { padding: 10px 14px; border-bottom: 1px solid var(--hair); }
.file-table td:first-child { font-family: var(--mono); font-size: 11.5px; white-space: nowrap; width: 210px; color: var(--accent); }
.file-table td:last-child { color: var(--text-2); }
.file-table tr:last-child td { border-bottom: none; }

.control-panel { display: grid; grid-template-columns: 1fr 1.4fr; gap: 16px; }
@media (max-width: 900px) { .control-panel { grid-template-columns: 1fr; } }
.status-big { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; }
.status-big .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); }
.status-big .dot.running { background: var(--s-good); box-shadow: 0 0 0 4px var(--s-good-bg); }
.status-big .label { font-family: var(--serif); font-size: 30px; font-weight: 400; letter-spacing: -0.035em; line-height: 1.1; }
.status-big .label.running { color: var(--s-good); }
.status-meta { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-bottom: 18px; min-height: 15px; }
.log-viewer {
  background: var(--bg); border: 1px solid var(--hair); border-radius: var(--r-sm);
  padding: 14px 16px; font-family: var(--mono); font-size: 11.5px; line-height: 1.7;
  color: var(--text-2); height: 340px; overflow-y: auto; white-space: pre-wrap; overflow-wrap: anywhere;
}

.empty {
  text-align: center; padding: 52px 24px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-md);
}
.card .empty { border: none; padding: 30px 12px; background: transparent; }
.empty .glyph { font-family: var(--mono); font-size: 18px; color: var(--accent); margin-bottom: 14px; }
.empty .title { font-family: var(--serif); font-size: 24px; font-weight: 400; letter-spacing: -0.03em; margin-bottom: 8px; }
.empty .copy { font-size: 13.5px; color: var(--text-2); line-height: 1.65; max-width: 48ch; margin: 0 auto; text-wrap: pretty; }
.empty .copy b { color: var(--text); font-weight: 600; }

.toast {
  position: fixed; bottom: 22px; right: 22px; z-index: 60; max-width: min(440px, calc(100vw - 44px));
  padding: 12px 18px 12px 16px; border-radius: var(--r-sm); font-size: 13px; font-weight: 500;
  border-left: 3px solid var(--accent);
  box-shadow: var(--shadow); animation: toast-in .3s var(--ease);
}
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
.toast.success { background: var(--ink); color: var(--ink-contrast); }
.toast.error { background: var(--s-bad); color: #fff; border-left-color: rgba(255,255,255,.55); }
:root[data-theme='dark'] .toast.error { color: #0B0B0E; }
@media (prefers-color-scheme: dark) { :root:not([data-theme='light']) .toast.error { color: #0B0B0E; } }

/* Usage bars: app.js paints the track with a dark-only inline colour;
   re-token it so it reads on paper too. */
#usage-daily div[style*="rgba(255,255,255,0.05)"] { background: var(--hair) !important; border-radius: 0 !important; }
#usage-daily div[style*="linear-gradient"] { border-radius: 0 !important; }

/* ── Responsive ──────────────────────────────────────────────── */

@media (max-width: 860px) {
  .brand-tag { display: none; }
}
@media (max-width: 700px) {
  header { padding-top: 12px; padding-bottom: 12px; }
  main { padding-top: 30px; padding-bottom: 72px; }
  .section-head { margin-bottom: 26px; }
  .card { padding: 20px 18px; }
  .desk-pane { padding: 22px 18px; }
  .desk-pane .subject { font-size: 24px; }
  .desk-pane .body { padding-left: 14px; }
  .campaign-card, .convo-card { padding: 20px 18px; }
  .sig-row { flex-direction: column; gap: 12px; padding: 16px; }
  .sig-summary { flex-wrap: wrap; }
  .sig-stat { min-width: 0; flex: 1 1 0; padding-right: 12px; }
  .sig-stat + .sig-stat { padding-left: 14px; }
  .help-feature { padding-left: 18px; }
  .thread-msg { max-width: 92%; }
  .activity-item { flex-wrap: wrap; gap: 4px 12px; }
  .activity-item .time { min-width: 0; }
}
@media (max-width: 520px) {
  #header-status-text { display: none; }
  .harvey-status { padding-right: 2px; }
  .brand-over { font-size: 7.5px; letter-spacing: 0.18em; }
  .refresh-btn, .icon-btn { padding: 7px 9px; }
  .queue-item { flex-wrap: wrap; gap: 10px 14px; }
  .queue-item .qtext { flex-basis: calc(100% - 22px); }
  .queue-item .btn { margin-left: 22px; }
  .stat-card, .stat-card + .stat-card { padding-left: 0; border-right: none; border-bottom: 1px solid var(--hair); }
  .stat-card:last-child { border-bottom: none; }
  .toast { right: 16px; bottom: 16px; max-width: calc(100vw - 32px); }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
  .marquee-track { animation: none; transform: none; }
  html { scroll-behavior: auto; }
}

/* ── Contactos / Empresas (manual outreach tracking) ─────────── */

.head-actions { align-items: center; }
.head-search, .head-filter, .status-select {
  font: 500 13px/1.2 var(--sans);
  color: var(--text);
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--r-sm);
  padding: 8px 10px;
  transition: border-color .2s var(--ease);
}
.head-search { width: min(280px, 100%); }
.head-search:hover, .head-filter:hover, .status-select:hover { border-color: var(--border-strong); }
.head-search:focus-visible, .head-filter:focus-visible, .status-select:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px; border-color: var(--accent);
}
.status-select { padding: 5px 8px; font-size: 12px; cursor: pointer; }
.status-select.status-contacted { color: var(--s-active); border-color: var(--s-active-line); background: var(--s-active-bg); }
.status-select.status-replied   { color: var(--s-note);   border-color: var(--s-note-line);   background: var(--s-note-bg); }
.status-select.status-meeting,
.status-select.status-closed    { color: var(--s-good);   border-color: var(--s-good-line);   background: var(--s-good-bg); }
.status-select.status-lost      { color: var(--text-3);   background: var(--panel-raised); }

.table-note {
  font: 500 11px/1.4 var(--mono);
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--text-3);
  margin: 0 0 12px;
}
td.num, th.num { font-family: var(--mono); font-variant-numeric: tabular-nums; text-align: right; width: 1%; white-space: nowrap; }
td.notes { color: var(--text-2); font-size: 12.5px; max-width: 280px; }
.pill-yes {
  font: 600 11px/1 var(--mono); letter-spacing: .06em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-surface); border: 1px solid var(--accent-line);
  border-radius: var(--r-sm); padding: 3px 6px;
}
.company-notes {
  white-space: pre-line; font-size: 13px; color: var(--text-2);
  border-left: 1px solid var(--accent); padding-left: 12px; margin: 12px 0 18px;
}
@media (max-width: 720px) {
  .head-search { width: 100%; }
  td.notes { display: none; }
}

/* ── Seguimiento: Hoy, ficha del lead ────────────────────────── */

tr.lead-row { cursor: pointer; }
.sub-line { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.due { font: 500 12px/1.2 var(--mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.due.late { color: var(--s-bad); }

.lead-pill {
  display: inline-block; white-space: nowrap;
  font: 500 11px/1 var(--mono); letter-spacing: .04em;
  padding: 4px 7px; border-radius: var(--r-sm);
  border: 1px solid var(--border); color: var(--text-2); background: var(--panel);
}
.lead-pill.status-contacted { color: var(--s-active); border-color: var(--s-active-line); background: var(--s-active-bg); }
.lead-pill.status-replied   { color: var(--s-note);   border-color: var(--s-note-line);   background: var(--s-note-bg); }
.lead-pill.status-meeting,
.lead-pill.status-closed    { color: var(--s-good);   border-color: var(--s-good-line);   background: var(--s-good-bg); }
.lead-pill.status-lost      { color: var(--text-3);   background: var(--panel-raised); }

.fu-block { margin-bottom: 30px; }
.fu-block .subhead { display: flex; align-items: baseline; gap: 8px; }
.fu-n { font-family: var(--mono); color: var(--text-3); }
.fu-hint { font-size: 12.5px; color: var(--text-3); margin: -4px 0 10px; }
#followup-lists .queue-clear { margin-bottom: 30px; }
/* A grid track won't shrink below its table otherwise; the table scrolls inside. */
#followup .today-main { min-width: 0; }

.lead-backdrop { position: fixed; inset: 0; background: rgba(11, 11, 14, .32); z-index: 40; }
.lead-backdrop[hidden], .lead-sheet[hidden] { display: none; }
.lead-sheet {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 41;
  width: min(560px, 100vw); overflow-y: auto;
  background: var(--bg); border-left: 1px solid var(--rule);
  padding: 26px 28px 60px;
}
.ls-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.ls-head h2 { font: 400 28px/1.15 var(--serif); color: var(--text); margin: 6px 0 10px; }
.ls-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 14px; font-size: 12.5px; color: var(--text-2); }
.ls-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 18px 0 4px; }
.ls-actions a.btn { text-decoration: none; }
.ls-block { border-top: 1px solid var(--hair); margin-top: 22px; padding-top: 4px; }
.ls-body { width: 100%; resize: vertical; margin: 12px 0 14px; font-family: var(--sans); }
.ls-quick { display: flex; flex-wrap: wrap; gap: 6px; margin: -4px 0 16px; }
.lead-sheet .form-row { align-items: flex-end; }
.lead-sheet select.form-input { cursor: pointer; }

.seg-group { display: flex; flex-wrap: wrap; gap: 6px; }
.seg input { position: absolute; opacity: 0; pointer-events: none; }
.seg span {
  display: inline-block; cursor: pointer; font-size: 12.5px;
  padding: 6px 11px; border: 1px solid var(--border); border-radius: var(--r-sm);
  color: var(--text-2); background: var(--panel);
}
.seg span:hover { border-color: var(--border-strong); }
.seg input:checked + span { color: var(--accent); border-color: var(--accent-line); background: var(--accent-surface); }
.seg input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.ls-history { list-style: none; margin: 0; padding: 0; }
.ls-history li { padding: 10px 0; border-bottom: 1px solid var(--hair); }
.ls-history li:last-child { border-bottom: none; }
.h-top { display: flex; justify-content: space-between; gap: 12px; }
.h-kind { font: 500 11px/1.4 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--text); }
.h-time { font: 400 11px/1.4 var(--mono); color: var(--text-3); white-space: nowrap; }
.h-body { font-size: 13.5px; color: var(--text-body); margin-top: 4px; white-space: pre-line; }
.h-bits { font-size: 12px; color: var(--text-3); margin-top: 4px; }
.ls-notes { margin: 0; padding-left: 16px; font-size: 13px; color: var(--text-2); }
.ls-notes li { margin-bottom: 4px; overflow-wrap: anywhere; }

/* Sheet header: title on the left, ‹ n/N › and × on the right */
.ls-head-text { min-width: 0; }
.ls-head-actions { display: flex; align-items: center; gap: 10px; flex: none; }
.sheet-btn {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 30px; height: 30px; padding: 0 8px;
  font: 400 18px/1 var(--sans); color: var(--text-2);
  background: transparent; border: 1px solid var(--border); border-radius: var(--r-sm); cursor: pointer;
  transition: color .2s var(--ease), border-color .2s var(--ease);
}
.sheet-btn:hover:not(:disabled) { color: var(--text); border-color: var(--text-2); }
.sheet-btn:disabled { opacity: .35; cursor: default; }
.sheet-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.ls-nav { display: flex; align-items: center; gap: 6px; }
.ls-pos { font: 500 11px/1 var(--mono); color: var(--text-3); font-variant-numeric: tabular-nums; min-width: 44px; text-align: center; }
.back-link {
  background: none; border: 0; padding: 0; cursor: pointer;
  font: 500 10.5px/1.4 var(--mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent);
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.back-link:hover { text-decoration: underline; }

/* Who to reach, at the top of the sheet */
.ls-facts { margin-top: 18px; border-top: 1px solid var(--hair); }
.fact { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 12px; padding: 8px 0; border-bottom: 1px solid var(--hair); }
.fact .k { font: 500 9.5px/1.9 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); }
.fact .v { font-size: 13.5px; color: var(--text-body); overflow-wrap: anywhere; }
.fact .v a { color: var(--text); text-decoration: none; border-bottom: 1px solid var(--accent-line); }
.fact .v a:hover { border-bottom-color: var(--accent); }
.ls-edit summary { margin-bottom: 14px; }
.ls-edit[open] summary { margin-bottom: 16px; }

/* List toolbar: search, then filter chips with counts */
.list-toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px 14px; margin: -8px 0 18px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-btn {
  font: 500 12.5px/1 var(--sans); color: var(--text-2); cursor: pointer;
  padding: 7px 10px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--r-sm);
  transition: border-color .2s var(--ease), color .2s var(--ease);
}
.chip-btn:hover { border-color: var(--border-strong); color: var(--text); }
.chip-btn.on { color: var(--accent); border-color: var(--accent-line); background: var(--accent-surface); }
.chip-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.chip-n { font: 500 11px/1 var(--mono); color: var(--text-3); margin-left: 4px; font-variant-numeric: tabular-nums; }
.chip-btn.on .chip-n { color: inherit; }

/* Row affordance: the arrow says "this opens" */
th.go, td.go { width: 1%; padding-left: 0; text-align: right; }
td.go { color: var(--text-4); font-family: var(--mono); transition: color .2s var(--ease), transform .2s var(--ease); }
tr.lead-row:hover td.go { color: var(--accent); }
tr.is-open td { background: var(--accent-surface); }
tr.is-open td:first-child { box-shadow: inset 2px 0 0 var(--accent); }
tr.is-open td.go { color: var(--accent); }
.clamp { display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Email composer: a wide sheet, editor beside the preview */
.lead-sheet.wide { width: min(1180px, 100vw); padding-bottom: 0; }
.cm-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 32px; margin-top: 22px; align-items: start; }
.cm-side { position: sticky; top: 0; }
.cm-side-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 12px; }
.cm-side-head .subhead { margin: 0; border: 0; padding: 0; }
.cm-label-row { display: flex; justify-content: space-between; align-items: flex-end; gap: 8px; flex-wrap: wrap; }
.cm-toolbar { display: flex; gap: 4px; margin-bottom: 6px; }
.cm-toolbar .btn-sm { padding: 4px 9px; }
#cm-body { margin: 0; line-height: 1.6; }
.cm-syntax { font: 400 11px/1.5 var(--mono); color: var(--text-3); margin: 6px 0 0; }
.cm-kind { flex: 0 1 190px !important; }

.cm-steps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px; }
@media (max-width: 720px) { .cm-steps { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.cm-step input { position: absolute; opacity: 0; pointer-events: none; }
.cm-step span {
  display: block; cursor: pointer; padding: 9px 11px; font-size: 13px; color: var(--text-2);
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--panel);
  transition: border-color .2s var(--ease);
}
.cm-step span b { font-family: var(--mono); font-weight: 500; color: var(--text-3); margin-right: 4px; }
.cm-step span i { display: block; font: normal 400 10.5px/1.4 var(--mono); color: var(--text-3); margin-top: 3px; }
.cm-step span:hover { border-color: var(--border-strong); }
.cm-step input:checked + span { color: var(--text); border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.cm-step input:checked + span b { color: var(--accent); }
.cm-step input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 1px; }

.cm-envelope { border-top: 1px solid var(--rule); margin-bottom: 10px; }
.cm-envelope div { display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; padding: 7px 0; border-bottom: 1px solid var(--hair); font-size: 13px; color: var(--text-body); overflow-wrap: anywhere; }
.cm-envelope .k { font: 500 9.5px/1.9 var(--mono); letter-spacing: .18em; text-transform: uppercase; color: var(--text-3); }
.cm-missing { color: var(--s-bad); }
/* The email lives in its own document (iframe): always white, as Gmail shows it. */
.cm-frame { display: block; width: 100%; min-height: 320px; border: 1px solid var(--border); background: #fff; }
.cm-note { margin: 10px 0 0; }
.cm-sender { margin-top: 6px; }
.cm-sender summary { cursor: pointer; text-transform: none; letter-spacing: .04em; }
.cm-sender[open] summary { margin-bottom: 16px; }

.cm-footer {
  position: sticky; bottom: 0; z-index: 2;
  display: flex; flex-wrap: wrap; align-items: center; gap: 10px 12px;
  margin: 26px -28px 0; padding: 14px 28px;
  background: var(--bg); border-top: 1px solid var(--rule);
}
.cm-footer-hint { font-size: 12px; color: var(--text-3); }

@media (max-width: 960px) {
  .cm-grid { grid-template-columns: minmax(0, 1fr); }
  .cm-side { position: static; }
}

@media (max-width: 600px) {
  .lead-sheet { padding: 20px 16px 48px; border-left: none; }
  .lead-sheet.wide { padding-bottom: 0; }
  .cm-footer { margin: 22px -16px 0; padding: 12px 16px; }
  .cm-footer-hint { display: none; }
  .cm-kind { flex: 1 1 auto !important; }
  .cm-step span { padding: 8px 9px; font-size: 12px; }
  .fact { grid-template-columns: 76px minmax(0, 1fr); }
  .list-toolbar .head-search { width: 100%; }
  .lead-sheet .form-row { flex-direction: column; align-items: stretch; gap: 0; }
}

.list-toolbar .head-search { width: min(340px, 100%); }

/* ── Viability audit (tiers from the research workbook) ─────────── */

.tier-badge {
  display: inline-block; min-width: 26px; text-align: center;
  font: 600 11px/1 var(--mono); letter-spacing: .04em;
  padding: 4px 6px; border-radius: var(--r-sm); border: 1px solid var(--border);
  color: var(--text-2); background: var(--panel-raised);
}
.tier-badge.tier-1 { color: var(--on-accent); background: var(--accent-fill); border-color: var(--accent-fill); }
.tier-badge.tier-2 { color: var(--accent); background: var(--accent-surface); border-color: var(--accent-line); }
.tier-badge.tier-3 { color: var(--s-wait); background: var(--s-wait-bg); border-color: var(--s-wait-line); }
.tier-badge.tier-4 { color: var(--text-3); background: var(--panel-raised); text-decoration: line-through; }

#prospects-tiers { margin-bottom: 8px; }
tr.lead-row.is-muted td { opacity: .62; }
tr.lead-row.is-muted:hover td { opacity: 1; }

.audit-block { border-left: 2px solid var(--accent-line); padding-left: 14px; }
.audit-block.tier-1 { border-left-color: var(--accent); }
.audit-block.tier-3 { border-left-color: var(--s-wait-line); }
.audit-block.tier-4 { border-left-color: var(--border-strong); }
.audit-diagnosis { font-size: 14px; line-height: 1.6; color: var(--text-body); margin: 8px 0 12px; }
.audit-warn {
  font-size: 13px; font-weight: 600; color: var(--s-wait);
  background: var(--s-wait-bg); border: 1px solid var(--s-wait-line);
  border-radius: var(--r-sm); padding: 8px 10px; margin: 8px 0;
}
.audit-block.tier-4 .audit-warn { color: var(--s-bad); background: var(--s-bad-bg); border-color: var(--s-bad-line); }

.cm-audit {
  font-size: 13px; line-height: 1.55; color: var(--text-2);
  background: var(--accent-surface); border: 1px solid var(--accent-line);
  border-radius: var(--r-sm); padding: 10px 12px; margin-bottom: 14px;
}
.cm-audit.tier-3 { background: var(--s-wait-bg); border-color: var(--s-wait-line); }
.cm-audit.tier-4 { background: var(--s-bad-bg); border-color: var(--s-bad-line); }
.cm-audit b { color: var(--text); }

/* ── Leads grouped by industry, and the import dialog ───────────── */

#prospects-rubros { margin-bottom: 8px; }
tr.group-row td {
  font: 600 11px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--accent); background: var(--accent-surface);
  padding: 10px 14px; border-top: 1px solid var(--accent-line);
}
tr.group-row:first-child td { border-top: 0; }
tr.group-row .chip-n { color: var(--text-3); margin-left: 6px; letter-spacing: 0; }

.import-dialog {
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 22px 22px 18px;
  background: var(--panel); color: var(--text); width: min(460px, 92vw);
  box-shadow: var(--shadow);
}
.import-dialog::backdrop { background: rgba(11, 11, 14, .35); }
.import-dialog h3 { font: 400 24px/1.2 var(--serif); margin: 0 0 4px; }
.import-dialog .muted { margin: 0 0 14px; font-size: 13px; }
.import-choice { display: flex; gap: 10px; align-items: flex-start; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r-sm); padding: 12px; margin-bottom: 8px; }
.import-choice:has(input:checked) { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.import-choice input { margin-top: 3px; accent-color: var(--accent); }
.import-choice b { display: block; font-size: 14px; }
.import-choice i { display: block; font-style: normal; font-size: 12.5px; color: var(--text-2); margin-top: 2px; line-height: 1.45; }
.import-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ── Mapa (Leaflet). The tiles stay light in the dark theme, so the dot
   colours are fixed; everything around the map uses the tokens. ──────── */

#mapa {
  --mk-1: #663399; --mk-2: #A47DDB; --mk-3: #D9962B; --mk-0: #8A8895; --mk-4: #B8574F;
}
#mapa-rubros, #mapa-opts { margin-bottom: 8px; }
.map-wrap { border: 1px solid var(--border); border-radius: var(--r-sm); overflow: hidden; background: var(--panel-raised); }
#mapa-canvas { height: 70vh; min-height: 380px; width: 100%; z-index: 0; font-family: var(--sans); }

.map-legend { display: flex; flex-wrap: wrap; gap: 6px 18px; margin: 0 0 10px; font-size: 12.5px; color: var(--text-2); }
.map-key { display: inline-flex; align-items: center; gap: 7px; }
.map-dot {
  display: inline-block; width: 12px; height: 12px; border-radius: 50%;
  background: var(--c); border: 2px solid var(--panel);
  box-shadow: 0 0 0 1px var(--border-strong);
}
.map-dot.approx { background: transparent; border: 2px dashed var(--c); box-shadow: none; }
.map-dot.tier-0, #mapa .lead-dot.tier-0 { --c: var(--mk-0); }
.map-dot.tier-1, #mapa .lead-dot.tier-1 { --c: var(--mk-1); }
.map-dot.tier-2, #mapa .lead-dot.tier-2 { --c: var(--mk-2); }
.map-dot.tier-3, #mapa .lead-dot.tier-3 { --c: var(--mk-3); }
.map-dot.tier-4, #mapa .lead-dot.tier-4 { --c: var(--mk-4); }

#mapa .lead-dot { fill: var(--c); fill-opacity: .9; stroke: #fff; stroke-width: 2; cursor: pointer; }
#mapa .lead-dot:hover { fill-opacity: 1; stroke: var(--text); }
#mapa .lead-dot.approx { fill-opacity: .12; stroke: var(--c); stroke-dasharray: 3 3; }
#mapa .lead-dot.approx:hover { fill-opacity: .35; }

.map-missing { margin: 4px 0 0; }
.map-missing summary { cursor: pointer; font-size: 13px; color: var(--text-2); margin-bottom: 8px; }

.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel); color: var(--text); border-radius: var(--r-md);
  box-shadow: var(--shadow); border: 1px solid var(--border);
}
.leaflet-popup-content { margin: 12px 14px; font: 13px/1.45 var(--sans); }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-3); }
.leaflet-container a.leaflet-popup-close-button:hover { color: var(--text); }
.leaflet-tooltip { background: var(--panel); color: var(--text); border-color: var(--border); font: 12px/1.3 var(--sans); box-shadow: var(--shadow); }
.leaflet-tooltip-top:before { border-top-color: var(--border); }
.leaflet-container .leaflet-control-attribution { background: var(--panel); color: var(--text-2); opacity: .92; }
.leaflet-container .leaflet-control-attribution a { color: var(--accent); }
.leaflet-bar a { background: var(--panel); color: var(--text); border-bottom-color: var(--border); }
.leaflet-bar a:hover { background: var(--panel-raised); color: var(--text); }
.leaflet-bar { border: 1px solid var(--border); box-shadow: none; }
.map-pop-name { font-weight: 600; font-size: 14px; margin-bottom: 4px; padding-right: 10px; }
.map-pop-sub { display: flex; align-items: center; gap: 8px; color: var(--text-2); margin-bottom: 6px; }
.map-pop-row { margin-bottom: 3px; word-break: break-word; }
.map-pop .btn { margin-top: 8px; }

@media (max-width: 720px) {
  #mapa-canvas { height: 62vh; min-height: 340px; }
}

/* ── Leads filter panel: one labeled row per filter ─────────────── */

.filter-panel {
  border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--panel);
  padding: 6px 16px 4px; margin: -6px 0 18px;
}
.filter-row {
  display: grid; grid-template-columns: 96px minmax(0, 1fr); align-items: center; gap: 12px;
  padding: 9px 0; border-bottom: 1px solid var(--hair, var(--border));
}
.filter-row[hidden] { display: none; }
.filter-label {
  font: 600 10.5px/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; color: var(--text-3);
}
.filter-row .head-search { width: 100%; max-width: 420px; }
.filter-row .chips { gap: 6px; }
.filter-summary {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px;
  padding: 10px 0 8px; font-size: 13px; color: var(--text-2);
}
.filter-summary b { color: var(--text); font-family: var(--mono); font-weight: 600; }
.link-btn {
  font: 600 12px/1 var(--sans); color: var(--accent); background: none; border: 0; padding: 4px 0;
  cursor: pointer; text-decoration: underline; text-underline-offset: 3px;
}
.link-btn:hover { color: var(--accent-deep, var(--accent)); }
@media (max-width: 720px) {
  .filter-row { grid-template-columns: 1fr; gap: 6px; }
}

/* ── Sign-in gate (web version) ─────────────────────────────────── */

.auth-gate {
  position: fixed; inset: 0; z-index: 2000; display: grid; place-items: center;
  background: var(--bg); padding: 24px;
}
.auth-gate[hidden] { display: none; }
.auth-card {
  width: min(380px, 100%); text-align: center; border: 1px solid var(--border);
  border-radius: var(--r-sm); background: var(--panel); padding: 34px 28px 30px;
}
.auth-card .brand-mark { color: var(--text); }
.auth-over { font: 500 9px/1 var(--mono); letter-spacing: .24em; color: var(--text-3); margin: 14px 0 4px; }
.auth-card h1 { font: 700 30px/1 var(--sans); letter-spacing: -.04em; margin: 0 0 14px; }
.auth-card p { font-size: 14px; color: var(--text-2); line-height: 1.5; margin: 0 0 20px; }
.auth-gate[data-state="loading"] #auth-signin { display: none; }
.auth-user { font: 500 11px/1 var(--mono); color: var(--text-3); max-width: 200px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 720px) { .auth-user { display: none; } }
