:root {
  --bg: #0e0f12;
  --panel: #16181d;
  --panel2: #1b1e24;
  --line: #262a32;
  --fg: #e6e8ec;
  --muted: #8a8f98;
  --accent: #5b8cff;
  --open: #46a758;
  --done: #7c66dc;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { background: var(--bg); color: var(--fg); font-size: 14px; }
/* The app owns the viewport height (dvh tracks the iOS URL bar); the three
   layout panes scroll internally, the page itself never scrolls. */
#app { display: flex; flex-direction: column; height: 100vh; height: 100dvh; }

#loadbar {
  position: fixed; top: 0; left: 0; height: 2px; width: 0; z-index: 50;
  background: var(--accent); transition: width .2s ease, opacity .3s ease; opacity: 0;
}
/* Opacity fades in on a short delay: a fast command clears _busy before the bar
   ever becomes visible, so only genuinely slow round trips show it. */
#loadbar.on { width: 70%; opacity: 1; transition: width .2s ease, opacity .2s ease .15s; }

/* In-flight feedback (driven by the data-indicator signals, see index.html).
   The spinner is display-toggled by data-show; re-showing restarts the
   animations, so the delayed fade-in re-arms on every request. */
.busy-ind {
  width: 13px; height: 13px; flex: none; border-radius: 50%;
  border: 2px solid var(--line); border-top-color: var(--accent);
  animation: spin .7s linear infinite, fade-in .15s ease .25s both;
}
.busy-ind.sm { width: 10px; height: 10px; border-width: 2px; }
@keyframes spin { to { transform: rotate(360deg); } }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* Busy submit-button label (Posting…/Creating…/Saving…). */
.btn-busy { display: inline-flex; align-items: center; gap: 6px; }

/* The pressed filter/command element pulses while its request is in flight
   (#app.cmdbusy ← data-indicator:_cmd), acknowledging the click before the
   server round trip lands. The animation delay keeps fast commands quiet.
   List rows are excluded: a row press already has instant feedback (the cursor
   highlight moves on pointerdown; the detail morph + active accent arrive on
   the stream, usually BEFORE the command response closes the indicator), so a
   pulse there flashes "loading" after the content has already landed. */
#app.cmdbusy [data-cmd].pressed:not(.row) { animation: cmd-pulse .8s ease-in-out .2s infinite; }
@keyframes cmd-pulse { 50% { opacity: .45; } }

.topbar {
  display: flex; align-items: center; gap: 16px;
  padding: 10px clamp(10px, 3vw, 16px); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; background: var(--bg); z-index: 10;
}
.brand { font-weight: 700; letter-spacing: .3px; display: flex; align-items: center; gap: 8px; }
.brand .logo { color: var(--accent); }
.brand .tag { font-weight: 400; font-size: 11px; color: var(--muted); border: 1px solid var(--line); padding: 2px 6px; border-radius: 999px; }
.search { flex: 1; display: flex; align-items: center; gap: 8px; }
.search input {
  width: 100%; max-width: 520px; padding: 8px 12px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
}
.status { display: flex; gap: 6px; }
.status button, .seg button, .chip, .link {
  cursor: pointer; border: 1px solid var(--line); background: var(--panel);
  color: var(--fg); border-radius: 7px; padding: 6px 10px; font-size: 13px;
}
/* Hover affordances only where hover exists — on touch they'd stick after a tap. */
@media (hover: hover) {
  .status button:hover, .seg button:hover, .chip:hover { border-color: var(--accent); }
  .row:hover { background: var(--panel); }
}
.status button.on { background: var(--accent); border-color: var(--accent); color: #fff; }

.layout {
  display: grid; grid-template-columns: 260px minmax(0, 1fr) 380px; gap: 0;
  flex: 1; min-height: 0;
}
.facets { border-right: 1px solid var(--line); padding: 14px; overflow: auto; }
.list { overflow: auto; }
.detail { border-left: 1px solid var(--line); overflow: auto; background: var(--panel); }
/* Active keyboard pane (mini.files) — a top accent edge shows which column j/k
   drive (filters / list / open issue). Toggled by data-class:paned="$pane === …". */
.facets.paned, .list.paned, .detail.paned { box-shadow: inset 0 2px 0 0 var(--accent); }
/* In the facets pane the cursor is native focus on a control. */
.facets.paned [data-cmd]:focus { outline: 2px solid var(--accent); outline-offset: 2px; }

.panel { margin-bottom: 18px; }
.panel-h { font-size: 11px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 8px; display: flex; justify-content: space-between; align-items: center; }
.stat { font-size: 13px; }
.stat.muted, .muted { color: var(--muted); }
.stat b { color: var(--fg); }

.seg { display: flex; gap: 6px; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: white; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 6px; }
.chip .dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; }
.chip.on { background: var(--panel2); border-color: var(--accent); }
.link { border: none; background: none; color: var(--accent); padding: 0; font-size: 11px; cursor: pointer; }

/* Author filter */
.author-input {
  width: 100%; padding: 7px 10px; border-radius: 7px; font: inherit;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
}
.author-input:focus { outline: none; border-color: var(--accent); }
.author-chip { cursor: pointer; }
.author-chip .x { color: var(--muted); margin-left: 3px; }
.my-issues { cursor: pointer; margin-top: 8px; display: inline-block; }
.author-link {
  cursor: pointer; background: none; border: none; padding: 0; font: inherit;
  color: var(--fg); font-weight: 700;
  text-decoration: underline dotted; text-underline-offset: 2px;
}
.author-link:hover { color: var(--accent); }

.list-h { display: flex; align-items: baseline; gap: 10px; padding: 14px clamp(12px, 4vw, 16px) 6px; }
.list-h h1 { font-size: 18px; margin: 0; }
.list-h .count { color: var(--muted); }
.rows { list-style: none; margin: 0; padding: 0; transition: opacity .1s ease; }
/* While a filter/search round trip is in flight the current rows are stale; dim
   them on a delay (fast responses never dim) so a slow fetch reads as "updating",
   not "frozen". */
.rows.stale { opacity: .55; transition: opacity .15s ease .3s; }
.row {
  padding: 10px clamp(12px, 4vw, 16px); border-bottom: 1px solid var(--line); cursor: pointer;
  display: flex; flex-direction: column; gap: 4px;
}
.row:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
/* Focus tracks the cursor during j/k (see index.html), so on the cursored row
   the ring would just double the .cur treatment — show it only when focus is
   somewhere the cursor visual isn't (e.g. Tab landing on a non-cursor row). */
.row.cur:focus-visible { outline: none; }
/* Two independent row states with deliberately DIFFERENT visual weight, so the
   cursor can never be mistaken for a second selection:
    - CURSOR (.cur, client-owned $cur): a hairline left bar only — where j/k or
      the pointer is parked. No fill.
    - ACTIVE (.active, server-owned $active): the filled row with a right edge
      bar toward the detail pane — the issue that is actually open. */
.row.cur { box-shadow: inset 3px 0 0 var(--accent); }
.row.active { background: var(--panel2); box-shadow: inset -3px 0 0 var(--accent); }
.row.active.cur { background: var(--panel2); box-shadow: inset 3px 0 0 var(--accent), inset -3px 0 0 var(--accent); }
.row.closed .title { color: var(--muted); }
.row-main { display: flex; align-items: center; gap: 8px; }
.title { font-weight: 500; }
.state { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.state.open { background: var(--open); }
.state.done { background: var(--done); }
.row-meta { display: flex; align-items: center; gap: 6px; padding-left: 17px; flex-wrap: wrap; }
.lbl {
  font-size: 11px; color: var(--muted); border: 1px solid var(--line);
  border-radius: 999px; padding: 1px 8px; position: relative;
}
.lbl::before { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--c, var(--muted)); margin-right: 5px; vertical-align: middle; }
.when { font-size: 12px; color: var(--muted); margin-left: auto; }
.empty { padding: 30px 16px; color: var(--muted); }
.more { padding: 16px; text-align: center; color: var(--muted); font-size: 13px; }

.detail-empty { padding: 30px 20px; }
/* Padding rides custom props so the mobile sticky header can full-bleed
   against them with negative margins. */
.issue { --pad-x: clamp(14px, 3vw, 20px); --pad-y: clamp(14px, 2.5vw, 18px); padding: var(--pad-y) var(--pad-x); }
.issue-h { display: flex; align-items: center; gap: 10px; }
.issue-h h2 { font-size: 18px; margin: 0; flex: 1; }
.issue-h .close { cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); padding: 4px 8px; }
.issue-h .edit-btn { cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--fg); padding: 4px 10px; font-size: 13px; }
/* Realtime presence — overlapping avatar stack of who's viewing this issue. */
.viewers { display: inline-flex; align-items: center; flex: none; }
.vw-av {
  width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--panel);
  margin-left: -7px; object-fit: cover; box-sizing: border-box;
}
.viewers .vw-av:first-child { margin-left: 0; }
.vw-chip {
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 10px; font-weight: 700; color: #fff; user-select: none;
}
.issue-h .edit-btn:hover { border-color: var(--accent); }
.edit-status { display: flex; gap: 16px; font-size: 13px; color: var(--muted); }
.edit-status label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; }
/* Custom radio so rendering is consistent (Safari's native appearance:auto dot
   is offset/misaligned, esp. inside flex). */
.edit-status input[type="radio"] {
  appearance: none; -webkit-appearance: none; margin: 0; padding: 0; flex: none;
  width: 16px; height: 16px; border: 1.5px solid var(--line); border-radius: 50%;
  display: inline-grid; place-content: center; cursor: pointer;
}
.edit-status input[type="radio"]::before {
  content: ""; width: 7px; height: 7px; border-radius: 50%;
  background: var(--accent); transform: scale(0); transition: transform .1s ease;
}
.edit-status input[type="radio"]:checked { border-color: var(--accent); }
.edit-status input[type="radio"]:checked::before { transform: scale(1); }
.edit-status input[type="radio"]:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.issue-sub { color: var(--muted); font-size: 12px; margin: 8px 0; }
.permalink { color: var(--muted); text-decoration: none; }
.permalink:hover { color: var(--accent); text-decoration: underline; }
.copy-link {
  cursor: pointer; background: none; border: none; padding: 0 2px; margin: 0 2px;
  color: var(--muted); font: inherit; font-size: 11px;
}
.copy-link:hover { color: var(--accent); }
.issue-labels { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 14px; }
.issue-body { line-height: 1.6; }

/* Rendered markdown (issue bodies + comments) — goldmark output, sanitized. */
.markdown { line-height: 1.6; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 10px; }
.markdown ul, .markdown ol { margin: 0 0 10px; padding-left: 22px; }
.markdown li { margin: 2px 0; }
.markdown li > ul, .markdown li > ol { margin: 2px 0; }
.markdown h1, .markdown h2, .markdown h3, .markdown h4 { margin: 16px 0 8px; line-height: 1.3; }
.markdown h1 { font-size: 1.4em; }
.markdown h2 { font-size: 1.25em; }
.markdown h3 { font-size: 1.1em; }
.markdown h4 { font-size: 1em; }
.markdown a { color: var(--accent); text-decoration: none; }
.markdown a:hover { text-decoration: underline; }
.markdown code {
  font: 0.88em ui-monospace, SFMono-Regular, Menlo, monospace;
  background: var(--bg); border: 1px solid var(--line); border-radius: 5px; padding: 1px 5px;
}
.markdown pre {
  background: var(--bg); border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; overflow: auto; margin: 0 0 10px;
}
.markdown pre code { background: none; border: none; padding: 0; font-size: 0.86em; }
.markdown blockquote {
  margin: 0 0 10px; padding: 2px 12px; color: var(--muted);
  border-left: 3px solid var(--line);
}
.markdown hr { border: none; border-top: 1px solid var(--line); margin: 14px 0; }
.markdown table { border-collapse: collapse; margin: 0 0 10px; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 5px 10px; text-align: left; }
.markdown th { background: var(--panel2); }
.markdown img { max-width: 100%; border-radius: 8px; }
.markdown del { color: var(--muted); }
.markdown input[type="checkbox"] { margin-right: 6px; }
.comments { margin-top: 22px; border-top: 1px solid var(--line); padding-top: 14px; }
.comment { padding: 10px 0; border-bottom: 1px solid var(--line); border-radius: 6px; }
/* flash-on-arrival: ONLY a genuinely new comment animates in (fade + slide up
   from an accent tint). The server flags it .fresh when it was created seconds
   ago, so the on-open / on-load batch of existing comments never animates — only
   live arrivals do. A fresh comment is a new node (stable ids preserve the rest),
   so the animation fires once on insert and not on later re-renders. */
.comment.fresh { animation: comment-arrive .6s ease; }
@keyframes comment-arrive {
  from { opacity: 0; transform: translateY(-6px); background-color: rgba(91, 140, 255, .18); }
  to   { opacity: 1; transform: none; background-color: transparent; }
}
.c-h { font-size: 13px; margin-bottom: 4px; }
.c-b { color: #d2d5db; line-height: 1.5; }

/* Detail focus ring (j/k via $dcur) — the active stop (edit button, a comment, or
   the compose form) gets an accent outline, but only while the detail is the
   active keyboard pane (.paned), so it doesn't compete with the list cursor. */
.detail.paned .stop.dcur { outline: 2px solid var(--accent); outline-offset: 3px; border-radius: 8px; }

.comment-form { margin-top: 16px; display: flex; flex-direction: column; gap: 8px; }
.comment-form textarea {
  width: 100%; resize: vertical; padding: 8px 10px; border-radius: 8px;
  border: 1px solid var(--line); background: var(--bg); color: var(--fg);
  font: inherit;
}
.comment-form textarea:focus { outline: none; border-color: var(--accent); }
.comment-form-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.comment-form button {
  cursor: pointer; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; border-radius: 7px; padding: 6px 14px; font-size: 13px;
}
.comment-form button:disabled { opacity: .45; cursor: not-allowed; }

.new-issue {
  cursor: pointer; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; border-radius: 7px; padding: 7px 12px; font-size: 13px; white-space: nowrap;
}
.new-issue:hover { filter: brightness(1.1); }
.stats-toggle, .help-toggle { cursor: pointer; border: 1px solid var(--line); background: var(--panel); color: var(--fg); border-radius: 7px; padding: 6px 9px; font-size: 13px; }
/* Mobile facets-drawer toggle (a <label> for the #ftoggle checkbox — pure CSS
   drawer, no JS, no signal). Hidden on desktop, shown in the narrow MQ below. */
.filters-toggle {
  display: none; cursor: pointer; align-items: center; gap: 6px; user-select: none;
  border: 1px solid var(--line); background: var(--panel); color: var(--fg);
  border-radius: 7px; padding: 6px 10px; font-size: 13px; white-space: nowrap;
}
/* Active-filter dot: any label chip or author chip on inside #facets (scoped —
   .chip.on is reused by the compose/edit label pickers in #detail). */
#app:has(#facets .chip.on, #facets .author-chip) .filters-toggle::after {
  content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--accent);
}
.help-toggle { font-weight: 700; width: 30px; }
.stats-toggle:hover, .help-toggle:hover { border-color: var(--accent); }
a.new-issue { text-decoration: none; display: inline-block; }
.who { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--fg); }
.who .avatar { width: 22px; height: 22px; border-radius: 50%; }
.who .link, .signin { color: var(--accent); text-decoration: none; font-size: 13px; }
.signin { border: 1px solid var(--line); border-radius: 7px; padding: 6px 12px; }
.signin:hover { border-color: var(--accent); }
.signin-prompt { margin-top: 16px; }
.signin-prompt a { color: var(--accent); text-decoration: none; border: 1px dashed var(--line); border-radius: 8px; padding: 10px 14px; display: inline-block; }
.signin-prompt a:hover { border-color: var(--accent); }
/* Hidden from first paint (no FOUC/layout-shift under SSR); revealed via the
   `on` class toggled by data-class:on="$_stats" — same pattern as #loadbar. */
.stats-panel { display: none; padding: 5px 16px; border-bottom: 1px solid var(--line); background: var(--panel2); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.stats-panel.on { display: block; }
.stats-panel b { color: var(--accent); font-weight: 600; }

.compose-form { display: flex; flex-direction: column; gap: 10px; margin-top: 4px; }
.compose-form input, .compose-form textarea {
  width: 100%; padding: 9px 11px; border-radius: 8px; border: 1px solid var(--line);
  background: var(--bg); color: var(--fg); font: inherit; resize: vertical;
}
.compose-form input:focus, .compose-form textarea:focus { outline: none; border-color: var(--accent); }
.compose-title { font-size: 15px; font-weight: 600; }
.compose-labels { display: flex; flex-wrap: wrap; gap: 6px; }
.compose-labels .chip { cursor: pointer; user-select: none; }
.compose-labels input { width: auto; margin-right: 6px; }
.compose-form button[type="submit"] {
  cursor: pointer; border: 1px solid var(--accent); background: var(--accent);
  color: #fff; border-radius: 7px; padding: 7px 14px; font-size: 13px;
}
.compose-form button[type="submit"]:disabled { opacity: .45; cursor: not-allowed; }

/* ---- Command surfaces: ⌘K palette + ? help (server-driven overlays) ---- */
/* Empty wrapper until the projection morphs the dialog in (.on); no FOUC. */
.overlay-wrap { display: none; }
.overlay-wrap.on {
  display: block; position: fixed; inset: 0; z-index: 100;
}
.overlay-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,.55); }

.palette, .help {
  position: relative; margin: 12vh auto 0; width: min(640px, 92vw);
  background: var(--panel); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: 0 24px 60px rgba(0,0,0,.5); overflow: hidden;
}
.kbd {
  font: 11px ui-monospace, SFMono-Regular, Menlo, monospace; color: var(--muted);
  border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 6px; background: var(--bg); white-space: nowrap;
}

/* Palette */
.palette-input {
  width: 100%; border: none; border-bottom: 1px solid var(--line);
  background: transparent; color: var(--fg); font: inherit; font-size: 15px;
  padding: 14px 16px; outline: none;
}
.palette-list { max-height: 56vh; overflow: auto; padding: 6px 0; }
.palette-group {
  font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); padding: 10px 16px 4px;
}
.palette-row {
  display: flex; align-items: center; gap: 10px; padding: 8px 16px;
  cursor: pointer; scroll-margin: 8px;
}
.palette-row.active, .palette-row:hover { background: var(--panel2); }
.palette-row.active { box-shadow: inset 2px 0 0 var(--accent); }
.palette-icon { width: 16px; text-align: center; color: var(--muted); flex: none; }
.palette-title { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-hint { color: var(--muted); font-size: 12px; }
.palette-empty { padding: 18px 16px; }

/* Help cheatsheet */
.help-h {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 16px; border-bottom: 1px solid var(--line);
}
.help-h h2 { font-size: 15px; margin: 0; }
.help-h .close { cursor: pointer; background: none; border: 1px solid var(--line); border-radius: 6px; color: var(--muted); padding: 4px 8px; }
.help-cols {
  display: grid; grid-template-columns: 1fr 1fr; gap: 6px 28px;
  padding: 16px; max-height: 60vh; overflow: auto;
}
.help-group { break-inside: avoid; margin-bottom: 8px; }
.help-group-h {
  font-size: 10px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); margin: 6px 0;
}
.help-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 5px 0;
}
.help-title { color: var(--fg); }
@media (max-width: 560px) { .help-cols { grid-template-columns: 1fr; } }

/* ---- Mobile: list-first layers (THE one layout breakpoint) ----------------
   Same DOM, same fragments, zero template branching. The list is the page;
   facets become a left slide-over drawer (checkbox + :has(), no JS); the
   detail becomes a full-screen layer whose visibility is pure CSS state:
   the fragment renders .detail-empty when nothing is selected and
   article.issue for view/compose/edit, so #detail:has(.issue) is a complete
   "open" predicate — the existing ✕ buttons (/cmd/close, /cmd/compose-cancel,
   /cmd/edit-cancel) are already the back affordances. */
@media (max-width: 768px) {
  .topbar { flex-wrap: wrap; gap: 8px 10px; }
  /* Keyboard-shortcut + debug affordances are dead weight on touch. */
  .brand .tag, .help-toggle, .stats-toggle { display: none; }
  .who, .signin { margin-left: auto; order: 1; }
  .search { order: 5; flex-basis: 100%; }
  .search input { max-width: none; }
  .filters-toggle { display: inline-flex; order: 6; }
  .status { order: 7; }
  .new-issue { order: 8; margin-left: auto; }

  /* iOS auto-zooms any focused field under 16px. */
  .search input, .author-input, .palette-input,
  .comment-form textarea, .compose-form input, .compose-form textarea { font-size: 16px; }

  /* Touch targets. */
  .status button, .seg button, .chip, .filters-toggle, .link { min-height: 38px; }
  .row { padding-block: 12px; }
  .issue-h .close, .issue-h .edit-btn { padding: 8px 12px; }

  /* Facets + detail leave the grid (position: fixed) — the list IS the page. */
  .layout { grid-template-columns: minmax(0, 1fr); }
  /* The keyboard-pane accent (j/k columns) is a desktop affordance. */
  .facets.paned, .list.paned, .detail.paned { box-shadow: none; }

  /* Facets drawer. The checkbox lives OUTSIDE every morph target, so server
     pushes into #facets (label toggles re-rendering) never close it mid-flow. */
  .facets {
    position: fixed; inset: 0 auto 0 0; width: min(320px, 85vw); z-index: 40;
    background: var(--bg); border-right: 1px solid var(--line);
    translate: -100% 0; visibility: hidden;
    overscroll-behavior: contain;
  }
  /* The transition lives ONLY on the open state: opening animates, while
     closing and — crucially — a viewport resize across this breakpoint snap
     instantly (a base-state transition would visibly fly the closed panes out
     of the viewport the moment the media query starts matching). */
  #app:has(#ftoggle:checked) .facets { translate: 0 0; visibility: visible; transition: translate .25s ease; }
  .facets-scrim { display: none; position: fixed; inset: 0; z-index: 39; background: rgba(0, 0, 0, .45); }
  #app:has(#ftoggle:checked) .facets-scrim { display: block; }

  /* Detail layer: full-screen takeover, slides in from the right. The morph
     swaps #detail's child; this transition animates the persistent container. */
  .detail {
    position: fixed; inset: 0; z-index: 30; border-left: none;
    translate: 100% 0; visibility: hidden;
    overscroll-behavior: contain;
  }
  /* Open-state-only transition (see .facets above). Instant close is also a
     feature: the morph swaps in .detail-empty the moment the issue closes, so
     a close animation would parade "Select an issue." across the screen. */
  #detail:has(.issue) { translate: 0 0; visibility: visible; transition: translate .25s ease; }
  /* Keep ✕/Edit reachable while deep in a long comment thread. */
  .issue-h {
    position: sticky; top: 0; z-index: 1; background: var(--panel);
    margin: calc(-1 * var(--pad-y)) calc(-1 * var(--pad-x)) 0;
    padding: 10px var(--pad-x);
  }
}
