/* ══════════════════════════════════════════════════════════════
   CloserOS — dashboard styles

   The assistant writes to you in a chat. The rules:

   1. One action colour. Vermilion (--act) marks the primary action and
      the task that is yours right now, nothing else. Charts, selection
      and progress use the ink blue (--accent). Status hues appear only
      on status.
   2. Delivery ticks are the state vocabulary: one tick written, two
      ticks sent, blue ticks replied, a check for done.
   3. Elevation is declared once: a soft offset shadow, never a border
      under a shadow. Lines only divide rows.
   4. One 8px spacing grid. Lists keep fixed columns; only the state
      changes, in place.
   5. Plain words in the default view; technical tools live under
      "Avanzado".

   Light and dark are the same design re-tokenised.
   ══════════════════════════════════════════════════════════════ */

@font-face {
  font-family: 'Figtree'; font-style: normal; font-weight: 400 700;
  font-display: swap; src: url('/static/fonts/figtree.woff2') format('woff2');
}
@font-face {
  font-family: 'Geist Mono'; font-style: normal; font-weight: 400 500;
  font-display: swap; src: url('/static/fonts/geist-mono.woff2') format('woff2');
}

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

:root {
  --sans: 'Figtree', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, monospace;

  --fs-caption: 0.78125rem;  /* 12.5 */
  --fs-ui:      0.875rem;    /* 14 */
  --fs-body:    0.9375rem;   /* 15 */
  --fs-lead:    1rem;        /* 16 */
  --fs-h3:      1.0625rem;   /* 17 */
  --fs-h2:      1.5rem;      /* 24 */
  --fs-kpi:     1.75rem;     /* 28 */

  --sp-1: 4px; --sp-2: 8px; --sp-3: 12px; --sp-4: 16px;
  --sp-5: 24px; --sp-6: 32px; --sp-7: 48px;

  --r-xs: 6px;    /* tags, kbd */
  --r-sm: 10px;   /* buttons, inputs */
  --r-md: 12px;   /* inner panels */
  --r-lg: 16px;   /* cards */
  --r-bubble: 18px;

  --sidebar-w: 300px;
  --content-w: 1120px;

  --ease-out: cubic-bezier(0.16, 1, 0.3, 1);

  --bg:          #F3F4EF;
  --surface:     #FFFFFF;
  --surface-2:   #ECEEE8;
  --surface-3:   #E1E4DC;
  --line:        #E3E6DE;
  --line-strong: #CBD0C6;
  --text:        #16201B;
  --text-2:      #48534D;
  --text-3:      #626C66;

  --accent:      #3554C8;
  --accent-hover:#2A45AC;
  --accent-text: #FFFFFF;
  --accent-soft: #DCE7FF;
  --accent-line: #B9CBF7;
  --chart-muted: #B9CBF7;

  --act:       #C9431B;
  --act-hover: #AE3814;
  --act-text:  #FFFFFF;
  --act-soft:  #FBE6DC;

  --good:   #1E7D52; --good-bg:   #E2F3EA; --good-line:   #B5DEC8;
  --wait:   #9A5800; --wait-bg:   #FBF0DC; --wait-line:   #EDD29A;
  --bad:    #BE2F3C; --bad-bg:    #FBE6E8; --bad-line:    #F0BEC3;
  --active: #1B6E8F; --active-bg: #E1F0F6; --active-line: #B5D8E6;
  --note:   #6A4EC0; --note-bg:   #EEE9FB; --note-line:   #D3C8F3;

  --shadow-border: 0 1px 1px rgb(22 32 27 / 0.05), 0 2px 8px -2px rgb(22 32 27 / 0.10);
  --shadow-border-hover: 0 1px 2px rgb(22 32 27 / 0.06), 0 6px 18px -6px rgb(22 32 27 / 0.18);
  --shadow-pop: 0 2px 4px rgb(22 32 27 / 0.06), 0 18px 40px -12px rgb(22 32 27 / 0.28);
  --btn-shadow: 0 1px 1px rgb(22 32 27 / 0.06), inset 0 0 0 1px var(--line-strong);
  --btn-primary-shadow: 0 1px 2px rgb(150 45 15 / 0.25);
  --bubble-shadow: 0 1px 1px rgb(22 32 27 / 0.06), 0 3px 10px -4px rgb(22 32 27 / 0.14);
  color-scheme: light;
}

:root[data-theme='dark'] {
  --bg:#0F1411; --surface:#171D19; --surface-2:#1E2621; --surface-3:#28312B;
  --line:#26302A; --line-strong:#37423B;
  --text:#EDF2EE; --text-2:#B2BCB5; --text-3:#8A958E;
  --accent:#8EA7FF; --accent-hover:#A9BCFF; --accent-text:#0D1430;
  --accent-soft:#1F2A4A; --accent-line:#33437A; --chart-muted:#33437A;
  --act:#FF7D52; --act-hover:#FF946F; --act-text:#1E0D06; --act-soft:#3A1C11;
  --good:#5FCB92; --good-bg:#13281C; --good-line:#1F4430;
  --wait:#F1B955; --wait-bg:#2B2110; --wait-line:#4B3918;
  --bad:#FF7F89; --bad-bg:#2D1417; --bad-line:#4D2026;
  --active:#5CC1DA; --active-bg:#0E2429; --active-line:#17414A;
  --note:#B9A1F6; --note-bg:#1F1832; --note-line:#382A5A;
  --shadow-border: 0 1px 1px rgb(0 0 0 / 0.35), 0 2px 10px -2px rgb(0 0 0 / 0.45);
  --shadow-border-hover: 0 2px 4px rgb(0 0 0 / 0.4), 0 8px 22px -6px rgb(0 0 0 / 0.55);
  --shadow-pop: 0 2px 6px rgb(0 0 0 / 0.4), 0 20px 44px -10px rgb(0 0 0 / 0.7);
  --btn-shadow: inset 0 0 0 1px var(--line-strong);
  --btn-primary-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
  --bubble-shadow: 0 1px 1px rgb(0 0 0 / 0.35), 0 3px 12px -4px rgb(0 0 0 / 0.5);
  color-scheme: dark;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme='light']) {
    --bg:#0F1411; --surface:#171D19; --surface-2:#1E2621; --surface-3:#28312B;
    --line:#26302A; --line-strong:#37423B;
    --text:#EDF2EE; --text-2:#B2BCB5; --text-3:#8A958E;
    --accent:#8EA7FF; --accent-hover:#A9BCFF; --accent-text:#0D1430;
    --accent-soft:#1F2A4A; --accent-line:#33437A; --chart-muted:#33437A;
    --act:#FF7D52; --act-hover:#FF946F; --act-text:#1E0D06; --act-soft:#3A1C11;
    --good:#5FCB92; --good-bg:#13281C; --good-line:#1F4430;
    --wait:#F1B955; --wait-bg:#2B2110; --wait-line:#4B3918;
    --bad:#FF7F89; --bad-bg:#2D1417; --bad-line:#4D2026;
    --active:#5CC1DA; --active-bg:#0E2429; --active-line:#17414A;
    --note:#B9A1F6; --note-bg:#1F1832; --note-line:#382A5A;
    --shadow-border: 0 1px 1px rgb(0 0 0 / 0.35), 0 2px 10px -2px rgb(0 0 0 / 0.45);
    --shadow-border-hover: 0 2px 4px rgb(0 0 0 / 0.4), 0 8px 22px -6px rgb(0 0 0 / 0.55);
    --shadow-pop: 0 2px 6px rgb(0 0 0 / 0.4), 0 20px 44px -10px rgb(0 0 0 / 0.7);
    --btn-shadow: inset 0 0 0 1px var(--line-strong);
    --btn-primary-shadow: 0 1px 2px rgb(0 0 0 / 0.4);
    --bubble-shadow: 0 1px 1px rgb(0 0 0 / 0.35), 0 3px 12px -4px rgb(0 0 0 / 0.5);
    color-scheme: dark;
  }
}

/* ── Base ────────────────────────────────────────────────────── */

* { margin: 0; padding: 0; box-sizing: border-box; }
::selection { background: var(--accent-soft); color: var(--text); }
html { -webkit-text-size-adjust: 100%; scrollbar-color: var(--line-strong) transparent; }
body {
  font-family: var(--sans);
  font-size: var(--fs-body);
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  caret-color: var(--act);
  min-height: 100dvh;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-variant-numeric: tabular-nums;
}
a {
  color: inherit; text-decoration: underline;
  text-underline-offset: 3px; text-decoration-thickness: from-font;
  text-decoration-color: var(--line-strong);
}
@media (hover: hover) { a:hover { text-decoration-color: currentColor; } }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--r-xs); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid var(--bg); }
::-webkit-scrollbar-track { background: transparent; }
code, kbd, .mono { font-family: var(--mono); }
code {
  font-size: 0.85em; padding: 1px 6px; border-radius: var(--r-xs);
  background: var(--surface-2);
}
kbd {
  font-family: var(--mono); font-size: 10.5px; line-height: 1;
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; padding: 0 4px; border-radius: 5px;
  color: inherit; opacity: 0.8; box-shadow: inset 0 0 0 1px currentColor;
}
.muted { color: var(--text-3); }
.num { text-align: right; }
svg.icon { width: 18px; height: 18px; flex: none; stroke: currentColor; fill: none;
           stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
[hidden] { display: none !important; }

/* ── App shell: the chat list + the open conversation ────────── */

.app { display: grid; grid-template-columns: var(--sidebar-w) minmax(0, 1fr); min-height: 100dvh; }
@media (min-width: 901px) {
  /* The list's surface runs the full page height, also past the sticky column. */
  .app { background: linear-gradient(to right, var(--surface) var(--sidebar-w), transparent var(--sidebar-w)); }
}

.sidebar {
  position: sticky; top: 0; height: 100dvh; overflow-y: auto;
  display: flex; flex-direction: column;
  background: var(--surface);
  box-shadow: 1px 0 0 var(--line);
  padding: var(--sp-4) var(--sp-3) var(--sp-3);
}

.brand { display: flex; align-items: center; gap: var(--sp-3); padding: var(--sp-1) var(--sp-2) var(--sp-4); }
.brand-logo-icon {
  width: 36px; height: 36px; border-radius: 12px; flex: none;
  display: grid; place-items: center;
  background: var(--text); color: var(--surface);
}
.brand-logo-icon svg, .brand-logo-icon .icon { width: 20px; height: 20px; }
.brand-logo-icon img { width: 100%; height: 100%; object-fit: contain; border-radius: inherit; }
.brand-title { font-size: 1.125rem; font-weight: 700; letter-spacing: -0.02em; line-height: 1.2; }
.powered-by { font-size: var(--fs-caption); color: var(--text-3); }

nav { display: flex; flex-direction: column; gap: var(--sp-3); flex: 1; }

.chat-list { display: flex; flex-direction: column; gap: 2px; }
.chat-row {
  display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; align-items: center; gap: var(--sp-3);
  width: 100%; padding: 10px var(--sp-2); border: 0; border-radius: var(--r-md);
  background: transparent; color: var(--text); font: inherit; text-align: left; cursor: pointer;
  transition: background-color 160ms var(--ease-out);
}
.chat-avatar {
  width: 44px; height: 44px; border-radius: 50%; display: grid; place-items: center;
  background: var(--surface-2); color: var(--text-2);
}
.chat-avatar .icon { width: 20px; height: 20px; }
.chat-avatar.av-home { background: var(--text); color: var(--surface); }
.chat-main { display: flex; flex-direction: column; min-width: 0; }
.chat-row .label { font-weight: 600; font-size: var(--fs-body); }
.chat-preview {
  color: var(--text-3); font-size: var(--fs-ui); white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.chat-preview:empty { display: none; }
@media (hover: hover) { .chat-row:hover { background: var(--surface-2); } }
.chat-row.active { background: var(--accent-soft); }
.chat-row.active .chat-preview { color: var(--text-2); }

.nav-count {
  min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px;
  display: none; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700; line-height: 1;
}
.nav-count.on { display: inline-flex; background: var(--act); color: var(--act-text); }

.nav-advanced { border-top: 1px solid var(--line); padding-top: var(--sp-2); }
.nav-advanced summary {
  list-style: none; cursor: pointer; display: flex; align-items: center; gap: var(--sp-2);
  padding: var(--sp-2); border-radius: var(--r-sm);
  font-size: var(--fs-ui); font-weight: 600; color: var(--text-2);
}
.nav-advanced summary::-webkit-details-marker { display: none; }
.nav-advanced summary::before { content: none; }
.nav-advanced summary .icon { width: 16px; height: 16px; transition: transform 200ms var(--ease-out); }
.nav-advanced[open] summary .icon { transform: rotate(90deg); }
@media (hover: hover) { .nav-advanced summary:hover { background: var(--surface-2); } }
.adv-list { display: flex; flex-direction: column; gap: 1px; padding: 2px 0 var(--sp-2); }
.adv-row {
  display: flex; align-items: center; gap: var(--sp-3); width: 100%;
  padding: 7px var(--sp-2) 7px 14px; border: 0; border-radius: var(--r-sm);
  background: transparent; color: var(--text-2); font: inherit; font-size: var(--fs-ui); text-align: left; cursor: pointer;
}
.adv-row .icon { width: 16px; height: 16px; color: var(--text-3); }
.adv-row .label { flex: 1; }
@media (hover: hover) { .adv-row:hover { background: var(--surface-2); color: var(--text); } }
.adv-row.active { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.adv-row .nav-count.on { background: var(--surface-3); color: var(--text); }

.sidebar-foot { display: flex; flex-direction: column; gap: var(--sp-3); padding: var(--sp-3) var(--sp-2) 0; border-top: 1px solid var(--line); }
.harvey-status { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-ui); color: var(--text-2); }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); flex: none; }
.status-dot.running { background: var(--good); box-shadow: 0 0 0 3px var(--good-bg); }
.status-dot.offline { background: var(--bad); }
.foot-row { display: flex; align-items: center; gap: var(--sp-2); }
.lang-actions { display: inline-flex; padding: 2px; border-radius: var(--r-sm); background: var(--surface-2); margin-right: auto; }
.lang-btn {
  border: 0; background: transparent; color: var(--text-3); font: inherit; font-size: 12px; font-weight: 700;
  padding: 4px 8px; border-radius: 8px; cursor: pointer;
}
.lang-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-border); }

main.content { padding: var(--sp-5) var(--sp-6) var(--sp-7); min-width: 0; }
.content-inner { max-width: var(--content-w); margin: 0 auto; }

.section { display: none; }
.section.active { display: block; animation: section-in 260ms var(--ease-out); }
@keyframes section-in { from { opacity: 0.4; transform: translateY(4px); } }

.section-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin: var(--sp-2) 0 var(--sp-5); flex-wrap: wrap; }
.section-head h2 { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.025em; line-height: 1.2; text-wrap: balance; }
.section-head p { color: var(--text-2); margin-top: var(--sp-1); max-width: 68ch; }
.page-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.subhead { font-size: var(--fs-ui); font-weight: 700; color: var(--text-2); margin: var(--sp-6) 0 var(--sp-3); display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); }
.subhead .hint { font-weight: 500; color: var(--text-3); }
.subhead:first-child { margin-top: 0; }

.card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-border); padding: var(--sp-5); }
.card + .card { margin-top: var(--sp-3); }
.card > h2, .card-title { font-size: var(--fs-h3); font-weight: 700; margin-bottom: var(--sp-3); display: flex; align-items: center; gap: var(--sp-2); }
.card .lede { color: var(--text-2); margin-bottom: var(--sp-4); max-width: 70ch; }
.card.flush { padding: 0; overflow: hidden; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.card-head h3 { font-size: var(--fs-h3); font-weight: 700; }
.card-head .meta { color: var(--text-3); font-size: var(--fs-ui); }
.inset { background: var(--surface-2); border-radius: var(--r-md); padding: var(--sp-4); }
.grid-2 { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-4); }
.grid-main { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: var(--sp-5); align-items: start; }

/* ── The next decision, on every view ────────────────────────── */

.next-band {
  display: flex; align-items: center; gap: var(--sp-3);
  margin-bottom: var(--sp-5); padding: var(--sp-3) var(--sp-3) var(--sp-3) var(--sp-4);
  border-radius: var(--r-lg); background: var(--act-soft); color: var(--text);
}
.band-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--act); flex: none; animation: band-pulse 2.4s var(--ease-out) 3; }
@keyframes band-pulse { 0% { box-shadow: 0 0 0 0 rgb(201 67 27 / 0.35); } 70%, 100% { box-shadow: 0 0 0 10px rgb(201 67 27 / 0); } }
.band-text { flex: 1; font-weight: 600; }

/* ── Home: the assistant's thread ────────────────────────────── */

.home-grid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--sp-5); align-items: start; }
.thread-wrap { min-width: 0; }
.thread-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.thread-head h2 { font-size: var(--fs-h2); font-weight: 700; letter-spacing: -0.025em; line-height: 1.15; }
.thread-sub { color: var(--text-3); font-size: var(--fs-ui); margin-top: 2px; }

.home-thread { display: flex; flex-direction: column; align-items: flex-start; gap: var(--sp-2); }
.day-sep { align-self: center; margin: var(--sp-2) 0; }
.day-sep span {
  display: inline-block; padding: 3px 12px; border-radius: 999px;
  background: var(--surface); box-shadow: var(--shadow-border);
  font-size: var(--fs-caption); font-weight: 600; color: var(--text-2);
}

.bubble {
  position: relative; max-width: min(560px, 100%);
  background: var(--surface); border-radius: var(--r-bubble) var(--r-bubble) var(--r-bubble) 6px;
  box-shadow: var(--bubble-shadow);
  padding: var(--sp-3) var(--sp-4) var(--sp-2);
  animation: bubble-in 420ms var(--ease-out) both;
}
.home-thread .bubble:nth-child(2) { animation-delay: 40ms; }
.home-thread .bubble:nth-child(3) { animation-delay: 90ms; }
.home-thread .bubble:nth-child(4) { animation-delay: 140ms; }
.home-thread .bubble:nth-child(5) { animation-delay: 190ms; }
.home-thread .bubble:nth-child(n+6) { animation-delay: 240ms; }
@keyframes bubble-in { from { opacity: 0; transform: translateY(8px) scale(0.98); filter: blur(2px); } }
.bubble-text { font-size: var(--fs-lead); line-height: 1.5; text-wrap: pretty; }
.bubble-text strong { font-weight: 700; }
.bubble-sub { color: var(--text-2); font-size: var(--fs-ui); margin-top: var(--sp-1); }
.bubble-quote {
  margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm);
  background: var(--accent-soft); color: var(--text); font-size: var(--fs-ui); overflow-wrap: anywhere;
}
.bubble-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; margin-top: var(--sp-3); }
.bubble-meta { display: flex; align-items: center; justify-content: flex-end; gap: 4px; margin-top: var(--sp-1); color: var(--text-3); font-size: 11.5px; }
.ticks { display: inline-flex; }
.ticks .icon { width: 16px; height: 16px; stroke-width: 2; }
.ticks.written, .ticks.sent { color: var(--text-3); }
.ticks.read { color: var(--accent); }
.ticks.done { color: var(--good); }
.bubble.active { box-shadow: var(--bubble-shadow), inset 0 0 0 2px var(--act); }
.bubble.good .bubble-text strong:first-child { color: var(--good); }
.bubble.warn { background: var(--wait-bg); }

/* ── The assistant's status, beside the thread ───────────────── */

.agent-card {
  position: sticky; top: var(--sp-5);
  display: flex; flex-direction: column; gap: var(--sp-4);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-border); padding: var(--sp-5);
}
.agent-state { display: flex; gap: var(--sp-3); align-items: flex-start; }
.state-dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 6px; flex: none; background: var(--text-3); }
.agent-state.on .state-dot { background: var(--good); box-shadow: 0 0 0 4px var(--good-bg); }
.agent-title { font-size: var(--fs-h3); font-weight: 700; }
.agent-sub, .mode-sub { color: var(--text-2); font-size: var(--fs-ui); }
.agent-mode { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); }
.mode-title { font-weight: 700; font-size: var(--fs-ui); }
.week-title { font-size: var(--fs-caption); font-weight: 700; color: var(--text-3); margin-bottom: var(--sp-2); }
.week-list { display: flex; flex-direction: column; }
.week-row { display: flex; justify-content: space-between; align-items: baseline; padding: 7px 0; border-bottom: 1px solid var(--line); }
.week-row:last-child { border-bottom: 0; }
.week-row dt { color: var(--text-2); font-size: var(--fs-ui); }
.week-row dd { font-weight: 700; font-size: var(--fs-lead); }

/* ── KPI cards with sparklines ───────────────────────────────── */

.kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
@media (max-width: 1000px) { .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.kpi {
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r-lg);
  box-shadow: var(--shadow-border); padding: var(--sp-4) var(--sp-4) var(--sp-3);
  display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.kpi-label { font-size: var(--fs-ui); color: var(--text-2); display: flex; align-items: center; gap: 6px; }
.kpi-value { font-size: var(--fs-kpi); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.kpi-value.zero { color: var(--text-3); }
.kpi-main { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-3); min-height: 32px; }
.kpi-note { font-size: var(--fs-caption); color: var(--text-3); }
.kpi-note b { color: var(--text-2); font-weight: 500; }
.spark { display: flex; align-items: flex-end; gap: 2px; height: 28px; flex: 1; max-width: 140px; justify-content: flex-end; }
.spark i { display: block; width: 5px; min-height: 2px; border-radius: 1.5px; background: var(--chart-muted); }
.spark i.on { background: var(--accent); }
.spark i.today { background: var(--accent); }

/* ── Funnel: one segmented bar, one legend ───────────────────── */

.funnel-bar {
  display: flex; height: 10px; gap: 2px; border-radius: 99px; overflow: hidden;
  background: var(--surface-3);
}
.funnel-bar .seg { min-width: 3px; }
.funnel-legend {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr)); gap: var(--sp-3) var(--sp-4);
  margin-top: var(--sp-4);
}
.legend-item { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.legend-key { display: flex; align-items: center; gap: 6px; font-size: var(--fs-caption); color: var(--text-2); }
.legend-key i { width: 8px; height: 8px; border-radius: 2px; flex: none; }
.legend-val { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; }
.legend-val small { font-size: var(--fs-caption); font-weight: 400; color: var(--text-3); margin-left: 4px; }

.c-accent { background: var(--accent); } .c-accent-soft { background: var(--chart-muted); }
.c-good { background: var(--good); } .c-wait { background: var(--wait); }
.c-bad { background: var(--bad); } .c-active { background: var(--active); }
.c-note { background: var(--note); } .c-idle { background: var(--line-strong); }

.legend-rows { display: flex; flex-direction: column; margin-top: var(--sp-3); }
.legend-row { display: grid; grid-template-columns: minmax(0, 1fr) auto 3.5ch; gap: var(--sp-3); align-items: center; padding: 7px 0; }
.legend-row + .legend-row { border-top: 1px solid var(--line); }
.legend-row .legend-key { font-size: var(--fs-ui); color: var(--text); gap: 8px; }
.legend-row .legend-val { font-size: var(--fs-ui); font-weight: 600; }
.legend-pct { font-size: var(--fs-caption); color: var(--text-3); text-align: right; }

/* Quiet status: a dot and a word, for secondary state inside a cell */
.mini { display: inline-flex; align-items: center; gap: 5px; font-size: var(--fs-caption); white-space: nowrap; }
.mini::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.mini.t-good { color: var(--good); } .mini.t-waiting { color: var(--wait); } .mini.t-bad { color: var(--bad); }
.mini.t-active { color: var(--active); } .mini.t-note { color: var(--note); } .mini.t-idle { color: var(--text-3); }

/* ── Meters (score, quota, progress) ─────────────────────────── */

.meter { display: inline-flex; align-items: center; gap: 2px; height: 12px; }
.meter i { width: 4px; height: 10px; border-radius: 1px; background: var(--surface-3); }
.meter i.on { background: var(--accent); }
.meter.good i.on { background: var(--good); }
.meter.wait i.on { background: var(--wait); }
.meter.bad i.on { background: var(--bad); }
.meter-row { display: inline-flex; align-items: center; gap: 8px; }
.meter-row .v { font-size: var(--fs-ui); color: var(--text-2); min-width: 2.5ch; text-align: right; }

.bar { height: 6px; border-radius: 99px; background: var(--surface-3); overflow: hidden; display: flex; }
.bar > span { display: block; height: 100%; transition: width 400ms var(--ease-out); }
.bar.thick { height: 8px; }

/* Kept for quota gauges (quotaCardHtml) */
.progress-wrap { margin-bottom: var(--sp-4); }
.progress-wrap:last-child { margin-bottom: 0; }
.progress-label { display: flex; justify-content: space-between; gap: var(--sp-2); font-size: var(--fs-ui); margin-bottom: 6px; }
.progress-label .pct { font-weight: 600; }
.progress-label .text { color: var(--text-2); }
.progress-bar { height: 8px; background: var(--surface-3); border-radius: 99px; overflow: hidden; }
.progress-fill { height: 100%; border-radius: 99px; transition: width 400ms var(--ease-out); }
.progress-fill.green { background: var(--accent); }
.progress-fill.yellow { background: var(--wait); }

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

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--sp-2);
  height: 40px; padding: 0 var(--sp-4); border: 0; border-radius: var(--r-sm);
  font: inherit; font-size: var(--fs-ui); font-weight: 600; white-space: nowrap; cursor: pointer;
  text-decoration: none; color: var(--text); background: var(--surface); box-shadow: var(--btn-shadow);
  transition: background-color 160ms var(--ease-out), transform 120ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
.btn:not(:disabled):active { transform: scale(0.97); }
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn .icon { width: 16px; height: 16px; }
.btn-primary { background: var(--act); color: var(--act-text); box-shadow: var(--btn-primary-shadow); }
/* Vermilion means "yours, now" (home and the approval desk). In the
   configuration tools the main button is ink, so the colour keeps its meaning. */
#today .btn-primary, #signals .btn-primary, #discover .btn-primary, #companies .btn-primary,
#prospects .btn-primary, #campaigns .btn-primary, #activity .btn-primary, #usage .btn-primary,
#settings .btn-primary, #controls .btn-primary { background: var(--text); color: var(--surface); box-shadow: none; }
.btn-secondary { background: var(--surface); }
.btn-ghost { background: transparent; box-shadow: none; color: var(--text-2); }
.btn-danger { background: var(--surface); color: var(--bad); box-shadow: inset 0 0 0 1px var(--bad-line); }
.btn-block { width: 100%; }
@media (hover: hover) {
  .btn-primary:hover:not(:disabled) { background: var(--act-hover); }
  #today .btn-primary:hover:not(:disabled), #signals .btn-primary:hover:not(:disabled), #discover .btn-primary:hover:not(:disabled),
  #companies .btn-primary:hover:not(:disabled), #prospects .btn-primary:hover:not(:disabled), #campaigns .btn-primary:hover:not(:disabled),
  #activity .btn-primary:hover:not(:disabled), #usage .btn-primary:hover:not(:disabled), #settings .btn-primary:hover:not(:disabled),
  #controls .btn-primary:hover:not(:disabled) { background: var(--text-2); }
  .btn-secondary:hover:not(:disabled), .btn-danger:hover:not(:disabled) { background: var(--surface-2); }
  .btn-ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--text); }
}
.btn-sm { height: 34px; padding: 0 var(--sp-3); font-size: var(--fs-ui); }
.btn-xs { height: 28px; padding: 0 10px; font-size: var(--fs-caption); }
.btn-icon { width: 40px; padding: 0; }
.btn-sm.btn-icon { width: 34px; }
.btn-group { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.icon-btn, .refresh-btn {
  height: 32px; min-width: 32px; padding: 0 10px; border: 0; border-radius: var(--r-sm);
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  background: var(--surface-2); color: var(--text-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer;
}
.icon-btn .icon, .refresh-btn .icon { width: 15px; height: 15px; }
@media (hover: hover) { .icon-btn:hover, .refresh-btn:hover { color: var(--text); background: var(--surface-3); } }
.icon-btn:active, .refresh-btn:active { transform: scale(0.96); }
a.btn, a.btn:hover { text-decoration: none; }

/* ── Status tags: the only coloured text ─────────────────────── */

.badge, .tag {
  display: inline-flex; align-items: center; gap: 6px; height: 24px; padding: 0 10px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--surface-2); color: var(--text-2);
}
.badge::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge.t-waiting { background: var(--wait-bg); color: var(--wait); }
.badge.t-active  { background: var(--active-bg); color: var(--active); }
.badge.t-good    { background: var(--good-bg); color: var(--good); }
.badge.t-bad     { background: var(--bad-bg); color: var(--bad); }
.badge.t-note    { background: var(--note-bg); color: var(--note); }
.badge.t-idle    { background: var(--surface-2); color: var(--text-3); }
.badge.t-idle::before { background: var(--line-strong); }
.tag { background: var(--surface-2); }
.tag.accent { background: var(--accent-soft); color: var(--accent); }
.cost-chip { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; }
.cost-chip.free { background: var(--good-bg); color: var(--good); }
.cost-chip.paid { background: var(--wait-bg); color: var(--wait); }
.optional-tag { margin-left: var(--sp-2); font-size: 11px; font-weight: 600; color: var(--text-3); }
.email-tag { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.email-tag:empty { display: none; }
.email-tag.verified { background: var(--good-bg); color: var(--good); }
.email-tag.risky { background: var(--wait-bg); color: var(--wait); }
.email-tag.guess { background: var(--surface-2); color: var(--text-3); }

/* ── Lists and tables ────────────────────────────────────────── */

.table-card { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-border); overflow-x: auto; }
.card .table-card { box-shadow: none; border-radius: 0; margin: 0 calc(-1 * var(--sp-5)); }
table { width: 100%; border-collapse: collapse; font-size: var(--fs-ui); }
th {
  text-align: left; font-weight: 600; font-size: var(--fs-caption); color: var(--text-3);
  padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); white-space: nowrap;
}
th.num { text-align: right; }
td { padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr { transition: background-color 140ms var(--ease-out); }
tr.clickable { cursor: pointer; }
@media (hover: hover) { tr.clickable:hover { background: var(--surface-2); } }
table.nowrap td { white-space: nowrap; }
td a { text-decoration-color: var(--line-strong); }
.cell-main { font-weight: 600; color: var(--text); }
.cell-sub { color: var(--text-3); font-size: var(--fs-caption); }
.cell-stack { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.cell-row { display: flex; align-items: center; gap: var(--sp-3); }
.avatar {
  width: 36px; height: 36px; border-radius: 50%; flex: none;
  display: grid; place-items: center; font-size: 12px; font-weight: 700;
  background: var(--surface-2); color: var(--text-2);
}
.row-action { opacity: 0; transition: opacity 140ms; }
tr:focus-within .row-action { opacity: 1; }
@media (hover: hover) { tr:hover .row-action { opacity: 1; } }
.toolbar { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.search { position: relative; flex: 1; min-width: 220px; }
.search .icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--text-3); width: 16px; height: 16px; }
.search input {
  width: 100%; height: 40px; padding: 0 var(--sp-3) 0 38px; border: 0; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--btn-shadow); font: inherit; color: var(--text);
}
.segmented { display: inline-flex; padding: 3px; border-radius: var(--r-sm); background: var(--surface-2); gap: 2px; flex-wrap: wrap; }
.segmented button {
  border: 0; background: transparent; color: var(--text-2); font: inherit; font-size: var(--fs-ui); font-weight: 600;
  height: 32px; padding: 0 12px; border-radius: 8px; cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
}
.segmented button .n { color: var(--text-3); font-weight: 500; }
.segmented button.on { background: var(--surface); color: var(--text); box-shadow: var(--shadow-border); }
.table-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); padding: var(--sp-3) var(--sp-4); color: var(--text-3); font-size: var(--fs-caption); border-top: 1px solid var(--line); }

/* ── Today: the queue, the steps, the timeline ───────────────── */

.queue { display: flex; flex-direction: column; gap: var(--sp-2); }
.queue-item {
  display: flex; align-items: center; gap: var(--sp-4);
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r-lg);
  box-shadow: var(--shadow-border); padding: var(--sp-4);
}
.queue-icon {
  width: 32px; height: 32px; flex: none; border-radius: 9px;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-2);
}
.queue-item.warn .queue-icon { background: var(--wait-bg); color: var(--wait); }
.queue-item.bad .queue-icon { background: var(--bad-bg); color: var(--bad); }
.queue-item.good .queue-icon { background: var(--good-bg); color: var(--good); }
.queue-item .qtext { flex: 1; min-width: 0; }
.queue-item .qtitle { font-size: var(--fs-body); font-weight: 600; letter-spacing: -0.005em; }
.queue-item .qdetail { font-size: var(--fs-ui); color: var(--text-2); margin-top: 2px; max-width: 72ch; text-wrap: pretty; }
.queue-item .btn { flex: none; }
.queue-clear {
  display: flex; align-items: center; gap: var(--sp-4); padding: var(--sp-5);
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r-lg); box-shadow: var(--shadow-border);
}
.queue-clear .queue-icon { background: var(--good-bg); color: var(--good); }
.queue-clear .qtitle { font-weight: 600; }
.queue-clear .qdetail { font-size: var(--fs-ui); color: var(--text-2); margin-top: 2px; max-width: 64ch; }

.steps { display: flex; flex-direction: column; }
.step { display: grid; grid-template-columns: 20px minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 10px 0; }
.step + .step { border-top: 1px solid var(--line); }
.step-icon { width: 20px; height: 20px; border-radius: 50%; display: flex; align-items: center; justify-content: center; }
.step-icon .icon { width: 12px; height: 12px; stroke-width: 2.5; }
.step-icon.done { background: var(--good-bg); color: var(--good); }
.step-icon.running { background: var(--accent-soft); color: var(--accent); }
.step-icon.partial { background: var(--surface-3); color: var(--text-2); }
.step-icon.waiting { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.step-label { font-size: var(--fs-ui); font-weight: 500; }
.step-detail { font-size: var(--fs-caption); color: var(--text-3); text-align: right; }
.step .bar { grid-column: 2 / 4; }
.live-head { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; margin-bottom: var(--sp-2); }
.live-now { display: inline-flex; align-items: center; gap: 8px; font-size: var(--fs-ui); color: var(--text-2); }
.live-next {
  display: flex; gap: 10px; align-items: flex-start; margin-top: var(--sp-3);
  padding: 10px 12px; border-radius: var(--r-md); background: var(--accent-soft); color: var(--text);
  font-size: var(--fs-ui);
}
.live-next .icon { color: var(--accent); margin-top: 1px; }
.live-flag { font-size: var(--fs-caption); color: var(--text-3); margin-top: var(--sp-2); }
.pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--accent); flex: none; }
@media (prefers-reduced-motion: no-preference) {
  .pulse { animation: pulse 1.6s ease-in-out infinite; }
  @keyframes pulse { 50% { opacity: 0.35; } }
}

.figures { display: flex; flex-direction: column; }
.figure { display: flex; align-items: baseline; justify-content: space-between; gap: var(--sp-3); padding: 8px 0; }
.figure + .figure { border-top: 1px solid var(--line); }
.figure .k { font-size: var(--fs-ui); color: var(--text-2); }
.figure .v { font-size: var(--fs-body); font-weight: 600; }
.figure .v.zero { color: var(--text-3); font-weight: 400; }
.figure-note { font-size: var(--fs-caption); color: var(--text-3); margin-top: 8px; }

.runs { display: flex; flex-direction: column; }
.run { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 10px 0; align-items: center; }
.run + .run { border-top: 1px solid var(--line); }
.run .name { font-size: var(--fs-ui); font-weight: 500; text-transform: capitalize; }
.run .when, .run .stats { font-size: var(--fs-caption); color: var(--text-3); }
.run .stats { text-align: right; }

/* Activity timeline, grouped by day */
.timeline { display: flex; flex-direction: column; }
.tl-day {
  font-size: var(--fs-caption); font-weight: 600; color: var(--text-3);
  padding: var(--sp-4) 0 var(--sp-2);
}
.tl-day:first-child { padding-top: 0; }
.tl-item { display: grid; grid-template-columns: 64px 28px minmax(0, 1fr) auto; gap: 10px; align-items: center; padding: 6px 0; }
.tl-time { font-size: var(--fs-caption); color: var(--text-3); }
.tl-icon {
  width: 24px; height: 24px; border-radius: 7px; display: flex; align-items: center; justify-content: center;
  background: var(--surface-2); color: var(--text-2);
}
.tl-icon .icon { width: 13px; height: 13px; }
.tl-text { font-size: var(--fs-ui); color: var(--text); min-width: 0; overflow-wrap: anywhere; }
.tl-text::first-letter { text-transform: uppercase; }
.tl-agent { font-size: var(--fs-caption); color: var(--text-3); }
.tl-item.quiet .tl-text { color: var(--text-3); }

/* Setup progress, check list */
.check-item { display: flex; gap: 10px; padding: 10px 0; }
.check-item + .check-item { border-top: 1px solid var(--line); }
.check-icon {
  width: 18px; height: 18px; flex: none; margin-top: 1px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center; font-size: 10px;
}
.check-icon.done { background: var(--good-bg); color: var(--good); }
.check-icon.pending { box-shadow: inset 0 0 0 1.5px var(--line-strong); }
.check-info { flex: 1; min-width: 0; }
.check-label { font-size: var(--fs-ui); font-weight: 500; }
.check-label.done { color: var(--text-3); font-weight: 400; }
.check-item.current {
  margin: 0 calc(-1 * var(--sp-3)); padding: var(--sp-3);
  background: var(--accent-soft); border-radius: var(--r-md);
}
.check-item.current + .check-item, .check-item + .check-item.current { border-top-color: transparent; }
.setup-card { margin-bottom: var(--sp-4); }
.setup-head { display: flex; justify-content: space-between; align-items: flex-start; gap: var(--sp-3); margin-bottom: var(--sp-3); }
.setup-head h3 { font-size: var(--fs-h3); margin: 0; }
.setup-head p { margin: 2px 0 0; font-size: var(--fs-caption); }
.check-help { font-size: var(--fs-caption); color: var(--text-3); margin-top: 2px; text-wrap: pretty; overflow-wrap: anywhere; }
.setup-pct { font-size: var(--fs-caption); color: var(--text-3); font-weight: 500; }

details summary { cursor: pointer; list-style: none; }
details summary::-webkit-details-marker { display: none; }
details summary::before {
  content: ''; display: inline-block; width: 6px; height: 6px; margin-right: 8px; translate: 0 -2px;
  border-right: 1.5px solid currentColor; border-bottom: 1.5px solid currentColor; rotate: -45deg;
  transition: rotate 150ms ease-out;
}
details[open] > summary::before { rotate: 45deg; }

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

.sig-summary .funnel-bar { margin-bottom: 0; }
.sig-group { margin-bottom: var(--sp-6); }
.sig-group-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--sp-4); margin-bottom: var(--sp-3); flex-wrap: wrap; }
.sig-group-head h3 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; }
.sig-group-head p { font-size: var(--fs-ui); color: var(--text-2); margin-top: 2px; max-width: 68ch; text-wrap: pretty; }
.sig-row { display: flex; gap: var(--sp-4); align-items: flex-start; padding: var(--sp-4) var(--sp-5); }
.sig-row + .sig-row { border-top: 1px solid var(--line); }
.sig-row.rejected .sig-main { opacity: 0.55; }
.sig-row .sig-main { flex: 1; min-width: 0; }
.sig-row .sig-label { font-size: var(--fs-body); font-weight: 500; }
.sig-row .sig-code { font-family: var(--mono); font-size: 11px; color: var(--text-3); margin-left: 8px; }
.sig-row .sig-desc { font-size: var(--fs-ui); color: var(--text-2); margin-top: 2px; max-width: 72ch; text-wrap: pretty; }
.sig-row .sig-meta { display: flex; gap: 6px; flex-wrap: wrap; margin-top: var(--sp-2); align-items: center; }
.sig-row .sig-decide { display: flex; gap: 6px; flex: none; }

.cohort-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 6px; }
.cohort-pick {
  display: flex; align-items: center; gap: 10px; height: 36px; padding: 0 12px;
  border-radius: var(--r-sm); background: var(--surface-2); box-shadow: inset 0 0 0 1px transparent;
  font-size: var(--fs-ui); cursor: pointer; transition: box-shadow 120ms ease, background-color 120ms ease;
}
@media (hover: hover) { .cohort-pick:hover { box-shadow: inset 0 0 0 1px var(--line-strong); } }
.cohort-pick:has(input:checked) { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.cohort-range { align-items: center; }
.cohort-range > span:first-child { flex: 1; }
.cohort-bound { width: 64px; padding: 3px 6px; font: inherit; font-size: 12px; }
.cohort-range:has(.cohort-bound:not(:placeholder-shown)) { background: var(--accent-soft); box-shadow: inset 0 0 0 1px var(--accent-line); }
.cohort-pick input { accent-color: var(--accent); }
.cohort-pick .n { margin-left: auto; font-size: var(--fs-caption); color: var(--text-3); }
.cohort-size { font-size: 2rem; font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }

/* ── Por aprobar: one email at a time, written like an outgoing message ── */

.desk { display: grid; grid-template-columns: 280px minmax(0, 1fr); gap: var(--sp-4); align-items: start; margin-bottom: var(--sp-6); }
.desk-list {
  display: flex; flex-direction: column; gap: 2px; padding: var(--sp-2);
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-border);
  max-height: calc(100dvh - 220px); overflow-y: auto;
}
.desk-item {
  display: grid; grid-template-columns: 36px minmax(0, 1fr); gap: var(--sp-3); align-items: center;
  padding: 10px var(--sp-2); border-radius: var(--r-md); cursor: pointer;
  transition: background-color 140ms var(--ease-out);
}
.desk-item + .desk-item { margin-top: 0; }
@media (hover: hover) { .desk-item:hover { background: var(--surface-2); } }
.desk-item.active { background: var(--accent-soft); }
.desk-item .di-text { min-width: 0; }
.desk-item .to { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-item .sub { color: var(--text-3); font-size: var(--fs-caption); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.desk-item.active .avatar { background: var(--act); color: var(--act-text); }

.desk-pane {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-border);
  padding: var(--sp-5) var(--sp-6);
}
.desk-pane .to-line { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; color: var(--text-3); font-size: var(--fs-ui); margin-bottom: var(--sp-4); }
.desk-pane .to-line b { color: var(--text); font-weight: 600; }
.desk-pane .subject { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.015em; margin: var(--sp-4) 0 var(--sp-3); }
.desk-pane .body {
  white-space: pre-wrap; font-size: var(--fs-lead); line-height: 1.6; max-width: 66ch;
  padding: var(--sp-4) var(--sp-5); border-radius: var(--r-bubble) var(--r-bubble) 6px var(--r-bubble);
  background: var(--accent-soft); color: var(--text);
}
.desk-footer { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-5); padding-top: var(--sp-4); border-top: 1px solid var(--line); flex-wrap: wrap; }
.desk-actions { display: flex; gap: var(--sp-2); flex-wrap: wrap; }
.desk-context {
  display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px var(--sp-5);
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--surface-2); font-size: var(--fs-ui);
}
.desk-context .k { color: var(--text-3); }
.desk-context .v { color: var(--text); overflow-wrap: anywhere; }
.desk-edit-subject, .desk-edit-body {
  width: 100%; border: 0; border-radius: var(--r-sm); font: inherit; color: var(--text);
  background: var(--surface); box-shadow: var(--btn-shadow); padding: var(--sp-3);
}
.desk-edit-subject { font-size: 1.125rem; font-weight: 700; margin: var(--sp-4) 0 var(--sp-3); }
.desk-edit-body { min-height: 220px; line-height: 1.6; resize: vertical; }
.desk-edit-subject:focus, .desk-edit-body:focus { outline: 2px solid var(--accent); outline-offset: 1px; }
@media (max-width: 900px) {
  .desk { grid-template-columns: minmax(0, 1fr); }
  .desk-list { flex-direction: row; overflow-x: auto; max-height: none; }
  .desk-item { min-width: 220px; }
  .desk-context { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .desk-pane { padding: var(--sp-4); }
}

.banner {
  display: flex; gap: var(--sp-3); align-items: flex-start;
  padding: var(--sp-3) var(--sp-4); border-radius: var(--r-lg); margin-bottom: var(--sp-4);
  background: var(--accent-soft); color: var(--text);
}
.banner .icon { margin-top: 2px; color: var(--accent); }
.banner b { font-weight: 700; }
.banner.bad { background: var(--bad-bg); }
.banner.bad .icon { color: var(--bad); }
.banner.wait { background: var(--wait-bg); }
.banner.wait .icon { color: var(--wait); }
.banner p { color: var(--text-2); font-size: var(--fs-ui); margin-top: 2px; }

/* ── Discover ────────────────────────────────────────────────── */

.prov-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-5); }
.prov-card {
  display: flex; flex-direction: column; gap: var(--sp-2); padding: var(--sp-4); cursor: pointer;
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r-lg);
  box-shadow: var(--shadow-border); transition: box-shadow 150ms ease-out;
}
@media (hover: hover) { .prov-card:hover { box-shadow: var(--shadow-border-hover); } }
.prov-card.selected { box-shadow: 0 0 0 1.5px var(--accent), 0 0 0 5px var(--accent-soft); }
.prov-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.prov-card h3 { font-size: var(--fs-body); font-weight: 600; letter-spacing: -0.01em; }
.prov-card .blurb { font-size: var(--fs-ui); color: var(--text-2); text-wrap: pretty; }
.prov-card .row { display: flex; gap: 8px; font-size: var(--fs-caption); }
.prov-card .row .k { color: var(--text-3); min-width: 44px; flex: none; }
.prov-card .row .v { color: var(--text-2); }
.prov-card .caveat {
  font-size: var(--fs-caption); color: var(--wait); background: var(--wait-bg);
  padding: 8px 10px; border-radius: var(--r-sm); text-wrap: pretty;
}
.estimate-box { border-radius: var(--r-md); padding: var(--sp-4); margin-bottom: var(--sp-3); background: var(--surface-2); }
.estimate-box .amount { font-size: var(--fs-kpi); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.estimate-box .amount.free { color: var(--good); }
.estimate-box .amount.paid { color: var(--wait); }
.query-list { font-family: var(--mono); font-size: 11.5px; color: var(--text-3); margin-top: var(--sp-3); line-height: 1.7; max-height: 150px; overflow-y: auto; overscroll-behavior: contain; }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: var(--sp-3); margin-bottom: var(--sp-4);
}
.stat-card {
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r-lg);
  box-shadow: var(--shadow-border); padding: var(--sp-4);
}
.stat-card .label { font-size: var(--fs-ui); color: var(--text-2); margin-bottom: 6px; }
.stat-card .value { font-size: var(--fs-kpi); font-weight: 600; letter-spacing: -0.03em; line-height: 1.1; }
.stat-card .breakdown { margin-top: 10px; display: flex; flex-wrap: wrap; gap: 4px 12px; }
.chip { font-size: var(--fs-caption); color: var(--text-3); }
.chip b { color: var(--text-2); font-weight: 500; }

/* Column chart (usage per day) */
.chart-cols { display: flex; align-items: flex-end; gap: 3px; height: 140px; margin-top: var(--sp-2); }
.chart-cols .col { flex: 1; height: 100%; display: flex; align-items: flex-end; border-radius: 3px; }
.chart-cols .col i { display: block; width: 100%; min-height: 2px; border-radius: 3px 3px 1px 1px; background: var(--accent); opacity: 0.85; }
@media (hover: hover) { .chart-cols .col:hover i { opacity: 1; } .chart-cols .col:hover { background: var(--surface-2); } }
.chart-axis { display: flex; justify-content: space-between; font-size: var(--fs-caption); color: var(--text-3); margin-top: 6px; }

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

.form-group { display: flex; flex-direction: column; gap: 6px; margin-bottom: var(--sp-3); }
.form-label { font-size: var(--fs-ui); font-weight: 600; color: var(--text-2); }
.form-input {
  width: 100%; height: 42px; padding: 0 var(--sp-3); border: 0; border-radius: var(--r-sm);
  background: var(--surface); box-shadow: var(--btn-shadow);
  font: inherit; font-size: var(--fs-body); color: var(--text);
  transition: box-shadow 140ms var(--ease-out);
}
textarea.form-input { height: auto; min-height: 96px; padding: var(--sp-3); line-height: 1.5; resize: vertical; }
.form-input:focus { outline: 0; box-shadow: inset 0 0 0 2px var(--accent); }
.form-input::placeholder { color: var(--text-3); }
.form-row { display: flex; gap: var(--sp-3); flex-wrap: wrap; }
.form-row .form-group { flex: 1; min-width: 180px; }
.test-result { margin-top: var(--sp-2); padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); font-size: var(--fs-ui); white-space: pre-wrap; }
.test-result.success { background: var(--good-bg); color: var(--good); }
.test-result.error   { background: var(--bad-bg); color: var(--bad); }
.test-result.pending { background: var(--surface-2); color: var(--text-2); }
.settings-row { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: var(--sp-6); padding: var(--sp-5) 0; }
.settings-row + .settings-row { border-top: 1px solid var(--line); }
.settings-row:first-of-type { padding-top: 0; }
.settings-row:last-child { padding-bottom: 0; }
.settings-row h3 { font-size: var(--fs-h3); font-weight: 700; margin-bottom: var(--sp-1); }
.settings-row .desc { color: var(--text-2); font-size: var(--fs-ui); }
.settings-row .fields { min-width: 0; }
.settings-row .fields .form-group:last-child { margin-bottom: 0; }
.settings-row .fields .form-row { margin-bottom: 0; }
.settings-row .fields .form-row .form-group { margin-bottom: var(--sp-3); }
.with-btn { display: flex; gap: var(--sp-2); }
.with-btn .form-input { flex: 1; }
@media (max-width: 900px) { .settings-row { grid-template-columns: minmax(0, 1fr); gap: var(--sp-3); } }

/* ── Campaigns ───────────────────────────────────────────────── */

.campaign-card {
  background: var(--surface); border: 1px solid transparent; border-radius: var(--r-lg);
  box-shadow: var(--shadow-border); margin-bottom: var(--sp-4); overflow: hidden;
}
.campaign-top { padding: var(--sp-5); }
.campaign-title { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); flex-wrap: wrap; }
.campaign-title h3 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; }
.campaign-card .meta { display: flex; gap: var(--sp-3); flex-wrap: wrap; align-items: center; font-size: var(--fs-caption); color: var(--text-3); margin-top: 6px; }
.campaign-progress { margin-top: var(--sp-4); }
.campaign-progress .bar { height: 8px; gap: 2px; background: var(--surface-3); }
.campaign-legend { display: flex; flex-wrap: wrap; gap: 6px 16px; margin-top: 10px; }
.campaign-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-caption); color: var(--text-2); }
.campaign-legend i { width: 8px; height: 8px; border-radius: 2px; }
.campaign-legend b { color: var(--text); font-weight: 600; }

.sequence { border-top: 1px solid var(--line); padding: var(--sp-2) var(--sp-5) var(--sp-5); }
.email-step { position: relative; display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 0 var(--sp-3); padding-top: var(--sp-4); }
.email-step::before {
  content: ''; position: absolute; left: 13.5px; top: calc(var(--sp-4) + 30px); bottom: -16px; width: 1px; background: var(--line);
}
.email-step:last-child::before { display: none; }
.step-dot {
  width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center;
  font-size: var(--fs-caption); font-weight: 600; background: var(--surface-2); color: var(--text-2);
  box-shadow: inset 0 0 0 1px var(--line);
}
.email-step .step-num { font-size: var(--fs-caption); color: var(--text-3); margin-top: 5px; }
.email-step .subject { font-size: var(--fs-body); font-weight: 600; margin: 2px 0 6px; }
.email-step .body {
  font-size: var(--fs-ui); color: var(--text-2); line-height: 1.6; white-space: pre-wrap;
  background: var(--surface-2); border-radius: var(--r-md); padding: var(--sp-3) var(--sp-4); max-width: 72ch;
}
.step-actions {
  margin-top: var(--sp-3); display: flex; flex-direction: column; max-width: 72ch;
  border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line);
}
.rcpt { display: flex; align-items: center; gap: var(--sp-3); padding: 8px 12px; flex-wrap: wrap; }
.rcpt + .rcpt { border-top: 1px solid var(--line); }
.rcpt-who { flex: 1 1 200px; min-width: 0; font-size: var(--fs-ui); display: inline-flex; align-items: center; gap: 8px; flex-wrap: wrap; overflow-wrap: anywhere; }
.step-actions label { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-caption); color: var(--text-2); cursor: pointer; }
.step-actions input { accent-color: var(--accent); }

/* ── Respuestas: every reply as a chat ───────────────────────── */

.convo-card {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-border);
  padding: var(--sp-5); margin-bottom: var(--sp-4);
}
.convo-head { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); flex-wrap: wrap; }
.convo-head > div:nth-child(2) { flex: 1; min-width: 0; }
.convo-head h3 { font-size: var(--fs-h3); font-weight: 700; }
.convo-head h3, .convo-head .sub { overflow-wrap: anywhere; }
.convo-head .sub { color: var(--text-3); font-size: var(--fs-ui); }
.convo-head .tags { display: flex; gap: var(--sp-2); flex-wrap: wrap; }

.thread {
  display: flex; flex-direction: column; gap: var(--sp-2);
  padding: var(--sp-4); border-radius: var(--r-md); background: var(--bg);
}
.thread-msg {
  max-width: min(78%, 620px); padding: var(--sp-2) var(--sp-3) var(--sp-2);
  border-radius: var(--r-bubble); box-shadow: var(--bubble-shadow);
  font-size: var(--fs-body); line-height: 1.5; white-space: pre-wrap;
}
.thread-msg.sent { align-self: flex-end; background: var(--accent-soft); border-bottom-right-radius: 6px; }
.thread-msg.received { align-self: flex-start; background: var(--surface); border-bottom-left-radius: 6px; }
.thread-msg .sender { display: block; font-size: var(--fs-caption); font-weight: 700; color: var(--text-3); margin-bottom: 2px; white-space: normal; }
.thread-email {
  align-self: flex-end; max-width: min(78%, 620px); width: 100%;
  background: var(--accent-soft); border-radius: var(--r-bubble); border-bottom-right-radius: 6px;
  box-shadow: var(--bubble-shadow); padding: var(--sp-3) var(--sp-4);
}
.te-head { display: flex; align-items: center; gap: var(--sp-2); font-size: var(--fs-caption); color: var(--text-3); margin-bottom: var(--sp-1); flex-wrap: wrap; }
.te-head .icon { width: 14px; height: 14px; }
.te-head b { color: var(--text); font-weight: 700; }
.te-head span:not(.te-when) { min-width: 0; }
.te-when { margin-left: auto; }
.te-body { white-space: pre-wrap; font-size: var(--fs-body); line-height: 1.5; }
.thread-draft {
  align-self: flex-end; max-width: min(78%, 620px); width: 100%;
  border-radius: var(--r-bubble); border-bottom-right-radius: 6px; padding: var(--sp-3) var(--sp-4);
  background: var(--surface); box-shadow: inset 0 0 0 2px var(--act-soft), var(--bubble-shadow);
}
.thread-draft .sender { display: flex; align-items: center; gap: 6px; font-size: var(--fs-caption); font-weight: 700; color: var(--act); margin-bottom: 4px; }
.thread-draft .sender .icon { width: 14px; height: 14px; }
.td-body { white-space: pre-wrap; font-size: var(--fs-body); line-height: 1.5; }

/* ── Controls, help, misc ────────────────────────────────────── */

.control-panel { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.6fr); gap: var(--sp-4); align-items: start; }
@media (max-width: 900px) { .control-panel { grid-template-columns: minmax(0, 1fr); } }
.status-big { display: flex; align-items: center; gap: 10px; margin-bottom: 6px; }
.status-big .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--text-3); }
.status-big .dot.running { background: var(--good); box-shadow: 0 0 0 4px var(--good-bg); }
.status-big .label { font-size: 1.25rem; font-weight: 600; letter-spacing: -0.015em; }
.status-big .label.running { color: var(--good); }
.status-meta { font-size: var(--fs-ui); color: var(--text-3); min-height: 20px; }
.log-viewer {
  background: #0B0B0D; color: #C9C9D1; border-radius: var(--r-md);
  padding: var(--sp-4); font-family: var(--mono); font-size: 12px; line-height: 1.7;
  height: 380px; overflow-y: auto; overscroll-behavior: contain; white-space: pre-wrap;
  box-shadow: inset 0 0 0 1px rgb(255 255 255 / 0.06);
}

.help-section { margin-bottom: var(--sp-6); max-width: 76ch; }
.help-section h2 { font-size: var(--fs-h3); font-weight: 600; letter-spacing: -0.01em; margin-bottom: var(--sp-2); }
.help-section p { font-size: var(--fs-body); color: var(--text-2); line-height: 1.65; margin-bottom: var(--sp-2); text-wrap: pretty; }
.help-section pre {
  background: var(--surface-2); border-radius: var(--r-md); padding: var(--sp-4);
  overflow-x: auto; font-family: var(--mono); font-size: 12.5px; line-height: 1.6; margin: var(--sp-2) 0;
}
.help-section details { background: var(--surface); border-radius: var(--r-md); box-shadow: var(--shadow-border); margin-bottom: var(--sp-2); }
.help-section details summary { padding: 12px var(--sp-4); font-size: var(--fs-body); font-weight: 500; }
.help-section .faq-body { padding: 0 var(--sp-4) var(--sp-4) 34px; font-size: var(--fs-ui); color: var(--text-2); line-height: 1.65; }
.help-section .faq-body p { font-size: var(--fs-ui); margin-bottom: 6px; }
.file-table { width: 100%; font-size: var(--fs-ui); border-collapse: collapse; }
.file-table td { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.file-table td:first-child { font-family: var(--mono); font-size: 12px; white-space: nowrap; width: 230px; color: var(--text); }
.file-table td:last-child { color: var(--text-2); }
.file-table tr:last-child td { border-bottom: none; }

.empty { text-align: center; padding: var(--sp-7) var(--sp-5); }
.empty .glyph {
  width: 40px; height: 40px; margin: 0 auto var(--sp-3); border-radius: 12px;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  background: var(--surface-2); color: var(--text-2);
}
.empty .title { font-size: var(--fs-h3); font-weight: 600; margin-bottom: 4px; }
.empty .copy { font-size: var(--fs-ui); color: var(--text-2); line-height: 1.6; max-width: 48ch; margin: 0 auto; text-wrap: pretty; }
.empty .copy b { color: var(--text); font-weight: 500; }
.section > .empty, .content-inner > .empty, #companies-list > .empty, #prospects-table > .empty,
#campaigns-list > .empty, #conversations-list > .empty, #activity-list > .empty {
  background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-border);
}

.toast {
  position: fixed; bottom: var(--sp-5); right: var(--sp-5); z-index: 60; max-width: 420px;
  padding: 10px 14px; border-radius: var(--r-md); font-size: var(--fs-ui); font-weight: 500;
  box-shadow: var(--shadow-pop);
  transition-property: opacity, translate; transition-duration: 250ms; transition-timing-function: var(--ease-out);
  @starting-style { opacity: 0; translate: 0 8px; }
}
.toast.success { background: var(--text); color: var(--bg); }
.toast.error { background: var(--bad); color: #fff; }

/* Lock screen */
#lock-screen { background: var(--bg); }
#lock-screen .card { box-shadow: var(--shadow-pop); }

/* Replies and scraped text are written by outsiders: a 3,000-character URL
   must wrap inside its box, never push the page sideways. */
.desk-pane .body, .thread-msg, .te-body, .td-body, .te-head span, .cell-main, .cell-sub { overflow-wrap: anywhere; }

.convo-actions { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: var(--sp-4); padding-top: var(--sp-3); border-top: 1px solid var(--line); }
.convo-actions .muted { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-caption); margin-right: auto; }
.convo-actions .btn-ghost { margin-left: auto; }
.facts { display: flex; flex-wrap: wrap; gap: 4px 14px; padding: 10px 4px 0; margin-bottom: var(--sp-5); font-size: var(--fs-caption); color: var(--text-3); }
.facts b { color: var(--text-2); font-weight: 600; font-variant-numeric: tabular-nums; }
.cell-sub .verified { color: var(--good); font-weight: 600; }
/* Long subjects end in an ellipsis; the card scrolls sideways if it must. */
table.clip td { max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.live-next .btn { margin-left: auto; }
.more-fields { margin-bottom: var(--sp-3); }
.more-fields summary { cursor: pointer; font-size: var(--fs-ui); color: var(--text-2); margin-bottom: var(--sp-3); }
.check-line { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-ui); color: var(--text-2); cursor: pointer; }

/* Contacts: why someone is opted out, under their row. */
.detail-row > td { white-space: normal; background: var(--surface-2); }
.optout-panel { display: flex; flex-direction: column; gap: var(--sp-2); max-width: 72ch; padding: var(--sp-2) 0; }
.optout-panel h4 { margin: 0; font-size: var(--fs-ui); }
.optout-panel p { margin: 0; font-size: var(--fs-ui); line-height: 1.55; }
.optout-panel .optout-meta { font-size: var(--fs-caption); color: var(--text-2); }
.optout-panel .thread-msg.received { background: var(--surface); }
.optout-panel .convo-actions { margin-top: var(--sp-2); }
.optout-panel .convo-actions .muted { white-space: normal; }
.optout-panel .convo-actions .btn-ghost { margin-left: 0; }

/* Outbox: an email autopilot held for you (#66). */
.desk-held { margin-bottom: var(--sp-3); }

/* Approval or autopilot: the Outbox notice and the Settings card. */
.mode-banner { align-items: center; }
.mode-banner > div { flex: 1; }
.mode-card h3 { margin: 0 0 var(--sp-2); }
.mode-card p { margin: 0 0 var(--sp-2); font-size: var(--fs-ui); line-height: 1.55; max-width: 72ch; }
.mode-card .convo-actions .muted { white-space: normal; flex-basis: 100%; }
.mode-confirm .form-input { width: 12rem; }
.mode-card .convo-actions .btn-ghost { margin-left: 0; }
.mode-banner:not(.wait) { background: var(--surface); border-color: var(--line); }

/* Setup checklist: the warmup step's actions */
.warmup-actions { margin-top: var(--sp-2); align-items: center; }
a.btn, a.btn:hover { text-decoration: none; }
.warmup-actions .form-input { flex: 1 1 200px; height: 28px; min-width: 0; }

/* ── Small screens: the chat list becomes a top strip ────────── */

@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .agent-card { position: static; }
  .grid-main { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 900px) {
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; }
  .sidebar {
    position: sticky; top: 0; z-index: 20; height: auto; overflow: visible;
    flex-direction: row; flex-wrap: wrap; align-items: center; gap: var(--sp-2) var(--sp-3);
    padding: var(--sp-2) var(--sp-4); box-shadow: 0 1px 0 var(--line);
  }
  .brand { padding: 0; }
  .brand-logo-icon { width: 32px; height: 32px; border-radius: 10px; }
  nav {
    order: 3; flex: 0 0 calc(100% + 2 * var(--sp-4)); flex-direction: row; gap: var(--sp-1); overflow-x: auto; scrollbar-width: none;
    margin: 0 calc(-1 * var(--sp-4)); padding: 0 var(--sp-4) var(--sp-1); width: calc(100% + 2 * var(--sp-4));
  }
  nav::-webkit-scrollbar { display: none; }
  .chat-list { flex-direction: row; gap: var(--sp-1); }
  .chat-row { grid-template-columns: auto auto; width: auto; flex: none; padding: 6px 12px 6px 6px; border-radius: 999px; gap: var(--sp-2); background: var(--surface-2); }
  .chat-avatar { width: 30px; height: 30px; }
  .chat-avatar .icon { width: 16px; height: 16px; }
  .chat-main { flex-direction: row; }
  .chat-preview { display: none; }
  .chat-row .nav-count.on { grid-column: auto; }
  .chat-row { display: inline-flex; align-items: center; }
  .nav-advanced { border-top: 0; padding: 0; flex: none; position: relative; }
  .nav-advanced summary { height: 42px; border-radius: 999px; background: var(--surface-2); padding: 0 14px; white-space: nowrap; }
  .nav-advanced[open] .adv-list {
    position: fixed; left: var(--sp-4); right: var(--sp-4); top: 120px; z-index: 30;
    background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-pop); padding: var(--sp-2);
    max-height: 60vh; overflow-y: auto;
  }
  .sidebar-foot { margin-left: auto; flex-direction: row; align-items: center; border-top: 0; padding: 0; }
  .sidebar-foot .harvey-status span:last-child { display: none; }
  .lang-actions { margin-right: 0; }
  .sidebar-foot .refresh-btn, .sidebar-foot #theme-btn { display: none; }
  .sidebar-user-badge { display: none !important; }
  main.content { padding: var(--sp-4) var(--sp-4) 80px; }
  .next-band { flex-wrap: wrap; }
  .band-text { flex-basis: calc(100% - 30px); }
  .tl-item { grid-template-columns: 52px 24px minmax(0, 1fr); }
  .queue-item { flex-wrap: wrap; }
  .queue-item .qtext { flex-basis: calc(100% - 48px); }
  .queue-item .btn { margin-left: 48px; }
  .step-detail { grid-column: 2 / 4; text-align: left; }
  .tl-agent { display: none; }
  .bubble { max-width: 100%; }
  .thread-msg, .thread-email, .thread-draft { max-width: 92%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; animation-delay: 0ms !important; }
}

/* ── Access: lock screen, team login, user badge ─────────────── */

.lock {
  position: fixed; inset: 0; z-index: 1000; align-items: center; justify-content: center; padding: var(--sp-5);
  background: var(--bg);
}
.lock-card {
  width: 100%; max-width: 420px; background: var(--surface); border-radius: 22px;
  box-shadow: var(--shadow-pop); padding: var(--sp-6);
}
.lock-brand { display: flex; align-items: center; gap: var(--sp-3); margin-bottom: var(--sp-4); }
.lock-brand h2 { font-size: 1.25rem; font-weight: 700; letter-spacing: -0.02em; }
.lock-reason { color: var(--bad); font-size: var(--fs-ui); margin-bottom: var(--sp-3); }
.lock-reason:empty { display: none; }
.lock-help { color: var(--text-2); font-size: var(--fs-ui); margin-bottom: var(--sp-3); }
.lock-card .form-group { margin-bottom: var(--sp-4); }

.auth-tabs { display: flex; padding: 3px; gap: 2px; border-radius: var(--r-sm); background: var(--surface-2); margin-bottom: var(--sp-5); }
.auth-tab-btn {
  flex: 1; height: 36px; border: 0; border-radius: 8px; background: transparent; color: var(--text-2);
  font: inherit; font-size: var(--fs-ui); font-weight: 600; cursor: pointer;
}
@media (hover: hover) { .auth-tab-btn:hover { color: var(--text); } }
.auth-tab-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-border); }

.sidebar-user-badge { display: flex; align-items: center; gap: var(--sp-3); }
.sidebar-user-badge .user-avatar {
  width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; flex: none;
  background: var(--accent-soft); color: var(--accent); font-size: 12px; font-weight: 700;
}
.sidebar-user-badge .user-details { flex: 1; min-width: 0; }
.sidebar-user-badge .user-name { font-size: var(--fs-ui); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sidebar-user-badge .btn-logout {
  width: 32px; height: 32px; border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-3);
  display: grid; place-items: center; cursor: pointer;
}
@media (hover: hover) { .sidebar-user-badge .btn-logout:hover { background: var(--surface-2); color: var(--text); } }
.badge-role { display: inline-flex; align-items: center; height: 18px; padding: 0 7px; border-radius: 999px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em; }
.badge-admin { background: var(--accent-soft); color: var(--accent); }
.badge-closer { background: var(--good-bg); color: var(--good); }
.badge-viewer { background: var(--surface-2); color: var(--text-2); }
.badge-enterprise { display: inline-flex; align-items: center; height: 22px; padding: 0 9px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--surface-2); color: var(--text-2); }

.toast {
  position: fixed; bottom: var(--sp-5); left: 50%; transform: translateX(-50%); z-index: 2000;
  padding: var(--sp-3) var(--sp-4); border-radius: 999px; background: var(--text); color: var(--surface);
  font-size: var(--fs-ui); font-weight: 600; box-shadow: var(--shadow-pop);
  animation: toast-in 320ms var(--ease-out);
}
.toast.error { background: var(--bad); color: #fff; }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 10px); } }

/* Setup gaps for whoever configures: quiet, under the status. */
.operator-note { padding: var(--sp-3) var(--sp-4); border-radius: var(--r-md); background: var(--wait-bg); }
.note-title { font-size: var(--fs-caption); font-weight: 700; color: var(--wait); margin-bottom: var(--sp-1); }
.operator-note ul { list-style: none; display: flex; flex-direction: column; gap: 2px; margin-bottom: var(--sp-2); font-size: var(--fs-ui); color: var(--text-2); }
.operator-note .btn { margin-left: calc(-1 * var(--sp-3)); }

/* The approval desk speaks plainly: no shortcut chips in the default view. */
.desk-actions kbd { display: none; }
@media (min-width: 1280px) and (hover: hover) { .desk-actions kbd { display: inline-flex; } }
.desk-footer { flex-direction: column; align-items: flex-start; gap: 2px; color: var(--text-2); font-size: var(--fs-ui); }
.footer-label { font-size: var(--fs-caption); font-weight: 700; color: var(--text-3); }

/* Sent list on phones: two lines per row instead of clipped columns. */
@media (max-width: 640px) {
  #outbox-list table thead { display: none; }
  #outbox-list table, #outbox-list tbody, #outbox-list tr, #outbox-list td { display: block; width: 100%; }
  #outbox-list tr { padding: var(--sp-2) var(--sp-4); border-bottom: 1px solid var(--line); }
  #outbox-list td { padding: 0; border: 0; }
  #outbox-list td:first-child { font-weight: 600; }
  #outbox-list td:not(:first-child) { display: inline; color: var(--text-3); font-size: var(--fs-caption); margin-right: var(--sp-2); }
}

.week-report { margin-top: var(--sp-2); margin-left: calc(-1 * var(--sp-3)); }

/* ── Welcome tour ── */
.tour { position: fixed; inset: 0; z-index: 1000; }
.tour-shade { position: absolute; inset: 0; background: rgb(15 20 17 / 0.55); }
.tour-spot {
  position: fixed; border-radius: var(--r-md); pointer-events: none;
  box-shadow: 0 0 0 2px var(--accent), 0 0 0 9999px rgb(15 20 17 / 0.55);
}
.tour:has(.tour-spot:not([hidden])) .tour-shade { background: transparent; }
.tour-card {
  position: fixed; width: min(360px, calc(100vw - 24px)); padding: var(--sp-4) var(--sp-4) var(--sp-3);
  background: var(--surface); color: var(--text); border-radius: var(--r-lg); box-shadow: var(--shadow-pop);
}
.tour-center .tour-card { top: 50%; left: 50%; transform: translate(-50%, -50%); width: min(440px, calc(100vw - 24px)); }
.tour-step { font-size: var(--fs-caption); font-weight: 600; color: var(--text-3); margin: 0 0 4px; font-variant-numeric: tabular-nums; }
.tour-title { margin: 0 0 6px; font-size: 1.125rem; line-height: 1.25; text-wrap: balance; }
.tour-center .tour-title { font-size: 1.375rem; }
.tour-body { margin: 0; color: var(--text-2); font-size: var(--fs-body); line-height: 1.5; }
.tour-foot { display: flex; align-items: center; justify-content: space-between; gap: var(--sp-3); margin-top: var(--sp-4); flex-wrap: wrap; }
.tour-dots { display: flex; gap: 5px; }
.tour-dot { width: 6px; height: 6px; border-radius: 999px; background: var(--line-strong); }
.tour-dot.past { background: var(--accent-line); }
.tour-dot.on { width: 18px; background: var(--accent); }
.tour-actions { display: flex; gap: 6px; margin-left: auto; }
.tour-actions [hidden] { display: none; }
.tour-banner { align-items: center; justify-content: space-between; flex-wrap: wrap; }
@media (prefers-reduced-motion: no-preference) {
  .tour-spot { transition: top 260ms var(--ease-out), left 260ms var(--ease-out), width 260ms var(--ease-out), height 260ms var(--ease-out); }
  .tour-card { transition: top 260ms var(--ease-out), left 260ms var(--ease-out); animation: tour-in 220ms var(--ease-out); }
  .tour-dot { transition: width 200ms var(--ease-out), background-color 200ms var(--ease-out); }
}
@keyframes tour-in { from { opacity: 0; } to { opacity: 1; } }
@media (max-width: 640px) {
  .tour-card, .tour-center .tour-card { left: 12px !important; right: 12px; top: auto !important; bottom: 12px; transform: none; width: auto; }
}

/* ── Brands ── */
.chat-avatar.av-brands { background: var(--note-bg); color: var(--note); }
.brands-list { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 460px), 1fr)); gap: var(--sp-4); }
.brand-card { display: flex; flex-direction: column; gap: var(--sp-4); }
.brand-head { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: var(--sp-3); align-items: center; }
.brand-head h3 { margin: 0; font-size: 1.0625rem; }
.brand-head .desc { margin: 2px 0 0; overflow-wrap: anywhere; }
.brand-badges { grid-column: 1 / -1; display: flex; gap: 6px; flex-wrap: wrap; }
.brand-swatches { display: flex; align-items: center; flex: none; }
.swatch { flex: none; width: 22px; height: 22px; border-radius: 999px; box-shadow: 0 0 0 2px var(--surface); margin-left: -6px; display: inline-block; }
.swatch:first-child { margin-left: 0; }
.swatch.swatch-none { background: var(--surface-2); box-shadow: inset 0 0 0 1px var(--line-strong); }
.brand-swatches.big { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.brand-swatches.big .swatch { margin: 0; width: 28px; height: 28px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 0.08); }
.brand-error { margin: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--bad-bg); color: var(--bad); font-size: var(--fs-ui); }
.brand-today-row { display: flex; justify-content: space-between; font-size: var(--fs-ui); color: var(--text-2); margin-bottom: 6px; }
.brand-today-row b { color: var(--text); font-variant-numeric: tabular-nums; }
.brand-meter { height: 8px; border-radius: 999px; background: var(--surface-2); overflow: hidden; }
.brand-meter span { display: block; height: 100%; background: var(--accent); border-radius: inherit; }
.brand-kpis { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: var(--sp-2); margin: 0; }
.brand-kpis div { background: var(--surface-2); border-radius: var(--r-md); padding: var(--sp-2) var(--sp-3); }
.brand-kpis dt { font-size: var(--fs-caption); color: var(--text-3); }
.brand-kpis dd { margin: 2px 0 0; font-size: 1.375rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.brand-prod { margin: 0; font-size: var(--fs-ui); color: var(--text-2); line-height: 1.5; }
.brand-prod b { color: var(--text); }
.brand-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--sp-3); flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: var(--sp-3); }
.brand-foot code { font-size: var(--fs-caption); }
.brand-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.brand-empty { text-align: left; display: flex; flex-direction: column; gap: var(--sp-2); align-items: flex-start; }
.brand-empty h3 { margin: 0; }
@media (max-width: 640px) { .brand-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); } }

/* ── Brand wizard / memory dialog ── */
.bw-dialog { margin: auto; border: 0; padding: 0; border-radius: var(--r-lg); background: var(--surface); color: var(--text); box-shadow: var(--shadow-pop); width: min(620px, calc(100vw - 24px)); max-height: calc(100dvh - 32px); }
.bw-dialog.wide { width: min(760px, calc(100vw - 24px)); }
.bw-dialog::backdrop { background: rgb(15 20 17 / 0.55); }
.bw { display: flex; flex-direction: column; max-height: calc(100dvh - 32px); }
.bw-head { display: flex; justify-content: space-between; align-items: center; padding: var(--sp-3) var(--sp-4); border-bottom: 1px solid var(--line); }
.bw-head h2 { margin: 0; font-size: 1.125rem; }
.bw-kicker { font-size: var(--fs-caption); font-weight: 600; color: var(--text-3); }
.bw-body { padding: var(--sp-4); overflow-y: auto; display: flex; flex-direction: column; gap: var(--sp-3); }
.bw-foot { display: flex; justify-content: flex-end; gap: var(--sp-2); padding: var(--sp-3) var(--sp-4); border-top: 1px solid var(--line); }
.bw-step { margin: 0; font-size: var(--fs-caption); font-weight: 600; color: var(--text-3); }
.bw-title { margin: 0; font-size: 1.375rem; line-height: 1.2; text-wrap: balance; }
.bw-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--sp-3); }
.bw-grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.bw-grid .form-group, .bw-body > .form-group { margin: 0; display: flex; flex-direction: column; gap: 6px; }
.bw-grid [hidden] { display: none; }
.bw-fieldset { border: 0; padding: 0; margin: 0; }
.bw-ais { display: grid; grid-template-columns: repeat(auto-fill, minmax(min(100%, 170px), 1fr)); gap: var(--sp-2); margin-top: 6px; }
.bw-ai { display: flex; gap: 8px; align-items: flex-start; padding: 10px 12px; border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line-strong); cursor: pointer; font-size: var(--fs-ui); }
.bw-ai:has(input:checked) { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.bw-ai input { margin-top: 3px; accent-color: var(--accent); }
.bw-count { display: flex; align-items: center; gap: var(--sp-4); }
.bw-count output { font-size: 2.5rem; font-weight: 700; min-width: 2ch; text-align: center; font-variant-numeric: tabular-nums; }
.bw-count .btn { width: 44px; height: 44px; font-size: 1.25rem; justify-content: center; }
.bw-error { margin: 0; color: var(--bad); font-weight: 600; min-height: 1.2em; }
.bw-done { margin: 0; padding-left: 1.2em; display: flex; flex-direction: column; gap: 6px; }
.bw-memory section h3 { margin: 0 0 4px; font-size: var(--fs-ui); color: var(--text-3); text-transform: none; }
.bw-memory section p, .bw-memory ul { margin: 0; }
.bw-memory ul { padding-left: 1.2em; }
.bw-memory h4 { margin: 6px 0 2px; font-size: var(--fs-caption); color: var(--text-3); }
.bw-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
@media (max-width: 640px) {
  .bw-grid, .bw-grid.three, .bw-cols { grid-template-columns: minmax(0, 1fr); }
}

/* ── Strategy steps ── */
.st-steps { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--sp-3); }
.st-step { border-radius: var(--r-md); box-shadow: inset 0 0 0 1px var(--line); padding: var(--sp-3) var(--sp-4); }
.st-step.is-next { box-shadow: inset 0 0 0 2px var(--accent-line); }
.st-step.is-locked { opacity: 0.6; }
.st-head { display: flex; align-items: center; gap: var(--sp-2); flex-wrap: wrap; }
.st-head h3 { margin: 0; font-size: var(--fs-lead); }
.st-num { width: 24px; height: 24px; border-radius: 999px; display: grid; place-items: center; background: var(--surface-2); font-weight: 700; font-size: var(--fs-caption); flex: none; }
.st-step.is-next .st-num { background: var(--accent); color: var(--accent-text); }
.st-actions { margin-left: auto; display: flex; gap: 6px; flex-wrap: wrap; }
.st-content { margin-top: var(--sp-3); display: flex; flex-direction: column; gap: var(--sp-2); font-size: var(--fs-ui); line-height: 1.5; }
.st-content p, .st-content ul { margin: 0; }
.st-content ul { padding-left: 1.2em; }
.st-content h4 { margin: 4px 0 0; font-size: var(--fs-caption); color: var(--text-3); }
.st-list { display: flex; flex-direction: column; gap: 6px; }
.st-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--sp-3); }
.st-body .brand-error { margin: 0; }
@media (max-width: 640px) { .st-grid { grid-template-columns: minmax(0, 1fr); } .st-actions { margin-left: 0; width: 100%; } }

.bw-share { margin: 0; padding: var(--sp-2) var(--sp-3); border-radius: var(--r-sm); background: var(--wait-bg); color: var(--text); font-size: var(--fs-ui); line-height: 1.45; }
.bw-share[hidden] { display: none; }

.billing-banner { align-items: center; justify-content: space-between; flex-wrap: wrap; background: var(--wait-bg); }
