/* Hallmark · shape: app screen · genre: modern-minimal · theme: Console (deal 2/3, seed telegram-mini-app-admin-2152·445aaf76·2026-11-14·r0)
 * nav: top tab strip under the account line, Telegram's own Back and Main buttons · signature: the conversation preview, what the commenter receives, built live beside the rule · states: loading, empty, error, full on every list · console: graphite in Telegram dark, paper in Telegram light
 * axes: dark/grotesk-sans/chromatic-amber · posture: restrained · contrast: pass · v2.0.0 */
/* Hallmark · pre-emit critique: P4 H4 E4 S4 R3 V4 · weakest: R, the overview could read as four stat cards, so the readings sit in one ruled strip and the funnel carries the screen */
/* answered: faces, Host Grotesk and Atkinson Mono have no Cyrillic, so the system face and the system mono carry the same two roles */
@import url("./tokens.css");
@import url("./base.css");

/* ------------------------------------------------ the paper colourway (Telegram light) */
:root[data-theme="light"] {
  color-scheme: light;
  --color-paper: oklch(96.5% 0.006 85); --color-paper-2: oklch(99.2% 0.003 85); --color-paper-3: oklch(93.5% 0.007 85);
  --color-ink: oklch(19% 0.01 60); --color-ink-2: oklch(33% 0.01 60); --color-muted: oklch(46% 0.012 60);
  --color-rule: oklch(88% 0.008 70); --color-rule-2: oklch(77% 0.01 70);
  --color-accent: oklch(80% 0.15 78); --color-accent-ink: oklch(20% 0.04 70); --color-accent-soft: oklch(93% 0.05 85); --color-focus: oklch(55% 0.14 70);
  --color-accent-text: oklch(50% 0.13 65);
  --color-cool: oklch(52% 0.14 250); --color-cool-soft: oklch(93% 0.03 250);
  --color-ok: oklch(50% 0.13 150); --color-ok-soft: oklch(94% 0.04 150); --color-bad: oklch(53% 0.18 25); --color-bad-soft: oklch(94.5% 0.03 25);
  --color-scrim: oklch(19% 0.01 60 / 0.4);
}
:root { --color-accent-text: var(--color-accent); --color-scrim: oklch(10% 0.01 250 / 0.6); --color-shade: oklch(15% 0 0 / 0.35); --text-2xs: 0.75rem; --control: 40px; --measure: 640px; }

html { scroll-padding-top: 120px; }
body { background: var(--color-paper); min-height: 100dvh; font-size: 1rem; }
.i { width: 18px; height: 18px; flex: none; fill: none; stroke: currentColor; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; }
.i-sm { width: 16px; height: 16px; }
.mono { font-family: var(--font-outlier); font-variant-numeric: tabular-nums slashed-zero; letter-spacing: 0; }
.muted { color: var(--color-muted); }
.small { font-size: var(--text-sm); }

.app { max-width: var(--measure); margin-inline: auto; padding-bottom: calc(var(--space-2xl) + env(safe-area-inset-bottom)); }

/* ------------------------------------------------ the shell */
.top { position: sticky; top: 0; z-index: var(--z-sticky-nav); background: var(--color-paper); border-bottom: 1px solid var(--color-rule); }
.account { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md) var(--space-xs); min-height: 52px; }
.account img, .avatar { width: 32px; height: 32px; border-radius: 50%; object-fit: cover; background: var(--color-paper-3); border: 1px solid var(--color-rule); flex: none; }
.avatar { display: grid; place-items: center; color: var(--color-muted); }
.account .who { min-width: 0; flex: 1; line-height: 1.25; }
.account .who b { display: block; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.account .who span { font-size: var(--text-sm); color: var(--color-muted); }
.tabs { display: flex; overflow-x: auto; scrollbar-width: none; padding-inline: var(--space-2xs); }
.tabs::-webkit-scrollbar { display: none; }
.tabs a { position: relative; flex: 1 0 auto; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-2xs); min-height: 52px; padding: var(--space-xs); color: var(--color-muted); text-decoration: none; font-size: var(--text-sm); font-weight: 500; white-space: nowrap; transition: color var(--dur-micro) var(--ease-out); }
.tabs a .i { width: 20px; height: 20px; }
.tabs a span { font-size: var(--text-2xs); line-height: 1.2; }
@media (min-width: 480px) { .tabs a { flex-direction: row; gap: var(--space-xs); min-height: 44px; } .tabs a .i { width: 16px; height: 16px; } .tabs a span { font-size: var(--text-sm); } }
.tabs a::after { content: ""; position: absolute; left: var(--space-sm); right: var(--space-sm); bottom: -1px; height: 2px; border-radius: 2px; background: var(--color-accent); transform: scaleX(0); transition: transform var(--dur-short) var(--ease-out); }
.tabs a:hover { color: var(--color-ink-2); }
.tabs a[aria-current="page"] { color: var(--color-ink); }
.tabs a[aria-current="page"]::after { transform: scaleX(1); }
.tabs a:focus-visible { outline-offset: -2px; }

.view { display: grid; gap: var(--space-lg); padding: var(--space-md); outline: none; }
.view > * { min-width: 0; }
.stack { display: grid; gap: var(--space-lg); min-width: 0; }
.head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-sm); flex-wrap: wrap; }
.head h1 { font-size: var(--text-xl); }
.head p { color: var(--color-muted); font-size: var(--text-sm); margin-top: var(--space-2xs); }
h2 { font-size: var(--text-md); font-weight: 600; letter-spacing: 0; }
.section { display: grid; gap: var(--space-sm); }
.section > header { display: flex; align-items: baseline; justify-content: space-between; flex-wrap: wrap; gap: var(--space-2xs) var(--space-sm); }
.section > header h2 { flex: none; }
.section > header p, .hint { color: var(--color-muted); font-size: var(--text-sm); line-height: 1.45; }

.gate { display: grid; gap: var(--space-sm); padding: var(--space-2xl) var(--space-md); max-width: 30rem; }
.gate h1 { font-size: var(--text-xl); }
.gate p { color: var(--color-muted); }

/* ------------------------------------------------ surfaces */
.panel { color: var(--color-ink); background: var(--color-paper-2); border: 1px solid var(--color-rule); border-radius: var(--radius-card); overflow: hidden; }
.panel-pad { padding: var(--space-md); display: grid; gap: var(--space-sm); }
.panel-pad > *, .group > * { min-width: 0; }
.rows > * + * { border-top: 1px solid var(--color-rule); }
.row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); min-height: 52px; min-width: 0; }
.row .grow { flex: 1; min-width: 0; }
.row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .sub { font-size: var(--text-sm); color: var(--color-muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.row .end { display: flex; align-items: center; gap: var(--space-2xs); flex: none; }
a.row, button.row { width: 100%; color: inherit; text-decoration: none; background: none; border: 0; text-align: left; cursor: pointer; transition: background-color var(--dur-micro) var(--ease-out); }
a.row:hover, button.row:hover { background: var(--color-paper-3); }
a.row:active, button.row:active { background: var(--color-paper-3); }
a.row:focus-visible, button.row:focus-visible { outline-offset: -2px; }
.row .chev { color: var(--color-muted); }

.notice { display: flex; gap: var(--space-sm); align-items: flex-start; padding: var(--space-sm) var(--space-md); border: 1px solid var(--color-rule-2); border-radius: var(--radius-card); background: var(--color-paper-2); }
.notice .i { margin-top: var(--space-3xs); }
.notice.bad { border-color: color-mix(in oklab, var(--color-bad) 45%, var(--color-rule)); background: var(--color-bad-soft); }
.notice.bad .i { color: var(--color-bad); }
.notice.warn { border-color: color-mix(in oklab, var(--color-accent) 45%, var(--color-rule)); background: var(--color-accent-soft); }
.notice.warn .i { color: var(--color-accent-text); }
.notice .grow { flex: 1; min-width: 0; display: grid; gap: var(--space-xs); }
.notice p { font-size: var(--text-sm); color: var(--color-ink-2); }

/* ------------------------------------------------ controls */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: var(--control); padding: 0 var(--space-md); border-radius: var(--radius-pill); border: 1px solid var(--color-rule-2); background: var(--color-paper-2); color: var(--color-ink); font-weight: 500; font-size: var(--text-sm); text-decoration: none; cursor: pointer; white-space: nowrap; transition: background-color var(--dur-micro) var(--ease-out), border-color var(--dur-micro) var(--ease-out), transform var(--dur-micro) var(--ease-out); position: relative; }
.btn::before { content: ""; position: absolute; inset: -3px; }
.btn:hover { background: var(--color-paper-3); border-color: var(--color-muted); }
.btn:active { transform: scale(0.97); }
.btn:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.btn:disabled, .btn[aria-disabled="true"] { opacity: 0.5; cursor: not-allowed; transform: none; }
.btn[aria-busy="true"] { cursor: progress; color: var(--color-muted); }
.btn.primary { background: var(--color-accent); border-color: var(--color-accent); color: var(--color-accent-ink); }
.btn.primary:hover { background: color-mix(in oklab, var(--color-accent) 88%, var(--color-ink)); }
.btn.danger { color: var(--color-bad); }
.btn.danger:hover { background: var(--color-bad-soft); border-color: var(--color-bad); }
.btn.ghost { border-color: transparent; background: transparent; }
.btn.ghost:hover { background: var(--color-paper-3); }
.btn.icon { width: var(--control); padding: 0; }
.btn.wide { width: 100%; }
.btn.sm { min-height: 32px; padding: 0 var(--space-sm); }
.btn.sm.icon { width: 32px; }
.btn.sm::before { inset: -6px; }
.actions { display: flex; gap: var(--space-xs); flex-wrap: wrap; }

.field { display: grid; gap: var(--space-xs); min-width: 0; }
.field > span, .label { font-size: var(--text-sm); font-weight: 500; color: var(--color-ink-2); }
.field small { font-size: var(--text-sm); color: var(--color-muted); line-height: 1.45; }
.field small.err { color: var(--color-bad); }
.input, .select, .textarea { width: 100%; min-height: var(--control); padding: 0 var(--space-sm); border-radius: var(--radius-pill); border: 1px solid var(--color-rule); background: var(--color-paper-3); color: var(--color-ink); font-size: 1rem; transition: border-color var(--dur-micro) var(--ease-out); }
.textarea { padding: var(--space-xs) var(--space-sm); min-height: 88px; line-height: 1.45; resize: vertical; display: block; }
.input::placeholder, .textarea::placeholder { color: var(--color-muted); opacity: 0.85; }
.input:hover, .select:hover, .textarea:hover { border-color: var(--color-rule-2); }
.input:focus-visible, .select:focus-visible, .textarea:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 0; border-color: transparent; }
.input[aria-invalid="true"], .textarea[aria-invalid="true"] { border-color: var(--color-bad); }
.input:disabled { background: var(--color-paper); color: var(--color-muted); border-style: dashed; cursor: not-allowed; }
.input.mono { font-size: var(--text-sm); }
.select { appearance: none; padding-right: var(--space-xl); background-image: linear-gradient(45deg, transparent 50%, var(--color-muted) 50%), linear-gradient(135deg, var(--color-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
.count { font-size: var(--text-2xs); color: var(--color-muted); justify-self: end; }
.with-btn { display: flex; gap: var(--space-xs); }
.with-btn .input { flex: 1; min-width: 0; }

/* segmented control: a row of radio buttons */
.seg { display: flex; padding: var(--space-2xs); gap: var(--space-2xs); border-radius: calc(var(--radius-pill) + 4px); background: var(--color-paper-3); border: 1px solid var(--color-rule); overflow-x: auto; scrollbar-width: none; }
.seg button { flex: 1; min-height: 34px; padding: 0 var(--space-sm); border: 0; border-radius: var(--radius-pill); background: transparent; color: var(--color-muted); font-size: var(--text-sm); font-weight: 500; cursor: pointer; white-space: nowrap; transition: background-color var(--dur-micro) var(--ease-out), color var(--dur-micro) var(--ease-out); }
.seg button:hover { color: var(--color-ink); }
.seg button[aria-checked="true"], .seg button[aria-pressed="true"] { background: var(--color-paper-2); color: var(--color-ink); box-shadow: 0 0 0 1px var(--color-rule-2); }
.seg button:focus-visible { outline: 2px solid var(--color-focus); outline-offset: -2px; }
.seg.fit { display: inline-flex; }
.seg.fit button { flex: none; }

/* switch: a real checkbox */
.switch { position: relative; display: inline-flex; flex: none; width: 44px; height: 26px; }
.switch input { position: absolute; inset: -9px; width: calc(100% + 18px); height: calc(100% + 18px); margin: 0; opacity: 0; cursor: pointer; z-index: 1; }
.switch span { position: absolute; inset: 0; border-radius: 13px; background: var(--color-rule-2); transition: background-color var(--dur-short) var(--ease-out); }
.switch span::after { content: ""; position: absolute; top: 3px; left: 3px; width: 20px; height: 20px; border-radius: 50%; background: var(--color-paper-2); transition: transform var(--dur-short) var(--ease-out); }
.switch input:checked + span { background: var(--color-ok); }
.switch input:checked + span::after { transform: translateX(18px); }
.switch input:focus-visible + span { outline: 2px solid var(--color-focus); outline-offset: 2px; }
.switch input:disabled { cursor: not-allowed; }
.switch input:disabled + span { background: var(--color-rule); }
.switch input:disabled + span::after { background: var(--color-paper-3); }
.switch:hover input:not(:checked) + span { background: var(--color-muted); }
label.row { cursor: pointer; }

.check { display: flex; align-items: center; gap: var(--space-sm); min-height: 44px; cursor: pointer; }
.check input { width: 20px; height: 20px; margin: 0; accent-color: var(--color-accent); flex: none; cursor: pointer; }
.check input:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

/* state chips */
.chip { display: inline-flex; align-items: center; gap: var(--space-2xs); min-height: 22px; padding: 0 var(--space-xs); border-radius: 4px; border: 1px solid var(--color-rule); font-size: var(--text-2xs); font-weight: 500; color: var(--color-ink-2); background: var(--color-paper-2); white-space: nowrap; }
.chip.ok { color: var(--color-ok); border-color: color-mix(in oklab, var(--color-ok) 35%, transparent); background: var(--color-ok-soft); }
.chip.bad { color: var(--color-bad); border-color: color-mix(in oklab, var(--color-bad) 35%, transparent); background: var(--color-bad-soft); }
.chip.cool { color: var(--color-cool); border-color: color-mix(in oklab, var(--color-cool) 35%, transparent); background: var(--color-cool-soft); }
.chip.warn { color: var(--color-accent-text); border-color: color-mix(in oklab, var(--color-accent) 40%, transparent); background: var(--color-accent-soft); }
.chips { display: flex; flex-wrap: wrap; gap: var(--space-xs); }

/* keyword tokens in the editor */
.tokens { display: flex; flex-wrap: wrap; gap: var(--space-xs); padding: var(--space-2xs); min-height: var(--control); border-radius: var(--radius-pill); border: 1px solid var(--color-rule); background: var(--color-paper-3); cursor: text; }
.tokens:focus-within { outline: 2px solid var(--color-focus); }
.tokens .tok { display: inline-flex; align-items: center; gap: var(--space-3xs); min-height: 28px; padding: 0 var(--space-3xs) 0 var(--space-xs); border-radius: 4px; background: var(--color-paper-2); border: 1px solid var(--color-rule-2); font-size: var(--text-sm); font-weight: 500; }
.tokens .tok button { display: grid; place-items: center; width: 26px; height: 26px; border: 0; border-radius: 4px; background: none; color: var(--color-muted); cursor: pointer; }
.tokens .tok button:hover { color: var(--color-bad); background: var(--color-bad-soft); }
.tokens .tok button:focus-visible { outline: 2px solid var(--color-focus); }
.tokens input { flex: 1; min-width: 8rem; min-height: 28px; border: 0; background: transparent; color: var(--color-ink); font-size: 1rem; padding: 0 var(--space-2xs); outline: none; }
.tokens input::placeholder { color: var(--color-muted); }

/* ------------------------------------------------ overview */
.readings { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.reading { padding: var(--space-md); display: grid; gap: var(--space-3xs); align-content: start; min-width: 0; }
.reading:nth-child(2n) { border-left: 1px solid var(--color-rule); }
.reading:nth-child(n + 3) { border-top: 1px solid var(--color-rule); }
.reading b { font-family: var(--font-outlier); font-variant-numeric: tabular-nums slashed-zero; font-size: var(--text-2xl); font-weight: 500; line-height: 1.15; color: var(--color-ink); }
.reading span { font-size: var(--text-sm); color: var(--color-muted); line-height: 1.35; }
@media (min-width: 560px) { .readings { grid-template-columns: repeat(4, minmax(0, 1fr)); } .reading:nth-child(n) { border-top: 0; border-left: 1px solid var(--color-rule); } .reading:first-child { border-left: 0; } }

.chart { padding: var(--space-md) var(--space-md) var(--space-sm); display: grid; gap: var(--space-sm); }
.chart svg { width: 100%; height: auto; overflow: visible; }
.chart .grid line { stroke: var(--color-rule); stroke-width: 1; }
.chart .axis text { fill: var(--color-muted); font-family: var(--font-outlier); font-size: 11px; }
.chart .s1 { fill: none; stroke: var(--color-cool); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart .s1-area { fill: var(--color-cool-soft); opacity: 0.7; }
.chart .s2 { fill: none; stroke: var(--color-ok); stroke-width: 1.75; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--color-paper-2); stroke-width: 1.75; }
.chart .dot.c1 { stroke: var(--color-cool); } .chart .dot.c2 { stroke: var(--color-ok); }
.chart .cursor { stroke: var(--color-rule-2); stroke-width: 1; }
.legend { display: flex; flex-wrap: wrap; gap: var(--space-md); font-size: var(--text-sm); color: var(--color-muted); }
.legend span { display: inline-flex; align-items: center; gap: var(--space-xs); }
.legend i { width: 14px; height: 2px; border-radius: 1px; background: var(--color-cool); }
.legend i.c2 { background: var(--color-ok); }
.legend .mono { color: var(--color-ink); }

.funnel { display: grid; }
.step { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: var(--space-xs) var(--space-sm); padding: var(--space-sm) var(--space-md); }
.step + .step { border-top: 1px solid var(--color-rule); }
.step .n { font-family: var(--font-outlier); font-variant-numeric: tabular-nums slashed-zero; font-size: var(--text-sm); text-align: right; }
.step .n em { font-style: normal; color: var(--color-muted); margin-left: var(--space-xs); }
.step .bar { grid-column: 1 / -1; height: 6px; border-radius: 3px; background: var(--color-paper-3); overflow: hidden; }
.step .bar i { display: block; height: 100%; width: 100%; background: var(--color-cool); transform-origin: left; transform: scaleX(0); transition: transform var(--dur-long) var(--ease-out); }
.step:last-child .bar i { background: var(--color-ok); }

.thumbs { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-xs); }
.thumb { position: relative; aspect-ratio: 1; border-radius: var(--radius-pill); overflow: hidden; background: var(--color-paper-3); border: 1px solid var(--color-rule); }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb .badge { position: absolute; left: var(--space-xs); bottom: var(--space-xs); padding: var(--space-3xs) var(--space-xs); border-radius: 4px; background: var(--color-paper-2); color: var(--color-ink); font-size: var(--text-2xs); }
.thumb .cap { position: absolute; inset: 0; padding: var(--space-xs); font-size: var(--text-2xs); color: var(--color-muted); overflow: hidden; }
a.thumb { transition: transform var(--dur-micro) var(--ease-out); }
a.thumb:active { transform: scale(0.98); }

/* media picker */
.pick { position: relative; aspect-ratio: 1; padding: 0; border-radius: var(--radius-pill); overflow: hidden; border: 1px solid var(--color-rule); background: var(--color-paper-3); cursor: pointer; transition: transform var(--dur-micro) var(--ease-out); }
.pick img { width: 100%; height: 100%; object-fit: cover; }
.pick .cap { position: absolute; inset: 0; padding: var(--space-xs); font-size: var(--text-2xs); color: var(--color-muted); text-align: left; overflow: hidden; }
.pick .mark { position: absolute; top: 6px; right: 6px; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 1.5px solid var(--color-paper-2); background: var(--color-shade); color: var(--color-accent-ink); }
.pick .mark .i { width: 14px; height: 14px; stroke-width: 2.4; opacity: 0; }
.pick[aria-pressed="true"] { outline: 2px solid var(--color-accent); outline-offset: -2px; }
.pick[aria-pressed="true"] .mark { background: var(--color-accent); border-color: var(--color-accent); }
.pick[aria-pressed="true"] .mark .i { opacity: 1; }
.pick:active { transform: scale(0.97); }
.pick:focus-visible { outline: 2px solid var(--color-focus); outline-offset: 2px; }

.words { display: flex; flex-wrap: wrap; gap: var(--space-xs); }
.word { display: inline-flex; align-items: center; gap: var(--space-xs); min-height: 30px; padding: 0 var(--space-sm); border-radius: var(--radius-pill); border: 1px solid var(--color-rule); background: var(--color-paper-2); font-size: var(--text-sm); }
.word .mono { color: var(--color-cool); font-size: var(--text-2xs); }

table.t { width: 100%; border-collapse: collapse; font-size: var(--text-sm); }
.t th { text-align: left; font-weight: 500; color: var(--color-muted); padding: var(--space-xs) var(--space-md); border-bottom: 1px solid var(--color-rule); }
.t td { padding: var(--space-sm) var(--space-md); border-top: 1px solid var(--color-rule); vertical-align: top; }
.t tr:first-child td { border-top: 0; }
.t .r { text-align: right; font-family: var(--font-outlier); font-variant-numeric: tabular-nums slashed-zero; white-space: nowrap; }
.t th.r { font-family: var(--font-body); }
.t td:first-child { overflow-wrap: anywhere; }
.t .off { color: var(--color-muted); }

.steps-list { counter-reset: s; }
.steps-list .row { align-items: flex-start; }
.steps-list .num { width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; border: 1px solid var(--color-rule-2); font-family: var(--font-outlier); font-size: var(--text-2xs); color: var(--color-muted); flex: none; margin-top: var(--space-3xs); }
.steps-list .done .num { background: var(--color-ok-soft); border-color: transparent; color: var(--color-ok); }
.steps-list .now .num { background: var(--color-accent); border-color: transparent; color: var(--color-accent-ink); }

/* ------------------------------------------------ rules */
.rule-row { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm) var(--space-sm) var(--space-sm) var(--space-md); min-width: 0; }
.rule-row .open { flex: 1; min-width: 0; display: grid; gap: var(--space-xs); padding: var(--space-3xs) 0; color: inherit; text-decoration: none; border-radius: var(--radius-pill); }
.rule-row .open:focus-visible { outline-offset: 4px; }
.rule-row .title { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rule-row .meta { font-size: var(--text-sm); color: var(--color-muted); display: flex; flex-wrap: wrap; gap: var(--space-3xs) var(--space-sm); }
.rule-row .meta .mono { color: var(--color-ink-2); }
.rule-row.off .title { color: var(--color-muted); }
.kw { display: flex; flex-wrap: wrap; gap: var(--space-2xs); }
.kw span { padding: var(--space-3xs) var(--space-xs); border-radius: 4px; background: var(--color-paper-3); border: 1px solid var(--color-rule); font-size: var(--text-2xs); font-weight: 500; color: var(--color-ink-2); }

/* the editor */
.editor { display: grid; gap: var(--space-lg); }
.group { display: grid; gap: var(--space-md); padding: var(--space-md); }
.group > h2 { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); }
.list-edit { display: grid; gap: var(--space-xs); }
.list-edit .item { display: flex; gap: var(--space-xs); align-items: flex-start; }
.list-edit .item > .grow { flex: 1; min-width: 0; display: grid; gap: var(--space-xs); }
.toggles { display: grid; }
.toggles .row { padding-inline: 0; min-height: 48px; }
.toggles .row .sub { white-space: normal; line-height: 1.4; margin-top: var(--space-3xs); }
.toggles .row + .row { border-top: 1px solid var(--color-rule); }

/* the signature: the conversation the commenter sees */
.convo { background: var(--color-paper-3); border-top: 1px solid var(--color-rule); padding: var(--space-md); display: grid; gap: var(--space-xs); }
.convo .when { justify-self: center; font-size: var(--text-2xs); color: var(--color-muted); padding: var(--space-xs) 0 var(--space-3xs); }
.convo .comment { display: grid; gap: var(--space-2xs); padding: var(--space-sm); border-radius: var(--radius-card); border: 1px solid var(--color-rule); background: var(--color-paper-2); font-size: var(--text-sm); }
.convo .comment b { font-weight: 600; }
.convo .comment .reply { padding-left: var(--space-md); border-left: 2px solid var(--color-rule-2); color: var(--color-ink-2); }
.convo .comment small { color: var(--color-muted); font-size: var(--text-2xs); }
.msg { max-width: 82%; display: grid; gap: 1px; }
.msg.them { justify-self: start; }
.msg.me { justify-self: end; }
.msg .bubble { padding: var(--space-xs) var(--space-sm); border-radius: 18px; background: var(--color-paper-2); border: 1px solid var(--color-rule); font-size: var(--text-sm); line-height: 1.45; white-space: pre-wrap; overflow-wrap: anywhere; }
.msg.me .bubble { background: var(--color-cool); border-color: transparent; color: var(--color-paper-2); }
.msg.them .bubble.has-btn { border-radius: 18px 18px 4px 4px; }
.msg .tbtn { display: flex; align-items: center; justify-content: center; gap: var(--space-xs); min-height: 40px; padding: 0 var(--space-sm); background: var(--color-paper-2); border: 1px solid var(--color-rule); font-size: var(--text-sm); font-weight: 600; color: var(--color-cool); }
.msg .tbtn:last-child { border-radius: 4px 4px 18px 18px; }
.msg .tbtn .i { width: 14px; height: 14px; }
.msg .att { display: flex; align-items: center; gap: var(--space-sm); padding: var(--space-sm); border-radius: 18px; background: var(--color-paper-2); border: 1px solid var(--color-rule); font-size: var(--text-sm); }
.msg .att .i { color: var(--color-muted); }
.msg .att span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.msg .note { font-size: var(--text-2xs); color: var(--color-muted); padding: var(--space-3xs) var(--space-2xs); }
.convo-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-sm); padding: var(--space-sm) var(--space-md); }
.convo-head h2 { font-size: var(--text-sm); }

/* ------------------------------------------------ files, people, log */
.file-ico { width: 36px; height: 36px; display: grid; place-items: center; flex: none; border-radius: var(--radius-pill); background: var(--color-paper-3); border: 1px solid var(--color-rule); color: var(--color-muted); overflow: hidden; }
.file-ico img { width: 100%; height: 100%; object-fit: cover; }
.drop { display: grid; justify-items: center; gap: var(--space-xs); padding: var(--space-lg) var(--space-md); border: 1px dashed var(--color-rule-2); border-radius: var(--radius-card); text-align: center; color: var(--color-muted); font-size: var(--text-sm); }
.drop.over { border-color: var(--color-accent); background: var(--color-accent-soft); }
.filter { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); }
@media (min-width: 480px) { .filter { grid-template-columns: minmax(0, 1fr) 11rem; } }
.search { position: relative; }
.search .i { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); color: var(--color-muted); pointer-events: none; }
.search .input { padding-left: var(--space-xl); }
.person .who { display: flex; align-items: baseline; gap: var(--space-xs); min-width: 0; }
.person .when { font-size: var(--text-2xs); color: var(--color-muted); }
.log-item { display: grid; gap: var(--space-2xs); padding: var(--space-sm) var(--space-md); }
.log-item .top-line { display: flex; align-items: center; gap: var(--space-xs); min-width: 0; }
.log-item .top-line .small { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.log-item .when { flex: none; font-size: var(--text-2xs); color: var(--color-muted); }
.log-item .text { font-size: var(--text-sm); color: var(--color-ink-2); overflow-wrap: anywhere; }
.log-item .err { font-size: var(--text-2xs); color: var(--color-bad); font-family: var(--font-outlier); overflow-wrap: anywhere; }
.kv { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--space-xs); min-width: 0; }
.kv .val { display: flex; align-items: center; gap: var(--space-xs); padding-left: var(--space-sm); border-radius: var(--radius-pill); border: 1px solid var(--color-rule); background: var(--color-paper-3); min-height: var(--control); }
.kv .val code { flex: 1; min-width: 0; font-family: var(--font-outlier); font-size: var(--text-sm); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--color-ink-2); }
.kv .val .btn { border: 0; border-left: 1px solid var(--color-rule); border-radius: 0 var(--radius-pill) var(--radius-pill) 0; min-height: calc(var(--control) - 2px); background: transparent; }

/* ------------------------------------------------ states */
.sk { display: block; border-radius: 4px; background: var(--color-paper-3); }
.sk.line { height: 12px; width: 90%; }
.sk.line[data-w="0"] { width: 45%; } .sk.line[data-w="2"] { width: 70%; } .sk.line[data-w="4"] { width: 60%; }
.sk.block { height: 120px; border-radius: var(--radius-card); }
.loading .sk { animation: sk 1.4s var(--ease-in-out) infinite; }
@keyframes sk { 50% { opacity: 0.45; } }
.empty { display: grid; justify-items: start; gap: var(--space-sm); padding: var(--space-lg) var(--space-md); }
.empty h3 { font-size: var(--text-md); font-weight: 600; letter-spacing: 0; }
.empty p { color: var(--color-muted); font-size: var(--text-sm); max-width: 48ch; }
.error-box { display: grid; gap: var(--space-sm); padding: var(--space-md); }
.error-box p { font-size: var(--text-sm); color: var(--color-muted); }

.toast { position: fixed; left: 50%; bottom: calc(var(--space-md) + env(safe-area-inset-bottom)); z-index: var(--z-toast); max-width: min(92vw, 28rem); padding: var(--space-sm) var(--space-md); border-radius: var(--radius-card); background: var(--color-ink); color: var(--color-paper); font-size: var(--text-sm); font-weight: 500; transform: translate(-50%, 0); opacity: 1; transition: opacity var(--dur-short) var(--ease-out), transform var(--dur-short) var(--ease-out); }
.toast.bad { background: var(--color-bad); color: var(--color-paper-2); }
.toast.hide { opacity: 0; transform: translate(-50%, 8px); }

.view.enter { animation: enter var(--dur-short) var(--ease-out); }
@keyframes enter { from { opacity: 0; transform: translateY(4px); } }

@media (prefers-reduced-motion: reduce) {
  .view.enter { animation: none; }
  .loading .sk { animation: none; }
  .step .bar i { transition: none; }
}
