/* Batchmark Designer — a print-room console, not a dashboard template.
   Palette: press-black, warm stock, one acid proofing accent. Type: editorial serif
   for voice, monospace for anything the printer or GS1 engine will read. */

:root {
  --bg: #0d0f13;
  --bg-deep: #080a0d;
  --panel: #14171d;
  --panel-glass: rgba(20, 23, 29, 0.86);
  --field: #0a0c10;
  --line: #272c36;
  --line-soft: #1d222b;
  --line-hot: #3a4150;
  --text: #ece9e0;
  --muted: #a0a7b4;
  --dim: #737b8a;
  --paper: #f4f0e4;
  --paper-ink: #191813;
  --paper-muted: #625d50;
  --accent: #d8f36a;
  --accent-bright: #e9ff9e;
  --accent-ink: #151906;
  --accent-wash: rgba(216, 243, 106, 0.1);
  --ok: #6ee7b0;
  --warn: #f2bf67;
  --danger: #ff8080;
  --danger-wash: rgba(255, 128, 128, 0.1);
  --serif: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, serif;
  --sans: "Avenir Next", "Segoe UI", system-ui, -apple-system, sans-serif;
  --mono: ui-monospace, "SFMono-Regular", "SF Mono", Menlo, Consolas, "Liberation Mono", monospace;
  --radius: 2px;
  --shadow: 0 18px 50px rgba(0, 0, 0, 0.34);
}

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

[hidden] {
  display: none !important;
}

html {
  color-scheme: dark;
  -webkit-text-size-adjust: 100%;
}

body {
  margin: 0;
  min-height: 100vh;
  background-color: var(--bg);
  background-image:
    linear-gradient(rgba(255, 255, 255, 0.022) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.022) 1px, transparent 1px);
  background-size: 44px 44px;
  color: var(--text);
  font-family: var(--sans);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

.ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(58rem 30rem at 88% -8%, rgba(216, 243, 106, 0.09), transparent 64%),
    radial-gradient(42rem 26rem at -6% 24%, rgba(104, 129, 255, 0.07), transparent 70%);
}

::selection {
  background: var(--accent);
  color: var(--accent-ink);
}

.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
  white-space: nowrap;
  border: 0;
}

.skip-link {
  position: absolute;
  left: 12px;
  top: -60px;
  z-index: 20;
  padding: 10px 16px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 12px;
  text-decoration: none;
}

.skip-link:focus {
  top: 12px;
}

a {
  color: inherit;
}

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

/* ---------------------------------------------------------------- masthead */

.masthead {
  max-width: 1520px;
  margin: 0 auto;
  padding: 26px clamp(16px, 4vw, 52px) 30px;
  border-bottom: 1px solid var(--line);
  position: relative;
}

.masthead::after {
  content: "";
  position: absolute;
  left: clamp(16px, 4vw, 52px);
  right: clamp(16px, 4vw, 52px);
  bottom: -1px;
  height: 5px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 16px);
  opacity: 0.8;
  pointer-events: none;
}

.masthead-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  flex-wrap: wrap;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  min-width: 0;
}

.brand-mark {
  width: 34px;
  height: 20px;
  fill: var(--accent);
  flex: none;
}

.brand-word {
  font-family: var(--mono);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.24em;
  text-transform: uppercase;
}

.brand-slash {
  color: var(--dim);
  font-family: var(--mono);
}

.brand-sub {
  font-family: var(--mono);
  font-size: 11px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--muted);
}

.masthead-title {
  margin-top: clamp(28px, 5vw, 54px);
  max-width: 900px;
}

.eyebrow,
.kicker {
  margin: 0 0 12px;
  color: var(--accent);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
}

.masthead h1 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(44px, 7.4vw, 88px);
  line-height: 0.92;
  letter-spacing: -0.035em;
}

.masthead h1 em {
  font-style: italic;
  color: var(--accent);
}

.lede {
  margin: 20px 0 0;
  max-width: 58ch;
  color: var(--muted);
  font-size: clamp(14px, 1.4vw, 16px);
  line-height: 1.65;
}

/* ------------------------------------------------------------------- shell */

.shell {
  max-width: 1520px;
  margin: 0 auto;
  padding: clamp(18px, 3vw, 36px) clamp(16px, 4vw, 52px) 56px;
  display: grid;
  grid-template-columns: minmax(0, 440px) minmax(0, 1fr);
  gap: clamp(16px, 2.2vw, 30px);
  align-items: start;
}

.controls {
  grid-column: 1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  gap: 14px;
  min-width: 0;
}

.stage {
  grid-column: 2;
  grid-row: 1;
  align-self: start;
  position: sticky;
  top: 22px;
  min-width: 0;
  padding: clamp(16px, 2vw, 24px);
  background: var(--panel-glass);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

/* ------------------------------------------------------------------ panels */

.panel {
  width: 100%;
  padding: 18px 18px 20px;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  min-width: 0;
}

.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 1px dashed var(--line-soft);
}

.panel-head .num {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  color: var(--accent);
}

.panel-head h2 {
  margin: 0;
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.panel-hint {
  margin-left: auto;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  white-space: nowrap;
}

.field {
  display: grid;
  gap: 6px;
  margin: 0 0 14px;
  min-width: 0;
}

.field:last-child {
  margin-bottom: 0;
}

.field > span,
.field legend {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.13em;
  text-transform: uppercase;
}

.field > span em {
  color: var(--dim);
  font-style: normal;
  letter-spacing: 0.04em;
  text-transform: none;
}

fieldset.field {
  padding: 0;
  border: 0;
}

fieldset.field legend {
  padding: 0;
  margin-bottom: 6px;
}

.duo {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
  align-items: start;
  margin: 0 0 14px;
}

.duo .field {
  margin-bottom: 0;
}

input,
select,
button {
  font: inherit;
}

input[type="text"],
input[type="number"],
input[type="date"],
select {
  width: 100%;
  min-width: 0;
  height: 40px;
  padding: 0 12px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  color: var(--text);
  font-family: var(--mono);
  font-size: 13px;
  line-height: 1.25;
  transition: border-color 120ms ease, background-color 120ms ease;
}

input[type="date"] {
  color-scheme: dark;
}

input::placeholder {
  color: #5a6170;
  opacity: 1;
}

input[type="text"]:hover,
input[type="number"]:hover,
input[type="date"]:hover,
select:hover {
  border-color: var(--line-hot);
}

input[type="text"]:focus,
input[type="number"]:focus,
input[type="date"]:focus,
select:focus {
  border-color: var(--accent);
  background: #0c0f11;
}

select {
  appearance: none;
  padding-right: 34px;
  background-image:
    linear-gradient(45deg, transparent 50%, var(--muted) 50%),
    linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position:
    calc(100% - 17px) 50%,
    calc(100% - 12px) 50%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
  cursor: pointer;
}

.mono-input {
  letter-spacing: 0.01em;
}

.hint {
  margin: -6px 0 14px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
}

.hint.is-ok {
  color: var(--ok);
}

.hint.is-error {
  color: var(--danger);
}

.batch-hint {
  margin: 12px 0 0;
}

/* ------------------------------------------------------------- orientation */

.segmented {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 4px;
  padding: 4px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
}

.seg-btn {
  padding: 8px 10px;
  border: 1px solid transparent;
  border-radius: 1px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: background-color 120ms ease, color 120ms ease;
}

.seg-btn:hover {
  color: var(--text);
}

.seg-btn.is-active {
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

/* --------------------------------------------------------------- symbology */

.radio-field {
  margin: 0;
  padding: 0;
  border: 0;
  min-width: 0;
}

.radio-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 8px;
}

.sym-card {
  position: relative;
  display: grid;
  grid-template-columns: 26px minmax(0, 1fr);
  grid-template-rows: auto auto;
  column-gap: 10px;
  align-items: center;
  padding: 12px 10px;
  background: var(--field);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.sym-card:hover {
  border-color: var(--line-hot);
}

.sym-card input {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  margin: 0;
  opacity: 0;
  cursor: pointer;
}

.sym-card:has(input:checked) {
  border-color: var(--accent);
  background: linear-gradient(155deg, var(--accent-wash), transparent 60%), var(--field);
}

.sym-card:has(input:focus-visible) {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.sym-card::after {
  content: "";
  position: absolute;
  top: 9px;
  right: 9px;
  width: 7px;
  height: 7px;
  border: 1px solid var(--line-hot);
  border-radius: 50%;
}

.sym-card:has(input:checked)::after {
  background: var(--accent);
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-wash);
}

.sym-icon {
  grid-row: 1 / span 2;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 18px;
  color: var(--muted);
}

.sym-card:has(input:checked) .sym-icon {
  color: var(--accent);
}

.sym-icon svg {
  width: 26px;
  height: 18px;
}

.sym-name {
  font-family: var(--sans);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  padding-right: 12px;
}

.sym-note {
  grid-column: 2;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.02em;
  line-height: 1.35;
}

.sym-warning {
  margin: 10px 0 0;
  padding: 9px 11px;
  border-left: 2px solid var(--warn);
  background: rgba(242, 191, 103, 0.1);
  color: #f0d7ac;
  font-size: 11.5px;
  line-height: 1.45;
}

.sym-warning strong {
  color: var(--warn);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

/* --------------------------------------------------------------- GS1 panel */

.gs1-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
}

.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 9px;
  border: 1px solid var(--line);
  border-radius: 999px;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  white-space: nowrap;
}

.status-pill::before {
  content: "";
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: currentColor;
}

.status-pill[data-state="valid"] {
  color: var(--ok);
  border-color: rgba(110, 231, 176, 0.35);
  background: rgba(110, 231, 176, 0.07);
}

.status-pill[data-state="invalid"] {
  color: var(--danger);
  border-color: rgba(255, 128, 128, 0.4);
  background: var(--danger-wash);
}

.status-pill[data-state="empty"] {
  color: var(--dim);
}

.text-btn {
  padding: 4px 2px;
  border: 0;
  background: none;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  text-decoration: underline;
  text-decoration-color: var(--line-hot);
  text-underline-offset: 3px;
  cursor: pointer;
}

.text-btn:hover {
  color: var(--accent);
  text-decoration-color: var(--accent);
}

.gs1-panel {
  padding: 11px 12px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: rgba(8, 10, 13, 0.35);
  min-height: 46px;
  min-width: 0;
}

.gs1-placeholder {
  margin: 0;
  color: var(--dim);
  font-size: 11.5px;
  line-height: 1.5;
}

.gs1-elements {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.gs1-element {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  max-width: 100%;
  padding: 3px 7px;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: var(--field);
  font-family: var(--mono);
  font-size: 10px;
  min-width: 0;
}

.gs1-element .ai {
  color: var(--accent);
  flex: none;
}

.gs1-element .value {
  color: var(--text);
  overflow-wrap: anywhere;
}

.gs1-canonical {
  margin: 10px 0 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.gs1-canonical code {
  color: var(--muted);
}

.issue-list {
  display: grid;
  gap: 7px;
  margin: 8px 0 0;
  padding: 0;
  list-style: none;
}

.issue-list:first-child {
  margin-top: 0;
}

.gs1-issue {
  display: grid;
  gap: 2px;
  padding: 7px 9px;
  border-left: 2px solid var(--danger);
  background: var(--danger-wash);
  font-size: 11.5px;
  line-height: 1.45;
}

.gs1-issue code {
  color: var(--danger);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
}

.gs1-issue span {
  color: #e8c9c9;
}

.gs1-ok-note {
  margin: 8px 0 0;
  color: var(--ok);
  font-family: var(--mono);
  font-size: 10px;
}

/* -------------------------------------------------------------------- CSV */

.dropzone {
  position: relative;
  display: grid;
  justify-items: center;
  gap: 4px;
  padding: 20px 14px;
  border: 1px dashed var(--line-hot);
  border-radius: var(--radius);
  background: rgba(8, 10, 13, 0.35);
  text-align: center;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease;
}

.dropzone:hover,
.dropzone.is-drag {
  border-color: var(--accent);
  background: var(--accent-wash);
}

.dropzone:focus-within {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

.dropzone input[type="file"] {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: pointer;
}

.drop-icon {
  color: var(--accent);
  width: 20px;
  height: 20px;
}

.drop-icon svg {
  width: 20px;
  height: 20px;
}

.drop-title {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.01em;
}

.drop-note {
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.05em;
}

.csv-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 10px;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  min-width: 0;
}

.csv-meta span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.csv-meta span:nth-child(2) {
  color: var(--dim);
  white-space: nowrap;
}

.csv-meta .text-btn {
  margin-left: auto;
  flex: none;
}

.csv-error {
  margin: 10px 0 0;
  padding: 8px 10px;
  border-left: 2px solid var(--danger);
  background: var(--danger-wash);
  color: #e8c9c9;
  font-size: 11.5px;
  line-height: 1.45;
}

.table-wrap {
  margin-top: 10px;
  max-height: 230px;
  overflow: auto;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius);
  background: var(--field);
}

.table-wrap table {
  width: 100%;
  min-width: 470px;
  border-collapse: collapse;
  font-family: var(--mono);
  font-size: 10px;
}

.table-wrap th {
  position: sticky;
  top: 0;
  z-index: 1;
  padding: 7px 8px;
  background: #10131a;
  border-bottom: 1px solid var(--line);
  color: var(--dim);
  font-weight: 500;
  letter-spacing: 0.08em;
  text-align: left;
  text-transform: uppercase;
  white-space: nowrap;
}

.table-wrap td {
  padding: 6px 8px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--muted);
  white-space: nowrap;
  max-width: 150px;
  overflow: hidden;
  text-overflow: ellipsis;
}

.table-wrap tr:last-child td {
  border-bottom: 0;
}

.table-wrap tr.is-active td {
  background: var(--accent-wash);
  color: var(--text);
}

.table-wrap tr.is-active td:first-child {
  box-shadow: inset 2px 0 0 var(--accent);
}

.row-btn {
  padding: 3px 8px;
  border: 1px solid var(--line);
  border-radius: 1px;
  background: transparent;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  cursor: pointer;
}

.row-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
}

/* ------------------------------------------------------------------ stage */

.stage-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: 12px;
  padding: 0 2px 14px;
  border-bottom: 1px solid var(--line-soft);
}

.stage-head .kicker {
  margin: 0 0 4px;
  font-size: 9px;
}

.stage-head h2 {
  margin: 0;
  font-family: var(--serif);
  font-weight: 400;
  font-size: clamp(22px, 2.4vw, 28px);
  letter-spacing: -0.01em;
  line-height: 1;
}

.stage-meta {
  margin: 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.04em;
  text-align: right;
  white-space: nowrap;
}

.bed {
  position: relative;
  margin-top: 14px;
  padding: clamp(24px, 4.5vw, 48px);
  background-color: var(--bg-deep);
  background-image: radial-gradient(rgba(255, 255, 255, 0.055) 1px, transparent 1px);
  background-size: 12px 12px;
  border: 1px solid var(--line-soft);
  overflow: hidden;
}

.bed::before {
  content: "";
  position: absolute;
  top: 7px;
  left: 22px;
  right: 22px;
  height: 5px;
  background-image: repeating-linear-gradient(90deg, var(--line) 0 1px, transparent 1px 14px);
  opacity: 0.75;
  pointer-events: none;
}

.reg {
  position: absolute;
  width: 13px;
  height: 13px;
  color: var(--line-hot);
  pointer-events: none;
}

.reg::before,
.reg::after {
  content: "";
  position: absolute;
  background: currentColor;
}

.reg::before {
  left: 6px;
  top: 0;
  width: 1px;
  height: 13px;
}

.reg::after {
  left: 0;
  top: 6px;
  width: 13px;
  height: 1px;
}

.reg-tl { top: 13px; left: 13px; }
.reg-tr { top: 13px; right: 13px; }
.reg-bl { bottom: 13px; left: 13px; }
.reg-br { bottom: 13px; right: 13px; }

.paper {
  position: relative;
  width: 100%;
  max-width: 660px;
  margin: 0 auto;
  background: var(--paper);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.25) inset,
    0 26px 55px rgba(0, 0, 0, 0.55),
    0 0 0 1px rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

#preview {
  display: block;
  width: 100%;
  height: auto;
}

.paper-empty,
.paper-error {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 10px;
  aspect-ratio: var(--paper-ratio, 70 / 45);
  padding: clamp(18px, 3.5vw, 40px);
  text-align: center;
  color: var(--paper-muted);
}

.empty-glyph {
  width: 76px;
  max-width: 45%;
  height: auto;
  color: #948d7b;
  margin-bottom: 2px;
}

.empty-title {
  margin: 0;
  font-family: var(--serif);
  font-size: clamp(24px, 3vw, 32px);
  line-height: 1.05;
  color: #35322a;
}

.empty-copy {
  margin: 0;
  max-width: 34ch;
  font-size: 12px;
  line-height: 1.55;
  color: var(--paper-muted);
}

.paper-btn {
  margin-top: 6px;
  padding: 8px 12px;
  border: 1px solid rgba(25, 24, 19, 0.28);
  border-radius: 1px;
  background: transparent;
  color: #29271f;
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
}

.paper-btn:hover {
  border-color: #191813;
  background: rgba(25, 24, 19, 0.05);
}

.paper-error {
  gap: 6px;
  background:
    repeating-linear-gradient(135deg, rgba(160, 40, 40, 0.06) 0 8px, transparent 8px 16px),
    var(--paper);
}

.error-kicker {
  margin: 0;
  color: #a0432f;
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
}

.error-title {
  margin: 0;
  color: #4a2118;
  font-family: var(--serif);
  font-size: clamp(20px, 2.6vw, 28px);
  line-height: 1.1;
}

.error-copy {
  margin: 0;
  max-width: 44ch;
  color: #6b4a40;
  font-family: var(--mono);
  font-size: 10.5px;
  line-height: 1.5;
  overflow-wrap: anywhere;
}

.under-stage {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 14px;
  margin-top: 14px;
}

.diagnostics {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  min-width: 0;
}

.diag-dot {
  width: 6px;
  height: 6px;
  margin-top: 5px;
  border-radius: 50%;
  background: var(--accent);
  flex: none;
}

.diag-copy {
  min-width: 0;
}

.diag-copy p {
  margin: 0;
  color: var(--muted);
  font-family: var(--mono);
  font-size: 10px;
  line-height: 1.5;
}

.diagnostics[data-state="error"] .diag-dot {
  background: var(--danger);
}

.diagnostics[data-state="error"] .diag-copy p {
  color: var(--danger);
}

.diagnostics[data-state="warning"] .diag-dot {
  background: var(--warn);
}

.diagnostics[data-state="warning"] .diag-copy p {
  color: var(--warn);
}

.diagnostics[data-state="idle"] .diag-dot {
  background: var(--dim);
}

.diag-copy ul {
  margin: 4px 0 0;
  padding: 0;
  list-style: none;
  display: grid;
  gap: 2px;
}

.diag-copy li {
  color: var(--muted);
  font-family: var(--mono);
  font-size: 9.5px;
  line-height: 1.45;
  overflow-wrap: anywhere;
}

.preview-note {
  margin: 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.04em;
  text-align: right;
  white-space: nowrap;
  flex: none;
}

.export {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 18px;
  padding-top: 16px;
  border-top: 1px solid var(--line-soft);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 42px;
  padding: 10px 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: transparent;
  color: var(--text);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  cursor: pointer;
  transition: border-color 120ms ease, background-color 120ms ease, color 120ms ease;
}

.btn svg {
  width: 15px;
  height: 15px;
  flex: none;
}

.btn:hover:not(:disabled) {
  border-color: var(--accent);
  color: var(--accent);
}

.btn-primary {
  flex: 1 1 190px;
  background: var(--accent);
  border-color: var(--accent);
  color: var(--accent-ink);
  font-weight: 600;
}

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

.btn:disabled {
  opacity: 0.32;
  cursor: not-allowed;
}

.export-note {
  margin: 10px 0 0;
  color: var(--dim);
  font-size: 10px;
  line-height: 1.55;
}

/* ----------------------------------------------------------------- footer */

.footer {
  max-width: 1520px;
  margin: 0 auto;
  padding: 20px clamp(16px, 4vw, 52px) 40px;
  border-top: 1px solid var(--line);
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}

.footer p {
  margin: 0;
  color: var(--dim);
  font-family: var(--mono);
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.footer p span {
  color: var(--muted);
}

.footer .footer-note {
  text-transform: none;
  letter-spacing: 0.02em;
}

/* ------------------------------------------------------------------ toast */

.toast {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 30;
  max-width: calc(100vw - 36px);
  padding: 10px 14px;
  background: var(--accent);
  color: var(--accent-ink);
  font-family: var(--mono);
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  border-radius: 1px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  opacity: 0;
  transform: translateY(6px);
  pointer-events: none;
  transition: opacity 160ms ease, transform 160ms ease;
}

.toast.is-visible {
  opacity: 1;
  transform: translateY(0);
}

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

@media (max-width: 1080px) {
  .shell {
    grid-template-columns: minmax(0, 1fr);
  }

  .stage {
    grid-column: 1;
    grid-row: 1;
    position: static;
  }

  .controls {
    grid-column: 1;
    grid-row: 2;
  }

  .controls {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    align-items: start;
  }

  .panel:first-child,
  .panel:nth-child(4),
  .panel:nth-child(5) {
    grid-column: span 2;
  }
}

@media (max-width: 720px) {
  .controls {
    display: flex;
    align-items: stretch;
  }

  .masthead {
    padding-top: 20px;
  }

  .masthead-title {
    margin-top: 26px;
  }

  .bed {
    padding: 22px 18px;
  }
}

@media (max-width: 560px) {
  body {
    font-size: 14px;
  }

  .masthead {
    padding: 18px 14px 22px;
  }

  .masthead::after {
    left: 14px;
    right: 14px;
  }

  .masthead-top {
    gap: 12px;
  }

  .brand-word {
    font-size: 12px;
    letter-spacing: 0.18em;
  }

  .brand-sub,
  .brand-slash {
    display: none;
  }

  .masthead h1 {
    font-size: clamp(40px, 13vw, 56px);
  }

  .lede {
    margin-top: 14px;
    font-size: 13.5px;
  }

  .shell {
    padding: 14px 12px 40px;
    gap: 12px;
  }

  .stage {
    padding: 14px;
  }

  .panel {
    padding: 15px 14px 17px;
  }

  .panel-hint {
    display: none;
  }

  .stage-head {
    align-items: flex-start;
    flex-direction: column;
    gap: 6px;
  }

  .stage-meta {
    text-align: left;
  }

  .bed {
    padding: 20px 14px;
    margin-top: 12px;
  }

  .reg {
    width: 10px;
    height: 10px;
  }

  .reg::before { left: 4.5px; height: 10px; }
  .reg::after { top: 4.5px; width: 10px; }

  .empty-copy {
    font-size: 11.5px;
  }

  .empty-glyph {
    width: 64px;
  }

  .under-stage {
    flex-direction: column;
    gap: 6px;
  }

  .preview-note {
    text-align: left;
  }

  .export {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .btn-primary {
    grid-column: 1 / -1;
    width: 100%;
  }

  .radio-grid {
    grid-template-columns: minmax(0, 1fr);
  }

  .sym-card {
    grid-template-columns: 26px minmax(0, 1fr);
  }

  .duo {
    grid-template-columns: minmax(0, 1fr);
    gap: 0;
    margin-bottom: 0;
  }

  .duo .field {
    margin-bottom: 14px;
  }

  .duo .field:last-child {
    margin-bottom: 0;
  }

  input[type="text"],
  input[type="number"],
  input[type="date"],
  select {
    font-size: 16px;
    padding: 0 10px;
  }

  .footer {
    padding: 16px 14px 32px;
    flex-direction: column;
    gap: 6px;
  }

  .toast {
    left: 12px;
    right: 12px;
    bottom: 12px;
    text-align: center;
  }
}

@media (prefers-reduced-motion: reduce) {
  *,
  *::before,
  *::after {
    scroll-behavior: auto !important;
    transition-duration: 0.001ms !important;
    animation-duration: 0.001ms !important;
  }
}
