/* printism web app.
   The accent is the printism magenta (riso fluorescent pink, #ff4f9e). The chrome is the same hue
   at very low chroma, a dark plum grey, so everything sits in one family with the pink; the press
   bed around the sheet is the darkest and nearly neutral, so the colours on the sheet read true.
   Labels are set in a DIN-style face like the plates on a press. Everything is local: system fonts
   only. */

:root {
  --bed: #221c1f;
  --panel: #2c2427;
  --panel-2: #372d31;
  --raise: #43363c;
  --raise-hover: #504046;
  --line: #54444a;
  --line-soft: #3d3236;
  --text: #f5eef1;
  --muted: #c4b6bc;
  --faint: #a89aa0;
  --accent: #ff4f9e;
  --accent-hover: #ff67ac;           /* also accent text on raised surfaces, where it reads better */
  --accent-press: #e3348a;
  --accent-soft: rgba(255, 79, 158, 0.16);
  --on-accent: #32081c;
  --warn: #fdbe45;
  --warn-soft: rgba(253, 190, 69, 0.1);
  --error: #fa6b52;

  --font-label: "Bahnschrift", "DIN Alternate", "DIN Next LT Pro", "D-DIN", "DIN 2014", "Barlow",
                "Roboto Condensed", system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-text: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --font-read: "Iowan Old Style", "Charter", "Bitstream Charter", "Sitka Text", Cambria, Georgia, serif;
  --font-code: ui-monospace, "SF Mono", "Cascadia Mono", Menlo, Consolas, monospace;

  --top-h: 48px;
  --rail-w: 268px;
  --panel-w: 360px;
  --radius: 6px;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bed);
  color: var(--text);
  font: 14px/1.45 var(--font-text);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3, h4 { font-family: var(--font-label); font-weight: 600; letter-spacing: 0.01em; margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
a { color: var(--accent); }
::selection { background: var(--accent); color: var(--on-accent); }

/* ── top bar ─────────────────────────────────────────────────────────────── */
.top {
  height: var(--top-h);
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 0 14px 0 12px;
  background: var(--panel);
  border-bottom: 1px solid var(--line);
  position: relative;
  z-index: 5;
}
.brand { display: flex; align-items: center; color: var(--text); text-decoration: none; }
.logo { display: block; height: 22px; width: auto; }
.views { display: flex; gap: 2px; height: 100%; }
.views a {
  display: flex; align-items: center; padding: 0 12px;
  color: var(--muted); text-decoration: none; font-family: var(--font-label); font-size: 14.5px;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.views a:hover { color: var(--text); }
.views a[aria-current="page"] { color: var(--text); border-bottom-color: var(--accent); }
.top-actions { margin-left: auto; display: flex; align-items: center; gap: 10px; }

.btn {
  height: 32px; padding: 0 14px; border-radius: var(--radius);
  background: var(--raise); border: 1px solid var(--line); color: var(--text);
  font-family: var(--font-label); font-size: 14px;
}
.btn:hover:not(:disabled) { background: var(--raise-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.primary:active:not(:disabled) { background: var(--accent-press); border-color: var(--accent-press); }
.btn.small { height: 26px; padding: 0 10px; font-size: 13px; }
.btn.lead { border-color: var(--accent); }
.btn.lead:hover:not(:disabled) { background: var(--accent-soft); }
.btn:disabled { opacity: 0.45; cursor: default; }
.btn.danger { border-color: var(--error); color: var(--error); }
.icon-btn {
  width: 32px; height: 32px; display: inline-grid; place-items: center; border-radius: var(--radius);
  background: transparent; border: 1px solid transparent; color: var(--muted); padding: 0;
}
.icon-btn svg { width: 18px; height: 18px; }
.icon-btn:hover:not(:disabled) { background: var(--raise); color: var(--text); }
.icon-btn:disabled { opacity: 0.35; cursor: default; }
.icon-btn.small { width: 24px; height: 24px; }
.icon-btn.small svg { width: 14px; height: 14px; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font-size: 13px; }
.link-btn:hover { text-decoration: underline; }

.quality { display: flex; align-items: center; gap: 6px; color: var(--muted); font-size: 13px; }
.quality select, .panel select, .field select {
  height: 30px; background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 0 8px;
}
.switch { display: inline-flex; align-items: center; gap: 7px; color: var(--muted); font-size: 13px; cursor: pointer; }
.switch input {
  appearance: none; width: 30px; height: 18px; border-radius: 9px; background: var(--line); position: relative;
  margin: 0; cursor: pointer; flex: none; transition: background 0.12s;
}
.switch input::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%;
  background: var(--text); transition: transform 0.12s;
}
.switch input:checked { background: var(--accent); }
.switch input:checked::after { transform: translateX(12px); background: #fff; }

.menu-wrap { position: relative; }
.menu {
  position: absolute; right: 0; top: calc(100% + 6px); width: 300px; padding: 6px;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 8px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35); z-index: 20;
}
.menu button {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border: 0; background: none; border-radius: 5px;
}
.menu button:hover, .menu button:focus-visible { background: var(--raise); }
.menu b { display: block; font-family: var(--font-label); font-weight: 600; }
.menu span { display: block; color: var(--muted); font-size: 12.5px; }

/* ── views ───────────────────────────────────────────────────────────────── */
.view { height: calc(100vh - var(--top-h)); }
.studio {
  display: grid;
  grid-template-columns: var(--rail-w) minmax(0, 1fr) var(--panel-w);
  grid-template-rows: minmax(0, 1fr) 28px;
}

/* ── left rail ───────────────────────────────────────────────────────────── */
.rail {
  grid-row: 1; background: var(--panel); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.design-card { padding: 14px 14px 12px; border-bottom: 1px solid var(--line-soft); }
.design-head, .presets-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.design-head h2, .presets-head h2 { font-size: 15px; }
.design-head .btn, .presets-head .btn { flex: none; height: 28px; padding: 0 12px; font-size: 13.5px; white-space: nowrap; }
.presets-head { padding-right: 6px; }          /* in line with the list, which keeps room for its scrollbar */
.design-thumb {
  height: 120px; border-radius: var(--radius); background: var(--bed) center / contain no-repeat;
  display: grid; place-items: center; color: var(--faint); font-size: 12.5px; border: 1px dashed var(--line);
}
.design-thumb.has { border-style: solid; border-color: var(--line-soft); }
.design-thumb.has span { display: none; }
.design-meta { margin: 6px 0 0; color: var(--muted); font-size: 12.5px; min-height: 18px; overflow-wrap: anywhere; }

.presets { padding: 12px 8px 8px 14px; display: flex; flex-direction: column; min-height: 0; flex: 1; }
.presets input[type="search"] {
  width: calc(100% - 6px); height: 30px; padding: 0 9px; border-radius: var(--radius);
  background: var(--panel-2); border: 1px solid var(--line); margin-bottom: 8px;
}
.preset-list { overflow-y: auto; flex: 1; padding-right: 6px; }
.family { margin-bottom: 12px; }
.family h3 {
  font-size: 11px; color: var(--faint); font-weight: 600; text-transform: uppercase; letter-spacing: 0.08em;
  margin: 6px 0 6px; display: flex; gap: 8px; align-items: center;
}
.family h3::after { content: ""; flex: 1; border-top: 1px solid var(--line-soft); }
/* Each preset is a card with a radio dot, so the list reads as choices before you point at one. */
.preset {
  position: relative; display: block; width: 100%; text-align: left; color: var(--text);
  background: var(--panel-2); border: 1px solid var(--line-soft); border-radius: var(--radius);
  padding: 6px 10px 7px 31px; transition: background 0.12s, border-color 0.12s;
}
.preset + .preset { margin-top: 4px; }
.preset::before {
  content: ""; position: absolute; left: 11px; top: 10px; width: 12px; height: 12px; box-sizing: border-box;
  border-radius: 50%; border: 1.5px solid var(--line); transition: border-color 0.12s;
}
.preset:hover { background: var(--raise); border-color: var(--line); }
.preset:hover::before { border-color: var(--muted); }
.preset[aria-current="true"] { background: var(--accent-soft); border-color: var(--accent); }
.preset[aria-current="true"]::before {
  border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 2.5px, transparent 3px);
}
.preset b { font-family: var(--font-label); font-weight: 500; font-size: 14px; }
.preset small { display: block; color: var(--muted); font-size: 12px; line-height: 1.35; margin-top: 2px; }
.preset[aria-current="true"] small { color: var(--text); }
.preset .tag {
  display: inline-block; margin-left: 6px; padding: 0 6px; border-radius: 8px; vertical-align: 1px;
  font: 500 11px/16px var(--font-label); color: var(--accent-hover); background: var(--accent-soft);
}
.preset[aria-current="true"] .tag { color: var(--text); }

/* ── the press bed and the sheet ─────────────────────────────────────────── */
.bed {
  grid-row: 1; position: relative; overflow: hidden; min-width: 0;
  background:
    radial-gradient(circle at 50% 40%, rgba(255, 255, 255, 0.035), transparent 60%),
    var(--bed);
}
.stage-area { position: absolute; inset: 0; overflow: hidden; cursor: default; }
.stage-area.pannable { cursor: grab; }
.stage-area.panning { cursor: grabbing; }
.stage-area.picking, .stage-area.picking * { cursor: crosshair; }
.progress { position: absolute; top: 0; left: 0; right: 0; height: 3px; z-index: 4; background: rgba(0, 0, 0, 0.2); }
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width 0.25s linear; }

.empty {
  position: absolute; inset: 0; display: grid; place-content: center; text-align: center;
  color: var(--muted); padding: 24px;
}
.empty-title { font-family: var(--font-label); font-size: 24px; color: var(--text); margin: 0 0 6px; }

.sheet-wrap { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.sheet {
  position: relative;
  background: #f3ecdc;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05), 0 18px 50px rgba(0, 0, 0, 0.45), 0 3px 8px rgba(0, 0, 0, 0.3);
}
.marks { position: absolute; inset: 0; width: 100%; height: 100%; pointer-events: none; overflow: visible; }
.print { position: absolute; }
.print img { position: absolute; inset: 0; width: 100%; height: 100%; user-select: none; }
.print.pixelated img { image-rendering: pixelated; }
.split {
  position: absolute; top: 0; bottom: 0; width: 0; border-left: 1.5px solid var(--accent);
  cursor: ew-resize; z-index: 2;
}
.split span {
  position: absolute; top: 50%; left: -11px; width: 22px; height: 44px; margin-top: -22px;
  border-radius: 11px; background: var(--accent);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.35);
}
.split span::before, .split span::after {
  content: ""; position: absolute; top: 17px; border: 5px solid transparent;
}
.split span::before { left: 1px; border-right-color: var(--on-accent); }
.split span::after { right: 1px; border-left-color: var(--on-accent); }
.detail-spot {
  position: absolute; border: 1.5px solid var(--accent); box-shadow: 0 0 0 1px rgba(0, 0, 0, 0.35);
  pointer-events: none;
}
.colorbar { position: absolute; display: flex; gap: 0; }
.colorbar .patch { flex: none; }
.slug {
  position: absolute; color: #4e4a43; white-space: nowrap; overflow: hidden;
  font-family: var(--font-label); letter-spacing: 0.02em;
}
.slug b { font-weight: 600; color: #2f2c27; }

.viewer-tools {
  position: absolute; left: 12px; bottom: 12px; display: flex; align-items: center; gap: 4px;
  background: rgba(44, 36, 39, 0.9); border: 1px solid var(--line); border-radius: 8px; padding: 4px;
  backdrop-filter: blur(6px); z-index: 3;
}
.tool {
  height: 28px; padding: 0 10px; border-radius: 5px; border: 1px solid transparent; background: none;
  color: var(--muted); font-family: var(--font-label); font-size: 13px;
}
.tool:hover { color: var(--text); background: var(--raise); }
.tool[aria-pressed="true"] { color: var(--on-accent); background: var(--accent); }
.zoom-read { min-width: 48px; text-align: center; color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }

.loupe {
  position: absolute; right: 12px; bottom: 12px; margin: 0; z-index: 3;
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px; overflow: hidden;
  box-shadow: 0 14px 40px rgba(0, 0, 0, 0.45); max-width: calc(100% - 24px);
}
.loupe-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 5px 6px 5px 10px; }
.loupe-head figcaption { font-size: 12.5px; color: var(--muted); }
.loupe-body { position: relative; line-height: 0; background: var(--bed); }
.loupe-body img { display: block; image-rendering: auto; max-width: min(512px, 42vw); }
.loupe-busy { position: absolute; inset: 0; background: rgba(34, 28, 31, 0.45); }
.loupe-busy::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent);
  animation: busy 1.1s ease-in-out infinite;
}
@keyframes busy { 0% { transform: scaleX(0.05); transform-origin: left; } 50% { transform: scaleX(1); transform-origin: left; }
  51% { transform-origin: right; } 100% { transform: scaleX(0.05); transform-origin: right; } }

.contact {
  position: absolute; inset: 0; overflow-y: auto; padding: 20px 20px 70px;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); gap: 18px 16px; align-content: start;
}
.contact-head { grid-column: 1 / -1; display: flex; align-items: baseline; gap: 14px; }
.contact-head h2 { font-size: 18px; }
.contact-head p { color: var(--muted); margin: 0; font-size: 13px; }
.contact-head .btn { margin-left: auto; }
.contact-item {
  background: none; border: 0; padding: 0; text-align: left; color: var(--text);
}
.contact-item .thumb {
  aspect-ratio: 4 / 5; border-radius: 3px; background: var(--panel) center / contain no-repeat;
  box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35); position: relative; overflow: hidden;
}
.contact-item .thumb.waiting::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 2px; background: var(--accent);
  animation: busy 1.1s ease-in-out infinite;
}
.contact-item b { display: block; margin-top: 7px; font-family: var(--font-label); font-weight: 500; }
.contact-item small { color: var(--faint); font-size: 12px; }
.contact-item:hover .thumb { outline: 2px solid var(--accent); outline-offset: 3px; }
.contact-item[aria-current="true"] .thumb { outline: 2px solid var(--accent); outline-offset: 3px; }

/* ── settings panel ──────────────────────────────────────────────────────── */
.panel {
  grid-row: 1; background: var(--panel); border-left: 1px solid var(--line);
  display: flex; flex-direction: column; min-height: 0;
}
.tabs { display: flex; padding: 0 8px; border-bottom: 1px solid var(--line); flex: none; }
.tabs button {
  flex: 1; height: 40px; border: 0; background: none; color: var(--muted);
  font-family: var(--font-label); font-size: 14px; border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tabs button:hover { color: var(--text); }
.tabs button[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.panel-body { overflow-y: auto; padding: 4px 14px 40px; flex: 1; }

.group { padding: 12px 0 14px; border-bottom: 1px solid var(--line-soft); }
.group:last-child { border-bottom: 0; }
.group-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.group-head h3 { font-size: 14.5px; }
.group-head .spacer { flex: 1; }
.group-note { color: var(--muted); font-size: 12.5px; margin: -2px 0 10px; }

.field { display: grid; grid-template-columns: 1fr auto; align-items: center; gap: 4px 8px; padding: 4px 0; }
.field > .lab {
  display: flex; align-items: center; gap: 6px; min-width: 0; font-family: var(--font-label); font-size: 13.5px;
  color: var(--text);
}
.field > .lab .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.field.changed > .lab .name { color: var(--accent); }
.field .reset {
  border: 0; background: none; color: var(--faint); padding: 0 2px; font-size: 12px; visibility: hidden;
}
.field.changed .reset { visibility: visible; }
.field .reset:hover { color: var(--text); }
.field .help { grid-column: 1 / -1; color: var(--faint); font-size: 12px; line-height: 1.4; margin-top: -1px; }
.panel.quiet .field .help { display: none; }
.field .ctl { display: flex; align-items: center; gap: 6px; justify-content: flex-end; }
.field.wide { grid-template-columns: 1fr; }
.field.wide .ctl { justify-content: flex-start; flex-wrap: wrap; }
.field.slider { grid-template-columns: 1fr auto; }
.field.slider .range { grid-column: 1 / -1; }
.field .num {
  width: 66px; height: 26px; text-align: right; padding: 0 6px; border-radius: 5px;
  background: var(--panel-2); border: 1px solid var(--line); font-variant-numeric: tabular-nums; font-size: 13px;
}
.field .unit { color: var(--faint); font-size: 12px; }
.field input[type="text"], .field textarea {
  width: 100%; height: 28px; padding: 0 8px; border-radius: 5px; background: var(--panel-2); border: 1px solid var(--line);
}
.field input[type="color"] {
  width: 34px; height: 26px; padding: 0; border: 1px solid var(--line); border-radius: 5px; background: none;
}

input[type="range"] {
  appearance: none; width: 100%; height: 18px; background: transparent; margin: 0;
}
input[type="range"]::-webkit-slider-runnable-track { height: 3px; border-radius: 2px; background: var(--line); }
input[type="range"]::-moz-range-track { height: 3px; border-radius: 2px; background: var(--line); }
input[type="range"]::-webkit-slider-thumb {
  appearance: none; width: 14px; height: 14px; border-radius: 50%; background: var(--text); margin-top: -5.5px;
  border: 0; box-shadow: 0 1px 3px rgba(0, 0, 0, 0.4);
}
input[type="range"]::-moz-range-thumb { width: 14px; height: 14px; border-radius: 50%; background: var(--text); border: 0; }
.changed input[type="range"]::-webkit-slider-thumb { background: var(--accent); }
.changed input[type="range"]::-moz-range-thumb { background: var(--accent); }

.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.seg button {
  border: 0; background: var(--panel-2); padding: 4px 10px; font-size: 13px; color: var(--muted);
  border-right: 1px solid var(--line); font-family: var(--font-label);
}
.seg button:last-child { border-right: 0; }
.seg button[aria-pressed="true"] { background: var(--accent); color: var(--on-accent); }

.chip {
  display: inline-flex; align-items: center; gap: 6px; height: 26px; padding: 0 8px 0 4px; border-radius: 13px;
  background: var(--panel-2); border: 1px solid var(--line); font-size: 12.5px;
}
.chip .sw { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0, 0, 0, 0.3); flex: none; }
.chip .x { border: 0; background: none; color: var(--faint); padding: 0 0 0 2px; font-size: 14px; line-height: 1; }
.chip .x:hover { color: var(--text); }
.chip.add { padding: 0 10px; color: var(--accent-hover); cursor: pointer; }

.ink-btn {
  display: inline-flex; align-items: center; gap: 7px; height: 28px; padding: 0 9px 0 5px; border-radius: 6px;
  background: var(--panel-2); border: 1px solid var(--line); max-width: 210px;
}
.ink-btn .sw { width: 18px; height: 18px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.3); flex: none; }
.ink-btn span:last-child { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }

/* ink picker popover */
.picker {
  position: fixed; z-index: 40; width: 340px; max-height: min(480px, 70vh); display: flex; flex-direction: column;
  background: var(--panel-2); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: 0 18px 50px rgba(0, 0, 0, 0.5);
}
.picker-head { padding: 10px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.picker-head select, .picker-head input {
  height: 30px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); padding: 0 8px; width: 100%;
}
.picker-grid {
  overflow-y: auto; padding: 8px; display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 6px;
}
.picker-grid button {
  display: grid; grid-template-rows: 30px auto; gap: 4px; text-align: left; padding: 4px; border-radius: 6px;
  border: 1px solid transparent; background: none; font-size: 12px; line-height: 1.25;
}
.picker-grid button:hover { border-color: var(--line); background: var(--panel); }
.picker-grid button[aria-current="true"] { border-color: var(--accent); }
.picker-grid .sw { border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.25); }
.picker-grid small { color: var(--faint); }
.picker-foot { padding: 8px 10px; border-top: 1px solid var(--line); display: flex; gap: 8px; align-items: center; }
.picker-foot input { width: 100px; height: 28px; border-radius: 6px; background: var(--panel); border: 1px solid var(--line); padding: 0 8px; }

/* plates list (Inks tab) */
.plates { display: grid; gap: 4px; }
.plate {
  display: grid; grid-template-columns: 26px 1fr auto; gap: 8px; align-items: center; text-align: left;
  border: 1px solid transparent; background: var(--panel-2); border-radius: 6px; padding: 6px 8px;
}
.plate:hover { border-color: var(--line); }
.plate[aria-expanded="true"] { border-color: var(--accent); }
.plate .sw { width: 26px; height: 26px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.3); }
.plate b { font-family: var(--font-label); font-weight: 500; display: block; font-size: 13.5px; }
.plate small { color: var(--muted); font-size: 12px; }
.plate .cov { color: var(--faint); font-size: 12px; font-variant-numeric: tabular-nums; }
.plate-edit { padding: 6px 2px 10px 12px; margin: -2px 0 6px; border-left: 2px solid var(--accent); }
.formula { margin: 0; padding: 0; list-style: none; font-size: 12.5px; color: var(--muted); }
.formula li { padding: 2px 0; display: flex; gap: 8px; align-items: baseline; }
.formula .sw { width: 12px; height: 12px; border-radius: 2px; flex: none; position: relative; top: 2px; }
.formula .miss { color: var(--warn); }

/* stages tab */
.pipeline { display: grid; gap: 4px; margin-bottom: 8px; }
.stage-row {
  background: var(--panel-2); border: 1px solid transparent; border-radius: 6px;
}
.stage-row[open] { border-color: var(--line); }
.stage-row summary {
  list-style: none; display: grid; grid-template-columns: auto 1fr auto; gap: 8px; align-items: center;
  padding: 6px 6px 6px 8px; cursor: pointer;
}
.stage-row summary::-webkit-details-marker { display: none; }
.stage-row summary b { font-family: var(--font-label); font-weight: 500; font-size: 13.5px; }
.stage-row summary small { display: block; color: var(--faint); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.stage-title { min-width: 0; }
.stage-row .caret { width: 10px; color: var(--faint); transition: transform 0.15s; }
.stage-row[open] .caret { transform: rotate(90deg); }
.stage-row .moves { display: flex; gap: 0; align-items: center; }
.stage-row .moves button:not(.stage-switch) {
  width: 24px; height: 24px; border: 0; background: none; color: var(--faint); border-radius: 4px; padding: 0;
}
.stage-row .moves button:not(.stage-switch):hover:not(:disabled) { color: var(--text); background: var(--raise); }
.stage-row .moves button:disabled { opacity: 0.35; cursor: default; }
.stage-row .moves .stage-switch { margin-right: 8px; }
.stage-row:has(> summary .stage-switch[aria-checked="false"]) .stage-title { opacity: 0.5; }
.stage-body { padding: 0 10px 8px 26px; }
.stage-body .summary { color: var(--muted); font-size: 12.5px; margin: 0 0 6px; }
.stage-body .more, .stage-body .link-btn { color: var(--accent-hover); }
.stage-tag {
  display: inline-block; margin-left: 7px; padding: 0 6px; border-radius: 8px; vertical-align: 1px;
  font: 500 11px/16px var(--font-label); color: var(--warn); background: var(--warn-soft);
}

/* a stage's on/off switch (a button, so it can sit in a row's summary without opening the row) */
.stage-switch {
  position: relative; flex: none; width: 28px; height: 16px; padding: 0; border: 0; border-radius: 8px;
  background: var(--line); transition: background 0.12s;
}
.stage-switch::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 12px; height: 12px; border-radius: 50%;
  background: var(--muted); transition: transform 0.12s;
}
.stage-switch[aria-checked="true"] { background: var(--accent); }
.stage-switch[aria-checked="true"]::after { transform: translateX(12px); background: #fff; }
.stage-switch:hover::after { box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.12); }
.dial { display: grid; grid-template-columns: auto minmax(0, 1fr); column-gap: 10px; align-items: start; }
.dial > .stage-switch { margin-top: 9px; }
.dial > .inert-note { grid-column: 2; }

/* settings that change nothing on this print (inert.js): greyed out, with the reason and a fix */
.is-inert { opacity: 0.4; }
.inert-callout {
  margin: 0 0 10px; padding: 8px 10px 9px; border-left: 2px solid var(--warn); border-radius: 0 6px 6px 0;
  background: var(--warn-soft); color: var(--text); font-size: 12.5px; line-height: 1.45;
}
.inert-note {
  margin: 0 0 6px; padding: 5px 8px; border-left: 2px solid var(--warn); border-radius: 0 5px 5px 0;
  background: var(--warn-soft); color: var(--muted); font-size: 12px; line-height: 1.4;
}
.inert-callout.note, .inert-note.note { border-left-color: var(--faint); background: var(--panel-2); color: var(--muted); }
.inert-callout p, .inert-note p { margin: 0; }
.inert-callout.checking-fix p, .inert-note.checking-fix p { color: var(--muted); }
.inert-callout .fixes, .inert-note .fixes { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 7px; }
.inert-note .fixes { margin-top: 5px; }
.checking { color: var(--faint); font-size: 12px; }
.field.flash { animation: flash 1.6s ease-out; border-radius: 6px; }
@keyframes flash {
  0%, 35% { background: var(--accent-soft); box-shadow: 0 0 0 4px var(--accent-soft); }
  100% { background: transparent; box-shadow: 0 0 0 4px transparent; }
}
.add-stage { display: flex; gap: 6px; align-items: center; }
.add-stage select { flex: 1; }

/* recipe tab */
.code {
  width: 100%; min-height: 160px; resize: vertical; padding: 8px 10px; border-radius: 6px;
  background: var(--bed); border: 1px solid var(--line); color: var(--text);
  font: 12.5px/1.5 var(--font-code); white-space: pre; tab-size: 2;
}
pre.code { min-height: 0; max-height: 360px; overflow: auto; margin: 0; white-space: pre-wrap; word-break: break-word; }
.tabs .icon-btn[aria-pressed="true"] { color: var(--accent); }
.tabs .icon-btn[aria-pressed="true"]:hover { color: var(--text); }
.tabs .icon-btn { font-family: var(--font-label); font-size: 14px; flex: none; }
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row .btn { height: 30px; }
.warnings { margin: 0 0 8px; padding: 8px 10px; border-radius: 6px; background: var(--warn-soft); color: var(--warn); font-size: 12.5px; list-style: none; }
.warnings li + li { margin-top: 3px; }
.stocks { display: grid; grid-template-columns: repeat(auto-fill, minmax(72px, 1fr)); gap: 8px; }
.stock {
  border: 1px solid transparent; background: none; padding: 3px; border-radius: 6px; text-align: center; font-size: 11.5px;
  color: var(--muted); line-height: 1.25;
}
.stock .sw { height: 40px; border-radius: 4px; border: 1px solid rgba(0, 0, 0, 0.25); margin-bottom: 4px; }
.stock:hover { border-color: var(--line); }
.stock[aria-pressed="true"] { border-color: var(--accent); color: var(--text); }
.more { color: var(--accent); background: none; border: 0; padding: 4px 0; font-size: 12.5px; }

/* ── status bar ──────────────────────────────────────────────────────────── */
.status {
  grid-column: 1 / -1; grid-row: 2; display: flex; align-items: center; gap: 20px; justify-content: space-between;
  padding: 0 12px; background: var(--panel); border-top: 1px solid var(--line); font-size: 12px; color: var(--muted);
  white-space: nowrap; overflow: hidden;
}
.status .warn { color: var(--warn); }
.status .err { color: var(--error); }
.status #status-left { overflow: hidden; text-overflow: ellipsis; }
.status dl { display: flex; gap: 14px; margin: 0; }
.status dt { display: inline; color: var(--faint); margin-right: 4px; }
.status dd { display: inline; margin: 0; color: var(--text); font-variant-numeric: tabular-nums; }

/* ── toast and drop hint ─────────────────────────────────────────────────── */
.toast {
  position: fixed; left: 50%; bottom: 44px; transform: translateX(-50%); z-index: 50;
  background: var(--text); color: #2a2226; padding: 9px 14px; border-radius: 8px; font-size: 13.5px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4); display: flex; gap: 14px; align-items: center; max-width: 80vw;
}
.toast.error { background: var(--error); }
.toast button { border: 0; background: none; color: #ae1967; font-weight: 600; padding: 0; white-space: nowrap; }
.toast.error button { color: inherit; text-decoration: underline; }
.drop-hint {
  position: fixed; inset: 0; z-index: 60; display: grid; place-items: center; background: rgba(34, 28, 31, 0.84);
  border: 3px dashed var(--accent); pointer-events: none;
}
.drop-hint p { font-family: var(--font-label); font-size: 28px; }

/* ── start-up: the loading screen (index.html, main.js) ─────────────────── */
/* It covers the whole window, with the app showing through it dimmed and blurred; when the app is
   ready the ring closes and fades, and the screen lifts so the app comes into focus. */
.boot {
  position: fixed; inset: 0; z-index: 70; display: flex; overflow-y: auto; padding: 32px 24px;
  background: radial-gradient(ellipse 75% 65% at 50% 40%, rgba(30, 24, 27, 0.6), rgba(18, 14, 16, 0.88));
  -webkit-backdrop-filter: blur(16px) saturate(0.85);
  backdrop-filter: blur(16px) saturate(0.85);
  transition: opacity 0.5s ease;
}
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .boot { background: rgba(26, 21, 23, 0.95); }
}
.boot.done { opacity: 0; pointer-events: none; }
.boot-card {
  width: min(420px, 100%); margin: auto; text-align: center;
  animation: boot-in 0.6s cubic-bezier(0.2, 0.7, 0.2, 1); transition: transform 0.5s ease;
}
.boot.done .boot-card { transform: scale(1.03); }
@keyframes boot-in { from { opacity: 0; transform: translateY(10px) scale(0.98); } }
.boot-title { font-family: var(--font-label); font-size: 26px; color: var(--text); margin: 0 0 8px; }
.boot-where {
  display: none; color: var(--muted); font-size: 13.5px; line-height: 1.5; margin: 0 auto; max-width: 46ch;
  text-wrap: balance;
}
[data-backend="browser"] .boot-card > .boot-where { display: block; }
.boot-error {
  color: var(--error); font-family: var(--font-code); font-size: 12.5px; white-space: pre-wrap; overflow-wrap: anywhere;
  text-align: left; margin: 14px 0 0; padding: 10px 12px; border-radius: 8px; background: rgba(250, 107, 82, 0.1);
}
.boot-advice { color: var(--muted); font-size: 13.5px; margin: 12px 0 0; }

/* The mark, with a soft glow of its ink behind it and the ring round it. main.js draws the ring
   (stroke-dashoffset) as the start-up goes; it's drawn from twelve o'clock. */
.boot-emblem { position: relative; width: 172px; height: 172px; margin: 0 auto 26px; display: grid; place-items: center; }
.boot-emblem::before {
  content: ""; position: absolute; inset: -12%; border-radius: 50%;
  background: radial-gradient(closest-side, rgba(255, 79, 158, 0.16), rgba(255, 79, 158, 0));
}
.boot-ring {
  position: absolute; inset: 0; width: 100%; height: 100%; overflow: visible; transform: rotate(-90deg);
  filter: drop-shadow(0 0 6px rgba(255, 79, 158, 0.45));
  transition: opacity 0.45s ease, transform 0.6s cubic-bezier(0.2, 0.7, 0.2, 1);
}
.boot-ring circle { fill: none; stroke-width: 2.2; }
.boot-ring-track { stroke: rgba(255, 79, 158, 0.14); }
.boot-ring-bar { stroke: var(--accent); stroke-linecap: round; opacity: 0; transition: opacity 0.3s ease; }
.boot.running .boot-ring-bar { opacity: 1; }
.boot.complete .boot-ring { opacity: 0; transform: rotate(-90deg) scale(1.12); }
.boot.failed .boot-ring { filter: drop-shadow(0 0 6px rgba(250, 107, 82, 0.4)); }
.boot.failed .boot-ring-bar { stroke: var(--error); }

/* The mark prints its screen while the app starts: each row of dots swells and shrinks a moment after
   the row before it, so waves of tone run out from the solid half, like ink spreading into a screen.
   make_logo.py numbers the rows from the seam (--r). */
.boot-mark { position: relative; display: block; width: 132px; height: 132px; }
.boot-mark .pm-dot {
  transform-box: fill-box; transform-origin: center;
  animation: pm-print 2.2s ease-in-out infinite;
  animation-delay: calc(var(--r) * 0.2s - 4.4s);
}
.boot.done .pm-dot, .boot.failed .pm-dot { animation-play-state: paused; }
@keyframes pm-print { 0%, 100% { transform: scale(0.28); } 45% { transform: scale(1.08); } }
@media (prefers-reduced-motion: reduce) { .boot-mark .pm-dot { animation: none; } }

/* The steps, as a checklist on a pane of their own: a node for each, joined by a line that inks in
   behind the finished ones, and how long each took. The steps still to come wait, dimmed. */
.boot-steps {
  list-style: none; margin: 22px 0 0; padding: 6px 16px 6px 14px; text-align: left; font-family: var(--font-label);
  background: rgba(44, 36, 39, 0.6); border: 1px solid rgba(255, 255, 255, 0.06); border-radius: 12px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.25);
}
.boot-steps:empty { display: none; }
.boot-steps li {
  position: relative; display: flex; align-items: center; gap: 12px; min-height: 31px; padding: 4px 0 4px 28px;
  color: var(--text); transition: opacity 0.3s ease, color 0.3s ease;
}
.boot-steps li.waiting { color: var(--faint); opacity: 0.55; }
.boot-steps li::before {
  content: ""; position: absolute; left: 0; top: 50%; width: 14px; height: 14px; margin-top: -7px; box-sizing: border-box;
  border-radius: 50%; border: 1.5px solid var(--line);
}
.boot-steps li:not(:last-child)::after {
  content: ""; position: absolute; left: 6px; top: calc(50% + 10px); height: calc(100% - 20px); width: 2px;
  border-radius: 1px; background: var(--line-soft);
}
.boot-steps li.done::after { background: rgba(255, 79, 158, 0.45); }
.boot-steps li.active::before {
  border: 2px solid var(--accent); border-right-color: transparent; animation: boot-spin 0.9s linear infinite;
}
.boot-steps li.done { color: var(--muted); }
.boot-steps li.done::before {
  border: 0; background: var(--accent) center / 10px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 12 12'%3E%3Cpath d='M2.6 6.3 5 8.6l4.4-5' fill='none' stroke='%2332081c' stroke-width='1.9' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
}
.boot-steps li.failed { color: var(--error); }
.boot-steps li.failed::before {
  border: 0; background: var(--error) center / 8px no-repeat
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 10 10'%3E%3Cpath d='m2 2 6 6M8 2 2 8' stroke='%23300b05' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
}
.boot-step { flex: 1; min-width: 0; }
.boot-time { color: var(--faint); font-size: 12.5px; font-variant-numeric: tabular-nums; }
.boot.complete .boot-steps li.waiting { opacity: 0; }
@keyframes boot-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .boot-steps li.active::before { animation: none; } }

/* ── swatch guides view ──────────────────────────────────────────────────── */
.swatches { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
.side-form { background: var(--panel); border-right: 1px solid var(--line); padding: 16px; overflow-y: auto; }
.side-form h2 { font-size: 18px; margin-bottom: 4px; }
.side-form > p { color: var(--muted); font-size: 13px; margin: 0 0 12px; }
.result-pane { overflow: auto; padding: 24px; position: relative; }
.result-pane img { display: block; max-width: 100%; margin: 0 auto; box-shadow: 0 18px 50px rgba(0, 0, 0, 0.45); }
.result-pane img.actual { max-width: none; }
.result-bar { display: flex; gap: 10px; align-items: center; margin: 0 auto 14px; max-width: 100%; flex-wrap: wrap; }
.result-bar .muted { color: var(--muted); font-size: 13px; }

/* ── ink library view ────────────────────────────────────────────────────── */
.library { display: grid; grid-template-columns: 220px minmax(0, 1fr); }
.lib-list { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 8px; overflow-y: auto; }
.lib-list button {
  display: flex; justify-content: space-between; width: 100%; text-align: left; border: 0; background: none;
  padding: 7px 10px; border-radius: 5px; font-family: var(--font-label); font-size: 14px; color: var(--muted);
}
.lib-list button:hover { background: var(--panel-2); color: var(--text); }
.lib-list button[aria-current="true"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.lib-list small { color: var(--faint); font-variant-numeric: tabular-nums; }
.lib-main { overflow-y: auto; padding: 20px 24px 40px; }
.lib-main h2 { font-size: 22px; }
.lib-main > p { color: var(--muted); max-width: 70ch; margin: 4px 0 14px; }
.lib-tools { display: flex; gap: 10px; align-items: center; margin-bottom: 14px; }
.lib-tools input { height: 32px; width: 260px; padding: 0 10px; border-radius: 6px; background: var(--panel-2); border: 1px solid var(--line); }
.ink-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; }
.ink-card { border: 0; background: none; padding: 0; text-align: left; color: var(--text); }
.ink-card .sw { height: 74px; border-radius: 4px; position: relative; overflow: hidden; }
.ink-card .sw i { position: absolute; top: 0; bottom: 0; }
.ink-card b { display: block; margin-top: 6px; font-family: var(--font-label); font-weight: 500; }
.ink-card small { display: block; color: var(--faint); font-size: 12px; }
.ink-card:hover .sw { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ── docs view ───────────────────────────────────────────────────────────── */
.docs { display: grid; grid-template-columns: 240px minmax(0, 1fr); }
.doc-nav { background: var(--panel); border-right: 1px solid var(--line); padding: 14px 8px; overflow-y: auto; }
.doc-nav a {
  display: block; padding: 6px 10px; border-radius: 5px; color: var(--muted); text-decoration: none;
  font-family: var(--font-label); font-size: 14px;
}
.doc-nav a:hover { background: var(--panel-2); color: var(--text); }
.doc-nav a[aria-current="page"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 2px 0 0 var(--accent); }
.doc-scroll { overflow-y: auto; background: #f3edef; color: #2a2226; }
.doc {
  max-width: 76ch; margin: 0 auto; padding: 40px 32px 80px;
  font: 17px/1.62 var(--font-read);
}
.doc h1 { font-size: 34px; line-height: 1.15; margin: 0 0 18px; color: #1f181b; }
.doc h2 { font-size: 23px; margin: 34px 0 10px; color: #1f181b; }
.doc h3 { font-size: 18.5px; margin: 26px 0 8px; color: #1f181b; }
.doc h4 { font-size: 16px; margin: 20px 0 6px; }
.doc p, .doc ul, .doc ol { margin: 0 0 14px; }
.doc li { margin: 3px 0; }
.doc a { color: #ae1967; }
.doc code { font: 0.84em var(--font-code); background: rgba(0, 0, 0, 0.06); padding: 1px 4px; border-radius: 3px; }
.doc pre {
  background: #2a2125; color: #f5eef1; padding: 14px 16px; border-radius: 6px; overflow-x: auto;
  font: 13px/1.55 var(--font-code); margin: 0 0 16px;
}
.doc pre code { background: none; padding: 0; font-size: inherit; color: inherit; }
.doc table { border-collapse: collapse; width: 100%; margin: 0 0 18px; font: 14px/1.45 var(--font-text); }
.doc th, .doc td { text-align: left; vertical-align: top; padding: 6px 10px 6px 0; border-bottom: 1px solid rgba(0, 0, 0, 0.12); }
.doc th { font-family: var(--font-label); font-weight: 600; border-bottom-color: rgba(0, 0, 0, 0.3); }
.doc td code { white-space: nowrap; }
.doc blockquote { margin: 0 0 14px; padding: 2px 0 2px 16px; border-left: 3px solid #ff4f9e; color: #54474d; }
.doc hr { border: 0; border-top: 1px solid rgba(0, 0, 0, 0.15); margin: 28px 0; }
.doc img { max-width: 100%; }

/* ── smaller screens ─────────────────────────────────────────────────────── */
@media (max-width: 1180px) {
  :root { --rail-w: 220px; --panel-w: 320px; }
  .views a { padding: 0 8px; }
  .quality span { display: none; }
}
@media (max-width: 900px) {
  body { overflow: auto; }
  .view { height: auto; min-height: calc(100vh - var(--top-h)); }
  .top { flex-wrap: wrap; height: auto; padding: 6px 10px; gap: 8px 14px; }
  :root { --top-h: 96px; }
  .top-actions { margin-left: 0; flex-wrap: wrap; gap: 8px; }
  .studio { grid-template-columns: 1fr; grid-template-rows: auto 70vh auto auto; }
  .status { white-space: normal; flex-wrap: wrap; gap: 4px 16px; padding: 6px 12px; }
  .status dl { flex-wrap: wrap; gap: 2px 12px; }
  .rail { grid-row: 1; border-right: 0; border-bottom: 1px solid var(--line); }
  .design-thumb { height: 96px; }
  .preset-list { max-height: 240px; }
  .bed { grid-row: 2; }
  .panel { grid-row: 3; border-left: 0; }
  .status { grid-row: 4; }
  .swatches, .library, .docs { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── batch view ──────────────────────────────────────────────────────────── */
.batch { display: grid; grid-template-columns: 340px minmax(0, 1fr); }
a.btn { display: inline-flex; align-items: center; text-decoration: none; }
.batch-pane { padding: 20px 24px 40px; }
.batch-drop {
  min-height: calc(100% - 8px); display: grid; place-content: center; text-align: center; color: var(--muted);
  border: 2px dashed var(--line); border-radius: 10px; padding: 32px;
}
.batch-head { display: flex; align-items: baseline; gap: 16px; flex-wrap: wrap; margin-bottom: 10px; }
.batch-head h2 { font-size: 18px; font-variant-numeric: tabular-nums; }
.batch-progress { height: 3px; background: var(--line); border-radius: 2px; margin: 0 0 18px; overflow: hidden; }
.batch-progress span { display: block; height: 100%; width: 0; background: var(--accent); transition: width 0.3s; }
.batch-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 20px 16px; }
.batch-item { margin: 0; min-width: 0; }
.batch-item .thumb {
  aspect-ratio: 4 / 5; border-radius: 3px; background: var(--panel); display: grid; place-items: center;
  overflow: hidden; position: relative; box-shadow: 0 6px 18px rgba(0, 0, 0, 0.35);
}
.batch-item .thumb img { max-width: 100%; max-height: 100%; display: block; }
.batch-item .thumb:not(.done) img { opacity: 0.5; filter: grayscale(0.6); }
.batch-item .thumb.ready img { opacity: 0.85; filter: none; }
.batch-item .thumb.printing::after, .batch-item .thumb.uploading::after {
  content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 3px; background: var(--accent);
  animation: busy 1.1s ease-in-out infinite;
}
.batch-item .thumb.failed { outline: 2px solid var(--error); outline-offset: 2px; }
.batch-item figcaption { margin-top: 8px; display: grid; gap: 1px; }
.batch-item b { font-family: var(--font-label); font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.batch-item small { color: var(--faint); font-size: 12px; overflow-wrap: anywhere; }
.batch-item small.err { color: var(--error); }
.batch-actions { font-size: 12.5px; margin-top: 2px; }
.batch-actions a { overflow-wrap: anywhere; }
.nav-count {
  margin-left: 6px; padding: 0 6px; border-radius: 9px; background: var(--accent); color: var(--on-accent);
  font-size: 11.5px; font-variant-numeric: tabular-nums; line-height: 18px;
}
@media (max-width: 900px) {
  .batch { grid-template-columns: 1fr; }
}
@media (max-width: 900px) {
  body:not([data-view="studio"]) .top-actions { display: none; }
}
