/* Brainfeed app. Cobalt accent, cool neutrals, Host Grotesk for all UI text, DM Mono for paths, dates and counts. */
:root {
  color-scheme: light;
  --bg: oklch(0.985 0.004 258);
  --surface: #fff;
  --sunk: oklch(0.962 0.008 258);
  --ink: oklch(0.19 0.035 262);
  --muted: oklch(0.43 0.025 262);
  --faint: oklch(0.5 0.02 262);
  --line: oklch(0.915 0.01 260);
  --line-strong: oklch(0.84 0.02 260);
  --blue: oklch(0.52 0.235 262);
  --blue-deep: oklch(0.42 0.2 263);
  --blue-ink: oklch(0.34 0.15 264);
  --blue-soft: oklch(0.955 0.035 262);
  --green: oklch(0.45 0.12 160);
  --green-soft: oklch(0.955 0.04 160);
  --red: oklch(0.5 0.19 28);
  --red-soft: oklch(0.96 0.03 25);
  --amber: oklch(0.45 0.1 70);
  --amber-soft: oklch(0.96 0.045 85);
  --dark: oklch(0.17 0.03 262);
  --font: "Host Grotesk", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", sans-serif;
  --display: var(--font);
  --mono: "DM Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
  --ease: cubic-bezier(.22, 1, .36, 1);
  --lift: 0 1px 2px oklch(0.2 0.05 262 / .06), 0 24px 48px -24px oklch(0.2 0.08 262 / .22);
}
* { box-sizing: border-box; }
html { scroll-padding-top: 88px; }
body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--font); font-size: 15px; line-height: 1.55; -webkit-font-smoothing: antialiased; overflow-x: clip; }
img { max-width: 100%; }
a { color: inherit; }
h1, h2, h3 { font-family: var(--display); text-wrap: balance; margin: 0; }
p { margin: 0; }
[hidden] { display: none !important; }
.boot { padding: 48px; color: var(--muted); }
.skip { position: absolute; left: 16px; top: -64px; z-index: 100; background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 10px; font-weight: 500; text-decoration: none; }
.skip:focus { top: 12px; }
:is(.btn, a, input, textarea, select, summary, button, [tabindex]):focus-visible { outline: 2px solid var(--blue); outline-offset: 3px; }

/* icons as masks, same set as the marketing site */
.ico { display: inline-block; width: 1.15em; height: 1.15em; flex: none; background: currentColor; -webkit-mask: var(--i) center / contain no-repeat; mask: var(--i) center / contain no-repeat; vertical-align: -0.2em; }
.i-arrow { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/arrow-right.svg); }
.i-ext { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/arrow-up-right.svg); }
.i-check { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/check.svg); }
.i-x { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/x.svg); }
.i-copy { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/copy.svg); }
.i-file { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/file-text.svg); }
.i-inbox { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/layers.svg); }
.i-notes { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/book-open.svg); }
.i-rss { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/rss.svg); }
.i-plug { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/plug.svg); }
.i-gear { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/settings.svg); }
.i-skip { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/skip-forward.svg); }
.i-edit { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/pencil.svg); }
.i-undo { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/undo-2.svg); }
.i-play { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/play.svg); }
.i-down { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/download.svg); }
.i-lock { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/lock.svg); }
.i-plus { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/plus.svg); }
.i-link { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/link-2.svg); }
.i-warn { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/triangle-alert.svg); }
.i-dot { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/circle-dot.svg); }
.i-alert { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/git-compare.svg); }
.i-spark { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/sparkles.svg); }
.fav { width: 20px; height: 20px; border-radius: 5px; flex: none; background: var(--sunk); object-fit: cover; }
.fav-lg { width: 28px; height: 28px; border-radius: 7px; }
.fav-fb { display: inline-grid; place-items: center; width: 20px; height: 20px; border-radius: 5px; background: var(--blue-soft); color: var(--blue-ink); font-size: 11px; font-weight: 700; flex: none; }
.fav-lg.fav-fb { width: 28px; height: 28px; border-radius: 7px; font-size: 13px; }

/* buttons: same as the marketing site */
.btn { font: inherit; font-size: 15px; font-weight: 500; display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 12px; padding: 10px 18px; cursor: pointer; transition: background .15s, border-color .15s, transform .2s var(--ease); text-decoration: none; white-space: nowrap; line-height: 1.3; }
.btn:active:not(:disabled) { transform: translateY(1px); }
.btn-blue { background: var(--blue); color: #fff; box-shadow: 0 1px 0 oklch(1 0 0 / .25) inset, 0 8px 20px -10px oklch(0.45 0.22 262 / .7); }
.btn-blue:hover:not(:disabled) { background: var(--blue-deep); }
.btn-dark { background: var(--ink); color: #fff; }
.btn-dark:hover:not(:disabled) { background: oklch(0.28 0.04 262); }
.btn-ghost { background: var(--surface); border-color: var(--line-strong); color: var(--ink); }
.btn-ghost:hover:not(:disabled) { border-color: var(--ink); }
.btn-danger { color: var(--red); }
.btn-sm { font-size: 14px; padding: 7px 14px; border-radius: 10px; }
.btn-lg { font-size: 16px; padding: 13px 26px; }
.btn:disabled { opacity: .5; cursor: default; }
.btn kbd, .kbd { font-family: var(--mono); font-size: 11px; font-weight: 500; border: 1px solid currentColor; border-radius: 5px; padding: 0 5px; opacity: .65; line-height: 1.5; }
.link { font: inherit; color: var(--blue-deep); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }

/* fields */
.field { display: grid; gap: 6px; }
.field > label, .lbl { font-size: 14px; font-weight: 500; }
.input { font: inherit; font-size: 16px; padding: 11px 14px; border-radius: 12px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); width: 100%; min-width: 0; }
.input::placeholder { color: var(--faint); }
.input:focus-visible { outline: 2px solid var(--blue); outline-offset: 1px; border-color: var(--blue); }
textarea.input { resize: vertical; line-height: 1.45; }
.mono { font-family: var(--mono); font-size: 14px; }
.hint { color: var(--muted); font-size: 14px; }
.hp { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

/* shell */
.shell { display: grid; grid-template-columns: 232px minmax(0, 1fr); min-height: 100vh; min-height: 100dvh; }
.side { position: sticky; top: 0; height: 100vh; height: 100dvh; display: flex; flex-direction: column; padding: 20px 14px 16px; border-right: 1px solid var(--line); background: var(--bg); }
.logo { display: inline-flex; align-items: center; gap: 10px; font-family: var(--display); font-weight: 700; font-size: 20px; letter-spacing: -0.03em; text-decoration: none; padding: 0 8px; }
.nav { display: grid; gap: 2px; margin-top: 28px; }
.nav a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; text-decoration: none; font-weight: 500; color: var(--muted); }
.nav a:hover { background: var(--sunk); color: var(--ink); }
.nav a[aria-current="page"] { background: var(--blue-soft); color: var(--blue-ink); }
.nav .badge { margin-left: auto; font-size: 12px; font-weight: 600; background: var(--blue); color: #fff; border-radius: 999px; padding: 0 8px; min-width: 22px; text-align: center; line-height: 20px; }
.side-foot { margin-top: auto; padding: 14px 10px 0; border-top: 1px solid var(--line); display: grid; gap: 4px; font-size: 13px; color: var(--muted); }
.side-foot b { color: var(--ink); font-weight: 500; overflow-wrap: anywhere; }
.agent-state { display: flex; align-items: center; gap: 8px; }
.pulse { width: 8px; height: 8px; border-radius: 50%; background: var(--faint); flex: none; }
.pulse.on { background: var(--green); }
.pulse.run { background: var(--blue); animation: blink 1.1s ease-in-out infinite; }
@keyframes blink { 50% { opacity: .3; } }
.main { padding: 36px clamp(20px, 4vw, 56px) 96px; min-width: 0; }
.page { max-width: 1120px; margin: 0 auto; }
.page-narrow { max-width: 760px; margin: 0 auto; }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px 32px; flex-wrap: wrap; margin-bottom: 28px; }
.head h1 { font-size: clamp(28px, 3.2vw, 38px); line-height: 1.05; letter-spacing: -0.035em; font-weight: 700; }
.head .lede { color: var(--muted); margin-top: 8px; max-width: 38em; text-wrap: pretty; font-size: 16px; }
.head-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tabs { display: inline-flex; gap: 2px; padding: 3px; background: var(--sunk); border-radius: 12px; margin-bottom: 24px; }
.tabs a { padding: 6px 16px; border-radius: 9px; text-decoration: none; font-weight: 500; color: var(--muted); font-size: 14px; }
.tabs a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line); }
h2.sec { font-size: 21px; letter-spacing: -0.025em; font-weight: 600; margin: 0 0 14px; }

/* relation chip: text and color together */
.rel { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 12px 4px 10px; border-radius: 999px; width: fit-content; }
.rel-builds { background: var(--blue-soft); color: var(--blue-ink); }
.rel-new { background: var(--green-soft); color: var(--green); }
.rel-conflict { background: var(--red-soft); color: var(--red); }

/* queue */
.agent-line { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.queue-grid { display: grid; grid-template-columns: minmax(0, 1fr) 320px; gap: clamp(24px, 4vw, 56px); align-items: start; }
.stack { max-width: 640px; width: 100%; outline: none; }
.pile { position: relative; margin-bottom: 20px; }
.pile::before, .pile::after { content: ""; position: absolute; inset: 0; border: 1px solid var(--line); border-radius: 20px; background: var(--surface); }
.pile.l2::before { transform: translateY(14px) scale(.94); opacity: .55; }
.pile.l2::after { transform: translateY(7px) scale(.97); opacity: .85; }
.pile.l1::after { transform: translateY(7px) scale(.97); opacity: .85; }
.pile.l1::before, .pile.l0::before, .pile.l0::after { display: none; }
.card { position: relative; z-index: 1; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 20px; padding: 26px 28px 24px; display: flex; flex-direction: column; gap: 14px; cursor: grab; user-select: none; -webkit-user-select: none; touch-action: pan-y; box-shadow: var(--lift); }
.card.dragging { cursor: grabbing; transition: none; }
.card.snap { transition: transform .3s var(--ease); }
.card.editing { cursor: default; user-select: text; }
.c-src { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 14px; flex-wrap: wrap; }
.c-src b { color: var(--ink); font-weight: 600; }
.c-src .date { margin-left: auto; font-family: var(--mono); font-size: 12px; }
.c-title { font-family: var(--display); font-size: clamp(22px, 2.4vw, 27px); line-height: 1.18; letter-spacing: -0.025em; font-weight: 600; text-wrap: balance; }
.c-idea { font-size: 16px; line-height: 1.55; color: var(--ink); text-wrap: pretty; }
.c-why { color: var(--muted); font-size: 14.5px; line-height: 1.5; padding-top: 12px; border-top: 1px solid var(--line); }
.c-why b { color: var(--ink); font-weight: 600; }
.c-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.c-link { font-size: 14px; color: var(--blue-deep); text-decoration: none; font-weight: 500; display: inline-flex; gap: 4px; align-items: center; max-width: 100%; }
.c-link:hover { text-decoration: underline; text-underline-offset: 3px; }
.c-link span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 28ch; }
.stamp { position: absolute; top: 18px; font-weight: 700; font-size: 14px; padding: 3px 12px; border-radius: 8px; border: 2px solid; opacity: 0; background: var(--surface); text-transform: uppercase; letter-spacing: .06em; pointer-events: none; }
.stamp-yes { right: 20px; color: var(--green); transform: rotate(6deg); }
.stamp-no { left: 20px; color: var(--red); transform: rotate(-6deg); }
.card[data-dir="yes"] .stamp-yes, .card[data-dir="no"] .stamp-no { opacity: 1; }
.edit-form { display: grid; gap: 12px; }
.edit-form .count { font-size: 12px; color: var(--muted); text-align: right; font-family: var(--mono); }
.actions { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.actions .btn-blue { margin-left: auto; }
.actions .btn { min-width: 0; }
.undo-bar { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; margin-top: 16px; padding: 10px 14px; border-radius: 14px; background: var(--sunk); border: 1px solid var(--line); font-size: 14px; }
.undo-bar .what { font-weight: 500; }
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip { font: inherit; font-size: 13px; font-weight: 500; padding: 4px 12px; border-radius: 999px; border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink); cursor: pointer; }
.chip:hover { border-color: var(--ink); }
.undo-bar .link { margin-left: auto; font-size: 14px; display: inline-flex; gap: 6px; align-items: center; text-decoration: none; font-weight: 600; }
.keys { margin-top: 16px; color: var(--muted); font-size: 13px; display: flex; gap: 6px 16px; flex-wrap: wrap; }
.keys .kbd { margin-right: 4px; }
.brain { border-left: 1px solid var(--line); padding-left: clamp(20px, 3vw, 36px); display: grid; gap: 22px; position: sticky; top: 32px; }
.brain h2 { font-size: 17px; font-weight: 600; letter-spacing: -0.02em; }
.brain .path { font-family: var(--mono); font-size: 13px; color: var(--muted); overflow-wrap: anywhere; }
.brain .note-title { font-weight: 600; font-size: 16px; margin-top: 6px; }
.heads { margin: 10px 0 0; padding: 0; list-style: none; display: grid; gap: 2px; font-size: 14px; color: var(--muted); }
.heads li { padding: 4px 0 4px 12px; border-left: 1px solid var(--line-strong); }
.brain .reason { font-size: 14px; color: var(--muted); margin-top: 12px; }
.kv { display: grid; gap: 6px; font-size: 14px; color: var(--muted); }
.kv b { color: var(--ink); font-weight: 500; }
.topic-list { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.topic-list span { font-size: 13px; padding: 2px 10px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); }

/* states */
.state { padding: 56px 0 24px; max-width: 520px; display: grid; gap: 12px; justify-items: start; }
.state h2 { font-size: clamp(26px, 3vw, 34px); letter-spacing: -0.03em; }
.state p { color: var(--muted); text-wrap: pretty; font-size: 16px; }
.state .actions { margin-top: 8px; }
.err { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; padding: 12px 16px; border-radius: 12px; background: var(--red-soft); color: var(--red); font-weight: 500; }
.err .btn { margin-left: auto; }
.skeleton { border-radius: 12px; background: var(--sunk); height: 14px; }
.skel-card { height: 320px; border-radius: 20px; border: 1px solid var(--line); background: var(--sunk); max-width: 640px; }
@media (prefers-reduced-motion: no-preference) {
  .skeleton, .skel-card { animation: breathe 1.4s ease-in-out infinite; }
  @keyframes breathe { 50% { opacity: .55; } }
}
.progress { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; width: 100%; max-width: 420px; }
.progress i { display: block; height: 100%; width: 35%; background: var(--blue); border-radius: 3px; }
@media (prefers-reduced-motion: no-preference) {
  .progress i { animation: slide 1.4s ease-in-out infinite; }
  @keyframes slide { 0% { transform: translateX(-100%); } 100% { transform: translateX(300%); } }
}
@media (prefers-reduced-motion: reduce) { .progress i { width: 60%; } }
.running { display: grid; gap: 14px; padding: 28px 0; max-width: 520px; }
.running h2 { font-size: 26px; letter-spacing: -0.03em; }
.running .meta { color: var(--muted); font-size: 15px; font-variant-numeric: tabular-nums; }

/* overview */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); border-block: 1px solid var(--line-strong); }
.stat { padding: 20px 24px 20px 0; }
.stat + .stat { padding-left: 24px; border-left: 1px solid var(--line); }
.stat b { display: block; font-family: var(--display); font-size: clamp(32px, 3.6vw, 44px); line-height: 1; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; }
.stat span { display: block; margin-top: 6px; color: var(--muted); font-size: 14px; }
.stat.good b { color: var(--green); }
.ov-grid { display: grid; grid-template-columns: minmax(0, 7fr) minmax(0, 5fr); gap: clamp(28px, 5vw, 64px); margin-top: 44px; }
.chart { width: 100%; height: auto; display: block; overflow: visible; }
.chart text { font-family: var(--font); font-size: 12px; fill: var(--muted); }
.chart .bar { fill: var(--blue); }
.chart .bar.below { fill: oklch(0.72 0.12 262); }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .target { stroke: var(--ink); stroke-width: 1.5; stroke-dasharray: 5 4; }
.chart .tl { fill: var(--ink); font-weight: 600; }
.legend { display: flex; gap: 8px 20px; flex-wrap: wrap; font-size: 13px; color: var(--muted); margin-top: 12px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; margin-right: 6px; vertical-align: -1px; }
.rows { list-style: none; margin: 0; padding: 0; }
.rows li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 16px; padding: 12px 0; border-top: 1px solid var(--line); font-size: 14px; }
.rows li:last-child { border-bottom: 1px solid var(--line); }
.rows .t { font-weight: 500; }
.rows .s { color: var(--muted); text-align: right; font-variant-numeric: tabular-nums; }
.rows .bad { color: var(--red); grid-column: 1 / -1; }

/* notes */
.search { position: relative; max-width: 420px; flex: 1 1 260px; }
.notes-list { list-style: none; margin: 8px 0 0; padding: 0; }
.note { border-top: 1px solid var(--line); padding: 20px 0; display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 16px; }
.note:last-child { border-bottom: 1px solid var(--line); }
.note .n-main { min-width: 0; display: grid; gap: 8px; }
.note h3, .note .n-title { font-size: 19px; letter-spacing: -0.02em; font-weight: 600; }
.n-meta { display: flex; gap: 6px 12px; flex-wrap: wrap; align-items: center; color: var(--muted); font-size: 13.5px; }
.note p { color: var(--ink); font-size: 15px; text-wrap: pretty; }
.note details summary { cursor: pointer; color: var(--blue-deep); font-size: 14px; font-weight: 500; width: fit-content; }
.md { margin: 10px 0 0; padding: 14px 16px; background: var(--sunk); border: 1px solid var(--line); border-radius: 12px; font-family: var(--mono); font-size: 12.5px; line-height: 1.7; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--ink); }

/* sources */
.src { display: grid; grid-template-columns: 28px minmax(0, 1fr) 150px auto; gap: 4px 20px; align-items: center; padding: 16px 0; border-top: 1px solid var(--line); }
.src:last-child { border-bottom: 1px solid var(--line); }
.src .s-main { min-width: 0; }
.src h3 { font-size: 17px; letter-spacing: -0.015em; font-weight: 600; font-family: var(--font); }
.src h3 span { font-weight: 400; color: var(--muted); font-size: 14px; margin-left: 6px; }
.src .blurb { color: var(--muted); font-size: 14px; margin-top: 2px; text-wrap: pretty; }
.src .tp { color: var(--faint); font-size: 13px; margin-top: 4px; }
.weight { font-size: 12px; color: var(--muted); display: grid; gap: 4px; }
.weight .track { height: 6px; border-radius: 3px; background: var(--line); overflow: hidden; }
.weight .track i { display: block; height: 100%; background: var(--blue); border-radius: 3px; }
.switch { position: relative; display: inline-flex; }
.switch input { position: absolute; inset: 0; opacity: 0; cursor: pointer; margin: 0; width: 100%; height: 100%; }
.switch span { width: 44px; height: 26px; border-radius: 999px; background: var(--line-strong); transition: background .15s; position: relative; display: block; }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px oklch(0.2 0.05 262 / .3); }
.switch input:checked + span { background: var(--blue); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--blue); outline-offset: 3px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { opacity: .45; }
.savebar { position: sticky; bottom: 16px; margin-top: 24px; display: flex; align-items: center; gap: 12px 16px; flex-wrap: wrap; padding: 12px 16px; background: var(--ink); color: #fff; border-radius: 16px; box-shadow: var(--lift); z-index: 5; }
.savebar span { font-size: 14px; }
.savebar .btn { margin-left: auto; }
.savebar .btn-ghost { background: transparent; color: #fff; border-color: oklch(1 0 0 / .3); }
.count-pill { font-size: 13px; padding: 3px 12px; border-radius: 999px; background: var(--sunk); border: 1px solid var(--line); font-weight: 500; }

/* connect */
.block { margin-top: 36px; }
.block > p { color: var(--muted); margin: -6px 0 14px; max-width: 40em; text-wrap: pretty; }
.code { background: oklch(0.13 0.025 262); border-radius: 16px; overflow: hidden; color: oklch(0.9 0.02 262); }
.code-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 12px 10px 18px; border-bottom: 1px solid oklch(1 0 0 / .1); font-family: var(--mono); font-size: 12px; color: oklch(0.78 0.03 262); }
.code pre { margin: 0; padding: 18px 20px; overflow-x: auto; font-family: var(--mono); font-size: 13px; line-height: 1.75; }
.code code { white-space: pre; font-family: inherit; }
.code .btn-ghost { background: oklch(1 0 0 / .08); border-color: oklch(1 0 0 / .25); color: #fff; }
.code .btn-ghost:hover:not(:disabled) { border-color: oklch(0.78 0.12 262); }
.fresh { padding: 18px 20px; border: 1px solid var(--blue); background: var(--blue-soft); border-radius: 16px; display: grid; gap: 10px; margin-top: 16px; }
.fresh b { font-weight: 600; }
.tok-row { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.tok-val { font-family: var(--mono); font-size: 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 10px; padding: 8px 12px; overflow-wrap: anywhere; flex: 1 1 280px; min-width: 0; user-select: all; }
.tok-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: flex-end; margin-top: 16px; }
.tok-form .field { flex: 1 1 220px; max-width: 320px; }
.tokens { list-style: none; margin: 18px 0 0; padding: 0; }
.tokens li { display: flex; align-items: center; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line); flex-wrap: wrap; }
.tokens li:last-child { border-bottom: 1px solid var(--line); }
.tokens .t { font-weight: 500; }
.tokens .d { color: var(--muted); font-size: 14px; }
.tokens .btn { margin-left: auto; }

/* settings */
.set-row { display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 20px 0; border-top: 1px solid var(--line); }
.set-row:last-of-type { border-bottom: 1px solid var(--line); }
.set-row h3 { font-family: var(--font); font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.set-row p { color: var(--muted); font-size: 14px; margin-top: 2px; max-width: 34em; }

/* onboarding */
.steps { display: flex; gap: 8px 24px; flex-wrap: wrap; margin-bottom: 28px; font-size: 14px; color: var(--muted); }
.steps li { list-style: none; display: inline-flex; align-items: center; gap: 8px; }
.steps ol { display: contents; }
.steps .n { width: 24px; height: 24px; border-radius: 50%; display: grid; place-items: center; background: var(--sunk); border: 1px solid var(--line-strong); font-size: 12px; font-weight: 600; }
.steps .on { color: var(--ink); font-weight: 600; }
.steps .on .n { background: var(--blue); border-color: var(--blue); color: #fff; }
.steps .done .n { background: var(--green-soft); border-color: transparent; color: var(--green); }
.ob { max-width: 720px; }
.ob h1 { font-size: clamp(30px, 4vw, 46px); line-height: 1.02; letter-spacing: -0.04em; font-weight: 700; }
.ob .lede { color: var(--muted); font-size: 17px; margin-top: 14px; max-width: 34em; text-wrap: pretty; }
.ob-form { margin-top: 32px; display: grid; gap: 14px; }
.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row .input { flex: 1 1 260px; }
.token-box summary { cursor: pointer; color: var(--blue-deep); font-weight: 500; width: fit-content; }
.token-box .field { margin-top: 12px; }
.status { color: var(--muted); min-height: 1.5em; display: flex; align-items: center; gap: 10px; }
.cli-line { margin-top: 36px; padding-top: 20px; border-top: 1px solid var(--line); color: var(--muted); font-size: 14px; display: grid; gap: 8px; }
.cli-line code { font-family: var(--mono); font-size: 13px; background: var(--sunk); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; width: fit-content; max-width: 100%; overflow-x: auto; }
.topic { display: grid; grid-template-columns: minmax(120px, 200px) 1fr; gap: 16px; align-items: center; padding: 6px 0; font-size: 14.5px; }
.bar { height: 8px; border-radius: 4px; background: var(--line); overflow: hidden; }
.bar i { display: block; height: 100%; background: var(--blue); border-radius: 4px; }
.pick-list { list-style: none; margin: 8px 0 0; padding: 0; }
.pick-list li { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: 4px 14px; padding: 14px 0; border-top: 1px solid var(--line); }
.pick-list li:last-child { border-bottom: 1px solid var(--line); }
.pick-list b { font-weight: 600; }
.pick-list .by { color: var(--muted); font-weight: 400; margin-left: 6px; }
.pick-list .why { grid-column: 2; color: var(--muted); font-size: 14px; }
.ob-sec { margin-top: 36px; }

/* auth */
.auth { min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); }
.auth-side { background: var(--blue); color: #fff; padding: clamp(32px, 5vw, 72px); display: flex; flex-direction: column; gap: 32px; justify-content: space-between; }
.auth-side .logo { color: #fff; padding: 0; }
.auth-side h1 { font-size: clamp(34px, 4.4vw, 58px); line-height: 1; letter-spacing: -0.04em; font-weight: 700; max-width: 11em; }
.auth-side ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; font-size: 17px; color: oklch(0.97 0.02 262); }
.auth-side li { display: flex; gap: 10px; align-items: baseline; }
.auth-main { display: grid; place-items: center; padding: 32px 24px; }
.auth-box { width: 100%; max-width: 420px; display: grid; gap: 20px; }
.auth-box h2 { font-size: 30px; letter-spacing: -0.03em; font-weight: 700; }
.auth-box .tabs { margin: 0; justify-self: start; }
.auth-box form { display: grid; gap: 14px; }
.auth-box .btn { width: 100%; }
.form-msg { min-height: 1.4em; font-size: 14px; color: var(--red); font-weight: 500; }
.keyshow { display: grid; gap: 14px; }
.keyshow .tok-val { font-size: 15px; padding: 14px; flex-basis: 100%; }
.note-box { padding: 12px 14px; border-radius: 12px; background: var(--amber-soft); color: var(--amber); font-size: 14px; font-weight: 500; }

/* toasts */
.toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: max-content; max-width: calc(100vw - 32px); pointer-events: none; }
.toast { background: var(--ink); color: #fff; padding: 10px 18px; border-radius: 12px; font-size: 14px; font-weight: 500; box-shadow: var(--lift); }
.toast.bad { background: var(--red); }

/* responsive */
@media (max-width: 1100px) {
  .queue-grid { grid-template-columns: 1fr; }
  .brain { border-left: 0; padding-left: 0; border-top: 1px solid var(--line); padding-top: 28px; position: static; max-width: 640px; }
  .ov-grid { grid-template-columns: 1fr; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; }
  .side { position: sticky; top: 0; z-index: 20; height: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px 16px 0; border-right: 0; border-bottom: 1px solid var(--line); gap: 0 12px; }
  .side .logo { padding: 0; font-size: 18px; }
  .side-foot { display: none; }
  .nav { order: 3; width: calc(100% + 32px); margin: 8px -16px 0; display: flex; overflow-x: auto; gap: 2px; padding: 0 12px 8px; scrollbar-width: none; }
  .nav::-webkit-scrollbar { display: none; }
  .nav a { flex: none; padding: 7px 12px; }
  .main { padding-top: 24px; }
  .auth { grid-template-columns: minmax(0, 1fr); }
  .auth-side { gap: 20px; padding: 24px 20px 28px; }
  .auth-side ul { display: none; }
  .auth-side h1 { font-size: 30px; }
}
@media (max-width: 640px) {
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .stat:nth-child(3) { padding-left: 0; border-left: 0; }
  .stat:nth-child(n+3) { border-top: 1px solid var(--line); }
  .card { padding: 20px 18px; }
  .actions .btn { flex: 1 1 calc(50% - 10px); }
  .actions .btn-blue { margin-left: 0; order: -1; flex-basis: 100%; }
  .src { grid-template-columns: 28px minmax(0, 1fr) auto; }
  .src .weight { grid-column: 2 / -1; grid-row: 2; max-width: 220px; }
  .note { grid-template-columns: 28px minmax(0, 1fr); }
  .note > .btn { grid-column: 2; justify-self: start; }
  .topic { grid-template-columns: 1fr; gap: 6px; }
  .set-row { align-items: flex-start; }
  .keys { display: none; }
  .c-link span { max-width: 22ch; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; animation-iteration-count: 1 !important; }
  .card.snap { transition: none; }
}

/* add link, custom feeds, integrations */
.add-link { margin: 0 0 24px; max-width: 640px; }
.add-link .row .input { flex: 1 1 260px; }
.add-link .form-msg { color: var(--muted); font-weight: 400; margin-top: 6px; }
.custom { margin-bottom: 36px; }
.src-end { display: flex; align-items: center; gap: 12px; }
.int { padding: 22px 0; border-top: 1px solid var(--line); max-width: 760px; }
.int:last-child { border-bottom: 1px solid var(--line); }
.int h3 { font-family: var(--font); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; margin-bottom: 6px; }
.int > p { color: var(--muted); max-width: 40em; text-wrap: pretty; }
.int a { color: var(--blue-deep); }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; flex-basis: 100%; }
.check input { width: 18px; height: 18px; accent-color: var(--blue); }
@media (max-width: 640px) { .src-end { grid-column: 2 / -1; } }

.int .tok-form { margin-top: 14px; }
.n-pr { color: var(--blue, #0b3fd6); font-weight: 600; text-decoration: none; }
.n-pr:hover { text-decoration: underline; }

.brain-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; font-weight: 600; padding: 4px 12px 4px 10px; border-radius: 999px; width: fit-content; background: var(--blue-soft, #e8f0fe); color: var(--blue-deep, #0b3fd6); }
.brain-filter { max-width: 320px; margin-bottom: 14px; }
.bind { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; margin-top: 10px; }
.bind-l { font-size: 13px; font-weight: 600; color: var(--muted); margin-right: 4px; }
.bind-chip[aria-pressed="true"] { background: var(--ink); color: var(--surface, #fff); border-color: var(--ink); }
.brain-row { padding: 18px 0; border-top: 1px solid var(--line); }
.brain-row:first-of-type { border-top: 0; }
.br-head { display: flex; flex-wrap: wrap; align-items: baseline; gap: 6px 12px; }
.br-head h4, .sub-h { font-family: var(--font); font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.sub-h { margin: 22px 0 10px; }
.br-repo { font-size: 13.5px; color: var(--blue-deep); overflow-wrap: anywhere; }
.br-count { font-size: 13px; color: var(--muted); }
.add-brain { margin-top: 8px; padding-top: 6px; border-top: 1px solid var(--line); }
.repo-list { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.repo-list li { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.repo-list li .mono { font-size: 13.5px; overflow-wrap: anywhere; flex: 1 1 200px; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--blue-deep); text-decoration: underline; cursor: pointer; }
.tok-fallback summary { cursor: pointer; font-weight: 600; color: var(--blue-deep); }
@media (max-width: 560px) { .repo-list li .btn { width: 100%; } }

.brains { margin-bottom: 36px; }
.lede-s { color: var(--muted); max-width: 40em; text-wrap: pretty; margin-bottom: 12px; }
.origin { font-size: 12.5px; font-weight: 600; padding: 3px 10px; border-radius: 999px; background: var(--line); color: var(--ink); }
.origin-created { background: var(--green-soft); color: var(--green); }
.origin-connected { background: var(--blue-soft, #e8f0fe); color: var(--blue-deep, #0b3fd6); }
.br-meta { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 14px; margin-top: 4px; }
.brain-empty { padding: 18px 20px; border: 1px dashed var(--line-strong); border-radius: 14px; margin-bottom: 8px; }
.brain-empty p { color: var(--muted); margin-top: 4px; }

/* ---------- journey v2: repos, activity, sources ---------- */
.i-github { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/github.svg); }
.i-repo { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/book-marked.svg); }
.i-folder { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/folder.svg); }
.i-search { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/search.svg); }
.i-more { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/ellipsis.svg); }
.i-pr { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/git-pull-request.svg); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.page-mid { max-width: 880px; margin: 0; }
.tag { font-size: 12px; font-weight: 500; color: var(--muted); background: var(--sunk); border-radius: 6px; padding: 2px 8px; white-space: nowrap; }
.badge.warn { background: var(--red); color: #fff; }
.btn-icon { padding: 7px 9px; }
.link-btn { font: inherit; background: none; border: 0; padding: 0; color: var(--blue-deep); cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* repo picker: search over your 10 newest repos, create inline */
.picker { border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); padding: 20px; margin-bottom: 32px; display: grid; gap: 14px; }
.pk-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.pk-head h2 { font-family: var(--font); font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.pk-search { position: relative; }
.pk-search .ico { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); color: var(--faint); pointer-events: none; }
.pk-search .input { padding-left: 40px; }
.pk-sub { font-size: 13px; color: var(--muted); font-weight: 500; }
.pk-list { list-style: none; margin: -4px 0 0; padding: 0; }
.pk-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 12px; padding: 9px 0; border-top: 1px solid var(--line); }
.pk-list li:first-child { border-top: 0; }
.pk-name { display: flex; align-items: center; gap: 10px; min-width: 0; font-size: 14px; }
.pk-name .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-name .ico { color: var(--muted); }
.pk-date { font-size: 13px; color: var(--muted); font-variant-numeric: tabular-nums; }
.pk-new .ico { color: var(--blue); }
.pk-skel { height: 44px; border-radius: 8px; background: var(--sunk); margin: 6px 0; border: 0 !important; }
.pk-foot { font-size: 13px; color: var(--muted); }
.gh-btn { width: fit-content; }
.gh-btn .ico { width: 1.2em; height: 1.2em; }

/* repo rows */
.repos { list-style: none; margin: 0 0 44px; padding: 0; border-top: 1px solid var(--line-strong); }
.repo { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 6px 20px; align-items: center; padding: 18px 0; border-bottom: 1px solid var(--line); }
.r-main { min-width: 0; display: grid; gap: 4px; }
.r-title { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 16px; font-weight: 600; }
.r-title .ico { color: var(--muted); }
.r-title a { text-decoration: none; overflow-wrap: anywhere; }
.r-title a:hover { text-decoration: underline; text-underline-offset: 3px; }
.r-meta { display: flex; flex-wrap: wrap; gap: 4px 16px; font-size: 14px; color: var(--muted); }
.r-meta a { color: var(--blue-deep); text-decoration: none; }
.r-meta a:hover { text-decoration: underline; }
.r-alert { display: flex; align-items: center; gap: 8px; font-size: 14px; color: var(--red); font-weight: 500; }
.repo.is-missing { background: var(--red-soft); border-radius: 12px; padding-inline: 16px; border-bottom-color: transparent; margin-block: 4px; }
.r-side { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; justify-content: flex-end; }
.r-msg { grid-column: 1 / -1; font-size: 14px; color: var(--muted); }
.r-msg:empty { display: none; }
.r-msg a { color: var(--blue-deep); }
.mini-switch { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--muted); position: relative; }
.mini-switch input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.mini-switch .track { width: 34px; height: 20px; border-radius: 999px; background: var(--line-strong); position: relative; transition: background .15s; flex: none; }
.mini-switch .track::after { content: ""; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: #fff; transition: transform .2s var(--ease); box-shadow: 0 1px 2px oklch(0.2 0.05 262 / .3); }
.mini-switch input:checked + .track { background: var(--blue); }
.mini-switch input:checked + .track::after { transform: translateX(14px); }
.mini-switch input:checked ~ .lbl { color: var(--ink); }
.mini-switch input:focus-visible + .track { outline: 2px solid var(--blue); outline-offset: 3px; }
.menu { position: relative; }
.menu summary { list-style: none; }
.menu summary::-webkit-details-marker { display: none; }
.menu-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; min-width: 220px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--lift); padding: 6px; display: grid; }
.menu-pop button { font: inherit; font-size: 14px; text-align: left; background: none; border: 0; padding: 9px 12px; border-radius: 8px; cursor: pointer; color: var(--ink); }
.menu-pop button:hover, .menu-pop button:focus-visible { background: var(--sunk); }
.menu-pop .danger { color: var(--red); }

/* mapping grid: newsletters are rows, repos are columns */
.map .sec { margin-bottom: 14px; }
.map-scroll { overflow-x: auto; border: 1px solid var(--line-strong); border-radius: 14px; background: var(--surface); }
.grid { border-collapse: collapse; width: 100%; font-size: 14px; }
.grid th, .grid td { padding: 0; border-bottom: 1px solid var(--line); }
.grid tbody tr:last-child th, .grid tbody tr:last-child td { border-bottom: 0; }
.grid thead th { font-weight: 500; color: var(--muted); font-size: 13px; text-align: center; padding: 12px 14px; background: var(--sunk); white-space: nowrap; }
.grid thead th:first-child { text-align: left; padding-left: 16px; }
.grid thead th .mono { color: var(--ink); max-width: 16ch; display: inline-block; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; }
.grid tbody th { text-align: left; font-weight: 500; padding: 10px 16px; }
.g-src { display: flex; align-items: center; gap: 10px; min-width: 200px; }
.g-none { font-size: 12px; font-weight: 500; color: var(--amber); background: var(--amber-soft); border-radius: 6px; padding: 1px 7px; }
.grid td { text-align: center; min-width: 96px; }
.g-cell { display: grid; place-items: center; height: 48px; cursor: pointer; position: relative; }
.g-cell:hover .g-box { border-color: var(--ink); }
.g-cell input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.g-box { width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-strong); display: grid; place-items: center; background: var(--surface); color: #fff; transition: background .12s, border-color .12s; }
.g-box .ico { width: 14px; height: 14px; opacity: 0; transition: opacity .12s; }
.g-cell input:checked + .g-box { background: var(--blue); border-color: var(--blue); }
.g-cell input:checked + .g-box .ico { opacity: 1; }
.g-cell input:focus-visible + .g-box { outline: 2px solid var(--blue); outline-offset: 3px; }
.map-foot { margin-top: 12px; }
.map-foot a, .hint a { color: var(--blue-deep); }

/* activity: runs and pull requests */
.activity { list-style: none; margin: 0; padding: 0; display: grid; }
.ev { display: grid; grid-template-columns: 18px minmax(0, 1fr) auto; gap: 10px; align-items: start; padding: 10px 0; border-top: 1px solid var(--line); font-size: 14px; }
.ev:first-child { border-top: 0; padding-top: 2px; }
.ev > .ico { margin-top: 2px; color: var(--muted); }
.ev-pr > .ico { color: var(--green); }
.ev-bad > .ico { color: var(--red); }
.ev div { display: grid; gap: 1px; min-width: 0; }
.ev div > span:first-child, .ev div > a { font-weight: 500; }
.ev a { color: var(--ink); text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.ev a:hover { text-decoration-color: currentColor; }
.ev-sub { color: var(--muted); font-size: 13px; overflow-wrap: anywhere; }
.ev time { color: var(--muted); font-size: 12.5px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.brain .b-sec { display: grid; gap: 8px; }
.brain .sec { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--muted); letter-spacing: 0; margin: 0; }
.dest { display: flex; align-items: center; gap: 8px; font-size: 15px; font-weight: 600; }
.dest .ico { color: var(--muted); }
.empty-activity { max-width: 520px; margin: 40px auto 0; }
.empty-activity .sec { margin-bottom: 10px; }
.agent-line { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 14px; }

/* notes: where each note went */
.n-dest { display: flex; align-items: center; flex-wrap: wrap; gap: 6px 12px; font-size: 13.5px !important; color: var(--muted) !important; }
.n-dest .mono { color: var(--ink); }
.n-dest a { color: var(--blue-deep); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.n-dest a:hover { text-decoration: underline; }
.n-dest .bad, a.bad { color: var(--red) !important; font-weight: 500; }
.n-dest .wait { color: var(--muted); }
.n-dest .wait a { display: inline; }

/* sources */
.src-sec { margin-top: 32px; }
.sec-row { display: flex; justify-content: space-between; align-items: center; gap: 12px 24px; flex-wrap: wrap; margin-bottom: 4px; }
.search.compact { flex: 0 1 300px; }
.search.compact .input { padding: 8px 12px; font-size: 15px; }
.src-list { list-style: none; margin: 8px 0 0; padding: 0; border-top: 1px solid var(--line); }
.src-row { display: grid; grid-template-columns: 28px minmax(0, 1fr) auto; gap: 4px 16px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.s-main { min-width: 0; }
.s-name { font-size: 16px; font-weight: 600; letter-spacing: -0.01em; }
.s-name span { font-weight: 400; color: var(--muted); font-size: 14px; margin-left: 8px; }
.s-sub { display: flex; flex-wrap: wrap; gap: 2px 14px; font-size: 13.5px; color: var(--muted); margin-top: 2px; }
.s-sub .mono { overflow-wrap: anywhere; font-size: 12.5px; }
.s-sub .tp { color: var(--faint); }
.goes { display: inline-flex; align-items: center; gap: 5px; color: var(--ink); font-weight: 500; }
.goes .ico { width: 14px; height: 14px; color: var(--muted); }
a.goes.none { color: var(--amber); text-decoration: none; }
a.goes.none .ico { color: var(--amber); }
.s-end { display: flex; align-items: center; gap: 10px; }

@media (max-width: 720px) {
  .repo { grid-template-columns: 1fr; }
  .r-side { justify-content: flex-start; }
  .pk-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .pk-date { display: none; }
  .g-src { min-width: 150px; }
  .grid td { min-width: 76px; }
}
@media (prefers-reduced-motion: reduce) {
  .mini-switch .track::after, .g-box, .g-box .ico { transition: none; }
}
.pk-empty { display: block !important; font-size: 14px; color: var(--muted); }
.note > .btn { align-self: start; }
.note-tools { display: flex; flex-wrap: wrap; gap: 12px 16px; align-items: end; margin-bottom: 4px; }
.note-tools .brain-filter { flex: 0 1 280px; }
.note-tools .search { margin: 0; }
.err + .note-tools, .err + .err { margin-top: 16px; }
.g-none { white-space: nowrap; }
.grid tbody th, .grid thead th:first-child { position: sticky; left: 0; z-index: 1; }
.grid tbody th { background: var(--surface); }
.pk-new > span:empty { display: none; }
@media (max-width: 720px) {
  .g-src { min-width: 0; flex-wrap: wrap; gap: 4px 8px; }
  .grid tbody th { padding: 10px 12px; min-width: 140px; }
  .grid thead th .mono { max-width: 11ch; }
}
.code + .code { margin-top: 12px; }

/* graph view of the mapping */
.seg { display: inline-flex; background: var(--sunk); border-radius: 10px; padding: 3px; gap: 2px; }
.seg button { font: inherit; font-size: 13.5px; font-weight: 500; border: 0; background: none; padding: 5px 14px; border-radius: 8px; color: var(--muted); cursor: pointer; }
.seg button[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px oklch(0.2 0.05 262 / .12); }
.map .sec-row { margin-bottom: 14px; }
.map .sec-row .sec { margin: 0; }
.graph { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: clamp(56px, 14vw, 180px); padding: 20px; border: 1px solid var(--line-strong); border-radius: 16px; background: var(--surface); background-image: radial-gradient(var(--line) 1px, transparent 1px); background-size: 18px 18px; user-select: none; -webkit-user-select: none; }
.g-lines { position: absolute; inset: 0; pointer-events: none; overflow: visible; }
.edge { fill: none; stroke: var(--blue); stroke-width: 2; opacity: .55; transition: opacity .15s, stroke-width .15s; }
.edge.lit { opacity: 1; stroke-width: 2.5; }
.edge.dim { opacity: .12; }
.edge.miss { stroke: var(--red); stroke-dasharray: 5 5; opacity: .6; }
.edge.ghost { stroke-dasharray: 6 6; opacity: .9; }
.g-col { position: relative; z-index: 1; display: grid; gap: 10px; align-content: start; }
.g-cap { font-size: 13px; font-weight: 600; color: var(--muted); }
.g-right .g-cap { text-align: left; }
.gnode { font: inherit; position: relative; display: flex; align-items: center; gap: 10px; width: 100%; min-height: 48px; padding: 10px 14px; background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; color: var(--ink); cursor: pointer; text-align: left; transition: border-color .15s, box-shadow .15s, opacity .15s, background .15s; text-decoration: none; }
.gnode:hover { border-color: var(--ink); }
.gn-name { font-weight: 500; font-size: 14.5px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.gn-sub { font-size: 12px; color: var(--muted); white-space: nowrap; }
.gn-flag { font-size: 12px; font-weight: 500; color: var(--amber); background: var(--amber-soft); border-radius: 6px; padding: 1px 7px; white-space: nowrap; }
.gn-flag.bad { color: var(--red); background: var(--red-soft); }
.gn-act { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 7px; border: 1.5px solid var(--line-strong); color: var(--muted); flex: none; }
.gn-act .ico { width: 14px; height: 14px; }
.grepo > .ico { color: var(--muted); }
.port { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line-strong); transform: translateY(-50%); }
.port-r { right: -6px; cursor: crosshair; }
.port-l { left: -6px; }
.gsrc:hover .port-r, .gsrc.is-sel .port-r { border-color: var(--blue); background: var(--blue); }
.gnode.is-sel { border-color: var(--blue); box-shadow: 0 0 0 3px var(--blue-soft); }
.gnode.is-lit { border-color: var(--blue); }
.gnode.is-lit .port, .grepo.is-lit .port-l { border-color: var(--blue); background: var(--blue); }
.gnode.is-dim { opacity: .45; }
.grepo.is-target { border-style: dashed; border-color: var(--blue); }
.grepo.is-target:hover, .grepo.is-hover { background: var(--blue-soft); border-style: solid; }
.grepo.is-lit .gn-act { background: var(--blue); border-color: var(--blue); color: #fff; }
.grepo.is-miss { background: var(--red-soft); border-color: oklch(0.85 0.06 25); }
.gsrc.is-loose .port-r { border-color: var(--amber); }
.gadd { color: var(--muted); border-style: dashed; justify-content: center; font-size: 14px; font-weight: 500; min-height: 44px; }
.gadd:hover { color: var(--ink); }
.graph.dragging, .graph.dragging * { cursor: crosshair !important; }
.g-hint { min-height: 22px; margin-top: 12px; font-size: 14px; color: var(--muted); }
.g-detail { display: flex; align-items: center; gap: 8px; margin-top: 4px; font-size: 14px; }
.g-detail .ico { color: var(--muted); }
.tag { display: inline-flex; align-items: center; gap: 5px; }
.tag .ico { width: 12px; height: 12px; }
.tag-bf { color: var(--blue-ink); background: var(--blue-soft); }
.tag-bf svg { color: var(--blue); }
.col-miss { background: oklch(0.985 0.012 25); }
.grid thead th.col-miss { color: var(--red); background: var(--red-soft); }
.grid thead th.col-miss .ico { width: 13px; height: 13px; margin-right: 4px; vertical-align: -2px; }
.col-miss .g-cell input:checked + .g-box { background: oklch(0.7 0.08 25); border-color: oklch(0.7 0.08 25); }
@media (max-width: 720px) {
  .graph { gap: 40px; padding: 14px; }
  .gnode { padding: 8px 10px; gap: 8px; }
  .gn-sub { display: none; }
  .gn-name { font-size: 13.5px; }
  .gn-flag { display: none; }
}
@media (prefers-reduced-motion: reduce) { .edge, .gnode { transition: none; } }
.g-col, .gnode { min-width: 0; }
.graph { grid-template-rows: auto auto; }
.graph > .g-hint { grid-column: 1 / -1; margin: 0; min-height: 0; font-size: 13.5px; color: var(--muted); position: relative; z-index: 1; }
.graph.has-sel > .g-hint { color: var(--blue-ink); font-weight: 500; }
.g-x { position: absolute; inset: 0; pointer-events: none; z-index: 2; }
.g-cut { pointer-events: auto; position: absolute; transform: translate(-50%, -50%); width: 22px; height: 22px; border-radius: 50%; border: 1px solid var(--line-strong); background: var(--surface); color: var(--muted); font-size: 15px; line-height: 1; cursor: pointer; display: grid; place-items: center; padding: 0; box-shadow: 0 1px 3px oklch(0.2 0.05 262 / .15); }
.g-cut:hover, .g-cut:focus-visible { color: #fff; background: var(--red); border-color: var(--red); }
.end { fill: var(--blue); opacity: .55; }
.end.lit { opacity: 1; }
.end.dim { opacity: .12; }
.end.miss { fill: var(--red); }
.grepo .port-l { display: none; }
.graph { row-gap: 14px; column-gap: clamp(56px, 14vw, 180px); }
@media (max-width: 720px) { .graph { column-gap: 40px; } }

/* ---------- W1d: banners, numbers strip, card evidence, settings, setup options, mobile bar ---------- */
.net { position: sticky; top: 0; z-index: 60; background: var(--ink); color: #fff; text-align: center; font-size: 14px; font-weight: 500; padding: 8px 16px; }
.banner { display: flex; align-items: center; gap: 10px 14px; flex-wrap: wrap; padding: 12px 16px; border-radius: 14px; border: 1px solid var(--line-strong); background: var(--surface); margin-bottom: 14px; font-size: 14.5px; }
.banner > .ico { flex: none; }
.banner .b-text { flex: 1 1 260px; min-width: 0; }
.banner .b-text b { font-weight: 600; }
.banner .b-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.banner-pr { background: var(--blue-soft); border-color: oklch(0.85 0.06 262); color: var(--blue-ink); }
.banner-ok { background: var(--green-soft); border-color: oklch(0.85 0.06 160); color: var(--green); }
.banner-warn { background: var(--amber-soft); border-color: oklch(0.85 0.08 85); color: var(--amber); }
.banner .btn-ghost { color: var(--ink); }

.strip { margin: 0 0 24px; }
.strip-stats { display: flex; flex-wrap: wrap; gap: 4px 28px; margin: 0; padding: 12px 0; border-block: 1px solid var(--line); }
.strip-stats > div { display: flex; align-items: baseline; gap: 8px; }
.strip-stats dt { color: var(--muted); font-size: 14px; }
.strip-stats dd { margin: 0; font-weight: 600; font-size: 18px; font-variant-numeric: tabular-nums; letter-spacing: -0.01em; }
.strip-stats .good dd { color: var(--green); }
.strip-more { margin-top: 10px; }
.strip-more summary { cursor: pointer; color: var(--blue-deep); font-size: 14px; font-weight: 500; width: fit-content; }
.strip-body { margin-top: 14px; max-width: 640px; display: grid; gap: 10px; }

.c-reason { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--muted); }
.c-reason .ico { margin-top: 3px; color: var(--blue); }
.c-evidence { margin: 0; padding: 12px 14px; border-radius: 12px; background: var(--sunk); border: 1px solid var(--line); display: grid; gap: 6px; }
.c-evidence blockquote { margin: 0; font-size: 14.5px; line-height: 1.5; font-style: italic; text-wrap: pretty; }
.c-evidence figcaption { font-size: 13px; color: var(--muted); }
.c-tags { display: inline-flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.note-box.ok { background: var(--green-soft); color: var(--green); }
.note-box.bad { background: var(--red-soft); color: var(--red); }
.btn-danger-solid { background: var(--red); color: #fff; }
.btn-danger-solid:hover:not(:disabled) { background: oklch(0.42 0.19 28); }

/* settings */
.set-page { max-width: 720px; }
.jump { display: flex; flex-wrap: wrap; gap: 6px; margin: -8px 0 8px; }
.set-sec { margin-top: 40px; scroll-margin-top: 24px; }
.set-sec > .hint { max-width: 38em; }
.set-sec h2.sec { margin-bottom: 4px; }
.set-form { display: grid; gap: 16px; max-width: 460px; margin-top: 14px; }
.set-form select.input { appearance: auto; }
.set-actions { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.set-actions .form-msg { min-height: 0; }
.set-sec .tok-form { margin-top: 14px; }
.danger { border: 1px solid oklch(0.85 0.06 28); border-radius: 16px; padding: 20px 22px 24px; background: var(--red-soft); }
.danger h2.sec { color: var(--red); }
.danger .input { background: var(--surface); }
.danger .set-form { max-width: 520px; }

/* setup: three ways in */
.opts { list-style: none; margin: 28px 0 0; padding: 0; border-top: 1px solid var(--line-strong); }
.opt { display: grid; gap: 14px; padding: 22px 0; border-bottom: 1px solid var(--line); }
.opt-main h2 { font-family: var(--font); font-size: 18px; font-weight: 600; letter-spacing: -0.015em; }
.opt-main p { color: var(--muted); margin-top: 2px; max-width: 40em; text-wrap: pretty; }
.opt-body { display: grid; gap: 10px; max-width: 560px; }
.opt-act .gh-btn { width: fit-content; }
.opt-note { max-width: 40em; }
.opt .pk-list li { grid-template-columns: minmax(0, 1fr) auto auto; }

/* skeletons */
.skel-list { display: grid; gap: 12px; max-width: 640px; }
@media (prefers-reduced-motion: no-preference) { .skel-list .skeleton { animation: breathe 1.4s ease-in-out infinite; } }

/* menu items that are links */
.menu-pop a[role="menuitem"] { display: flex; align-items: center; gap: 10px; font-size: 14px; padding: 9px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.menu-pop a[role="menuitem"]:hover, .menu-pop a[role="menuitem"]:focus-visible { background: var(--sunk); }
.menu-pop a[aria-current="page"] { color: var(--blue-ink); background: var(--blue-soft); }
#queue-card:focus { outline: none; }
#queue-card:focus-visible { outline: 2px solid var(--blue); outline-offset: 6px; border-radius: 20px; }

/* mobile: bottom bar replaces the scrolling nav */
.tabbar { display: none; }
@media (max-width: 820px) {
  .side .nav { display: none; }
  .side { padding: 10px 16px; flex-wrap: nowrap; }
  .side .logo { padding: 0; }
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom)); }
  .tabbar { display: grid; grid-template-columns: repeat(4, 1fr); position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; padding-bottom: env(safe-area-inset-bottom); background: var(--surface); border-top: 1px solid var(--line-strong); }
  .tabbar > a, .tabbar .more > summary { display: grid; justify-items: center; align-content: center; gap: 2px; min-height: 56px; padding: 6px 4px; font-size: 12px; font-weight: 500; color: var(--muted); text-decoration: none; position: relative; cursor: pointer; border-radius: 0; }
  .tabbar .ico { width: 1.4em; height: 1.4em; }
  .tabbar > a[aria-current="page"], .tabbar .more > summary[data-on] { color: var(--blue-ink); }
  .tabbar > a[aria-current="page"]::before, .tabbar .more > summary[data-on]::before { content: ""; position: absolute; top: 0; left: 24%; right: 24%; height: 3px; border-radius: 0 0 3px 3px; background: var(--blue); }
  .tabbar .badge { position: absolute; top: 6px; left: calc(50% + 6px); margin: 0; font-size: 11px; min-width: 18px; line-height: 18px; background: var(--blue); color: #fff; border-radius: 999px; text-align: center; padding: 0 5px; }
  .tabbar .badge.warn { background: var(--red); }
  .tabbar .more { position: static; }
  .tabbar .more .menu-pop { top: auto; bottom: calc(100% + 8px); right: 8px; left: auto; }
  .tabbar a:focus-visible, .tabbar summary:focus-visible { outline-offset: -3px; }
  .toasts { bottom: calc(72px + env(safe-area-inset-bottom)); }
  .stack .actions { flex-wrap: nowrap; gap: 6px; }
  .stack .actions .btn { flex: 1 1 0; padding: 10px 4px; font-size: 14px; }
  .stack .actions .btn-blue { order: 0; flex-basis: 0; margin-left: 0; }
  .stack .actions .kbd, .stack .actions .ico { display: none; }
  .stack .actions { position: sticky; bottom: calc(64px + env(safe-area-inset-bottom)); z-index: 5; padding: 10px; margin: 0 -10px; background: oklch(0.985 0.004 258 / .96); border-radius: 16px; border: 1px solid var(--line); }
  .savebar { bottom: calc(72px + env(safe-area-inset-bottom)); }
}
@media (max-width: 640px) {
  .strip-stats { gap: 4px 20px; }
  .set-sec { margin-top: 32px; }
  .opt .pk-list li { grid-template-columns: minmax(0, 1fr) auto; }
  .opt .pk-date { display: none; }
}
.steps { padding: 0; margin-top: 0; }

/* ---------- integration pass: notification rules, health, history, insights ---------- */
.rules { margin-top: 14px; padding: 16px 18px; border-radius: 14px; background: var(--soft, #f5f5f7); }
.rules h3 { font-family: var(--font); font-size: 14px; font-weight: 600; margin-bottom: 8px; }
.rules ul { margin: 0; padding-left: 18px; color: var(--muted); font-size: 14px; display: grid; gap: 6px; }
.rules li b { color: var(--ink, inherit); }
.health { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; }
.health.ok { color: var(--green); }
.health.bad { color: var(--red); }
.health.fwd { color: var(--muted); }
.forward-note { margin-top: 6px; font-size: 13px; color: var(--muted); }
.insights { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; margin: 0 0 20px; padding: 16px 20px; border: 1px solid var(--line); border-radius: 16px; }
.insights div { display: grid; gap: 2px; }
.insights dt { font-size: 13px; color: var(--muted); }
.insights dd { margin: 0; font-size: 22px; font-weight: 600; letter-spacing: -0.02em; }
.pr-list { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.pr-list li { display: grid; gap: 4px; padding: 14px 16px; border: 1px solid var(--line); border-radius: 14px; }
.pr-list li .pr-top { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.pr-list li.failed { border-color: var(--red); background: var(--red-soft); }
.pr-list li .pr-err { color: var(--red); font-size: 14px; }
.pr-list li time { margin-left: auto; color: var(--muted); font-size: 13px; }
.auth-mode { color: var(--muted); font-size: 13px; }


/* ---------- QA pass, 15 Nov 2026: phone and tablet, tap targets, focus, dark OS ---------- */
.shell.is-setup .nav, .shell.is-setup .tabbar { display: none; }
.shell.is-setup .main { padding-bottom: 48px; }

/* Touch targets: 44px on phones, tablets and any coarse pointer. Inline links inside prose keep their line height. */
@media (max-width: 820px), (pointer: coarse) {
  .btn, .btn-sm { min-height: 44px; }
  .btn-icon { min-width: 44px; }
  .chip { min-height: 44px; padding: 4px 16px; display: inline-flex; align-items: center; }
  .seg button { min-height: 44px; padding-inline: 16px; }
  .input { min-height: 44px; }
  .seg { padding: 2px; }
  .side .logo, .auth-side .logo { min-height: 44px; }
  .c-link, .strip-more summary, .token-box summary, .note details summary, .link { padding-block: 11px; }
  .c-link { min-height: 44px; }
  .undo-bar .link { padding-block: 11px; }
  .switch { min-width: 44px; min-height: 44px; align-items: center; justify-content: center; }
  .switch span { margin: 0 auto; }
  .g-cut { width: 32px; height: 32px; }
  .gn-act { width: 28px; height: 28px; }
  .gadd, .gnode { min-height: 48px; }
}
.agent-line a, .hint a, .state a { padding-block: 0; }
@media (max-width: 820px) {
  .agent-line a { display: inline-block; padding-block: 11px; }
  .page-narrow, .page { overflow-wrap: anywhere; }
  .head { gap: 12px 16px; }
  .head-actions .btn { width: auto; }
  /* Queue on a phone: the card comes first, the numbers follow it. */
  .q-page { display: flex; flex-direction: column; }
  .q-page .queue-grid { display: contents; }
  .q-page .stack { order: 1; }
  .q-page > .q-top { order: 2; margin-top: 28px; }
  .q-page .brain { order: 3; margin-top: 4px; }
  .q-page > .state, .q-page > .empty-activity { order: 1; }
  .q-page > .q-top:empty { display: none; }
  .q-page > .head { margin-bottom: 20px; }
  .q-page > .head .lede { display: none; }
  .code pre { white-space: pre-wrap; overflow-wrap: anywhere; }
  .code code { white-space: pre-wrap; overflow-wrap: anywhere; }
  .g-src { min-width: 0; }
}
@media (max-width: 720px) {
  .graph { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); column-gap: 30px; }
  .gn-name { font-size: 14px; }
}
@media (max-width: 640px) {
  .head h1 { font-size: 30px; }
  .head { align-items: flex-start; }
  .q-page > .head { flex-wrap: nowrap; }
  .q-page > .head > div:first-child { min-width: 0; flex: 1; }
  .q-page > .head .head-actions { flex: none; }
  .notes-bar .btn, .head-actions .btn { flex: 1 1 auto; }
}
.code pre:focus-visible { outline: 2px solid var(--blue); outline-offset: -2px; }
/* A busy button keeps its place and says so without color alone. */
.btn[aria-busy="true"] { cursor: progress; }
@media (max-width: 820px), (pointer: coarse) {
  .menu-pop a[role="menuitem"], .menu-pop button { min-height: 44px; display: flex; align-items: center; }
}
@media (max-width: 820px) {
  .agent-line { display: block; }
  .agent-line .pulse { display: inline-block; margin-right: 8px; vertical-align: middle; }
}
.auth { grid-template-rows: minmax(0, 1fr); }
@media (max-width: 820px) { .auth { grid-template-rows: auto minmax(0, 1fr); } .auth-side { justify-content: flex-start; } .auth-main { place-items: start center; padding-top: 32px; } }
.auth-legal { font-size: 13px; color: var(--muted); }
.err > span:not(.ico) { flex: 1 1 12ch; min-width: 0; }
/* Key hints keep full text contrast. Only the border is faint. */
.btn kbd, .kbd { opacity: 1; border-color: color-mix(in srgb, currentColor 40%, transparent); }
.keys .kbd, .undo-bar .kbd { color: var(--muted); }
.empty-activity { margin: 40px 0 0; }
@media (max-width: 820px) { .state { padding-top: 28px; } .q-page > .q-top { margin-top: 24px; } }
.tag { font-family: var(--font); }
@media (max-width: 480px) {
  .steps { gap: 8px 12px; }
  .steps li:not(.on) .sl { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
}
.input[aria-invalid="true"] { border-color: var(--red); }
/* The wrapper must not box the bar in, or sticky has nowhere to travel. */
#savebar { display: contents; }

/* =====================================================================
   Product polish, 15 Nov 2026. One type family, fixed rem scale, a second
   neutral layer for the sidebar, hairline panels. Queue, Notes, Settings.
   ===================================================================== */
:root {
  --bg: oklch(0.992 0.002 258);
  --rail: oklch(0.972 0.005 258);
  --sunk: oklch(0.965 0.006 258);
  --hover: oklch(0.975 0.005 258);
  --line: oklch(0.925 0.007 260);
  --line-strong: oklch(0.86 0.012 260);
  --foot: oklch(0.985 0.003 258);
  --shadow-1: 0 1px 2px oklch(0.25 0.03 262 / .05);
  --shadow-2: 0 1px 2px oklch(0.25 0.03 262 / .05), 0 8px 24px -12px oklch(0.25 0.06 262 / .18);
  --lift: 0 1px 2px oklch(0.25 0.03 262 / .06), 0 18px 40px -20px oklch(0.25 0.08 262 / .25);
}
body { font-size: 15px; font-feature-settings: "ss01", "cv11"; letter-spacing: -0.003em; }
h1, h2, h3 { font-family: var(--font); }
.mono, .tok-val, .md, .path, .c-src .date { font-feature-settings: normal; letter-spacing: 0; }

/* buttons and fields */
.btn { font-size: 14px; font-weight: 550; padding: 8px 14px; border-radius: 9px; gap: 7px; transition: background .15s, border-color .15s, color .15s, box-shadow .15s, transform .15s var(--ease); }
.btn .ico { width: 15px; height: 15px; }
.btn-sm { font-size: 13px; padding: 5px 10px; border-radius: 8px; }
.btn-lg { font-size: 15px; padding: 11px 20px; border-radius: 10px; }
.btn-blue { box-shadow: 0 1px 0 oklch(1 0 0 / .2) inset, 0 1px 2px oklch(0.35 0.18 262 / .35); }
.btn-ghost { border-color: var(--line-strong); box-shadow: var(--shadow-1); }
.btn-ghost:hover:not(:disabled) { border-color: var(--line-strong); background: var(--hover); }
.btn-ghost.btn-danger:hover:not(:disabled) { background: var(--red-soft); border-color: oklch(0.85 0.06 28); }
.btn-icon { padding: 6px; width: 32px; height: 32px; }
.btn kbd, .kbd { font-size: 11px; padding: 1px 5px; border-radius: 4px; line-height: 1.4; }
.btn-blue .kbd { border-color: oklch(1 0 0 / .4); }
.input { font-size: 14.5px; padding: 8px 12px; border-radius: 9px; box-shadow: var(--shadow-1); transition: border-color .15s, box-shadow .15s; }
.input:hover:not(:focus) { border-color: oklch(0.78 0.015 260); }
.input:focus-visible { outline: 0; border-color: var(--blue); box-shadow: 0 0 0 3px oklch(0.52 0.235 262 / .18); }
select.input { appearance: none; padding-right: 34px; background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='none' stroke='%23646b7d' stroke-width='1.75' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 6.5 3 3 3-3'/%3E%3C/svg%3E") no-repeat right 10px center; cursor: pointer; }
.field > label, .lbl { font-size: 13.5px; font-weight: 550; }
.rel { font-size: 12.5px; font-weight: 550; padding: 3px 9px 3px 7px; gap: 5px; }
.rel .ico { width: 13px; height: 13px; }
.seg { background: var(--sunk); border-radius: 9px; padding: 3px; }
.seg button { font-size: 13.5px; border-radius: 7px; padding: 5px 12px; transition: color .15s, background .15s; }
.seg button:hover { color: var(--ink); }
.seg button[aria-selected="true"] { box-shadow: 0 0 0 1px var(--line), var(--shadow-1); }
.switch span { width: 38px; height: 22px; }
.switch span::after { width: 18px; height: 18px; top: 2px; left: 2px; }
.switch input:checked + span::after { transform: translateX(16px); }

/* shell */
.shell { grid-template-columns: 224px minmax(0, 1fr); }
.side { background: var(--rail); padding: 18px 12px 14px; border-right-color: var(--line); }
.logo { font-family: var(--font); font-size: 17px; font-weight: 700; letter-spacing: -0.025em; gap: 9px; padding: 0 6px; }
.logo svg { width: 24px; height: 24px; }
.nav { margin-top: 24px; gap: 1px; }
.nav a { gap: 10px; padding: 0 10px; height: 34px; border-radius: 8px; font-size: 14px; font-weight: 500; color: oklch(0.4 0.02 262); transition: background .12s, color .12s; }
.nav a .ico { width: 16px; height: 16px; opacity: .85; }
.nav a:hover { background: oklch(0.945 0.008 258); }
.nav a[aria-current="page"] { background: var(--surface); color: var(--ink); box-shadow: 0 0 0 1px var(--line), var(--shadow-1); }
.nav a[aria-current="page"] .ico { opacity: 1; color: var(--blue); }
.nav .badge { font-family: var(--mono); font-size: 11.5px; font-weight: 500; line-height: 19px; min-width: 20px; padding: 0 6px; border-radius: 6px; background: var(--blue-soft); color: var(--blue-ink); }
.nav .badge.warn { background: var(--red-soft); color: var(--red); }
.side-foot { border-top-color: var(--line); padding: 12px 8px 0; font-size: 12.5px; }
.side-foot b { font-weight: 500; font-size: 12.5px; color: var(--muted); }
.main { padding: 28px clamp(20px, 3.4vw, 48px) 96px; }
.head { align-items: flex-end; margin-bottom: 24px; gap: 12px 24px; }
.head h1 { font-size: 26px; font-weight: 650; letter-spacing: -0.025em; line-height: 1.15; display: flex; align-items: center; gap: 10px; }
.head .lede { font-size: 14.5px; margin-top: 4px; }
.h-count { font-family: var(--mono); font-size: 13px; font-weight: 500; letter-spacing: 0; color: var(--muted); background: var(--sunk); border: 1px solid var(--line); border-radius: 7px; padding: 1px 8px; line-height: 1.5; }
.agent-line { margin-top: 6px; font-size: 13.5px; gap: 8px; }
.agent-line a { color: var(--muted); text-underline-offset: 3px; text-decoration-color: var(--line-strong); }
.agent-line a:hover { color: var(--ink); text-decoration-color: currentColor; }
.pulse { width: 7px; height: 7px; }
.banner { border-radius: 12px; padding: 10px 12px 10px 14px; font-size: 14px; }
.banner-pr { border-color: oklch(0.88 0.05 262); }
.state { padding: 48px 0 24px; }
.state h2 { font-size: 24px; font-weight: 650; letter-spacing: -0.02em; }
.state p { font-size: 15px; }
.toast { border-radius: 10px; font-size: 13.5px; padding: 9px 16px; }

/* ---------- queue ---------- */
.queue-grid { grid-template-columns: minmax(0, 1fr) 300px; gap: clamp(28px, 4vw, 56px); }
.stack { max-width: 620px; }
.q-prog { display: grid; gap: 8px; margin-bottom: 14px; }
.q-prog p { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; font-size: 13.5px; }
.q-prog b { font-weight: 600; }
.q-prog span { color: var(--muted); }
.segs { display: flex; gap: 4px; list-style: none; margin: 0; padding: 0; }
.segs li { flex: 1; height: 4px; border-radius: 2px; background: var(--line); transition: background .25s var(--ease); }
.segs li.is-done { background: var(--blue); }
.segs li.is-now { background: oklch(0.8 0.08 262); }
.segbar { height: 4px; border-radius: 2px; background: var(--line); overflow: hidden; }
.segbar i { display: block; height: 100%; background: var(--blue); border-radius: 2px; transition: width .25s var(--ease); }
.pile { margin-bottom: 0; }
.pile::before, .pile::after { border-radius: 16px; border-color: var(--line); }
.card { border-radius: 16px; padding: 0; gap: 0; border-color: var(--line-strong); }
.c-top { display: flex; align-items: center; justify-content: space-between; gap: 8px 12px; flex-wrap: wrap; padding: 18px 24px 0; }
.c-src { font-size: 13.5px; gap: 8px; }
.c-src b { font-weight: 600; }
.c-src .date { margin-left: 0; font-size: 12px; color: var(--faint); }
.c-src .date::before { content: "·"; margin-right: 8px; color: var(--line-strong); }
.c-body { padding: 16px 24px 0; display: grid; gap: 10px; }
.c-title { font-size: 22px; line-height: 1.25; letter-spacing: -0.022em; font-weight: 650; }
.c-idea { font-size: 15.5px; line-height: 1.6; color: oklch(0.27 0.03 262); max-width: 62ch; }
.c-evidence { margin: 16px 24px 0; padding: 12px 14px 12px 38px; position: relative; border-radius: 10px; border: 0; background: var(--sunk); }
.c-evidence::before { content: "\201C"; position: absolute; left: 13px; top: 4px; font-size: 32px; line-height: 1; font-weight: 600; color: var(--faint); }
.c-evidence blockquote { font-style: normal; font-size: 14.5px; font-weight: 500; }
.c-evidence figcaption { font-size: 12.5px; }
.c-why { margin: 16px 24px 0; padding: 14px 0 0; border-top: 1px solid var(--line); font-size: 14px; color: var(--muted); display: grid; gap: 4px; }
.c-why-h { font-size: 12.5px; font-weight: 600; color: var(--ink); }
.c-reason { margin-top: 6px; font-size: 13.5px; }
.c-foot { margin-top: 18px; padding: 12px 24px; border-top: 1px solid var(--line); background: var(--foot); border-radius: 0 0 16px 16px; min-height: 48px; }
.c-foot .c-tags:empty { display: none; }
.c-foot .c-link { margin-left: auto; font-size: 13.5px; }
.stamp { top: 16px; font-size: 12px; border-radius: 6px; }
@media (min-width: 821px) {
  .stack > .actions { display: grid; grid-template-columns: 1fr 1fr 1fr 1.35fr; gap: 8px; margin-top: 16px; }
  .stack > .actions .btn { height: 42px; justify-content: center; }
  .stack > .actions .btn .kbd { margin-left: 2px; }
  .stack > .actions .btn-blue { margin-left: 0; }
}
.stack > .actions .btn-danger { color: var(--red); }
.undo-bar { margin-top: 12px; padding: 8px 8px 8px 14px; border-radius: 12px; background: var(--ink); border-color: var(--ink); color: #fff; font-size: 13.5px; box-shadow: var(--shadow-2); }
.undo-bar .what { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1 1 200px; min-width: 0; }
.undo-bar .chip { background: oklch(1 0 0 / .08); color: #fff; border-color: oklch(1 0 0 / .2); font-size: 12.5px; padding: 3px 10px; }
.undo-bar .chip:hover { background: oklch(1 0 0 / .16); border-color: oklch(1 0 0 / .35); }
.undo-bar .link { color: #fff; margin-left: 0; padding: 4px 10px; border-radius: 8px; background: oklch(1 0 0 / .1); }
.undo-bar .link:hover { background: oklch(1 0 0 / .18); }
.undo-bar .kbd, .keys .kbd { color: inherit; }
.undo-bar .kbd { border-color: oklch(1 0 0 / .35); }
.keys { margin-top: 12px; font-size: 12.5px; gap: 6px 14px; }

/* side rail */
.brain { border-left: 0; padding-left: 0; gap: 0; top: 24px; }
.brain .b-sec { padding-bottom: 20px; margin-bottom: 20px; border-bottom: 1px solid var(--line); gap: 10px; }
.brain .b-sec:last-child { border-bottom: 0; margin-bottom: 0; padding-bottom: 0; }
.brain .sec { font-size: 12.5px; font-weight: 600; color: var(--muted); margin: 0; letter-spacing: 0; }
.dest { font-size: 14px; }
.dest .mono { font-size: 13.5px; }
.brain .hint { font-size: 13px; }
.b-note { border: 1px solid var(--line); border-radius: 10px; background: var(--surface); padding: 12px 14px; display: grid; gap: 2px; box-shadow: var(--shadow-1); }
.brain .note-title { margin: 0; font-size: 14px; display: flex; align-items: center; gap: 7px; }
.brain .note-title .ico { width: 14px; height: 14px; color: var(--muted); }
.brain .path { font-size: 12px; color: var(--faint); }
.heads { margin-top: 8px; font-size: 13px; gap: 0; }
.heads li { padding: 3px 0 3px 12px; border-left-color: var(--line); }
.brain .strip { margin: 0; display: grid; gap: 10px; }
.strip-stats { display: grid; grid-template-columns: 1fr 1fr; gap: 1px; padding: 0; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--line); }
.strip-stats > div { display: grid; gap: 0; background: var(--surface); padding: 9px 12px; }
.strip-stats dt { font-size: 12.5px; }
.strip-stats dd { font-size: 19px; font-weight: 600; letter-spacing: -0.02em; }
.strip-more { margin-top: 0; }
.strip-more summary { font-size: 13px; color: var(--muted); }
.strip-more summary:hover { color: var(--ink); }
.brain .strip-body { margin-top: 10px; }
.brain .chart text { font-size: 15px; }
.q-top .strip { margin-bottom: 8px; }
.q-top .strip .sec { font-size: 12.5px; font-weight: 600; color: var(--muted); margin-bottom: 8px; }
.q-top .strip-stats { grid-template-columns: repeat(4, minmax(0, 150px)); width: fit-content; }
.ev { font-size: 13.5px; padding: 9px 0; grid-template-columns: 16px minmax(0, 1fr) auto; }
.ev > .ico { width: 15px; height: 15px; }
.ev time { font-size: 12px; font-family: var(--mono); color: var(--faint); }
.running h2 { font-size: 22px; font-weight: 650; }

/* ---------- notes ---------- */
.notes-page { max-width: 960px; margin: 0; }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-bottom: 4px; }
.tb-search { position: relative; flex: 1 1 260px; max-width: 380px; }
.tb-search > .ico { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 15px; height: 15px; color: var(--faint); pointer-events: none; }
.tb-search .input { padding-left: 34px; }
.tb-repo .input { width: auto; max-width: 240px; }
.seg-n { margin-left: 6px; font-family: var(--mono); font-size: 11.5px; color: var(--faint); }
.seg button[aria-selected="true"] .seg-n { color: var(--muted); }
.ngroup { margin-top: 24px; }
.ng-h { display: flex; align-items: baseline; gap: 8px; font-size: 12.5px; font-weight: 600; color: var(--muted); padding-bottom: 8px; border-bottom: 1px solid var(--line); letter-spacing: 0; }
.ng-h span { font-family: var(--mono); font-weight: 400; color: var(--faint); }
.nlist { list-style: none; margin: 0; padding: 0; }
.nrow { display: grid; grid-template-columns: 24px minmax(0, 1fr) auto; gap: 4px 14px; padding: 14px 10px; margin: 0 -10px; border-bottom: 1px solid var(--line); transition: background .12s; }
.nrow:hover, .nrow.is-open { background: var(--hover); }
.nr-fav { padding-top: 1px; }
.nr-fav .fav, .nr-fav .fav-fb { width: 22px; height: 22px; }
.nr-main { min-width: 0; }
.nr-title { font-size: 15.5px; font-weight: 600; letter-spacing: -0.012em; line-height: 1.35; }
.nr-toggle { font: inherit; color: inherit; background: none; border: 0; padding: 0; text-align: left; cursor: pointer; letter-spacing: inherit; }
.nr-toggle:hover { text-decoration: underline; text-decoration-color: var(--line-strong); text-underline-offset: 3px; }
.nr-idea { margin-top: 3px; font-size: 14px; line-height: 1.5; color: var(--muted); max-width: 72ch; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; text-wrap: pretty; }
.nrow.is-open .nr-idea { display: block; -webkit-line-clamp: unset; color: oklch(0.3 0.03 262); }
.nr-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 12px; margin-top: 8px; font-size: 13px; color: var(--muted); }
.nr-meta .rel { font-size: 12px; padding: 2px 8px 2px 6px; }
.nr-dest { display: inline-flex; align-items: center; }
.nr-dest a, .nr-dest .wait { display: inline-flex; align-items: center; gap: 4px; text-decoration: none; font-weight: 500; }
.nr-dest a { color: var(--blue-deep); }
.nr-dest a:hover { text-decoration: underline; text-underline-offset: 3px; }
.nr-dest .ico { width: 14px; height: 14px; }
.nr-dest .wait { color: var(--muted); font-weight: 400; }
.nr-dest .bad { color: var(--red); }
.nr-side { display: flex; align-items: center; gap: 6px; align-self: start; }
.nr-side time { font-family: var(--mono); font-size: 12px; color: var(--faint); white-space: nowrap; }
.nr-side .btn-icon { opacity: 0; transition: opacity .12s; }
.nrow:hover .nr-side .btn-icon, .nrow:focus-within .nr-side .btn-icon { opacity: 1; }
@media (hover: none) { .nr-side .btn-icon { opacity: 1; } }
.nr-md { margin-top: 14px; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; background: var(--surface); box-shadow: var(--shadow-1); }
.nr-md-bar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 6px 6px 12px; background: var(--sunk); border-bottom: 1px solid var(--line); }
.nr-md-bar .mono { font-size: 12px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nr-md .md { margin: 0; border: 0; border-radius: 0; background: var(--surface); max-height: 360px; overflow: auto; font-size: 12.5px; padding: 14px 16px; }
.nl-empty { padding: 40px 0; display: grid; gap: 12px; justify-items: start; color: var(--muted); }
.nl-empty b { color: var(--ink); }

/* ---------- settings ---------- */
.settings-page { max-width: 980px; margin: 0; }
.set-grid { display: grid; grid-template-columns: 168px minmax(0, 1fr); gap: 48px; align-items: start; }
.set-nav { position: sticky; top: 24px; }
.set-nav ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 1px; }
.set-nav button { font: inherit; font-size: 14px; width: 100%; text-align: left; padding: 6px 10px; border: 0; background: none; border-radius: 7px; color: var(--muted); cursor: pointer; transition: background .12s, color .12s; }
.set-nav button:hover { background: var(--sunk); color: var(--ink); }
.set-nav button[aria-current] { background: var(--sunk); color: var(--ink); font-weight: 550; }
.set-nav .is-danger { color: var(--red); }
.set-nav .is-danger:hover, .set-nav .is-danger[aria-current] { color: var(--red); background: var(--red-soft); }
.set-main { display: grid; gap: 44px; max-width: 680px; min-width: 0; }
.sset { scroll-margin-top: 24px; }
.sset-h { margin-bottom: 12px; }
.sset-h h2 { font-size: 16px; font-weight: 600; letter-spacing: -0.012em; }
.sset-h h2:focus { outline: none; }
.sset-h p { margin-top: 2px; font-size: 14px; color: var(--muted); max-width: 54ch; text-wrap: pretty; }
.panel { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow-1); }
.panel-pad { padding: 16px 18px 18px; }
.prow { display: flex; align-items: center; justify-content: space-between; gap: 12px 24px; padding: 14px 18px; min-height: 64px; }
.prow + .prow { border-top: 1px solid var(--line); }
.prow-l { min-width: 0; }
.prow-l h3, .prow-l > label { display: block; font-size: 14.5px; font-weight: 550; letter-spacing: -0.005em; color: var(--ink); }
.prow-l p { margin-top: 1px; font-size: 13.5px; color: var(--muted); text-wrap: pretty; }
.prow-l h3.mono { font-size: 13.5px; font-weight: 500; }
.prow > select.input { width: 220px; flex: none; }
.prow > .input-num { width: 88px; flex: none; font-variant-numeric: tabular-nums; }
.prow-v { font-size: 13.5px; color: var(--muted); overflow-wrap: anywhere; text-align: right; }
.prow-stack { flex-direction: column; align-items: stretch; }
.prow-stack .field { max-width: 420px; }
.pfoot { display: flex; align-items: center; justify-content: flex-end; gap: 10px; padding: 12px 18px; border-top: 1px solid var(--line); background: var(--foot); border-radius: 0 0 12px 12px; flex-wrap: wrap; }
.pfoot .form-msg { margin-right: auto; min-height: 0; }
.form-msg.ok { color: var(--green); }
.status-pill { display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 500; padding: 3px 10px; border-radius: 999px; background: var(--sunk); color: var(--muted); white-space: nowrap; text-decoration: none; }
.status-pill .ico { width: 13px; height: 13px; }
.status-pill.bad { background: var(--red-soft); color: var(--red); }
.sset .rules { margin-top: 10px; padding: 0; background: none; border-radius: 0; }
.sset .rules summary { font-size: 13.5px; color: var(--muted); cursor: pointer; width: fit-content; }
.sset .rules summary:hover { color: var(--ink); }
.sset .rules dl { margin: 10px 0 0; padding: 14px 16px; background: var(--sunk); border-radius: 10px; display: grid; gap: 10px; }
.sset .rules dl > div { display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 12px; }
.sset .rules dt { font-size: 13.5px; font-weight: 600; }
.sset .rules dd { margin: 0; font-size: 13.5px; color: var(--muted); text-wrap: pretty; }
.keymap { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; margin: 0; padding: 14px 18px 16px; border-top: 1px solid var(--line); }
.keymap > div { display: flex; align-items: center; gap: 10px; transition: opacity .15s; }
.keymap dt, .keymap dd { margin: 0; }
.keymap dd { font-size: 13.5px; color: var(--muted); }
.keymap .kbd { display: inline-grid; place-items: center; min-width: 26px; height: 24px; color: var(--ink); background: var(--surface); border-color: var(--line-strong); box-shadow: 0 1px 0 var(--line-strong); font-size: 12px; }
.keymap .is-off { opacity: .4; }
.sset .fresh { margin: 0 0 12px; border-radius: 12px; }
.panel .tok-form { margin-top: 0; }
.panel .tok-form .field { max-width: none; }
.panel .tokens { margin-top: 14px; }
.panel .tokens li { padding: 10px 0; gap: 4px 12px; }
.panel .tokens .t { font-size: 14px; font-weight: 550; }
.panel .tokens .d { font-size: 13px; flex: 1 1 260px; }
.panel .form-msg:empty { display: none; }
.panel-danger { border-color: oklch(0.87 0.05 28); }
.panel-danger .pfoot { background: oklch(0.985 0.008 25); }

/* ---------- responsive ---------- */
@media (max-width: 1100px) {
  .queue-grid { grid-template-columns: minmax(0, 1fr); }
  .brain { max-width: 620px; border-top: 1px solid var(--line); padding-top: 24px; position: static; }
}
@media (max-width: 960px) {
  .set-grid { grid-template-columns: minmax(0, 1fr); gap: 20px; }
  .set-nav { top: 0; z-index: 10; margin: 0 calc(-1 * clamp(20px, 3.4vw, 48px)); padding: 8px clamp(20px, 3.4vw, 48px); background: oklch(0.992 0.002 258 / .94); backdrop-filter: blur(8px); border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
  .set-nav ul { display: flex; gap: 2px; width: max-content; }
  .set-nav button { white-space: nowrap; }
}
@media (max-width: 820px) {
  .shell { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto 1fr; align-content: start; }
  .side { background: var(--surface); padding: 10px 16px; }
  .main { padding: 20px 16px calc(96px + env(safe-area-inset-bottom)); }
  .input { font-size: 16px; }
  .set-nav { top: 56px; margin-inline: -16px; padding-inline: 16px; }
  .brain { border-top: 1px solid var(--line); }
  .head h1 { font-size: 24px; }
  .stack > .actions { margin-top: 12px; }
  .stack .actions { background: oklch(0.992 0.002 258 / .96); }
  .c-top, .c-body { padding-inline: 18px; }
  .c-evidence, .c-why { margin-inline: 18px; }
  .c-foot { padding-inline: 18px; }
  .c-title { font-size: 20px; }
  .nr-side .btn-icon { width: 44px; height: 44px; }
}
@media (max-width: 640px) {
  .prow { flex-wrap: wrap; }
  .prow > select.input, .prow > .input-num { width: 100%; }
  .keymap { grid-template-columns: 1fr 1fr; }
  .sset .rules dl > div { grid-template-columns: 1fr; gap: 2px; }
  .nrow { gap: 4px 12px; }
  .nr-side .btn-icon { display: none; }
  .toolbar .seg { width: 100%; overflow-x: auto; }
  .tb-search { max-width: none; }
  .q-top .strip-stats { grid-template-columns: 1fr 1fr; width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .segs li, .segbar i, .nrow, .keymap > div { transition: none; }
}
.kbd, .btn kbd { font-family: var(--font); font-weight: 600; }
.panel .tok-form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1.3fr) auto; align-items: end; gap: 10px; }
@media (max-width: 640px) { .panel .tok-form { grid-template-columns: minmax(0, 1fr); } .panel .tok-form .btn { width: 100%; } }

/* =====================================================================
   Home: the command center. A dark band holds the pipeline and the
   14-day timeline. Four panels below: up next, signal, sources, brain.
   ===================================================================== */
.i-home { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/house.svg); }
.i-bot { --i: url(https://cdn.jsdelivr.net/npm/lucide-static@0.460.0/icons/bot.svg); }
:root {
  --hq: oklch(0.205 0.045 264);
  --hq-2: oklch(0.255 0.055 264);
  --hq-ink: oklch(0.97 0.01 262);
  --hq-mute: oklch(0.76 0.035 262);
  --hq-line: oklch(1 0 0 / .12);
  --hq-glow: oklch(0.72 0.17 262);
}
.home { max-width: 1180px; margin: 0; display: grid; gap: 20px; }
.home #banners:empty { display: none; }
.home #banners .banner { margin: 0; }

.hq { position: relative; overflow: hidden; border-radius: 18px; background: var(--hq); color: var(--hq-ink); padding: 28px 32px 22px; isolation: isolate; box-shadow: 0 1px 0 oklch(1 0 0 / .06) inset, 0 24px 48px -28px oklch(0.2 0.1 264 / .6); }
.hq::before { content: ""; position: absolute; inset: 0; z-index: -1; background-image: radial-gradient(oklch(1 0 0 / .09) 1px, transparent 1.2px); background-size: 18px 18px; mask-image: linear-gradient(180deg, #000 0%, transparent 85%); -webkit-mask-image: linear-gradient(180deg, #000 0%, transparent 85%); }
.hq-skel { height: 380px; background: var(--sunk); box-shadow: none; }
.hq-top { display: flex; justify-content: space-between; align-items: flex-end; gap: 20px 32px; flex-wrap: wrap; }
.hq-date { font-size: 13px; color: var(--hq-mute); font-family: var(--mono); letter-spacing: 0; }
.hq h1 { font-size: 34px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.1; margin-top: 6px; }
.hq-sum { margin-top: 8px; font-size: 16px; color: oklch(0.86 0.025 262); max-width: 46ch; text-wrap: pretty; }
.hq-cta { display: flex; gap: 10px; flex-wrap: wrap; }
.hq .btn-blue { background: oklch(0.6 0.2 262); box-shadow: 0 1px 0 oklch(1 0 0 / .25) inset, 0 10px 24px -10px oklch(0.6 0.22 262 / .8); }
.hq .btn-blue:hover:not(:disabled) { background: oklch(0.55 0.21 262); }
.btn-dim { background: oklch(1 0 0 / .08); color: var(--hq-ink); border-color: oklch(1 0 0 / .18); }
.btn-dim:hover:not(:disabled) { background: oklch(1 0 0 / .14); border-color: oklch(1 0 0 / .3); }
.hq :focus-visible { outline-color: var(--hq-glow); }

/* pipeline: five stations on one track, with packets flowing left to right */
.flow { --node: 48px; position: relative; list-style: none; margin: 30px 0 0; padding: 0; display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; }
.flow::before, .flow::after { content: ""; position: absolute; top: calc(var(--node) / 2 - 1px); left: 10%; right: 10%; height: 2px; border-radius: 1px; }
.flow::before { background: var(--hq-line); }
.flow::after { background-image: radial-gradient(circle, var(--hq-glow) 0 2px, transparent 2.5px); background-size: 34px 2px; background-repeat: repeat-x; height: 4px; top: calc(var(--node) / 2 - 2px); opacity: 0; }
.flow.has-run::after { opacity: .9; }
.flow.is-running::after { opacity: 1; background-image: radial-gradient(circle, oklch(0.85 0.12 262) 0 2.5px, transparent 3px); }
@media (prefers-reduced-motion: no-preference) {
  .flow.has-run::after { animation: packets 2.4s linear infinite; }
  .flow.is-running::after { animation-duration: .7s; }
  @keyframes packets { to { background-position-x: 34px; } }
}
.st { position: relative; min-width: 0; }
.st-a { display: grid; justify-items: center; text-align: center; gap: 2px; color: inherit; text-decoration: none; padding: 0 4px 10px; border-radius: 14px; transition: background .2s var(--ease); }
.st-a:hover { background: oklch(1 0 0 / .05); }
.st-node { position: relative; z-index: 1; width: var(--node); height: var(--node); border-radius: 50%; display: grid; place-items: center; background: var(--hq-2); border: 1px solid oklch(1 0 0 / .16); color: oklch(0.9 0.03 262); margin-bottom: 10px; transition: border-color .2s, background .2s, transform .25s var(--ease); }
.st-node .ico { width: 20px; height: 20px; }
.st-a:hover .st-node { border-color: oklch(1 0 0 / .4); transform: translateY(-2px); }
.st-l { font-size: 12.5px; color: var(--hq-mute); font-weight: 500; }
.st-v { font-size: 30px; font-weight: 650; letter-spacing: -0.03em; line-height: 1.15; font-variant-numeric: tabular-nums; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.st-v[data-count=""] { font-size: 22px; line-height: 1.55; letter-spacing: -0.02em; }
.st-s { font-size: 12.5px; color: var(--hq-mute); text-wrap: balance; max-width: 18ch; }
.st.is-hot .st-node { background: oklch(0.55 0.21 262); border-color: oklch(0.75 0.15 262); color: #fff; box-shadow: 0 0 0 6px oklch(0.6 0.2 262 / .18); }
.st.is-live .st-node { border-color: oklch(0.8 0.12 262); color: #fff; }
@media (prefers-reduced-motion: no-preference) {
  .st.is-hot .st-node::after, .st.is-live .st-node::after { content: ""; position: absolute; inset: -6px; border-radius: 50%; border: 2px solid oklch(0.7 0.17 262); animation: ping 2.2s var(--ease) infinite; }
  .st.is-live .st-node::after { animation-duration: 1.1s; }
  @keyframes ping { 0% { transform: scale(.9); opacity: .9; } 100% { transform: scale(1.45); opacity: 0; } }
}
.st-favs { display: flex; margin-top: 8px; }
.st-favs .fav, .st-favs .fav-fb { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--hq); margin-left: -6px; background: var(--hq-2); }
.st-favs > :first-child { margin-left: 0; }
.st-favs .fav-fb { color: var(--hq-ink); background: var(--hq-2); font-size: 10px; }
.st-mix { display: flex; gap: 2px; width: 64px; height: 5px; margin-top: 10px; border-radius: 3px; overflow: hidden; }
.mix { display: block; min-width: 4px; }
.mix-new { background: oklch(0.75 0.13 160); }
.mix-builds { background: oklch(0.72 0.15 262); }
.mix-conflict { background: oklch(0.7 0.17 28); }

/* timeline */
.tl { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 18px; margin-top: 14px; padding-top: 16px; border-top: 1px solid var(--hq-line); font-size: 12px; color: var(--hq-mute); }
.tl-cap { font-weight: 500; white-space: nowrap; }
.tl-track { position: relative; height: 22px; margin-right: 18px; }
.tl-track::before { content: ""; position: absolute; left: 0; right: 0; top: 50%; height: 1px; background: var(--hq-line); }
.tl-tick { position: absolute; top: calc(50% - 3px); width: 1px; height: 6px; background: oklch(1 0 0 / .18); }
.tl-tick.is-major { top: calc(50% - 5px); height: 10px; background: oklch(1 0 0 / .3); }
.tl-ev { position: absolute; top: 50%; width: 10px; height: 10px; border-radius: 50%; transform: translate(-50%, -50%); background: var(--hq-glow); box-shadow: 0 0 0 3px var(--hq); cursor: default; }
.tl-ev.tl-pr { background: oklch(0.78 0.14 160); border-radius: 3px; transform: translate(-50%, -50%) rotate(45deg); width: 9px; height: 9px; }
.tl-ev.tl-bad { background: oklch(0.7 0.17 28); }
.tl-now { position: absolute; top: 0; bottom: 0; width: 1px; background: oklch(1 0 0 / .45); }
.tl-now span { white-space: nowrap; position: absolute; left: 6px; top: 50%; transform: translateY(-50%); font-family: var(--mono); font-size: 11px; color: var(--hq-ink); }
.tl-key { display: flex; gap: 14px; white-space: nowrap; }
.tl-key span { display: inline-flex; align-items: center; gap: 6px; }
.tl-key .tl-ev { position: static; transform: none; box-shadow: none; display: inline-block; width: 8px; height: 8px; }
.tl-key .tl-ev.tl-pr { transform: rotate(45deg); width: 7px; height: 7px; }

/* panels */
.home-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 20px; align-items: stretch; }
.hpn { background: var(--surface); border: 1px solid var(--line); border-radius: 16px; padding: 20px 22px 20px; box-shadow: var(--shadow-1); display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.hp-h { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.hp-h h2 { font-size: 15px; font-weight: 600; letter-spacing: -0.01em; }
.hp-sub { font-size: 13px; color: var(--muted); }
.hp-link { font-size: 13.5px; color: var(--muted); text-decoration: none; display: inline-flex; align-items: center; gap: 4px; font-weight: 500; }
.hp-link .ico { width: 14px; height: 14px; transition: transform .2s var(--ease); }
.hp-link:hover { color: var(--ink); }
.hp-link:hover .ico { transform: translateX(2px); }
.hp-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: auto; }
.hp-foot .hint .kbd { color: var(--muted); }

/* up next: three cards fanned */
.fan { position: relative; display: block; height: 228px; color: inherit; text-decoration: none; margin: 4px 0 6px; }
.mini { position: absolute; left: calc(var(--i) * 14px); right: calc(var(--i) * 14px); top: calc(var(--i) * -10px + 20px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 14px; padding: 16px 18px; display: grid; gap: 8px; align-content: start; height: 200px; transform-origin: 50% 100%; box-shadow: var(--shadow-2); transition: transform .35s var(--ease), box-shadow .35s var(--ease); }
.mini[style*="--i:1"] { opacity: .9; transform: rotate(-2.2deg); }
.mini[style*="--i:2"] { opacity: .75; transform: rotate(2deg); }
.fan:hover .mini[style*="--i:0"], .fan:focus-visible .mini[style*="--i:0"] { transform: translateY(-4px); box-shadow: var(--lift); }
.fan:hover .mini[style*="--i:1"] { transform: rotate(-4.5deg) translateX(-18px); }
.fan:hover .mini[style*="--i:2"] { transform: rotate(4deg) translateX(18px); }
.fan:focus-visible { outline: none; }
.fan:focus-visible .mini[style*="--i:0"] { outline: 2px solid var(--blue); outline-offset: 3px; }
.mini-top { display: flex; justify-content: space-between; align-items: center; gap: 8px; flex-wrap: wrap; }
.mini .c-src { font-size: 13px; }
.mini .rel { font-size: 12px; padding: 2px 8px 2px 6px; }
.mini h3 { font-size: 18px; font-weight: 650; letter-spacing: -0.018em; line-height: 1.3; text-wrap: balance; }
.mini p { font-size: 14px; color: var(--muted); line-height: 1.5; display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; overflow: hidden; }
.mini[style*="--i:1"] > *, .mini[style*="--i:2"] > * { visibility: hidden; }
.next-empty { flex: 1; display: grid; place-items: center; text-align: center; gap: 12px; padding: 24px 0; color: var(--muted); }
.next-empty b { color: var(--ink); display: block; }
.ne-ring { width: 52px; height: 52px; border-radius: 50%; display: grid; place-items: center; background: var(--green-soft); color: var(--green); }
.ne-ring .ico { width: 22px; height: 22px; }

/* signal */
.sig { display: flex; align-items: center; gap: 24px; flex-wrap: wrap; }
.sig-ring { position: relative; width: 132px; height: 132px; flex: none; }
.ring { width: 100%; height: 100%; display: block; }
.ring-bg { fill: none; stroke: var(--sunk); stroke-width: 11; }
.ring-fg { fill: none; stroke: oklch(0.72 0.12 262); stroke-width: 11; stroke-linecap: round; transition: stroke-dashoffset 1s var(--ease); }
.ring-fg.good { stroke: var(--blue); }
.ring-tgt { fill: var(--surface); stroke: var(--ink); stroke-width: 2; }
.sig-c { position: absolute; inset: 0; display: grid; place-content: center; text-align: center; grid-template-columns: auto auto; align-items: baseline; justify-content: center; }
.sig-c b { font-size: 34px; font-weight: 650; letter-spacing: -0.04em; font-variant-numeric: tabular-nums; line-height: 1; }
.sig-c span { font-size: 16px; font-weight: 600; color: var(--muted); }
.sig-c small { grid-column: 1 / -1; font-size: 12px; color: var(--muted); margin-top: 2px; }
.sig-stats { flex: 1 1 160px; margin: 0; display: grid; gap: 0; }
.sig-stats > div { display: flex; justify-content: space-between; align-items: baseline; padding: 8px 0; border-bottom: 1px solid var(--line); }
.sig-stats > div:last-child { border-bottom: 0; }
.sig-stats dt { font-size: 13.5px; color: var(--muted); }
.sig-stats dd { margin: 0; font-size: 18px; font-weight: 600; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.wk { display: flex; align-items: flex-end; gap: 8px; height: 92px; padding-top: 4px; }
.wk-c { flex: 1; height: 100%; display: grid; grid-template-rows: minmax(0, 1fr) auto; justify-items: center; gap: 6px; min-width: 0; }
.wk-bar { align-self: end; width: 100%; max-width: 30px; min-height: 4px; display: flex; flex-direction: column-reverse; border-radius: 5px; overflow: hidden; gap: 2px; }
.wk-bar i { background: var(--blue); min-height: 0; }
.wk-bar em { background: var(--line-strong); min-height: 0; }
.wk-l { font-family: var(--mono); font-size: 11px; color: var(--faint); }
.wk-key { display: flex; gap: 14px; flex-wrap: wrap; font-size: 12.5px; color: var(--muted); }
.wk-key span { display: inline-flex; align-items: center; gap: 6px; }
.wk-key i { width: 9px; height: 9px; border-radius: 3px; display: inline-block; }
.k-yes { background: var(--blue); }
.k-no { background: var(--line-strong); }

/* source signal */
.sl { list-style: none; margin: 0; padding: 0; display: grid; }
.sl li { display: grid; grid-template-columns: 18px minmax(0, 190px) minmax(0, 1fr) 92px; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.sl li:last-child { border-bottom: 0; }
.sl-rank { font-family: var(--mono); font-size: 12px; color: var(--faint); text-align: right; }
.sl-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 500; }
.sl-name > span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.sl-bar { height: 8px; border-radius: 4px; background: var(--sunk); overflow: hidden; }
.sl-bar > span { display: flex; height: 100%; gap: 2px; }
.sl-bar i { background: var(--blue); }
.sl-bar em { background: var(--line-strong); }
.sl-v { font-size: 12.5px; color: var(--muted); text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
.sl-v b { color: var(--ink); font-weight: 600; }
@media (prefers-reduced-motion: no-preference) {
  .sl-bar > span, .wk-bar { animation: grow .8s var(--ease) both; }
  .sl-bar > span { transform-origin: left; }
  .wk-bar { transform-origin: bottom; }
  @keyframes grow { from { transform: scale(0, 1); } }
  .wk-bar { animation-name: growy; }
  @keyframes growy { from { transform: scale(1, 0); } }
}

/* second brain */
.bn { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 20px; align-items: center; }
.bn-big b { display: block; font-size: 40px; font-weight: 650; letter-spacing: -0.04em; line-height: 1; font-variant-numeric: tabular-nums; }
.bn-big span { font-size: 13px; color: var(--muted); }
.bn-repos { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; }
.bn-repos li { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 9px; background: var(--sunk); font-size: 13.5px; min-width: 0; }
.bn-repos .ico { width: 15px; height: 15px; color: var(--muted); }
.bn-repos .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; flex: 1; font-size: 13px; }
.bn-n { font-size: 12.5px; color: var(--muted); white-space: nowrap; }
.bn-repos .is-bad { background: var(--red-soft); color: var(--red); }
.bn-repos .is-bad .bn-n, .bn-repos .is-bad .ico { color: var(--red); }
.bn-alert { display: flex; align-items: center; gap: 8px; font-size: 13.5px; font-weight: 500; color: var(--red); text-decoration: none; }
.bn-topics { display: grid; gap: 8px; }
.bn-cap { font-size: 12.5px; color: var(--muted); font-weight: 500; }
.bn-topics .topic-list { margin: 0; }
.bn-topics .topic-list span { font-size: 12.5px; padding: 3px 10px; background: var(--blue-soft); border-color: transparent; color: var(--blue-ink); }
.hp-brain .hint a { color: var(--muted); }

/* responsive */
@media (max-width: 1100px) {
  .home-grid { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .sl li { grid-template-columns: 18px minmax(0, 150px) minmax(0, 1fr) 84px; }
}
@media (max-width: 900px) {
  .home-grid { grid-template-columns: minmax(0, 1fr); }
  .flow { grid-template-columns: repeat(5, minmax(96px, 1fr)); overflow-x: auto; padding-bottom: 4px; scrollbar-width: none; margin-inline: -8px; }
}
@media (max-width: 640px) {
  .hq { padding: 22px 18px 18px; border-radius: 16px; }
  .hq h1 { font-size: 28px; }
  .hq-cta { width: 100%; }
  .hq-cta .btn { flex: 1 1 auto; }
  .flow { --node: 40px; grid-template-columns: minmax(0, 1fr); gap: 0; margin-top: 22px; overflow: visible; margin-inline: 0; }
  .flow::before, .flow::after { left: calc(var(--node) / 2 - 1px); right: auto; top: 20px; bottom: 20px; width: 2px; height: auto; }
  .flow::after { width: 4px; left: calc(var(--node) / 2 - 2px); background-size: 2px 30px; background-repeat: repeat-y; background-image: radial-gradient(circle, var(--hq-glow) 0 2px, transparent 2.5px); }
  @media (prefers-reduced-motion: no-preference) { .flow.has-run::after { animation: packets-y 2.4s linear infinite; } @keyframes packets-y { to { background-position-y: 30px; } } }
  .st-a { grid-template-columns: var(--node) minmax(0, 1fr) auto; grid-template-areas: "n l v" "n s v" "n x x"; justify-items: start; text-align: left; column-gap: 14px; padding: 8px 0; align-items: center; }
  .st-node { grid-area: n; margin: 0; align-self: start; }
  .st-l { grid-area: l; }
  .st-s { grid-area: s; max-width: none; }
  .st-v { grid-area: v; font-size: 24px; justify-self: end; }
  .st-v[data-count=""] { font-size: 17px; max-width: 40vw; }
  .st-favs, .st-mix { grid-area: x; margin-top: 6px; }
  .tl { grid-template-columns: minmax(0, 1fr); gap: 10px; }
  .tl-track { margin-right: 28px; }
  .tl-key { display: none; }
  .hpn { padding: 18px 16px; }
  .fan { height: 236px; }
  .mini { height: 208px; }
  .sl li { grid-template-columns: 16px minmax(0, 1fr) 76px; }
  .sl-bar { grid-column: 2 / -1; grid-row: 2; }
  .bn { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  .ring-fg, .mini, .st-node, .st-a { transition: none; }
}
@media (max-width: 820px), (pointer: coarse) { .hp-foot .hint { display: none; } }
