/* Marketing tokens from the site: navy #0A2540, growth #0E9F6E, growth ink #067A4E, paper #F7F9FC.
   #0E9F6E on white is about 3.4:1, so it fills positive buttons and chart lines. Selected filters use navy.
   Navy #0A2540 on that emerald is about 4.6:1. Positive text uses #067A4E (about 5.4:1 on white).
   Sign-in and the signup continue button use the sidebar navy with white text. */
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/inter-latin-ext-400.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 400;
  font-display: swap;
  src: url("/fonts/inter-latin-400.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/inter-latin-ext-500.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url("/fonts/inter-latin-500.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/inter-latin-ext-600.woff2") format("woff2");
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+0304, U+0308, U+0329, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face {
  font-family: Inter;
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url("/fonts/inter-latin-600.woff2") format("woff2");
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
.loader { text-align: center; padding: 64px 16px; }
.loader h2 { margin-bottom: 8px; }
.orbit { width: 88px; height: 88px; margin: 0 auto 20px; border-radius: 50%; border: 3px solid var(--line, #e3e8f0); border-top-color: var(--growth, #0e9f6e); animation: spin 0.9s linear infinite; position: relative; }
.orbit::after { content: ""; position: absolute; inset: 16px; border-radius: 50%; border: 3px solid transparent; border-bottom-color: var(--navy, #0a2540); animation: spin 1.4s linear infinite reverse; }
.checklist { margin: 8px 0 0; padding-left: 18px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.plan-price { font-size: 28px; margin: 0 0 8px; }
.plan-price span { font-size: 14px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.prompt-slot { border: 1px dashed var(--line); border-radius: 10px; padding: 10px 12px; margin-top: 8px; background: transparent; }
.prompt-slot .prompt-text { color: var(--growth-ink, #067a4e); font-weight: 600; }
.prompt-slot .help { margin: 4px 0 0; }

:root {
  --bg: #f7f9fc;
  --surface: #ffffff;
  --band: #eef3fa;
  --ink: #0a2540;
  --heading: #0a2540;
  --navy: #0a2540;
  --muted: #3e5166;
  --line: #e3e8f0;
  --growth: #0e9f6e;
  --growth-ink: #067a4e;
  --on-growth: #0a2540;
  --primary: #0e9f6e;
  --primary-hover: #067a4e;
  --on-primary: #0a2540;
  --on-primary-hover: #f7f9fc;
  --primary-border: #067a4e;
  --nav-active: #0a2540;
  --nav-active-ink: #f7f9fc;
  --accent: #0e9f6e;
  --accent-hover: #0b8a5f;
  --accent-soft: #e7f6f0;
  --good: #067a4e;
  --good-bg: #e7f6f0;
  --bad: #9f2d2d;
  --bad-bg: #f8f1f1;
  --bad-border: #eadbdb;
  --info: #334155;
  --info-bg: #f1f5f9;
  --info-border: #e2e8f0;
  --focus: #0a2540;
  --shadow: 0 1px 2px rgba(10, 37, 64, 0.04);
  --grid: #e3e8f0;
  --chart-ink: #64748b;
  --slate: #64748b;
  --slate-2: #94a3b8;
  --slate-3: #cbd5e1;
  color: var(--ink);
  background: var(--bg);
  font-family: Inter, "Segoe UI", ui-sans-serif, system-ui, sans-serif;
  font-size: 14px;
  font-weight: 400;
  line-height: 1.5;
  font-variant-numeric: tabular-nums;
  color-scheme: light;
}
:root[data-theme="dark"] {
  --bg: #061422;
  --surface: #0a2540;
  --band: #0a2540;
  --ink: #f7f9fc;
  --heading: #f7f9fc;
  --navy: #0a2540;
  --muted: #94a3b8;
  --line: #1c3d5c;
  --growth: #0e9f6e;
  --growth-ink: #0e9f6e;
  --on-growth: #0a2540;
  --primary: #0e9f6e;
  --primary-hover: #067a4e;
  --on-primary: #0a2540;
  --on-primary-hover: #f7f9fc;
  --primary-border: #067a4e;
  --nav-active: #133652;
  --nav-active-ink: #f7f9fc;
  --accent: #0e9f6e;
  --accent-hover: #12b37d;
  --accent-soft: #06281c;
  --good: #0e9f6e;
  --good-bg: #04160f;
  --bad: #e7b4b4;
  --bad-bg: #2a1214;
  --bad-border: #5c2a2a;
  --info: #cbd5e1;
  --info-bg: #12263a;
  --info-border: #1c3d5c;
  --focus: #f7f9fc;
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.28);
  --grid: #1c3d5c;
  --chart-ink: #94a3b8;
  --slate: #94a3b8;
  --slate-2: #64748b;
  --slate-3: #475569;
  color-scheme: dark;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; }
a { color: var(--heading); }
button, input, select, textarea { font: inherit; color: inherit; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; }
[hidden] { display: none !important; }

.shell { display: grid; grid-template-columns: 240px minmax(0, 1fr); min-height: 100vh; }
.nav {
  position: sticky;
  top: 0;
  height: 100vh;
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  border-right: 1px solid var(--line);
  background: var(--band);
  overflow: auto;
}
.brand,
.brand:hover,
.brand:focus,
.brand:focus-visible,
.brand:active {
  display: inline-flex;
  align-items: center;
  gap: 0.55rem;
  margin: 0 4px 16px;
  color: var(--heading);
  text-decoration: none;
  font-weight: 600;
  letter-spacing: -0.03em;
  font-size: 0.98rem;
}
.brand svg { width: 1.15rem; height: 1.15rem; flex: none; color: currentColor; }
.project-switch { display: grid; gap: 4px; margin: 0 4px 8px; color: var(--muted); font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; }
.project-switch select {
  width: 100%;
  height: 36px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 28px 0 10px;
  box-shadow: var(--shadow);
  appearance: none;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 14px) 15px, calc(100% - 9px) 15px;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}
.nav nav, .side-nav { display: grid; gap: 2px; }
.nav > nav:not(.nav-secondary) a,
.nav a[data-nav] {
  display: flex;
  align-items: center;
  gap: 6px;
  text-decoration: none;
  min-height: 32px;
  padding: 6px 10px;
  border-radius: 8px;
  color: var(--muted);
  font-size: 14px;
  font-weight: 500;
}
.nav > nav:not(.nav-secondary) a svg,
.nav a[data-nav] svg { width: 16px; height: 16px; flex: none; }
.nav > nav:not(.nav-secondary) a:hover,
.nav a[data-nav]:hover { background: var(--bg); color: var(--heading); }
.nav > nav:not(.nav-secondary) a.active,
.nav a[data-nav].active { background: var(--nav-active); color: var(--nav-active-ink); font-weight: 500; }
.nav-foot { margin-top: auto; display: grid; gap: 8px; padding-top: 12px; }
.sign-out { margin: 0; }
.sign-out button {
  width: 100%;
  height: 32px;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
  cursor: pointer;
}
.sign-out button:hover { background: var(--bg); border-color: var(--line); }
.theme-toggle {
  width: 32px;
  height: 32px;
  background: transparent;
  color: var(--muted);
  border: 0;
  border-radius: 8px;
  padding: 0;
  box-shadow: none;
  cursor: pointer;
}
.theme-toggle svg { width: 16px; height: 16px; display: block; }
.theme-toggle .icon-sun { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-moon { display: none; }
:root[data-theme="dark"] .theme-toggle .icon-sun { display: block; }
.theme-toggle:hover { color: var(--heading); background: var(--bg); }
.nav .nav-secondary { display: grid; gap: 2px; }
.nav .nav-secondary a {
  text-decoration: none;
  font-size: 13px;
  padding: 5px 10px;
  border-radius: 6px;
  color: var(--muted);
}
.nav .nav-secondary a:hover { background: var(--bg); color: var(--heading); }
.nav .nav-secondary a.active { background: var(--nav-active); color: var(--nav-active-ink); }

.main { padding: 24px 32px 48px; min-width: 0; }
.notice, .banner {
  border: 1px solid var(--info-border);
  background: var(--info-bg);
  color: var(--info);
  border-radius: 8px;
  padding: 10px 12px;
  margin: 0 0 16px;
}
.notice.bad, .banner.bad { border-color: var(--bad-border); background: var(--bad-bg); color: var(--bad); }
h1, h2, h3 { color: var(--heading); }
h1 { font-size: 22px; letter-spacing: -0.02em; margin: 0; font-weight: 600; line-height: 1.25; }
h2 { font-size: 15px; letter-spacing: -0.015em; margin: 24px 0 8px; font-weight: 600; line-height: 1.35; }
h3 { font-size: 14px; letter-spacing: -0.01em; margin: 16px 0 8px; font-weight: 600; }
.sub, .muted, .help { color: var(--muted); }
.help { font-size: 13px; line-height: 1.5; font-weight: 400; }
.toolbar, .row, .filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.page-head { display: grid; gap: 12px; margin-bottom: 8px; }
.page-head h1 { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 12px; margin: 16px 0; }
.card, .panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px;
  box-shadow: var(--shadow);
}
.stat { display: flex; flex-direction: column; gap: 4px; min-height: 92px; }
.stat-label { color: var(--muted); font-size: 12px; font-weight: 500; }
.stat-value { font-size: 22px; letter-spacing: -0.02em; font-weight: 600; color: var(--heading); line-height: 1.2; font-variant-numeric: tabular-nums; }
.stat-foot { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; color: var(--muted); font-size: 13px; }
.stat-from, .stat-note { color: var(--muted); font-size: 13px; }
:root[data-theme="dark"] .stat-from,
:root[data-theme="dark"] .stat-note { color: var(--muted); }
.delta {
  display: inline-flex;
  align-items: center;
  border-radius: 6px;
  padding: 1px 6px;
  font-size: 12px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.delta.up { color: var(--good); background: var(--good-bg); }
.delta.down { color: var(--bad); background: var(--bad-bg); border: 1px solid var(--bad-border); }
:root[data-theme="dark"] .sub,
:root[data-theme="dark"] .muted,
:root[data-theme="dark"] .help { color: #94a3b8; }
:root[data-theme="dark"] .delta.up { color: var(--good); background: var(--good-bg); }
:root[data-theme="dark"] .delta.down { color: var(--bad); background: var(--bad-bg); border-color: var(--bad-border); }
.good { color: var(--good); }
.bad { color: var(--bad); }
.new { color: var(--accent); }
.paused { opacity: 0.55; }

.filters { align-items: flex-start; }
.filter-bar { display: flex; flex-wrap: nowrap; gap: 8px; align-items: center; min-width: 0; }
.filter-bar .pill-select { min-width: 0; }
.filter-bar .pill-select select { max-width: 168px; }
.more-filters-panel .pill-select { max-width: 100%; }
.more-filters-panel .pill-select select { width: 160px; min-width: 120px; max-width: 100%; }
.more-filters { position: relative; }
.more-filters > summary {
  list-style: none;
  height: 28px;
  display: inline-flex;
  align-items: center;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--heading);
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
}
.more-filters > summary::-webkit-details-marker { display: none; }
.more-filters-panel {
  position: absolute;
  z-index: 20;
  top: 36px;
  left: 0;
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  width: max-content;
  max-width: min(420px, 80vw);
  padding: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.filters-toggle { display: none; }
.segmented {
  display: inline-flex;
  height: 28px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  overflow: hidden;
  box-shadow: none;
}
.segmented button {
  height: 28px;
  border: 0;
  border-radius: 0;
  background: transparent;
  color: var(--muted);
  padding: 0 8px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  box-shadow: none;
}
.segmented button + button { border-left: 1px solid var(--line); }
.segmented button.on { background: var(--nav-active); color: var(--nav-active-ink); }
.pill-select, .search-field {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  height: 28px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  box-shadow: none;
  color: var(--muted);
  font-size: 13px;
  font-weight: 500;
}
.pill-select span, .search-field span { font-size: 12px; }
.pill-select select, .pill-select input, .search-field input {
  border: 0;
  background: transparent;
  height: 26px;
  padding: 0 14px 0 0;
  min-width: 0;
  width: auto;
  color: var(--heading);
  font-weight: 500;
  font-size: 13px;
  box-shadow: none;
}
.pill-select { position: relative; padding-right: 22px; }
.pill-select select { appearance: none; cursor: pointer; }
.pill-select::after {
  content: "";
  position: absolute;
  right: 10px;
  top: 10px;
  border-right: 1.5px solid var(--muted);
  border-bottom: 1.5px solid var(--muted);
  width: 5px;
  height: 5px;
  transform: rotate(45deg);
  pointer-events: none;
}
.search-field { padding-left: 10px; }
.search-field svg { width: 14px; height: 14px; flex: none; }
.search-field input { width: 160px; padding-right: 0; }
.filter-chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; width: 100%; }
.filter-chip, .text-link {
  border: 0;
  background: transparent;
  cursor: pointer;
  font-size: 13px;
}
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 24px;
  padding: 0 8px;
  border-radius: 6px;
  background: var(--bg);
  color: var(--heading);
  border: 1px solid var(--line);
  font-weight: 500;
}
.text-link { color: var(--heading); text-decoration: underline; padding: 0 4px; height: auto; }
.filter-sheet { display: contents; }

.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { fill: var(--chart-ink); }
.chart .grid-line { stroke: var(--grid); }
.chart .series-own { stroke: var(--accent); }
.chart .end-label.own { fill: var(--good); font-weight: 600; }
.chart .source-switch { stroke: var(--heading); }
.chart .source-label { fill: var(--heading); }
:root[data-theme="dark"] .chart .end-label.own { fill: var(--good); }
.legend { display: flex; gap: 8px; flex-wrap: wrap; font-size: 13px; margin-top: 8px; }
.swatch { width: 10px; height: 10px; display: inline-block; margin-right: 6px; border-radius: 99px; }
.table-wrap { overflow-x: auto; max-width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: var(--shadow); }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: 0.02em; }
th a { color: inherit; text-decoration: none; }
tr.click:hover td { background: var(--bg); cursor: pointer; }
.tag, .chip, .pill {
  display: inline-block;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 1px 8px;
  margin: 0 4px 4px 0;
  font-size: 12px;
  font-weight: 500;
  background: var(--surface);
}
.chip.own, .pill.own { background: var(--accent-soft); color: var(--good); border-color: #b7e4d0; }
.pill.daily { background: var(--accent-soft); border-color: #b7e4d0; color: var(--good); }
.pill.weekly { background: #f8fafc; border-color: var(--slate-3); color: var(--slate); }
.pill.off { background: var(--bg); border-color: var(--line); color: var(--muted); }
.bar-track { height: 8px; background: var(--bg); border-radius: 99px; width: 140px; display: inline-block; vertical-align: middle; }
.bar-fill { height: 8px; background: var(--slate-2); border-radius: 99px; }
.bar-fill.own { background: var(--accent); }
.answer, pre.answer {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 12px;
  max-height: 360px;
  overflow: auto;
  font-size: 13px;
  line-height: 1.5;
}
.answer { white-space: normal; }
.answer h2, .answer h3 { font-size: 15px; margin: 8px 0 4px; }
.answer p { margin: 6px 0; }
.answer ul { margin: 6px 0 6px 18px; }
.answer a { text-decoration: underline; }
.cited { margin-top: 6px; }
pre.answer { white-space: pre-wrap; }
.chart-wrap { position: relative; }
.chart-controls { display: flex; justify-content: flex-end; gap: 6px; flex-wrap: wrap; margin: 0 0 4px; row-gap: 10px; }
.chart-controls button { height: 28px; padding: 0 8px; font-size: 13px; border: 1px solid var(--line); border-radius: 6px; box-shadow: none; }
.chart-controls button.on, .tabs a.on { background: var(--nav-active); color: var(--nav-active-ink); border-color: var(--nav-active); }
.chart-mode { margin: 0 0 6px; }
.chart .series-hit { fill: none; stroke: transparent; stroke-width: 14px; pointer-events: stroke; cursor: pointer; }
.chart path.series { pointer-events: none; }
.chart .guide { stroke: var(--heading); stroke-opacity: 0.35; stroke-width: 1px; pointer-events: none; }
.chart-wrap.is-hot path.series,
.chart-wrap.is-hot circle.series { opacity: 0.18; }
.chart-wrap.is-hot path.series.is-hi,
.chart-wrap.is-hot circle.series.is-hi { opacity: 1; }
.chart-wrap.is-hot .legend button { opacity: 0.4; }
.chart-wrap.is-hot .legend button.is-hi { opacity: 1; }
.chart-tip {
  position: absolute;
  z-index: 3;
  min-width: 168px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
  font-size: 12px;
  line-height: 1.45;
  pointer-events: none;
  box-shadow: 0 8px 24px rgba(10, 37, 64, 0.12);
}
.chart-tip[hidden] { display: none !important; }
.chart-tip .tip-date { color: var(--muted); margin-bottom: 4px; }
.chart-tip .tip-row { display: flex; justify-content: space-between; gap: 16px; }
.chart-tip .tip-row.own { font-weight: 600; color: var(--good); }
.legend button.legend-item {
  background: transparent;
  color: var(--ink);
  border: 0;
  border-radius: 6px;
  padding: 2px 8px;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-weight: 500;
  line-height: 1.3;
  cursor: pointer;
  box-shadow: none;
}
.legend button.legend-item.own { font-weight: 600; }
.legend button.legend-item.off { opacity: 0.38; text-decoration: line-through; }
.legend button.legend-item:hover,
.legend button.legend-item.is-hi { background: var(--bg); }
label { display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
input, select, textarea {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 8px 10px;
}
input[type="checkbox"],
input[type="radio"] {
  accent-color: var(--accent);
}
form[data-action="save-engines"] input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  padding: 0;
}
textarea { width: min(640px, 100%); min-height: 90px; }
button, .button {
  height: 32px;
  background: var(--primary);
  color: var(--on-primary);
  border: 1px solid var(--primary-border);
  border-radius: 8px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.14);
}
button:hover, .button:hover { background: var(--primary-hover); color: var(--on-primary-hover); }
button.ghost, .button.ghost {
  height: 32px;
  background: transparent;
  color: var(--muted);
  border: 0;
  box-shadow: none;
  font-weight: 500;
}
button.ghost:hover, .button.ghost:hover { background: var(--bg); color: var(--heading); }
button.filters-toggle {
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--slate);
  box-shadow: none;
}
button.filters-toggle:hover { background: var(--bg); }
button.danger, button.danger:hover { background: #9f2d2d; color: #f7f9fc; border-color: #7a2424; box-shadow: none; }
button:disabled { opacity: 0.6; cursor: default; }
.skeleton { height: 14px; background: linear-gradient(90deg, var(--line), var(--surface), var(--line)); background-size: 200% 100%; animation: shine 1.2s infinite; border-radius: 6px; margin: 8px 0; }
@keyframes shine { to { background-position: -200% 0; } }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.tabs + .tabs { margin-top: 10px; }
.tabs a.button { text-decoration: none; border: 1px solid var(--line); border-radius: 6px; height: 28px; padding: 0 8px; display: inline-flex; align-items: center; color: var(--muted); background: var(--surface); font-size: 13px; font-weight: 500; box-shadow: none; }
.grain button { padding: 6px 10px; }
.typebar { display: flex; height: 12px; border-radius: 99px; overflow: hidden; background: var(--bg); margin: 8px 0; }
.typebar span { display: block; height: 100%; }
.type-you { background: var(--accent); }
.type-competitor { background: #64748b; }
.type-ugc { background: #475569; }
.type-corporate { background: #94a3b8; }
.swatch.type-you { background: var(--accent); }
.swatch.type-competitor { background: #64748b; }
.swatch.type-ugc { background: #475569; }
.swatch.type-corporate { background: #94a3b8; }
mark.own { background: #c7f0df; color: inherit; }
mark.comp { background: #e2e8f0; color: inherit; }
td.heat { text-align: right; font-variant-numeric: tabular-nums; }
.kicker { font-size: 12px; color: var(--muted); font-weight: 500; letter-spacing: 0; }
footer { margin-top: 32px; color: var(--muted); font-size: 12px; }
footer a { color: var(--heading); }
#add-panel:not([hidden]) { display: grid; gap: 10px; margin: 8px 0 14px; }
.topic-block { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); margin: 10px 0; box-shadow: var(--shadow); }
.topic-block > summary { display: flex; gap: 10px; align-items: baseline; flex-wrap: wrap; cursor: pointer; padding: 12px 14px; list-style: none; }
.topic-block > summary::-webkit-details-marker { display: none; }
.topic-block > summary::before { content: "▸"; color: var(--muted); }
.topic-block[open] > summary::before { content: "▾"; }
.topic-name { font-weight: 600; letter-spacing: -0.01em; }
.topic-body { padding: 0 14px 12px; display: grid; gap: 8px; }
.topic-tools { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.topic-tools form { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.prompt-row { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 8px 0; border-top: 1px solid var(--line); }
.prompt-main, .prompt-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; min-width: 0; }
.prompt-main { flex: 1 1 240px; }
button.prompt-text { height: auto; background: transparent; color: inherit; border: 0; padding: 0; box-shadow: none; text-align: left; cursor: text; font: inherit; font-weight: 400; white-space: normal; overflow-wrap: anywhere; }
button.icon { height: 28px; background: transparent; color: var(--ink); border: 1px solid var(--line); padding: 0 8px; box-shadow: none; line-height: 1; }
button.icon.danger { color: var(--bad); background: transparent; border-color: var(--line); }
button.filter-chip, button.text-link, button.legend-item { height: auto; box-shadow: none; }
button.chip { background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 6px; height: auto; padding: 1px 8px; font-size: 12px; box-shadow: none; }
.add-row, #add-panel, .topic-block, .prompt-row, .prompt-main, .prompt-meta, .topic-tools { max-width: 100%; min-width: 0; }
.add-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.add-row textarea, .add-row input, .add-row select, .prompt-edit { min-width: 0; max-width: 100%; }
.add-row textarea, .prompt-edit { min-height: 38px; width: min(480px, 100%); }
label.check { display: flex; align-items: center; gap: 6px; }
.country-field { display: flex; align-items: center; gap: 6px; }
.country-field input, select.move-topic { width: 7.5rem; padding: 4px 6px; }
button[data-action=scan-new]:disabled { cursor: not-allowed; opacity: 0.45; }
.import-block { margin-top: 12px; }
.tag-field summary { cursor: pointer; width: fit-content; }
.split { display: grid; grid-template-columns: 1.2fr 0.8fr; gap: 16px; }
form.stack { display: grid; gap: 10px; max-width: 640px; margin: 12px 0; }
form.stack fieldset { border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; display: grid; gap: 4px; }
form.stack fieldset label { display: flex; gap: 8px; align-items: center; font-weight: normal; }
form.stack button { justify-self: start; }
#api-key-once code { word-break: break-all; user-select: all; }
.loader { text-align: center; padding: 64px 16px; }
.loader h2 { margin-bottom: 8px; }
.orbit { width: 88px; height: 88px; margin: 0 auto 20px; border-radius: 50%; border: 3px solid var(--line); border-top-color: var(--accent); animation: spin 0.9s linear infinite; position: relative; }
.orbit::after { content: ""; position: absolute; inset: 16px; border-radius: 50%; border: 3px solid transparent; border-bottom-color: var(--good); animation: spin 1.4s linear infinite reverse; }
.checklist { margin: 8px 0 0; padding-left: 18px; }
.plan-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; }
.plan-price { font-size: 28px; margin: 0 0 8px; color: var(--heading); font-variant-numeric: tabular-nums; }
.plan-price span { font-size: 14px; color: var(--muted); }
@keyframes spin { to { transform: rotate(360deg); } }
.prompt-label { margin: 0 0 6px; }

:root[data-theme="dark"] .segmented button:not(.on),
:root[data-theme="dark"] .sign-out button,
:root[data-theme="dark"] button.chip,
:root[data-theme="dark"] .filter-chip,
:root[data-theme="dark"] .tag,
:root[data-theme="dark"] .pill {
  color: #e2e8f0;
}
:root[data-theme="dark"] .sign-out button,
:root[data-theme="dark"] button.chip,
:root[data-theme="dark"] .filter-chip { background: #12263a; }
:root[data-theme="dark"] .pill.own,
:root[data-theme="dark"] .chip.own,
:root[data-theme="dark"] .pill.daily { color: var(--good); background: var(--accent-soft); }
:root[data-theme="dark"] button.filters-toggle { color: #94a3b8; }

@media (max-width: 800px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .nav {
    position: static;
    height: auto;
    max-width: 100%;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto auto;
    gap: 8px 8px;
    padding: 10px 12px 8px;
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }
  .brand { grid-column: 1; grid-row: 1; margin: 0; min-width: 0; }
  .nav-foot { display: contents; }
  .theme-toggle { grid-column: 2; grid-row: 1; }
  .sign-out { grid-column: 3; grid-row: 1; width: auto; }
  .sign-out button { width: auto; }
  .nav > .project-switch { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; margin: 0; }
  .nav > .project-switch:first-of-type { grid-row: 2; }
  .nav > .project-switch:nth-of-type(2) { grid-row: 3; }
  .nav > .project-switch select { height: 32px; min-width: 0; flex: 1; }
  .nav .side-nav { grid-column: 1 / -1; grid-row: 4; display: flex; overflow-x: auto; max-width: 100%; }
  .nav .nav-secondary { grid-column: 1 / -1; grid-row: 5; display: flex; flex-wrap: wrap; overflow: visible; gap: 8px; }
  .main, .panel, .toolbar { max-width: 100%; min-width: 0; }
  .main { padding: 16px; }
  input, select, textarea { max-width: 100%; }
  .stats, .split { grid-template-columns: 1fr 1fr; }
  .page-head { display: grid; }
  .filters-toggle { display: inline-flex; align-items: center; gap: 6px; }
  .filter-bar { display: none; }
  .filters.is-open .filter-bar {
    display: flex;
    flex-direction: column;
    align-items: stretch;
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    max-height: 80vh;
    overflow: auto;
    padding: 16px 16px 24px;
    background: var(--surface);
    border-top: 1px solid var(--line);
    box-shadow: 0 -12px 32px rgba(10, 37, 64, 0.16);
  }
  .filters.is-open .pill-select,
  .filters.is-open .search-field,
  .filters.is-open .segmented { width: 100%; }
  .filters.is-open .search-field input { width: 100%; }
  .filter-bar { flex-wrap: wrap; }
  .more-filters-panel { position: static; width: auto; max-width: none; box-shadow: none; padding: 0; border: 0; }
}
.settings-nav { display: flex; flex-wrap: wrap; gap: 8px; margin: 12px 0 16px; row-gap: 10px; }
.settings-nav button {
  height: 28px;
  padding: 0 8px;
  font-size: 13px;
  border-radius: 6px;
  background: var(--surface);
  color: var(--heading);
  border: 1px solid var(--line);
  box-shadow: none;
}
.settings-nav button.on,
.settings-nav button.on:hover { background: var(--nav-active); color: var(--nav-active-ink); border-color: var(--nav-active); }
.sign-out button:hover { background: var(--bg); color: var(--ink); border-color: var(--line); }
.segmented button:hover { background: var(--bg); color: var(--heading); box-shadow: none; }
.segmented button.on,
.segmented button.on:hover,
.tabs a.on,
.tabs a.on:hover,
.chart-controls button.on,
.chart-controls button.on:hover { background: var(--nav-active); color: var(--nav-active-ink); border-color: var(--nav-active); }
#signup > button[type="submit"],
#signup > button[type="submit"]:hover,
#signup > button[type="submit"]:active {
  background: #0a2540;
  color: #ffffff;
  border-color: #0a2540;
}
:root[data-theme="dark"] #signup > button[type="submit"],
:root[data-theme="dark"] #signup > button[type="submit"]:hover,
:root[data-theme="dark"] #signup > button[type="submit"]:active {
  background: var(--nav-active);
  color: #ffffff;
  border-color: var(--nav-active);
}
button.legend-item:hover,
button.filter-chip:hover,
button.text-link:hover { background: var(--bg); color: var(--heading); box-shadow: none; }
button.icon:hover { background: var(--bg); color: var(--ink); }

.checkout { display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(260px, 0.85fr); gap: 16px; align-items: start; }
.checkout-summary { position: sticky; top: 16px; }
.checkout-form fieldset { border: 1px solid var(--line); border-radius: 8px; margin: 0 0 12px; padding: 12px; display: grid; gap: 10px; }
.checkout-form legend { padding: 0 4px; font-weight: 650; }
.checkout .choice { display: flex; gap: 16px; flex-wrap: wrap; }
.checkout label { color: var(--ink); font-size: 14px; }
.checkout input, .checkout select, .checkout textarea { width: 100%; font-size: 16px; }
.checkout input:focus-visible, .checkout select:focus-visible, .checkout textarea:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.totals { margin: 12px 0 0; }
.totals div { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); }
.totals dt { color: var(--muted); }
.totals dd { margin: 0; font-variant-numeric: tabular-nums; }
.vat-status { min-height: 1.2em; margin: 0; font-size: 14px; }
.vat-status.is-valid { color: var(--good); }
.vat-status.is-invalid, .vat-status.is-down { color: var(--bad); }
.spinner { width: 14px; height: 14px; border: 2px solid var(--line); border-top-color: var(--accent); border-radius: 50%; display: inline-block; margin-right: 6px; vertical-align: -2px; animation: spin 0.8s linear infinite; }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation: none; }
}
@media (max-width: 800px) {
  .checkout { grid-template-columns: 1fr; }
  .checkout-summary { position: static; order: -1; }
}

.billing-head { display: flex; justify-content: space-between; gap: 16px; align-items: flex-start; margin-bottom: 12px; }
.billing-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.billing .plan-price { font-weight: 650; }
.billing-status {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 2px 8px;
  background: var(--info-bg);
  color: var(--info);
  border: 1px solid var(--info-border);
  font-size: 12px;
  font-weight: 650;
}
.billing-status.is-active,
.billing-status.is-canceling { background: var(--good-bg); color: var(--good); border-color: transparent; }
.billing-status.is-past_due,
.billing-status.is-canceled,
.billing-status.is-requires_action { background: var(--bad-bg); color: var(--bad); border-color: var(--bad-border); }
@media (max-width: 800px) {
  .billing-grid, .billing-head { grid-template-columns: 1fr; }
  .billing-head { display: grid; }
}
