/* Layout: one-screen editor. Top bar, icon rail + slide-out library panel, centered artboard on a cutting-mat stage, contextual inspector on the right. On phones the rail becomes a bottom bar and the panels become sheets. */
:root {
  --chrome: #E9ECF0;
  --panel: #FFFFFF;
  --ink: #18202C;
  --muted: #5B6676;
  --line: #D6DCE4;
  --stage: #D3D9E1;
  --stage-grid: rgba(24, 32, 44, 0.06);
  --hover: #F1F3F6;
  --accent: #E8A317;
  --accent-ink: #1F1600;
  --accent-soft: rgba(232, 163, 23, 0.16);
  --danger: #C8102E;
  --ok: #1E8E5A;
  --ok-soft: rgba(30, 142, 90, 0.14);
  --warn: #D98A00;
  --info: #2F6FD6;
  --info-soft: rgba(47, 111, 214, 0.14);
  --shadow: 0 1px 2px rgba(16, 24, 40, .08), 0 8px 28px rgba(16, 24, 40, .12);
  --f-ui: "IBM Plex Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --f-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, monospace;
  --f-mark: "Big Shoulders Display", "Oswald", "Arial Narrow", sans-serif;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --chrome: #11151B; --panel: #191F27; --ink: #E6EAF0; --muted: #95A0B0; --line: #2A323D;
    --stage: #0B0E12; --stage-grid: rgba(230, 234, 240, 0.05); --hover: #222A34;
    --accent: #F2B12A; --accent-ink: #1F1600; --accent-soft: rgba(242, 177, 42, 0.18); --danger: #FF5A6E; --ok: #3CC487; --ok-soft: rgba(60, 196, 135, 0.16); --warn: #F2B12A; --info: #6EA2FF; --info-soft: rgba(110, 162, 255, 0.16);
    --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --chrome: #11151B; --panel: #191F27; --ink: #E6EAF0; --muted: #95A0B0; --line: #2A323D;
  --stage: #0B0E12; --stage-grid: rgba(230, 234, 240, 0.05); --hover: #222A34;
  --accent: #F2B12A; --accent-ink: #1F1600; --accent-soft: rgba(242, 177, 42, 0.18); --danger: #FF5A6E; --ok: #3CC487; --ok-soft: rgba(60, 196, 135, 0.16); --warn: #F2B12A; --info: #6EA2FF; --info-soft: rgba(110, 162, 255, 0.16);
  --shadow: 0 1px 2px rgba(0,0,0,.4), 0 10px 30px rgba(0,0,0,.45);
  color-scheme: dark;
}
[hidden] { display: none !important; }
*, *::before, *::after { box-sizing: border-box; }
html, body { height: 100%; }
body { margin: 0; }
body {
  background: var(--chrome); color: var(--ink); font-family: var(--f-ui); font-size: 13px;
  display: flex; flex-direction: column; overflow: hidden;
}
button, input, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

/* Top bar */
.topbar {
  display: flex; align-items: center; gap: 10px; flex-wrap: nowrap;
  padding-block: 8px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--panel); border-bottom: 1px solid var(--line); min-height: 52px;
}
.mark { font-family: var(--f-mark); font-weight: 800; font-size: 22px; letter-spacing: .02em; text-transform: uppercase; line-height: 1; white-space: nowrap; display: flex; align-items: center; gap: 8px; }
.mark i { display: inline-block; width: 18px; height: 18px; background: var(--accent); transform: rotate(45deg); border: 2px solid var(--ink); border-radius: 2px; }
.docname { border: 1px solid transparent; background: transparent; padding: 6px 8px; border-radius: 6px; min-width: 0; width: 220px; font-weight: 500; }
.docname:hover { border-color: var(--line); }
.docname:focus { border-color: var(--accent); outline: none; background: var(--chrome); }
.chip { font-family: var(--f-mono); font-size: 12px; color: var(--muted); background: var(--chrome); border: 1px solid var(--line); padding: 4px 8px; border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.spacer { flex: 1; }
.tbtn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; height: 34px; min-width: 34px; padding: 0 10px; border: 1px solid var(--line); background: var(--panel); border-radius: 8px; white-space: nowrap; }
.tbtn:hover:not(:disabled) { background: var(--hover); }
.tbtn:disabled { opacity: .4; cursor: default; }
.tbtn svg { width: 16px; height: 16px; flex: none; }
.tbtn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); font-weight: 600; }
.tbtn.primary:hover { filter: brightness(1.05); background: var(--accent); }
.tbtn.icon { padding: 0; }
.tgroup { display: flex; gap: 4px; }

/* Main grid */
.app { flex: 1; min-height: 0; display: grid; grid-template-columns: 72px 300px 1fr 280px; }
.app.panel-closed { grid-template-columns: 72px 1fr 280px; }
.rail { background: var(--panel); border-right: 1px solid var(--line); display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; padding-left: max(6px, env(safe-area-inset-left, 0px)); overflow-y: auto; }
.rail button { display: flex; flex-direction: column; align-items: center; gap: 4px; border: 0; background: transparent; padding: 9px 2px; border-radius: 8px; color: var(--muted); font-size: 11px; font-weight: 500; }
.rail button svg { width: 22px; height: 22px; }
.rail button:hover { background: var(--hover); color: var(--ink); }
.rail button[aria-selected="true"] { background: var(--accent-soft); color: var(--ink); }
.panel { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; min-width: 0; }
.app.panel-closed .panel { display: none; }
.panel-inner { padding: 16px; display: flex; flex-direction: column; gap: 16px; }
.panel h2 { margin: 0; font-size: 15px; font-weight: 600; display: flex; align-items: center; justify-content: space-between; }
.panel h3, .props h3 { margin: 0; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.close-panel { border: 0; background: transparent; color: var(--muted); width: 28px; height: 28px; border-radius: 6px; }
.close-panel:hover { background: var(--hover); color: var(--ink); }
.search { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: var(--chrome); }
.sec { display: flex; flex-direction: column; gap: 8px; }

/* Template cards */
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin: 10px 0 6px; }
.chip { border: 1px solid var(--line); background: var(--chrome); color: var(--ink); border-radius: 999px; padding: 4px 10px; font-size: 12px; font-weight: 500; cursor: pointer; }
.chip:hover { border-color: var(--accent); }
.chip[aria-pressed="true"] { background: var(--accent-soft); border-color: var(--accent); font-weight: 600; }
.tcount { margin: 4px 0 8px; font-size: 12px; color: var(--muted); }
.tgrid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.tcard { border: 1px solid var(--line); background: var(--chrome); border-radius: 8px; padding: 6px; display: flex; flex-direction: column; gap: 6px; text-align: left; }
.tcard:hover { border-color: var(--accent); }
.tthumb { aspect-ratio: 4 / 3; max-width: 100%; display: flex; align-items: center; justify-content: center; border-radius: 4px; background-color: #fff; background-image: linear-gradient(45deg, #e4e7eb 25%, transparent 25%), linear-gradient(-45deg, #e4e7eb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e4e7eb 75%), linear-gradient(-45deg, transparent 75%, #e4e7eb 75%); background-size: 10px 10px; background-position: 0 0, 0 5px, 5px -5px, -5px 0; overflow: hidden; }
.tthumb img { max-width: 100%; max-height: 100%; display: block; box-shadow: 0 1px 3px rgba(0,0,0,.25); }
.tcard b { font-size: 12px; font-weight: 600; line-height: 1.25; }
.tcard span { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }

/* Size list */
.slist { display: flex; flex-direction: column; gap: 2px; }
.srow { display: flex; align-items: center; justify-content: space-between; gap: 8px; border: 0; background: transparent; padding: 8px 10px; border-radius: 6px; text-align: left; }
.srow:hover { background: var(--hover); }
.srow em { font-style: normal; font-family: var(--f-mono); font-size: 11px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.custom-size { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) 70px; gap: 6px; }

/* Elements */
.egrid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.ebtn { aspect-ratio: 1; max-width: 100%; border: 1px solid var(--line); background: var(--chrome); border-radius: 8px; display: flex; align-items: center; justify-content: center; padding: 10px; }
.ebtn:hover { border-color: var(--accent); }
.ebtn svg { width: 100%; height: 100%; }
.textpreset { border: 1px solid var(--line); background: var(--chrome); border-radius: 8px; padding: 12px; text-align: left; }
.textpreset:hover { border-color: var(--accent); }

/* Uploads */
.drop { border: 1.5px dashed var(--line); border-radius: 10px; padding: 22px 14px; text-align: center; color: var(--muted); display: flex; flex-direction: column; gap: 10px; align-items: center; }
.drop.over { border-color: var(--accent); background: var(--accent-soft); }
.ugrid { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 6px; }
.ugrid button { aspect-ratio: 1; max-width: 100%; border: 1px solid var(--line); border-radius: 6px; padding: 0; overflow: hidden; background: var(--chrome); }
.ugrid img { width: 100%; height: 100%; object-fit: cover; display: block; }

/* Layers */
.layers { display: flex; flex-direction: column; gap: 2px; }
.layer { display: grid; grid-template-columns: 22px 1fr auto; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 6px; border: 1px solid transparent; cursor: pointer; }
.layer:hover { background: var(--hover); }
.layer.sel { background: var(--accent-soft); border-color: var(--accent); }
.layer .lt { font-family: var(--f-mono); font-size: 10px; color: var(--muted); text-align: center; }
.layer .ln { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.layer .la { display: flex; gap: 2px; }
.layer .la button { border: 0; background: transparent; width: 24px; height: 24px; border-radius: 4px; color: var(--muted); display: flex; align-items: center; justify-content: center; padding: 0; }
.layer .la button:hover { background: var(--panel); color: var(--ink); }
.layer .la svg { width: 14px; height: 14px; }
.layer.hiddenobj .ln { opacity: .45; }
.empty { color: var(--muted); padding: 8px 2px; line-height: 1.5; }

/* Stage */
.stage { position: relative; min-width: 0; min-height: 0; background-color: var(--stage); background-image: linear-gradient(var(--stage-grid) 1px, transparent 1px), linear-gradient(90deg, var(--stage-grid) 1px, transparent 1px); background-size: 24px 24px; display: flex; flex-direction: column; }
.stage-scroll { flex: 1; overflow: auto; display: flex; min-height: 0; }
.artwrap { margin: auto; padding: 48px; }
.artboard { box-shadow: var(--shadow); background-color: #fff; background-image: linear-gradient(45deg, #e4e7eb 25%, transparent 25%), linear-gradient(-45deg, #e4e7eb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e4e7eb 75%), linear-gradient(-45deg, transparent 75%, #e4e7eb 75%); background-size: 16px 16px; background-position: 0 0, 0 8px, 8px -8px, -8px 0; line-height: 0; }
.zoombar { position: absolute; right: 14px; bottom: 14px; display: flex; align-items: center; gap: 4px; background: var(--panel); border: 1px solid var(--line); border-radius: 10px; padding: 4px; box-shadow: var(--shadow); }
.zoombar button { border: 0; background: transparent; height: 28px; min-width: 28px; border-radius: 6px; padding: 0 6px; }
.zoombar button:hover { background: var(--hover); }
.zoombar output { font-family: var(--f-mono); font-size: 12px; min-width: 48px; text-align: center; font-variant-numeric: tabular-nums; }
.hint { position: absolute; left: 14px; bottom: 14px; font-size: 12px; color: var(--muted); background: var(--panel); border: 1px solid var(--line); border-radius: 8px; padding: 6px 10px; max-width: calc(100% - 220px); }
.hint kbd { font-family: var(--f-mono); font-size: 11px; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 4px; padding: 0 4px; background: var(--chrome); }

/* Inspector */
.props { background: var(--panel); border-left: 1px solid var(--line); overflow-y: auto; min-width: 0; padding-right: env(safe-area-inset-right, 0px); }
.props-inner { padding: 16px; display: flex; flex-direction: column; gap: 18px; }
.props-title { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.props-title strong { font-size: 15px; font-weight: 600; }
.props-title .badge { font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.grid3 { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.field { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.field label, .lbl { font-size: 11px; color: var(--muted); }
.field input[type="number"], .field input[type="text"], .field select, .props select, .panel select { width: 100%; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--chrome); min-width: 0; }
.field input[type="number"] { font-family: var(--f-mono); font-size: 12px; font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.row.between { justify-content: space-between; }
.seg { display: flex; border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.seg button { flex: 1; border: 0; border-right: 1px solid var(--line); background: var(--panel); height: 32px; display: flex; align-items: center; justify-content: center; padding: 0 6px; }
.seg button:last-child { border-right: 0; }
.seg button:hover { background: var(--hover); }
.seg button[aria-pressed="true"] { background: var(--accent-soft); }
.seg svg { width: 16px; height: 16px; }
.colorrow { display: flex; align-items: center; gap: 8px; }
.colorrow input[type="color"] { width: 34px; height: 30px; padding: 0; border: 1px solid var(--line); border-radius: 6px; background: transparent; flex: none; }
.colorrow input[type="text"] { font-family: var(--f-mono); font-size: 12px; width: 92px; min-width: 0; flex: 0 1 92px; padding: 6px 8px; border: 1px solid var(--line); border-radius: 6px; background: var(--chrome); text-transform: uppercase; }
.swatches { display: grid; grid-template-columns: repeat(9, 1fr); gap: 4px; }
.swatches button { aspect-ratio: 1; max-width: 100%; border-radius: 4px; border: 1px solid rgba(0,0,0,.15); padding: 0; }
.swatches button:hover { transform: scale(1.12); }
.swatches button.none { background: linear-gradient(135deg, #fff 45%, #C8102E 45%, #C8102E 55%, #fff 55%); }
input[type="range"] { width: 100%; accent-color: var(--accent); }
.check { display: flex; align-items: center; gap: 8px; cursor: pointer; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; }
.note { font-size: 12px; color: var(--muted); line-height: 1.5; background: var(--chrome); border-radius: 8px; padding: 10px; }
.note strong { color: var(--ink); font-weight: 600; }
.legib { font-family: var(--f-mono); font-size: 11.5px; line-height: 1.6; }
.btnrow { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.btnrow .tbtn { padding: 0; }
.danger { color: var(--danger); }
hr.div { border: 0; border-top: 1px solid var(--line); margin: 0; }

/* Modal */
.modal-back { position: fixed; inset: 0; background: rgba(8, 12, 18, .5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: 16px; }
.modal { background: var(--panel); border: 1px solid var(--line); border-radius: 14px; width: min(520px, 100%); max-height: calc(100% - 32px); overflow: auto; box-shadow: var(--shadow); }
.modal header { display: flex; justify-content: space-between; align-items: center; padding: 16px 18px; border-bottom: 1px solid var(--line); }
.modal header h2 { margin: 0; font-size: 16px; font-weight: 600; }
.modal .body { padding: 18px; display: flex; flex-direction: column; gap: 16px; }
.modal footer { padding: 14px 18px; border-top: 1px solid var(--line); display: flex; justify-content: flex-end; gap: 8px; flex-wrap: wrap; }
.fmt { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.fmt label { border: 1px solid var(--line); border-radius: 8px; padding: 10px 8px; display: flex; flex-direction: column; gap: 2px; cursor: pointer; }
.fmt label:has(input:checked) { border-color: var(--accent); background: var(--accent-soft); }
.fmt input { position: absolute; opacity: 0; pointer-events: none; }
.fmt b { font-size: 13px; }
.fmt span { font-size: 11px; color: var(--muted); }
.outinfo { font-family: var(--f-mono); font-size: 12px; background: var(--chrome); border-radius: 8px; padding: 10px 12px; line-height: 1.7; font-variant-numeric: tabular-nums; }
.outinfo .warn { color: var(--danger); }
.preview-img { max-width: 100%; border: 1px solid var(--line); border-radius: 6px; }

.toast { position: fixed; left: 50%; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); transform: translateX(-50%); background: var(--ink); color: var(--panel); padding: 10px 16px; border-radius: 999px; font-weight: 500; z-index: 60; box-shadow: var(--shadow); max-width: calc(100% - 32px); text-align: center; }

.mob-only { display: none; }


/* Gang sheet, send-to-shop and orders */
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chips button { border: 1px solid var(--line); background: var(--chrome); border-radius: 999px; padding: 5px 10px; font-size: 12px; display: flex; gap: 6px; align-items: baseline; }
.chips button:hover { border-color: var(--accent); }
.chips button em { font-style: normal; font-family: var(--f-mono); font-size: 11px; color: var(--muted); }
.statline { font-family: var(--f-mono); font-size: 12px; line-height: 1.7; background: var(--chrome); border-radius: 8px; padding: 10px 12px; font-variant-numeric: tabular-nums; }
.statline strong { color: var(--ink); }
.meter { height: 6px; border-radius: 999px; background: var(--line); overflow: hidden; margin-top: 6px; }
.meter i { display: block; height: 100%; background: var(--accent); }
.modal.wide { width: min(820px, 100%); }
.steps { display: flex; gap: 6px; padding: 12px 18px 0; flex-wrap: wrap; }
.steps span { font-size: 12px; color: var(--muted); padding: 4px 10px; border-radius: 999px; border: 1px solid var(--line); }
.steps span[aria-current="step"] { color: var(--accent-ink); background: var(--accent); border-color: var(--accent); font-weight: 600; }
.sendgrid { display: grid; grid-template-columns: minmax(0, 5fr) minmax(0, 6fr); gap: 18px; align-items: start; }
.proofbox { border: 1px solid var(--line); border-radius: 8px; padding: 10px; display: flex; flex-direction: column; gap: 8px; }
.proofbox .tthumb { aspect-ratio: auto; min-height: 160px; padding: 8px; }
.proofbox .tthumb img { max-height: 340px; }
.checks { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.checks li { display: grid; grid-template-columns: 10px 1fr; gap: 10px; padding: 10px 12px; border-radius: 8px; background: var(--chrome); }
.checks .dot { width: 10px; height: 10px; border-radius: 50%; margin-top: 4px; background: var(--muted); }
.checks .ok .dot { background: var(--ok); }
.checks .warn .dot { background: var(--warn); }
.checks .fail .dot { background: var(--danger); }
.checks b { font-weight: 600; }
.checks p { margin: 2px 0 0; color: var(--muted); font-size: 12px; line-height: 1.45; }
.checks button { margin-top: 6px; height: 28px; font-size: 12px; }
.form { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 12px; }
.form .full { grid-column: 1 / -1; }
.form input, .form select, .form textarea { width: 100%; padding: 8px 10px; border: 1px solid var(--line); border-radius: 6px; background: var(--chrome); min-width: 0; font: inherit; color: inherit; }
.form textarea { min-height: 72px; resize: vertical; }
.form .check input { width: 16px; height: 16px; flex: none; padding: 0; }
.form input:invalid:not(:placeholder-shown) { border-color: var(--danger); }
.est { font-family: var(--f-mono); font-size: 12px; }
.result { display: flex; flex-direction: column; gap: 12px; }
.result h3 { margin: 0; font-size: 18px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--ink); }
.progress { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; font-size: 13px; }
.progress li::before { content: "○ "; color: var(--muted); }
.progress li.done::before { content: "✓ "; color: var(--ok); }
.progress li.err::before { content: "✕ "; color: var(--danger); }
.copybox { font-family: var(--f-mono); font-size: 12px; white-space: pre-wrap; background: var(--chrome); border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; max-height: 200px; overflow: auto; user-select: all; }
.olist { display: flex; flex-direction: column; gap: 10px; }
.ocard { border: 1px solid var(--line); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: 64px minmax(0, 1fr); gap: 10px; background: var(--panel); }
.othumb { width: 64px; height: 64px; border-radius: 6px; object-fit: contain; background-color: #fff; background-image: linear-gradient(45deg, #e4e7eb 25%, transparent 25%), linear-gradient(-45deg, #e4e7eb 25%, transparent 25%), linear-gradient(45deg, transparent 75%, #e4e7eb 75%), linear-gradient(-45deg, transparent 75%, #e4e7eb 75%); background-size: 8px 8px; background-position: 0 0, 0 4px, 4px -4px, -4px 0; border: 1px solid var(--line); }
.omain { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.orow { display: flex; align-items: center; justify-content: space-between; gap: 6px; }
.orow b { font-family: var(--f-mono); font-size: 12px; }
.ometa { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.onotes { font-size: 12px; margin: 2px 0 0; overflow-wrap: anywhere; }
.oact { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.oact select { padding: 4px 6px; border: 1px solid var(--line); border-radius: 6px; background: var(--chrome); font-size: 12px; }
.oact .tbtn { height: 28px; font-size: 12px; padding: 0 8px; }
.pill { font-size: 11px; font-weight: 600; padding: 2px 8px; border-radius: 999px; white-space: nowrap; background: var(--chrome); color: var(--muted); border: 1px solid var(--line); }
.pill.new { background: var(--accent-soft); color: var(--ink); border-color: var(--accent); }
.pill.prod { background: var(--info-soft); color: var(--ink); border-color: var(--info); }
.pill.ready { background: var(--ok-soft); color: var(--ink); border-color: var(--ok); }
.pill.cancel { text-decoration: line-through; }
details.settings { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
details.settings summary { cursor: pointer; font-weight: 600; }
details.settings .form { margin-top: 10px; grid-template-columns: minmax(0, 1fr); }
@media (max-width: 820px) {
  .sendgrid, .form { grid-template-columns: minmax(0, 1fr); }
  .hide-xs { display: none; }
}

/* Narrow screens */
@media (max-width: 1100px) {
  .app { grid-template-columns: 64px 270px 1fr 250px; }
  .app.panel-closed { grid-template-columns: 64px 1fr 250px; }
  .docname { width: 150px; }
}
@media (max-width: 820px) {
  .topbar { gap: 6px; }
  .docname, .chip, .tlabel, .hint { display: none; }
  .mark span { display: none; }
  .app, .app.panel-closed { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .stage { grid-row: 1; }
  .rail { grid-row: 2; flex-direction: row; justify-content: space-around; border-right: 0; border-top: 1px solid var(--line); padding: 4px; padding-left: max(8px, env(safe-area-inset-left, 0px)); padding-right: max(8px, env(safe-area-inset-right, 0px)); padding-bottom: calc(4px + env(safe-area-inset-bottom, 0px)); overflow-x: auto; }
  .rail button { flex: 1; min-width: 52px; padding: 6px 2px; font-size: 10px; }
  .panel, .props { position: fixed; left: 0; right: 0; bottom: calc(62px + env(safe-area-inset-bottom, 0px)); max-height: 52%; z-index: 20; border: 0; border-top: 1px solid var(--line); border-radius: 14px 14px 0 0; box-shadow: var(--shadow); padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px); }
  .props.mob-hidden { display: none; }
  .panel-inner, .props-inner { padding-left: 16px; padding-right: 16px; }
  .mob-only { display: inline-flex; }
  .artwrap { padding: 20px; }
  .zoombar { right: max(10px, env(safe-area-inset-right, 0px)); bottom: 10px; }
}
@media (prefers-reduced-motion: reduce) { * { transition: none !important; animation: none !important; } }
