/*
 * Cartly Juice design tokens, taken from Cartly Monitors (seat-monitor-site/apps/web/app/globals.css).
 *
 * Near-black graphite, a silver "C" tile, and lime #ccfd50 as the ONLY interface accent. Lime is rationed
 * to signals: the primary action, the active nav item, the selected dimension, focus.
 * Dark is the default on :root; light is an opt-in override via [data-theme="light"].
 *
 * Radii rule: buttons and chips pill, panels 16, KPI cards 12, inputs 10, gate card 20.
 */

@font-face {
  font-family: "Geist";
  src: url("/fonts/Geist-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}
@font-face {
  font-family: "Geist Mono";
  src: url("/fonts/GeistMono-Variable.woff2") format("woff2");
  font-weight: 100 900;
  font-display: swap;
}

:root {
  --font-sans: "Geist", system-ui, -apple-system, sans-serif;
  --font-mono: "Geist Mono", ui-monospace, "SF Mono", monospace;

  --base: #0b0b0c;
  --surface: #151516;
  --glass: rgba(20, 20, 21, 0.62);
  --glass-blur: 24px;

  --text-1: #f2f2f2;
  --text-2: #c9c9cc;
  --text-3: #9a9a9f;
  --text-4: #7d7d84;

  /* --accent is the fill (always with --accent-ink on top); --accent-text is lime as text, icon or ring. */
  --accent: #ccfd50;
  --accent-ink: #0b0b0c;
  --accent-text: #ccfd50;
  --accent-soft: rgba(204, 253, 80, 0.12);

  --success: #8fd14f;
  --warning: #d9a84a;
  --danger: #e5706b;
  --success-soft: rgba(143, 209, 79, 0.14);
  --warning-soft: rgba(217, 168, 74, 0.14);
  --danger-soft: rgba(229, 112, 107, 0.14);

  --fill-1: rgba(255, 255, 255, 0.025);
  --fill-2: rgba(255, 255, 255, 0.045);
  --fill-3: rgba(255, 255, 255, 0.07);
  --fill-4: rgba(255, 255, 255, 0.095);
  --border-1: rgba(255, 255, 255, 0.07);
  --border-2: rgba(255, 255, 255, 0.1);
  --border-3: rgba(255, 255, 255, 0.15);

  --glow-a: rgba(255, 255, 255, 0.05);
  --glow-b: rgba(204, 253, 80, 0.07);

  /* Chart series: the Cartly tag hues stepped down until they pass the palette validator on --surface.
     Slot order is fixed and follows the event type, never its rank. */
  --series-1: #789f25;
  --series-2: #4a98d0;
  --series-3: #cf5f80;
  --series-4: #b5862c;
  --series-5: #8a79e0;
  --series-6: #2ea597;

  --r-pill: 999px;
  --r-glass: 16px;
  --r-card: 12px;
  --r-input: 10px;
  --r-modal: 20px;

  --sidebar-w: 240px;
  --rail-w: 56px;
  --header-h: 56px;
  --btn-h: 38px;
  --input-h: 40px;

  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --fast: 140ms;
  --base-t: 240ms;

  --shadow-pop: 0 12px 40px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.04);
  --ring: 0 0 0 3px var(--accent-soft);
  color-scheme: dark;
}

:root[data-theme="light"] {
  --base: #f4f4f5;
  --surface: #ffffff;
  --glass: rgba(255, 255, 255, 0.66);

  --text-1: #151516;
  --text-2: #3f3f44;
  --text-3: #6a6a70;
  --text-4: #74747a;

  --accent-text: #4b6a00;
  --accent-soft: rgba(132, 190, 0, 0.16);

  --success: #4f8f1f;
  --warning: #a8781e;
  --danger: #c84c4c;
  --success-soft: rgba(79, 143, 31, 0.12);
  --warning-soft: rgba(168, 120, 30, 0.12);
  --danger-soft: rgba(200, 76, 76, 0.12);

  --fill-1: rgba(16, 16, 18, 0.02);
  --fill-2: rgba(16, 16, 18, 0.035);
  --fill-3: rgba(16, 16, 18, 0.05);
  --fill-4: rgba(16, 16, 18, 0.075);
  --border-1: rgba(16, 16, 18, 0.07);
  --border-2: rgba(16, 16, 18, 0.1);
  --border-3: rgba(16, 16, 18, 0.15);

  --glow-a: rgba(16, 16, 18, 0.035);
  --glow-b: rgba(190, 240, 70, 0.22);

  --series-1: #5f8300;
  --series-2: #2c7cb8;
  --series-3: #c0466a;
  --series-4: #8a6a14;
  --series-5: #6e5fd8;
  --series-6: #0b8f82;

  --shadow-pop: 0 12px 40px rgba(16, 16, 18, 0.14), 0 0 0 1px rgba(16, 16, 18, 0.04);
  color-scheme: light;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
[hidden] { display: none !important; }

html { min-height: 100%; background: var(--base); }

body {
  position: relative;
  min-height: 100dvh;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  -webkit-tap-highlight-color: transparent;
}

/* The Cartly ambient: a silver light top-left, a faint lime cast top-right. Fixed behind everything. */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(55% 45% at 12% -5%, var(--glow-a), transparent 60%),
    radial-gradient(48% 42% at 106% 12%, var(--glow-b), transparent 55%),
    var(--base);
}

.mono { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
h1, h2 { text-wrap: balance; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; background: none; border: none; }
a, button, input, select { touch-action: manipulation; }
::selection { background: var(--accent-soft); }
:focus-visible { outline: 2px solid var(--accent-text); outline-offset: 2px; }
main:focus { outline: none; }

::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb {
  background: var(--border-3);
  border-radius: 999px;
  border: 3px solid transparent;
  background-clip: content-box;
}

.sprite { position: absolute; }
.mark { display: block; flex-shrink: 0; }
.ico {
  width: 18px;
  height: 18px;
  flex-shrink: 0;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.7;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.skip {
  position: fixed;
  top: 10px;
  left: 10px;
  z-index: 100;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  font-size: 13px;
  font-weight: 600;
  transform: translateY(-200%);
}
.skip:focus { transform: none; }

/* ---------- shell ---------- */
.shell { display: flex; min-height: 100dvh; }
.main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.content {
  flex: 1;
  width: 100%;
  max-width: 1400px;
  margin: 0 auto;
  padding: 28px 32px 56px;
  transition: opacity var(--base-t) var(--ease);
}
.content[aria-busy="true"] { opacity: 0.62; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  height: 100dvh;
  position: sticky;
  top: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 12px;
  background: var(--glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-right: 1px solid var(--border-1);
}
.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px 14px;
  border-radius: var(--r-input);
}
.wordmark { font-size: 16px; font-weight: 600; letter-spacing: -0.02em; white-space: nowrap; }

.nav { flex: 1; display: flex; flex-direction: column; gap: 2px; }
.item {
  position: relative;
  display: flex;
  align-items: center;
  gap: 11px;
  height: 38px;
  padding: 0 11px;
  border-radius: var(--r-input);
  color: var(--text-3);
  font-size: 13.5px;
  font-weight: 450;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.item:hover { background: var(--fill-2); color: var(--text-2); }
.item[aria-current="page"] { background: var(--fill-3); color: var(--text-1); font-weight: 550; }
.item[aria-current="page"]::before {
  content: "";
  position: absolute;
  left: 0;
  top: 50%;
  width: 3px;
  height: 16px;
  transform: translateY(-50%);
  border-radius: 999px;
  background: var(--accent);
}
.item[aria-current="page"] .ico { color: var(--accent-text); }

.meter {
  padding: 12px 11px;
  border-radius: var(--r-card);
  background: var(--fill-2);
  border: 1px solid var(--border-1);
}
.meterTop {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-3);
}
.meterBar { height: 6px; border-radius: 999px; background: var(--fill-4); overflow: hidden; }
.meterBar > span {
  display: block;
  width: 0;
  height: 100%;
  border-radius: 999px;
  background: var(--accent);
  transition: width var(--base-t) var(--ease);
}
.meterNote { margin-top: 9px; font-size: 11.5px; color: var(--text-4); }

.header {
  position: sticky;
  top: 0;
  z-index: 10;
  min-height: var(--header-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 9px 24px;
  background: var(--glass);
  backdrop-filter: blur(var(--glass-blur));
  -webkit-backdrop-filter: blur(var(--glass-blur));
  border-bottom: 1px solid var(--border-1);
}
.right { display: flex; align-items: center; gap: 10px; min-width: 0; }
.updated { font-size: 12px; color: var(--text-4); white-space: nowrap; }

.iconBtn {
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-2);
  background: var(--fill-2);
  color: var(--text-2);
  transition:
    background var(--fast) var(--ease),
    color var(--fast) var(--ease),
    border-color var(--fast) var(--ease),
    transform var(--fast) var(--ease);
}
.iconBtn .ico { width: 16px; height: 16px; }
.iconBtn:hover { background: var(--fill-3); color: var(--text-1); border-color: var(--border-3); }
.iconBtn:active { transform: scale(0.96); }
.iconBtn:disabled { opacity: 0.5; cursor: default; }
#themeBtn .onLight { display: none; }
:root[data-theme="light"] #themeBtn .onLight { display: block; }
:root[data-theme="light"] #themeBtn .onDark { display: none; }

/* ---------- controls ---------- */
.seg {
  display: inline-flex;
  flex-shrink: 0;
  gap: 2px;
  padding: 3px;
  border-radius: var(--r-pill);
  background: var(--fill-2);
  border: 1px solid var(--border-1);
}
.seg button {
  height: 28px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.seg button:hover { color: var(--text-1); }
.seg button[aria-pressed="true"] { background: var(--fill-4); color: var(--text-1); }
.seg.small button { height: 24px; padding: 0 11px; font-size: 12px; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 14px; }
.chip {
  height: 30px;
  padding: 0 12px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-1);
  background: var(--fill-2);
  color: var(--text-3);
  font-size: 12.5px;
  font-weight: 500;
  transition:
    background var(--fast) var(--ease),
    color var(--fast) var(--ease),
    border-color var(--fast) var(--ease);
}
.chip:hover { background: var(--fill-3); color: var(--text-1); }
.chip[aria-pressed="true"] {
  background: var(--accent-soft);
  border-color: color-mix(in srgb, var(--accent-text) 30%, transparent);
  color: var(--accent-text);
}

.selectWrap { position: relative; display: inline-flex; min-width: 0; }
.selectWrap select {
  appearance: none;
  -webkit-appearance: none;
  height: 34px;
  width: 100%;
  max-width: 200px;
  padding: 0 30px 0 13px;
  border-radius: var(--r-pill);
  border: 1px solid var(--border-2);
  background-color: var(--fill-2);
  color: var(--text-2);
  font: inherit;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  text-overflow: ellipsis;
  transition: background-color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.selectWrap select:hover { background-color: var(--fill-3); border-color: var(--border-3); }
.selectWrap select option { background: var(--surface); color: var(--text-1); }
.selectWrap .ico {
  position: absolute;
  right: 10px;
  top: 50%;
  width: 14px;
  height: 14px;
  transform: translateY(-50%);
  color: var(--text-4);
  pointer-events: none;
}

.input {
  width: 100%;
  height: var(--input-h);
  padding: 0 13px;
  border-radius: var(--r-input);
  background: var(--fill-2);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  font-family: inherit;
  font-size: 14px;
  transition:
    border-color var(--fast) var(--ease),
    background var(--fast) var(--ease),
    box-shadow var(--fast) var(--ease);
}
.input.mono { font-family: var(--font-mono); font-size: 13px; }
.input::placeholder { color: var(--text-4); }
.input:focus { outline: none; border-color: var(--accent-text); box-shadow: var(--ring); background: var(--fill-3); }

.pill {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: var(--btn-h);
  padding: 0 15px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 600;
  white-space: nowrap;
  transition: filter var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.pill:active:not(:disabled) { transform: scale(0.985); }
.pill.primary { background: var(--accent); color: var(--accent-ink); }
.pill.primary:hover:not(:disabled) { filter: brightness(1.06); }
.pill.primary:disabled { background: var(--fill-3); color: var(--text-4); cursor: default; }
.pill.block { width: 100%; }

.textBtn {
  align-self: center;
  padding: 4px 8px;
  border-radius: var(--r-input);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-3);
  transition: color var(--fast) var(--ease);
}
.textBtn:hover { color: var(--text-1); }

/* ---------- account menu ---------- */
.accountWrap { position: relative; flex-shrink: 0; }
.account {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 9px 0 6px;
  border-radius: var(--r-pill);
  background: var(--fill-2);
  border: 1px solid var(--border-1);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  transition: background var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.account:hover { background: var(--fill-3); border-color: var(--border-2); }
.account > .ico { width: 14px; height: 14px; color: var(--text-4); }
.avatar {
  width: 22px;
  height: 22px;
  display: grid;
  place-items: center;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: linear-gradient(135deg, #19191a, #050506);
  box-shadow: 0 0 0 1px var(--border-2);
}
.accountName { max-width: 140px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.menu {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 20;
  min-width: 220px;
  padding: 6px;
  border-radius: var(--r-card);
  background: var(--surface);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-pop);
}
.menuHead {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 8px 10px 10px;
  margin-bottom: 4px;
  border-bottom: 1px solid var(--border-1);
}
.menuLabel { font-size: 11px; color: var(--text-4); }
.menuName { font-size: 13px; font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menuRole { margin-top: 2px; font-size: 11.5px; color: var(--text-3); }
.menuItem {
  display: flex;
  align-items: center;
  gap: 9px;
  width: 100%;
  height: 34px;
  padding: 0 10px;
  border-radius: var(--r-input);
  color: var(--text-2);
  font-size: 13px;
  font-weight: 500;
  text-align: left;
}
.menuItem .ico { width: 16px; height: 16px; }
.menuItem:hover { background: var(--fill-2); color: var(--text-1); }

/* ---------- page ---------- */
.view { animation: viewIn var(--base-t) var(--ease); }
@keyframes viewIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.pageHead { margin-bottom: 22px; }
.h1 { font-size: 22px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.25; }
.sub { margin-top: 4px; max-width: 72ch; font-size: 13.5px; color: var(--text-3); text-wrap: pretty; }

.alert {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 18px;
  padding: 8px 8px 8px 14px;
  border-radius: var(--r-input);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  font-size: 13px;
}
.retry {
  flex-shrink: 0;
  height: 30px;
  padding: 0 13px;
  border-radius: var(--r-pill);
  background: var(--fill-3);
  border: 1px solid var(--border-2);
  color: var(--text-1);
  font-size: 12.5px;
  font-weight: 550;
  transition: background var(--fast) var(--ease);
}
.retry:hover { background: var(--fill-4); }

.kpis {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 14px;
  margin-bottom: 18px;
}
.kpi {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  padding: 16px 18px;
  background: var(--glass);
  border: 1px solid var(--border-1);
  border-radius: var(--r-card);
}
.kpiLabel { font-size: 12.5px; color: var(--text-3); }
.kpiValue {
  min-height: 33px;
  font-size: 30px;
  font-weight: 500;
  line-height: 1.1;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.kpiSub { min-height: 18px; font-size: 12px; color: var(--text-4); }
.kpiSub b { font-family: var(--font-mono); font-weight: 500; color: var(--text-2); font-variant-numeric: tabular-nums; }

.overviewGrid {
  display: grid;
  grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr);
  gap: 18px;
}
.panel.fill { display: flex; flex-direction: column; }
.panel.fill .panelBody { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.panel.wide { grid-column: 1 / -1; }

.panel {
  min-width: 0;
  background: var(--glass);
  border: 1px solid var(--border-1);
  border-radius: var(--r-glass);
  overflow: hidden;
}
.panelHead {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--border-1);
}
.panelTitle { font-size: 13.5px; font-weight: 600; letter-spacing: -0.01em; }
.panelSub { font-size: 12px; color: var(--text-4); }
.panelBody { padding: 16px 18px; }

/* ---------- charts ---------- */
.chartbox { position: relative; width: 100%; }
.chartbox.tall { flex: 1; min-height: 256px; }
.chartbox.short { height: 148px; }
.chartbox canvas { position: absolute; inset: 0; } /* out of flow, so a resize can never prop the panel open */
.chartEmpty {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 13px;
  color: var(--text-4);
}

.legend { display: flex; flex-wrap: wrap; gap: 4px; margin: -4px 0 12px -8px; }
.legend button {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 26px;
  padding: 0 8px;
  border-radius: var(--r-pill);
  font-size: 12px;
  color: var(--text-2);
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease);
}
.legend button:hover { background: var(--fill-2); color: var(--text-1); }
.legend button i { width: 9px; height: 9px; border-radius: 3px; background: var(--c); }
.legend button[aria-pressed="false"] { color: var(--text-4); text-decoration: line-through; }
.legend button[aria-pressed="false"] i { opacity: 0.35; }

.bars { list-style: none; display: flex; flex-direction: column; gap: 14px; }
.bars li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 4px 10px; align-items: baseline; }
.barName {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.barVal { font-size: 13px; color: var(--text-1); }
.barPct { width: 46px; font-size: 12px; color: var(--text-4); text-align: right; }
.barTrack { grid-column: 1 / -1; height: 6px; border-radius: 999px; background: var(--fill-3); overflow: hidden; }
.barTrack span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--text-4);
  transition: width var(--base-t) var(--ease);
}
.bars li:first-child .barTrack span { background: var(--accent-text); } /* lime marks the leading module only */

/* ---------- queue spots ---------- */
.kpi.hero .kpiValue { color: var(--accent-text); }
.kpiSub b.plain { font-family: inherit; font-weight: 550; }
.insight { margin-bottom: 14px; font-size: 13.5px; line-height: 1.55; color: var(--text-2); text-wrap: pretty; }
.insight b { color: var(--text-1); font-weight: 600; }
.insight .muted { color: var(--text-4); }

/* One grid for the head and every row, so columns line up. */
.factorHead, .factors li {
  display: grid;
  grid-template-columns: minmax(120px, 1.1fr) minmax(140px, 2fr) 52px 72px 64px 56px;
  gap: 14px;
  align-items: center;
}
.factorHead { padding: 0 0 8px; border-bottom: 1px solid var(--border-1); font-size: 11.5px; color: var(--text-4); }
.factorHead .num, .factors .num, .spread .num, .spreadKey .num { text-align: right; }
.fhScale { display: flex; justify-content: space-between; }
.factors { list-style: none; }
.factors li { padding: 10px 0; border-bottom: 1px solid var(--border-1); font-size: 13px; }
.factors li:last-child { border-bottom: 0; }
.factors li.thin { opacity: 0.5; }
.factors li.factorEmpty { display: block; padding: 14px 0 2px; font-size: 12.5px; color: var(--text-4); }
.fName { display: flex; flex-direction: column; min-width: 0; }
.fName > span { font-weight: 550; color: var(--text-1); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.fName small, .sName small { font-size: 11.5px; color: var(--text-4); font-variant-numeric: tabular-nums; }
.fBar { position: relative; height: 10px; border-radius: 999px; background: var(--fill-2); }
.fMid { position: absolute; left: 50%; top: -3px; bottom: -3px; width: 1px; background: var(--border-3, var(--text-4)); opacity: 0.6; }
.fFill { position: absolute; top: 0; bottom: 0; border-radius: 999px; }
.fFill.up { background: var(--accent-text); }
.fFill.down { background: var(--text-4); }
.fScore { font-size: 14px; color: var(--text-1); }

.cols { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 10px; height: 214px; padding-top: 4px; }
.col { display: grid; grid-template-rows: auto 1fr auto auto; gap: 5px; min-width: 0; text-align: center; }
.col.thin { opacity: 0.5; }
.colVal { font-size: 12.5px; color: var(--text-1); }
.colTrack { position: relative; border-radius: 8px 8px 3px 3px; background: var(--fill-2); overflow: hidden; }
.colFill { position: absolute; left: 0; right: 0; bottom: 0; border-radius: inherit; background: var(--text-4); transition: height var(--base-t) var(--ease); }
.colFill.lead { background: var(--accent-text); }
.colLabel { font-size: 11.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.colSub { font-size: 11px; color: var(--text-4); }
.colAvg { position: absolute; left: 0; right: 0; height: 0; border-top: 1px dashed var(--text-3); pointer-events: none; }
.colsKey { display: flex; align-items: center; gap: 6px; margin: -4px 0 10px; font-size: 11.5px; color: var(--text-4); }
.colsKey i { width: 14px; border-top: 1px dashed var(--text-3); }

.spread { list-style: none; }
.spread li, .spreadKey {
  display: grid;
  grid-template-columns: minmax(130px, 1fr) minmax(160px, 2.4fr) 64px 64px 56px;
  gap: 14px;
  align-items: center;
}
.spread li.thin { opacity: 0.5; }
.spread li { padding: 9px 0; border-bottom: 1px solid var(--border-1); font-size: 13px; }
.sName { display: flex; flex-direction: column; min-width: 0; }
.sName > span { font-weight: 550; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sTrack { position: relative; height: 14px; }
.sTrack::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--border-1); }
.sWhisk { position: absolute; top: 4px; bottom: 4px; border-radius: 999px; background: color-mix(in srgb, var(--series-2) 32%, transparent); }
.sBox { position: absolute; top: 2px; bottom: 2px; border-radius: 4px; background: var(--series-2); }
.sMed { position: absolute; top: -1px; bottom: -1px; width: 2px; margin-left: -1px; border-radius: 1px; background: var(--text-1); }
.sBest { position: absolute; top: 50%; width: 9px; height: 9px; margin: -4.5px 0 0 -4.5px; border-radius: 50%; background: var(--accent-text); box-shadow: 0 0 0 2px var(--surface, #000); }
.sBestN { color: var(--accent-text); }
.spreadKey { padding-top: 8px; font-size: 11.5px; color: var(--text-4); }
.spreadMore { margin-top: 10px; font-size: 12px; color: var(--text-4); }

.miniStats { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 12px; margin-bottom: 18px; }
.miniStats > div { min-width: 0; padding: 10px 12px; border-radius: var(--r-input); background: var(--fill-1, var(--fill-2)); }
.miniStats dt { font-size: 11.5px; color: var(--text-4); }
.miniStats dd { margin: 0; }
.miniStats dd.mono { margin-top: 2px; font-size: 18px; color: var(--text-1); }
.miniStats .miniSub { font-size: 11.5px; color: var(--text-4); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.miniStats .miniSub b { font-family: var(--font-mono); font-weight: 500; color: var(--text-2); }
.skel.block { display: block; height: 180px; --w: 100%; }

@media (max-width: 900px) {
  .factorHead { display: none; }
  .factors li { grid-template-columns: minmax(0, 1fr) 44px 60px; gap: 6px 12px; }
  .factors li .fBar { grid-column: 1 / -1; grid-row: 2; }
  .factors li .num:nth-of-type(n+5) { display: none; }
  .factors li { grid-template-columns: minmax(0, 1fr) 40px 58px; }
  .factors .fName { grid-row: 1; }
  .spread li, .spreadKey { grid-template-columns: minmax(0, 1fr) 58px 58px; gap: 6px 12px; }
  .spread li .sTrack { grid-column: 1 / -1; grid-row: 2; }
  .spread li .num:last-child, .spreadKey .num:last-child, .spreadKey span:nth-child(2) { display: none; }
  .miniStats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
}
@media (max-width: 520px) {
  .miniStats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .cols { gap: 6px; }
  .colLabel { font-size: 10.5px; white-space: normal; }
}

/* ---------- tables ---------- */
.tableWrap { overflow: auto; max-height: calc(100dvh - 216px); overscroll-behavior: contain; }
table { width: 100%; border-collapse: separate; border-spacing: 0; font-size: 13px; }
th {
  position: sticky;
  top: 0;
  z-index: 2;
  height: 42px;
  padding: 0 12px;
  text-align: left;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-3);
  white-space: nowrap;
  background: var(--surface);
  border-bottom: 1px solid var(--border-2);
}
th button {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 26px;
  border-radius: 6px;
  font-weight: inherit;
  color: inherit;
  transition: color var(--fast) var(--ease);
}
th button:hover { color: var(--text-1); }
th.num button { flex-direction: row-reverse; } /* the sort mark sits outside the label, so labels align with their numbers */
th .sortMark { width: 8px; font-family: var(--font-mono); font-size: 11px; color: var(--accent-text); }
td {
  height: 44px;
  padding: 8px 12px;
  color: var(--text-2);
  white-space: nowrap;
  border-bottom: 1px solid var(--border-1);
  transition: background var(--fast) var(--ease);
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover td { background: var(--fill-1); }
th.num, td.num { text-align: right; }
td.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; letter-spacing: -0.01em; color: var(--text-1); }
td.lead { font-weight: 550; color: var(--text-1); }
td.dim { color: var(--text-4); }
td.mail { font-family: var(--font-mono); font-size: 12px; font-weight: 500; color: var(--text-1); }
td.mono { font-family: var(--font-mono); font-size: 12px; letter-spacing: -0.01em; }
td.wire { height: 36px; padding-top: 4px; padding-bottom: 4px; }
td.strong { color: var(--text-1); }

.rate { display: inline-flex; align-items: center; justify-content: flex-end; gap: 10px; width: 100%; }
.rateTrack { width: 56px; height: 4px; border-radius: 999px; background: var(--fill-3); overflow: hidden; }
.rateTrack span { display: block; height: 100%; border-radius: 999px; background: var(--text-3); }

td.best { color: var(--accent-text); }
td.best::before {
  content: "Best";
  margin-right: 8px;
  font-family: var(--font-sans);
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0;
}

.tag {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 9px;
  border-radius: var(--r-pill);
  font-size: 11.5px;
  font-weight: 550;
  color: var(--text-3);
  background: var(--fill-3);
}
.tag.ok { color: var(--success); background: var(--success-soft); }
.tag.warn { color: var(--warning); background: var(--warning-soft); }
.tag.bad { color: var(--danger); background: var(--danger-soft); }

.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 56px 24px;
  text-align: center;
  white-space: normal;
}
.stateTitle { font-size: 14px; font-weight: 600; color: var(--text-1); }
.stateBody { max-width: 340px; font-size: 12.5px; color: var(--text-3); }
td.stateCell { height: auto; padding: 0; }
tbody tr:hover td.stateCell { background: none; }

.skel {
  display: block;
  height: 12px;
  width: var(--w, 70%);
  border-radius: 6px;
  background: var(--fill-3);
  animation: pulse 1.6s var(--ease) infinite;
}
.kpiValue .skel { height: 26px; margin-top: 4px; }
td.num .skel { margin-left: auto; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.45; }
}

.filterbar { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.filterbar .selectWrap select { height: var(--btn-h); max-width: none; min-width: 190px; }
.filterbar .input { flex: 0 1 300px; width: auto; min-width: 0; height: var(--btn-h); border-radius: var(--r-pill); }

/* ---------- sign in ---------- */
.gate {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px 16px;
  overflow: auto;
  background:
    radial-gradient(55% 45% at 12% -5%, var(--glow-a), transparent 60%),
    radial-gradient(48% 42% at 106% 12%, var(--glow-b), transparent 55%),
    var(--base);
}
.gateCard {
  width: 100%;
  max-width: 400px;
  padding: 32px 30px;
  border-radius: var(--r-modal);
  background: var(--glass);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-pop);
  animation: viewIn var(--base-t) var(--ease);
}
.gateCard:focus { outline: none; }
.gateBrand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.gateWordmark { font-size: 18px; font-weight: 650; letter-spacing: -0.02em; }
.gateTitle { font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
.gateSub { margin-top: 6px; font-size: 13px; color: var(--text-3); text-wrap: pretty; }
.gateFields { display: flex; flex-direction: column; gap: 12px; margin-top: 22px; }
.gateKey { margin-top: 0; }
.discordBtn { gap: 10px; text-decoration: none; }
.discordIco { flex-shrink: 0; }
.gateDivider {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--text-4);
  font-size: 11.5px;
}
.gateDivider::before, .gateDivider::after { content: ""; flex: 1; height: 1px; background: var(--border-1); }
#inviteLink { text-align: center; text-decoration: none; }
.avatar img { width: 100%; height: 100%; border-radius: inherit; object-fit: cover; display: block; }
.label { margin-bottom: -6px; font-size: 12px; font-weight: 600; color: var(--text-3); }
.gateErr {
  padding: 9px 12px;
  border-radius: var(--r-input);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  font-size: 12.5px;
}

/* ---------- responsive ---------- */
@media (max-width: 1180px) {
  .overviewGrid { grid-template-columns: minmax(0, 1fr); }
}
/* Rail mode: same breakpoint as Cartly Monitors. Labels move to title tooltips. */
@media (max-width: 1080px) {
  .sidebar { width: var(--rail-w); gap: 4px; padding: 14px 8px; }
  .brand { justify-content: center; padding: 6px 0 12px; }
  .wordmark, .meter { display: none; }
  .item { justify-content: center; gap: 0; padding: 0; }
  .item span {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
  }
  .header { padding: 9px 16px; gap: 12px; }
  .content { padding: 20px 20px 48px; }
  .kpis { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 720px) {
  .header { position: static; flex-wrap: wrap; }
  .updated, .accountName { display: none; }
  .right { flex: 1 1 100%; }
  .right .selectWrap { flex: 1; }
  .right .selectWrap select { max-width: none; }
  .right .iconBtn:first-of-type { order: 2; }
  .tableWrap { max-height: calc(100dvh - 180px); }
}
@media (max-width: 640px) {
  .sidebar { width: 48px; padding: 12px 5px; }
  .content { padding: 16px 12px 40px; }
  .kpis { gap: 10px; }
  .kpi { padding: 13px 14px; }
  .kpiValue { font-size: 24px; min-height: 27px; }
  .panelBody { padding: 14px; }
  .panelHead { padding: 12px 14px; }
  .filterbar .selectWrap, .filterbar .input, .filterbar .pill { flex: 1 1 100%; width: 100%; }
  .filterbar .selectWrap select { width: 100%; }
}

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

/* ---------- overview verdicts ---------- */
.verdictCols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.verdictHead { margin: 0 0 10px; font-size: 12px; }
.verdictList {
  list-style: none;
  margin: 0; padding: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.verdictList li {
  display: flex; align-items: baseline; gap: 8px; flex-wrap: wrap;
  padding: 8px 12px;
  border: 1px solid var(--border-1);
  border-radius: var(--r-card);
  background: var(--fill-1);
  font-size: 12.5px;
}
.verdictName { color: var(--text-3); font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em; }
.verdictMeta { color: var(--text-3); }
.verdictEmpty { color: var(--text-4); justify-content: center; }
@media (max-width: 720px) { .verdictCols { grid-template-columns: 1fr; } }

/* ---------- ask AI ----------
 * A centred chat column, like Claude or ChatGPT. Assistant turns have no bubble so the steps and
 * charts read as one flow; only the operator's own messages sit in a bubble.
 */
body[data-view="ask"] .main { height: 100dvh; overflow: hidden; }
body[data-view="ask"] .content { display: flex; flex-direction: column; min-height: 0; max-width: none; padding: 0; }
.askView { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.askCol { width: 100%; max-width: 780px; margin: 0 auto; padding: 0 24px; }
.askThread { flex: 1; min-height: 0; overflow-y: auto; overscroll-behavior: contain; padding: 28px 0 12px; }

.askEmpty {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding-top: clamp(24px, 13vh, 120px);
  text-align: center;
}
.askHello { margin-top: 18px; font-size: 26px; font-weight: 600; letter-spacing: -0.02em; line-height: 1.2; }
.askEmpty .sub { max-width: 46ch; }
.suggestions {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
  width: 100%;
  margin-top: 28px;
}
.suggest {
  padding: 12px 14px;
  border-radius: var(--r-card);
  border: 1px solid var(--border-1);
  background: var(--glass);
  color: var(--text-2);
  font-size: 13px;
  line-height: 1.4;
  text-align: left;
  transition: background var(--fast) var(--ease), color var(--fast) var(--ease), border-color var(--fast) var(--ease);
}
.suggest:hover { background: var(--fill-3); border-color: var(--border-2); color: var(--text-1); }
.suggest:active { transform: scale(0.99); }

.askLog { display: flex; flex-direction: column; gap: 22px; }
.msg { animation: viewIn var(--base-t) var(--ease); }
.msg.user {
  align-self: flex-end;
  max-width: min(78%, 560px);
  padding: 10px 14px;
  border-radius: 18px;
  background: var(--fill-3);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  font-size: 14px;
}
.msg.ai { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.msgHead { display: flex; align-items: center; gap: 9px; min-height: 22px; }
.orbSmall { flex-shrink: 0; }

/* The inline status: a soft light passes over the label while work is happening. */
.aiStatus { display: inline-flex; align-items: baseline; gap: 7px; font-size: 13px; font-weight: 500; color: var(--text-3); }
.aiStatus.active .aiLabel {
  background: linear-gradient(100deg, var(--text-3) 30%, var(--text-1) 50%, var(--text-3) 70%);
  background-size: 220% 100%;
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
  animation: shimmer 1.9s var(--ease) infinite;
}
@keyframes shimmer {
  from { background-position: 110% 0; }
  to { background-position: -110% 0; }
}
.aiTimer { font-size: 11.5px; color: var(--text-4); }

.flow { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.msgFoot { font-size: 11.5px; color: var(--text-4); }
.msgErr {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 8px 8px 12px;
  border-radius: var(--r-input);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  font-size: 13px;
}

.answer { font-size: 14px; line-height: 1.6; color: var(--text-1); overflow-wrap: anywhere; }
.answer > * + * { margin-top: 10px; }
.answer h4 { font-size: 14px; font-weight: 600; }
.answer ul, .answer ol { padding-left: 20px; }
.answer li + li { margin-top: 4px; }
.answer strong { font-weight: 600; }
.answer code { padding: 1px 5px; border-radius: 5px; background: var(--fill-3); font-family: var(--font-mono); font-size: 12.5px; }
.answer.live > p:last-child::after,
.answer.live > :is(ul, ol):last-child > li:last-child::after {
  content: "";
  display: inline-block;
  width: 7px;
  height: 14px;
  margin-left: 2px;
  vertical-align: -2px;
  border-radius: 2px;
  background: var(--accent-text);
  animation: pulse 1s var(--ease) infinite;
}
.mdTable { overflow-x: auto; border: 1px solid var(--border-1); border-radius: var(--r-input); }
.mdTable th { position: static; height: 34px; background: var(--fill-2); }
.mdTable td { height: 34px; padding: 6px 12px; }

.thought > summary, .toolStep > summary { list-style: none; cursor: pointer; }
.thought > summary::-webkit-details-marker, .toolStep > summary::-webkit-details-marker, .rawData > summary::-webkit-details-marker { display: none; }
.thought > summary { font-size: 12.5px; color: var(--text-4); transition: color var(--fast) var(--ease); }
.thought > summary:hover { color: var(--text-2); }
.thought p {
  margin-top: 6px;
  padding-left: 12px;
  border-left: 2px solid var(--border-2);
  font-size: 12.5px;
  color: var(--text-3);
  white-space: pre-wrap;
}

.toolStep { border: 1px solid var(--border-1); border-radius: var(--r-card); background: var(--glass); min-width: 0; }
.toolStep > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  min-height: 40px;
  padding: 6px 12px;
  border-radius: var(--r-card);
  font-size: 13px;
  color: var(--text-2);
  transition: background var(--fast) var(--ease);
}
.toolStep > summary:hover { background: var(--fill-1); }
.stepTitle { flex: 1; min-width: 0; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.stepMeta { display: inline-flex; align-items: center; gap: 10px; flex-shrink: 0; font-size: 11.5px; color: var(--text-4); }
.stepChevron { width: 14px; height: 14px; color: var(--text-4); transition: transform var(--fast) var(--ease); }
.toolStep[open] .stepChevron { transform: rotate(180deg); }
.stepIcon { position: relative; width: 14px; height: 14px; flex-shrink: 0; border-radius: 50%; }
.running .stepIcon { border: 2px solid var(--border-3); border-top-color: var(--accent-text); animation: spin 0.8s linear infinite; }
.finished .stepIcon { background: var(--accent-soft); }
.finished .stepIcon::after {
  content: "";
  position: absolute;
  left: 4.7px;
  top: 2.4px;
  width: 4px;
  height: 7px;
  border: solid var(--accent-text);
  border-width: 0 1.6px 1.6px 0;
  transform: rotate(40deg);
}
.failed .stepIcon { background: var(--danger-soft); }
.failed .stepIcon::after { content: ""; position: absolute; inset: 6px 3px; border-radius: 2px; background: var(--danger); }
@keyframes spin { to { transform: rotate(360deg); } }
.spark { display: inline-flex; align-items: flex-end; gap: 1.5px; height: 16px; }
.spark i { width: 3px; min-height: 2px; border-radius: 1px; background: var(--text-4); }
.toolStep[open] .spark { display: none; }

.stepBody { padding: 4px 12px 12px; animation: viewIn var(--base-t) var(--ease); }
.vizHead { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 12px; }
.vizNote { font-size: 11.5px; color: var(--text-4); }
.vizNote.solo { display: block; margin-bottom: 10px; }
.vizEmpty { padding: 8px 0; font-size: 12.5px; color: var(--text-4); }
.vizBars { list-style: none; display: flex; flex-direction: column; gap: 10px; }
.vizBars li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 3px 10px; align-items: baseline; }
.vizName { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 12.5px; font-weight: 500; color: var(--text-2); }
.vizVal { font-size: 12.5px; color: var(--text-1); }
.vizVal i { margin-right: 7px; font-family: var(--font-sans); font-size: 10.5px; font-style: normal; font-weight: 600; color: var(--accent-text); }
.vizSub { font-size: 11px; color: var(--text-4); text-align: right; }
.vizBars li:not(:has(.vizSub)) .vizVal { grid-column: 2 / -1; }
.vizTrack { grid-column: 1 / -1; height: 5px; border-radius: 999px; background: var(--fill-3); overflow: hidden; }
.vizTrack span {
  display: block;
  height: 100%;
  border-radius: 999px;
  background: var(--text-4);
  transform-origin: left;
  animation: growBar var(--base-t) var(--ease);
}
.vizBars li.on .vizTrack span { background: var(--accent-text); }
@keyframes growBar { from { transform: scaleX(0); } }
.vizFacts { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 8px; margin-top: 12px; }
.vizFacts div { padding: 8px 10px; border-radius: var(--r-input); background: var(--fill-2); }
.vizFacts dt { font-size: 11px; color: var(--text-4); }
.vizFacts dd { font-size: 14px; color: var(--text-1); }
.vizChart + .vizChart { margin-top: 12px; }
.vizChart figcaption { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 5px; font-size: 11.5px; color: var(--text-3); }
.vizChart svg { display: block; width: 100%; height: 72px; }
.vizChart + .vizChart svg { height: 48px; }
.vizChart rect { fill: var(--text-4); transition: fill var(--fast) var(--ease); }
.vizChart rect:hover { fill: var(--accent-text); }
.vizChart + .vizNote { margin: 8px 0 0; }
.vizTable { max-height: 208px; overflow: auto; overscroll-behavior: contain; }
.vizTable th { height: 32px; padding: 0 10px 0 0; font-size: 11.5px; }
.vizTable td { height: 34px; padding: 4px 10px 4px 0; font-size: 12.5px; }

.rawData { margin-top: 12px; }
.rawData > summary {
  display: inline-flex;
  gap: 7px;
  list-style: none;
  cursor: pointer;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  color: var(--text-3);
  transition: color var(--fast) var(--ease);
}
.rawData > summary:hover { color: var(--text-1); }
.rawData > summary .mono { color: var(--text-4); font-size: 11px; }
.callLine { display: block; margin-top: 8px; font-family: var(--font-mono); font-size: 11.5px; color: var(--accent-text); overflow-wrap: anywhere; }
.rawData pre {
  max-height: 260px;
  margin-top: 6px;
  padding: 10px 12px;
  overflow: auto;
  border-radius: var(--r-input);
  background: var(--fill-2);
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-2);
}

.askDock { flex-shrink: 0; padding: 6px 0 calc(16px + env(safe-area-inset-bottom)); }
.askNeedKey {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
  padding: 10px 10px 10px 14px;
  border-radius: var(--r-glass);
  background: var(--danger-soft);
  border: 1px solid color-mix(in srgb, var(--danger) 30%, transparent);
  color: var(--danger);
  font-size: 13px;
}
.askNeedKey[hidden] { display: none; }
.pill.small { height: 30px; padding: 0 13px; font-size: 12.5px; text-decoration: none; }
.pill:not(.primary) { background: var(--fill-2); border: 1px solid var(--border-2); color: var(--text-2); }
.pill:not(.primary):hover { background: var(--fill-3); color: var(--text-1); }
.settingsPanel { max-width: 720px; }
.settingsForm .label { display: block; margin-bottom: 6px; }
.askKeyRow { display: flex; align-items: center; gap: 8px; }
.askKeyRow .input { flex: 1; min-width: 0; }
.keyStatus { margin-top: 8px; font-size: 12.5px; color: var(--text-3); }
.keyStatus:empty { display: none; }
.settingsForm .gateErr { margin-top: 8px; }
.aiNote { margin-top: 8px; font-size: 11.5px; color: var(--text-4); text-wrap: pretty; }
.composer {
  padding: 10px 10px 8px 14px;
  border-radius: 20px;
  background: var(--surface);
  border: 1px solid var(--border-2);
  box-shadow: var(--shadow-pop);
  transition: border-color var(--fast) var(--ease);
}
.composer:focus-within { border-color: var(--border-3); }
.composer textarea {
  display: block;
  width: 100%;
  min-height: 24px;
  max-height: 180px;
  border: 0;
  outline: 0;
  resize: none;
  background: transparent;
  color: var(--text-1);
  font: inherit;
  font-size: 14.5px;
  line-height: 1.5;
}
.composer textarea::placeholder { color: var(--text-4); }
.composerRow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 6px; }
.composerMeta { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 12px; min-width: 0; }
.metaChip, .metaBtn { font-size: 12px; color: var(--text-4); white-space: nowrap; }
.metaBtn { padding: 2px 0; border-radius: 6px; font-weight: 500; color: var(--text-3); transition: color var(--fast) var(--ease); }
.metaBtn:hover { color: var(--text-1); }
.metaBtn.needed { color: var(--accent-text); }
.sendBtn {
  flex-shrink: 0;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: var(--r-pill);
  background: var(--accent);
  color: var(--accent-ink);
  transition: filter var(--fast) var(--ease), transform var(--fast) var(--ease);
}
.sendBtn .ico { width: 17px; height: 17px; stroke-width: 2.2; }
.sendBtn:hover:not(:disabled) { filter: brightness(1.06); }
.sendBtn:active:not(:disabled) { transform: scale(0.96); }
.sendBtn:disabled { background: var(--fill-3); color: var(--text-4); cursor: default; }
.sendBtn.stop { background: var(--fill-4); color: var(--text-1); }

@media (max-width: 720px) {
  .askCol { padding: 0 12px; }
  .askThread { padding-top: 16px; }
  .msg.user { max-width: 88%; }
}
@media (max-width: 560px) {
  .suggestions { grid-template-columns: minmax(0, 1fr); }
  .askEmpty { padding-top: 12px; }
  .stepMeta .spark { display: none; }
  .vizFacts { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .aiStatus.active .aiLabel { animation: none; background: none; color: var(--text-2); }
}

/* Account ran on more than one module — the cross-module cohort. */
.crossMod { color: var(--warning, #facc15); font-size: 11px; }
