/* Interpretability Lab. Tokens follow the Voice Data Lab (sandbox/voice_data_sandbox/static/app.css):
   dark by default, light under :root[data-theme="light"]. A new colour goes in both blocks. */
:root {
  --bg: #0b0d12; --panel: #12151c; --panel-2: #171b24; --line: #222836; --line-2: #2c3343;
  --text: #e6e9f0; --dim: #8a93a6; --faint: #5b6476;
  --accent: #8b7cff; --accent-2: #5ee0c1; --accent-rgb: 139,124,255; --accent-2-rgb: 94,224,193;
  --accent-ink: #d6d0ff; --on-accent: #0b0d12;
  --ok: #4ade80; --problem: #f59e0b; --bad: #f87171; --bad-rgb: 248,113,113;
  --radius: 12px; --topbar: rgba(11,13,18,.85); --hover-bg: rgba(255,255,255,.03);
  --shadow-c: rgba(0,0,0,.6);
  /* source tags (.stag): what produced a card's numbers */
  --src-model: #60a5fa; --src-sae: #b4a7ff; --src-ours: #34d399; --src-np: #fbbf24; --src-weights: #f472b6;
  --mono: "JetBrains Mono", "SF Mono", ui-monospace, Menlo, monospace;
  --sans: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", system-ui, sans-serif;
  color-scheme: dark;
}
:root[data-theme="light"] {
  --bg: #f6f7fb; --panel: #ffffff; --panel-2: #f1f3f8; --line: #e6e8ef; --line-2: #d8dce6;
  --text: #171a22; --dim: #5a6273; --faint: #8c93a3;
  --accent: #6d5cf0; --accent-2: #0f9f84; --accent-rgb: 109,92,240; --accent-2-rgb: 15,159,132;
  --accent-ink: #4f3fd1; --on-accent: #ffffff;
  --ok: #16a34a; --problem: #d97706; --bad: #dc2626; --bad-rgb: 220,38,38;
  --topbar: rgba(255,255,255,.82); --hover-bg: rgba(23,26,34,.035);
  --shadow-c: rgba(30,36,60,.14);
  --src-model: #1d4ed8; --src-sae: #6d28d9; --src-ours: #047857; --src-np: #b45309; --src-weights: #be185d;
  color-scheme: light;
}
:root[data-theme="light"] .card { box-shadow: 0 1px 2px rgba(30,36,60,.05), 0 8px 24px -12px rgba(30,36,60,.12); }
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; background: var(--bg); color: var(--text); font: 14px/1.5 var(--sans); -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; }
kbd { font: 10.5px var(--mono); padding: 0 5px; border: 1px solid currentColor; border-radius: 4px; opacity: .55; margin-left: 6px; }
code { font: 12px var(--mono); color: var(--accent-2); }
a { color: var(--accent-ink); }
[hidden] { display: none !important; }
h2 { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--dim); margin: 0; }

/* ---------- controls ---------- */
button { cursor: pointer; border: 1px solid var(--line-2); background: var(--panel-2); border-radius: 8px; padding: 6px 12px; transition: background .15s, border-color .15s, color .15s; }
button:hover { border-color: var(--faint); }
button:disabled { opacity: .45; cursor: default; }
button.ghost { background: transparent; }
button.icon { padding: 5px 9px; min-width: 32px; }
button.small { padding: 3px 9px; font-size: 12px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
button.primary:hover { filter: brightness(1.1); }
button.primary.busy { opacity: .75; cursor: progress; }
button.primary.busy kbd { display: none; }
button.primary.busy::after { content: ""; display: inline-block; width: 10px; height: 10px; margin-left: 8px; vertical-align: -1px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
/* old results while a newer run is on its way (app.js pending); shown only after .2 s */
.pending { position: relative; opacity: .4; transition: opacity .2s .2s; pointer-events: none; }
.pending::before { content: ""; position: absolute; left: 0; right: 0; top: -8px; height: 2px; border-radius: 2px;
  background: linear-gradient(90deg, transparent, var(--accent-2), transparent); background-size: 50% 100%; background-repeat: no-repeat;
  opacity: 0; animation: sweep 1.1s linear .2s infinite; }
@keyframes sweep { from { opacity: 1; background-position: -50% 0; } to { opacity: 1; background-position: 150% 0; } }
@media (prefers-reduced-motion: reduce) { .pending::before { animation: none; opacity: 1; background-size: 100% 100%; } button.primary.busy::after { animation: none; } }
/* new results just landed (app.js flash) */
.fresh { animation: fresh .6s ease-out; }
@keyframes fresh { from { background-color: rgba(var(--accent-rgb), .16); } to { background-color: transparent; } }
button.on { background: rgba(var(--accent-rgb),.16); border-color: var(--accent); color: var(--accent-ink); }
select { background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; padding: 5px 10px; outline: none; }
textarea, input[type=number] { width: 100%; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 10px 12px; outline: none; resize: vertical; font: 13.5px/1.55 var(--mono); }
textarea:focus, input:focus, select:focus { border-color: var(--accent); box-shadow: 0 0 0 3px rgba(var(--accent-rgb),.15); }
.seg, .mseg { display: inline-flex; border: 1px solid var(--line-2); border-radius: 8px; overflow: hidden; }
.seg button, .mseg button { border: 0; border-radius: 0; background: transparent; padding: 4px 10px; font-size: 12.5px; color: var(--dim); font-variant-numeric: tabular-nums; }
.seg button + button, .mseg button + button { border-left: 1px solid var(--line-2); }
.seg button.on, .mseg button.on { background: rgba(var(--accent-rgb),.16); color: var(--accent-ink); }
.hint { color: var(--faint); font-size: 12px; }
.pill { font-size: 11.5px; padding: 2px 9px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--dim); white-space: nowrap; }
.pill.demo { border-color: var(--problem); color: var(--problem); font-weight: 600; letter-spacing: .02em; }

/* ---------- top bar ---------- */
.top { position: relative; flex: none; min-height: 56px; flex-wrap: wrap; row-gap: 8px; display: flex; align-items: center; gap: 24px; padding: 10px 20px; background: var(--topbar); backdrop-filter: blur(12px); border-bottom: 1px solid var(--line); z-index: 20; }
.brand { font-weight: 650; letter-spacing: -.01em; display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.brand .sub { color: var(--faint); font-weight: 450; font-size: 12.5px; }
.logo { width: 18px; height: 18px; border-radius: 6px; background: conic-gradient(from 200deg, var(--accent), var(--accent-2), var(--accent)); box-shadow: 0 0 18px rgba(var(--accent-rgb),.45); }
.views { display: flex; gap: 4px; }
.views button { border-color: transparent; background: transparent; color: var(--dim); }
.views button.on { background: rgba(var(--accent-rgb),.16); border-color: var(--accent); color: var(--accent-ink); }
.top-tools { margin-left: auto; display: flex; align-items: center; gap: 12px; }
label.sel { display: flex; align-items: center; gap: 8px; color: var(--faint); font-size: 12px; }
.status { display: flex; align-items: center; gap: 7px; color: var(--dim); font-size: 12px; white-space: nowrap; max-width: 300px; overflow: hidden; text-overflow: ellipsis; }
.dot { flex: none; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--faint); }
.status.ready .dot { background: var(--ok); }
.status.busy .dot { background: var(--accent-2); animation: pulse 1.4s infinite; }
.status.err .dot { background: var(--bad); }
.logout { color: var(--dim); font-size: 12px; text-decoration: none; white-space: nowrap; }
.logout:hover { color: var(--text); }
/* load progress: a line on the top bar's bottom edge, and a panel under it (right side) */
.load-line { position: absolute; left: 0; right: 0; bottom: -1px; height: 2px; overflow: hidden; }
.load-line i { display: block; height: 100%; width: 0; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s linear; }
.loadbox { position: absolute; top: calc(100% + 10px); right: 20px; width: min(360px, calc(100vw - 32px)); padding: 14px 16px 12px; background: var(--panel); border: 1px solid var(--line-2); border-radius: var(--radius); box-shadow: 0 12px 32px -12px var(--shadow-c); font-size: 12.5px; }
.lb-head { display: flex; align-items: baseline; gap: 10px; margin-bottom: 9px; }
.lb-title { font-weight: 600; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-left { color: var(--accent-ink); font-variant-numeric: tabular-nums; white-space: nowrap; }
.lb-close { align-self: center; margin: -4px -6px -4px 0; padding: 0 6px; border: 0; background: transparent; color: var(--faint); font-size: 16px; line-height: 20px; border-radius: 6px; }
.lb-close:hover { color: var(--text); background: var(--panel-2); }
.lb-bar { position: relative; height: 6px; border-radius: 99px; background: var(--panel-2); border: 1px solid var(--line); overflow: hidden; }
.lb-bar i { position: absolute; inset: 0 auto 0 0; width: 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width .25s linear; overflow: hidden; }
.lb-bar i::after { content: ""; position: absolute; inset: 0; background: linear-gradient(90deg, transparent, rgba(255,255,255,.35), transparent); transform: translateX(-100%); animation: shimmer 1.6s infinite; }
.loadbox.done .lb-bar i::after { animation: none; }
.loadbox.slow .lb-left { color: var(--problem); }
@keyframes shimmer { to { transform: translateX(100%); } }
.lb-steps { list-style: none; margin: 10px 0 0; padding: 0; display: grid; gap: 4px; }
.lb-steps li { display: flex; gap: 8px; align-items: center; color: var(--faint); font-variant-numeric: tabular-nums; }
.lb-steps li .ic { width: 12px; text-align: center; flex: none; }
.lb-steps li .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lb-steps li.run { color: var(--text); }
.lb-steps li.run .ic::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); animation: pulse 1.4s infinite; }
.lb-steps li.done { color: var(--dim); }
.lb-steps li.done .ic { color: var(--ok); }
.lb-note { margin-top: 9px; color: var(--faint); font-size: 11.5px; line-height: 1.45; }
.lb-note:empty { display: none; }
@media (prefers-reduced-motion: reduce) { .lb-bar i::after, .lb-steps li.run .ic::before { animation: none; } }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(var(--accent-2-rgb),.6); } 70%, 100% { box-shadow: 0 0 0 7px rgba(var(--accent-2-rgb),0); } }

/* ---------- layout ---------- */
/* The top bar is in the flow (not fixed), so it can wrap on narrow screens without covering the page. */
body { display: flex; flex-direction: column; }
.layout { flex: 1; min-height: 0; position: relative; display: grid; grid-template-columns: 1fr 320px; }
.layout.no-notes { grid-template-columns: 1fr 0; }
.layout.no-notes .notes { display: none; }
.main { overflow-y: auto; padding: 24px 32px 80px; min-width: 0; display: flex; flex-direction: column; }
.view { display: flex; flex-direction: column; gap: 16px; max-width: 1180px; width: 100%; margin: 0 auto; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.card-head { display: flex; align-items: center; gap: 12px; margin-bottom: 12px; flex-wrap: wrap; }
.card-head .mseg, .card-head .ext, .card-head button:not(.qm) { margin-left: auto; }
.card-head .ext + button, .card-head button + .ext { margin-left: 0; }
/* Source tag: a quiet chip at the right of a card head, coloured by what produced the numbers.
   Last in the head; when a visible control sits before it, that control takes the auto margin. */
.stag { --c: var(--faint); flex: none; font: 600 10.5px/1.5 var(--sans); letter-spacing: .04em; white-space: nowrap; cursor: help;
  color: var(--c); border: 1px solid color-mix(in srgb, var(--c) 40%, transparent); background: color-mix(in srgb, var(--c) 9%, transparent);
  border-radius: 99px; padding: 0 7px; }
.stag[data-src="model"] { --c: var(--src-model); }
.stag[data-src="sae"] { --c: var(--src-sae); }
.stag[data-src="ours"] { --c: var(--src-ours); }
.stag[data-src="np"] { --c: var(--src-np); }
.stag[data-src="weights"] { --c: var(--src-weights); }
.card-head .stag, details.fold > summary .stag { margin-left: auto; }
/* Our own tooltip for the chips (app.js → chip tooltips): native title tooltips don't show everywhere. */
.chip-tip { position: fixed; z-index: 40; max-width: 300px; padding: 7px 10px; font: 12px/1.45 var(--sans); color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 8px; box-shadow: 0 10px 28px -8px var(--shadow-c); pointer-events: none; }
.card-head :is(.mseg, .ext, button:not(.qm)):not([hidden]) ~ .stag { margin-left: 0; }
/* Neuronpedia's labels: an LLM's reading, not a measurement. Dashed, uncoloured. */
.llm-tag, .flabel:not(.wait):not(.none)::before { font: 600 9.5px/1.4 var(--sans); letter-spacing: .04em; color: var(--faint);
  border: 1px dashed var(--line-2); border-radius: 99px; padding: 0 5px; white-space: nowrap; }
.flabel:not(.wait):not(.none)::before { content: "LLM label"; margin-right: 6px; vertical-align: 1px; }
.llm-tag { cursor: help; margin-right: 6px; vertical-align: 2px; }
.input-card textarea { min-height: 64px; }
.input-row { display: flex; align-items: center; gap: 12px; margin-top: 10px; flex-wrap: wrap; }
.input-row.first { margin: 0 0 10px; }
.input-row.strip { margin: 0; }
.input-row .primary { margin-left: auto; }
.presets { display: flex; gap: 6px; flex-wrap: wrap; }
.presets button { font-size: 12px; padding: 3px 10px; border-radius: 99px; background: transparent; color: var(--dim); }
.presets button:hover { color: var(--text); }
.presets button.g { border-style: dashed; }   /* Gonen et al.'s pairs, verbatim */
.presets .sep { font-size: 11px; color: var(--faint); align-self: center; margin: 0 2px 0 6px; }
.leak-pick { max-width: 260px; font-size: 12px; padding: 3px 8px; }
.leak-info { margin-top: 10px; font-size: 12px; line-height: 1.6; color: var(--dim); }
.leak-info b { color: var(--text); font-weight: 600; }
.leak-info .warn { color: var(--warn, #d9a441); }
.fid { display: flex; align-items: center; gap: 6px; color: var(--faint); font-size: 12px; }
.fid .hash { font: 14px var(--mono); color: var(--dim); }
.fid input { width: 120px; padding: 6px 10px; }
.empty { color: var(--faint); font-size: 13px; padding: 6px 0; }
.err { color: var(--bad); font-size: 13px; }

/* ---------- tokens ---------- */
.tokens { font: 14px/2.1 var(--mono); word-break: break-word; }
.tok { display: inline; padding: 3px 1px; border-radius: 4px; cursor: pointer; white-space: pre-wrap; box-shadow: inset 0 0 0 1px transparent; transition: box-shadow .1s; background: rgba(var(--accent-rgb), var(--a, 0)); }
.tok:hover { box-shadow: inset 0 0 0 1px var(--accent); }
.tok.sel { box-shadow: inset 0 0 0 2px var(--accent-2); }
.tok.first:not(.bos) { text-decoration: underline dashed var(--faint); text-underline-offset: 5px; }
.tok.bos { color: var(--faint); font-size: 11px; padding: 2px 5px; margin-right: 4px; border: 1px dashed var(--line-2); }
.tok + .tok { margin-left: 1px; }
.tokens.static .tok { cursor: default; }
.trow { padding: 10px 0; border-top: 1px solid var(--line); display: grid; grid-template-columns: 1fr 64px; gap: 12px; align-items: baseline; }
.trow:first-child { border-top: 0; padding-top: 0; }
.trow .mx { text-align: right; font: 12px var(--mono); color: var(--dim); }
.trow.pending .tokens { opacity: .7; }   /* our corpus: not shaded yet (api_corpus step 2 on its way) */
.trow .spin { display: inline-block; width: 8px; height: 8px; margin-left: 6px; vertical-align: 0;
  border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }

/* ---------- feature + token lists ---------- */
.flist, .nlist { display: flex; flex-direction: column; }
.frow { display: grid; grid-template-columns: 74px 1fr 52px 44px 22px; gap: 10px; align-items: center; padding: 5px 6px; border-radius: 8px; cursor: pointer; }
.frow:hover { background: var(--hover-bg); }
.frow.sel { background: rgba(var(--accent-rgb),.12); }
.frow .id { font: 12.5px var(--mono); color: var(--accent-ink); }
.frow .v, .frow .n { font: 12px var(--mono); color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
.frow .n { color: var(--faint); }
.frow a { color: var(--faint); text-decoration: none; text-align: center; }
.frow a:hover { color: var(--accent-ink); }
.frow:has(.flabel) { row-gap: 1px; }
.flabel { grid-column: 2 / -1; font-size: 12px; color: var(--dim); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.flabel.wait, .flabel.none { color: var(--faint); font-style: italic; }
.f-label { font-size: 16px; margin-top: 12px; }
.f-label:empty { display: none; }
.f-label .hint { display: block; margin-bottom: 2px; font-size: 12px; }
.ex-head { display: block; margin-bottom: 8px; }
.ex-head + .trow { border-top: 0; padding-top: 0; }
.src-tag { font: 11px/1.4 var(--sans); color: var(--faint); border: 1px solid var(--line); border-radius: 99px; padding: 1px 7px; margin-left: 8px; white-space: nowrap; }
details.fold > summary { list-style: none; cursor: pointer; display: flex; align-items: center; gap: 12px; }
details.fold > summary::-webkit-details-marker { display: none; }
details.fold > summary::before { content: "▸"; color: var(--faint); font-size: 12px; transition: transform .15s; }
details.fold[open] > summary::before { transform: rotate(90deg); }
details.fold[open] > summary { margin-bottom: 10px; }
.push-note { margin: 0 0 12px; }
.sub-h { font-size: 11.5px; letter-spacing: .06em; text-transform: uppercase; color: var(--dim); margin-bottom: 6px; }
.np-sum:not(:empty) + .np-frame:not(:empty) { margin-top: 14px; }
.bar { height: 6px; border-radius: 99px; background: var(--panel-2); overflow: hidden; position: relative; }
.bar i { position: absolute; inset: 0 auto 0 0; border-radius: 99px; background: linear-gradient(90deg, var(--accent), var(--accent-2)); }
.bar.two i.a { background: var(--faint); opacity: .7; height: 50%; }
.bar.two i.b { top: 50%; height: 50%; }
.nrow { display: grid; grid-template-columns: minmax(80px, 160px) 1fr 58px; gap: 10px; align-items: center; padding: 4px 6px; }
.nrow .t { font: 13px var(--mono); white-space: pre; overflow: hidden; text-overflow: ellipsis; }
.nrow .t::before, .nrow .t::after { content: "‹"; color: var(--faint); }
.nrow .t::after { content: "›"; }
.nrow .v { font: 12px var(--mono); color: var(--dim); text-align: right; }
.nrow.neg .bar i { background: linear-gradient(90deg, rgba(var(--bad-rgb),.5), var(--bad)); }
.legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--faint); margin-bottom: 6px; }
.legend i { display: inline-block; width: 14px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 5px; }

/* skeleton while a request runs: keeps the layout still */
.skel { height: 12px; border-radius: 6px; margin: 9px 0; background: linear-gradient(90deg, var(--panel-2) 0%, var(--line) 50%, var(--panel-2) 100%); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

/* ---------- Neuronpedia embed ---------- */
.np-frame iframe { width: 100%; height: 640px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }

/* ---------- notes panel ---------- */
.notes { border-left: 1px solid var(--line); background: var(--panel); overflow-y: auto; display: flex; flex-direction: column; }
.notes-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 18px 6px; }
.notes-body { padding: 4px 18px 12px; font-size: 13px; color: var(--dim); }
.notes-body p { margin: 0 0 10px; }
.notes-body b { color: var(--text); font-weight: 600; }
.notes-body .term { color: var(--accent-ink); }
.notes-body .src { font-size: 11.5px; color: var(--faint); border-top: 1px solid var(--line); padding-top: 10px; margin-top: 12px; }
.notes-body .src a { color: var(--faint); }
.notes-legend { padding: 10px 18px 14px; border-top: 1px solid var(--line); font-size: 12px; color: var(--dim); display: grid; gap: 5px; }
.notes-legend .stag, .notes-legend .llm-tag { margin-right: 4px; }
.notes-legend .src { font-size: 11.5px; color: var(--faint); }
.notes-model { margin-top: auto; padding: 12px 18px 18px; border-top: 1px solid var(--line); font-size: 12px; color: var(--faint); }
.notes-model b { color: var(--dim); font-weight: 600; }

/* ---------- toast ---------- */
.toast { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px; padding: 9px 16px; font-size: 13px; box-shadow: 0 12px 32px -8px var(--shadow-c); z-index: 30; max-width: min(640px, calc(100vw - 32px)); }
.toast.bad { border-color: var(--bad); color: var(--bad); }

/* ---------- narrow screens ---------- */
@media (max-width: 1280px) {
  .top { gap: 16px; }
  .brand .sub, label.sel .lbl, .status:not(.busy):not(.err) #status-text { display: none; }
  .top-tools { gap: 10px; }
}
@media (max-width: 1100px) {
  .layout, .layout.no-notes { grid-template-columns: 1fr; }
  .notes { position: absolute; top: 0; right: 0; bottom: 0; width: min(340px, 100%); z-index: 15; box-shadow: -12px 0 32px -12px var(--shadow-c); }
  .layout.no-notes .notes { display: none; }
  .layout:not(.no-notes) .notes { display: flex; }
}
@media (max-width: 860px) {
  .top { gap: 10px; padding: 8px 16px; }
  .top-tools { margin-left: 0; flex-wrap: wrap; gap: 8px; }
  .main { padding: 16px 16px 60px; }
  .grid2 { grid-template-columns: 1fr; }
  .frow { grid-template-columns: 64px 1fr 46px 40px 18px; gap: 8px; }
}

/* Compare, Answer point: the reply with its answer word, the answer odds, the concept word */
.reply { font: 12.5px/1.6 var(--mono); color: var(--dim); margin: -2px 0 10px; padding: 6px 8px; background: var(--panel-2);
  border-radius: 8px; max-height: 9.6em; overflow: auto; word-break: break-word; }
.reply .hint { font-family: inherit; margin-right: 4px; }
.reply .rest { color: var(--faint); }   /* after the answer sentence: fetched later (api_reply_rest) */
.reply .writing { color: var(--faint); font-style: italic; white-space: nowrap; }
.reply .writing .spin, .fsearch .spin { display: inline-block; width: 8px; height: 8px; margin: 0 4px 0 2px; vertical-align: 0;
  border: 1.5px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: spin .7s linear infinite; }
.reply mark { background: rgba(var(--accent-2-rgb),.22); color: var(--text); border-radius: 4px; padding: 0 3px; }
.nrow.chosen .t { color: var(--text); font-weight: 600; }
.nrow.chosen { background: rgba(var(--accent-2-rgb),.10); border-radius: 6px; }
.tk { font: 12.5px var(--mono); color: var(--text); white-space: pre; }
.tk::before { content: "‹"; color: var(--faint); } .tk::after { content: "›"; color: var(--faint); }
.odds { width: 100%; border-collapse: collapse; font-size: 12.5px; margin: 2px 0 8px; }
.odds th, .odds td { padding: 5px 8px; text-align: right; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
.odds th:first-child, .odds td:first-child { text-align: left; color: var(--dim); }
.odds th { font-weight: 500; }
.odds th i { display: block; font: 11px var(--sans, inherit); font-style: normal; color: var(--faint); }
.odds td { font-family: var(--mono); }
#c-odds p, #c-concept p { margin: 8px 0 0; line-height: 1.5; }
#c-concept > .hint:first-child { margin-bottom: 6px; }
.crow { grid-template-columns: 74px 1fr 1fr 1fr 22px; }
.crow.chead { display: grid; gap: 10px; padding: 0 6px 2px; font-size: 11px; color: var(--faint); cursor: default; }
.crow .bar i.c { background: var(--accent-2); }
.crow .bar i.b { background: var(--accent); }
.crow .bar i.a { background: var(--faint); opacity: .7; }
.crow.carried .id::before { content: "▸ "; color: var(--accent-2); }
@media (max-width: 700px) { .crow { grid-template-columns: 64px 1fr 1fr 1fr 18px; gap: 8px; } }

/* "?" on a card: opens the notes panel at that card's entry (app.js CARD_NOTES) */
.qm { width: 18px; height: 18px; padding: 0; border-radius: 99px; font: 600 11px/16px var(--sans); color: var(--faint);
  background: transparent; border: 1px solid var(--line-2); margin-left: -4px; flex: none; cursor: pointer; }
.qm:hover, .qm:focus-visible { color: var(--accent-ink); border-color: var(--accent); }
.cardnotes { border-top: 1px solid var(--line); margin-top: 12px; padding-top: 10px; }
.cn-head { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--faint); margin-bottom: 8px; }
.cardnote { padding: 8px 10px; margin: 0 -10px 6px; border-radius: 8px; line-height: 1.5; transition: background-color .4s; }
.cardnote.hl { background: rgba(var(--accent-rgb), .16); }
.cn-row { display: block; font-size: 12px; margin-top: 2px; }
.cn-row i { font-style: normal; color: var(--faint); margin-right: 6px; }
/* the shading chip in the Tokens card (a clicked feature); ✕ turns it off */
.shadechip { font-size: 12px; color: var(--dim); border: 1px solid var(--accent); border-radius: 99px; padding: 2px 4px 2px 10px;
  background: rgba(var(--accent-rgb), .12); white-space: nowrap; }
.shadechip b { color: var(--accent-ink); font: 600 12px var(--mono); }
.shadechip button { border: 0; background: transparent; color: var(--dim); padding: 0 6px; font-size: 12px; cursor: pointer; }
.shadechip button:hover { color: var(--text); }

/* Feature view: label search (api_search) */
.fsearch input[type=search] { width: 260px; background: var(--panel-2); border: 1px solid var(--line-2); border-radius: 10px;
  padding: 6px 10px; outline: none; font: 13px var(--sans); }
.fsearch input[type=search]:focus { border-color: var(--faint); }
.hrow { display: grid; grid-template-columns: 74px 1fr 64px 72px 22px; gap: 10px; align-items: center; padding: 5px 6px; border-radius: 8px; cursor: pointer; }
.hrow:hover { background: var(--hover-bg); }
.hrow.sel { background: rgba(var(--accent-rgb),.12); }
.hrow .id { font: 12.5px var(--mono); color: var(--accent-ink); }
.hrow .lab { font-size: 12.5px; color: var(--dim); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hrow .lab b { color: var(--text); font-weight: 600; }
.hrow .v { font: 12px var(--mono); color: var(--dim); text-align: right; font-variant-numeric: tabular-nums; }
.hrow a { color: var(--faint); text-decoration: none; text-align: center; }
.hrow a:hover { color: var(--accent-ink); }
.hrow.hhead { cursor: default; font-size: 11px; color: var(--faint); padding-top: 0; }
.hrow.hhead:hover { background: none; }
.hrow.hhead span { text-align: right; } .hrow.hhead span:nth-child(2) { text-align: left; }
@media (max-width: 760px) { .fsearch input[type=search] { width: 100%; } .hrow { grid-template-columns: 58px 1fr 52px 60px 18px; gap: 6px; } }
