/* ============================================================
   Imposition & Costing — wizard UI
   Mobile first: the base rules are the phone layout, and the wider
   screens are the special case, because the shop floor uses a phone.
   IBM Plex Sans and the Phosphor icons are vendored under /vendor so the app
   keeps working when the shop's internet does not.
   ============================================================ */
@import url("vendor/ibm-plex-sans.css");

/* The [hidden] attribute must always win over component display rules
   (e.g. .modal{display:flex}), otherwise hidden panels/modals stay visible. */
[hidden] { display: none !important; }

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-soft: #55617a;
  --ink-faint: #8b94a7;
  --line: #e3e7ee;
  --line-soft: #eef1f5;
  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #eaf1fe;
  --ok: #15803d;
  --ok-soft: #eafaf0;
  --warn: #b45309;
  --danger: #dc2626;
  --danger-soft: #fdecec;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05), 0 4px 16px rgba(15, 23, 42, .06);
  --shadow-lg: 0 12px 44px rgba(15, 23, 42, .18);
  --radius: 14px;
  --radius-sm: 10px;
  --caret-right: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20256%20256%22%3E%3Cpath%20d%3D%22M184.49%2C136.49l-80%2C80a12%2C12%2C0%2C0%2C1-17-17L159%2C128%2C87.51%2C56.49a12%2C12%2C0%2C1%2C1%2C17-17l80%2C80A12%2C12%2C0%2C0%2C1%2C184.49%2C136.49Z%22/%3E%3C/svg%3E");
  --caret-down: url("data:image/svg+xml,%3Csvg%20xmlns%3D%22http%3A//www.w3.org/2000/svg%22%20viewBox%3D%220%200%20256%20256%22%3E%3Cpath%20d%3D%22M216.49%2C104.49l-80%2C80a12%2C12%2C0%2C0%2C1-17%2C0l-80-80a12%2C12%2C0%2C0%2C1%2C17-17L128%2C159l71.51-71.52a12%2C12%2C0%2C0%2C1%2C17%2C17Z%22/%3E%3C/svg%3E");
  --font: "IBM Plex Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  font-size: 15px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}

/* ---------- Top bar ----------
   Phone first. The four things here (mark, name, job code, two actions) must
   never wrap: an earlier version let them stack three deep and push the actual
   work off screen. The name is the only elastic part. */
.topbar {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 14px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.topbar-left { display: flex; align-items: center; gap: 8px; min-width: 0; flex: 1; }
.brand-dot {
  width: 22px; height: 22px; border-radius: 7px; flex: none;
  background: linear-gradient(140deg, var(--primary), #60a5fa);
}
.app-title {
  font-weight: 650; font-size: 15px; letter-spacing: -.2px;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; min-width: 0;
}
.job-badge {
  font-size: 11px; font-weight: 600; color: var(--ink-soft); background: var(--line-soft);
  padding: 4px 9px; border-radius: 20px; font-variant-numeric: tabular-nums;
  flex: none; letter-spacing: .02em;
}
.topbar-right { display: flex; gap: 6px; flex: none; }
.topbar-right .btn { padding: 8px 11px; font-size: 13px; white-space: nowrap; }
.label-full { display: none; }
.label-short { display: inline; }

/* ---------- Stepper ---------- */
.stepper {
  display: flex; gap: 6px; justify-content: center;
  padding: 18px 16px 8px;
  max-width: 760px; margin: 0 auto;
}
.step {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: none; border: none; cursor: default; padding: 4px 2px;
  position: relative; color: var(--ink-faint); font: inherit;
}
.step::before {
  content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 2px;
  background: var(--line); z-index: 0;
}
.step:first-child::before { display: none; }
.step-num {
  width: 32px; height: 32px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--surface); border: 2px solid var(--line);
  font-weight: 700; font-size: 14px; z-index: 1; transition: all .2s;
}
.step-label { font-size: 12px; font-weight: 600; }
.step.done { cursor: pointer; color: var(--ink-soft); }
.step.done .step-num { background: var(--ok-soft); border-color: var(--ok); color: var(--ok); }
.step.done::before { background: var(--ok); }
.step.active { color: var(--primary); }
.step.active .step-num { background: var(--primary); border-color: var(--primary); color: #fff; box-shadow: 0 0 0 5px var(--primary-soft); }

/* ---------- Page & steps ---------- */
.page { max-width: 860px; margin: 0 auto; padding: 20px 24px 80px; }
.page:has(.wizard-step.wide:not([hidden])) { max-width: 1120px; }
.step-head { margin: 8px 0 20px; }
.step-head h1 { font-size: 24px; margin: 0 0 4px; letter-spacing: -.4px; }
.step-sub { color: var(--ink-soft); margin: 0; }

.card.soft {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 22px; box-shadow: var(--shadow);
}
.soft-rule { border: none; border-top: 1px solid var(--line-soft); margin: 20px 0; }

/* ---------- Fields ---------- */
.field { display: flex; flex-direction: column; gap: 5px; margin-bottom: 4px; }
.field label { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.field .opt { font-weight: 400; color: var(--ink-faint); }
input[type=text], input[type=number], input[type=date], select, textarea {
  font: inherit; padding: 10px 12px; border: 1px solid var(--line);
  border-radius: var(--radius-sm); background: #fff; color: var(--ink); width: 100%;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft);
}
.num { font-variant-numeric: tabular-nums; }
.field-note { font-size: 12px; color: var(--ink-faint); margin-top: 2px; }
.hint { font-size: 12.5px; color: var(--ink-faint); }
.field-narrow { max-width: 220px; }
.field-wide { grid-column: 1 / -1; }
.field-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.field-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; }
.field-row { display: flex; gap: 16px; }
.field-row .field { flex: 1; }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  font: inherit; font-weight: 600; cursor: pointer; border: 1px solid transparent;
  border-radius: var(--radius-sm); padding: 10px 18px; transition: all .15s;
  background: var(--surface); color: var(--ink); text-decoration: none;
}
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--primary-dark); }
.btn-ghost { background: var(--surface); border-color: var(--line); color: var(--ink-soft); }
.btn-ghost:not(:disabled):hover { border-color: var(--ink-faint); color: var(--ink); }
.btn-lg { padding: 13px 26px; font-size: 16px; }
.btn-sm { padding: 7px 13px; font-size: 13px; }

.step-actions { display: flex; align-items: center; justify-content: space-between; margin-top: 24px; }
.step-actions.inline { justify-content: flex-start; gap: 12px; margin-top: 20px; }

/* ---------- Spinner ---------- */
.spinner {
  width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid rgba(255,255,255,.45); border-top-color: #fff;
  display: inline-block; animation: spin .7s linear infinite;
}
.dz-loading .spinner { border-color: rgba(47,107,255,.3); border-top-color: var(--primary); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Step 1: artwork ---------- */
.artwork-grid { display: grid; grid-template-columns: 1.25fr 1fr; gap: 22px; align-items: start; }
.dropzone {
  border: 2px dashed var(--line); border-radius: var(--radius);
  background: var(--surface); min-height: 340px;
  display: flex; align-items: center; justify-content: center; position: relative;
  transition: border-color .15s, background .15s; overflow: hidden;
}
.dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.dz-empty { text-align: center; padding: 30px; }
.dz-icon { font-size: 40px; color: var(--primary); }
.dz-title { font-weight: 700; font-size: 18px; margin: 8px 0 2px; }
.dz-hint { color: var(--ink-faint); font-size: 13px; margin-bottom: 16px; }
.dz-loading { color: var(--ink-soft); display: flex; align-items: center; gap: 10px; font-weight: 600; }
.artwork-preview { width: 100%; height: 100%; min-height: 340px; display: flex; align-items: center; justify-content: center; padding: 14px; }
.artwork-preview svg, .artwork-preview img { max-width: 100%; max-height: 420px; height: auto; }
.preview-actions { display: flex; gap: 8px; margin-top: 12px; flex-wrap: wrap; }

.info-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 18px; box-shadow: var(--shadow); font-size: 14px;
}
.info-card .ic-file { font-weight: 700; font-size: 15px; margin-bottom: 12px; word-break: break-word; }
.info-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line-soft); }
.info-row .k { color: var(--ink-soft); }
.info-row .v { font-weight: 600; text-align: right; }
.ic-colors { margin-top: 12px; }
.ic-colors .k { color: var(--ink-soft); font-size: 13px; margin-bottom: 6px; display: block; }
.swatch-row { display: flex; flex-wrap: wrap; gap: 8px; }
.swatch-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; background: var(--line-soft); padding: 4px 9px 4px 4px; border-radius: 20px; }
.swatch { width: 18px; height: 18px; border-radius: 50%; border: 1px solid rgba(0,0,0,.12); flex: none; }
.swatch.unknown { display: flex; align-items: center; justify-content: center; font-size: 11px; color: var(--ink-faint); background: repeating-linear-gradient(45deg,#eee,#eee 3px,#fafafa 3px,#fafafa 6px); }

.blank-box { margin-top: 16px; background: var(--ok-soft); border: 1px solid #c7e8d3; border-radius: var(--radius-sm); padding: 14px 16px; }
.blank-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; }
.blank-head .k { font-weight: 700; }
.unit-toggle { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 999px; padding: 2px; }
.unit-btn { border: 0; background: none; font: inherit; font-size: 13px; padding: 5px 12px; border-radius: 999px; cursor: pointer; color: var(--ink-faint); }
.unit-btn.is-on { background: var(--primary); color: #fff; font-weight: 600; }
.blank-box .field-row { gap: 12px; }
.link-btn { border: 0; background: none; padding: 0; margin-top: 8px; font: inherit; font-size: 13px; color: var(--primary); cursor: pointer; text-decoration: underline; }
/* Inks measured off the artwork read as suggestions, not as facts the file
   stated — the operator confirms or removes them. */
.spot-row.is-suggested { border-left: 3px solid var(--primary-soft); padding-left: 9px; }
.spot-note { grid-column: 1 / -1; font-size: 12px; color: var(--ink-faint); margin-top: 2px; }

/* ---------- Size picker ---------- */
.size-range { width: 100%; margin-top: 8px; accent-color: var(--primary); height: 28px; }

/* ---------- Searchable dropdown ---------- */
.combo { position: relative; }
select.is-enhanced { position: absolute; opacity: 0; pointer-events: none; height: 0; width: 0; }
.combo-btn { width: 100%; text-align: left; font: inherit; background: #fff; border: 1px solid var(--line);
  border-radius: var(--radius-sm); padding: 11px 34px 11px 12px; cursor: pointer; min-height: 44px;
  background-image: linear-gradient(45deg, transparent 50%, var(--ink-faint) 50%), linear-gradient(135deg, var(--ink-faint) 50%, transparent 50%);
  background-position: right 15px center, right 10px center; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.combo-btn:focus-visible { outline: 2px solid var(--primary); outline-offset: 1px; }
.combo-panel { position: absolute; z-index: 40; left: 0; right: 0; top: calc(100% + 4px); background: #fff;
  border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(0,0,0,.14); overflow: hidden; }
.combo-search { width: 100%; border: 0; border-bottom: 1px solid var(--line-soft); padding: 11px 12px; font: inherit; min-height: 44px; }
.combo-search:focus { outline: none; }
.combo-list { max-height: 46vh; overflow-y: auto; -webkit-overflow-scrolling: touch; }
.combo-opt { padding: 11px 12px; cursor: pointer; font-size: 14px; min-height: 44px; display: flex; align-items: center; }
.combo-opt:hover { background: var(--line-soft); }
.combo-opt.is-sel { background: var(--ok-soft); font-weight: 600; }
.combo-empty { padding: 12px; color: var(--ink-faint); font-size: 13px; }

.manual-blank { margin-top: 16px; }
.toggle-line { display: flex; align-items: center; gap: 10px; cursor: pointer; font-weight: 600; }
.toggle-line.big { font-size: 15px; }
.toggle-line input, .radio-line input { width: 18px; height: 18px; accent-color: var(--primary); flex: none; }
.toggle-line.required span::after { content: " *"; color: var(--danger); }
.self-end { align-self: end; }

/* ---------- Advanced details ---------- */
.advanced { margin-top: 18px; border-top: 1px solid var(--line-soft); padding-top: 6px; }
.advanced > summary {
  cursor: pointer; font-weight: 600; color: var(--primary); font-size: 14px;
  padding: 10px 0; list-style: none; user-select: none;
  display: flex; align-items: center; gap: 7px;
}
.advanced > summary::before {
  content: ""; width: 14px; height: 14px; flex: none;
  background: currentColor;
  -webkit-mask: var(--caret-right) center/14px no-repeat;
  mask: var(--caret-right) center/14px no-repeat;
}
.advanced[open] > summary::before {
  -webkit-mask-image: var(--caret-down);
  mask-image: var(--caret-down);
}
.advanced > summary::-webkit-details-marker { display: none; }
.adv-group { padding: 14px 0; border-top: 1px solid var(--line-soft); }
.adv-group h4 { margin: 0 0 12px; font-size: 14px; }
.adv-group h4 small, .step-head small { font-weight: 400; color: var(--ink-faint); }
.sub-label { font-size: 12px; font-weight: 700; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .4px; margin-bottom: 8px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.radio-line { display: flex; align-items: center; gap: 8px; padding: 6px 0; cursor: pointer; }
.radio-line small { color: var(--ink-faint); }
.check-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 16px; }
/* A bare max-height cut a row in half, which reads as a rendering fault rather
   than as "there is more below". The inset shadow and the scroll snap make the
   list's edge deliberate. */
.check-grid.scroll-list {
  grid-template-columns: 1fr; max-height: 210px; overflow-y: auto;
  padding-right: 4px; scroll-snap-type: y proximity;
  border: 1px solid var(--line-soft); border-radius: var(--radius-sm);
  padding: 4px 8px;
  -webkit-mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent);
  mask-image: linear-gradient(to bottom, #000 calc(100% - 22px), transparent);
}
.check-grid.scroll-list > * { scroll-snap-align: start; }
.check-item { display: flex; align-items: center; gap: 8px; font-size: 13.5px; padding: 4px 0; cursor: pointer; }
.check-item input { width: 16px; height: 16px; accent-color: var(--primary); flex: none; }
.check-item small { color: var(--ink-faint); font-size: 11.5px; }

/* ---------- Colours / spot rows ---------- */
.spot-header { display: flex; align-items: center; justify-content: space-between; margin: 16px 0 8px; font-weight: 600; font-size: 14px; }
.spot-list { display: flex; flex-direction: column; gap: 8px; }
.spot-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.spot-row .swatch { width: 30px; height: 30px; border-radius: 8px; }
.spot-row .spot-name { flex: 2; }
.spot-row .spot-hex { flex: none; width: 96px; }
.spot-row .btn-remove { border: none; background: none; color: var(--ink-faint); font-size: 20px; cursor: pointer; line-height: 1; padding: 4px 8px; border-radius: 6px; }
.spot-row .btn-remove:hover { background: var(--danger-soft); color: var(--danger); }
.spot-empty { color: var(--ink-faint); font-size: 13px; font-style: italic; padding: 4px 0; }

.note { display: flex; gap: 10px; align-items: flex-start; margin-top: 14px; background: #fff8e8; border: 1px solid #f0e2bf; color: #7a6420; border-radius: var(--radius-sm); padding: 10px 12px; font-size: 12.5px; }
.note-close { border: none; background: none; cursor: pointer; font-size: 16px; color: inherit; line-height: 1; }

/* ---------- Step 4: candidate cards ---------- */
/* Wider minimum than before: four stat tiles across a 240px card squeezed
   "Rs 9.59 / Cost/pc" onto two cramped lines. Fewer, roomier cards read
   faster than more crowded ones. */
.candidate-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(310px, 1fr)); gap: 18px; }
.cand-card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 14px; box-shadow: var(--shadow); cursor: pointer; transition: all .15s; position: relative;
  display: flex; flex-direction: column; gap: 10px;
}
/* Hover is a light lift; selection is a filled state. Previously both were
   just "primary border", so the chosen layout was nearly indistinguishable
   from the one under the cursor. */
.cand-card:not(.infeasible):hover { border-color: var(--ink-faint); transform: translateY(-2px); box-shadow: var(--shadow); }
.cand-card.selected {
  border-color: var(--primary); border-width: 2px;
  background: var(--primary-soft);
  box-shadow: 0 0 0 4px rgba(37, 99, 235, .16), var(--shadow);
}
.cand-card.selected .cand-fig { background: #fff; }
.cand-card.selected::after {
  content: "Selected"; position: absolute; top: 10px; right: 10px;
  background: var(--primary); color: #fff; font-size: 10.5px; font-weight: 700;
  letter-spacing: .04em; text-transform: uppercase; padding: 3px 8px; border-radius: 20px;
}
.cand-card.best { border-color: var(--ok); }
.cand-card.infeasible { opacity: .55; cursor: default; background: #fbfbfc; }
.cand-thumb { background: #fafbfc; border: 1px solid var(--line-soft); border-radius: var(--radius-sm); aspect-ratio: 4/3; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.cand-thumb svg { width: 100%; height: 100%; }
.cand-thumb .thumb-empty { color: var(--ink-faint); font-size: 12px; }
.rank-badge { position: absolute; top: 10px; left: 10px; background: var(--ink); color: #fff; font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 20px; z-index: 2; }
.cand-card.best .rank-badge { background: var(--ok); }
.cand-card.infeasible .rank-badge { background: var(--danger); }
.cand-ups { font-size: 30px; font-weight: 800; letter-spacing: -1px; line-height: 1; }
.cand-ups small { font-size: 13px; font-weight: 600; color: var(--ink-soft); }
.cand-figs { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; }
.cand-fig { text-align: center; background: var(--line-soft); border-radius: 8px; padding: 9px 6px; }
.cand-fig .fv { font-weight: 700; font-size: 15px; font-variant-numeric: tabular-nums; line-height: 1.25; white-space: nowrap; }
.cand-fig .fl { font-size: 10px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.cand-sub { font-size: 12px; color: var(--ink-faint); }
.cand-reason { font-size: 12px; color: var(--danger); }
/* The press warning is identical on every card, so it must not dominate them.
   Two lines maximum here; the full text is on the selected sheet below. */
.cand-warn {
  font-size: 11px; color: var(--warn); line-height: 1.35;
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden;
}
.thumb-retry {
  border: 1px solid var(--line); background: #fff; border-radius: 8px;
  font: inherit; font-size: 12px; color: var(--ink-soft); padding: 7px 11px; cursor: pointer;
}
.thumb-retry:hover { border-color: var(--primary); color: var(--primary); }

/* ---------- Sheet viewer ---------- */
.viewer-wrap { margin-top: 22px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.viewer-head { display: flex; align-items: center; justify-content: space-between; padding: 14px 18px; border-bottom: 1px solid var(--line-soft); }
.viewer-head h3 { margin: 0; font-size: 16px; }
.viewer-toolbar { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 18px; background: #fafbfd; border-bottom: 1px solid var(--line-soft); flex-wrap: wrap; }
.layer-toggles { display: flex; flex-wrap: wrap; gap: 6px 12px; }
.layer-toggles label { display: flex; align-items: center; gap: 5px; font-size: 11.5px; color: var(--ink-soft); cursor: pointer; }
.layer-toggles input { width: 14px; height: 14px; accent-color: var(--primary); }
.viewer-btns { display: flex; align-items: center; gap: 6px; }
.zoom-label { font-size: 12px; color: var(--ink-soft); min-width: 44px; text-align: right; font-variant-numeric: tabular-nums; }
.viewport { position: relative; height: 560px; overflow: hidden; background: #eef1f6; cursor: grab; }
.viewport.panning { cursor: grabbing; }
.svg-stage { position: absolute; top: 0; left: 0; transform-origin: 0 0; }

/* ---------- Step 5: output ---------- */
.approve-summary { background: var(--primary-soft); border-radius: var(--radius-sm); padding: 14px 16px; margin-bottom: 18px; font-size: 14px; }
.approve-summary strong { font-weight: 700; }
.output-results { display: grid; grid-template-columns: 1fr 1fr; gap: 22px; margin-top: 22px; align-items: start; }
.output-preview, .output-downloads { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: 18px; box-shadow: var(--shadow); }
.output-preview h3, .output-downloads h3 { margin: 0 0 12px; font-size: 16px; }
.output-preview-img { width: 100%; border-radius: var(--radius-sm); border: 1px solid var(--line-soft); }
.output-links { display: flex; flex-direction: column; gap: 8px; margin: 12px 0 16px; }
.dl-link { display: flex; align-items: center; gap: 10px; padding: 11px 14px; border: 1px solid var(--line); border-radius: var(--radius-sm); text-decoration: none; color: var(--ink); font-weight: 600; font-size: 14px; transition: all .15s; }
.dl-link:hover { border-color: var(--primary); background: var(--primary-soft); }
.dl-icon { font-size: 18px; }
.zip-btn { width: 100%; }

/* ---------- Toasts ---------- */
.toast-stack { position: fixed; top: 16px; right: 16px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: 380px; }
.toast { display: flex; align-items: flex-start; gap: 10px; padding: 12px 14px; border-radius: var(--radius-sm); box-shadow: var(--shadow-lg); font-size: 14px; animation: slidein .2s ease; }
.toast.error { background: var(--danger-soft); color: #8a2a2a; border: 1px solid #f2c4c4; }
.toast.ok { background: var(--ok-soft); color: #17643a; border: 1px solid #bfe3cd; }
.toast.info { background: var(--primary-soft); color: #234; border: 1px solid #c9dcff; }
.toast-close { border: none; background: none; cursor: pointer; font-size: 16px; color: inherit; margin-left: auto; line-height: 1; }
@keyframes slidein { from { opacity: 0; transform: translateX(20px); } }

/* ---------- Modal ---------- */
.modal { position: fixed; inset: 0; z-index: 90; display: flex; align-items: center; justify-content: center; padding: 30px; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(20,30,50,.5); }
.modal-panel { position: relative; background: var(--surface); border-radius: var(--radius); max-width: 720px; width: 100%; max-height: 88vh; display: flex; flex-direction: column; box-shadow: var(--shadow-lg); }
.modal-head { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--line-soft); }
.modal-head h3 { margin: 0; font-size: 17px; }
.modal-close { border: none; background: none; font-size: 24px; cursor: pointer; color: var(--ink-soft); line-height: 1; }
.modal-body { padding: 20px; overflow: auto; }
.modal-body img, .modal-body svg { max-width: 100%; height: auto; }

/* pricing table in modal */
.pricing-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pricing-table th, .pricing-table td { text-align: left; padding: 8px 10px; border-bottom: 1px solid var(--line-soft); vertical-align: top; }
.pricing-table th { color: var(--ink-soft); font-size: 12px; text-transform: uppercase; letter-spacing: .3px; }
.pricing-table td.amt { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; }
.pricing-table .formula { color: var(--ink-faint); font-size: 12px; }
.pricing-summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px,1fr)); gap: 10px; margin-top: 16px; }
.pricing-stat { background: var(--line-soft); border-radius: var(--radius-sm); padding: 10px 12px; }
.pricing-stat .pl { font-size: 11px; color: var(--ink-soft); text-transform: uppercase; letter-spacing: .3px; }
.pricing-stat .pv { font-weight: 800; font-size: 16px; font-variant-numeric: tabular-nums; }

/* ---------- Responsive ---------- */
@media (max-width: 820px) {
  .artwork-grid, .field-grid-2, .field-grid-3, .two-col, .output-results, .check-grid { grid-template-columns: 1fr; }
  .step-label { display: none; }
  .stepper { max-width: 420px; }
}

/* ---------- Phone ----------
 *
 * The app is used on the shop floor on a phone, so this is a first-class
 * layout rather than a shrunk desktop. The header was the worst of it: the
 * title, the job code and two buttons all competed for one line and wrapped
 * into a three-line stack that pushed the work off screen.
 */
/* Phone-sized rules are the base above; these only tune what genuinely
   differs on a small screen. */
@media (max-width: 560px) {
  .page { padding-left: 14px; padding-right: 14px; }
  h1 { font-size: 22px; }
  .stepper { padding: 12px 8px 4px; gap: 2px; }

  .field-row { flex-direction: column; gap: 12px; }
  .blank-head { flex-wrap: wrap; }

  /* Anything tappable clears the 44px minimum — except checkboxes and radios,
     which are sized glyphs; stretching those to 44px left a 70px gap between
     every option in a list. Their labels carry the tap target instead. */
  .btn, .combo-btn, .combo-opt, .unit-btn,
  input:not([type=checkbox]):not([type=radio]):not([type=range]),
  select { min-height: 44px; }
  input:not([type=checkbox]):not([type=radio]):not([type=range]),
  select, .combo-btn, .combo-search { font-size: 16px; }  /* no iOS zoom-on-focus */
  .check-item, .radio-line, .toggle-line { min-height: 40px; }

  /* Four stats side by side get too narrow to read; pair them instead. */
  .cand-figs { grid-template-columns: repeat(2, 1fr); gap: 6px; }
  .cand-figs .fig { padding: 10px 8px; }
  .cand-ups { font-size: 30px; }

  /* An ink row has four controls; side by side they squeeze the name field to
     nothing. Swatch and delete stay on the first line with the name; the hex
     and the usage note wrap under it. */
  .spot-row { gap: 8px; padding: 10px 0; border-bottom: 1px solid var(--line-soft); }
  .spot-row .spot-name { flex: 1 1 60%; min-width: 0; order: 2; }
  .spot-row .swatch { order: 1; }
  .spot-row .btn-remove { order: 3; margin-left: auto; }
  .spot-row .spot-hex { order: 4; flex: 1 1 100%; width: auto; }
  .spot-note { order: 5; }

  .actions, .step-actions { flex-direction: column-reverse; gap: 10px; }
  .actions .btn, .step-actions .btn { width: 100%; }

  .modal { inset: 8px; max-height: calc(100dvh - 16px); }
}

/* ---------- Wider than a phone ---------- */
@media (min-width: 561px) {
  .topbar { padding: 12px 24px; gap: 14px; }
  .app-title { font-size: 16px; font-weight: 700; }
  .job-badge { font-size: 12px; }
  .topbar-right { gap: 8px; }
  .topbar-right .btn { padding: 9px 14px; font-size: 14px; }
  /* Room for the full words again. */
  .label-full { display: inline; }
  .label-short { display: none; }
}

/* Respect a reduced-motion preference. */
@media (prefers-reduced-motion: reduce) {
  * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

/* Layouts step: calm empties + show-more */
.empty-note { grid-column: 1 / -1; padding: 18px; background: var(--surface); border: 1px dashed var(--line-soft); border-radius: var(--radius); color: var(--ink-soft); text-align: center; }
.empty-note.muted { border: none; background: none; font-size: 13px; padding: 8px; }
.show-more { grid-column: 1 / -1; justify-self: center; margin-top: 4px; }

/* Size-only placeholder (files with no renderable artwork) */
.preview-placeholder { text-align: center; padding: 30px 24px; color: var(--ink-soft); }
.preview-placeholder .ph-icon { font-size: 44px; color: var(--ink-faint); }
.preview-placeholder .ph-title { font-weight: 700; font-size: 16px; margin: 8px 0 6px; color: var(--ink); }
.preview-placeholder .ph-sub { font-size: 13px; line-height: 1.5; max-width: 360px; margin: 0 auto; }

/* ---------- Icons ---------- */
.ph { flex: none; vertical-align: -0.15em; }
.btn .ph { margin: 0; }
.dz-icon { color: var(--primary); display: flex; justify-content: center; }
.note-close .ph, .modal-close .ph, .btn-remove .ph { display: block; }

/* ---------- Press & sheet (promoted out of Advanced) ---------- */
.press-block { margin-top: 4px; }
.press-block .block-head {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 12px; flex-wrap: wrap; margin-bottom: 12px;
}
.press-block h4 { margin: 0; font-size: 15px; }
@media (max-width: 560px) {
  /* Two columns of checkboxes are unreadable at this width. */
  .press-block .two-col { display: block; }
  .press-block .two-col > * + * { margin-top: 16px; }
}

@media (max-width: 560px) {
  /* Two columns of checkboxes leave no room for the label on a phone. */
  .check-grid { grid-template-columns: 1fr; gap: 2px; }
  .check-item { padding: 10px 4px; }
}

/* ---------- Layer toggles ----------
   These name the SVG layer groups the sheet exposes (PRINTABLE_AREA,
   REG_MARKS, UP_NUMBERS), so they are shown as the operator would see them
   in Illustrator rather than as sentence text. */
#layer-toggles .check-item span,
#layer-toggles label span {
  text-transform: uppercase;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: .5px;
  color: var(--ink-soft);
}

/* ---------- Full-screen sheet view ----------
   A layout is checked by looking at it, and the inline viewer is a strip.
   This hands the whole window to the imposition; the close control stays in
   the top-right corner where it is expected. */
.modal.modal-full { padding: 0; }
.modal.modal-full .modal-panel {
  width: 100vw; max-width: 100vw;
  height: 100dvh; max-height: 100dvh;
  border-radius: 0;
}
.modal.modal-full .modal-body { flex: 1; min-height: 0; padding: 0; }
.modal.modal-full .fs-sheet {
  width: 100%; height: 100%;
  display: flex; align-items: center; justify-content: center;
  background: var(--bg); padding: 16px;
}
.modal.modal-full .fs-sheet svg { max-width: 100%; max-height: 100%; }
