/* ══════════════════════════════════════════════════════════════
   Mise — popup

   GENERATED by extension/scripts/port-design.mjs from
   type-specimens/popup-states.html. Do not hand-edit: change the
   specimen, run a desk crit, then `npm run port:design`.
   Tokens + every .popup rule, plus the Prep and Archive views.
   ══════════════════════════════════════════════════════════════ */

/* ══════ Fonts ══════ */
@font-face {
  font-family: "Departure Mono";
  src: url("../fonts/DepartureMono-Regular.woff2") format("woff2");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Commit Mono";
  src: url("../fonts/CommitMono-400-Regular.otf") format("opentype");
  font-weight: 400;
  font-style: normal;
  font-display: swap;
}
@font-face {
  font-family: "Commit Mono";
  src: url("../fonts/CommitMono-400-Italic.otf") format("opentype");
  font-weight: 400;
  font-style: italic;
  font-display: swap;
}

:root {
  /* Families */
  --font-display: "Departure Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-body: "Commit Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  --font-mono: "Commit Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace;

  /* ══════ Color tokens — v2 brutalist + flame ══════ */
  --ink-900: oklch(0.100 0 0);
  --ink-800: oklch(0.150 0 0);
  --ink-700: oklch(0.200 0 0);
  --ink-600: oklch(0.280 0 0);

  --paper-50:  oklch(0.985 0 0);
  --paper-100: oklch(0.965 0 0);
  --paper-200: oklch(0.920 0 0);
  --paper-250: oklch(0.885 0 0);   /* skeleton bar bg on paper */

  --ink-primary:   oklch(0.120 0 0);
  --ink-secondary: oklch(0.280 0 0);
  --ink-dim:       oklch(0.480 0 0);
  --ink-muted-v2:  oklch(0.620 0 0);
  --rule-cream:    oklch(0.820 0 0);

  --paper-primary: oklch(0.965 0 0);
  --paper-dim:     oklch(0.780 0 0);
  --paper-muted:   oklch(0.620 0 0);
  --rule-ink:      oklch(0.280 0 0);

  --flame:        oklch(0.533 0.212 30.4);    /* sanguine — digital-clock red, not coppery */
  --flame-bright: oklch(0.587 0.205 30.4);
  --flame-deep:   oklch(0.452 0.185 30.4);
  --ember:        oklch(0.373 0.151 30.4);

  --error:      var(--flame-deep);
  --error-soft: oklch(0.940 0.025 30);

  --shadow:      oklch(0.100 0.015 240 / 0.25);
  --shadow-soft: oklch(0.100 0.015 240 / 0.12);

  /* Legacy aliases (existing selectors) */
  --bg-page:       var(--ink-700);
  --bg-panel:      var(--ink-600);
  --bg-card:       var(--paper-100);
  --bg-pdf:        var(--paper-50);
  --ink:           var(--ink-primary);
  --ink-paper:     var(--paper-primary);
  --ink-paper-dim: var(--paper-muted);
  --rule:          var(--rule-cream);
  --rule-dark:     var(--rule-ink);

  /* ══════ Spacing — 4pt semantic scale ══════ */
  --space-xs:  4px;
  --space-sm:  8px;
  --space-md:  12px;
  --space-lg:  16px;
  --space-xl:  24px;
  --space-2xl: 32px;
  --space-3xl: 48px;
  --space-4xl: 64px;
  --space-5xl: 96px;
}
/* ─── Popup surface (shared) ───────────────────────────────── */

.popup-frame {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-self: start;
}

.popup {
  width: 400px;
  background: var(--bg-card);
  color: var(--ink);
  border: 1px solid var(--rule);
  box-shadow: 0 20px 60px -20px var(--shadow);
  position: relative;
}

/* ticket-top */
.popup .ticket-top {
  padding: 14px 18px;
  border-bottom: 1px dashed var(--rule);
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.popup .ticket-top .brand {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 10px;
  letter-spacing: 0.08em;
  line-height: 1.2;
  text-transform: uppercase;
  color: var(--ink);
}

.popup .ticket-top .captured {
  font-family: var(--font-display);
  font-size: 10px;
  line-height: 1.2;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

/* source + badge */
.popup .source {
  padding: 12px 18px;
  border-bottom: 1px dashed var(--rule);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-dim);
  display: flex;
  justify-content: space-between;
  align-items: center;
  letter-spacing: 0.02em;
  gap: var(--space-md);
}

.popup .source .url {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.popup .source .badge {
  background: var(--ember);
  color: var(--bg-card);
  padding: 3px 7px 2px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  flex-shrink: 0;
}

.popup .source .badge.pending {
  background: transparent;
  color: var(--ink-dim);
  border: 1px solid var(--ink-dim);
  padding: 2px 6px 1px;
}

/* chyron — extraction status bar below source */
.popup .chyron-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 18px;
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-primary);
  border-bottom: 1px dashed var(--rule);
  gap: var(--space-md);
}

.popup .chyron-bar .elapsed {
  font-family: var(--font-mono);
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}

.popup .chyron-bar .status {
  display: flex;
  align-items: center;
  gap: 8px;
}

.popup .chyron-bar .status .dot {
  width: 6px;
  height: 6px;
  background: var(--flame);
  display: inline-block;
}

/* progress meter — 1px rule filling in flame */
.popup .progress {
  height: 2px;
  background: var(--rule-cream);
  position: relative;
  overflow: hidden;
}

.popup .progress::after {
  content: "";
  position: absolute;
  inset: 0 auto 0 0;
  background: var(--flame-deep);
  width: var(--progress, 40%);
}

/* title + subtitle */
.popup h2.title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 24px;
  line-height: 1.1;
  letter-spacing: 0;
  text-transform: uppercase;
  margin: 16px 18px 6px;
  color: var(--ink);
}

.popup .subtitle {
  margin: 0 18px 14px;
  font-family: var(--font-body);
  font-weight: 400;
  font-style: italic;
  font-size: 12px;
  line-height: 1.45;
  color: var(--ink-dim);
}

/* byline — who wrote the recipe. Roman, not italic: the subtitle is the
   recipe's own voice, this is attribution. Sentence case, because a
   person's name is not a label to be shouted like the facts row. */
.popup .byline {
  margin: 0 18px 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  line-height: 1.4;
  letter-spacing: 0.06em;
  /* --ink-dim, not --ink-muted-v2: muted lands at 3.28:1 on paper and
     fails AA at 10px. This matches the facts label and the subtitle. */
  color: var(--ink-dim);
}

/* Tighten only when it trails a subtitle, which already carries 14px
   beneath it. Under a bare title (6px) that pull would close the gap. */
.popup .subtitle + .byline {
  margin-top: -6px;
}

.popup .byline strong {
  color: var(--ink);
  font-weight: 400;
  letter-spacing: 0.02em;
}

/* facts */
.popup .facts {
  display: flex;
  gap: 18px;
  padding: 10px 18px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-dim);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.popup .facts .fact {
  display: flex;
  align-items: baseline;
  gap: 6px;
}

.popup .facts .fact strong {
  color: var(--ink);
  font-weight: 400;
  font-size: 11px;
  letter-spacing: 0.02em;
}

/* section heading */
.popup h3.section {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 13px;
  line-height: 1.2;
  margin: 18px 18px 10px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--ink);
  border-bottom: 1px solid var(--ink);
  padding-bottom: 6px;
}

/* ingredients */
.popup ul.ingredients {
  list-style: none;
  padding: 0;
  margin: 0 18px 18px;
  font-size: 13px;
  line-height: 1.5;
}

.popup ul.ingredients li {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  align-items: baseline;
  padding: 4px 0;
  border-bottom: 1px dotted var(--rule);
}

.popup ul.ingredients li .qty {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--ink);
  letter-spacing: 0.02em;
  text-transform: uppercase;
}

/* method */
.popup ol.method {
  padding: 0;
  margin: 0 18px 18px;
  list-style: none;
  counter-reset: step;
}

.popup ol.method li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 9px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
  line-height: 1.55;
}

.popup ol.method li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
  padding-top: 3px;
}

/* tag line */
.popup .tags {
  padding: 12px 18px 8px;
  border-top: 1px dashed var(--rule);
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  word-spacing: 0.15em;
}

.popup .tags .tag {
  color: var(--ink-dim);
}

/* ticket-bottom */
.popup .ticket-bottom {
  padding: 8px 18px 12px;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  display: flex;
  justify-content: space-between;
}

.popup .ticket-bottom .glyph {
  color: var(--flame);
}

/* ─── Skeleton primitives ──────────────────────────────────── */

.bar {
  display: block;
  height: 10px;
  background: var(--paper-250);
  border-radius: 0;  /* brutalist — no rounded bars */
}

.bar.thin { height: 8px; }
.bar.tall { height: 16px; }
.bar.tallx { height: 22px; }

@media (prefers-reduced-motion: no-preference) {
  .skel .bar {
    animation: sweep 1.6s ease-in-out infinite;
    background: linear-gradient(
      90deg,
      var(--paper-250) 0%,
      var(--paper-200) 40%,
      var(--paper-250) 80%
    );
    background-size: 200% 100%;
  }
  @keyframes sweep {
    0%   { background-position: 120% 0; }
    100% { background-position: -20% 0; }
  }
}

/* skeleton-replacement of title block */
.popup .title-skel {
  padding: 18px 18px 6px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.popup .subtitle-skel {
  padding: 0 18px 14px;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.popup .facts-skel {
  display: flex;
  gap: 18px;
  padding: 12px 18px;
  border-top: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
}

.popup .facts-skel .bar { width: 56px; height: 10px; }

.popup ul.ingredients-skel {
  list-style: none;
  padding: 0;
  margin: 0 18px 18px;
}

.popup ul.ingredients-skel li {
  display: grid;
  grid-template-columns: 78px 1fr;
  gap: 8px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dotted var(--rule);
}

.popup ol.method-skel {
  padding: 0;
  margin: 0 18px 18px;
  list-style: none;
  counter-reset: step;
}

.popup ol.method-skel li {
  counter-increment: step;
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule);
}

.popup ol.method-skel li::before {
  content: counter(step, decimal-leading-zero);
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-muted-v2);
  letter-spacing: 0.06em;
  padding-top: 3px;
}

.popup ol.method-skel li .body-skel {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* ─── Filmstrip — video capture progress ──────────────────── */

.popup .filmstrip {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 10px 18px;
  border-bottom: 1px dashed var(--rule);
}

.popup .filmstrip .frame {
  aspect-ratio: 1 / 1;
  border: 1px solid var(--ink-dim);
}

.popup .filmstrip .frame.captured {
  background: var(--ember);
  border-color: var(--ember);
}

.popup .filmstrip .frame.active {
  background: var(--flame);
  border-color: var(--flame);
}

/* ─── Stamp — FIRED / KITCHEN ERROR / OFF MENU ───────── */

/* Inverted stamp — the impression, not the outline (2026-08-30).
   A 2px box around near-black text made the stamp the loudest object on
   an otherwise empty screen, so it out-shouted the sentence that
   actually says what happened. Filling the block and knocking the mark
   out of it is what a rubber stamp does; dropping the fill to --ink-dim
   pulls its contrast back so the message below can lead.
   Measured in-browser: paper-100 on ink-dim = 5.93:1, which clears AA
   for normal text, never mind the 3:1 the 28px title needs. The err
   fill is flame-deep, and keeps colour v2.2's rule that failure owns
   the red. */
.stamp {
  margin: 14px 18px;
  border: none;
  background: var(--ink-dim);
  padding: 14px 20px;
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: center;
  gap: 12px;
  color: var(--paper-100);
}

.stamp.err { background: var(--flame-deep); color: var(--paper-50); }

.stamp .glyph-mark { height: 30px; flex-shrink: 0; display: flex; }
.stamp .glyph-mark svg { display: block; height: 100%; width: auto; }

.stamp h2.stamp-title {
  font-family: var(--font-display);
  font-weight: 400;
  font-size: 28px;
  line-height: 1.0;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin: 0;
  white-space: nowrap;
}

/* Off-menu message — sits below the stamp box, not inside it.
   This is the user feedback, so it carries the weight (2026-08-30).
   "OFF MENU" is brand voice: it names the state without explaining it,
   and on its own it reads as cryptic. The headline states the outcome
   in plain words at full ink and no italic — italics on a 12px mono
   face at --ink-dim was the quietest text on a screen whose only job
   is to tell you something. The hint below stays quiet and carries the
   recovery, so the two lines read in the right order. */
.off-note {
  margin: 14px 18px 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.35;
  color: var(--ink-primary);
  max-width: 34ch;
}

/* The recovery line, and the breathing room before the action row —
   the ticket used to butt straight into the button panel. */
/* No max-width: at 40ch the line broke after "Open" with a third of the
   card empty beside it. The block is two lines, so `balance` is the
   right tool — it evens them and keeps a word off its own line.
   --ink-dim on the card measures 5.93:1, so the quiet line is still AA
   at 12px. */
.off-hint {
  margin: 7px 18px 20px;
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.55;
  color: var(--ink-dim);
  text-wrap: balance;
}

/* Empty / Error — full 1px bordered callout instead of banned side-stripe */
.callout {
  margin: 14px 18px;
  border: 1px solid var(--flame);
  padding: 12px 14px;
  background: var(--paper-200);
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.callout.error {
  border-color: var(--flame-deep);
  background: var(--error-soft);
}

.callout .hdr {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--flame);
  display: flex;
  justify-content: space-between;
}

.callout.error .hdr {
  color: var(--flame-deep);
}

.callout .hdr > span:first-child { display: inline-flex; align-items: center; gap: 6px; }
.callout .hdr svg { width: 12px; height: 12px; flex: none; }

.callout .hdr .code {
  font-family: var(--font-mono);
  color: var(--ink-dim);
  letter-spacing: 0.04em;
}

.callout .body {
  font-family: var(--font-body);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink-primary);
}

/* ─── Empty state — affordance list ───────────────────────── */

.fallback-list {
  list-style: none;
  padding: 0;
  margin: 12px 18px 18px;
  border-top: 1px dashed var(--rule);
}

.fallback-list li {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px dashed var(--rule);
  font-size: 13px;
  line-height: 1.4;
}

/* Each fallback wears the icon of the button it names (Retry → refresh,
   Open Prep → settings). Icons, never text glyphs. */
.fallback-list li .gl {
  display: inline-flex;
  color: var(--flame);
}

.fallback-list li .gl svg { width: 14px; height: 14px; }

.fallback-list li .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-dim);
  border: 1px solid var(--ink-dim);
  padding: 1px 5px;
  letter-spacing: 0.04em;
}

/* ─── Ambiguous — picker list ─────────────────────────────── */

.picker {
  list-style: none;
  padding: 0;
  margin: 14px 0 10px;
}

.picker li {
  display: grid;
  grid-template-columns: 44px 1fr 18px;
  gap: 12px;
  align-items: center;
  padding: 10px 18px;
  border-bottom: 1px dashed var(--rule);
  font-size: 12.5px;
  line-height: 1.35;
  cursor: pointer;
}

.picker li:first-child { border-top: 1px dashed var(--rule); }

.picker li .thumb {
  width: 44px;
  aspect-ratio: 1 / 1;
  background: var(--paper-250);
  border: 1px solid var(--rule);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.06em;
}

.picker li .thumb.recipe {
  background: var(--ember);
  color: var(--bg-card);
  border-color: var(--ember);
}

.picker li .meta {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.picker li .meta .ptitle {
  font-family: var(--font-display);
  font-size: 12px;
  color: var(--ink-primary);
  letter-spacing: 0.02em;
  text-transform: uppercase;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker li .meta .psub {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-dim);
  letter-spacing: 0.04em;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.picker li .arrow {
  font-family: var(--font-display);
  font-size: 14px;
  color: var(--ink-dim);
  justify-self: end;
}

.picker li[data-focus="true"] {
  background: var(--paper-200);
}

.picker li[data-focus="true"] .arrow {
  color: var(--flame);
}

/* ─── Fired — overlay stamp ───────────────────────────────── */

.popup.fired .popup-body {
  filter: grayscale(0.6) opacity(0.35);
  pointer-events: none;
}

.fired-stamp {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  padding: 18px;
  pointer-events: none;
}

/* Inverted like .stamp — a filled block with the mark knocked out,
   which is what a rubber stamp actually looks like. Fill is
   --ink-primary, not flame: the colour system gives success no
   dedicated hue ("the glyph carries the meaning"), and red is
   contextually exclusive, so it stays with failure. The three
   stamps read as a value ladder — dim grey nothing-here, near-black
   delivered, red broken. */
.fired-stamp .mark {
  border: none;
  padding: 16px 20px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: center;
  background: var(--ink-primary);
  color: var(--paper-100);
}

.fired-stamp .mark .line1 {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--paper-100);
  line-height: 1.0;
  display: flex;
  gap: 12px;
  align-items: center;
}

/* 34px is not arbitrary: the flame's viewBox is 28x34, so this puts
   exactly one grid unit on one CSS pixel and crispEdges can then
   switch anti-aliasing off without tearing anything. It is the only
   stamp glyph drawn with 1-unit features — at 30px they landed on
   0.88px and blurred into a smudge beside Departure Mono's chunky
   letterforms. Deliberately NOT applied to the other two glyphs:
   checked side by side, and the broken plate's circular rim goes
   visibly uneven without AA, because its curves render at a
   fractional scale where the anti-aliasing is doing real work. */
.fired-stamp .glyph-mark { height: 34px; flex-shrink: 0; display: flex; }
.fired-stamp .glyph-mark svg {
  display: block; height: 100%; width: auto;
  shape-rendering: crispEdges;
}

.fired-stamp .mark .line2 {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--paper-dim);
  letter-spacing: 0.02em;
  max-width: 32ch;
  text-align: center;
  line-height: 1.4;
}

/* ─── Action row (popup chrome) ───────────────────────────── */

.popup-actions {
  width: 400px;
  background: var(--bg-panel);
  border: 1px solid var(--rule-dark);
  padding: 12px 14px;
  display: flex;
  gap: 8px;
  align-items: center;
}

.popup-actions .fire-btn {
  flex: 1;
  background: var(--flame);
  color: var(--bg-card);
  border: none;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.popup-actions .fire-btn[disabled] {
  background: var(--ink-600);
  color: var(--paper-muted);
  cursor: not-allowed;
}

.popup-actions .fire-btn[disabled] .kbd {
  color: var(--paper-muted);
}

.popup-actions .fire-btn.warn {
  background: var(--flame);
  padding-right: 12px;
}

/* Every button that advertises a key wears the same chip. This was
   scoped to .fire-btn, which is why the shipped RETRY chip had no box
   at all — the specimen had been faking one with an inline style, so
   the design document looked right while the product did not.
   currentColor rather than a fixed --bg-card so one rule reads on the
   flame fill and the bone fill alike. */
.popup-actions .kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  border: 1px solid currentColor;
  border-radius: 2px;
  padding: 1px 5px;
  opacity: 0.7;
}

.popup-actions .fire-btn .warn-glyph {
  color: var(--bg-card);
  font-size: 12px;
}

/* 8px horizontal, not 11. The success row is FIRE + Copy + Prep +
   Archive, and once every button grew an icon (2026-08-30) that row
   ran 15.8px past the 400px popup — measured as the last button's
   right edge against the row's content box, which is the only test
   that catches it: the row is overflow:visible, so scrollWidth does
   NOT report it and the buttons just quietly spill off the window.
   At 8px every row in the product fits. */
.popup-actions .secondary-btn {
  background: transparent;
  border: 1px solid var(--rule-dark);
  color: var(--ink-paper);
  padding: 10px 8px;
  font-family: var(--font-body);
  font-weight: 400;
  font-size: 11.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Button icons — Tabler outline, per CLAUDE.md's two-tier icon rule:
   pixel art for stamp glyphs, Tabler vectors for functional chrome.
   Sized down from the 24px grid, so the 2px stroke lands near 1.2px —
   the control-panel hairline the rest of the chrome is drawn with. */
.popup-actions .btn-icon {
  flex-shrink: 0;
  display: block;
}

.popup-actions .secondary-btn .btn-icon { width: 14px; height: 14px; }
.popup-actions .fire-btn .btn-icon,
.popup-actions .retry-btn .btn-icon { width: 15px; height: 15px; }

/* Fire disabled: the icon rides the label's ink, not full strength. */
.popup-actions .fire-btn[disabled] .btn-icon { opacity: 0.85; }

.popup-actions .retry-btn {
  flex: 1;
  background: var(--paper-primary);
  color: var(--ink-primary);
  border: none;
  padding: 10px 14px;
  font-family: var(--font-body);
  font-size: 12px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
}

.popup-actions .countdown {
  flex: 1;
  text-align: center;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--paper-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.popup-actions .countdown strong {
  color: var(--paper-primary);
  font-weight: 400;
}

.chrome-caption {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--paper-muted);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

/* ─── Popup window (extension-only; the specimen had no window) ── */

html,
body {
  width: 400px;
  margin: 0;
  padding: 0;
  background: var(--bg-page);
  color: var(--paper-primary);
  font-family: var(--font-body);
  /* The window surround is ink, so the scrollbar should be too. */
  color-scheme: dark;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* …but the card and the panes are paper, and they hold native controls — the
   Model <select> in Prep renders itself dark on a white field otherwise. */
.popup,
.surface {
  color-scheme: light;
}

body {
  /* MV3 caps popup height at 600px. The card scrolls; the actions are pinned. */
  max-height: 600px;
  display: flex;
  flex-direction: column;
}

* { box-sizing: border-box; }

/* The specimen framed each card as a gallery tile; here the card IS the
   window, so it loses its border, shadow, and fixed width. */
.popup {
  width: 100%;
  border: 0;
  box-shadow: none;
  overflow-y: auto;
  flex: 1 1 auto;
}

/* .fired-stamp is inset:0 against .popup. While .popup scrolls, that box is
   the full content height, so on a long recipe the receipt would land
   somewhere down the scroll. Clipping on fire makes inset:0 mean the visible
   box again, which is what the specimen's fixed-height card implied. */
.popup.fired { overflow: hidden; }

.popup-actions { flex: 0 0 auto; }

/* ─── View routing ───────────────────────────────────────────────
   Three surfaces share one window: the extraction card, Prep, and the
   Archive. Only one is mounted at a time. [hidden] has to win over the
   flex display below, hence !important. */
[hidden] { display: none !important; }

.surface {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  background: var(--bg-card);
  color: var(--ink);
}

/* Every surface wears the ticket header, so switching views reads as
   turning the ticket over rather than opening a different app. */
.surface .ticket-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 18px;
  border-bottom: 1px dashed var(--rule);
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 1;
}

.surface .ticket-top .brand {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink);
}

:focus-visible {
  outline: 2px solid var(--flame);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}


/* ─── Prep (extension-only chrome) ───────────────────────────────── */

#prep-view form {
  padding: var(--space-lg) 18px var(--space-xl);
  display: grid;
  gap: var(--space-lg);
}

#prep-view .field {
  display: grid;
  gap: var(--space-sm);
  border: 0;
  margin: 0;
  padding: 0;
}

/* .field is display:grid, which outranks the user agent's [hidden] rule. The
   Custom fields hide with the attribute, so restate it. */
#prep-view [hidden] {
  display: none;
}

#prep-view .field .label,
#prep-view .field legend.label {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-secondary);
  padding: 0;
}

#prep-view .field input[type="password"],
#prep-view .field input[type="text"],
#prep-view .field input[type="url"],
#prep-view .field select {
  font-family: var(--font-mono);
  font-size: 13px;
  padding: 9px 11px;
  width: 100%;
  color: var(--ink);
  background: var(--paper-50);
  border: 1px solid var(--rule);
  border-radius: 0;
}

#prep-view .field .hint {
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.45;
  color: var(--ink-dim);
}

/* The only link in the extension. Flame because it is the one action inside a
   hint, and 5.22:1 on paper carries it. */
#prep-view .field .hint a {
  color: var(--flame);
  text-underline-offset: 2px;
}

#prep-view .radios {
  display: flex;
  gap: var(--space-lg);
  font-family: var(--font-mono);
  font-size: 13px;
}

/* Form controls default to OS blue, which is the one colour the brutalist
   monochrome + flame system does not contain. Pull them onto the accent. */
#prep-view input[type="radio"],
#prep-view input[type="checkbox"] {
  accent-color: var(--flame);
}

#prep-view .field.checkbox {
  grid-auto-flow: column;
  grid-template-columns: auto 1fr;
  justify-content: start;
  align-items: center;
  gap: var(--space-sm);
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.4;
}

/* A checkbox field that carries a hint needs the hint under both columns
   rather than tucked beside the box. */
#prep-view .field.checkbox.explained {
  grid-auto-flow: row;
  grid-template-columns: auto 1fr;
  align-items: start;
  row-gap: 6px;
}

#prep-view .field.checkbox.explained > input {
  grid-row: 1;
  margin-top: 2px;
}

#prep-view .field.checkbox.explained > span:not(.hint) {
  grid-row: 1;
}

#prep-view .field.checkbox.explained > .hint {
  grid-column: 1 / -1;
}

#prep-view .status {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--flame);
  margin: 0;
  padding: 0 18px var(--space-lg);
  min-height: 1em;
}


/* ─── Archive (extension-only chrome) ────────────────────────────── */

#archive-view .arch-tools {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: var(--space-sm);
  padding: 10px 18px;
  border-bottom: 1px solid var(--rule);
  position: sticky;
  top: 41px;
  background: var(--bg-card);
  z-index: 1;
}

#archive-view .arch-tools input {
  font-family: var(--font-mono);
  font-size: 12px;
  padding: 7px 9px;
  width: 100%;
  color: var(--ink);
  background: var(--paper-50);
  border: 1px solid var(--rule);
  border-radius: 0;
}

#archive-view .arch-tools button {
  font-family: var(--font-display);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 7px 11px;
  color: var(--ink-secondary);
  background: transparent;
  border: 1px solid var(--rule);
  border-radius: 0;
  cursor: pointer;
}

#archive-view .arch-tools button:hover {
  color: var(--flame);
  border-color: var(--flame);
}

#archive-view .arch-list { display: block; }

#archive-view .arch-row {
  display: grid;
  grid-template-columns: 6ch 1fr;
  column-gap: var(--space-md);
  row-gap: 2px;
  align-items: baseline;
  padding: 10px 18px;
  width: 100%;
  text-align: left;
  background: transparent;
  border: 0;
  border-bottom: 1px dashed var(--rule);
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  cursor: pointer;
}

#archive-view .arch-row:hover,
#archive-view .arch-row[aria-expanded="true"] { background: var(--paper-50); }

#archive-view .arch-row .no {
  grid-row: span 2;
  font-family: var(--font-display);
  font-size: 11px;
  color: var(--ink-dim);
}

#archive-view .arch-row .title {
  font-family: var(--font-body);
  font-size: 13px;
  color: var(--ink);
}

#archive-view .arch-row .meta {
  grid-column: 2;
  font-size: 10px;
  color: var(--ink-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* An expanded row shows the real card, so the Archive and the extraction
   screen are never two renderings of the same recipe. */
#archive-view .arch-detail {
  border-bottom: 1px solid var(--rule);
  background: var(--paper-50);
}

#archive-view .arch-detail .popup {
  width: 100%;
  border: 0;
  box-shadow: none;
  overflow: visible;
}

#archive-view .arch-empty {
  padding: var(--space-3xl) var(--space-xl);
  text-align: center;
  font-family: var(--font-display);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-dim);
  margin: 0;
}
