/* ============================================================
   Research Intelligence — Design System
   Modern product UI · generous whitespace · one accent
   ============================================================ */

:root {
  /* Neutrals — warm-leaning off-white canvas */
  --canvas:       oklch(98.5% 0.004 85);
  --surface:      oklch(100% 0 0);
  --surface-sunk: oklch(96.5% 0.005 85);
  --ink:          oklch(20% 0.012 80);
  --ink-2:        oklch(38% 0.012 80);
  --ink-3:        oklch(55% 0.01 80);
  --ink-4:        oklch(72% 0.008 80);
  --hair:         oklch(92% 0.005 80);
  --hair-2:       oklch(87% 0.006 80);

  /* Accent — single color, tweakable */
  --accent-h:     250;
  --accent:       oklch(48% 0.14 var(--accent-h));
  --accent-ink:   oklch(30% 0.12 var(--accent-h));
  --accent-soft:  oklch(95% 0.03 var(--accent-h));
  --accent-soft-2:oklch(90% 0.05 var(--accent-h));

  /* Semantic, muted */
  --pos:          oklch(55% 0.11 155);
  --pos-soft:     oklch(94% 0.04 155);
  --warn:         oklch(62% 0.13 70);
  --warn-soft:    oklch(95% 0.05 70);
  --neg:          oklch(54% 0.16 28);
  --neg-soft:     oklch(95% 0.04 28);

  /* Density — tweakable via data-density on html */
  --space-1:      4px;
  --space-2:      8px;
  --space-3:      12px;
  --space-4:      16px;
  --space-5:      24px;
  --space-6:      32px;
  --space-7:      48px;
  --space-8:      64px;

  --fs-xxs: 11px;
  --fs-xs:  12px;
  --fs-sm:  13px;
  --fs-md:  14px;
  --fs-lg:  16px;
  --fs-xl:  20px;
  --fs-2xl: 28px;
  --fs-3xl: 40px;
  --fs-4xl: 56px;

  --lh-tight: 1.15;
  --lh-snug:  1.3;
  --lh-body:  1.5;

  --radius-sm: 4px;
  --radius:    8px;
  --radius-lg: 14px;

  --row-pad: 14px 18px;
  --card-pad: 22px 24px;

  --sans: "Instrument Sans", -apple-system, "Helvetica Neue", Arial, sans-serif;
  --serif: "Instrument Serif", Georgia, "Times New Roman", serif;
  --mono: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, monospace;
}

[data-density="compact"] {
  --space-5: 16px; --space-6: 20px; --space-7: 32px; --space-8: 44px;
  --fs-md: 13px; --fs-lg: 14.5px; --fs-xl: 18px; --fs-2xl: 24px; --fs-3xl: 32px;
  --row-pad: 10px 14px;
  --card-pad: 16px 18px;
}
[data-density="airy"] {
  --space-5: 32px; --space-6: 44px; --space-7: 64px; --space-8: 88px;
  --fs-md: 15px; --fs-lg: 17px; --fs-xl: 22px; --fs-2xl: 32px; --fs-3xl: 48px;
  --row-pad: 20px 24px;
  --card-pad: 28px 32px;
}

[data-theme="warm"] {
  --accent-h: 35;
  --canvas: oklch(98% 0.01 60);
  --surface-sunk: oklch(96% 0.012 60);
}
[data-theme="neutral"] {
  --accent-h: 265;
  --accent: oklch(38% 0.04 265);
  --accent-ink: oklch(25% 0.03 265);
}

* { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
body {
  background: var(--canvas);
  color: var(--ink);
  font-family: var(--sans);
  font-size: var(--fs-md);
  line-height: var(--lh-body);
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "ss01", "cv11";
}

button { font: inherit; color: inherit; background: none; border: 0; cursor: pointer; padding: 0; }
input, textarea, select { font: inherit; color: inherit; }
a { color: inherit; text-decoration: none; }

/* ---------- Typography ---------- */
.h-display { font-family: var(--serif); font-weight: 400; font-size: var(--fs-4xl); line-height: var(--lh-tight); letter-spacing: -0.02em; }
.h-display em { font-style: italic; font-family: var(--serif); }
.h-1 { font-family: var(--serif); font-weight: 400; font-size: var(--fs-3xl); line-height: var(--lh-tight); letter-spacing: -0.015em; }
.h-2 { font-size: var(--fs-2xl); font-weight: 600; line-height: var(--lh-snug); letter-spacing: -0.012em; }
.h-3 { font-size: var(--fs-xl); font-weight: 600; line-height: var(--lh-snug); letter-spacing: -0.008em; }
.h-4 { font-size: var(--fs-lg); font-weight: 600; line-height: var(--lh-snug); }
.eyebrow { font-size: var(--fs-xxs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.11em; color: var(--ink-3); }
.muted { color: var(--ink-3); }
.ink-2 { color: var(--ink-2); }
.mono { font-family: var(--mono); font-size: 0.92em; }
.serif { font-family: var(--serif); }
.italic { font-style: italic; }

/* ---------- Layout primitives ---------- */
.shell { min-height: 100vh; display: flex; flex-direction: column; }
.container { max-width: 1360px; margin: 0 auto; padding: 0 40px; width: 100%; }

.hair      { border-top: 1px solid var(--hair); }
.hair-b    { border-bottom: 1px solid var(--hair); }
.card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
}
.card-flat { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius); }
.sunk { background: var(--surface-sunk); }

.row { display: flex; align-items: center; gap: var(--space-3); }
.col { display: flex; flex-direction: column; gap: var(--space-3); }
.grow { flex: 1 1 auto; min-width: 0; }
.between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); }
.wrap { flex-wrap: wrap; }

/* ---------- Header & nav ---------- */
.header {
  background: var(--surface);
  border-bottom: 1px solid var(--hair);
  position: sticky; top: 0; z-index: 40;
}
.header-top { padding: 18px 40px 14px; display: flex; align-items: center; justify-content: space-between; max-width: 1360px; margin: 0 auto; width: 100%;}
.brand { display: flex; align-items: baseline; gap: 10px; flex-shrink: 0; white-space: nowrap; }
.brand .mark {
  font-family: var(--serif); font-size: 22px; font-weight: 400;
  letter-spacing: -0.01em; color: var(--ink); white-space: nowrap;
}
.brand .mark em { color: var(--accent); font-style: italic; }
.brand .sub { font-family: var(--mono); font-size: var(--fs-xxs); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.1em; }

.header-meta { display: flex; gap: 22px; align-items: center; color: var(--ink-3); font-size: var(--fs-sm); }
.header-meta b { color: var(--ink); font-weight: 600; }
.header-meta .pulse { width: 7px; height: 7px; border-radius: 50%; background: var(--pos); display: inline-block; margin-right: 6px; vertical-align: middle; box-shadow: 0 0 0 3px var(--pos-soft); }

.nav { max-width: 1360px; margin: 0 auto; padding: 0 40px; width: 100%; display: flex; gap: 2px; align-items: stretch; flex-wrap: nowrap; }
.nav-btn {
  padding: 12px 14px 14px; font-size: var(--fs-sm); font-weight: 500;
  color: var(--ink-3); border-bottom: 2px solid transparent;
  white-space: nowrap; flex-shrink: 0;
  display: inline-flex; align-items: center; gap: 8px;
  position: relative;
}
.nav-btn:hover { color: var(--ink); }
.nav-btn.active { color: var(--ink); border-bottom-color: var(--accent); font-weight: 600; }
.nav-btn .badge { background: var(--accent-soft); color: var(--accent-ink); font-size: 10px; font-weight: 600; padding: 1px 6px; border-radius: 10px; min-width: 18px; text-align: center; }

/* ---------- Chips / badges / tags ---------- */
.chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 9px;
  background: var(--surface-sunk);
  color: var(--ink-2);
  border-radius: 999px;
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid transparent;
}
.chip.mono-chip { font-family: var(--mono); font-size: 11px; padding: 2px 7px; }
.chip.accent { background: var(--accent-soft); color: var(--accent-ink); }
.chip.pos { background: var(--pos-soft); color: oklch(32% 0.09 155); }
.chip.warn { background: var(--warn-soft); color: oklch(38% 0.1 55); }
.chip.neg { background: var(--neg-soft); color: oklch(38% 0.14 28); }
.chip.ghost { background: transparent; border-color: var(--hair-2); color: var(--ink-2); }

.dot { width: 6px; height: 6px; border-radius: 50%; background: currentColor; display: inline-block; }

.tag-list { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 14px;
  border-radius: var(--radius);
  font-size: var(--fs-sm); font-weight: 500;
  background: var(--surface); color: var(--ink);
  border: 1px solid var(--hair-2);
  transition: all 0.12s ease;
  cursor: pointer;
}
.btn:hover { border-color: var(--ink-3); }
.btn.primary { background: var(--ink); color: var(--canvas); border-color: var(--ink); }
.btn.primary:hover { background: oklch(30% 0.02 80); border-color: oklch(30% 0.02 80); }
.btn.accent { background: var(--accent); color: white; border-color: var(--accent); }
.btn.accent:hover { background: var(--accent-ink); border-color: var(--accent-ink); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--ink-2); }
.btn.ghost:hover { background: var(--surface-sunk); color: var(--ink); }
.btn.sm { padding: 5px 10px; font-size: var(--fs-xs); gap: 6px; }

/* ---------- Inputs ---------- */
.input, .textarea, .select {
  width: 100%;
  padding: 10px 14px;
  background: var(--surface);
  border: 1px solid var(--hair-2);
  border-radius: var(--radius);
  font-size: var(--fs-sm);
  color: var(--ink);
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}
.input:focus, .textarea:focus, .select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
.textarea { resize: vertical; min-height: 100px; line-height: var(--lh-body); font-family: var(--sans); }
.search-wrap { position: relative; width: 260px; }
.search-wrap input { padding-left: 38px; }
.search-wrap svg { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--ink-3); pointer-events: none; }
.search-drop { position: absolute; top: calc(100% + 6px); left: 0; right: 0; background: var(--canvas); border: 1px solid var(--hair-2); border-radius: var(--radius-lg); box-shadow: 0 8px 24px -8px rgba(0,0,0,0.14); z-index: 200; overflow: hidden; }
.search-drop-mode { padding: 6px 12px; font-size: 10px; font-family: var(--mono); color: var(--accent); background: var(--accent-soft); letter-spacing: 0.06em; text-transform: uppercase; }
.search-drop-empty { padding: 14px 12px; font-size: 13px; color: var(--ink-3); text-align: center; }
.search-drop-row { padding: 10px 14px; cursor: pointer; border-top: 1px solid var(--hair); }
.search-drop-row:first-child { border-top: none; }
.search-drop-row:hover { background: var(--surface-sunk); }
.search-drop-title { font-size: 13px; font-weight: 500; color: var(--ink); line-height: 1.35; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.search-drop-meta { font-size: 11px; color: var(--ink-3); font-family: var(--mono); margin-top: 3px; }

/* ---------- Score ring ---------- */
.score {
  width: 44px; height: 44px;
  position: relative; display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: var(--fs-md);
  font-family: var(--mono);
}
.score svg { position: absolute; inset: 0; transform: rotate(-90deg); }
.score .bg { stroke: var(--hair); }
.score .fg { stroke: var(--accent); transition: stroke-dashoffset 0.3s ease; }

/* ---------- Paper row ---------- */
.paper-row {
  padding: var(--row-pad);
  display: grid;
  grid-template-columns: 52px 1fr auto;
  gap: 18px;
  align-items: start;
  border-top: 1px solid var(--hair);
  transition: background 0.1s ease;
  cursor: pointer;
}
.paper-row:first-child { border-top: 0; }
.paper-row:hover { background: var(--surface-sunk); }
.paper-row .title { font-size: var(--fs-md); font-weight: 600; color: var(--ink); line-height: 1.35; margin-bottom: 4px; }
.paper-row .meta { font-size: var(--fs-xs); color: var(--ink-3); display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.paper-row .meta .mono { color: var(--ink-2); }

/* Must-read marker */
.mark-must {
  width: 3px; height: 100%; background: var(--accent);
  border-radius: 2px;
}

/* ---------- KPI / signal widgets ---------- */
.kpi {
  padding: 18px 20px;
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  background: var(--surface);
}
.kpi .label { font-size: var(--fs-xxs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 10px; }
.kpi .val { font-family: var(--mono); font-size: 26px; font-weight: 500; color: var(--ink); letter-spacing: -0.02em; }
.kpi .delta { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 4px; }
.kpi .delta.pos { color: oklch(42% 0.12 155); }
.kpi .delta.neg { color: oklch(50% 0.15 28); }

/* ---------- Tables ---------- */
.table { width: 100%; border-collapse: collapse; }
.table th {
  text-align: left; padding: 10px 14px;
  font-size: var(--fs-xxs); font-weight: 600;
  text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-3);
  border-bottom: 1px solid var(--hair);
  background: transparent;
  cursor: pointer;
  user-select: none;
}
.table th:hover { color: var(--ink); }
.table th .sort-ind { opacity: 0.4; margin-left: 4px; font-size: 9px; }
.table th.sorted .sort-ind { opacity: 1; color: var(--accent); }
.table td {
  padding: 12px 14px;
  font-size: var(--fs-sm);
  color: var(--ink);
  border-bottom: 1px solid var(--hair);
  vertical-align: top;
}
.table tr:last-child td { border-bottom: 0; }
.table tr.rowish:hover td { background: var(--surface-sunk); cursor: pointer; }

/* Bars (for benchmark frequency) */
.bar { height: 6px; background: var(--hair); border-radius: 3px; overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--accent); }

/* ---------- Drawer ---------- */
.drawer-scrim {
  position: fixed; inset: 0;
  background: oklch(20% 0.01 80 / 0.35);
  z-index: 60;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.drawer-scrim.open { opacity: 1; pointer-events: auto; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: 640px; max-width: 90vw;
  background: var(--surface);
  border-left: 1px solid var(--hair);
  z-index: 61;
  transform: translateX(100%);
  transition: transform 0.28s cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex; flex-direction: column;
  overflow: hidden;
}
.drawer.open { transform: translateX(0); }
.drawer-header { padding: 20px 28px 16px; border-bottom: 1px solid var(--hair); }
.drawer-body { padding: 24px 28px 80px; overflow-y: auto; }
.drawer-close { position: absolute; top: 16px; right: 16px; width: 32px; height: 32px; border-radius: var(--radius); display: inline-flex; align-items: center; justify-content: center; color: var(--ink-3); }
.drawer-close:hover { background: var(--surface-sunk); color: var(--ink); }

/* ---------- Subdomain card ---------- */
.sd-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 18px;
}

.sd-card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 24px 24px 22px;
  cursor: pointer;
  transition: border-color 0.15s ease, transform 0.15s ease;
  display: flex; flex-direction: column; gap: 16px;
  position: relative;
  overflow: hidden;
}
.sd-card:hover { border-color: var(--ink-4); transform: translateY(-1px); }
.sd-card .cat { font-size: var(--fs-xxs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); }
.sd-card .sd-title { font-family: var(--serif); font-size: 22px; line-height: 1.2; color: var(--ink); letter-spacing: -0.01em; }
.sd-card .sd-body { font-size: var(--fs-sm); color: var(--ink-2); line-height: 1.5; }
.sd-card .sd-stats { display: flex; align-items: center; gap: 28px; margin-top: auto; padding-top: 14px; border-top: 1px solid var(--hair); }
.sd-card .sd-stat .v { font-family: var(--mono); font-size: 18px; font-weight: 500; color: var(--ink); letter-spacing: -0.02em; }
.sd-card .sd-stat .l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-3); margin-top: 2px; font-weight: 600; }

/* Edit / delete icon actions on a private-topic card. Pushed to the right,
   ghost by default, themed accent (edit) / danger (delete) on hover. */
.sd-card .sd-card-actions { display: flex; gap: 6px; margin-left: auto; }
.sd-card-action {
  display: inline-flex; align-items: center; justify-content: center;
  width: 30px; height: 30px; border-radius: var(--radius-sm);
  border: 1px solid var(--hair); background: var(--canvas);
  color: var(--ink-3); cursor: pointer;
  transition: color 0.15s, border-color 0.15s, background 0.15s;
}
.sd-card-action:hover { color: var(--accent-ink); border-color: var(--accent); background: var(--accent-soft, var(--surface-sunk)); }
.sd-card-action.danger:hover { color: oklch(52% 0.20 30); border-color: oklch(72% 0.16 30); background: oklch(96% 0.03 30); }

.sd-card.spotlight { background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 60%); }
.sd-follow-btn {
  position: absolute; top: 14px; right: 14px;
  width: 28px; height: 28px;
  display: flex; align-items: center; justify-content: center;
  border: 1px solid var(--hair); border-radius: var(--radius-sm);
  background: var(--canvas); color: var(--ink-3);
  transition: border-color 0.15s, color 0.15s, background 0.15s;
  cursor: pointer; z-index: 1;
}
.sd-follow-btn:hover { border-color: var(--accent); color: var(--accent); }
.sd-follow-btn.on { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }

/* ---------- Signal list ---------- */
.signal { display: flex; gap: 12px; padding: 10px 0; border-top: 1px solid var(--hair); }
.signal:first-child { border-top: 0; }
.signal .kind { font-family: var(--mono); font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em; color: var(--ink-3); min-width: 72px; padding-top: 2px; }
.signal .body { flex: 1; font-size: var(--fs-sm); }
.signal .body b { font-weight: 600; color: var(--ink); }
.signal .trend { font-family: var(--mono); color: var(--pos); font-size: var(--fs-xs); font-weight: 600; }

/* ---------- Gap card ---------- */
.gap {
  padding: 16px 20px;
  border-top: 1px solid var(--hair);
  cursor: pointer;
}
.gap:first-child { border-top: 0; }
.gap:hover { background: var(--surface-sunk); }
.gap .g-title { font-weight: 600; font-size: var(--fs-md); color: var(--ink); }
.gap .g-evidence { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 4px; }
.gap .g-expand { margin-top: 14px; padding-top: 14px; border-top: 1px dashed var(--hair-2); }

/* ---------- Matrix ---------- */
.matrix {
  display: grid;
  gap: 2px;
  font-family: var(--mono);
  font-size: 10px;
}
.matrix-cell {
  aspect-ratio: 1 / 1;
  display: flex; align-items: center; justify-content: center;
  background: var(--hair);
  color: var(--ink-3);
  position: relative;
  cursor: pointer;
  transition: transform 0.08s ease;
}
.matrix-cell:hover { transform: scale(1.08); z-index: 2; outline: 2px solid var(--accent); }
.matrix-cell.c0 { background: oklch(97% 0.004 80); color: transparent; }
.matrix-cell.c1 { background: oklch(93% 0.04 var(--accent-h)); color: var(--accent-ink); }
.matrix-cell.c2 { background: oklch(86% 0.08 var(--accent-h)); color: var(--accent-ink); }
.matrix-cell.c3 { background: oklch(70% 0.14 var(--accent-h)); color: white; }
.matrix-cell.c4 { background: oklch(52% 0.17 var(--accent-h)); color: white; }
.matrix-cell.gap-cell { background: repeating-linear-gradient(135deg, oklch(97% 0.02 40) 0 4px, oklch(94% 0.06 60) 4px 8px); color: oklch(45% 0.14 45); font-weight: 700; }

/* ---------- Tweaks panel ---------- */
.tweaks-btn {
  position: fixed; bottom: 20px; right: 20px;
  z-index: 70;
  background: var(--ink); color: var(--canvas);
  padding: 10px 14px; border-radius: 999px;
  font-size: var(--fs-sm); font-weight: 500;
  box-shadow: 0 6px 20px oklch(20% 0.01 80 / 0.2);
  display: inline-flex; align-items: center; gap: 8px;
}
.tweaks-panel {
  position: fixed; bottom: 68px; right: 20px;
  z-index: 70;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 18px;
  width: 280px;
  box-shadow: 0 12px 40px oklch(20% 0.01 80 / 0.18);
}
.tweaks-panel h5 { font-size: var(--fs-xxs); font-weight: 600; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); margin-bottom: 10px; }
.seg { display: inline-flex; background: var(--surface-sunk); border-radius: var(--radius); padding: 2px; gap: 2px; border: 1px solid var(--hair); }
.seg button { padding: 5px 10px; font-size: var(--fs-xs); font-weight: 500; color: var(--ink-3); border-radius: 6px; }
.seg button.on { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(20% 0.01 80 / 0.06); }

/* ---------- Confidence indicator ---------- */
.conf-dot { display: inline-flex; gap: 2px; align-items: center; vertical-align: middle; }
.conf-dot i { display: block; width: 5px; height: 5px; border-radius: 50%; background: var(--hair-2); }
.conf-dot i.on { background: var(--ink-3); }
.conf-dot.hi i.on { background: var(--pos); }
.conf-dot.lo i.on { background: var(--warn); }

/* ---------- Subdomain page specific ---------- */
.sd-hero {
  padding: 48px 0 40px;
  border-bottom: 1px solid var(--hair);
  margin-bottom: 32px;
}
.sd-hero .eyebrow-row { display: flex; gap: 12px; align-items: center; color: var(--ink-3); font-size: var(--fs-xs); margin-bottom: 18px; }
.sd-hero h1 { font-family: var(--serif); font-size: 52px; line-height: 1.05; letter-spacing: 0; max-width: none; width: 100%; }
.sd-hero .sd-lede { font-size: var(--fs-lg); color: var(--ink-2); max-width: none; width: 100%; margin-top: 18px; line-height: 1.55; }
.sd-hero .sd-stats { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0; margin-top: 32px; border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.sd-hero .sd-stat { padding: 18px 0; border-right: 1px solid var(--hair); padding-right: 24px; }
.sd-hero .sd-stat:last-child { border-right: 0; }
.sd-hero .sd-stat .v { font-family: var(--mono); font-size: 28px; font-weight: 500; letter-spacing: -0.02em; }
.sd-hero .sd-stat .l { font-size: 10px; text-transform: uppercase; letter-spacing: 0.09em; color: var(--ink-3); margin-top: 2px; font-weight: 600; }

.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; }
.grid-3 { display: grid; grid-template-columns: 2fr 1fr; gap: 32px; }
.grid-3col { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }

.section { margin: 44px 0; }
.section-hd { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 18px; gap: 16px; }
.section-hd h3 { font-family: var(--serif); font-size: 28px; font-weight: 400; letter-spacing: -0.01em; line-height: 1.2; }
.section-hd .hint { font-size: var(--fs-xs); color: var(--ink-3); max-width: 340px; }

/* SOTA card */
.sota {
  padding: 24px 26px;
  border-top: 1px solid var(--hair);
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 20px;
  align-items: start;
  cursor: pointer;
}
.sota:first-child { border-top: 0; }
.sota:hover { background: var(--surface-sunk); }
.sota .rank { font-family: var(--serif); font-size: 36px; color: var(--ink-4); font-style: italic; line-height: 1; min-width: 48px; padding-top: 2px; }
.sota .sota-title { font-size: 17px; font-weight: 600; line-height: 1.35; letter-spacing: -0.005em; }
.sota .sota-claim { font-size: var(--fs-sm); color: var(--ink-2); margin-top: 8px; line-height: 1.5; }
.sota .sota-claim em { font-style: normal; font-family: var(--mono); font-size: 0.9em; color: var(--accent-ink); background: var(--accent-soft); padding: 1px 5px; border-radius: 3px; }
.sota .sota-meta { font-size: var(--fs-xs); color: var(--ink-3); margin-top: 10px; display: flex; gap: 12px; flex-wrap: wrap; }
.sota .priority { font-family: var(--mono); font-size: var(--fs-xs); color: var(--accent); font-weight: 600; }

/* Filters bar */
.filters {
  display: flex; gap: 8px; align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--hair);
  flex-wrap: wrap;
}
.filter-pill {
  padding: 6px 12px;
  border: 1px solid var(--hair-2);
  border-radius: 999px;
  font-size: var(--fs-xs);
  color: var(--ink-2);
  cursor: pointer;
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--surface);
}
.filter-pill:hover { border-color: var(--ink-3); color: var(--ink); }
.filter-pill.on { background: var(--ink); color: var(--canvas); border-color: var(--ink); }

/* Queue cards */
.q-card { padding: 16px 18px; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--surface); }

.kbd { font-family: var(--mono); font-size: 11px; padding: 2px 5px; background: var(--surface-sunk); border: 1px solid var(--hair); border-radius: 4px; color: var(--ink-2); }

/* Novelty check */
.novelty-input-sidebar { width: 280px; flex-shrink: 0; }

.novelty-verdict {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 36px 36px 32px;
  display: grid;
  grid-template-columns: 180px 1fr;
  gap: 40px;
  align-items: start;
}
.novelty-big {
  font-family: var(--serif);
  font-size: 88px;
  line-height: 0.9;
  letter-spacing: -0.04em;
  color: var(--ink);
}
.novelty-big .unit { font-family: var(--serif); font-style: italic; font-size: 34px; color: var(--ink-3); margin-left: 2px; }
.novelty-label { font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em; color: var(--ink-3); font-weight: 600; margin-bottom: 8px; }

.stacked-bar { display: flex; height: 10px; border-radius: 5px; overflow: hidden; background: var(--hair); }
.stacked-bar > span { display: block; height: 100%; }
.stacked-bar .s-novel { background: var(--accent); }
.stacked-bar .s-onestep { background: oklch(70% 0.11 var(--accent-h)); }
.stacked-bar .s-notnovel { background: var(--hair-2); }

/* Utilities */
.divider { width: 1px; height: 14px; background: var(--hair-2); display: inline-block; vertical-align: middle; }
.gap-12 { gap: 12px; } .gap-16 { gap: 16px; } .gap-24 { gap: 24px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.w-full { width: 100%; }
.text-right { text-align: right; }

/* Scrollbar subtle */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--hair-2); border-radius: 5px; border: 2px solid var(--canvas); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-4); }

/* Placeholder */
.placeholder {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  padding: 80px 24px;
  border: 1px dashed var(--hair-2);
  border-radius: var(--radius-lg);
  color: var(--ink-3);
  text-align: center;
  background: repeating-linear-gradient(135deg, transparent 0 12px, var(--surface-sunk) 12px 13px);
}
.placeholder h4 { color: var(--ink-2); margin-bottom: 6px; font-weight: 500; }
.placeholder .note { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }


/* ============================================================
   Today / Landing page
   ============================================================ */

.today-wrap {
  max-width: 1240px;
  margin: 0 auto;
  padding: 28px 40px 96px;
}

.today-actionbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 32px;
}
.today-actionbar-left { display: flex; align-items: center; gap: 12px; }
.today-actionbar-right { display: flex; align-items: center; gap: 10px; position: relative; }

.menu-wrap { position: relative; }
.menu-pop {
  position: absolute; top: calc(100% + 6px); left: 0;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius);
  box-shadow: 0 20px 48px -12px rgba(0,0,0,0.18), 0 4px 12px -4px rgba(0,0,0,0.08);
  min-width: 280px;
  padding: 6px;
  z-index: 50;
}
.menu-item {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--ink-2);
}
.menu-item:hover { background: var(--surface-sunk); color: var(--ink); }
.menu-item .mi-t { font-size: 13px; font-weight: 600; color: var(--ink); }
.menu-item .mi-s { font-size: 11px; color: var(--ink-3); margin-top: 2px; }

.profile-btn {
  display: inline-flex; align-items: center; gap: 8px;
  position: relative;
  padding: 6px 10px 6px 6px;
  border: 1px solid var(--hair);
  border-radius: 20px;
  background: var(--surface);
  font-size: 13px; font-weight: 500; color: var(--ink);
  cursor: pointer;
}
.profile-btn:hover { border-color: var(--hair-2); }
.profile-btn.needs-completion { border-color: oklch(68% 0.16 250); }
.profile-notification-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: oklch(58% 0.2 250);
  box-shadow: 0 0 0 3px oklch(93% 0.05 250);
  flex: 0 0 auto;
}
.profile-btn .avatar {
  width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent); color: white;
  display: inline-flex; align-items: center; justify-content: center;
  font-family: var(--mono); font-weight: 600; font-size: 12px;
}

/* Hero */
.today-hero { margin-bottom: 56px; }
.today-greet {
  font-family: var(--serif);
  font-size: 52px;
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 400;
  color: var(--ink);
  margin: 0;
}
.today-greet em { font-style: italic; color: var(--accent); }
.today-meta {
  margin-top: 14px;
  font-size: 15px;
  color: var(--ink-3);
}
.today-meta b { color: var(--ink); font-weight: 600; }

/* KPI cards */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 32px;
}
.kpi-card {
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 24px 26px 22px;
  cursor: pointer;
  transition: border-color 120ms, transform 120ms;
  display: flex; flex-direction: column; gap: 4px;
}
.kpi-card:hover {
  border-color: var(--ink-4);
}
.kpi-card:hover .kpi-arrow { transform: translateX(4px); }
.kpi-card.accent .kpi-num { color: var(--accent); }
.kpi-num {
  font-family: var(--serif);
  font-size: 72px;
  line-height: 0.95;
  font-weight: 400;
  letter-spacing: -0.03em;
  color: var(--ink);
}
.kpi-label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-weight: 600;
  color: var(--ink-3);
  margin-top: 10px;
}
.kpi-sub {
  font-size: 13px;
  color: var(--ink-2);
  margin-top: 2px;
  display: flex; justify-content: space-between; align-items: baseline;
}
.kpi-arrow {
  display: inline-block;
  color: var(--accent);
  font-weight: 600;
  transition: transform 160ms;
}
.kpi-empty {
  padding: 24px 26px;
  border: 1px dashed var(--hair);
  border-radius: var(--radius-lg);
  color: var(--ink-4);
  font-size: 13px;
  display: flex; align-items: center; gap: 10px;
}
.kpi-empty .mono { font-size: 18px; }

/* Audio strip */
.audio-strip {
  margin-top: 20px;
  background: var(--accent-soft);
  border: 1px solid var(--accent-soft-2);
  border-radius: var(--radius);
  padding: 12px 16px;
  display: flex; align-items: center; gap: 12px;
  font-size: 13px;
  color: var(--accent-ink);
}
.audio-strip b { font-weight: 700; }
.audio-topics { font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

/* Sections */
.today-section { margin-top: 56px; }
.today-section-hd {
  display: flex; justify-content: space-between; align-items: flex-end;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--hair);
}
.today-h2 {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 400;
  letter-spacing: -0.015em;
  color: var(--ink);
  margin: 0;
}
.today-section-sub {
  font-size: 12px;
  color: var(--ink-3);
  margin-top: 6px;
}

/* Topic cards grid */
.topics-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
}
.topic-card {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  padding: 20px 22px;
  position: relative;
  cursor: pointer;
  transition: border-color 120ms, box-shadow 120ms;
  display: flex; flex-direction: column; gap: 14px;
  text-align: left;
}
.topic-card:hover {
  border-color: var(--ink-4);
  box-shadow: 0 8px 24px -12px rgba(0,0,0,0.08);
}
.topic-hd {
  display: flex; align-items: flex-start; gap: 8px;
}
.topic-kind {
  font-size: var(--fs-xxs);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--accent);
}
.topic-title {
  font-family: var(--serif);
  font-size: 20px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  font-weight: 400;
  color: var(--ink);
  flex: 1;
}
.topic-global {
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
  padding-top: 12px;
  border-top: 1px solid var(--hair);
}
.topic-personal { display: flex; flex-direction: column; gap: 6px; }
.topic-row {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.topic-row b { color: var(--ink); font-weight: 600; }
.topic-row .muted { color: var(--ink-4); }
.tdot {
  width: 6px; height: 6px; border-radius: 50%;
  background: var(--hair-2);
  display: inline-block;
  flex-shrink: 0;
}
.tdot.on { background: var(--ink-3); }
.tdot.on.accent { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }

.topic-spike {
  display: flex; gap: 10px; align-items: flex-start;
  padding: 10px 12px;
  background: var(--surface-sunk);
  border-radius: var(--radius-sm);
  border-left: 2px solid var(--accent);
}
.spike-arrow { color: var(--accent); font-size: 12px; line-height: 1.2; margin-top: 1px; }
.spike-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.1em;
  font-weight: 600; color: var(--accent-ink);
}
.spike-body { font-size: 12px; color: var(--ink-2); margin-top: 2px; line-height: 1.4; }

.topic-actions {
  display: flex; gap: 8px; margin-top: auto; padding-top: 4px;
}

/* Pin-another card */
.topic-card.topic-pin-more {
  border-style: dashed;
  align-items: center; justify-content: center;
  gap: 10px;
  color: var(--ink-3);
  background: transparent;
}
.topic-card.topic-pin-more:hover { border-color: var(--accent); color: var(--accent); }
.tpm-plus {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1.5px solid currentColor;
  display: flex; align-items: center; justify-content: center;
}
.tpm-label { font-size: 14px; font-weight: 600; }
.tpm-sub { font-size: 11px; color: var(--ink-4); }

/* Team feed */
.team-feed {
  background: var(--surface);
  border: 1px solid var(--hair);
  border-radius: var(--radius-lg);
  overflow: hidden;
}
.feed-row {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 14px; align-items: center;
  padding: 16px 22px;
  border-top: 1px solid var(--hair);
}
.feed-row:first-child { border-top: none; }
.feed-row.muted { opacity: 0.7; }
.feed-ico {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--surface-sunk);
  color: var(--ink-2);
  display: flex; align-items: center; justify-content: center;
}
.feed-title {
  font-size: 14px; color: var(--ink); line-height: 1.35;
}
.feed-who { font-weight: 600; }
.feed-sub { font-size: 12px; color: var(--ink-3); margin-top: 3px; }

/* Resume strip */
.resume-strip {
  margin-top: 40px;
  padding: 16px 22px;
  background: var(--surface-sunk);
  border-radius: var(--radius);
  display: flex; gap: 40px; align-items: center;
  font-size: 13px;
}
.resume-item {
  display: flex; align-items: center; gap: 12px;
}
.resume-label {
  font-size: 10px; text-transform: uppercase; letter-spacing: 0.12em;
  font-weight: 600; color: var(--ink-3);
}
.resume-body { color: var(--ink); font-weight: 500; }
/* ============================================================
   Landing page — pre-login
   ============================================================ */

.landing { background: var(--canvas); color: var(--ink); }

/* Reveal-on-scroll */
.reveal { opacity: 0; transform: translateY(24px); transition: opacity 700ms cubic-bezier(.2,.6,.2,1), transform 700ms cubic-bezier(.2,.6,.2,1); }
.reveal.in { opacity: 1; transform: translateY(0); }

/* Top nav */
.lp-nav { position: sticky; top: 0; z-index: 50; background: oklch(98.5% 0.004 85 / 0.85); backdrop-filter: blur(12px); border-bottom: 1px solid var(--hair); }
.lp-nav-inner { max-width: 1240px; margin: 0 auto; padding: 16px 40px; display: flex; align-items: center; gap: 32px; }
.lp-brand { display: flex; align-items: center; gap: 8px; font-family: var(--serif); font-size: 18px; letter-spacing: -0.01em; white-space: nowrap; flex-shrink: 0; }
.lp-brand-mark { color: var(--accent); font-size: 16px; }
.lp-nav-links { display: flex; gap: 28px; margin-left: auto; }
.lp-nav-links a { font-size: 13px; color: var(--ink-2); text-decoration: none; font-weight: 500; white-space: nowrap; }
.lp-nav-links a:hover { color: var(--ink); }
.lp-nav-cta { display: flex; gap: 8px; flex-shrink: 0; }

/* Section scaffolding */
.lp-section-inner { max-width: 1240px; margin: 0 auto; padding: 0 40px; }
.lp-eyebrow { font-family: var(--mono); font-size: 11px; text-transform: uppercase; letter-spacing: 0.16em; color: var(--accent); font-weight: 600; }
.lp-eyebrow.muted { color: var(--ink-3); }

/* Hero */
.lp-hero { padding: 56px 0 72px; }
.lp-hero-inner { max-width: 1240px; margin: 0 auto; padding: 0 40px; text-align: center; }
.lp-h1 { font-family: var(--serif); font-size: 88px; line-height: 1.02; letter-spacing: -0.035em; font-weight: 400; margin: 24px 0 0; color: var(--ink); }
.lp-h1 em { font-style: italic; color: var(--accent); }
.lp-sub { max-width: 700px; margin: 28px auto 0; font-size: 19px; line-height: 1.5; color: var(--ink-2); }
.lp-hero-cta { display: flex; gap: 12px; justify-content: center; margin-top: 32px; }
.lp-hero-meta { margin-top: 16px; font-size: 13px; color: var(--ink-3); font-family: var(--mono); }
.btn.lg { padding: 12px 22px; font-size: 15px; font-weight: 600; }

/* Problem */
.lp-problem { padding: 72px 0; background: var(--surface); border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.lp-h2 { font-family: var(--serif); font-size: 52px; line-height: 1.1; letter-spacing: -0.025em; font-weight: 400; color: var(--ink); margin: 14px 0 36px; max-width: 880px; }
.lp-h2 em { font-style: italic; color: var(--accent); }
.lp-lede { max-width: 720px; font-size: 17px; line-height: 1.6; color: var(--ink-2); margin: -20px 0 40px; }
.lp-problem-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 28px; margin-top: 24px; }
.lp-stat { padding: 24px 0; border-top: 1px solid var(--hair); }
.lp-stat-num { font-family: var(--serif); font-size: 52px; line-height: 1.0; letter-spacing: -0.03em; color: var(--ink); }
.lp-stat-label { font-size: 15px; font-weight: 600; color: var(--ink); margin-top: 12px; }
.lp-stat-sub { font-size: 13px; color: var(--ink-3); margin-top: 5px; }

/* How — feature triplets */
.lp-how { padding: 80px 0; }
.lp-feature { display: grid; grid-template-columns: 1fr 1fr; gap: 64px; align-items: center; margin-top: 60px; padding: 24px 0; }
.lp-feature.reverse .lp-feature-text { order: 2; }
.lp-feature.reverse .lp-feature-vis { order: 1; }
.lp-feat-num { font-family: var(--mono); font-size: 12px; color: var(--accent); font-weight: 600; letter-spacing: 0.08em; }
.lp-feat-h { font-family: var(--serif); font-size: 40px; line-height: 1.15; letter-spacing: -0.02em; font-weight: 400; margin: 10px 0 14px; color: var(--ink); }
.lp-feat-body { font-size: 16px; line-height: 1.6; color: var(--ink-2); margin-bottom: 20px; }
.lp-feat-bullets { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.lp-feat-bullets li { font-size: 14px; color: var(--ink-2); padding-left: 22px; position: relative; line-height: 1.5; }
.lp-feat-bullets li::before { content: "→"; position: absolute; left: 0; top: 0; color: var(--accent); font-weight: 600; font-size: 14px; }
.lp-feature-vis { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius-lg); padding: 24px; box-shadow: 0 8px 24px -12px rgba(0,0,0,0.08); }

/* Feature visuals */
.vis-topics { display: flex; flex-direction: column; gap: 10px; }
.vis-topic { padding: 12px 16px; background: var(--canvas); border: 1px solid var(--hair); border-radius: var(--radius); animation: row-in 600ms ease-out var(--d) both; }
@keyframes row-in { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: translateX(0); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.vis-topic-name { font-family: var(--serif); font-size: 15px; letter-spacing: -0.005em; color: var(--ink); }
.vis-topic-bar { margin-top: 7px; height: 3px; background: var(--hair); border-radius: 2px; overflow: hidden; }
.vis-topic-bar > span { display: block; height: 100%; background: var(--accent); }
.vis-topic-meta { margin-top: 5px; font-family: var(--mono); font-size: 11px; color: var(--ink-3); }

.vis-novelty { display: flex; flex-direction: column; gap: 14px; }
.vis-nov-score { display: flex; align-items: flex-end; gap: 4px; line-height: 1; }
.vis-nov-num { font-size: 72px; line-height: 1; letter-spacing: -0.04em; color: var(--ink); }
.vis-nov-unit { font-size: 24px; color: var(--ink-3); font-style: italic; line-height: 1; padding-bottom: 6px; }
.vis-nov-bar { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--hair); }
.vis-nov-bar > span { display: block; height: 100%; }
.seg-novel { background: var(--accent); }
.seg-onestep { background: oklch(70% 0.11 var(--accent-h)); }
.seg-notnovel { background: var(--hair-2); }
.vis-nov-legend { display: flex; gap: 14px; font-size: 12px; color: var(--ink-3); flex-wrap: wrap; }
.vis-nov-legend b { color: var(--ink); font-weight: 600; }
.vis-nov-legend .d { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 5px; vertical-align: middle; }
.d.novel { background: var(--accent); }
.d.step { background: oklch(70% 0.11 var(--accent-h)); }
.d.not { background: var(--hair-2); }
.vis-nov-verdict { font-family: var(--serif); font-size: 15px; line-height: 1.4; color: var(--ink); margin-top: 4px; padding-top: 14px; border-top: 1px solid var(--hair); }
.vis-nov-verdict i { color: var(--accent); font-weight: 500; }

.vis-matrix-wrap { display: flex; gap: 6px; align-items: stretch; }
.vis-matrix-ylabel { display: flex; align-items: center; justify-content: center; }
.vis-matrix-ylabel span { font-size: 10px; font-family: var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; writing-mode: vertical-rl; transform: rotate(180deg); }
.vis-matrix-xlabel { font-size: 10px; font-family: var(--mono); color: var(--ink-3); text-transform: uppercase; letter-spacing: 0.08em; text-align: center; margin-top: 6px; }
.vis-matrix { display: flex; flex-direction: column; gap: 3px; padding: 6px; }
.vis-row { display: flex; gap: 3px; }
.vis-cell { flex: 1; aspect-ratio: 1; border-radius: 2px; background: var(--surface-sunk); display: flex; align-items: center; justify-content: center; font-family: var(--mono); font-size: 10px; color: var(--ink-2); animation: cell-in 400ms ease-out var(--d) both; }
@keyframes cell-in { from { opacity: 0; transform: scale(0.7); } to { opacity: 1; transform: scale(1); } }
.vis-cell.gap { background: repeating-linear-gradient(45deg, transparent 0 4px, var(--accent-soft-2) 4px 5px); border: 1px dashed var(--accent); }
.vis-cell.c1 { background: oklch(96% 0.02 var(--accent-h)); }
.vis-cell.c2 { background: oklch(88% 0.06 var(--accent-h)); color: var(--ink); }
.vis-cell.c3 { background: oklch(70% 0.11 var(--accent-h)); color: white; }
.vis-mtx-legend { display: flex; gap: 16px; margin-top: 14px; font-size: 12px; color: var(--ink-3); }

/* What you get — collapsed strip */
.lp-what { padding: 40px 0; background: var(--surface); border-top: 1px solid var(--hair); border-bottom: 1px solid var(--hair); }
.lp-what-label { font-size: 15px; color: var(--ink-3); margin: 0 0 20px; }
.lp-panel-strip { display: flex; gap: 0; justify-content: center; flex-wrap: wrap; }
.lp-panel-name { font-family: var(--serif); font-size: 17px; color: var(--ink-2); padding: 6px 18px; border-right: 1px solid var(--hair); }
.lp-panel-name:last-child { border-right: none; }

/* Trust */
.lp-trust { padding: 80px 0; }
.lp-trust-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 24px; margin-top: 24px; }
.lp-trust-item { padding: 26px; background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius-lg); }
.lp-trust-item h4 { font-family: var(--serif); font-size: 20px; font-weight: 400; letter-spacing: -0.01em; color: var(--ink); margin: 0 0 12px; }
.lp-trust-item p { font-size: 13px; line-height: 1.6; color: var(--ink-2); margin: 0; }

/* CTA */
.lp-cta { padding: 88px 0; background: linear-gradient(180deg, var(--canvas) 0%, var(--surface-sunk) 100%); text-align: center; border-top: 1px solid var(--hair); }
.lp-cta-h { font-family: var(--serif); font-size: 72px; line-height: 1.05; letter-spacing: -0.03em; font-weight: 400; color: var(--ink); margin: 0 0 28px; }
.lp-cta-actions { display: flex; gap: 12px; justify-content: center; }
.lp-cta-meta { margin-top: 18px; font-size: 12px; color: var(--ink-3); font-family: var(--mono); }

/* Footer */
.lp-footer { padding: 24px 0 32px; border-top: 1px solid var(--hair); }

/* ── Notebook Detail ────────────────────────────────────────────────────────── */
.nb-header { display: flex; align-items: flex-start; gap: 24px; margin-bottom: 32px; }
.nb-header-actions { display: flex; align-items: center; gap: 10px; flex-shrink: 0; padding-top: 4px; }

.nb-layout { display: grid; grid-template-columns: 1fr 280px; gap: 32px; align-items: start; }
@media (max-width: 900px) { .nb-layout { grid-template-columns: 1fr; } }

/* Audio player card */
.nb-audio-card { background: var(--surface); border: 1px solid var(--hair); border-radius: var(--radius-lg); padding: 20px 24px; margin-bottom: 16px; }
.nb-audio-card.nb-audio-empty { opacity: 0.7; }
.nb-audio-top { display: flex; align-items: center; gap: 16px; }
.nb-audio-label { font-size: 14px; font-weight: 600; color: var(--ink); }
.nb-audio-dur { font-size: 12px; color: var(--ink-3); margin-top: 2px; }
.nb-play-btn { width: 44px; height: 44px; border-radius: 50%; background: var(--accent); color: #fff; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; transition: opacity 0.15s; }
.nb-play-btn:hover { opacity: 0.85; }
.nb-play-btn--idle { background: var(--surface-sunk); color: var(--ink-3); cursor: default; }

/* Artifact cards */
.nb-artifacts { display: flex; flex-direction: column; gap: 10px; }
.nb-artifact { border: 1px solid var(--hair); border-radius: var(--radius-lg); overflow: hidden; background: var(--surface); }
.nb-artifact.empty { opacity: 0.65; }
.nb-art-header { display: flex; align-items: center; gap: 12px; padding: 14px 18px; cursor: pointer; user-select: none; }
.nb-artifact.empty .nb-art-header { cursor: default; }
.nb-art-ico { width: 28px; height: 28px; display: flex; align-items: center; justify-content: center; background: var(--surface-sunk); border-radius: 6px; flex-shrink: 0; color: var(--ink-2); }
.nb-art-meta { flex: 1; min-width: 0; }
.nb-art-title { font-size: 13px; font-weight: 600; color: var(--ink); }
.nb-art-sub { font-size: 11px; color: var(--ink-3); margin-top: 1px; font-family: var(--font-mono); }
.nb-art-body { padding: 0 18px 18px; border-top: 1px solid var(--hair); }
.nb-art-actions { display: flex; gap: 8px; margin-top: 14px; }

/* Mindmap */
.nb-mindmap-wrap { padding-top: 16px; overflow-x: auto; }
.mm-node { padding-left: calc(var(--depth, 0) * 20px); margin: 2px 0; }
.mm-label { display: inline-block; padding: 4px 10px; border-radius: 6px; font-size: 13px; line-height: 1.4; }
.mm-root { background: var(--accent); color: #fff; font-weight: 600; font-size: 14px; }
.mm-l1 { background: var(--surface-sunk); color: var(--ink); font-weight: 500; border: 1px solid var(--hair); }
.mm-label:not(.mm-root):not(.mm-l1) { color: var(--ink-2); font-size: 12px; }
.mm-children { margin-top: 4px; border-left: 2px solid var(--hair); margin-left: 10px; padding-left: 2px; }

/* Briefing doc markdown */
.nb-briefing { padding-top: 16px; max-height: 480px; overflow-y: auto; }
.nb-md-h2 { font-family: var(--serif); font-size: 18px; font-weight: 400; color: var(--ink); margin: 20px 0 6px; letter-spacing: -0.01em; }
.nb-md-h2:first-child { margin-top: 0; }
.nb-md-p { font-size: 13px; line-height: 1.65; color: var(--ink-2); margin: 0 0 8px; }
.nb-md-ul { font-size: 13px; line-height: 1.65; color: var(--ink-2); margin: 0 0 8px; padding-left: 20px; }
.nb-md-ul li { margin-bottom: 3px; }

/* Source paper list */
.nb-paper-list { display: flex; flex-direction: column; gap: 8px; }
.nb-paper-row { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--hair); border-radius: var(--radius); cursor: pointer; background: var(--surface); transition: border-color 0.15s; }
.nb-paper-row:hover { border-color: var(--accent); }
.nb-paper-title { font-size: 12px; font-weight: 500; color: var(--ink); line-height: 1.4; margin-bottom: 3px; }
.nb-paper-meta { font-size: 11px; color: var(--ink-3); }

/* Sidebar sections */
.nb-side-section { padding: 18px 0; border-bottom: 1px solid var(--hair); }
.nb-side-section:first-child { padding-top: 0; }
.nb-side-section:last-child { border-bottom: none; }

/* NLM chat card */
.nb-nlm-card { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border: 1px solid var(--hair); border-radius: var(--radius); background: var(--surface-sunk); text-decoration: none; color: var(--ink); transition: border-color 0.15s; }
.nb-nlm-card:hover { border-color: var(--accent); }

/* Markdown rendered table */
.nb-md-tbl { width: 100%; border-collapse: collapse; font-size: 12px; }
.nb-md-tbl th { text-align: left; padding: 6px 10px; background: var(--surface-sunk); border-bottom: 2px solid var(--hair-2); font-weight: 600; color: var(--ink); white-space: nowrap; }
.nb-md-tbl td { padding: 5px 10px; border-bottom: 1px solid var(--hair); color: var(--ink-2); vertical-align: top; line-height: 1.4; }
.nb-md-tbl tr:last-child td { border-bottom: none; }
.nb-md-tbl tr:hover td { background: var(--surface-sunk); }

/* Blockquote */
.nb-md-bq { border-left: 3px solid var(--accent); margin: 10px 0; padding: 8px 14px; background: var(--surface-sunk); border-radius: 0 4px 4px 0; }
.nb-md-bq p { margin: 0 0 4px; color: var(--ink-2); font-style: italic; font-size: 13px; line-height: 1.55; }
.nb-md-bq p:last-child { margin-bottom: 0; }

/* H3/H4 inside briefing */
.nb-md-h3 { font-size: 14px; font-weight: 600; color: var(--ink); margin: 16px 0 4px; }

/* HR */
.nb-md-hr { border: none; border-top: 1px solid var(--hair); margin: 16px 0; }

/* Comparison full-width scroll */
.nb-comparison { overflow-x: auto; }

/* ============================================================
   Mobile responsiveness
   ============================================================ */

/* Scrollable nav strip — hides scrollbar, keeps swipe */
.nav {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.nav::-webkit-scrollbar { display: none; }

@media (max-width: 768px) {
  /* ── Container ── */
  .container { padding: 0 16px; }

  /* ── Header ── */
  .header-top {
    padding: 12px 16px 10px;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
  }
  .header-meta {
    width: 100%;
    flex-wrap: wrap;
    gap: 10px;
    justify-content: flex-end;
  }
  /* Hide stats + last-updated text on mobile */
  .header-meta > span { display: none; }
  /* Search drops to its own full-width row */
  .header-meta > .search-wrap {
    order: 9;
    width: 100% !important;
    flex: 1 1 100%;
  }

  /* ── Nav ── */
  .nav { padding: 0 16px; }

  /* ── Brand ── */
  .brand .sub { display: none; }
  .brand .mark { font-size: 18px; }

  /* ── Paper drawer → full-screen ── */
  .drawer { width: 100%; max-width: 100%; border-left: none; }
  .drawer-header { padding: 16px 20px 14px; }
  .drawer-body { padding: 16px 20px 64px; }

  /* ── Paper row ── */
  .paper-row {
    grid-template-columns: 44px 1fr;
    padding: 12px 16px;
    gap: 12px;
  }
  .paper-row > *:nth-child(3) { grid-column: 2; }

  /* ── Today page ── */
  .today-wrap { padding: 20px 16px 64px; }
  .today-greet { font-size: 36px; letter-spacing: -0.02em; }
  .today-meta { font-size: 13px; }
  .today-actionbar { flex-wrap: wrap; gap: 12px; }
  .today-section { margin-top: 36px; }
  .today-h2 { font-size: 22px; }
  .kpi-row { grid-template-columns: 1fr 1fr; gap: 10px; }
  .kpi-num { font-size: 48px; }
  .topics-grid { grid-template-columns: 1fr; }
  .resume-strip { flex-direction: column; gap: 12px; padding: 14px 16px; }

  /* ── Layout grids → single column ── */
  .grid-2 { grid-template-columns: 1fr; gap: 16px; }
  .grid-3 { grid-template-columns: 1fr; gap: 16px; }
  .grid-3col { grid-template-columns: 1fr; gap: 12px; }

  /* ── Sections ── */
  .section { margin: 24px 0; }
  .section-hd { flex-wrap: wrap; gap: 8px; }
  .section-hd h3 { font-size: 20px; }

  /* ── Subdomain hero ── */
  .sd-hero { padding: 24px 0 20px; margin-bottom: 20px; }
  .sd-hero h1 { font-size: 32px; }
  .sd-hero .sd-lede { font-size: 14px; }
  .sd-hero .sd-stats { grid-template-columns: repeat(3, 1fr); overflow-x: auto; }
  .sd-hero .sd-stat { padding: 14px 0; padding-right: 16px; }
  .sd-hero .sd-stat .v { font-size: 20px; }

  /* ── Subdomain cards ── */
  .sd-grid { grid-template-columns: 1fr; }
  .sd-card { padding: 18px 18px 16px; }
  .sd-card .sd-title { font-size: 18px; }

  /* ── Novelty check input ── */
  .novelty-input-grid { grid-template-columns: 1fr !important; }
  .novelty-input-sidebar { width: 100% !important; }

  /* ── Novelty verdict → stack ── */
  .novelty-verdict {
    grid-template-columns: 1fr;
    gap: 16px;
    padding: 20px 18px;
  }
  .novelty-big { font-size: 64px; }

  /* ── Notebook detail ── */
  .nb-header { flex-direction: column; gap: 12px; }

  /* ── Team feed row ── */
  .feed-row { grid-template-columns: 36px 1fr; }
  .feed-row > *:last-child { display: none; }

  /* ── Tweaks panel ── */
  .tweaks-panel { width: calc(100vw - 32px); right: 16px; bottom: 72px; }

  /* ── App footer ── */
  .shell > footer { padding: 24px 0 40px; }

  /* ── Landing page ── */
  .lp-nav-inner { padding: 12px 16px; gap: 12px; }
  .lp-nav-links { display: none; }
  .lp-section-inner { padding: 0 16px; }
  .lp-hero { padding: 32px 0 48px; }
  .lp-hero-inner { padding: 0 16px; }
  .lp-h1 { font-size: 44px; letter-spacing: -0.025em; }
  .lp-sub { font-size: 15px; margin-top: 18px; }
  .lp-hero-cta { flex-direction: column; align-items: center; }
  .lp-problem { padding: 48px 0; }
  .lp-h2 { font-size: 30px; margin-bottom: 20px; }
  .lp-lede { font-size: 15px; }
  .lp-problem-grid { grid-template-columns: 1fr; gap: 0; }
  .lp-stat { padding: 18px 0; }
  .lp-stat-num { font-size: 36px; }
  .lp-how { padding: 48px 0; }
  .lp-feature { grid-template-columns: 1fr; gap: 28px; margin-top: 36px; }
  .lp-feature.reverse .lp-feature-text { order: 1; }
  .lp-feature.reverse .lp-feature-vis { order: 2; }
  .lp-feat-h { font-size: 26px; }
  .lp-feat-body { font-size: 14px; }
  .lp-trust { padding: 48px 0; }
  .lp-trust-grid { grid-template-columns: 1fr; gap: 14px; }
  .lp-cta { padding: 56px 0; }
  .lp-cta-h { font-size: 40px; }
  .lp-cta-actions { flex-direction: column; align-items: center; }
}

/* ── Profile page ──────────────────────────────────────────────────────── */
.profile-page {
  min-height: 100%;
  background: var(--surface);
  padding: 40px 16px 80px;
}
.profile-inner {
  max-width: 760px;
  margin: 0 auto;
}
.profile-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 32px;
  flex-wrap: wrap;
}
.profile-title {
  font-family: var(--serif);
  font-size: 28px;
  font-weight: 700;
  margin: 0 0 6px;
  color: var(--ink-1);
}
.profile-subtitle {
  font-size: 14px;
  color: var(--ink-3);
  margin: 0;
}
.profile-error {
  background: #fef2f2;
  color: #b91c1c;
  border: 1px solid #fca5a5;
  border-radius: 8px;
  padding: 10px 14px;
  font-size: 14px;
  margin-bottom: 20px;
}
.profile-section {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 20px;
}
.profile-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--ink-1);
  margin: 0 0 16px;
  letter-spacing: -0.01em;
}
.profile-section-desc {
  font-size: 13px;
  color: var(--ink-3);
  margin: -8px 0 16px;
  line-height: 1.55;
}
.profile-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.profile-field {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.profile-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-2);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.profile-input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--sans);
  color: var(--ink-1);
  background: var(--surface);
  transition: border-color 0.15s;
  box-sizing: border-box;
}
.profile-input:focus {
  outline: none;
  border-color: var(--accent);
}
.profile-papers-list {
  list-style: none;
  margin: 0 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.profile-paper-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.profile-paper-info {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  min-width: 0;
}
.profile-paper-title {
  font-size: 13px;
  color: var(--ink-1);
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.profile-paper-year {
  font-size: 12px;
  color: var(--ink-3);
  font-family: var(--mono);
  flex-shrink: 0;
}
.profile-paper-link {
  font-size: 13px;
  color: var(--accent);
  text-decoration: none;
  flex-shrink: 0;
}
.profile-paper-remove {
  background: none;
  border: none;
  color: var(--ink-3);
  cursor: pointer;
  font-size: 12px;
  padding: 2px 6px;
  border-radius: 4px;
  flex-shrink: 0;
}
.profile-paper-remove:hover { color: var(--ink-1); background: var(--border); }
.profile-add-paper {
  display: flex;
  gap: 8px;
  align-items: center;
  flex-wrap: wrap;
}
.profile-add-title { flex: 2; min-width: 160px; }
.profile-add-url   { flex: 1; min-width: 120px; }
.profile-textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 14px;
  font-family: var(--sans);
  color: var(--ink-1);
  background: var(--surface);
  resize: vertical;
  line-height: 1.6;
  box-sizing: border-box;
  transition: border-color 0.15s;
}
.profile-textarea:focus { outline: none; border-color: var(--accent); }
.profile-char-count {
  font-size: 12px;
  color: var(--ink-3);
  text-align: right;
  margin-top: 6px;
  font-family: var(--mono);
}
.profile-footer {
  display: flex;
  align-items: center;
  gap: 16px;
  padding-top: 8px;
}
.profile-saved-msg {
  font-size: 13px;
  color: var(--ink-3);
}
.profile-scholar-row {
  display: flex;
  gap: 8px;
  align-items: center;
}
.profile-papers-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 20px;
  height: 20px;
  padding: 0 6px;
  background: var(--accent);
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
  margin-left: 8px;
  vertical-align: middle;
}
.profile-scholar-error {
  margin-top: 6px;
  font-size: 12px;
  color: var(--red, #e53e3e);
}
.profile-scholar-saving {
  margin-top: 6px;
  font-size: 12px;
  color: var(--ink-3);
  font-style: italic;
}
.profile-scholar-preview {
  margin-top: 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
}
.profile-scholar-preview-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface-2, var(--hair));
  font-size: 12px;
  color: var(--ink-2);
  gap: 8px;
  flex-wrap: wrap;
}
.profile-scholar-list {
  list-style: none;
  margin: 0;
  padding: 0;
  max-height: 320px;
  overflow-y: auto;
}
.profile-scholar-item {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 8px 12px;
  border-top: 1px solid var(--hair);
  cursor: pointer;
  font-size: 13px;
}
.profile-scholar-item:first-child { border-top: none; }
.profile-scholar-item:hover { background: var(--surface-2, var(--bg-2)); }
.profile-scholar-item input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; }
.profile-scholar-item-info {
  display: flex;
  align-items: baseline;
  gap: 4px;
  flex-wrap: wrap;
  flex: 1;
  min-width: 0;
}
/* Inside the scholar preview, titles wrap instead of truncating */
.profile-scholar-item-info .profile-paper-title {
  white-space: normal;
  overflow: visible;
  text-overflow: unset;
  word-break: break-word;
  flex: none;
}
.btn-link {
  background: none;
  border: none;
  padding: 2px 4px;
  font-size: 11px;
  color: var(--accent);
  cursor: pointer;
  text-decoration: underline;
}
.btn-link:hover { opacity: 0.75; }

/* Private topic paper management */
.topic-add-paper {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.topic-paper-remove {
  position: absolute;
  top: 50%;
  right: 8px;
  transform: translateY(-50%);
  background: none;
  border: none;
  color: var(--ink-3);
  font-size: 13px;
  cursor: pointer;
  padding: 4px 6px;
  border-radius: 4px;
  opacity: 0;
  transition: opacity 0.15s;
}
/* Show on hover of parent row */
div:hover > .topic-paper-remove { opacity: 1; }
.topic-paper-remove:hover { color: var(--red, #e53); background: var(--surface-2); }
@media (pointer: coarse) { .topic-paper-remove { opacity: 1; } }

/* AI Research Profile section */
.profile-ai-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.profile-ai-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px;
  background: var(--surface-2, var(--hair));
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-2);
}
.profile-ai-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  flex-shrink: 0;
}
@keyframes spin { to { transform: rotate(360deg); } }
.profile-ai-empty {
  padding: 14px 16px;
  background: var(--surface-2, var(--hair));
  border-radius: 8px;
  font-size: 13px;
  color: var(--ink-3);
}
.profile-ai-result {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.profile-ai-card-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 10px;
}
.profile-ai-area {
  display: inline-block;
  padding: 4px 12px;
  background: var(--accent);
  color: #fff;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.03em;
}
.profile-ai-edit {
  display: flex;
  flex-direction: column;
}
.profile-ai-summary {
  font-size: 14px;
  line-height: 1.6;
  color: var(--ink-1);
  margin: 0;
}
.profile-ai-keywords {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}
.profile-ai-kw {
  padding: 3px 10px;
  background: var(--surface-2, var(--hair));
  border: 1px solid var(--border);
  border-radius: 12px;
  font-size: 11px;
  color: var(--ink-2);
}
.profile-ai-categories {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.profile-ai-cat {
  padding: 14px 16px;
  border: 1px solid var(--border);
  border-radius: 10px;
  background: var(--surface, var(--bg));
}
.profile-ai-cat-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink-1);
  margin-bottom: 4px;
}
.profile-ai-cat-desc {
  font-size: 12px;
  color: var(--ink-2);
  line-height: 1.5;
  margin-bottom: 8px;
}
.profile-ai-cat-papers {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.profile-ai-cat-papers li {
  font-size: 11px;
  color: var(--ink-3);
  padding-left: 10px;
  position: relative;
}
.profile-ai-cat-papers li::before {
  content: '·';
  position: absolute;
  left: 0;
}

@media (max-width: 600px) {
  .profile-grid { grid-template-columns: 1fr; }
  .profile-header { flex-direction: column; }
  .profile-add-paper { flex-direction: column; }
  .profile-add-title, .profile-add-url { width: 100%; }
  .profile-scholar-row { flex-direction: column; align-items: stretch; }
}

/* ── Keyword management panel ─────────────────────────────── */
.kw-panel {
  border: 1px solid var(--hair-2);
  border-radius: 10px;
  overflow: hidden;
}
.kw-panel-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.kw-refine-badge {
  font-size: 11px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 20px;
  background: oklch(94% 0.06 50);
  color: oklch(45% 0.18 50);
}
.kw-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-family: var(--mono);
  padding: 3px 10px;
  border-radius: 20px;
  background: var(--surface-sunk);
  border: 1px solid var(--hair);
  color: var(--ink-2);
  white-space: nowrap;
}
.kw-chip.kw-good {
  background: oklch(95% 0.07 145);
  border-color: oklch(80% 0.10 145);
  color: oklch(40% 0.18 145);
}
.kw-chip.kw-mixed {
  background: oklch(95% 0.05 80);
  border-color: oklch(80% 0.08 80);
  color: oklch(42% 0.14 80);
}
.kw-chip.kw-bad {
  background: oklch(95% 0.06 30);
  border-color: oklch(80% 0.10 30);
  color: oklch(45% 0.18 30);
}
.kw-chip.kw-anti {
  background: oklch(95% 0.04 30);
  border-color: oklch(82% 0.08 30);
  color: oklch(45% 0.16 30);
  text-decoration: line-through;
}
.kw-add-input {
  font-size: 12px;
  font-family: var(--mono);
  border: 1px dashed var(--hair-2);
  border-radius: 20px;
  padding: 3px 10px;
  background: transparent;
  color: var(--ink-2);
  outline: none;
  width: 130px;
}
.kw-add-input:focus {
  border-color: var(--accent);
  background: var(--surface-sunk);
}
.kw-stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 12px;
}
.kw-stats-table th {
  text-align: left;
  padding: 5px 10px 5px 0;
  border-bottom: 1px solid var(--hair);
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--ink-3);
}
.kw-stats-table td {
  padding: 6px 10px 6px 0;
  border-bottom: 1px solid var(--hair);
  color: var(--ink-2);
  vertical-align: middle;
}
.kw-stats-table td:first-child {
  color: var(--ink);
  max-width: 180px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.kw-archive {
  border-top: 1px solid var(--hair);
  padding-top: 8px;
}
.kw-archive-toggle {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 6px 0;
  background: transparent;
  border: 0;
  color: var(--ink-2);
  cursor: pointer;
  font-size: 12px;
  font-weight: 600;
  text-align: left;
}
.kw-archive-toggle .mono {
  color: var(--ink-3);
  font-size: 10px;
  font-weight: 400;
}
.kw-archive-table {
  margin-top: 6px;
}
.kw-archive-table td:first-child {
  color: var(--ink-2);
}
@media (max-width: 600px) {
  /* Keep Found/Relevant/Kept visible on mobile — they're the actionable
     columns. Only tighten the keyword cell so the table fits. */
  .kw-stats-table td:first-child { max-width: 120px; }
  .kw-add-input { width: 100px; }
}
.kw-src-chip {
  font-size: 12px;
  padding: 4px 11px;
  border-radius: 20px;
  background: var(--surface-sunk);
  border: 1px solid var(--hair);
  color: var(--ink-2);
  cursor: pointer;
}
.kw-src-chip.on {
  background: oklch(94% 0.06 var(--accent-h));
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 500;
}
.kw-limit-chip {
  font-size: 12px;
  padding: 4px 12px;
  border-radius: 8px;
  background: var(--surface-sunk);
  border: 1px solid var(--hair);
  color: var(--ink-2);
  cursor: pointer;
}
.kw-limit-chip.on {
  background: oklch(94% 0.06 var(--accent-h));
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* Topic page spacing fixes */
.grid-3 > * { min-width: 0; }
.grid-3 { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.topic-paper-item { position: relative; }
.topic-paper-item .paper-row { padding-right: 44px; }
@media (max-width: 860px) {
  .grid-3 { grid-template-columns: 1fr; }
}
