:root {
  --ink: #292929;
  --ink-2: #4b5259;
  --muted: #75797e;
  --paper: #f7f8f9;
  --paper-2: #f0f1f2;
  --card: #ffffff;
  --line: rgba(41, 41, 41, 0.1);
  --line-strong: rgba(41, 41, 41, 0.18);
  --brand: #c51b1f;
  --brand-deep: #9e1114;
  --pass: #1e9e6a;
  --warn: #b8860b;
  --fail: #c51b1f;
  --font-display: "Lato", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Open Sans", "Helvetica Neue", Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--paper);
  color: var(--ink);
  font-family: var(--font-body);
  min-height: 100dvh;
}

.app {
  min-height: 100dvh;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  grid-template-rows: auto 1fr;
  background: var(--paper);
}
.app.has-cad {
  grid-template-columns: 340px minmax(420px, 1fr) 360px;
}

.top {
  grid-column: 1 / -1;
  grid-row: 1;
  display: flex;
  flex-direction: column;
  padding: 0;
  background: var(--card);
  border-bottom: 1px solid var(--line);
  box-shadow: inset 0 -3px 0 var(--brand);
  overflow: visible;
}
.top-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 32px;
  padding: 22px 36px 18px;
}
.brand {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
}
.brand-lockup {
  display: flex;
  align-items: center;
  gap: 16px;
  min-width: 0;
}
.brand-icon {
  height: 42px;
  width: auto;
  display: block;
  flex: 0 0 auto;
}
.mark {
  width: 16px;
  height: 16px;
  background: var(--brand);
  clip-path: polygon(0 0, 100% 0, 100% 70%, 70% 100%, 0 100%);
}
.kicker {
  margin: 0 0 4px;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  color: var(--brand);
}
h1 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 24px;
  line-height: 1.1;
  font-weight: 800;
  letter-spacing: -0.04em;
}
.site-nav-row {
  display: flex;
  align-items: center;
  gap: 28px;
  flex-wrap: wrap;
}
.site-nav-tagline {
  margin: 0;
  font-family: var(--font-body);
  font-size: 13px;
  line-height: 1.45;
  color: var(--muted);
  max-width: 22rem;
}
.site-nav {
  display: inline-flex;
  gap: 2px;
  margin-top: 0;
  padding: 4px;
  background: var(--paper-2);
  border: 1px solid var(--line);
  border-radius: 999px;
}
.site-nav a {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  text-decoration: none;
  padding: 7px 16px;
  border-radius: 999px;
  background: transparent;
  transition: background 0.15s ease, color 0.15s ease;
}
.site-nav a:hover {
  color: var(--ink);
  background: rgba(255, 255, 255, 0.72);
}
.site-nav a[aria-current="page"] {
  color: #fff;
  background: var(--brand);
  box-shadow: none;
}
.file-label {
  margin: 1px 0 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
}
.promise {
  min-width: 0;
  padding: 14px 36px 16px;
  border-top: 1px solid var(--line);
  background: #fafafa;
  text-align: left;
}
.promise h2 {
  margin: 0;
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.025em;
}
.promise-note {
  margin: 8px 0 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}
.promise-chip {
  margin: 0;
  max-width: 200px;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.35;
  text-align: right;
}
.promise-chip.rapid { border-color: var(--pass); color: var(--pass); }
.promise-chip.hollow { border-color: var(--warn); color: var(--warn); }
.promise-chip.complex { border-color: var(--brand); color: var(--brand); }
.top-right {
  justify-self: end;
  display: flex;
  align-items: center;
  gap: 22px;
}
.unit-switch {
  display: inline-flex;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  overflow: hidden;
  background: var(--paper);
  flex-shrink: 0;
}
.unit-switch-btn {
  appearance: none;
  border: 0;
  margin: 0;
  padding: 6px 12px;
  font: 700 12px/1.2 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  background: transparent;
  cursor: pointer;
}
.unit-switch-btn + .unit-switch-btn {
  border-left: 1px solid var(--line-strong);
}
.unit-switch-btn[aria-pressed="true"] {
  color: var(--ink);
  background: #fff8f8;
  box-shadow: inset 0 -2px 0 var(--brand);
}
.unit-switch-btn:hover {
  color: var(--ink);
}
.csmfg-nav {
  display: flex;
  align-items: center;
  gap: 28px;
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.01em;
  white-space: nowrap;
}
.csmfg-nav > a,
.csmfg-drop-btn {
  color: var(--ink);
  text-decoration: none;
  background: none;
  border: 0;
  padding: 0;
  font: inherit;
  cursor: pointer;
}
.csmfg-nav > a:hover,
.csmfg-drop-btn:hover,
.csmfg-nav > a:focus-visible,
.csmfg-drop-btn:focus-visible {
  color: var(--brand);
}
.csmfg-contact {
  font-weight: 700;
}
.csmfg-drop { position: relative; padding-bottom: 10px; margin-bottom: -10px; }
.csmfg-drop-btn::after {
  content: " ▾";
  font-size: 10px;
}
.csmfg-drop-menu {
  display: none;
  position: absolute;
  top: 100%;
  right: 0;
  min-width: 168px;
  padding: 6px 0;
  background: var(--card);
  border: 1px solid var(--line-strong);
  box-shadow: 0 8px 24px rgba(30, 30, 32, 0.08);
  z-index: 30;
}
.csmfg-drop:hover .csmfg-drop-menu,
.csmfg-drop:focus-within .csmfg-drop-menu {
  display: flex;
  flex-direction: column;
}
.csmfg-drop-menu a {
  padding: 7px 14px;
  color: var(--ink);
  text-decoration: none;
  font-size: 13px;
  font-weight: 600;
}
.csmfg-drop-menu a:hover { background: var(--paper); color: var(--brand); }

.rail {
  grid-column: 1;
  grid-row: 2;
  border-right: 1px solid var(--line);
  padding: 12px 16px 12px 36px;
  overflow: auto;
  display: flex;
  flex-direction: column;
  gap: 22px;
  background: var(--card);
}
.stack { display: flex; flex-direction: column; gap: 16px; }

.drop {
  position: relative;
  display: block;
  border: 1px dashed var(--line-strong);
  padding: 22px 18px;
  cursor: pointer;
  background: var(--paper);
}
.drop input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
}
.drop:hover, .drop.drag { border-color: var(--brand); background: #fff8f8; }
.drop-title { display: block; font-weight: 700; font-family: var(--font-display); }
.drop-help { display: block; margin-top: 6px; color: var(--muted); font-size: 13px; line-height: 1.45; }
.drop.has-file { padding: 10px; }
.drop.has-file .drop-title,
.drop.has-file .drop-help { display: none; }
.drop.has-file::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: 2;
}
.drop-preview {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  pointer-events: none;
}
.drop-preview[hidden] { display: none; }
.drop-preview img,
.drop-preview embed {
  display: block;
  max-width: 100%;
  max-height: 88px;
  width: auto;
  height: auto;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
  pointer-events: none;
}
.drop-preview embed {
  width: 100%;
  height: 88px;
}
.drop-preview img[hidden],
.drop-preview embed[hidden] { display: none; }
.drop-preview-name {
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 700;
  color: var(--ink);
}
.drop-trace-link { margin: 8px 0 0; }

.samples-row {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.samples-row[hidden] {
  display: none !important;
}
.samples-label {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  flex: 0 0 auto;
}
.samples { display: flex; flex-wrap: wrap; gap: 6px; }
.samples button {
  font: 11px/1 var(--font-mono);
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  padding: 7px 8px;
  cursor: pointer;
}
.samples button:hover { border-color: var(--brand); color: var(--brand); }

.stock-profiles {
  margin-top: 12px;
  margin-bottom: 1.6em;
  border: 1px solid #d8c4a8;
  border-radius: 6px;
  background: var(--card);
  overflow: visible;
  position: relative;
  z-index: 6;
}
.stock-profiles:not([open]) {
  overflow: hidden;
}
.stock-profiles > summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  font-size: 13px;
  font-weight: 600;
  color: #6b4f38;
  background: #f0e4d4;
  border-bottom: 1px solid transparent;
  cursor: pointer;
  list-style: none;
}
.stock-profiles[open] > summary {
  border-bottom-color: #dcc9ae;
}
.stock-profiles > summary::-webkit-details-marker { display: none; }
.stock-profiles > summary:hover {
  background: #eadfce;
}
.stock-expand-icon {
  width: 18px;
  height: 18px;
  border: 1px solid #c9ad8a;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.45);
  position: relative;
  flex: 0 0 auto;
}
.stock-expand-icon::before,
.stock-expand-icon::after {
  content: "";
  position: absolute;
  background: #8a6848;
  border-radius: 1px;
}
.stock-expand-icon::before {
  width: 8px;
  height: 1.5px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}
.stock-expand-icon::after {
  width: 1.5px;
  height: 8px;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  transition: transform 0.15s ease;
}
.stock-profiles[open] .stock-expand-icon::after {
  transform: translate(-50%, -50%) scaleY(0);
}
.stock-fields {
  display: grid;
  gap: 12px;
  padding: 14px 12px 10px;
}
.stock-field {
  display: grid;
  gap: 6px;
}
.stock-field-label {
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-mono);
}
.stock-input-wrap { position: relative; z-index: 7; }
.stock-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 8px 10px;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  font: 13px/1.3 var(--font-sans);
}
.stock-dropdown {
  position: absolute;
  z-index: 40;
  top: calc(100% + 4px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 4px 0;
  list-style: none;
  background: #fff;
  border: 1px solid var(--line-strong);
  border-radius: 4px;
  box-shadow: 0 8px 24px rgba(15, 23, 42, 0.12);
  max-height: 220px;
  overflow: auto;
}
.stock-dropdown button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  background: transparent;
  padding: 8px 10px;
  font: 12px/1.35 var(--font-sans);
  cursor: pointer;
}
.stock-dropdown button:hover,
.stock-dropdown button:focus {
  background: rgba(180, 32, 36, 0.08);
  color: var(--brand);
}
.stock-example-line {
  margin: 0;
  font-size: 12px;
  color: var(--muted);
  line-height: 1.45;
}
.stock-example {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  color: var(--brand);
  text-decoration: underline;
  cursor: pointer;
}
.stock-browse {
  border: 0;
  background: none;
  padding: 0;
  font: inherit;
  font-weight: 600;
  color: var(--brand);
  text-decoration: underline;
  cursor: pointer;
}
.stock-browse-dialog {
  border: 0;
  padding: 0;
  max-width: min(560px, calc(100vw - 32px));
  width: 100%;
  background: transparent;
}
.stock-browse-dialog::backdrop {
  background: rgba(28, 26, 22, 0.45);
}
.stock-browse-panel {
  background: var(--paper);
  border: 1px solid var(--line-strong);
  box-shadow: 0 18px 48px rgba(28, 26, 22, 0.22);
  display: flex;
  flex-direction: column;
  max-height: min(72vh, 640px);
}
.stock-browse-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--line);
}
.stock-browse-head h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 650;
  color: var(--ink);
}
.stock-browse-close {
  border: 0;
  background: transparent;
  color: var(--muted);
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
}
.stock-browse-close:hover { color: var(--ink); }
.stock-browse-filter {
  margin: 12px 16px 0;
  box-sizing: border-box;
  width: calc(100% - 32px);
  border: 1px solid var(--line-strong);
  background: #fff;
  color: var(--ink);
  padding: 9px 10px;
  font: 13px var(--font-mono);
}
.stock-browse-count {
  margin: 8px 16px 0;
  font-size: 11px;
  color: var(--muted);
}
.stock-browse-list {
  list-style: none;
  margin: 8px 0 0;
  padding: 0 0 12px;
  overflow: auto;
  flex: 1;
}
.stock-browse-list li { margin: 0; }
.stock-browse-list button {
  display: block;
  width: 100%;
  text-align: left;
  border: 0;
  border-top: 1px solid var(--line);
  background: transparent;
  color: var(--ink);
  padding: 10px 16px;
  font: 13px/1.35 var(--font-mono);
  cursor: pointer;
}
.stock-browse-list button:hover,
.stock-browse-list button:focus {
  background: rgba(180, 32, 36, 0.08);
  color: var(--brand);
}
.stock-browse-empty {
  padding: 24px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 13px;
}
.stock-footnote {
  margin: 0;
  padding: 0 12px 12px;
  font-size: 12px;
  color: #1a5fb4;
}

.optional h2, .metrics h2, .accuracy h2, .viewport header h2, .step h2, .cart-head h2 {
  margin: 0 0 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  font-family: var(--font-mono);
}
.hint { margin: 0 0 12px; color: var(--muted); font-size: 12px; line-height: 1.45; }
.std-line {
  margin: 0 0 6px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
}
.std-line:last-child { margin-bottom: 0; }
.fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 10px;
}
.fields label {
  display: block;
  font-size: 12px;
  line-height: 1.3;
  color: var(--muted);
  min-height: 0;
}
.must { color: var(--brand); font-weight: 700; }
.fields input, .fields select, .fields textarea {
  display: block;
  width: 100%;
  margin-top: 5px;
  box-sizing: border-box;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 8px 9px;
  min-height: 36px;
  font: 13px var(--font-mono);
}
.fields select:disabled {
  opacity: 0.72;
  cursor: not-allowed;
  background: #f0eeea;
}
.fields textarea {
  min-height: 76px;
  resize: vertical;
  line-height: 1.4;
}
.fields small {
  color: var(--muted);
  font-size: 11px;
  line-height: 1.4;
}
.length-cap-note {
  display: block;
  margin-top: 4px;
  color: #9a5b00;
  font-weight: 600;
}
.length-cap-note[hidden] {
  display: none !important;
}
.width-field { position: relative; }
.size-callout {
  position: absolute;
  left: 0;
  right: 0;
  top: -2px;
  bottom: auto;
  z-index: 4;
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0;
  padding: 2px 4px;
  background: rgba(255, 255, 255, 0.82);
  color: var(--brand);
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
  pointer-events: none;
  animation: size-callout-flash 2.3s ease-in-out infinite;
}
.size-callout[hidden] { display: none; }
.size-callout-arrow {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--brand);
}
.width-field.is-pointed input {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px rgba(197, 27, 31, 0.18);
  animation: size-field-flash 2.3s ease-in-out infinite;
}
@keyframes size-callout-flash {
  0%, 100% { opacity: 1; transform: translateY(0); }
  50% { opacity: 0.2; transform: translateY(-3px); }
}
@keyframes size-field-flash {
  0%, 100% { box-shadow: 0 0 0 2px rgba(197, 27, 31, 0.28); }
  50% { box-shadow: 0 0 0 5px rgba(197, 27, 31, 0.04); }
}
@media (prefers-reduced-motion: reduce) {
  .size-callout,
  .width-field.is-pointed input { animation: none; }
}
.fields label.wide { grid-column: 1 / -1; }
.fields label[hidden],
.fields[hidden] { display: none !important; }
.alloy-row {
  grid-template-columns: 1fr 1fr 1fr;
  margin-bottom: 12px;
}
.finish-head select {
  min-width: 9.5rem;
  min-height: 36px;
  padding: 6px 9px;
  font: 13px var(--font-mono);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  flex-shrink: 0;
}
.check {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  font-size: 13px;
  line-height: 1.4;
  cursor: pointer;
}
.check input { margin-top: 2px; }
.check[hidden] { display: none !important; }
.check-err {
  color: var(--fail);
  border: 1px solid color-mix(in srgb, var(--fail) 35%, var(--line));
  background: color-mix(in srgb, var(--fail) 6%, var(--card));
  padding: 10px 12px;
  border-radius: 2px;
}
.signoff-err {
  margin: 8px 0 0;
  color: var(--fail);
  font-size: 13px;
  line-height: 1.45;
}
.ops { display: flex; flex-direction: column; gap: 8px; margin-bottom: 12px; }
.step { padding-bottom: 4px; border-bottom: 1px solid var(--line); }
.machining-op { display: flex; flex-direction: column; gap: 10px; }
.machining-side-holes { margin-bottom: 12px; }
.machining-side-holes dl { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
.machining-side-holes dt { font-weight: 600; color: var(--muted); }
.machining-side-holes dd { margin: 0; }
.machining-side-holes dd.machining-detected { color: #1d6fd4; font-weight: 600; }
.machining-cut-label { margin: 0 0 4px; font-weight: 600; }
.machining-fields { padding-left: 2px; }
.machining-fields .fields { margin-top: 4px; }
.machining-fields .apply-dfm { margin-top: 4px; width: 100%; }
.machining-fields .apply-dfm:disabled { opacity: 0.45; cursor: not-allowed; }
.end-tap-list { display: flex; flex-direction: column; gap: 8px; margin-top: 4px; }
.end-tap-row { display: flex; gap: 8px; align-items: center; }
.end-tap-row input { flex: 1; min-width: 0; }
.end-tap-action {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--surface);
  color: var(--text);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
}
.end-tap-add:hover { border-color: var(--accent, #1d6fd4); color: var(--accent, #1d6fd4); }
.end-tap-remove:hover { border-color: var(--fail); color: var(--fail); }
.machining-end-tap-note { margin-top: 8px; }
.step-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.step-head h2 { margin: 0; }
.step-head .unit-switch {
  flex-shrink: 0;
}
.step-link {
  font-size: 12px;
  color: var(--brand);
  text-decoration: none;
  white-space: nowrap;
  flex-shrink: 0;
}
.step-link:hover { text-decoration: underline; }
.rev-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.rev-list li { font-size: 12px; line-height: 1.45; padding-left: 10px; border-left: 2px solid var(--line-strong); }
.rev-list li.ok, .rev-list li.pass { border-color: var(--pass); }
.rev-list li.fail, .rev-list li.revise, .rev-list li.review { border-color: var(--warn); }
.rev-list li.process { border-color: var(--brand); }
.dfm-details > summary {
  cursor: pointer;
  list-style: none;
}
.dfm-details > summary::-webkit-details-marker { display: none; }
.dfm-details > summary h2 { display: inline; margin: 0; }
.dfm-details .dfm-hint {
  margin-left: 8px;
  font-size: 11px;
  color: var(--muted);
  font-weight: 400;
  text-transform: none;
  letter-spacing: 0;
}
.dfm-details .dfm-hint.warn-count {
  color: var(--fail);
  font-weight: 700;
}
.dfm-details #dfmChecks { margin: 8px 0 10px; }
.dfm-submit-note { margin: 10px 0 0; }
.fields input[readonly] {
  background: #f3f4f6;
  color: var(--ink);
  cursor: default;
}
.apply-dfm {
  margin-top: 10px;
  font: 700 12px/1 var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand);
  border: 0;
  padding: 10px 12px;
  cursor: pointer;
}
.apply-dfm[hidden] { display: none; }
.apply-dfm + .apply-dfm { margin-top: 6px; }

.metrics dl {
  margin: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px 16px;
}
.metrics dt { font-size: 11px; color: var(--muted); }
.metrics dd {
  margin: 3px 0 0;
  font-family: var(--font-mono);
  font-size: 15px;
}

.acc-summary { margin: 0 0 10px; font-size: 13px; }
.accuracy ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.accuracy li {
  border-top: 1px solid var(--line);
  padding-top: 8px;
  font-size: 12px;
}
.accuracy .lab { display: flex; justify-content: space-between; gap: 8px; font-family: var(--font-mono); }
.accuracy .detail { color: var(--muted); margin-top: 4px; line-height: 1.4; }
.badge { text-transform: uppercase; letter-spacing: 0.08em; }
.badge.pass { color: var(--pass); }
.badge.warn { color: var(--warn); }
.badge.fail { color: var(--fail); }

.needs-cad { display: contents; }
.app:not(.has-cad) .needs-cad { display: none; }

.stage {
  grid-column: 2;
  grid-row: 2;
  display: flex;
  flex-direction: column;
  min-width: 0;
  min-height: 0;
  height: 100%;
  width: 100%;
  background: var(--card);
  border-right: 1px solid var(--line);
}
.page-gutter,
.cart {
  grid-column: 3;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--paper);
  border-left: 1px solid var(--line);
  padding: 18px 18px 28px;
  display: none;
  flex-direction: column;
  gap: 14px;
}
.app.has-cad .cart { display: flex; }
.app.checkout-open.has-cad .cart { display: none; }
.checkout {
  grid-column: 3;
  grid-row: 2;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  background: var(--paper);
  border-left: 1px solid var(--line);
  padding: 18px 18px 28px;
  display: none;
  flex-direction: column;
  gap: 14px;
}
.app.checkout-open.has-cad .checkout { display: flex; }
.checkout-steps {
  display: flex;
  gap: 0;
  margin: 0;
  padding: 0;
  list-style: none;
  border: 1px solid var(--line);
  background: var(--card);
}
.checkout-steps li {
  flex: 1;
  padding: 8px 6px;
  text-align: center;
  font: 10px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
  border-right: 1px solid var(--line);
  cursor: pointer;
  user-select: none;
}
.checkout-steps li:hover { background: #fff8f8; color: var(--ink); }
.checkout-steps li:last-child { border-right: 0; }
.checkout-steps li.on { color: var(--ink); font-weight: 600; background: #fff8f8; }
.checkout-steps li.done { color: var(--pass); }
.checkout-err {
  margin: 0;
  color: var(--fail);
  font-size: 12px;
  line-height: 1.4;
}
.checkout-ok {
  margin: 0;
  font-size: 14px;
  line-height: 1.45;
}
.pay-success-kicker {
  margin: 0 0 10px;
  font-family: var(--font-display, inherit);
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--pass, #24613f);
}
.pay-success .checkout-ok {
  margin-bottom: 10px;
}
.pay-success .rate-note {
  margin: 0 0 14px;
}
.checkout-nav {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 16px;
}
.checkout-nav--row {
  flex-direction: row;
  align-items: stretch;
  gap: 12px;
}
.checkout-nav--row .ghost-btn,
.checkout-nav--row .add-btn {
  flex: 1;
  margin: 0;
}
.ghost-btn {
  font: 700 13px/1.2 var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  padding: 13px 16px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
}
.cart-sum {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 13px;
  display: flex;
  justify-content: space-between;
}
.cart-head h2 {
  margin: 2px 0 0;
  font-family: var(--font-display);
  font-size: 20px;
  color: var(--ink);
  letter-spacing: -0.03em;
  text-transform: none;
}
.cart-sla {
  margin: 0;
  font-size: 13px;
  line-height: 1.45;
}
.rate-note {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
}
.clock {
  margin: 0;
  padding: 0 0 0 18px;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.quote-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  background: var(--card);
  border: 1px solid var(--line);
}
.quote-lines li {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 4px 12px;
  padding: 8px 10px;
  border-top: 1px solid var(--line);
  font-size: 12px;
}
.quote-lines li:first-child { border-top: 0; }
.quote-lines li.off { opacity: 0.45; }
.quote-lines .qlabel { font-weight: 600; }
.quote-lines .qamt { font-family: var(--font-mono); }
.quote-lines .qdrv { grid-column: 1 / -1; color: var(--muted); font-family: var(--font-mono); font-size: 11px; }
.quote-total {
  margin: 0;
  padding: 10px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  font-family: var(--font-mono);
  font-size: 14px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.quote-total .tot-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 12px;
}
.quote-total .tot-includes,
.quote-total .tot-drop {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
  font-weight: 400;
}
.add-btn {
  font: 700 13px/1.25 var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #fff;
  background: var(--brand);
  border: 0;
  padding: 12px 14px;
  cursor: pointer;
  text-align: center;
  text-decoration: none;
  display: block;
}
.add-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.save-to-cart-wrap {
  margin-top: 4px;
  padding-top: 12px;
  border-top: 1px solid var(--line);
}
.save-to-cart-wrap .add-btn { width: 100%; }
.cart-head:focus {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
}
.cart-head.is-target {
  outline: 2px solid var(--brand);
  outline-offset: 3px;
  background: #fff8f8;
}
.contact-first {
  margin: 0;
  text-align: center;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.cart-volume-note {
  margin: 0 0 10px;
  color: #1a5fb4;
  font-size: 13px;
  line-height: 1.5;
}
.cart-volume-note a {
  color: #1a5fb4;
  font-weight: 700;
}
.cart-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.cart-line-detail {
  display: block;
  margin-top: 2px;
  font-size: 0.85em;
  color: var(--muted, #64748b);
  line-height: 1.35;
}

.cart-items li {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 10px;
  font-size: 12px;
  line-height: 1.4;
}
.cart-items button {
  margin-top: 6px;
  font: 11px var(--font-mono);
  background: none;
  border: 0;
  color: var(--brand);
  cursor: pointer;
  padding: 0;
}
.cart-items .remove-line {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.cart-items .remove-line svg {
  width: 13px;
  height: 13px;
}
.viewport {
  display: flex;
  flex-direction: column;
  flex: 1;
  min-height: 0;
  height: 100%;
}
.viewport header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px 16px;
  padding: 6px 12px;
  border-bottom: 1px solid var(--line);
  background: var(--card);
}
.viewport header h2 { margin: 0; }
.viewport header p {
  margin: 0;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  text-align: right;
}
.cad-file {
  margin: 8px 0 0;
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--ink);
  font-weight: 500;
  word-break: break-all;
}
.stock-badge {
  margin: 6px 0 0;
  padding: 6px 10px;
  border: 1px solid #c8e6c9;
  border-radius: 6px;
  background: #f1f8f2;
  color: #1b5e20;
  font: 600 12px/1.35 var(--font-display);
}
.stock-badge[hidden] { display: none !important; }

.view-toggle {
  display: flex;
  border: 1px solid var(--line-strong);
  background: var(--paper);
}
.view-toggle button {
  font: 12px/1 var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink-2);
  background: transparent;
  border: 0;
  padding: 8px 12px;
  cursor: pointer;
}
.view-toggle button.active {
  background: var(--brand);
  color: #fff;
}
.side-turn {
  display: flex;
  align-items: center;
  gap: 8px;
}
.side-turn[hidden] { display: none; }
.side-turn button {
  font: 12px/1 var(--font-display);
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--paper);
  border: 1px solid var(--line-strong);
  padding: 8px 10px;
  cursor: pointer;
}
.side-turn button:hover { border-color: var(--brand); color: var(--brand); }
.side-turn span {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink);
  min-width: 9em;
}
#isoMount { cursor: grab; }
#isoMount.is-spinning { cursor: grabbing; }
.cad-zoom {
  display: flex;
  margin-left: auto;
  border: 1px solid var(--line-strong);
}
.cad-zoom button {
  width: 34px;
  height: 32px;
  font: 700 18px/1 var(--font-display);
  color: var(--ink);
  background: var(--paper);
  border: 0;
  border-right: 1px solid var(--line-strong);
  cursor: pointer;
}
.cad-zoom button:last-child { border-right: 0; }
.cad-zoom #clearCad {
  width: auto;
  padding: 0 10px;
  font: 600 11px/1 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.cad-zoom button:hover { color: var(--brand); background: #fff; }

.canvas-stack {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  height: 100%;
  background: #f7f8f9;
}

.cad-sticky {
  position: absolute;
  z-index: 4;
  top: 50%;
  left: 50%;
  width: min(272px, calc(100% - 48px));
  margin: 0;
  padding: 10px 10px 13px;
  border: 0;
  appearance: none;
  cursor: pointer;
  text-align: left;
  color: #2a2926;
  background:
    repeating-linear-gradient(
      0deg,
      transparent,
      transparent 13px,
      rgba(40, 38, 34, 0.03) 14px
    ),
    linear-gradient(180deg, #f8f6f1 0%, #ebe6d8 100%);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 14px 32px rgba(28, 26, 22, 0.16);
  transform: translate(-50%, -52%) rotate(-2.2deg);
  transform-origin: 50% 0;
  transition: transform 0.22s ease, box-shadow 0.22s ease;
}
.cad-sticky:hover,
.cad-sticky:focus-visible {
  transform: translate(-50%, -54%) rotate(-0.3deg);
  box-shadow:
    0 1px 0 rgba(255, 255, 255, 0.8) inset,
    0 18px 40px rgba(28, 26, 22, 0.2);
  outline: none;
}
.cad-sticky:focus-visible {
  box-shadow:
    0 0 0 3px rgba(197, 27, 31, 0.28),
    0 1px 0 rgba(255, 255, 255, 0.7) inset,
    0 18px 40px rgba(28, 26, 22, 0.2);
}
.cad-sticky-tape {
  position: absolute;
  top: -9px;
  left: 50%;
  width: 74px;
  height: 18px;
  margin-left: -37px;
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.22),
    rgba(255, 255, 255, 0.42) 42%,
    rgba(255, 255, 255, 0.16)
  );
  border: 1px solid rgba(255, 255, 255, 0.4);
  transform: rotate(2.5deg);
  box-shadow: 0 1px 2px rgba(28, 26, 22, 0.1);
  pointer-events: none;
}
.cad-sticky img {
  display: block;
  width: 100%;
  height: 134px;
  object-fit: cover;
  object-position: 50% 42%;
  background: #d4d2ce;
  box-shadow: 0 0 0 1px rgba(28, 26, 22, 0.08);
}
.cad-sticky-body {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 4px 1px;
}
.cad-sticky-kicker {
  font: 700 10px/1 var(--font-display);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
}
.cad-sticky-cta {
  font: 700 13px/1.3 var(--font-display);
  color: var(--brand);
}
.app.has-cad .cad-sticky {
  display: none;
}
.cad-sticky[hidden] {
  display: none !important;
}
.cad-busy {
  position: absolute;
  inset: 0;
  z-index: 5;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, #f7f8f9 72%, transparent);
  backdrop-filter: blur(1.5px);
  pointer-events: none;
}
.cad-busy[hidden] {
  display: none !important;
}
.cad-busy-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  border-radius: 12px;
  border: 1px solid var(--line);
  background: var(--card, #fff);
  box-shadow: 0 10px 30px rgba(20, 28, 24, 0.12);
  pointer-events: none;
}
.cad-busy-card p {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}
.cad-busy-spinner {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid color-mix(in srgb, var(--brand) 25%, #fff);
  border-top-color: var(--brand);
  animation: cad-busy-spin 0.7s linear infinite;
}
@keyframes cad-busy-spin {
  to { transform: rotate(360deg); }
}
.canvas-wrap {
  position: absolute;
  inset: 0;
  overflow: hidden;
}
.canvas-wrap:not(.active) {
  visibility: hidden;
  pointer-events: none;
}
.canvas-wrap canvas,
.canvas-wrap .css2d {
  position: absolute;
  inset: 0;
  display: block;
  width: 100% !important;
  height: 100% !important;
}

.dim-label {
  font: 500 12px/1 var(--font-mono);
  color: var(--ink);
  background: transparent;
  border: 0;
  padding: 0;
  white-space: nowrap;
  pointer-events: none;
}
.dim-label span {
  position: relative;
  top: -0.95em;
}

.status {
  position: fixed;
  right: 20px;
  bottom: 16px;
  margin: 0;
  padding: 8px 12px;
  background: var(--card);
  border: 1px solid var(--line-strong);
  font-size: 12px;
  box-shadow: 0 8px 24px rgba(30, 30, 32, 0.08);
}

@media (max-width: 1100px) {
  .app, .app.has-cad { grid-template-columns: 1fr; grid-template-rows: auto; }
  .stage { grid-column: auto; grid-row: auto; min-height: 50dvh; height: 50dvh; border-right: 0; }
  .cad-sticky {
    width: min(224px, calc(100% - 32px));
    padding: 8px 8px 10px;
  }
  .cad-sticky img { height: 90px; }
  .cart { grid-column: auto; grid-row: auto; border-left: 0; border-top: 1px solid var(--line); }
  .page-gutter { display: none; }
  .rail { grid-column: auto; grid-row: auto; border-right: 0; border-bottom: 1px solid var(--line); }
  .top-bar { flex-wrap: wrap; padding: 16px 20px 14px; gap: 16px; }
  .promise { padding: 12px 20px 14px; }
  .top-right { justify-self: start; }
  .promise-chip { text-align: left; max-width: none; }
}

.cart-page {
  min-height: 100dvh;
  background: var(--paper);
}
.cart-page-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 32px 28px 56px;
}
.order-layout {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 340px;
  gap: 28px;
  align-items: start;
}
.order-panel-head h2 {
  font-size: 28px;
  margin-top: 0;
}
.cart-page .order-panel-head {
  cursor: default;
  pointer-events: none;
  user-select: text;
}
.cart-page .order-panel-head:focus,
.cart-page .order-panel-head.is-target {
  outline: none;
  background: transparent;
}
.checkout-head h2 {
  margin-top: 0;
}
.cart-page .cart,
.cart-page .checkout {
  grid-column: auto;
  grid-row: auto;
  border: 0;
  padding: 0;
  overflow: visible;
  background: transparent;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.cart-page .checkout,
.cart-page .checkout[hidden] { display: none; }
.cart-page.checkout-open .order-shell { display: none; }
.cart-page.checkout-open .checkout { display: flex; }
.order-summary-card {
  position: sticky;
  top: 24px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 24px;
  display: flex;
  flex-direction: column;
  gap: 20px;
  box-shadow: 0 8px 24px rgba(30, 30, 32, 0.06);
}
.order-summary-title {
  margin: 0;
  font: 700 13px/1.2 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.order-total {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 0 0 4px;
  border-bottom: 1px solid var(--line);
}
.order-total-label {
  font: 12px/1.3 var(--font-body);
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.order-total-amount {
  font: 800 32px/1.1 var(--font-display);
  color: var(--ink);
  letter-spacing: -0.02em;
}
.pay-scope {
  margin: 0;
  padding: 0;
  border: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.pay-scope-legend {
  margin: 0 0 4px;
  padding: 0;
  font: 700 12px/1.3 var(--font-mono);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}
.pay-scope-option {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  gap: 10px;
  align-items: start;
  padding: 12px;
  border: 1px solid var(--line-strong);
  border-radius: 6px;
  background: var(--paper);
  cursor: pointer;
}
.pay-scope-option[hidden] { display: none !important; }
.pay-scope-option:has(input:checked) {
  border-color: var(--brand);
  background: #fff8f8;
  box-shadow: inset 3px 0 0 var(--brand);
}
.pay-scope-option input {
  margin-top: 3px;
}
.pay-scope-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.pay-scope-copy strong {
  font: 700 14px/1.3 var(--font-display);
  color: var(--ink);
}
.pay-scope-copy small {
  font-size: 12px;
  line-height: 1.4;
  color: var(--muted);
}
.pay-scope-price {
  font: 700 14px/1.2 var(--font-mono);
  color: var(--ink);
  white-space: nowrap;
}
.cart-page .cart-actions {
  flex-direction: column;
  margin-top: 0;
}
.cart-page .cart-actions .ghost-btn,
.cart-page .cart-actions .add-btn {
  flex: none;
  width: 100%;
}
.cart-page .order-lines {
  gap: 14px;
}
.cart-page .order-line {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 16px;
  align-items: start;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 22px 24px;
  font-size: 14px;
  line-height: 1.5;
  box-shadow: 0 4px 14px rgba(30, 30, 32, 0.04);
}
.order-line-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 8px;
}
.order-line-name {
  font: 700 17px/1.3 var(--font-display);
  color: var(--ink);
  word-break: break-word;
}
.order-line-price {
  font: 700 18px/1.2 var(--font-mono);
  color: var(--ink);
  white-space: nowrap;
}
.order-line-spec {
  margin: 0 0 10px;
  font-size: 14px;
  color: var(--muted);
}
.order-line-sla {
  margin: 12px 0 0;
  font: 600 12px/1.3 var(--font-mono);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pass);
}
.order-line-extras {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.order-line-extra {
  font-size: 13px;
  line-height: 1.45;
}
.order-line-extra-label {
  font: 600 11px/1.2 var(--font-mono);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-right: 6px;
}
.cart-page .cart-line-detail {
  display: block;
  margin-top: 4px;
  font-size: 12px;
}
.cart-page .remove-line {
  margin-top: 2px;
  font: 600 12px/1 var(--font-body);
  background: none;
  border: 0;
  color: var(--brand);
  cursor: pointer;
  padding: 4px 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
}
.cart-page .remove-line svg {
  width: 14px;
  height: 14px;
}
.cart-empty {
  margin: 0;
  padding: 28px 24px;
  background: var(--card);
  border: 1px solid var(--line);
  font-size: 15px;
  line-height: 1.55;
  text-align: center;
}
.cart-empty a { color: var(--brand); font-weight: 700; }
.cart-placed-link {
  margin: 0 0 10px;
  font-size: 14px;
}
.cart-placed-link a { color: var(--brand); font-weight: 700; }
.cart-back-workbench { margin-top: 0; }
.cart-page .cart-volume-note {
  margin: 0;
  padding: 14px 16px;
  background: #f0f6ff;
  border: 1px solid #c8daf4;
  color: var(--ink);
  font-size: 14px;
  line-height: 1.55;
}
.cart-page .cart-volume-note a {
  color: #1a5fb4;
  font-weight: 700;
}
@media (max-width: 860px) {
  .cart-page-main {
    padding: 24px 16px 40px;
  }
  .order-layout {
    grid-template-columns: 1fr;
  }
  .order-summary-card {
    position: static;
  }
  .order-line-head {
    flex-direction: column;
    gap: 6px;
  }
  .order-line-price {
    font-size: 20px;
  }
}
.signoff-spec {
  margin: 8px 0 0;
  padding: 0 0 0 18px;
  font: 400 13px/1.45 var(--font-body);
  color: var(--ink);
}
.signoff-spec li { margin: 2px 0; }

.signoff-line {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font: 400 13px/1.45 var(--font-body);
  color: var(--ink);
}
.signoff-line strong {
  font-weight: 600;
  font-size: 13px;
  font-family: var(--font-body);
}
.checkout-pane[data-pane="signoff"] {
  font: 400 13px/1.45 var(--font-body);
  color: var(--ink);
}
.checkout-pane[data-pane="signoff"] > .hint {
  font: 400 13px/1.45 var(--font-body);
  color: var(--muted);
}
.signoff-notes-field {
  display: block;
  margin-top: 12px;
  font: 400 13px/1.45 var(--font-body);
  color: var(--ink);
}
.signoff-notes-field textarea {
  width: 100%;
  min-height: 96px;
  margin-top: 6px;
  resize: vertical;
  font: 400 13px/1.45 var(--font-body);
  color: var(--ink);
}
.checkout-pane[data-pane="signoff"] .check {
  margin-top: 12px;
  font: 400 13px/1.45 var(--font-body);
  color: var(--ink);
}
.signoff-preview {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 8px;
  padding: 10px;
  background: var(--paper);
  border: 1px solid var(--line);
}
.signoff-caption {
  margin: 0;
  font: 400 13px/1.45 var(--font-body);
  color: var(--ink);
  letter-spacing: normal;
  text-transform: none;
}
.signoff-svg {
  display: flex;
  justify-content: center;
  background: #fff;
  border: 1px solid var(--line);
  padding: 8px;
}
.signoff-svg svg { max-width: 100%; height: auto; }
.signoff-img {
  display: block;
  max-width: 100%;
  max-height: 280px;
  margin: 0 auto;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
}
.signoff-pdf {
  display: block;
  width: 100%;
  height: 280px;
  background: #fff;
  border: 1px solid var(--line);
}
.signoff-notes {
  margin: 0;
  padding: 0 0 0 18px;
  font: 400 13px/1.45 var(--font-body);
  color: var(--ink);
}
.signoff-notes li { margin: 2px 0; }
.checkout-pane[data-pane="signoff"] .cart-items li {
  font: 400 13px/1.45 var(--font-body);
}

.freight-box {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 6px;
  padding: 16px 16px 14px;
  background: #fff;
  border: 1px solid var(--line-strong);
  box-shadow: 0 10px 28px rgba(30, 30, 32, 0.06);
}
.freight-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--line);
}
.freight-head h3 {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 16px;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--ink);
  text-transform: none;
}
.freight-meta {
  margin: 0;
  font-size: 12px;
  line-height: 1.45;
  color: var(--muted);
}
.freight-zone {
  flex: 0 0 auto;
  padding: 5px 9px;
  background: #fff4f4;
  color: var(--brand);
  font: 700 11px/1 var(--font-display);
  letter-spacing: 0.08em;
  text-transform: uppercase;
}
.freight-options {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.freight-option {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 12px 14px;
  background: var(--paper);
  border: 1px solid var(--line);
  cursor: pointer;
}
.freight-option:has(input:checked) {
  border-color: var(--brand);
  background: #fff8f8;
  box-shadow: inset 3px 0 0 var(--brand);
}
.freight-option.is-ref {
  opacity: 0.72;
  cursor: default;
}
.freight-option input {
  margin: 0;
  flex: 0 0 auto;
}
.freight-copy {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.freight-copy strong {
  font-size: 14px;
  color: var(--ink);
}
.freight-transit,
.freight-note {
  font-size: 12px;
  color: var(--muted);
}
.freight-duty {
  display: inline-block;
  margin-top: 4px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: #0d5c42;
  background: #d8f3e8;
}
.freight-retainer-note {
  margin: 0;
  padding: 12px;
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink-2);
  background: var(--paper);
  border: 1px dashed var(--line-strong);
  border-radius: 6px;
  list-style: none;
}
.freight-price {
  margin-left: auto;
  font-family: var(--font-display);
  font-size: 20px;
  font-weight: 800;
  letter-spacing: -0.03em;
  color: var(--ink);
  white-space: nowrap;
}

.dash {
  min-height: 100dvh;
  background: var(--paper);
}
.dash-main {
  max-width: 1080px;
  margin: 0 auto;
  padding: 24px 20px 48px;
}
.dash-stats {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 20px;
}
.admin-dash .dash-stats {
  grid-template-columns: repeat(4, minmax(0, 1fr));
}
.admin-token-field {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 11px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}
.admin-token-field input {
  min-width: 140px;
  padding: 6px 8px;
  border: 1px solid var(--line);
  background: var(--card);
  font-family: var(--font-mono);
  font-size: 13px;
  text-transform: none;
  letter-spacing: 0;
  color: var(--ink);
}
.admin-auth-hint {
  margin: 0 0 16px;
}
.admin-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-bottom: 14px;
}
.admin-tab {
  border: 1px solid var(--line);
  background: var(--card);
  color: var(--ink);
  padding: 8px 12px;
  font-size: 13px;
  cursor: pointer;
}
.admin-tab[aria-selected="true"] {
  border-color: var(--brand);
  color: var(--brand);
  font-weight: 600;
}
.admin-table-wrap {
  overflow-x: auto;
  border: 1px solid var(--line);
  background: var(--card);
}
.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.admin-table th,
.admin-table td {
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  vertical-align: top;
}
.admin-table th {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  background: color-mix(in srgb, var(--paper) 80%, var(--card));
}
.admin-table td:nth-child(3),
.admin-table td:nth-child(4),
.admin-table td:nth-child(5) {
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.pay-modal {
  border: none;
  padding: 0;
  background: transparent;
  max-width: calc(100vw - 24px);
}
.pay-modal::backdrop {
  background: rgba(20, 28, 24, 0.55);
}
.pay-modal-card {
  position: relative;
  width: min(520px, calc(100vw - 24px));
  margin: auto;
  background: var(--card, #fff);
  border: 1px solid var(--line);
  border-radius: 16px;
  padding: 28px 24px 22px;
  box-shadow: 0 18px 60px rgba(20, 53, 42, 0.18);
}
.pay-modal-close {
  position: absolute;
  top: 10px;
  right: 12px;
  border: 0;
  background: transparent;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: var(--muted);
}
.pay-modal h3 {
  margin: 0 0 12px;
  font-size: 22px;
  letter-spacing: -0.02em;
}
.pay-modal-lead {
  margin: 0 0 10px;
  line-height: 1.5;
  color: var(--ink);
}
.pay-modal-email {
  margin: 16px 0 20px;
  padding: 12px 14px;
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
  border-radius: 10px;
  line-height: 1.45;
}
.pay-modal-email strong {
  word-break: break-all;
}
.pay-modal-summary {
  background: color-mix(in srgb, var(--brand) 8%, var(--card));
  border-radius: 10px;
  padding: 14px 16px;
  margin: 16px 0 18px;
}
.pay-modal-summary strong {
  display: block;
  margin-bottom: 4px;
}
.pay-modal-start,
.pay-modal-actions .add-btn {
  width: 100%;
}
.pay-modal-error {
  min-height: 1.2em;
  margin: 12px 0 0;
  color: var(--fail, #b42318);
  font-size: 13px;
}
.pay-modal-status {
  min-height: 1.2em;
  margin: 8px 0 0;
  color: var(--pass, #24613f);
  font-size: 13px;
  font-weight: 600;
}
.pay-waiting {
  margin: 12px 0 0;
  padding: 12px 14px;
  border-radius: 10px;
  background: color-mix(in srgb, var(--brand) 10%, var(--card, #fff));
  border: 1px solid color-mix(in srgb, var(--brand) 28%, var(--line));
  color: var(--ink);
  font-size: 13px;
  line-height: 1.45;
  font-weight: 600;
}
.pay-waiting.is-error {
  background: color-mix(in srgb, var(--fail, #b42318) 8%, var(--card, #fff));
  border-color: color-mix(in srgb, var(--fail, #b42318) 35%, var(--line));
  color: var(--fail, #b42318);
  font-weight: 500;
}
.pay-waiting[hidden] {
  display: none !important;
}
.pay-waiting a.pay-popup-link {
  color: var(--brand, #1d6fd4);
  font-weight: 600;
  text-decoration: underline;
}
.pay-confirm-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 12px 18px;
  margin: 12px 0 0;
}
.pay-confirm-row[hidden] {
  display: none !important;
}
.pay-confirm-row .pay-popup-link {
  color: var(--brand, #1d6fd4);
  font-size: 13px;
  font-weight: 600;
}
.square-card-wrap {
  margin: 14px 0 4px;
  display: grid;
  gap: 12px;
}
.square-card-wrap[hidden] {
  display: none !important;
}
.billing-box {
  display: grid;
  gap: 10px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card, #fff) 94%, #eef2f6);
}
.billing-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
}
.billing-fields {
  margin-top: 2px;
}
.billing-fields.is-locked input,
.billing-fields.is-locked select {
  opacity: 0.85;
}
.square-card-container {
  min-height: 90px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: color-mix(in srgb, var(--card, #fff) 92%, #f3f5f8);
}
#squarePayBtn {
  justify-self: start;
  min-width: 180px;
}
#squarePayBtn:disabled {
  opacity: 0.65;
  cursor: wait;
}
.dash-stat {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 14px 16px;
}
.dash-stat span {
  display: block;
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
}
.dash-stat strong {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 800;
}
.dash-list { display: flex; flex-direction: column; gap: 12px; }
.dash-email {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
  background: var(--card);
  border: 1px solid var(--line);
  padding: 12px 16px;
  margin-bottom: 12px;
}
.dash-email label {
  font-size: 13px;
  font-weight: 600;
  color: var(--muted);
}
.dash-email input[type="email"] {
  flex: 1 1 220px;
  min-width: 180px;
  max-width: 360px;
  background: var(--paper);
  border: 1px solid var(--line-strong);
  color: var(--ink);
  padding: 8px 9px;
  min-height: 36px;
  font: 13px var(--font-mono);
}
.dash-email button {
  display: inline-block;
  width: auto;
  padding: 10px 14px;
}
.dash-empty {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 28px 20px;
  color: var(--muted);
  font-size: 14px;
}
.dash-order {
  background: var(--card);
  border: 1px solid var(--line);
  padding: 0;
}
.dash-order.on { border-color: var(--brand); }
.dash-order summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 8px 16px;
}
.dash-order summary::-webkit-details-marker { display: none; }
.dash-order .oid {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
}
.dash-order .ototal {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 500;
  text-align: right;
}
.dash-order .ometa {
  grid-column: 1 / -1;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.45;
}
.dash-body {
  padding: 0 16px 16px;
  border-top: 1px solid var(--line);
}
.dash-body h3 {
  margin: 16px 0 8px;
  font-size: 11px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--muted);
  font-family: var(--font-mono);
}
.dash-dl {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 6px 12px;
  font-size: 13px;
  line-height: 1.45;
  margin: 0;
}
.dash-dl dt { color: var(--muted); }
.dash-dl dd { margin: 0; }
.dash-line {
  margin-top: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.drop-help a, .drop-trace-link a { color: var(--brand); font-weight: 700; }
.trace-app .stage {
  border-left: 1px solid var(--line);
  overflow: auto;
}
.trace-app .status {
  position: static;
  right: auto;
  bottom: auto;
  margin-top: 10px;
  width: 100%;
  box-shadow: none;
  line-height: 1.45;
}
.trace-app .status.is-error {
  border-color: rgba(197, 27, 31, 0.35);
  background: #fff5f5;
  color: var(--fail);
}
.trace-app .status.is-ok {
  border-color: rgba(30, 158, 106, 0.35);
  background: #f3fbf7;
  color: var(--pass);
}
.trace-app .drop.needs-attention,
.trace-app input.needs-attention {
  border-color: var(--fail);
  box-shadow: 0 0 0 1px rgba(197, 27, 31, 0.18);
}
.trace-guide {
  margin: 16px 16px 0;
  padding: 14px 16px 16px;
  background: var(--card);
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  gap: 16px;
}
.trace-guide > p {
  margin: 0;
  flex: 0 1 42rem;
  max-width: 42rem;
  font-size: 14px;
  line-height: 1.5;
  color: var(--ink);
}
.trace-guide-grid {
  display: grid;
  flex: 0 0 auto;
  width: min(25%, 220px);
  min-width: 140px;
}
.trace-guide-card {
  margin: 0;
  padding: 5px;
  border: 1px solid var(--line);
  background: var(--paper);
}
.trace-guide-card figcaption {
  margin: 0 0 4px;
  font-family: var(--font-display);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.02em;
  text-transform: uppercase;
}
.trace-guide-card.is-good figcaption { color: var(--pass); }
.trace-guide-card img {
  display: block;
  width: 100%;
  object-fit: contain;
  background: #fff;
  border: 1px solid var(--line);
}
.trace-guide-card.is-good img {
  width: 100%;
  height: auto;
  max-height: 68px;
  margin-inline: auto;
}
.trace-preview-wrap {
  position: relative;
  min-height: 520px;
  background: var(--paper);
  border: 1px solid var(--line);
  display: flex;
  flex-direction: column;
}
.trace-preview-wrap canvas,
.trace-preview-wrap img {
  width: 100%;
  height: auto;
  display: block;
  background: var(--paper);
}
.trace-preview-wrap img[hidden],
.trace-preview-wrap canvas[hidden] { display: none; }
.trace-preview-wrap .hint,
.trace-preview-wrap .trace-production-note { padding: 0 12px 12px; }
.trace-preview-overlay {
  position: absolute;
  inset: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0;
  padding: 18px 24px;
  border-radius: 8px;
  font-size: clamp(18px, 2.2vw, 26px);
  font-weight: 700;
  line-height: 1.35;
  text-align: center;
  pointer-events: none;
}
.trace-preview-overlay[hidden] {
  display: none !important;
}
.trace-preview-overlay.is-processing {
  color: #8a4b00;
  background: rgba(255, 244, 214, 0.94);
  border: 2px solid #f0b429;
}
.trace-preview-overlay.is-error {
  color: #8b1e1e;
  background: rgba(255, 236, 236, 0.96);
  border: 2px solid #e05252;
}
.trace-actions { display: flex; flex-direction: column; gap: 8px; }
.trace-production-note {
  color: var(--fail);
  font-size: 0.88rem;
  line-height: 1.45;
  margin: 10px 0 0;
}
.quiet-button {
  font: 700 12px/1 var(--font-display);
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--ink);
  background: var(--card);
  border: 1px solid var(--line-strong);
  padding: 10px 12px;
  cursor: pointer;
}
.metrics-dl { margin: 0 0 12px; }
.metrics-dl > div { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; padding: 4px 0; }
.metrics-dl dt { color: var(--muted); }
.metrics-dl dd { margin: 0; font-family: var(--font-mono); }
@media (max-width: 1100px) {
  .dash-stats { grid-template-columns: 1fr; }
  .dash-dl { grid-template-columns: 1fr; }
}
