:root {
  --paper: #e9eeec;
  --paper-deep: #dbe3e0;
  --ink: #102522;
  --muted: #667572;
  --line: #bdc9c5;
  --white: #f9fbfa;
  --forge: #163b36;
  --forge-2: #24534c;
  --signal: #f2602d;
  --signal-soft: #ffe0d3;
  --ready: #15805f;
  --ready-soft: #d5efe5;
  --warning: #e9b949;
  --danger: #b93636;
  --shadow: 0 18px 44px rgba(16, 37, 34, .11);
  --radius: 18px;
  --display: Bahnschrift, "Arial Narrow", Arial, sans-serif;
  --body: "Segoe UI", Arial, sans-serif;
  --mono: Consolas, "Courier New", monospace;
}

* { box-sizing: border-box; }

html { min-height: 100%; background: var(--paper); }

body {
  margin: 0;
  color: var(--ink);
  background:
    linear-gradient(90deg, rgba(16,37,34,.035) 1px, transparent 1px) 0 0 / 42px 42px,
    linear-gradient(rgba(16,37,34,.035) 1px, transparent 1px) 0 0 / 42px 42px,
    var(--paper);
  font-family: var(--body);
  min-height: 100vh;
}

button, input, select, textarea { font: inherit; }
button { cursor: pointer; }

button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible {
  outline: 3px solid rgba(242,96,45,.38);
  outline-offset: 2px;
}

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  min-height: 76px;
  display: grid;
  grid-template-columns: minmax(230px, 1fr) auto minmax(230px, 1fr);
  align-items: center;
  gap: 24px;
  padding: 10px clamp(20px, 3vw, 52px);
  color: var(--white);
  background: rgba(16, 37, 34, .96);
  border-bottom: 1px solid rgba(255,255,255,.12);
  backdrop-filter: blur(12px);
}

.brand { color: inherit; text-decoration: none; display: inline-flex; align-items: center; gap: 12px; width: max-content; }
.brand strong { display: block; font: 700 20px/1 var(--display); letter-spacing: .02em; }
.brand small { display: block; margin-top: 5px; color: #aebdb9; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.brand-mark { display: grid; grid-template-columns: repeat(3, 6px); align-items: end; gap: 3px; height: 28px; padding: 4px; border: 1px solid rgba(255,255,255,.35); }
.brand-mark i { display: block; width: 6px; background: var(--signal); }
.brand-mark i:nth-child(1) { height: 8px; }
.brand-mark i:nth-child(2) { height: 18px; }
.brand-mark i:nth-child(3) { height: 12px; }

.nav-tabs { display: flex; align-items: center; gap: 4px; padding: 4px; border-radius: 13px; background: rgba(255,255,255,.07); }
.nav-tab { min-width: 0; border: 0; border-radius: 9px; padding: 9px 15px; color: #b9c6c3; background: transparent; font-weight: 650; white-space: nowrap; }
.nav-tab:hover { color: var(--white); }
.nav-tab.active { color: var(--ink); background: var(--white); }
.counter { display: inline-grid; place-items: center; min-width: 20px; height: 20px; margin-left: 4px; padding: 0 5px; color: inherit; background: rgba(22,59,54,.12); border-radius: 99px; font: 700 11px/1 var(--mono); }

.station-box { justify-self: end; display: grid; grid-template-columns: auto auto; align-items: center; column-gap: 8px; }
.station-box label { color: #9fb0ac; font-size: 10px; text-transform: uppercase; letter-spacing: .1em; }
.station-box input { grid-column: 2; width: 150px; padding: 3px 0; color: var(--white); background: transparent; border: 0; border-bottom: 1px solid #536d68; font-weight: 650; }
.account-box { grid-column: 3; grid-row: 1 / 3; display: grid; gap: 5px; min-width: 145px; padding-left: 14px; border-left: 1px solid rgba(255,255,255,.16); }
.account-box > strong { max-width: 190px; overflow: hidden; color: white; font-size: 12px; text-overflow: ellipsis; white-space: nowrap; }
.account-box > span { display: flex; align-items: center; gap: 10px; }
.account-box a, .account-box button { padding: 0; color: #aebdb9; border: 0; background: transparent; font-size: 10px; text-decoration: underline; }
.account-box a:hover, .account-box button:hover { color: white; }
.connection-dot { grid-row: 1 / 3; width: 9px; height: 9px; border-radius: 50%; background: var(--warning); box-shadow: 0 0 0 4px rgba(233,185,73,.12); }
.connection-dot.online { background: #4bd3a4; box-shadow: 0 0 0 4px rgba(75,211,164,.12); }
.connection-dot.offline { background: #ff6b64; box-shadow: 0 0 0 4px rgba(255,107,100,.12); }

main { width: min(1540px, 100%); margin: 0 auto; padding: clamp(24px, 4vw, 58px); }
.view { display: none; animation: view-in .24s ease both; }
.view.active { display: block; }

@keyframes view-in { from { opacity: 0; transform: translateY(5px); } }

.terminal-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(310px, .68fr); gap: clamp(22px, 3vw, 44px); }
.terminal-grid.terminal-focus { grid-template-columns: minmax(0, 1060px); justify-content: center; }
.terminal-main { min-width: 0; }
.section-heading, .page-heading, .panel-title { display: flex; align-items: end; justify-content: space-between; gap: 20px; }
.section-heading { margin-bottom: 24px; }
.eyebrow { margin: 0 0 7px; color: var(--signal); font: 750 11px/1 var(--body); letter-spacing: .16em; text-transform: uppercase; }
h1, h2, p { margin-top: 0; }
h1 { margin-bottom: 0; font: 720 clamp(32px, 4vw, 55px)/.95 var(--display); letter-spacing: -.035em; }
h2 { margin-bottom: 0; font: 700 22px/1.05 var(--display); letter-spacing: -.02em; }
.enter-hint { color: var(--muted); font: 600 13px/1 var(--mono); }

.scan-form { margin-bottom: 22px; }
.scan-input-wrap { position: relative; display: grid; grid-template-columns: 1fr auto; padding: 7px; background: var(--white); border: 2px solid var(--forge); border-radius: 15px; box-shadow: 0 9px 24px rgba(16,37,34,.08); }
.scan-corners { position: absolute; inset: 0; pointer-events: none; }
.scan-input-wrap:focus-within { box-shadow: 0 0 0 5px rgba(242,96,45,.14), 0 9px 24px rgba(16,37,34,.08); border-color: var(--signal); }
.scan-input-wrap input { min-width: 0; height: 58px; padding: 0 18px; border: 0; outline: 0; color: var(--ink); background: transparent; font: 680 clamp(22px, 3vw, 33px)/1 var(--mono); text-transform: uppercase; }
.scan-input-wrap input::placeholder { color: #aeb9b6; text-transform: none; font-family: var(--body); font-weight: 450; }
.scan-input-wrap button, .primary-button { border: 0; border-radius: 10px; color: white; background: var(--signal); font-weight: 750; }
.scan-input-wrap button { min-width: 154px; padding: 0 22px; }
.scan-input-wrap button:hover, .primary-button:hover { background: #d94e1e; }
.scan-input-wrap button:disabled { opacity: .6; cursor: wait; }
.scan-help { margin: 9px 2px 0; color: var(--muted); font-size: 12px; }

.assignment-card { position: relative; overflow: hidden; min-height: 315px; padding: clamp(26px, 4vw, 48px); color: var(--white); border-radius: 24px; background: var(--forge); box-shadow: var(--shadow); transition: background .25s ease, transform .25s ease; }
.assignment-card::before { content: ""; position: absolute; inset: 0; pointer-events: none; opacity: .16; background: repeating-linear-gradient(90deg, transparent 0 34px, rgba(255,255,255,.18) 35px 36px); mask-image: linear-gradient(to top, black, transparent 58%); }
.assignment-card::after { content: ""; position: absolute; right: -100px; bottom: -135px; width: 360px; height: 360px; border: 54px solid rgba(255,255,255,.05); transform: rotate(13deg); }
.assignment-card.success { background: var(--ready); animation: assignment-pop .32s ease both; }
.assignment-card.error { background: var(--danger); animation: assignment-shake .34s ease both; }
@keyframes assignment-pop { 50% { transform: scale(1.012); } }
@keyframes assignment-shake { 25% { transform: translateX(-5px); } 60% { transform: translateX(4px); } }
.assignment-state { position: relative; z-index: 1; display: flex; align-items: center; gap: 10px; color: #b8cbc6; font-size: 12px; letter-spacing: .11em; text-transform: uppercase; }
.pulse-ring { width: 9px; height: 9px; border-radius: 50%; background: #7c9992; box-shadow: 0 0 0 5px rgba(124,153,146,.13); }
.success .pulse-ring { background: #8df0cd; box-shadow: 0 0 0 5px rgba(141,240,205,.15); }
.error .pulse-ring { background: #ffb4ad; }
.assignment-body { position: relative; z-index: 1; display: grid; grid-template-columns: minmax(210px, .9fr) 1.2fr; align-items: center; gap: clamp(28px, 5vw, 70px); min-height: 184px; }
.pallet-label { display: block; margin-bottom: 2px; color: #a9beb8; font-size: 12px; letter-spacing: .12em; text-transform: uppercase; }
.pallet-number { display: block; font: 780 clamp(86px, 12vw, 150px)/.85 var(--display); letter-spacing: -.07em; font-stretch: condensed; }
.assignment-details { padding-left: 28px; border-left: 1px solid rgba(255,255,255,.26); }
.assignment-details h2 { margin-bottom: 10px; font-size: clamp(23px, 3vw, 35px); }
.assignment-details p { margin-bottom: 7px; color: #c4d3cf; line-height: 1.45; }
.assignment-details .product-code { color: white; font: 700 18px/1 var(--mono); }
.ambiguity-choices { display: grid; gap: 8px; margin-top: 16px; }
.ambiguity-choice { display: flex; align-items: center; justify-content: space-between; gap: 14px; width: 100%; padding: 11px 13px; color: white; border: 1px solid rgba(255,255,255,.45); border-radius: 9px; background: rgba(255,255,255,.1); text-align: left; }
.ambiguity-choice:hover { background: rgba(255,255,255,.2); }
.ambiguity-choice:disabled { opacity: .55; cursor: wait; }
.ambiguity-choice strong { font-family: var(--mono); }
.ambiguity-choice span { color: rgba(255,255,255,.78); font-size: 11px; }
.assignment-footer { position: relative; z-index: 1; display: flex; justify-content: space-between; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.2); color: #b7c9c4; font-size: 12px; }
.assignment-footer strong { color: white; }
.recognition-note { display: inline-block; margin-left: 5px; color: #b8cbc6; font-size: 10px; }

.stats-strip { display: grid; grid-template-columns: repeat(3, 1fr); margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; background: rgba(249,251,250,.64); }
.stats-strip div { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 15px 18px; }
.stats-strip div + div { border-left: 1px solid var(--line); }
.stats-strip span { color: var(--muted); font-size: 12px; }
.stats-strip strong { font: 740 24px/1 var(--display); }

.terminal-aside { display: flex; flex-direction: column; gap: 18px; }
.panel { position: relative; padding: 24px; border: 1px solid rgba(16,37,34,.14); border-radius: var(--radius); background: rgba(249,251,250,.82); box-shadow: 0 8px 26px rgba(16,37,34,.055); }
.panel-title { align-items: center; margin-bottom: 22px; }
.big-counter { color: var(--ink); font: 750 38px/1 var(--display); }
.plan-list, .recent-list { display: flex; flex-direction: column; gap: 13px; }
.plan-row { padding-bottom: 13px; border-bottom: 1px solid var(--line); }
.plan-row:last-child { padding-bottom: 0; border-bottom: 0; }
.row-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.row-top strong { font-size: 13px; }
.row-top span { color: var(--muted); font: 650 11px/1 var(--mono); }
.progress-track { overflow: hidden; height: 5px; margin-top: 9px; background: var(--paper-deep); border-radius: 99px; }
.progress-track i { display: block; height: 100%; background: var(--signal); border-radius: inherit; }
.recent-item { display: grid; grid-template-columns: 42px 1fr auto; align-items: center; gap: 11px; }
.recent-pallet { display: grid; place-items: center; width: 42px; height: 42px; color: var(--white); background: var(--forge); border-radius: 9px; font: 750 17px/1 var(--display); }
.recent-main strong { display: block; font: 700 13px/1.2 var(--mono); }
.recent-main span { display: block; overflow: hidden; max-width: 175px; margin-top: 4px; color: var(--muted); font-size: 11px; text-overflow: ellipsis; white-space: nowrap; }
.recent-time { color: var(--muted); font: 500 10px/1 var(--mono); }
.undo-button, .icon-button { border: 0; background: transparent; color: var(--muted); }
.undo-button { display: inline-block; padding: 4px; font-size: 11px; text-decoration: underline; }
.undo-button.visible { display: inline-block; }
.icon-button { width: 34px; height: 34px; border: 1px solid var(--line); border-radius: 9px; font-size: 19px; }
.icon-button:hover { color: var(--ink); background: var(--paper); }
.empty-state { color: var(--muted); font-size: 13px; }

.page-heading { margin-bottom: 32px; }
.page-intro { max-width: 510px; margin: 0; color: var(--muted); line-height: 1.5; }
.legend { display: flex; gap: 18px; color: var(--muted); font-size: 12px; }
.legend span { display: flex; align-items: center; gap: 7px; }
.dot { width: 9px; height: 9px; border-radius: 50%; background: var(--warning); }
.dot.complete { background: var(--ready); }
.pallet-search { position: relative; display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: center; gap: 14px; margin: -10px 0 24px; padding: 10px 12px; border: 1px solid var(--line); border-radius: 14px; background: rgba(249,251,250,.88); box-shadow: 0 8px 22px rgba(16,37,34,.055); }
.pallet-search:focus-within { border-color: var(--signal); box-shadow: 0 0 0 4px rgba(242,96,45,.11), 0 8px 22px rgba(16,37,34,.055); }
.pallet-search-mark { display: grid; grid-template-columns: repeat(3, 3px); align-items: end; gap: 2px; width: 31px; height: 31px; padding: 7px; border-radius: 8px; background: var(--forge); }
.pallet-search-mark i { display: block; width: 3px; background: var(--signal); }
.pallet-search-mark i:nth-child(1) { height: 7px; }
.pallet-search-mark i:nth-child(2) { height: 14px; }
.pallet-search-mark i:nth-child(3) { height: 10px; }
.pallet-search label { min-width: 0; }
.pallet-search label > span { display: block; margin-bottom: 3px; color: var(--muted); font-size: 9px; font-weight: 750; letter-spacing: .11em; text-transform: uppercase; }
.pallet-search input { width: 100%; padding: 0; color: var(--ink); border: 0; outline: 0; background: transparent; font: 700 17px/1.3 var(--mono); }
.pallet-search input::placeholder { color: #98a6a2; font-family: var(--body); font-size: 13px; font-weight: 450; }
.pallet-search input::-webkit-search-cancel-button { display: none; }
.pallet-search button { padding: 7px 9px; color: var(--signal); border: 1px solid #efb29b; border-radius: 7px; background: var(--signal-soft); font-size: 10px; font-weight: 750; }
.pallet-search button:hover { color: white; border-color: var(--signal); background: var(--signal); }
.pallet-search output { min-width: 94px; color: var(--muted); font: 700 11px/1 var(--mono); text-align: right; white-space: nowrap; }
.pallet-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(245px, 1fr)); gap: 17px; }
.pallet-grid.pallet-search-empty { display: grid; min-height: 210px; place-content: center; justify-items: center; gap: 8px; padding: 30px; border: 1px dashed var(--line); border-radius: 16px; background: rgba(249,251,250,.55); text-align: center; }
.pallet-search-empty strong { color: var(--ink); font: 700 21px/1 var(--display); }
.pallet-search-empty span { color: var(--muted); font-size: 12px; }
.pallet-card { overflow: hidden; border: 1px solid var(--line); border-radius: 16px; background: var(--white); box-shadow: 0 7px 18px rgba(16,37,34,.055); }
.pallet-card-top { display: flex; justify-content: space-between; align-items: flex-start; padding: 20px; color: white; background: var(--forge); }
.pallet-card.complete .pallet-card-top { background: var(--ready); }
.pallet-card-top strong { font: 760 48px/.9 var(--display); letter-spacing: -.05em; }
.status-badge { padding: 5px 8px; border: 1px solid rgba(255,255,255,.35); border-radius: 99px; font-size: 9px; letter-spacing: .09em; text-transform: uppercase; }
.pallet-card-body { padding: 18px 20px 20px; }
.pallet-card-body h3 { margin: 0 0 7px; font: 700 17px/1.15 var(--display); }
.pallet-card-body p { margin-bottom: 15px; color: var(--muted); font: 600 12px/1.3 var(--mono); }
.pallet-meta { display: flex; justify-content: space-between; margin-top: 8px; color: var(--muted); font-size: 11px; }
.release-button { width: 100%; margin-top: 15px; padding: 9px; color: var(--danger); border: 1px solid #e2bcbc; border-radius: 8px; background: #fff7f7; font-weight: 700; }
.release-button:hover { color: white; border-color: var(--danger); background: var(--danger); }
.release-button:disabled { opacity: .55; cursor: wait; }

.pallet-parts { margin-top: 17px; padding-top: 14px; border-top: 1px solid var(--line); }
.pallet-parts summary { display: flex; justify-content: space-between; gap: 12px; color: var(--ink); cursor: pointer; font-size: 11px; font-weight: 750; list-style: none; }
.pallet-parts summary::-webkit-details-marker { display: none; }
.pallet-parts summary::before { content: "+"; color: var(--signal); font: 700 14px/1 var(--mono); }
.pallet-parts[open] summary::before { content: "−"; }
.pallet-parts summary span { margin-left: auto; color: var(--muted); font-weight: 500; }
.pallet-parts ul { display: flex; flex-direction: column; gap: 9px; margin: 13px 0 0; padding: 0; list-style: none; }
.pallet-parts li { display: grid; grid-template-columns: 1fr auto; gap: 12px; align-items: center; }
.pallet-parts li div { min-width: 0; }
.pallet-parts li code { display: block; color: var(--ink); font: 700 11px/1.2 var(--mono); }
.pallet-parts li span { display: block; overflow: hidden; margin-top: 3px; color: var(--muted); font-size: 10px; text-overflow: ellipsis; white-space: nowrap; }
.pallet-parts li strong { color: var(--forge); font: 700 11px/1 var(--mono); }

.manage-grid { display: grid; grid-template-columns: 1.2fr .8fr; gap: 20px; margin-bottom: 20px; }
.form-panel { min-height: 390px; }
.step-badge { position: absolute; top: 20px; right: 22px; display: grid; place-items: center; width: 32px; height: 32px; color: var(--signal); border: 1px solid var(--signal); border-radius: 50%; font: 750 14px/1 var(--mono); }
.stack-form { display: flex; flex-direction: column; gap: 16px; }
.stack-form label { display: flex; flex-direction: column; gap: 7px; color: var(--muted); font-size: 12px; font-weight: 650; }
.field-row { display: grid; grid-template-columns: .7fr 1.3fr; gap: 13px; }
.field-row.compact { grid-template-columns: 1fr 1fr; }
.stack-form input, .stack-form select, .stack-form textarea { width: 100%; padding: 11px 12px; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: var(--white); outline: 0; }
.stack-form textarea { resize: vertical; font-family: var(--mono); font-size: 12px; line-height: 1.55; }
.stack-form small { color: #81908d; font-size: 10px; font-weight: 450; }
.primary-button { align-self: flex-start; padding: 12px 18px; }
.secondary-button { padding: 10px 15px; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: var(--white); font-weight: 700; }
.secondary-button:hover { border-color: var(--forge); background: var(--paper); }
.secondary-button[hidden] { display: none; }
.form-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.parts-editor-fieldset { min-width: 0; margin: 0; padding: 0; border: 0; }
.parts-editor-fieldset legend { margin-bottom: 9px; color: var(--muted); font-size: 12px; font-weight: 650; }
.parts-editor-labels, .part-editor-row { display: grid; grid-template-columns: minmax(135px, .8fr) minmax(180px, 1.2fr) 90px 36px; gap: 9px; align-items: center; }
.parts-editor-labels { margin-bottom: 6px; color: #81908d; font-size: 9px; letter-spacing: .07em; text-transform: uppercase; }
.parts-editor { display: flex; flex-direction: column; gap: 8px; }
.part-editor-row label { display: block; }
.part-editor-row input { margin: 0; }
.remove-part-button { display: grid; place-items: center; width: 36px; height: 36px; color: var(--danger); border: 1px solid #e2bcbc; border-radius: 8px; background: #fff7f7; font-size: 20px; line-height: 1; }
.remove-part-button:hover { color: white; background: var(--danger); }
.add-part-button { align-self: flex-start; margin-top: 10px; padding: 8px 11px; color: var(--forge); border: 1px dashed var(--forge-2); border-radius: 8px; background: transparent; font-size: 11px; font-weight: 750; }
.add-part-button:hover { background: var(--ready-soft); }
.info-note { margin-top: 22px; padding: 15px; border-left: 3px solid var(--warning); background: #fff9e9; }
.info-note strong { font-size: 12px; }
.info-note p { margin: 5px 0 0; color: var(--muted); font-size: 11px; line-height: 1.45; }
.table-panel, .catalog-panel { margin-top: 20px; }
.plan-table-row { display: grid; grid-template-columns: minmax(180px, 1.5fr) 80px 110px minmax(160px, 1fr) 110px; align-items: center; gap: 16px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.plan-table-row:last-child { border-bottom: 0; }
.plan-product strong { display: block; font-size: 13px; }
.plan-product small { color: var(--muted); font: 500 11px/1 var(--mono); }
.plan-status { width: max-content; padding: 5px 8px; border-radius: 99px; background: var(--ready-soft); color: var(--ready); font-size: 9px; font-weight: 750; letter-spacing: .07em; }
.plan-status.PAUSED { background: #f7e9bf; color: #856713; }
.plan-status.DONE { background: var(--paper-deep); color: var(--muted); }
.plan-action { padding: 7px 9px; border: 1px solid var(--line); border-radius: 7px; background: transparent; color: var(--ink); font-size: 11px; }
.plan-action:hover { background: var(--paper); }
.product-catalog { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 14px; }
.catalog-item { padding: 16px; border: 1px solid var(--line); border-radius: 12px; background: var(--white); }
.catalog-item summary { cursor: pointer; list-style: none; display: flex; justify-content: space-between; gap: 15px; }
.catalog-item summary::-webkit-details-marker { display: none; }
.catalog-item strong { font-size: 13px; }
.catalog-item summary span { color: var(--muted); font-size: 11px; }
.spec-list { margin: 15px 0 0; padding: 13px 0 0; border-top: 1px solid var(--line); list-style: none; }
.spec-list li { display: grid; grid-template-columns: 100px 1fr auto; gap: 8px; padding: 5px 0; color: var(--muted); font-size: 11px; }
.spec-list code { color: var(--ink); font-family: var(--mono); }

.spec-editor-grid { display: grid; grid-template-columns: minmax(420px, .9fr) minmax(460px, 1.1fr); align-items: start; gap: 20px; }
.spec-form-panel { position: sticky; top: 98px; }
.quantity-field { max-width: 260px; }
.specification-catalog { display: flex; flex-direction: column; gap: 13px; }
.spec-record { overflow: hidden; border: 1px solid var(--line); border-radius: 13px; background: var(--white); transition: border-color .18s ease, box-shadow .18s ease; }
.spec-record.expanded { border-color: #b8ccc6; box-shadow: 0 8px 22px rgba(16,37,34,.07); }
.spec-record-head { display: block; }
.spec-record-toggle { display: grid; grid-template-columns: minmax(180px, 1fr) auto 32px; align-items: center; gap: 14px; width: 100%; min-width: 0; padding: 16px 17px 10px; color: var(--ink); border: 0; background: transparent; text-align: left; }
.spec-record-toggle:hover { background: linear-gradient(90deg, var(--signal-soft), transparent 70%); }
.spec-record-toggle:focus-visible { position: relative; z-index: 1; outline: 3px solid rgba(242,96,45,.32); outline-offset: -3px; }
.spec-record-identity { min-width: 0; }
.spec-record-identity code { display: block; color: var(--signal); font: 750 12px/1 var(--mono); }
.spec-record-identity strong { display: block; margin-top: 6px; font: 700 18px/1.15 var(--display); }
.spec-record-actions { display: flex; align-items: center; justify-content: flex-end; gap: 7px; padding: 0 14px 13px; flex-wrap: wrap; }
.edit-spec-button { padding: 7px 10px; color: var(--forge); border: 1px solid var(--line); border-radius: 8px; background: transparent; font-size: 10px; font-weight: 700; }
.edit-spec-button:hover { border-color: var(--forge); background: var(--paper); }
.delete-spec-button { padding: 7px 10px; color: var(--danger); border: 1px solid #e2bcbc; border-radius: 8px; background: #fff7f7; font-size: 10px; font-weight: 700; }
.delete-spec-button:hover { color: white; border-color: var(--danger); background: var(--danger); }
.delete-spec-button:disabled { opacity: .55; cursor: wait; }
.spec-record-meta { display: flex; justify-content: flex-end; gap: 7px; flex-wrap: wrap; }
.spec-record-meta span { padding: 5px 7px; color: var(--muted); border-radius: 6px; background: var(--paper); font-size: 9px; }
.spec-record-chevron { position: relative; width: 30px; height: 30px; border: 1px solid var(--line); border-radius: 8px; background: var(--paper); }
.spec-record-chevron::after { content: ""; position: absolute; left: 10px; top: 8px; width: 7px; height: 7px; border-right: 2px solid var(--forge-2); border-bottom: 2px solid var(--forge-2); transform: rotate(45deg); transition: transform .18s ease, top .18s ease; }
.spec-record.expanded .spec-record-chevron { border-color: #efb29b; background: var(--signal-soft); }
.spec-record.expanded .spec-record-chevron::after { top: 11px; border-color: var(--signal); transform: rotate(225deg); }
.spec-record-details { padding: 0 17px 17px; border-top: 1px solid var(--line); background: linear-gradient(180deg, rgba(233,239,237,.45), transparent 34px); }
.spec-record-lines-label { display: grid; grid-template-columns: minmax(130px, .9fr) minmax(120px, 1.35fr) auto; gap: 12px; padding: 13px 0 9px; color: #84928f; font-size: 8px; font-weight: 750; letter-spacing: .09em; text-transform: uppercase; }
.spec-record-lines-label span:last-child { text-align: right; }
.spec-record-lines { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 0; list-style: none; }
.spec-record-lines li { display: grid; grid-template-columns: minmax(130px, .9fr) minmax(120px, 1.35fr) auto; align-items: center; gap: 12px; min-height: 30px; padding: 5px 0; border-top: 1px solid rgba(205,217,214,.72); color: var(--muted); font-size: 10px; }
.spec-record-lines code, .spec-record-lines span { display: block; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.spec-record-lines code { color: var(--ink); font: 650 10px/1 var(--mono); }
.spec-record-lines strong { color: var(--ink); text-align: right; white-space: nowrap; }

.report-heading { gap: 22px; }
.report-heading > div { max-width: 780px; }
.report-heading .page-intro { margin-top: 9px; }
.export-button { display: inline-flex; align-items: center; justify-content: center; min-height: 44px; padding: 0 17px; color: white; border: 1px solid #d94f20; border-radius: 10px; background: var(--signal); box-shadow: 0 7px 18px rgba(242,96,45,.18); font-size: 12px; font-weight: 800; text-decoration: none; white-space: nowrap; }
.export-button:hover { background: #d94f20; }
.export-button:focus-visible { outline: 3px solid rgba(242,96,45,.38); outline-offset: 3px; }
.cutting-summary { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 14px; margin-bottom: 20px; }
.cutting-summary article { min-height: 108px; display: flex; flex-direction: column; justify-content: space-between; padding: 18px 20px; border: 1px solid var(--line); border-radius: 13px; background: var(--white); }
.cutting-summary span { color: var(--muted); font-size: 10px; font-weight: 700; letter-spacing: .07em; text-transform: uppercase; }
.cutting-summary strong { margin-top: 13px; font: 750 34px/1 var(--display); }
.cutting-summary .cutting-total { color: var(--ink); border-color: #efae94; background: var(--signal-soft); }
.cutting-summary .cutting-total strong { color: var(--signal); }
.cutting-report-panel { padding: 22px; }
.cutting-report-panel .panel-title small { color: var(--muted); font-size: 10px; }
.cutting-table-wrap { max-width: 100%; overflow-x: auto; }
.cutting-table { width: 100%; min-width: 900px; border-collapse: collapse; }
.cutting-table th { padding: 11px 10px; color: #aebdb9; background: var(--forge); font-size: 9px; font-weight: 750; letter-spacing: .07em; text-align: left; text-transform: uppercase; }
.cutting-table th:first-child { border-radius: 8px 0 0 8px; }
.cutting-table th:last-child { border-radius: 0 8px 8px 0; text-align: center; }
.cutting-table td { padding: 13px 10px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; vertical-align: middle; }
.cutting-table td code { display: block; color: var(--ink); font: 700 11px/1.25 var(--mono); }
.cutting-table td span { display: block; margin-top: 4px; }
.cutting-table td i { display: inline-grid; place-items: center; min-width: 28px; height: 28px; margin-right: 4px; padding: 0 6px; color: white; border-radius: 6px; background: var(--forge-2); font: normal 700 11px/1 var(--mono); }
.cutting-table .number-cell { color: var(--ink); font: 700 12px/1 var(--mono); text-align: right; }
.cutting-table .order-cell { width: 104px; text-align: center; }
.cutting-table .order-cell strong { display: inline-grid; place-items: center; min-width: 48px; height: 36px; padding: 0 10px; color: var(--ink); border-radius: 8px; background: var(--signal-soft); font: 800 17px/1 var(--mono); }
.cutting-table .cutting-empty { padding: 32px 16px; color: var(--muted); text-align: center; }

.journal-panel { min-width: 0; max-width: 100%; padding: 10px 22px; overflow: hidden; }
.journal-list { max-width: 100%; overflow-x: auto; }
.journal-row { display: grid; grid-template-columns: 140px 120px 70px minmax(210px, 1fr) 140px 80px; align-items: center; gap: 14px; min-width: 850px; padding: 13px 4px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 11px; }
.journal-row:last-child { border-bottom: 0; }
.journal-row.reversed { opacity: .48; }
.journal-row.reversed strong { text-decoration: line-through; }
.journal-row strong { color: var(--ink); font-family: var(--mono); }
.journal-row time { font-family: var(--mono); font-size: 10px; }
.journal-head { color: #7b8986; font-size: 9px; font-weight: 750; letter-spacing: .08em; text-transform: uppercase; }
.journal-pallet { display: grid; place-items: center; width: 38px; height: 32px; color: white; border-radius: 7px; background: var(--forge); font: 750 15px/1 var(--display); }
.reversed-label { color: var(--danger); font-size: 9px; font-weight: 750; text-transform: uppercase; }

.toast { position: fixed; right: 24px; bottom: 24px; z-index: 50; max-width: min(390px, calc(100vw - 48px)); padding: 13px 17px; color: white; background: var(--ink); border-radius: 11px; box-shadow: var(--shadow); opacity: 0; transform: translateY(15px); pointer-events: none; transition: .22s ease; }
.toast.show { opacity: 1; transform: none; }
.toast.error { background: var(--danger); }
.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; }
[hidden] { display: none !important; }

.auth-page { display: grid; min-height: 100vh; place-items: center; padding: 24px; background: var(--forge); }
.auth-shell { position: relative; width: min(940px, 100%); min-height: 560px; display: grid; grid-template-columns: 1.05fr .95fr; overflow: hidden; border: 1px solid rgba(255,255,255,.18); border-radius: 26px; background: var(--white); box-shadow: 0 28px 80px rgba(0,0,0,.28); }
.auth-identity { position: relative; display: flex; flex-direction: column; justify-content: space-between; padding: clamp(34px, 6vw, 68px); color: white; background: var(--forge-2); }
.auth-identity::after { content: ""; position: absolute; inset: auto -100px -175px auto; width: 390px; height: 390px; border: 62px solid rgba(255,255,255,.06); transform: rotate(14deg); }
.auth-identity .brand { position: relative; z-index: 1; }
.auth-identity-copy { position: relative; z-index: 1; }
.auth-identity-copy h1 { max-width: 520px; font-size: clamp(40px, 6vw, 72px); }
.auth-identity-copy p { max-width: 400px; margin: 22px 0 0; color: #bdd0cb; line-height: 1.55; }
.auth-form-wrap { display: grid; align-content: center; padding: clamp(34px, 6vw, 70px); }
.auth-form-wrap h2 { margin-bottom: 9px; font-size: 34px; }
.auth-form-wrap > p { margin-bottom: 30px; color: var(--muted); line-height: 1.45; }
.auth-form { display: grid; gap: 18px; }
.auth-form label, .user-create-form label, .user-edit-grid label { display: grid; gap: 7px; color: var(--muted); font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.auth-form input, .user-create-form input, .user-create-form select, .user-edit-grid input, .user-edit-grid select { width: 100%; min-height: 46px; padding: 0 13px; color: var(--ink); border: 1px solid var(--line); border-radius: 9px; background: white; }
.auth-form .primary-button { min-height: 49px; margin-top: 5px; }
.form-message { min-height: 20px; margin: 0; color: var(--danger); font-size: 12px; line-height: 1.4; }

.admin-page main { width: min(1280px, 100%); }
.admin-topbar { position: static; grid-template-columns: 1fr auto; }
.admin-actions { display: flex; align-items: center; gap: 13px; }
.admin-actions span { color: #b9c6c3; font-size: 12px; }
.admin-actions a, .admin-actions button { padding: 9px 12px; color: white; border: 1px solid rgba(255,255,255,.28); border-radius: 8px; background: transparent; font-size: 11px; text-decoration: none; }
.admin-heading { margin-bottom: 30px; }
.admin-heading .page-intro { max-width: 700px; margin-top: 14px; }
.users-layout { display: grid; grid-template-columns: minmax(280px, .62fr) minmax(0, 1.38fr); align-items: start; gap: 26px; }
.user-create-panel { position: sticky; top: 24px; }
.user-create-form { display: grid; gap: 14px; margin-top: 24px; }
.user-create-form .primary-button { min-height: 46px; }
.user-list { display: grid; gap: 12px; margin-top: 20px; }
.user-card { padding: 18px; border: 1px solid var(--line); border-left: 5px solid var(--forge-2); border-radius: 12px; background: white; }
.user-card[data-role="ADMIN"] { border-left-color: var(--signal); }
.user-card-head { display: flex; align-items: center; justify-content: space-between; gap: 15px; margin-bottom: 15px; }
.user-card-head strong { font: 700 17px/1 var(--display); }
.role-stamp { padding: 5px 8px; color: var(--forge); border-radius: 5px; background: var(--ready-soft); font: 750 9px/1 var(--mono); letter-spacing: .08em; }
.user-card[data-role="ADMIN"] .role-stamp { color: #8b3518; background: var(--signal-soft); }
.user-edit-grid { display: grid; grid-template-columns: 1fr 1.25fr .8fr; gap: 12px; }
.user-card-actions { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-top: 14px; }
.active-toggle { display: flex; align-items: center; gap: 8px; color: var(--muted); font-size: 11px; }
.active-toggle input { width: 17px; height: 17px; accent-color: var(--ready); }
.save-user-button { padding: 9px 13px; color: white; border: 0; border-radius: 8px; background: var(--forge); font-size: 11px; font-weight: 750; }
.save-user-button:hover { background: var(--forge-2); }

@media (max-width: 1040px) {
  .topbar { grid-template-columns: 1fr auto; }
  .nav-tabs { grid-row: 2; grid-column: 1 / -1; justify-self: center; }
  .terminal-grid { grid-template-columns: 1fr; }
  .terminal-aside { display: grid; grid-template-columns: 1fr 1fr; }
  .manage-grid { grid-template-columns: 1fr; }
  .spec-editor-grid { grid-template-columns: 1fr; }
  .spec-form-panel { position: static; }
  .account-box { min-width: 120px; }
  .users-layout { grid-template-columns: 1fr; }
  .user-create-panel { position: static; }
}

@media (max-width: 700px) {
  .topbar { position: relative; grid-template-columns: minmax(0, 1fr) auto; padding: 12px 16px; gap: 10px 8px; }
  .brand small, .station-box label { display: none; }
  .brand { gap: 8px; min-width: 0; }
  .brand strong { font-size: 16px; }
  .station-box input { grid-column: 2; width: 70px; }
  .account-box { grid-column: 1 / 3; grid-row: 3; display: flex; align-items: center; justify-content: flex-end; padding: 7px 0 0; border: 0; }
  .account-box > strong { font-size: 10px; }
  .nav-tabs { min-width: 0; width: 100%; max-width: 100%; overflow-x: auto; }
  .nav-tab { flex: 1 1 0; padding: 9px 3px; font-size: 9px; }
  main { padding: 25px 16px 42px; }
  h1 { font-size: 37px; }
  .scan-input-wrap { grid-template-columns: 1fr; }
  .scan-input-wrap input { height: 56px; padding: 0 12px; font-size: 22px; }
  .scan-input-wrap button { height: 47px; }
  .assignment-card { min-height: 360px; padding: 25px; }
  .assignment-body { grid-template-columns: 1fr; gap: 22px; padding: 24px 0; }
  .assignment-details { padding: 18px 0 0; border-left: 0; border-top: 1px solid rgba(255,255,255,.26); }
  .pallet-number { font-size: 100px; }
  .stats-strip { grid-template-columns: 1fr; }
  .stats-strip div + div { border-left: 0; border-top: 1px solid var(--line); }
  .terminal-aside { grid-template-columns: 1fr; }
  .page-heading { align-items: flex-start; flex-direction: column; }
  .field-row { grid-template-columns: 1fr; }
  .plan-table-row { grid-template-columns: 1fr auto; }
  .plan-table-row > :nth-child(2), .plan-table-row > :nth-child(4) { display: none; }
  .spec-editor-grid { display: flex; flex-direction: column; }
  .spec-editor-grid > * { width: 100%; }
  .report-heading { align-items: stretch; }
  .export-button { width: 100%; }
  .cutting-summary { grid-template-columns: 1fr; }
  .cutting-summary article { min-height: 90px; }
  .cutting-report-panel { padding: 14px; }
  .spec-record-lines-label, .spec-record-lines li { grid-template-columns: minmax(105px, .95fr) minmax(90px, 1.15fr) auto; gap: 7px; }
  .spec-record-head { grid-template-columns: 1fr; gap: 0; }
  .spec-record-toggle { grid-template-columns: minmax(0, 1fr) 32px; padding: 15px 14px 10px; }
  .spec-record-identity { grid-column: 1; grid-row: 1; }
  .spec-record-identity strong { white-space: normal; }
  .spec-record-meta { grid-column: 1; grid-row: 2; justify-content: flex-start; }
  .spec-record-chevron { grid-column: 2; grid-row: 1 / 3; }
  .spec-record-actions { padding: 0 14px 14px; }
  .parts-editor-labels { display: none; }
  .part-editor-row { grid-template-columns: minmax(0, 1fr) 82px 36px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: var(--paper); }
  .part-name-field { grid-column: 1 / -1; grid-row: 2; }
  .part-code-field { grid-column: 1; grid-row: 1; }
  .part-quantity-field { grid-column: 2; grid-row: 1; }
  .part-editor-row .remove-part-button { grid-column: 3; grid-row: 1; }
  .journal-panel { padding: 8px 14px; }
  .journal-list { overflow: visible; }
  .journal-head { display: none; }
  .journal-row:not(.journal-head) { min-width: 0; grid-template-columns: minmax(0, 1fr) auto; gap: 7px 12px; padding: 15px 2px; }
  .journal-row:not(.journal-head) time { grid-column: 1; grid-row: 1; }
  .journal-row:not(.journal-head) > strong { grid-column: 1; grid-row: 2; font-size: 13px; }
  .journal-row:not(.journal-head) > .journal-pallet { grid-column: 2; grid-row: 1 / 3; }
  .journal-row:not(.journal-head) > :nth-child(4) { grid-column: 1 / 3; grid-row: 3; }
  .journal-row:not(.journal-head) > :nth-child(5) { grid-column: 1; grid-row: 4; }
  .journal-row:not(.journal-head) > :nth-child(6) { grid-column: 2; grid-row: 4; text-align: right; }
  .auth-page { padding: 0; }
  .auth-shell { min-height: 100vh; grid-template-columns: 1fr; border: 0; border-radius: 0; }
  .auth-identity { min-height: 260px; padding: 32px 26px; }
  .auth-identity-copy h1 { font-size: 44px; }
  .auth-identity-copy p { margin-top: 14px; }
  .auth-form-wrap { padding: 38px 26px; }
  .admin-topbar { grid-template-columns: 1fr; }
  .admin-actions { justify-content: space-between; width: 100%; }
  .user-edit-grid { grid-template-columns: 1fr; }
  .pallet-search { grid-template-columns: auto minmax(0, 1fr) auto; }
  .pallet-search output { grid-column: 2 / 4; min-width: 0; text-align: left; }
}

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