/* =========================================================================
   Convertly — "precision tool" design system

   Deliberately not a centred marketing page: this is a two-pane workbench.
   Warm paper base, ink-black type, a single terracotta accent, hairline
   rules and small radii. Metadata is set in monospace so file details read
   like instrument readouts rather than body copy.
   ========================================================================= */

/* ------------------------------------------------------------- tokens --- */

:root,
[data-theme="light"] {
  --paper:        #faf7f2;
  --surface:      #ffffff;
  --surface-2:    #f4f0e9;
  --surface-3:    #ebe5da;

  --ink:          #1c1917;
  --ink-2:        #57534e;
  --ink-3:        #8c8378;

  --line:         #e4ddd1;
  --line-2:       #d1c8b8;
  --line-3:       #b8ad9a;

  --accent:       #c2410c;
  --accent-hover: #9a3412;
  --accent-soft:  #fdf1e8;
  --accent-line:  #f0c4a4;
  --accent-ink:   #ffffff;

  --ok:           #3f6212;
  --ok-soft:      #f2f7e8;
  --ok-line:      #cfe0a8;

  --bad:          #b91c1c;
  --bad-soft:     #fdf0ef;
  --bad-line:     #f3c4c0;

  --warn:         #92400e;
  --warn-soft:    #fdf5e6;
  --warn-line:    #ecd4a4;

  --grain: .022;
  color-scheme: light;
}

[data-theme="dark"] {
  --paper:        #17150f;
  --surface:      #201d17;
  --surface-2:    #29251e;
  --surface-3:    #332e25;

  --ink:          #f2ede4;
  --ink-2:        #a9a094;
  --ink-3:        #78706a;

  --line:         #322d25;
  --line-2:       #443e34;
  --line-3:       #5b5346;

  --accent:       #ea7c3c;
  --accent-hover: #f59355;
  --accent-soft:  #2d1e12;
  --accent-line:  #6b4526;
  --accent-ink:   #17150f;

  --ok:           #a3c76d;
  --ok-soft:      #1e2414;
  --ok-line:      #3f5122;

  --bad:          #f08a80;
  --bad-soft:     #2a1614;
  --bad-line:     #5c2b26;

  --warn:         #dfae5c;
  --warn-soft:    #2a2113;
  --warn-line:    #574222;

  --grain: .04;
  color-scheme: dark;
}

:root {
  --sans: ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", Inter,
          Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, "SF Mono", Menlo, Consolas,
          "Liberation Mono", monospace;

  --rail: 268px;
  --bar: 56px;
  --r: 6px;
  --r-lg: 10px;
}

/* -------------------------------------------------------------- reset --- */

*, *::before, *::after { box-sizing: border-box; }

/*
 * MUST come before any component rule that sets `display`.
 *
 * The browser's own [hidden] { display: none } lives in the user-agent
 * stylesheet, which loses to *any* author declaration. So `.runbar { display:
 * flex }` silently defeats `<div class="runbar" hidden>` and the element stays
 * on screen. The whole UI relies on the hidden attribute — settings panel, run
 * bar, error box, sidebar filter — so this single rule keeps all of it honest.
 * Do not remove.
 */
[hidden] { display: none !important; }

html { -webkit-text-size-adjust: 100%; height: 100%; }

body {
  margin: 0;
  min-height: 100%;
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.55;
  letter-spacing: -.005em;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
  transition: background-color .2s ease, color .2s ease;
}

/* Paper grain. Fixed, non-interactive, scales with theme. */
body::before {
  content: "";
  position: fixed; inset: 0;
  pointer-events: none; z-index: 1;
  opacity: var(--grain);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='.85' numOctaves='3'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
}

img, svg { max-width: 100%; }
svg { display: block; }

/* Long unbroken filenames must never widen the layout. */
body { overflow-wrap: break-word; }
.q-name, .out-name, .dir-name { overflow-wrap: anywhere; }

a { color: inherit; text-decoration: none; }

h1, h2, h3, h4 {
  margin: 0 0 .5em;
  font-weight: 600;
  line-height: 1.16;
  letter-spacing: -.028em;
}
h1 { font-size: 1.62rem; }
h2 { font-size: 1.16rem; }
h3 { font-size: .98rem; }
p { margin: 0 0 .9rem; }

.muted { color: var(--ink-2); }
.small { font-size: .82rem; }
.mono  { font-family: var(--mono); font-size: .8rem; letter-spacing: 0; }

/* Small uppercase section markers — a recurring motif. */
.eyebrow {
  display: block;
  font-family: var(--mono);
  font-size: .68rem;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: .13em;
  color: var(--ink-3);
}

.skip-link {
  position: absolute; left: -9999px; top: 0; z-index: 999;
  padding: .7rem 1.1rem;
  background: var(--accent); color: var(--accent-ink);
}
.skip-link:focus { left: 0; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 3px;
}

/* ========================================================== app shell === */

.shell {
  display: grid;
  grid-template-columns: var(--rail) minmax(0, 1fr);
  min-height: 100vh;
  position: relative;
  z-index: 2;
}

/* ---------------------------------------------------------------- rail --- */

.rail {
  position: sticky; top: 0;
  height: 100vh;
  display: flex; flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
}

.rail-head {
  display: flex; align-items: center; gap: .6rem;
  height: var(--bar);
  padding: 0 1rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}

.mark {
  width: 26px; height: 26px;
  display: grid; place-items: center;
  background: var(--accent);
  border-radius: var(--r);
  flex-shrink: 0;
}
.mark svg { width: 15px; height: 15px; color: var(--accent-ink); }

.wordmark {
  font-size: .96rem; font-weight: 600; letter-spacing: -.02em;
}
.wordmark span { color: var(--accent); }

/* search */

.rail-search {
  position: relative;
  padding: .75rem;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.rail-search svg {
  position: absolute; left: 1.4rem; top: 50%; transform: translateY(-50%);
  width: 14px; height: 14px; color: var(--ink-3); pointer-events: none;
}
.rail-search input {
  width: 100%;
  padding: .48rem .6rem .48rem 2rem;
  font: inherit; font-size: .86rem;
  color: var(--ink);
  background: var(--surface-2);
  border: 1px solid transparent;
  border-radius: var(--r);
}
.rail-search input:focus {
  outline: none;
  border-color: var(--accent);
  background: var(--surface);
}
.rail-search input::placeholder { color: var(--ink-3); }

.kbd {
  position: absolute; right: 1.35rem; top: 50%; transform: translateY(-50%);
  padding: .1rem .32rem;
  font-family: var(--mono); font-size: .66rem;
  color: var(--ink-3);
  border: 1px solid var(--line-2); border-radius: 3px;
  pointer-events: none;
}
.rail-search input:focus ~ .kbd { display: none; }

/* converter list */

.rail-list {
  flex: 1; overflow-y: auto;
  padding: .5rem 0 1.5rem;
  scrollbar-width: thin;
}
.rail-list::-webkit-scrollbar { width: 8px; }
.rail-list::-webkit-scrollbar-thumb {
  background: var(--line-2); border-radius: 4px;
  border: 2px solid var(--surface);
}

.rail-group { border-bottom: 1px solid var(--line); }
.rail-group:last-child { border-bottom: 0; }

.group-btn {
  display: flex; align-items: center; gap: .5rem; width: 100%;
  padding: .7rem 1rem;
  font: inherit;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-3);
  font-family: var(--mono); font-size: .68rem;
  text-transform: uppercase; letter-spacing: .13em;
}
.group-btn:hover { color: var(--ink); }
.group-btn .tw {
  width: 9px; height: 9px; margin-left: auto;
  transition: transform .18s ease;
  color: var(--ink-3);
}
.rail-group.open .group-btn .tw { transform: rotate(90deg); }
.group-count {
  font-size: .68rem;
  color: var(--ink-3);
  font-variant-numeric: tabular-nums;
}

.group-items { display: none; padding-bottom: .5rem; }
.rail-group.open .group-items { display: block; }

.rail-link {
  display: flex; align-items: center; gap: .55rem;
  padding: .38rem 1rem .38rem 1.15rem;
  font-size: .855rem;
  color: var(--ink-2);
  border-left: 2px solid transparent;
}
.rail-link:hover { color: var(--ink); background: var(--surface-2); }

.rail-link.active {
  color: var(--accent);
  font-weight: 600;
  border-left-color: var(--accent);
  background: var(--accent-soft);
}

/* Format tag chip on each row — the "instrument" detail. */
.tag {
  margin-left: auto;
  font-family: var(--mono); font-size: .64rem;
  letter-spacing: .04em;
  color: var(--ink-3);
  padding: .05rem .3rem;
  border: 1px solid var(--line); border-radius: 3px;
  flex-shrink: 0;
}
.rail-link.active .tag { color: var(--accent); border-color: var(--accent-line); }

.rail-empty {
  padding: 1.5rem 1rem; text-align: center;
  font-size: .84rem; color: var(--ink-3);
}

.rail-foot {
  padding: .7rem 1rem;
  border-top: 1px solid var(--line);
  display: flex; align-items: center; justify-content: space-between;
  flex-shrink: 0;
}

/* theme switch — a 3-position segmented control, not a single toggle */
.theme-seg {
  display: flex;
  background: var(--surface-2);
  border-radius: var(--r);
  padding: 2px;
}
.theme-seg button {
  width: 26px; height: 22px;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: 4px;
  color: var(--ink-3); cursor: pointer;
}
.theme-seg button svg { width: 13px; height: 13px; }
.theme-seg button:hover { color: var(--ink); }
.theme-seg button[aria-pressed="true"] {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}

/* ========================================================= work area === */

.work { display: flex; flex-direction: column; min-width: 0; }

.topbar {
  position: sticky; top: 0; z-index: 20;
  display: flex; align-items: center; gap: .75rem;
  height: var(--bar);
  padding: 0 1.5rem;
  background: var(--paper);
  background: color-mix(in srgb, var(--paper) 92%, transparent);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}

.rail-toggle {
  display: none;
  width: 32px; height: 32px;
  place-items: center;
  background: none; border: 1px solid var(--line-2); border-radius: var(--r);
  color: var(--ink); cursor: pointer;
}
.rail-toggle svg { width: 15px; height: 15px; }

.crumbs {
  display: flex; align-items: center; gap: .45rem;
  font-family: var(--mono); font-size: .74rem;
  color: var(--ink-3);
  min-width: 0;
}
.crumbs a:hover { color: var(--ink); }
.crumbs .sep { color: var(--line-3); }
.crumbs strong {
  color: var(--ink); font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}

.engine-chip {
  margin-left: auto;
  display: flex; align-items: center; gap: .4rem;
  padding: .2rem .55rem;
  font-family: var(--mono); font-size: .68rem;
  color: var(--ink-2);
  border: 1px solid var(--line); border-radius: 99px;
  white-space: nowrap;
}
.dot { width: 5px; height: 5px; border-radius: 50%; background: var(--ok); flex-shrink: 0; }
.dot.warn { background: var(--warn); }

/* ------------------------------------------------------------- canvas --- */

.canvas {
  flex: 1;
  padding: 1.75rem 1.5rem 4rem;
  max-width: 1080px;
  width: 100%;
}

.page-head { margin-bottom: 1.5rem; }
.page-head h1 { margin: .3rem 0 .35rem; }
.page-head p { color: var(--ink-2); max-width: 62ch; margin: 0; }

/* Conversion direction display — big, typographic, unmistakably not a hero. */
.flow {
  display: flex; align-items: center; gap: .85rem;
  margin: 1.1rem 0 0;
  padding: .85rem 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-left: 3px solid var(--accent);
  border-radius: var(--r);
}
.flow-fmt {
  font-family: var(--mono); font-size: 1.02rem; font-weight: 600;
  letter-spacing: -.01em;
}
.flow-arrow { color: var(--accent); width: 20px; height: 12px; flex-shrink: 0; }
.flow-note {
  margin-left: auto;
  font-family: var(--mono); font-size: .7rem; color: var(--ink-3);
}

/* ---------------------------------------------------------- drop zone --- */

/* Corner brackets instead of a dashed rectangle. */
.drop {
  position: relative;
  padding: 2.4rem 1.5rem;
  margin-bottom: 1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  text-align: center;
  cursor: pointer;
  transition: border-color .15s ease, background-color .15s ease;
}
.drop::before, .drop::after {
  content: ""; position: absolute;
  width: 14px; height: 14px;
  border: 2px solid var(--line-3);
  transition: border-color .15s ease;
}
.drop::before { top: 12px; left: 12px; border-right: 0; border-bottom: 0; border-radius: 3px 0 0 0; }
.drop::after  { bottom: 12px; right: 12px; border-left: 0; border-top: 0; border-radius: 0 0 3px 0; }

.drop:hover { border-color: var(--line-2); }
.drop:hover::before, .drop:hover::after { border-color: var(--accent); }

.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.drop.over::before, .drop.over::after { border-color: var(--accent); }

.drop-title { font-size: 1rem; font-weight: 600; margin-bottom: .2rem; }
.drop-sub { font-size: .84rem; color: var(--ink-2); margin-bottom: 1rem; }

.drop-actions {
  min-width: 0;
  display: flex; align-items: center; justify-content: center;
  gap: .5rem; flex-wrap: wrap;
}
.drop-meta {
  margin-top: 1.1rem;
  font-family: var(--mono); font-size: .7rem; color: var(--ink-3);
}

.pick { position: relative; display: inline-block; }
.pick-menu {
  position: absolute; top: calc(100% + 5px); left: 0;
  min-width: 168px; z-index: 30;
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r);
  box-shadow: 0 8px 26px rgba(28,25,23,.13);
  overflow: hidden;
}
.pick-menu button {
  display: flex; align-items: center; gap: .55rem; width: 100%;
  padding: .55rem .75rem;
  font: inherit; font-size: .85rem; text-align: left;
  color: var(--ink); background: none; border: 0; cursor: pointer;
}
.pick-menu button:hover { background: var(--surface-2); }
.pick-menu button + button { border-top: 1px solid var(--line); }
.pick-menu svg { width: 14px; height: 14px; color: var(--ink-3); flex-shrink: 0; }

/* --------------------------------------------------------------- URL --- */

.url-bar { display: flex; gap: .5rem; margin-bottom: 1rem; }
.url-bar input {
  flex: 1;
  padding: .5rem .7rem;
  font: inherit; font-size: .87rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: var(--r);
}

/* ------------------------------------------------------------ buttons --- */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  padding: .48rem 1rem;
  font: inherit; font-size: .86rem; font-weight: 500;
  border: 1px solid transparent; border-radius: var(--r);
  cursor: pointer;
  transition: background-color .14s ease, border-color .14s ease, color .14s ease;
  white-space: nowrap;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn svg { width: 14px; height: 14px; }

.btn-primary { background: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-line {
  background: var(--surface); color: var(--ink);
  border-color: var(--line-2);
}
.btn-line:hover:not(:disabled) { border-color: var(--line-3); background: var(--surface-2); }

.btn-quiet { background: none; color: var(--ink-2); }
.btn-quiet:hover:not(:disabled) { color: var(--ink); background: var(--surface-2); }

.btn-lg { padding: .6rem 1.3rem; font-size: .9rem; }

.icon-btn {
  width: 28px; height: 28px; padding: 0;
  display: grid; place-items: center;
  background: none; border: 0; border-radius: var(--r);
  color: var(--ink-3); cursor: pointer;
  flex-shrink: 0;
}
.icon-btn:hover { color: var(--bad); background: var(--bad-soft); }
.icon-btn svg { width: 15px; height: 15px; }

/* --------------------------------------------------------- file queue --- */

/* A numbered manifest, not a card list. */
.queue { list-style: none; margin: 0 0 1rem; padding: 0; }

.queue-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .6rem .85rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  counter-increment: q;
}
.queue-row + .queue-row { margin-top: -1px; border-radius: 0; }
.queue-row:first-child { border-radius: var(--r) var(--r) 0 0; }
.queue-row:last-child  { border-radius: 0 0 var(--r) var(--r); }
.queue-row:only-child  { border-radius: var(--r); }

.queue-row::before {
  content: counter(q, decimal-leading-zero);
  font-family: var(--mono); font-size: .68rem;
  color: var(--ink-3);
  flex-shrink: 0;
}
.queue { counter-reset: q; }

.q-ext {
  width: 34px; height: 34px; flex-shrink: 0;
  display: grid; place-items: center;
  font-family: var(--mono); font-size: .58rem; font-weight: 600;
  letter-spacing: .02em;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 4px;
}

.q-meta { flex: 1; min-width: 0; }
.q-name {
  font-size: .875rem; font-weight: 500;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.q-sub { font-family: var(--mono); font-size: .7rem; color: var(--ink-3); }

.q-target { display: flex; align-items: center; gap: .4rem; flex-shrink: 0; }
.q-target .eyebrow { font-size: .62rem; }
.target-select { min-width: 92px; }

select, input[type="number"], input[type="url"], input[type="text"] {
  font: inherit; font-size: .84rem;
  padding: .34rem .5rem;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-2);
  border-radius: 4px;
}
select:disabled { opacity: .6; }
input[type="color"] {
  width: 40px; height: 28px; padding: 2px;
  background: var(--surface);
  border: 1px solid var(--line-2); border-radius: 4px; cursor: pointer;
}
input[type="range"] { accent-color: var(--accent); width: 100%; }
input[type="checkbox"] { accent-color: var(--accent); }

/* ----------------------------------------------------------- run bar --- */

.runbar {
  min-width: 0;
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  padding: .8rem 1rem;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r);
  margin-bottom: 1rem;
}
.runbar-right { display: flex; align-items: center; gap: .9rem; margin-left: auto; flex-wrap: wrap; }
.check-inline { display: flex; align-items: center; gap: .4rem; font-size: .84rem; cursor: pointer; }

/* ----------------------------------------------------------- options --- */

.opts { margin-bottom: 1rem; }
.opts-btn {
  display: flex; align-items: center; gap: .45rem;
  padding: .35rem 0;
  font: inherit;
  background: none; border: 0; cursor: pointer;
  color: var(--ink-2);
  font-family: var(--mono); font-size: .7rem;
  text-transform: uppercase; letter-spacing: .11em;
}
.opts-btn:hover { color: var(--ink); }
.opts-btn .tw { width: 9px; height: 9px; transition: transform .18s ease; }
.opts-btn[aria-expanded="true"] .tw { transform: rotate(90deg); }

.opts-body {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-top: .6rem; padding: 1.1rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
}

.opt { display: flex; flex-direction: column; gap: .3rem; }
.opt-wide { grid-column: 1 / -1; }
.opt > label {
  font-family: var(--mono); font-size: .66rem;
  text-transform: uppercase; letter-spacing: .11em;
  color: var(--ink-3);
}
.opt output { color: var(--accent); font-family: var(--mono); font-weight: 600; }

.sizes { display: flex; flex-wrap: wrap; gap: .35rem; margin-top: .2rem; }
.size {
  display: inline-flex; align-items: center; gap: .3rem;
  padding: .28rem .55rem;
  font-family: var(--mono); font-size: .72rem;
  background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 4px;
  cursor: pointer; user-select: none;
}
.size input { width: 12px; height: 12px; margin: 0; }
.size:has(input:checked) {
  background: var(--accent-soft);
  border-color: var(--accent-line);
  color: var(--accent);
}

/* ---------------------------------------------------------- progress --- */

.prog { margin-bottom: 1rem; }
.prog-track { height: 3px; background: var(--surface-3); border-radius: 2px; overflow: hidden; }
.prog-fill {
  height: 100%; width: 0;
  background: var(--accent);
  transition: width .25s ease;
}
.prog-fill.indef { width: 35%; animation: sweep 1.1s ease-in-out infinite; }
@keyframes sweep { 0% { margin-left: -35%; } 100% { margin-left: 100%; } }
.prog-label {
  margin: .45rem 0 0;
  font-family: var(--mono); font-size: .72rem; color: var(--ink-2);
}

/* ------------------------------------------------------------ notices --- */

.note {
  display: flex; flex-direction: column; gap: .25rem;
  padding: .75rem .95rem;
  margin-bottom: 1rem;
  font-size: .86rem;
  border: 1px solid; border-left-width: 3px;
  border-radius: var(--r);
}
.note-bad  { background: var(--bad-soft);  border-color: var(--bad-line);  border-left-color: var(--bad);  color: var(--bad); }
.note-warn { background: var(--warn-soft); border-color: var(--warn-line); border-left-color: var(--warn); color: var(--warn); }
.note a { text-decoration: underline; }

/* ----------------------------------------------------------- results --- */

.results { margin-bottom: 1.5rem; }
.results-bar {
  display: flex; align-items: center; gap: 1rem; flex-wrap: wrap;
  margin-bottom: .7rem;
}
.results-bar h2 { margin: 0; }
.results-bar .btn { margin-left: auto; }

.out-list { list-style: none; margin: 0 0 1rem; padding: 0; }
.out-row {
  display: flex; align-items: center; gap: .8rem;
  padding: .65rem .85rem;
  background: var(--surface);
  border: 1px solid var(--ok-line);
  border-left: 3px solid var(--ok);
  border-radius: var(--r);
}
.out-row + .out-row { margin-top: .35rem; }
.out-tick { width: 15px; height: 15px; color: var(--ok); flex-shrink: 0; }
.out-meta { flex: 1; min-width: 0; }
.out-name { font-size: .875rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.out-sub { font-family: var(--mono); font-size: .7rem; color: var(--ink-3); }

/* -------------------------------------------------------------- index --- */

/* Home: a dense directory table, not marketing tiles. */
.stat-strip {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1px;
  background: var(--line);
  border: 1px solid var(--line);
  border-radius: var(--r);
  overflow: hidden;
  margin-bottom: 2rem;
}
.stat-cell { padding: .85rem 1rem; background: var(--surface); }
.stat-n {
  font-family: var(--mono); font-size: 1.3rem; font-weight: 600;
  letter-spacing: -.02em;
  font-variant-numeric: tabular-nums;
}
.stat-l {
  font-family: var(--mono); font-size: .66rem;
  text-transform: uppercase; letter-spacing: .11em;
  color: var(--ink-3);
}

.dir-section { margin-bottom: 2rem; }
.dir-head {
  display: flex; align-items: baseline; gap: .7rem;
  padding-bottom: .5rem; margin-bottom: .8rem;
  border-bottom: 1px solid var(--line);
}
.dir-head h2 { margin: 0; font-size: 1rem; }
.dir-head .eyebrow { margin-left: auto; }

.dir-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: .4rem;
}
.dir-item {
  display: flex; align-items: center; gap: .6rem;
  padding: .6rem .75rem;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r);
  transition: border-color .14s ease, transform .14s ease;
}
.dir-item:hover {
  border-color: var(--accent);
  transform: translateX(2px);
}
.dir-name { font-size: .865rem; font-weight: 500; }
.dir-pair {
  margin-left: auto;
  font-family: var(--mono); font-size: .66rem; color: var(--ink-3);
  white-space: nowrap;
}
.dir-item:hover .dir-pair { color: var(--accent); }

/* --------------------------------------------------------------- prose --- */

.prose { max-width: 66ch; margin-bottom: 2rem; }
.prose h2 { margin-top: 1.8rem; font-size: 1.02rem; }
.prose ol, .prose ul { padding-left: 1.15rem; margin: 0 0 1rem; }
.prose li { margin-bottom: .45rem; }
.prose code {
  font-family: var(--mono); font-size: .84em;
  padding: .08em .32em;
  background: var(--surface-2);
  border: 1px solid var(--line); border-radius: 3px;
}

/* Numbered steps with monospace markers. */
.howto { list-style: none; padding: 0; counter-reset: s; }
.howto li {
  position: relative;
  padding-left: 2rem; margin-bottom: .7rem;
  counter-increment: s;
}
.howto li::before {
  content: counter(s, decimal-leading-zero);
  position: absolute; left: 0; top: .05em;
  font-family: var(--mono); font-size: .72rem;
  color: var(--accent);
}

.foot {
  padding-top: 1.2rem; margin-top: 2rem;
  border-top: 1px solid var(--line);
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  font-family: var(--mono); font-size: .7rem; color: var(--ink-3);
}

/* ---------------------------------------------------------- responsive --- */

.scrim {
  display: none;
  position: fixed; inset: 0; z-index: 40;
  background: rgba(28,25,23,.4);
}

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }

  .rail {
    position: fixed; top: 0; left: 0; bottom: 0; z-index: 50;
    width: var(--rail);
    transform: translateX(-100%);
    transition: transform .22s ease;
    box-shadow: 0 0 40px rgba(28,25,23,.18);
  }
  .rail.open { transform: none; }
  .scrim.show { display: block; }

  .rail-toggle { display: grid; }
  .canvas { padding: 1.25rem 1rem 3rem; }
  .engine-chip { display: none; }
}

@media (max-width: 600px) {
  body { font-size: 14.5px; }
  .queue-row { flex-wrap: wrap; }
  .q-target { width: 100%; justify-content: space-between; padding-left: 2.6rem; }
  .runbar { flex-direction: column; align-items: stretch; }
  .runbar-right { margin-left: 0; justify-content: space-between; }
  .runbar .btn { flex: 1; }
  .flow { flex-wrap: wrap; }
  .flow-note { margin-left: 0; width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: .001ms !important;
    transition-duration: .001ms !important;
  }
}

@media print {
  .rail, .topbar, .drop, .runbar, .opts, .scrim { display: none !important; }
  .shell { grid-template-columns: 1fr; }
  body::before { display: none; }
}
