/* Series colours (s1-s6) are a fixed order checked for colour-blind separation on these card surfaces, light and dark:
   ChatGPT is always s1 and Claude always s2. Status colours (ok/warn/bad) only ever mean good or bad. */
:root {
  --bg: #f6f4f2;
  --card: #ffffff;
  --ink: #1d1a19;
  --ink-2: #4a4542;
  --muted: #6d6662;
  --line: #e6e0dc;
  --grid: #eeeae6;
  --axis: #cfc8c3;
  --accent: #e4585b;
  --accent-ink: #ffffff;
  --ok: #1f8f5f;
  --warn: #b7791f;
  --bad: #c9373a;
  --s1: #2a78d6;
  --s2: #eb6834;
  --s3: #1baf7a;
  --s4: #eda100;
  --s5: #e87ba4;
  --s6: #6250d6;
  --neutral: #c4bcb6;
  --chatgpt: var(--s1);
  --claude: var(--s2);
  --found: color-mix(in oklab, var(--s1) 20%, var(--card));
  --empty-cell: #f3f0ed;
  --code-bg: #f1ece8;
  --hover: #f7f4f1;
  --shadow: 0 1px 2px rgba(30, 20, 15, 0.05), 0 4px 14px rgba(30, 20, 15, 0.04);
  color-scheme: light;
}
/* Dark: from the system setting unless the viewer picked light with the switch, or when they picked dark. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151312;
    --card: #1f1c1b;
    --ink: #f1ece9;
    --ink-2: #cfc7c2;
    --muted: #a39b96;
    --line: #34302e;
    --grid: #2b2826;
    --axis: #45403d;
    --accent-ink: #1d1a19;
    --ok: #4cc38a;
    --warn: #e0b24a;
    --bad: #ff7b7e;
    --s1: #3987e5;
    --s2: #d95926;
    --s3: #199e70;
    --s4: #c98500;
    --s5: #d55181;
    --s6: #9085e9;
    --neutral: #5b5552;
    --found: color-mix(in oklab, var(--s1) 26%, var(--card));
    --empty-cell: #262321;
    --code-bg: #2a2625;
    --hover: #262321;
    --shadow: none;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151312;
  --card: #1f1c1b;
  --ink: #f1ece9;
  --ink-2: #cfc7c2;
  --muted: #a39b96;
  --line: #34302e;
  --grid: #2b2826;
  --axis: #45403d;
  --accent-ink: #1d1a19;
  --ok: #4cc38a;
  --warn: #e0b24a;
  --bad: #ff7b7e;
  --s1: #3987e5;
  --s2: #d95926;
  --s3: #199e70;
  --s4: #c98500;
  --s5: #d55181;
  --s6: #9085e9;
  --neutral: #5b5552;
  --found: color-mix(in oklab, var(--s1) 26%, var(--card));
  --empty-cell: #262321;
  --code-bg: #2a2625;
  --hover: #262321;
  --shadow: none;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font: 14px/1.5 system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; }
[hidden] { display: none !important; }
h1, h2, h3 { margin: 0; line-height: 1.25; }
h1 { font-size: 19px; }
h2 { font-size: 14.5px; font-weight: 650; }
h3 { font-size: 12px; color: var(--muted); font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; }
a { color: var(--s1); }
code, pre { font: 12.5px/1.45 ui-monospace, 'SF Mono', Menlo, Consolas, monospace; }
code { background: var(--code-bg); padding: 1px 5px; border-radius: 4px; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.small { font-size: 12.5px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.error { color: var(--bad); margin: 0; }
.spacer { flex: 1; }
button { font: inherit; color: inherit; }

/* ---------------------------------------------------------------- sign-in */
.login { min-height: 100vh; display: grid; place-items: center; padding: 16px; }
.login-card { width: min(400px, 100%); display: grid; gap: 16px; padding: 26px; }
.login-title { font-size: 21px; }
.login-sub { margin: 2px 0 0; }
.login-form { display: grid; gap: 12px; }
.login-form p { margin: 0; }
#login-methods { display: grid; gap: 14px; }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12.5px; }
.or::before, .or::after { content: ''; flex: 1; border-top: 1px solid var(--line); }
.btn.google { display: inline-flex; align-items: center; justify-content: center; gap: 10px; text-decoration: none; padding: 9px 12px; }
.btn.google svg { width: 18px; height: 18px; }
.login .link { justify-self: start; color: var(--muted); }
.login .link:hover { color: var(--ink); }
.me { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field { display: grid; gap: 6px; font-weight: 600; font-size: 13px; }
input, select, textarea { font: inherit; color: var(--ink); background: var(--bg); border: 1px solid var(--line); border-radius: 8px; padding: 7px 10px; }
input:focus-visible, select:focus-visible, textarea:focus-visible, button:focus-visible, a:focus-visible, [tabindex]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.btn { font: inherit; font-weight: 600; border: 1px solid var(--line); background: var(--card); color: var(--ink); border-radius: 8px; padding: 7px 12px; cursor: pointer; white-space: nowrap; }
.btn:hover { border-color: var(--muted); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn.ghost { background: transparent; }
.btn.small { padding: 4px 10px; font-size: 12.5px; }
.btn[disabled] { opacity: 0.5; cursor: default; }
.link { background: none; border: 0; padding: 0; color: var(--s1); cursor: pointer; text-decoration: underline; }

/* ---------------------------------------------------------------- header and filters */
.sticky { position: sticky; top: 0; z-index: 10; }
.top { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding: 10px 20px; background: var(--card); border-bottom: 1px solid var(--line); }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 700; }
.brand small { font-weight: 500; color: var(--muted); }
.logo { width: 28px; height: auto; display: block; flex: none; }
.tabs { display: flex; gap: 2px; flex: 1; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.tab { font-weight: 600; padding: 7px 12px; border-radius: 8px; color: var(--muted); text-decoration: none; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px; }
.tab:hover { color: var(--ink); }
.tab.active { color: var(--ink); background: var(--code-bg); }
.tools { display: flex; align-items: center; gap: 8px; }
.theme-switch { display: inline-flex; align-items: center; gap: 6px; }
.theme-switch svg { width: 15px; height: 15px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.login-tools { position: fixed; top: 12px; right: 16px; }
.pill { display: inline-block; min-width: 20px; padding: 0 6px; border-radius: 999px; font-size: 11.5px; font-weight: 700; text-align: center; background: var(--code-bg); color: var(--ink); line-height: 18px; }
.pill.warn { background: var(--bad); color: #fff; }

.filters { background: color-mix(in oklab, var(--bg) 88%, transparent); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); }
.filters-inner { max-width: 1280px; margin: 0 auto; padding: 8px 20px; display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; }
.segmented { display: inline-flex; background: var(--code-bg); border-radius: 9px; padding: 2px; gap: 2px; }
.seg { border: 0; background: none; padding: 4px 11px; border-radius: 7px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.seg:hover { color: var(--ink); }
.seg.on { background: var(--card); color: var(--ink); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }

/* ---------------------------------------------------------------- layout */
.main { max-width: 1280px; margin: 0 auto; padding: 18px 20px 48px; }
.main.loading > * { opacity: 0.55; transition: opacity 0.15s; pointer-events: none; }
.view { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); padding: 16px; min-width: 0; }
.card > h2 + * { margin-top: 12px; }
.grid { display: grid; gap: 16px; min-width: 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.three { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid.main-side { grid-template-columns: minmax(0, 1.75fr) minmax(0, 1fr); }
.grid.stats { grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); }
.stack { display: grid; gap: 16px; align-content: start; min-width: 0; }
@media (max-width: 1080px) { .grid.three { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 900px) { .grid.two, .grid.three, .grid.main-side { grid-template-columns: minmax(0, 1fr); } }

.panel { display: grid; grid-template-columns: minmax(0, 1fr); gap: 12px; align-content: start; }
.panel > *, .view > *, .stack > * { min-width: 0; }
.panel-head { display: flex; align-items: start; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.panel-head h2 { display: flex; align-items: center; gap: 6px; }
.panel-desc { margin: 2px 0 0; color: var(--muted); font-size: 12.5px; }
.panel-actions { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.info { width: 17px; height: 17px; border-radius: 50%; border: 1px solid var(--line); background: none; color: var(--muted); font: italic 600 10.5px/15px Georgia, serif; padding: 0; cursor: help; flex: none; }
.info:hover { color: var(--ink); border-color: var(--muted); }
.notice { margin: 0; padding: 10px 12px; border-radius: 8px; background: var(--code-bg); color: var(--ink-2); }
.empty { margin: 0; padding: 26px 8px; text-align: center; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
.actions.center { justify-content: center; }
.actions.center:empty { display: none; }

.banner { display: flex; flex-wrap: wrap; gap: 4px 12px; align-items: center; width: 100%; text-align: left; border: 1px solid color-mix(in oklab, var(--bad) 40%, var(--line)); background: color-mix(in oklab, var(--bad) 8%, var(--card)); border-radius: 10px; padding: 10px 14px; cursor: pointer; }
.banner b { color: var(--bad); }
.banner span { color: var(--ink-2); }
.setup .steps { margin: 0; padding-left: 20px; display: grid; gap: 8px; }

/* ---------------------------------------------------------------- headline numbers */
.tiles { display: grid; gap: 12px; grid-template-columns: repeat(auto-fit, minmax(168px, 1fr)); }
.tiles.small { grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); }
.tile { display: grid; gap: 2px; align-content: start; text-align: left; position: relative; overflow: hidden; padding: 14px 14px 12px; }
.tile.clickable { cursor: pointer; font: inherit; color: inherit; }
.tile.clickable:hover { border-color: var(--axis); }
.tile-label { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 12.5px; font-weight: 600; }
.tile-value { font-size: 27px; font-weight: 650; letter-spacing: -0.01em; line-height: 1.2; }
.tiles.small .tile-value { font-size: 21px; }
.tile-foot { display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; font-size: 12px; color: var(--muted); min-height: 18px; }
.delta { font-weight: 700; font-size: 12px; }
.delta.good { color: var(--ok); }
.delta.bad { color: var(--bad); }
.delta.flat { color: var(--muted); }
.spark { width: 100%; height: 28px; margin-top: 6px; display: block; }
.spark .line { fill: none; stroke-width: 1.5; stroke-linejoin: round; stroke-linecap: round; }
.spark .wash { opacity: 0.1; }

/* old System screen pieces */
.stat .value { font-size: 28px; font-weight: 700; margin-top: 4px; }
.stat .sub { color: var(--muted); font-size: 12.5px; }
.stat.bad .value { color: var(--bad); }
.stat.ok .value { color: var(--ok); }
.bars { display: grid; gap: 8px; }
.bar-row { display: grid; grid-template-columns: minmax(120px, 190px) 1fr 44px; gap: 10px; align-items: center; font-size: 13px; }
.bar { height: 8px; border-radius: 999px; background: var(--code-bg); overflow: hidden; }
.bar > span { display: block; height: 100%; background: var(--s1); border-radius: 999px; }

/* ---------------------------------------------------------------- charts */
.chart-box { width: 100%; min-height: 40px; }
.chart { display: block; overflow: visible; }
.chart .grid { stroke: var(--grid); stroke-width: 1; }
.chart .baseline { stroke: var(--axis); stroke-width: 1; }
.chart .tick { fill: var(--muted); font-size: 11px; font-variant-numeric: tabular-nums; }
.chart .cap { fill: var(--ink-2); font-size: 11px; font-weight: 600; }
.chart .hit { fill: transparent; outline: none; }
.chart .hit:hover, .chart .hit:focus-visible { fill: color-mix(in oklab, var(--ink) 5%, transparent); }
.chart .hit.pick { cursor: pointer; }
.chart .line { fill: none; stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .wash { opacity: 0.1; }
.chart .dot { stroke: var(--card); stroke-width: 2; }
.chart .cross { stroke: var(--axis); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: 6px 16px; color: var(--ink-2); font-size: 12.5px; }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: none; }
.swatch.line { height: 3px; width: 14px; border-radius: 2px; }

.tip { position: fixed; z-index: 50; pointer-events: none; background: var(--card); color: var(--ink); border: 1px solid var(--line); border-radius: 8px; box-shadow: 0 6px 24px rgba(0, 0, 0, 0.16); padding: 8px 10px; font-size: 12.5px; max-width: 320px; display: grid; gap: 3px; }
.tip-title { font-weight: 650; color: var(--ink-2); margin-bottom: 2px; overflow-wrap: anywhere; }
.tip-row { display: flex; align-items: center; gap: 7px; overflow-wrap: anywhere; }
.tip-row b { font-variant-numeric: tabular-nums; }
.tip-row span { color: var(--muted); }
.tip-row.text span { color: var(--ink); line-height: 1.45; }
.tip .key { width: 9px; height: 9px; border-radius: 2px; flex: none; }
.tip .key.line { width: 12px; height: 3px; }

.donut-wrap { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
.donut { width: 132px; height: 132px; flex: none; }
.donut .slice { outline: none; }
.donut .slice:hover, .donut .slice:focus-visible { opacity: 0.82; }
.donut .slice.pick { cursor: pointer; }
.donut-empty { fill: none; stroke: var(--empty-cell); }
.donut-value { fill: var(--ink); font-size: 19px; font-weight: 650; }
.donut-label { fill: var(--muted); font-size: 9.5px; }
.donut-key { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; flex: 1; min-width: 180px; font-size: 13px; }
.donut-key li { display: grid; grid-template-columns: 12px 1fr auto 44px; gap: 8px; align-items: center; }
.donut-key li.pick { cursor: pointer; border-radius: 6px; }
.donut-key li.pick:hover { background: var(--hover); }
.donut-key b { font-variant-numeric: tabular-nums; }
.k-pct { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; font-size: 12px; }

.rank { display: grid; gap: 4px; }
.rank-row { display: grid; grid-template-columns: minmax(110px, 38%) 1fr auto; gap: 10px; align-items: center; font-size: 13px; padding: 4px 6px; margin: 0 -6px; border-radius: 7px; border: 0; background: none; text-align: left; width: calc(100% + 12px); }
.rank-row.pick { cursor: pointer; }
.rank-row.pick:hover { background: var(--hover); }
.rank-label { display: flex; align-items: center; gap: 7px; min-width: 0; }
.rank-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rank-track { height: 8px; border-radius: 0 4px 4px 0; position: relative; }
.rank-track.layered { height: 10px; outline: none; }
.rank-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.rank-track.layered .rank-fill { position: absolute; left: 0; top: 0; }
.rank-fill.found { background: var(--found); }
.rank-fill.cited { background: var(--s1); }
.rank-value { font-variant-numeric: tabular-nums; font-weight: 600; text-align: right; white-space: nowrap; }
.rank-value small { color: var(--muted); font-weight: 500; margin-left: 4px; }

.funnel { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.funnel-top { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; font-size: 13px; }
.funnel-label small { color: var(--muted); margin-left: 6px; }
.funnel-top b { font-size: 16px; font-variant-numeric: tabular-nums; }
.funnel-track { height: 14px; margin-top: 4px; }
.funnel-fill { display: block; height: 100%; border-radius: 0 4px 4px 0; }
.funnel-rate { color: var(--muted); font-size: 12px; margin-top: 2px; }

.heat-wrap { display: grid; gap: 8px; overflow-x: auto; }
.heat { display: grid; grid-template-columns: 32px repeat(24, minmax(10px, 1fr)); gap: 2px; min-width: 360px; font-size: 10.5px; color: var(--muted); align-items: center; }
.heat-cell { aspect-ratio: 1; border-radius: 3px; outline: none; }
.heat-cell:hover, .heat-cell:focus-visible { box-shadow: 0 0 0 2px var(--ink); }
.heat-hour { text-align: left; font-variant-numeric: tabular-nums; }
.heat-scale { display: flex; align-items: center; gap: 3px; font-size: 11.5px; color: var(--muted); justify-content: flex-end; }
.heat-scale i { width: 14px; height: 10px; border-radius: 2px; }
.heat-scale span { margin: 0 4px; }

table.cohort td.cell { color: var(--ink); font-weight: 600; outline: none; }
table.cohort td.cell.on-dark { color: #fff; }
table.cohort td.future { background: repeating-linear-gradient(135deg, transparent 0 4px, var(--grid) 4px 5px); }
table.cohort td, table.cohort th { padding: 6px 8px; }

.meter { display: inline-block; width: 64px; height: 6px; border-radius: 3px; background: var(--empty-cell); overflow: hidden; vertical-align: middle; }
.meter > span { display: block; height: 100%; }
.rate { display: inline-flex; align-items: center; gap: 8px; font-variant-numeric: tabular-nums; }
.split { display: inline-flex; width: 80px; height: 6px; border-radius: 3px; overflow: hidden; gap: 2px; vertical-align: middle; outline: none; }
.split > span { display: block; height: 100%; }

/* ---------------------------------------------------------------- tables */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line); white-space: nowrap; vertical-align: middle; }
th { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 600; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.wrap { white-space: normal; overflow-wrap: anywhere; min-width: 160px; }
tbody tr:last-child td { border-bottom: 0; }
tr.click { cursor: pointer; }
tr.click:hover td { background: var(--hover); }
.mini-table table td, .mini-table table th { padding: 5px 8px; }
.person { display: grid; line-height: 1.3; }
.tags { display: inline-flex; gap: 4px; }

.tag { display: inline-block; padding: 1px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 600; background: var(--code-bg); white-space: nowrap; }
.tag.chatgpt, .tag.claude { color: var(--ink); }
.tag.chatgpt::before, .tag.claude::before { content: ''; display: inline-block; width: 7px; height: 7px; border-radius: 50%; margin-right: 5px; vertical-align: 0; }
.tag.chatgpt::before { background: var(--chatgpt); }
.tag.claude::before { background: var(--claude); }
.tag.open, .tag.hard, .tag.failed, .tag.rolled_back { color: var(--bad); }
.tag.fixed, .tag.ok, .tag.merged { color: var(--ok); }
.tag.ignored, .tag.soft, .tag.no_turn { color: var(--warn); }
.tag.timeout, .tag.error { color: var(--bad); }
.tag.repairing, .tag.triggered { color: var(--warn); }
.tag.proposed { color: var(--s1); }

/* ---------------------------------------------------------------- lists, toolbars, chips */
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 8px 10px; }
.list-panel .toolbar { justify-content: flex-start; }
.search { min-width: 0; flex: 1 1 260px; max-width: 420px; background: var(--bg); }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font-weight: 600; font-size: 12.5px; border: 1px solid var(--line); background: var(--card); color: var(--muted); border-radius: 999px; padding: 3px 11px; cursor: pointer; }
.chip:hover { color: var(--ink); }
.chip.active { background: var(--ink); color: var(--card); border-color: var(--ink); }
.toggle { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }

.feed { display: grid; gap: 2px; }
.feed-item, .prompt-card { display: grid; gap: 5px; text-align: left; background: none; border: 0; border-radius: 9px; padding: 9px 10px; margin: 0 -10px; cursor: pointer; width: calc(100% + 20px); min-width: 0; }
.feed-item:hover, .prompt-card:hover { background: var(--hover); }
.feed-top, .pc-top { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; font-size: 12px; }
.feed-top .counts { margin-left: auto; color: var(--muted); }
.feed-prompt { font-weight: 550; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.prompt-list { display: grid; gap: 2px; }
.prompt-card { border-bottom: 1px solid var(--line); border-radius: 0; padding: 12px 10px; }
.prompt-card:last-child { border-bottom: 0; }
.prompt-card:hover { border-radius: 9px; }
.pc-prompt { font-weight: 600; font-size: 14.5px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow-wrap: anywhere; }
.pc-who { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 260px; }
.pc-counts { display: inline-flex; gap: 12px; color: var(--muted); }
.pc-counts b { color: var(--ink); font-variant-numeric: tabular-nums; }
.pc-sites { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 12px; }
.q-line { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; min-width: 0; }
.q-line .fan { color: var(--muted); }
.q-line .more { font-size: 12px; }
.q-chip { display: inline-flex; align-items: center; gap: 5px; max-width: 100%; border: 1px solid color-mix(in oklab, var(--s1) 30%, var(--line)); background: color-mix(in oklab, var(--s1) 7%, var(--card)); color: var(--ink); border-radius: 7px; padding: 2px 8px; font-size: 12.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; cursor: pointer; }
.q-chip.static { cursor: inherit; }
.q-chip small { font-size: 10.5px; font-weight: 700; color: var(--s1); }
button.q-chip:hover { border-color: var(--s1); }
.site { display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 0; cursor: pointer; color: inherit; font-size: inherit; min-width: 0; }
.site span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
button.site:hover span:last-child { text-decoration: underline; }
.site.static { cursor: inherit; }
.site-mark { --hue: 200; width: 18px; height: 18px; border-radius: 5px; flex: none; display: inline-grid; place-items: center; font-size: 10.5px; font-weight: 700; background: oklch(0.93 0.035 var(--hue)); color: oklch(0.42 0.07 var(--hue)); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .site-mark { background: oklch(0.33 0.04 var(--hue)); color: oklch(0.86 0.05 var(--hue)); } }
:root[data-theme="dark"] .site-mark { background: oklch(0.33 0.04 var(--hue)); color: oklch(0.86 0.05 var(--hue)); }

.cloud { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; }
.cloud-word { --w: 1; border: 0; background: none; padding: 1px 2px; cursor: pointer; font-weight: 600; color: color-mix(in oklab, var(--ink) calc(var(--w) * 100%), var(--muted)); border-radius: 4px; }
.cloud-word:hover { color: var(--s1); }

.pages { margin: 0; padding-left: 20px; display: grid; gap: 8px; }
.pages a { overflow-wrap: anywhere; font-weight: 550; text-decoration: none; color: var(--ink); }
.pages a:hover { text-decoration: underline; }
ul.plain { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
ul.plain a { overflow-wrap: anywhere; }
.row-button { display: flex; align-items: center; gap: 8px; width: 100%; text-align: left; border: 0; background: none; padding: 7px 8px; border-radius: 7px; cursor: pointer; min-width: 0; }
.row-button:hover { background: var(--hover); }
.row-button .grow { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------------------------------------------------------------- the fan-out tree */
.prompt-text { margin: 0; padding: 12px 14px; border-left: 3px solid var(--accent); background: var(--card); border-radius: 0 10px 10px 0; font-size: 15px; font-weight: 550; white-space: pre-wrap; overflow-wrap: anywhere; }
.tree { font-size: 13px; }
.tree ul { list-style: none; margin: 0; padding: 0 0 0 22px; }
.tree li { position: relative; padding: 6px 0 0 14px; }
.tree li::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; border-left: 1.5px solid var(--axis); }
.tree li:last-child::before { bottom: auto; height: 20px; }
.tree li::after { content: ''; position: absolute; left: 0; top: 20px; width: 12px; border-top: 1.5px solid var(--axis); }
.node { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 8px; max-width: 100%; }
.node.root { padding: 8px 12px; border-radius: 9px; background: var(--code-bg); font-weight: 600; overflow-wrap: anywhere; display: flex; }
.node-kind { font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); }
.node.round-node { padding: 3px 0; }
.node.query .q-chip { white-space: normal; text-align: left; }
.srcs { display: flex; flex-wrap: wrap; gap: 5px; margin: 6px 0 2px; }
.src { display: inline-flex; align-items: center; gap: 5px; padding: 2px 8px 2px 3px; border-radius: 7px; border: 1px solid var(--line); background: var(--card); font-size: 12px; color: var(--ink-2); text-decoration: none; max-width: 100%; }
.src span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.src:hover { border-color: var(--axis); }
.src.cited { border-color: color-mix(in oklab, var(--ok) 45%, var(--line)); color: var(--ink); }
.src .star { font-size: 10.5px; color: var(--ok); }
ol.chat { margin: 0; padding-left: 22px; display: grid; gap: 2px; }
ol.chat button { display: grid; gap: 1px; text-align: left; width: 100%; border: 0; background: none; border-radius: 7px; padding: 6px 8px; cursor: pointer; }
ol.chat button:hover:not([disabled]) { background: var(--hover); }
ol.chat li.current button { background: var(--code-bg); cursor: default; font-weight: 600; }

/* ---------------------------------------------------------------- side panel */
.drawer-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.4); display: flex; justify-content: flex-end; z-index: 20; }
html.drawer-open { overflow: hidden; }
.drawer { width: min(860px, 100%); height: 100%; overflow-y: auto; overflow-x: hidden; overscroll-behavior: contain; background: var(--bg); padding: 18px; display: grid; gap: 14px; align-content: start; outline: none; }
.drawer > * { min-width: 0; }
.drawer-head { display: flex; justify-content: space-between; gap: 12px; align-items: start; }
.drawer-title { min-width: 0; }
.drawer-title h1 { overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: 140px 1fr; gap: 6px 12px; margin: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
pre.sample { margin: 0; max-height: 360px; overflow: auto; padding: 12px; border-radius: 8px; background: var(--code-bg); }
textarea.note { width: 100%; min-height: 64px; resize: vertical; }

.subtabs { display: flex; gap: 4px; flex-wrap: wrap; }
.subtab { border: 1px solid var(--line); background: var(--card); padding: 5px 12px; border-radius: 8px; font-weight: 600; font-size: 13px; color: var(--muted); cursor: pointer; display: inline-flex; gap: 6px; align-items: center; }
.subtab.on { color: var(--ink); border-color: var(--ink); }

@media (max-width: 760px) {
  .tabs { order: 3; flex-basis: 100%; }
}
@media (max-width: 640px) {
  .main { padding: 12px 16px 40px; }
  .top { padding: 8px 16px; }
  .filters-inner { padding: 8px 16px; }
  .kv { grid-template-columns: 1fr; }
  .tile-value { font-size: 22px; }
  .tiles { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
  .tile { padding: 12px; }
  .sticky { position: static; }
  .rank-row { grid-template-columns: minmax(90px, 42%) 1fr auto; }
  .drawer { padding: 14px 16px; }
  #updated { display: none; }
  .theme-switch [data-label] { display: none; }
  .me { display: none; }
  .tab { padding: 6px 9px; }
}
@media (forced-colors: active) {
  .rank-fill, .funnel-fill, .heat-cell, .meter > span, .split > span { forced-color-adjust: none; }
}
