/* Slide editor sidebar — fixed left rail, vertical thumb strip, add button,
   plus the modal "Add slide" template picker. */

/* Resize handles (shared by Pages sidebar + Tweaks panel). Hit zone is
   wider than the visible bar so it's easy to grab; visually it shows on
   hover/active. */
.panel-resizer {
  position: absolute;
  top: 0;
  bottom: 0;
  width: 10px;
  cursor: col-resize;
  z-index: 60;
  user-select: none;
  background: transparent;
  transition: background 120ms ease;
}
.panel-resizer--right { right: -5px; }
.panel-resizer--left  { left: -5px; }
.panel-resizer:hover,
.panel-resizer:active { background: rgba(181, 70, 44, 0.18); }
.panel-resizer::after {
  content: "";
  position: absolute;
  top: 18px; bottom: 18px;
  left: 50%;
  width: 2px;
  margin-left: -1px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 2px;
  transition: background 120ms ease;
}
.panel-resizer:hover::after,
.panel-resizer:active::after { background: rgba(255, 255, 255, 0.45); }

/* ── Tweaks panel docking (Phase 2) ───────────────────────────────────────
   The panel is mounted (vanilla JS, Phase 5) into #tweaks-root, which is the
   reserved right grid column. By default TWEAKS_STYLE (injected by
   tweaks-panel.js at mount time, AFTER this stylesheet loads) sets
   `.twk-panel{position:fixed;right:16;bottom:16;width:280}`, floating it over
   the stage. We DOCK it into its cell instead, so it occupies the reserved
   [tweaks] gutter and the slide can never underlap it.

   Cascade note: a bare `.twk-panel{}` here (specificity 0,1,0) would TIE the
   runtime-injected <style> and LOSE on source order. We scope every docking
   declaration under `#tweaks-root` (specificity 1,1,0) so it beats the injected
   rule without !important. The vanilla panel does NOT emit an inline
   style={{right,bottom}} (the React panel did), so docking would work even
   without the !important neutralisers below — they are kept as belt-and-braces
   in case the panel's drag handler ever writes inline right/bottom while
   floating. On desktop the panel is `position:sticky` and ignores right/bottom
   anyway.

   Sticky (not static) so the panel tracks the viewport while the user scrolls
   a tall multi-slide deck, instead of scrolling off the top (risk 6). */
#tweaks-root {
  grid-column: tweaks;
  position: relative;          /* sticky child resolves against the cell */
  min-width: 0;
}
#tweaks-root .twk-panel {
  position: sticky;
  top: var(--shell-pad, 16px);
  /* !important neutralises any inline right/bottom the panel's drag handler
     could write while floating (tweaks-panel.js clampToViewport) — an
     inline-style attribute otherwise wins over this rule. With these zeroed the
     docked panel fills its cell and the sticky top is the only active inset. */
  right: auto !important;
  bottom: auto !important;
  left: auto !important;
  width: auto;
  max-width: none;
  max-height: calc(100dvh - 2 * var(--shell-pad, 16px));
  /* The panel itself paints its glass; let it fill the reserved gutter. */
  transform: none !important;
  /* NOTE: the panel keeps its own cream surface + ink-on-cream controls from
     TWEAKS_STYLE (tweaks-panel.js). We deliberately do NOT retint the surface
     here: the inner control colours (#29261b ink, etc.) are hardcoded in that
     injected <style>, so recolouring only the surface would risk dark-on-dark
     text on dark themes. The Phase 5 rewrite swapped the panel React→vanilla
     while preserving this cream-glass surface (a behaviour-preserving port);
     full panel surface theme-linking remains intentionally out of scope. Here
     we only theme-link the .edt rail, which this file fully controls. */
}
/* The reopen "Style" pill (created in main.js) lives in the empty cell when
   the panel is closed; the resizer (.panel-resizer) still anchors to the
   docked panel's own box. */

/* Freeform text-box layer — sits on top of every template's structured
   content. A .textbox-wrap pairs an always-present drag handle (left edge)
   with the editable .textbox text. Click the handle to move, click the
   text to edit. */
.textbox-layer {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.textbox-layer .textbox-wrap {
  pointer-events: auto;
  display: inline-flex;
  align-items: stretch;
  gap: 0;
  /* Always-visible outline so the freeform box is discoverable as a movable
     unit, not text glued to the canvas. */
  outline: 1px dashed rgba(255, 255, 255, 0.2);
  outline-offset: 4px;
  border-radius: 4px;
  transition: outline-color 120ms ease;
}
.textbox-layer .textbox-wrap:hover,
.textbox-layer .textbox-wrap:focus-within {
  outline-color: var(--accent, #B5462C);
}
/* Delete (×) control — top-right of the box, revealed on hover/focus. Sizes
   are divided by --preview-scale (the slide renders at transform:scale) so the
   hit target stays a constant ~26px on screen at any slide scale, like the
   field/drag handles. */
.textbox-layer .textbox__delete {
  position: absolute;
  top: calc(-13px / var(--preview-scale, 1));
  right: calc(-13px / var(--preview-scale, 1));
  width: calc(26px / var(--preview-scale, 1));
  height: calc(26px / var(--preview-scale, 1));
  display: grid;
  place-items: center;
  appearance: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent, #B5462C);
  color: #fff;
  font-size: calc(18px / var(--preview-scale, 1));
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease;
  z-index: 6;
  pointer-events: auto;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.textbox-layer .textbox-wrap:hover .textbox__delete,
.textbox-layer .textbox-wrap:focus-within .textbox__delete,
.textbox-layer .textbox__delete:focus-visible { opacity: 1; }
.textbox-layer .textbox__delete:hover { transform: scale(1.08); background: #c44e32; }
.textbox-layer .textbox__delete:active { transform: scale(0.94); }
.textbox-layer .textbox__delete:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }
@media (prefers-reduced-motion: reduce) { .textbox-layer .textbox__delete { transition: opacity 120ms ease; } }
/* Inert in thumbnails + never in the printed/exported deck. */
.thumb .textbox-layer .textbox__delete { display: none; }
@media print { .textbox-layer .textbox__delete { display: none !important; } }

/* Full-background dim control — an edit-only pill on the fullbg slide. Inert in
   thumbnails + never in the printed/exported deck (the dim VALUE still applies
   via the scrim; only the slider chrome is hidden). */
.slide--fullbg .dim-control {
  position: absolute;
  bottom: 18px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 5;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px;
  background: rgba(0, 0, 0, 0.6);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  border-radius: 999px;
  color: #F1ECE0;
  font-family: var(--f-mono, ui-monospace, monospace);
  font-size: 16px;
  letter-spacing: 0.06em;
  white-space: nowrap;
}
.slide--fullbg .dim-control__range { width: 200px; accent-color: var(--accent, #B5462C); cursor: pointer; }
.slide--fullbg .dim-control__val { min-width: 46px; text-align: right; }
.thumb .dim-control { display: none; }
@media print { .dim-control { display: none !important; } }

/* ── In-slide structural editing controls (edit-only) ──────────────────────
   Row reorder/remove cluster, "+ Add row", decoration hover-× + ghost-restore,
   and the imgtext mirror pill. All injected by templates.js, all
   contenteditable=false. Sizes that must stay a constant on-screen px regardless
   of the slide's transform:scale are DIVIDED by --preview-scale (same trick the
   field-handle + textbox controls use). Hidden in thumbnails + @media print (so
   they never bake into a PDF/PNG); stripped from PPTX by the builder. */

/* A list row is the positioning context for its absolute control cluster. */
.list-row { position: relative; }

/* Reorder/remove cluster — top-right of the row, revealed on hover / focus-
   within. Dark glass pill so it reads over any theme. */
.row-controls {
  position: absolute;
  top: calc(2px / var(--preview-scale, 1));
  right: calc(2px / var(--preview-scale, 1));
  display: flex;
  flex-direction: row;
  gap: calc(2px / var(--preview-scale, 1));
  padding: calc(3px / var(--preview-scale, 1));
  border-radius: calc(7px / var(--preview-scale, 1));
  background: rgba(0, 0, 0, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 120ms ease;
  z-index: 6;
  pointer-events: auto;
}
.list-row:hover .row-controls,
.list-row:focus-within .row-controls,
.row-controls:focus-within { opacity: 1; }

.row-ctl {
  width: calc(22px / var(--preview-scale, 1));
  height: calc(22px / var(--preview-scale, 1));
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border: 0;
  border-radius: calc(4px / var(--preview-scale, 1));
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  font-size: calc(15px / var(--preview-scale, 1));
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.row-ctl:hover:not([disabled]) { background: rgba(255, 255, 255, 0.16); color: #fff; }
.row-ctl:active:not([disabled]) { background: rgba(255, 255, 255, 0.24); }
.row-ctl[disabled] { opacity: 0.25; cursor: not-allowed; }
.row-ctl--del:hover:not([disabled]) { background: rgba(220, 64, 64, 0.55); color: #fff; }
.row-ctl:focus-visible { outline: calc(2px / var(--preview-scale, 1)) solid var(--accent, #B5462C); outline-offset: calc(1px / var(--preview-scale, 1)); }

/* "+ Add row" — a quiet ghost button at each list's end. The mono uppercase
   reads as marginalia, not chrome. */
.add-row {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  margin-top: 14px;
  padding: 8px 14px;
  border: 1px dashed var(--rule, rgba(0, 0, 0, 0.2));
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #8a8270);
  font-family: var(--f-mono, ui-monospace, monospace);
  font-size: 18px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.5;
  transition: opacity 120ms ease, border-color 120ms ease, color 120ms ease, background 120ms ease;
}
.add-row:hover {
  opacity: 1;
  border-color: var(--accent, #B5462C);
  color: var(--accent, #B5462C);
  background: color-mix(in oklab, var(--accent, #B5462C) 8%, transparent);
}
.add-row:focus-visible { opacity: 1; outline: 2px solid var(--accent, #B5462C); outline-offset: 2px; }
.add-row:active { transform: scale(0.98); }

/* Decoration hover-× — sits on the quote glyph; revealed on hover/focus of its
   parent decoration. Accent disc, same language as the textbox delete. */
.decor-hide {
  position: absolute;
  top: 0;
  right: calc(-30px / var(--preview-scale, 1));
  width: calc(26px / var(--preview-scale, 1));
  height: calc(26px / var(--preview-scale, 1));
  display: grid;
  place-items: center;
  appearance: none;
  border: 0;
  border-radius: 50%;
  background: var(--accent, #B5462C);
  color: #fff;
  font-size: calc(18px / var(--preview-scale, 1));
  line-height: 1;
  cursor: pointer;
  opacity: 0;
  transition: opacity 120ms ease, transform 120ms ease, background 120ms ease;
  z-index: 6;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
}
.quote-mark { position: relative; }
.quote-mark:hover .decor-hide,
.decor-hide:focus-visible { opacity: 1; }
.decor-hide:hover { transform: scale(1.08); background: #c44e32; }
.decor-hide:active { transform: scale(0.94); }
.decor-hide:focus-visible { outline: 2px solid #fff; outline-offset: 1px; }

/* Decoration ghost slot + "+ restore" — shown in place of a hidden decoration.
   A dashed outline marks the reclaimable space; the restore button re-runs
   toggleDecoration. */
.decor-ghost {
  display: inline-flex;
  align-items: center;
  margin: 0 0 -10px -8px;
  min-height: 60px;
}
.decor-ghost__btn {
  appearance: none;
  padding: 6px 12px;
  border: 1px dashed var(--rule, rgba(0, 0, 0, 0.25));
  border-radius: 8px;
  background: transparent;
  color: var(--muted, #8a8270);
  font-family: var(--f-mono, ui-monospace, monospace);
  font-size: 16px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 120ms ease, border-color 120ms ease, color 120ms ease;
}
.decor-ghost__btn:hover { opacity: 1; border-color: var(--accent, #B5462C); color: var(--accent, #B5462C); }
.decor-ghost__btn:focus-visible { opacity: 1; outline: 2px solid var(--accent, #B5462C); outline-offset: 2px; }

/* imgtext mirror pill — top-right of the slide frame; aria-pressed reflects the
   flip state. */
.mirror-toggle {
  position: absolute;
  top: 90px;
  right: 80px;
  z-index: 5;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  appearance: none;
  padding: 7px 14px;
  border: 1px solid var(--rule, rgba(0, 0, 0, 0.2));
  border-radius: 999px;
  background: rgba(0, 0, 0, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #F1ECE0;
  font-family: var(--f-mono, ui-monospace, monospace);
  font-size: 14px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  opacity: 0.55;
  transition: opacity 120ms ease, background 120ms ease, border-color 120ms ease;
}
.slide--imgtext .slide__frame:hover .mirror-toggle,
.mirror-toggle:focus-visible { opacity: 1; }
.mirror-toggle:hover { background: rgba(0, 0, 0, 0.72); border-color: var(--accent, #B5462C); }
.mirror-toggle[aria-pressed="true"] { background: var(--accent, #B5462C); color: #14110E; border-color: var(--accent, #B5462C); opacity: 1; }
.mirror-toggle:focus-visible { outline: 2px solid var(--accent, #B5462C); outline-offset: 2px; }

/* Draggable split divider (compare + imgtext). The structural base (position,
   hit-area, the thin ::before line) lives in carousel.css; these are the edit-
   only affordances: rest faint, reveal on the slide-frame hover (like the
   row-controls / mirror-toggle), and brighten the line to accent on hover /
   keyboard focus. It stays grabbable at rest (opacity is on the ::before line,
   not the wide transparent hit area, so pointer-events never drop). */
.split-handle { opacity: 0.55; transition: opacity 120ms ease; }
.split-handle::before { background: var(--rule, rgba(0, 0, 0, 0.28)); }
.slide__frame:hover .split-handle { opacity: 1; }
.split-handle:hover::before,
.split-handle:focus-visible::before { background: var(--accent, #B5462C); }
.split-handle:focus-visible { outline: 2px solid var(--accent, #B5462C); outline-offset: -1px; }

@media (prefers-reduced-motion: reduce) {
  .row-controls, .row-ctl, .add-row, .decor-hide, .decor-ghost__btn, .mirror-toggle { transition: opacity 120ms ease; }
  .split-handle, .split-handle::before { transition: none; }
  .decor-hide:hover, .decor-hide:active, .add-row:active { transform: none; }
}

/* Edit-only: never in thumbnails. */
.thumb .row-controls,
.thumb .add-row,
.thumb .decor-hide,
.thumb .decor-ghost,
.thumb .split-handle,
.thumb .mirror-toggle { display: none; }
.textbox-layer .textbox__handle {
  appearance: none;
  border: 0;
  background-color: rgba(0, 0, 0, 0.35);
  /* Wider so it survives the responsive --preview-scale shrink (down to
     0.32 in narrow viewports → ~10px on-screen at 32px native). */
  width: 32px;
  margin-right: 6px;
  border-radius: 6px;
  cursor: grab;
  /* Always visible so users see what to grab. The default + hover both
     keep it readable on dark surfaces; on light surfaces (paper/atea) the
     accent dots still stand out. */
  opacity: 1;
  transition: background 120ms ease, transform 120ms ease;
  /* Six dots — the classic "drag handle" affordance. */
  background-image: radial-gradient(circle, var(--accent, #B5462C) 2.2px, transparent 2.5px);
  background-size: 10px 14px;
  background-position: center;
  background-repeat: round;
  touch-action: none;
}
.textbox-layer .textbox__handle:hover { background-color: rgba(0, 0, 0, 0.55); }
.textbox-layer .textbox__handle:active { cursor: grabbing; transform: scale(0.96); }
.textbox-layer .textbox-wrap[data-moving] .textbox__handle {
  background-color: var(--accent, #B5462C);
  background-image: radial-gradient(circle, rgba(20, 17, 14, 0.9) 2.2px, transparent 2.5px);
}
.textbox-layer .textbox {
  pointer-events: auto;
  flex: 1 1 auto;
  min-width: 60px;
  min-height: 1em;
  font-family: var(--f-body);
  color: var(--ink);
  line-height: 1.25;
  cursor: text;
  padding: 4px 8px;
  border-radius: 4px;
  transition: outline 120ms ease;
}
.textbox-layer .textbox:focus {
  outline: 1.5px solid var(--accent);
  outline-offset: 2px;
}
.textbox-layer .textbox-wrap:hover .textbox:not(:focus) {
  outline: 1px dashed rgba(255, 255, 255, 0.18);
  outline-offset: 2px;
}
/* When the wrap is being moved, the textbox text shouldn't intercept clicks
   and lose us the drag-in-progress. */
.textbox-layer .textbox-wrap[data-moving] .textbox { pointer-events: none; }

/* Template-field drag handle — appears on hover/focus of any [data-field]
   element so structural fields (kicker, headline, lede, bullets, etc.) get
   the same one-click drag affordance as freeform text boxes. The handle is
   contenteditable=false; serializeRichText collapses unknown <button>
   children to their text content (empty), so it never leaks into state. */
[data-field] { position: relative; }
/* The slide itself is rendered with `transform: scale(--preview-scale)` so
   children of the slide render at that scale. To keep the drag handle the
   same visual size regardless of slide scale (so the user can actually grab
   it on a small step-num inside a steps slide, for example), we DIVIDE the
   handle's css-px dimensions by --preview-scale — that way the post-scale
   on-screen pixel size lands near 18px no matter the slide's scale. */
[data-field] > .field-handle {
  position: absolute;
  top: calc(-2px / var(--preview-scale, 1));
  left: calc(-22px / var(--preview-scale, 1));
  width: calc(18px / var(--preview-scale, 1));
  height: calc(18px / var(--preview-scale, 1));
  appearance: none;
  border: 0;
  border-radius: calc(4px / var(--preview-scale, 1));
  background-color: rgba(0, 0, 0, 0.4);
  background-image: radial-gradient(circle, var(--accent, #B5462C) calc(1.6px / var(--preview-scale, 1)), transparent calc(1.8px / var(--preview-scale, 1)));
  background-size: calc(6px / var(--preview-scale, 1)) calc(8px / var(--preview-scale, 1));
  background-position: center;
  background-repeat: round;
  cursor: grab;
  /* Low-but-present resting opacity (was 0 — fully hidden until hover) so the
     drag handle is a discoverable cue rather than invisible. Rises to 0.85/1
     on hover/focus/move. */
  opacity: 0.25;
  transition: opacity 120ms ease, background 120ms ease;
  pointer-events: auto;
  user-select: none;
  touch-action: none;
  /* Don't steal layout space from the field itself. */
  z-index: 5;
}
[data-field]:hover > .field-handle,
[data-field]:focus > .field-handle,
[data-field][data-moving] > .field-handle {
  opacity: 0.85;
}
[data-field] > .field-handle:hover { opacity: 1; background-color: rgba(0, 0, 0, 0.6); }
[data-field] > .field-handle:active { cursor: grabbing; transform: scale(0.95); }
/* The handles are keyboard-focusable (tabindex 0) for the move-mode flow, so
   they need a clear focus ring. focus-visible for pointer users; a :focus
   fallback covers engines without :focus-visible. */
[data-field] > .field-handle:focus-visible,
.textbox-layer .textbox__handle:focus-visible {
  opacity: 1;
  outline: 2px solid var(--accent, #B5462C);
  outline-offset: 2px;
}
[data-field] > .field-handle:focus:not(:focus-visible),
.textbox-layer .textbox__handle:focus:not(:focus-visible) { outline: none; }
[data-field][data-moving] > .field-handle {
  background-color: var(--accent, #B5462C);
  background-image: radial-gradient(circle, rgba(20, 17, 14, 0.9) 1.6px, transparent 1.8px);
}
/* Hide the field-handle in textboxes (they have their own dedicated handle)
   and in thumbnails (no editing at thumb scale). */
.textbox > .field-handle { display: none; }
.thumb [data-field] > .field-handle { display: none; }

/* Thumbnails: keep the boxes visible but inert (parent disables pointer-events).
   Hide the handle entirely at thumb scale. */
.thumb .textbox-layer .textbox { cursor: default; outline: none !important; }
.thumb .textbox-layer .textbox__handle { display: none; }

/* ── Export safety: NO edit-only chrome in the printed/exported PDF ──────────
   PDF export = browser print (Cmd/Ctrl+P → Save as PDF) and the MCP renderer's
   page.pdf(); both honour @media print. The field-handle rests at opacity 0.25
   (an always-visible discoverability cue) and the freeform-box wrap carries an
   always-visible dashed outline — neither (nor the move/delete/dim controls)
   must bake into the exported PDF. The .thumb rules above only cover thumbnails,
   not print, which is why these leaked. */
@media print {
  .field-handle,
  [data-field-handle],
  .textbox-layer .textbox__handle,
  .textbox-layer .textbox__delete,
  .dim-control,
  .row-controls,
  .add-row,
  .decor-hide,
  .decor-ghost,
  .split-handle,
  .mirror-toggle { display: none !important; }
  .textbox-layer .textbox-wrap,
  .textbox-layer .textbox-wrap:hover,
  .textbox-layer .textbox-wrap:focus-within,
  .textbox-layer .textbox,
  .textbox-layer .textbox:focus,
  [data-field],
  [data-field]:hover,
  [data-field]:focus { outline: none !important; }
}

/* Left Pages rail. Phase 2: a normal grid item in the reserved [rail] track
   (was position:fixed with 16px insets + a hardcoded 300px width). Its width
   now comes from the --rail-w track (driven live by the resizer in main.js),
   so the gutter always equals the rail. The glass surface is theme-linked via
   --chrome-* tokens so it harmonises with light themes instead of being a
   fixed dark slab (findings chrome-vs-slide-language-clash / hardcoded-chrome).
   Sticky top keeps the rail in view while a tall deck scrolls. */
.edt {
  grid-column: rail;
  position: sticky;
  top: var(--shell-pad, 16px);
  align-self: start;
  height: calc(100dvh - 2 * var(--shell-pad, 16px));
  z-index: 50;
  display: flex;
  flex-direction: column;
  background: var(--chrome-surface, rgba(20, 17, 14, 0.78));
  border: 0.5px solid var(--chrome-border, rgba(255, 255, 255, 0.08));
  border-radius: 14px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  font-family: var(--f-body);
  color: var(--chrome-ink, var(--ink));
  overflow: hidden;
}

.edt__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  padding: 14px 16px 10px;
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--chrome-ink-dim, rgba(239, 233, 219, 0.55));
  border-bottom: 1px solid var(--chrome-line, rgba(255, 255, 255, 0.06));
}
.edt__title-wrap {
  display: inline-flex;
  align-items: baseline;
  gap: 10px;
  min-width: 0;
  flex-wrap: wrap;
}
.edt__title { color: var(--chrome-ink, rgba(239, 233, 219, 0.95)); font-weight: 500; }
.edt__count { font-variant-numeric: tabular-nums; }

.edt__head-right {
  display: inline-flex;
  align-items: center;
  gap: 10px;
}
.edt__history-row {
  display: inline-flex;
  gap: 4px;
}
.edt__history {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--chrome-ink-dim, rgba(239, 233, 219, 0.7));
  width: 26px;
  height: 22px;
  border-radius: 5px;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, opacity 120ms ease;
  font-family: var(--f-body);
}
.edt__history:hover:not(:disabled) {
  background: var(--chrome-hover, rgba(255, 255, 255, 0.08));
  color: var(--chrome-ink, #F1ECE0);
}
.edt__history:active:not(:disabled) {
  background: var(--chrome-hover, rgba(255, 255, 255, 0.14));
}
.edt__history:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

.edt__list {
  flex: 1 1 auto;
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 12px;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: rgba(255, 255, 255, 0.18) transparent;
}
.edt__list::-webkit-scrollbar { width: 8px; }
.edt__list::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.18); border-radius: 4px; border: 2px solid transparent; background-clip: content-box; }

.edt__tools {
  padding: 10px 12px;
  border-top: 1px solid var(--chrome-line, rgba(255, 255, 255, 0.06));
}
.edt__primary {
  width: 100%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 12px;
  border: 0;
  border-radius: 9px;
  background: var(--accent);
  color: #14110E;
  font-family: var(--f-mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
  transition: filter 120ms ease, transform 120ms ease;
}
.edt__primary:hover { filter: brightness(1.1); }
.edt__primary:active { transform: scale(0.98); }

.edt__file {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 12px 12px;
  border-top: 1px solid var(--chrome-line, rgba(255, 255, 255, 0.04));
  padding-top: 10px;
}
.edt__link {
  appearance: none;
  border: 1px solid var(--chrome-border, rgba(255, 255, 255, 0.08));
  border-radius: 7px;
  background: transparent;
  color: var(--chrome-ink-dim, rgba(239, 233, 219, 0.7));
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 8px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.edt__link:hover { background: var(--chrome-hover, rgba(255, 255, 255, 0.06)); color: var(--chrome-ink, var(--ink)); }

/* ── Thumbnails ──────────────────────────────────────────────────────────── */
.thumb {
  position: relative;
  border: 1.5px solid rgba(255, 255, 255, 0.06);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  transition: border-color 120ms ease, transform 120ms ease;
  user-select: none;
}
.thumb:hover { border-color: rgba(255, 255, 255, 0.18); }
.thumb.is-active { border-color: var(--accent); }
.thumb:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.thumb__meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 6px 8px 4px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.thumb__num { color: var(--chrome-ink, rgba(239, 233, 219, 0.95)); font-variant-numeric: tabular-nums; }
.thumb__label { color: var(--chrome-ink-dim, rgba(239, 233, 219, 0.7)); font-weight: 500; }

.thumb__cell {
  /* Render the slide at a much smaller scale than the main stage. The slide
     itself uses `transform: scale(var(--preview-scale))` driven by this var,
     so we just override it locally. */
  --preview-scale: 0.25;
  width: calc(var(--slide-w) * var(--preview-scale));
  height: calc(var(--slide-h) * var(--preview-scale));
  margin: 0 auto 4px;
  position: relative;
  overflow: hidden;
  border-radius: 4px;
  pointer-events: none; /* clicks fall through to .thumb */
}
.thumb__cell .slide { transform-origin: top left; }

.thumb__ctl {
  position: absolute;
  top: 4px;
  right: 4px;
  display: none;
  flex-direction: row;
  gap: 2px;
  padding: 3px;
  background: rgba(0, 0, 0, 0.7);
  border-radius: 6px;
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
}
.thumb:hover .thumb__ctl,
.thumb:focus-within .thumb__ctl { display: flex; }

.thumb__btn {
  width: 22px;
  height: 22px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(255, 255, 255, 0.85);
  cursor: pointer;
  border-radius: 4px;
  transition: background 120ms ease, color 120ms ease;
}
.thumb__btn:hover { background: rgba(255, 255, 255, 0.15); color: #fff; }
.thumb__btn:disabled { opacity: 0.3; cursor: not-allowed; }
.thumb__btn--danger:hover { background: rgba(220, 64, 64, 0.5); }
.thumb__btn .icon { display: inline-flex; }

/* ── Add slide / change template modal ───────────────────────────────────── */
.tpl-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: rgba(10, 8, 6, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: tpl-fade-in 180ms ease-out;
}
@keyframes tpl-fade-in { from { opacity: 0; } to { opacity: 1; } }

.tpl-dialog {
  width: min(900px, 100%);
  max-height: calc(100vh - 64px);
  background: #1B1714;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--f-body);
  color: var(--ink);
}

.tpl-dialog__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.tpl-dialog__head h2 {
  margin: 0;
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 26px;
  letter-spacing: -0.01em;
}
.tpl-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(239, 233, 219, 0.6);
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.tpl-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }

.tpl-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 14px;
  padding: 20px 24px 24px;
  overflow-y: auto;
}

.tpl-card {
  appearance: none;
  border: 1.5px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.02);
  padding: 0;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: inherit;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  transition: border-color 120ms ease, transform 120ms ease, background 120ms ease;
}
.tpl-card:hover { border-color: var(--accent); background: rgba(181, 70, 44, 0.06); transform: translateY(-2px); }
.tpl-card:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }

.tpl-card__preview {
  height: 130px;
  position: relative;
  background: var(--paper, #14110E);
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
}
/* Per-template visual hint inside the card preview */
.tpl-card__preview::before,
.tpl-card__preview::after {
  content: "";
  position: absolute;
  background: var(--ink, #EFE9DB);
  opacity: 0.7;
}
.tpl-card__preview[data-type="cover"]::before { left: 18px; bottom: 50px; width: 70%; height: 28px; background: var(--ink, #EFE9DB); }
.tpl-card__preview[data-type="cover"]::after { left: 18px; bottom: 22px; width: 50%; height: 6px; background: var(--accent, #B5462C); }
.tpl-card__preview[data-type="quote"]::before { left: 18px; top: 18px; width: 14px; height: 26px; background: var(--accent, #B5462C); border-radius: 2px; }
.tpl-card__preview[data-type="quote"]::after { left: 18px; top: 56px; width: 80%; height: 30px; }
.tpl-card__preview[data-type="bullets"]::before { left: 18px; top: 22px; width: 60%; height: 14px; }
.tpl-card__preview[data-type="bullets"]::after { left: 18px; top: 50px; width: 80%; height: 60px; background: repeating-linear-gradient(to bottom, var(--ink, #EFE9DB) 0 4px, transparent 4px 18px); }
.tpl-card__preview[data-type="imgtext"]::before { left: 18px; top: 22px; width: 36%; height: 88px; background: var(--accent, #B5462C); opacity: 0.5; border-radius: 4px; }
.tpl-card__preview[data-type="imgtext"]::after { right: 18px; top: 30px; width: 36%; height: 70px; background: repeating-linear-gradient(to bottom, var(--ink, #EFE9DB) 0 4px, transparent 4px 14px); }
.tpl-card__preview[data-type="steps"]::before { left: 18px; top: 18px; width: 24px; height: 22px; background: var(--accent, #B5462C); border-radius: 2px; }
.tpl-card__preview[data-type="steps"]::after { left: 56px; top: 22px; width: 60%; height: 80px; background: repeating-linear-gradient(to bottom, var(--ink, #EFE9DB) 0 4px, transparent 4px 24px); }
.tpl-card__preview[data-type="full"] { background: linear-gradient(135deg, #2a241b 0%, #14110E 100%); }
.tpl-card__preview[data-type="full"]::before { left: 14px; top: 14px; width: 70px; height: 18px; background: var(--accent, #B5462C); }
.tpl-card__preview[data-type="full"]::after { left: 14px; bottom: 14px; right: 14px; height: 22px; background: var(--ink, #EFE9DB); opacity: 0.85; }
.tpl-card__preview[data-type="stat"]::before { left: 18px; top: 30px; width: 130px; height: 70px; background: var(--accent, #B5462C); border-radius: 2px; }
.tpl-card__preview[data-type="stat"]::after { left: 18px; bottom: 18px; width: 80%; height: 12px; }
.tpl-card__preview[data-type="close"]::before { left: 18px; top: 22px; width: 70%; height: 24px; }
.tpl-card__preview[data-type="close"]::after { left: 18px; top: 60px; width: 90%; height: 50px; background: repeating-linear-gradient(to bottom, var(--ink, #EFE9DB) 0 3px, transparent 3px 14px); }
.tpl-card__preview[data-type="statement"]::before { left: 16px; top: 36px; right: 16px; height: 42px; background: var(--ink, #EFE9DB); }
.tpl-card__preview[data-type="statement"]::after { left: 16px; bottom: 26px; width: 36%; height: 8px; background: var(--accent, #B5462C); }
.tpl-card__preview[data-type="compare"]::before { left: 16px; top: 26px; width: 34%; height: 74px; background: repeating-linear-gradient(to bottom, var(--ink, #EFE9DB) 0 4px, transparent 4px 16px); }
.tpl-card__preview[data-type="compare"]::after { right: 16px; top: 26px; width: 34%; height: 74px; background: repeating-linear-gradient(to bottom, var(--ink, #EFE9DB) 0 4px, transparent 4px 16px); }
.tpl-card__preview[data-type="checklist"]::before { left: 18px; top: 22px; width: 24px; height: 14px; background: var(--accent, #B5462C); }
.tpl-card__preview[data-type="checklist"]::after { left: 18px; top: 50px; width: 78%; height: 62px; background: repeating-linear-gradient(to bottom, var(--ink, #EFE9DB) 0 4px, transparent 4px 20px); }
.tpl-card__preview[data-type="divider"]::before { left: 18px; top: 24px; width: 56px; height: 70px; background: var(--accent, #B5462C); border-radius: 2px; }
.tpl-card__preview[data-type="divider"]::after { left: 18px; bottom: 24px; width: 66%; height: 16px; background: var(--ink, #EFE9DB); }
.tpl-card__preview[data-type="fullbg"] { background: linear-gradient(135deg, #1f1a14 0%, #000 100%); }
.tpl-card__preview[data-type="fullbg"]::before { left: 14px; top: 14px; width: 56px; height: 16px; background: var(--accent, #B5462C); }
.tpl-card__preview[data-type="fullbg"]::after { left: 14px; bottom: 16px; right: 28px; height: 20px; background: var(--ink, #EFE9DB); opacity: 0.7; }

.tpl-card__meta { padding: 12px 14px 14px; }
.tpl-card__label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-family: var(--f-display);
  font-size: 18px;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.tpl-card__pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: 999px;
  background: rgba(181, 70, 44, 0.18);
  color: var(--accent);
  font-weight: 500;
}
.tpl-card__desc {
  font-family: var(--f-body);
  font-size: 12.5px;
  line-height: 1.4;
  color: rgba(239, 233, 219, 0.55);
}

/* ── Layout — the editor grid shell reserves the rail + panel gutters ───────
   The old `.app{padding-left:260px}` magic number is GONE: the [rail] grid
   track already reserves the left rail and the [tweaks] track reserves the
   right panel, so the centred slide can never underlap either (findings
   68-widened-slide-worsened-overlap + slide-under-tweaks-panel). The
   .slide-cell__num offset stays (the ruler label is display:none by default
   but kept positioned for anyone who re-enables it). */
@media (min-width: 1100px) {
  .slide-cell__num { left: -54px; }
}

/* Intermediate band (1100–1320px): before the single-column collapse, pull
   the rail + panel gutters in so the stage keeps a usable width on smaller
   laptops (finding no-breakpoint-between-fixed-and-collapse). The resizer can
   still override --rail-w / --tweaks-w above these floors. */
@media (min-width: 1100px) and (max-width: 1320px) {
  body { --rail-w: 248px; --tweaks-w: 248px; --shell-gap: 16px; }
}

/* ── Collapse: single column + Tweaks bottom sheet (SCREEN ONLY) ────────────
   `@media screen` is load-bearing for print safety: the print path emulates a
   1080px page, which is < 1099px, so an unscoped rule here would re-show /
   re-float the rail + Tweaks panel on paper. Scoping to `screen` keeps print
   on its dedicated one-slide-per-page path (risk 3). */
@media screen and (max-width: 1099px) {
  /* One column; the rail becomes a top strip (row 1), the stage row 2. The
     Tweaks cell overlaps the stage row — the panel itself is the bottom sheet
     (position:fixed, below), so the empty cell does not consume layout. */
  body {
    grid-template-columns: minmax(0, 1fr);
    grid-template-rows: auto 1fr;
    column-gap: 0;
    padding: 0;
  }
  .app { grid-column: 1; grid-row: 2; }
  #tweaks-root { grid-column: 1; grid-row: 2; }

  /* Below 1100px the editor collapses to a horizontal top strip, not a left
     rail. (Was position:relative under the old fixed model; now it is grid
     row 1 and we reset the docked sticky offsets.) */
  .edt {
    grid-column: 1;
    grid-row: 1;
    position: relative;
    top: auto; left: auto; right: auto; bottom: auto;
    align-self: auto;
    width: auto;
    height: auto;
    max-height: 248px;
    margin: 8px;
  }
  .edt__list {
    flex-direction: row;
    overflow-x: auto;
    overflow-y: hidden;
    /* Breathing room so the cramped thumb strip isn't edge-to-edge
       (finding mobile-thumb-strip-cramped). */
    gap: 12px;
    padding: 12px;
    scroll-padding: 12px;
  }
  .thumb { min-width: 132px; }
  .thumb__cell { --preview-scale: 0.12; }

  /* Tweaks → bottom sheet. Full-width, docked to the bottom, slides up, and
     scrolls internally (finding tweaks-panel-no-mobile-treatment). This must
     out-specify BOTH the docked desktop rule above AND the runtime-injected
     TWEAKS_STYLE; `#tweaks-root .twk-panel` (1,1,0) beats the injected
     `.twk-panel` (0,1,0), and !important on the geometric props beats any
     inline right/bottom the panel's drag handler could write while floating. */
  #tweaks-root .twk-panel {
    position: fixed !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    top: auto !important;
    width: auto !important;
    max-width: none !important;
    max-height: min(60dvh, 520px);
    border-radius: 14px 14px 0 0;
    transform: none !important;
    transform-origin: bottom center;
    overflow-y: auto;
    overscroll-behavior: contain;
    box-shadow: 0 -12px 40px rgba(0, 0, 0, 0.28);
    animation: twk-sheet-up 200ms cubic-bezier(0.3, 0.7, 0.4, 1);
  }
  /* The drag-to-resize handle is meaningless for a full-width sheet. */
  #tweaks-root .twk-panel .panel-resizer { display: none; }
}
@keyframes twk-sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

@media screen and (max-width: 720px) {
  .edt { max-height: 188px; }
  .thumb__cell { --preview-scale: 0.08; }
  .thumb { min-width: 96px; }
}

/* ── Paste JSON modal ──────────────────────────────────────────────────── */
.edt__overlay {
  position: fixed;
  inset: 0;
  z-index: 1100;
  background: rgba(10, 8, 6, 0.7);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 32px;
  animation: tpl-fade-in 180ms ease-out;
}
.edt__paste-modal {
  width: min(720px, 100%);
  background: #1B1714;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  box-shadow: 0 24px 80px rgba(0, 0, 0, 0.6);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  font-family: var(--f-body);
  color: var(--ink);
}
.edt__paste-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.edt__paste-head strong {
  font-family: var(--f-display);
  font-weight: 400;
  font-size: 22px;
  letter-spacing: -0.01em;
}
.edt__overlay-close {
  appearance: none;
  border: 0;
  background: transparent;
  color: rgba(239, 233, 219, 0.6);
  font-size: 18px;
  width: 32px;
  height: 32px;
  border-radius: 8px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.edt__overlay-close:hover { background: rgba(255, 255, 255, 0.08); color: var(--ink); }
.edt__paste-hint {
  padding: 12px 22px 0;
  color: rgba(239, 233, 219, 0.55);
  font-size: 12px;
  line-height: 1.5;
}
.edt__paste-ta {
  margin: 12px 22px;
  min-height: 280px;
  resize: vertical;
  padding: 12px;
  font-family: var(--f-mono, "JetBrains Mono", ui-monospace, monospace);
  font-size: 12px;
  line-height: 1.5;
  color: var(--ink);
  background: #14110E;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  outline: none;
}
.edt__paste-ta:focus { border-color: var(--accent, #B5462C); }
.edt__paste-err {
  margin: 0 22px;
  color: #E08D6F;
  font-size: 12px;
  min-height: 16px;
}
.edt__paste-foot {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding: 14px 22px 18px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

/* ── File-tools groups (presets | file I/O) ───────────────────────────────
   The file row used to be one flat grid; it now lives in two labelled
   clusters with a hairline divider so presets, file I/O, and clipboard
   actions read at different altitudes (finding save-open-json-labeling-
   ambiguity). Each group keeps the same two-column grid as the old row. */
.edt__file-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
/* A lone trailing button in a group spans both columns so it doesn't leave a
   ragged half-row. Re-scoped per group (was a single rule on .edt__file). */
.edt__file-group > :last-child:nth-child(odd) { grid-column: span 2; }
.edt__file-cap {
  grid-column: span 2;
  font-family: var(--f-mono);
  font-size: 9px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--chrome-ink-dim, rgba(239, 233, 219, 0.7));
  margin: 2px 0 0;
}
.edt__file-divider {
  height: 1px;
  background: var(--chrome-line, rgba(255, 255, 255, 0.06));
  margin: 8px 0 2px;
}

/* ── Autosave indicator (near the Slides header) ──────────────────────────
   Quiet reassurance that every edit already persists to this browser
   (finding no-autosave-reassurance). Mono, dim, with a tiny dot that pulses
   to accent for ~1s when a change lands, then settles back. */
.edt__saved {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: var(--f-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: none;
  color: var(--chrome-ink-dim, rgba(239, 233, 219, 0.7));
  white-space: nowrap;
  user-select: none;
}
.edt__saved::before {
  content: "";
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--chrome-ink-dim, rgba(239, 233, 219, 0.4));
  transition: background 200ms ease, box-shadow 200ms ease;
}
.edt__saved.is-pulsing::before {
  background: var(--accent, #B5462C);
  box-shadow: 0 0 0 2px color-mix(in oklab, var(--accent, #B5462C) 28%, transparent);
}
@media (prefers-reduced-motion: reduce) {
  .edt__saved::before { transition: none; }
}

/* ── Toast — transient feedback (built in toast.js) ───────────────────────
   Singleton host docked BOTTOM-LEFT (the right edge is taken by the Tweaks
   panel + its floating "Style" reopen pill, and by the Tweaks bottom-sheet
   under 1100px). Host is click-through; each toast re-enables pointer events
   so it can be hovered / actioned without blocking stage clicks underneath.
   z-index sits above the rail/panel but the toast only ever fires over the
   bare stage (deck swaps, deletes, file/PPTX errors) — Paste-JSON errors stay
   in that modal's inline errBox, so a toast never overlaps a modal button. */
.toast-host {
  position: fixed;
  left: 16px;
  bottom: 16px;
  z-index: 1200;
  display: flex;
  flex-direction: column-reverse; /* newest nearest the corner */
  gap: 10px;
  max-width: min(380px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 11px 12px 11px 14px;
  background: var(--chrome-surface, rgba(20, 17, 14, 0.92));
  border: 0.5px solid var(--chrome-border, rgba(255, 255, 255, 0.1));
  border-radius: 12px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, 0.45);
  -webkit-backdrop-filter: blur(20px) saturate(140%);
  backdrop-filter: blur(20px) saturate(140%);
  color: var(--chrome-ink, #EFE9DB);
  font-family: var(--f-body);
}
.toast--error {
  border-left: 3px solid var(--accent, #B5462C);
}
.toast__msg {
  flex: 1 1 auto;
  font-size: 13.5px;
  line-height: 1.4;
}
.toast--error .toast__msg { color: #E08D6F; }
.toast__action {
  flex: 0 0 auto;
  appearance: none;
  border: 1px solid var(--chrome-border, rgba(255, 255, 255, 0.14));
  background: transparent;
  color: var(--chrome-ink-dim, rgba(239, 233, 219, 0.85));
  font-family: var(--f-mono);
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 6px 10px;
  border-radius: 7px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, border-color 120ms ease;
}
.toast__action:hover {
  background: var(--chrome-hover, rgba(255, 255, 255, 0.08));
  color: var(--accent, #B5462C);
  border-color: var(--accent, #B5462C);
}
.toast__close {
  flex: 0 0 auto;
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--chrome-ink-dim, rgba(239, 233, 219, 0.55));
  font-size: 18px;
  line-height: 1;
  width: 26px;
  height: 26px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease;
}
.toast__close:hover {
  background: var(--chrome-hover, rgba(255, 255, 255, 0.08));
  color: var(--chrome-ink, #EFE9DB);
}
.toast__action:focus-visible,
.toast__close:focus-visible {
  outline: 2px solid var(--accent, #B5462C);
  outline-offset: 2px;
}
/* Bigger touch targets on coarse pointers (finger / pen). */
@media (pointer: coarse) {
  .toast__action { padding: 11px 14px; }
  .toast__close { width: 40px; height: 40px; }
}
/* Motion only when the user hasn't asked to reduce it. Entry slides up from
   the corner; leave fades + drops. With reduce, both are instant. */
@media (prefers-reduced-motion: no-preference) {
  .toast {
    animation: toast-in 180ms cubic-bezier(0.3, 0.7, 0.4, 1);
    transition: opacity 200ms ease, transform 200ms ease;
  }
  .toast.is-leaving {
    opacity: 0;
    transform: translateY(8px);
  }
}
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}
@media print { .toast-host { display: none !important; } }

/* ── Accessibility: visually-hidden text (SR-only) + skip link ───────────── */
.sr-only {
  position: absolute !important;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0, 0, 0, 0);
  white-space: nowrap; border: 0;
}
/* Skip-to-editing-area link — first focusable element; hidden until focused. */
.skip-link {
  position: fixed;
  top: 8px; left: 8px;
  z-index: 2000;
  transform: translateY(-150%);
  transition: transform 120ms ease;
  background: var(--accent, #B5462C);
  color: #fff;
  font-family: var(--f-body);
  font-size: 13px;
  padding: 8px 14px;
  border-radius: 8px;
  text-decoration: none;
}
.skip-link:focus { transform: translateY(0); outline: 2px solid #fff; outline-offset: 2px; }
@media (prefers-reduced-motion: reduce) { .skip-link { transition: none; } }
