/* ===== Cabinet Repair Intake — Design System (refresh 2026-06-22) =====
   Aligned with the "Cabinet Intake.dc.html" design reference:
   warm cream surface (#F7F5F0), dark char ink (#1C1916), amber
   accent (#C9781B), success green (#2F7D52). Type system:
   Archivo (display headlines) + Hanken Grotesk (body / buttons) +
   Spline Sans Mono (small-caps labels + tabular numbers).
   Original navy/oak palette retained as inactive backups below.   */

@import url('https://fonts.googleapis.com/css2?family=Archivo:wght@500;600;700;800&family=Hanken+Grotesk:wght@400;500;600;700&family=Spline+Sans+Mono:wght@400;500;600&display=swap');

:root {
  /* Surface tokens — warm cream */
  --bg:        #F7F5F0;   /* cream page bg */
  --bg-raised: #FFFFFF;   /* white cards */
  --paper:     #F7F5F0;
  --cream:     #EFEBE2;
  --cream-2:   #E6E1D7;

  /* Text */
  --ink:       #1C1916;   /* dark char headings + body */
  --ink-soft:  #6B6459;   /* secondary body */
  --ink-faint: #9A9286;   /* mono labels + meta */
  --ink-mono:  #9A9286;

  /* Lines */
  --rule:      #E6E1D7;   /* card borders */
  --rule-soft: #ECE7DD;   /* internal dividers */

  /* Amber accent (primary brand accent) */
  --accent:      #C9781B;
  --accent-deep: #A6620E;
  --accent-soft: #FBF0E1;
  --oak-soft:    #FBF8F1;

  /* Char primary (was navy) */
  --primary:      #1C1916;
  --primary-deep: #0c0b09;
  --primary-soft: #EFEBE2;

  /* Status colors */
  --danger:  #B91C1C;
  --success: #2F7D52;

  /* Type */
  --serif: 'Archivo', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --sans:  'Hanken Grotesk', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif;
  --mono:  'Spline Sans Mono', ui-monospace, 'SFMono-Regular', Menlo, monospace;

  /* Radii — design uses larger card radii for a softer feel */
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;

  /* Shadows — softer, warmer */
  --shadow-sm: 0 1px 2px rgba(28,25,22,.04), 0 1px 1px rgba(28,25,22,.03);
  --shadow-md: 0 12px 30px -12px rgba(28,25,22,.18), 0 2px 6px rgba(28,25,22,.05);
  --shadow-lg: 0 30px 60px -20px rgba(28,25,22,.30), 0 8px 20px -10px rgba(28,25,22,.18);

  /* Mobile-first foundation tokens */
  --tap-min: 44px;
  --spc-1: 4px; --spc-2: 8px; --spc-3: 12px; --spc-4: 16px; --spc-5: 24px;
  --bp-sm: 480px; --bp-md: 600px; --bp-lg: 760px;
  --safe-bottom: env(safe-area-inset-bottom);
  --safe-top: env(safe-area-inset-top);
  --safe-left: env(safe-area-inset-left);
  --safe-right: env(safe-area-inset-right);
  /* Horizontal gutter that respects landscape safe-area on iPhone.
     Used by wiz-body / vendor-header / vendor-form-wrap. */
  --gutter-x: 16px;
}

* { box-sizing: border-box; }
html, body {
  margin: 0; padding: 0;
  /* Hard-lock horizontal scroll on BOTH html and body. iOS PWA in
     standalone mode would still allow a 1-2px horizontal swipe past
     the right edge if only body was locked — html needs it too.
     max-width: 100vw protects against any descendant that sets a
     width larger than the viewport. */
  overflow-x: hidden;
  max-width: 100vw;
  width: 100%;
}
html { font-size: 100%; }
body {
  font-family: var(--sans);
  color: var(--ink);
  background: var(--bg);
  font-size: 0.9375rem;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  /* Belt + suspenders against any descendant overflow. */
  overscroll-behavior-x: contain;
}

/* Typography — Archivo bold for display, Hanken Grotesk for body,
   Spline Sans Mono for small-caps labels + numerics. */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 800; letter-spacing: -0.01em; margin: 0; color: var(--ink); }
h1 { font-size: 34px; line-height: 1.05; letter-spacing: -0.02em; }
h2 { font-size: 24px; line-height: 1.15; font-weight: 700; }
h3 { font-size: 19px; line-height: 1.25; font-weight: 700; }
.mono { font-family: var(--mono); font-feature-settings: 'tnum' 1; }
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent);
}

/* ===== App shell ===== */
.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 280px 1fr;
}

/* Sidebar / step rail */
.rail {
  background: var(--bg-raised);
  border-right: 1px solid var(--rule);
  padding: 28px 24px;
  display: flex;
  flex-direction: column;
  gap: 32px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}
.brand-mark {
  width: 36px; height: 36px;
  border-radius: 8px;
  background-color: var(--primary);
  background-image: url('/icons/icon-192.png');
  background-size: cover;
  background-position: center;
  /* Hide any text children (e.g. legacy "P") so the image stands alone */
  font-size: 0;
  color: transparent;
  display: grid;
  place-items: center;
}
.brand-name {
  font-family: var(--serif);
  font-size: 20px;
  font-weight: 400;
  line-height: 1.1;
  color: var(--primary);
}
.brand-sub {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

.steps { display: flex; flex-direction: column; gap: 2px; }
.step {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 12px;
  border-radius: var(--r-md);
  cursor: pointer;
  color: var(--ink-soft);
  border: none;
  background: transparent;
  text-align: left;
  font: inherit;
  transition: background .12s;
}
.step:hover { background: var(--rule-soft); }
.step.active { background: var(--ink); color: var(--bg); }
.step.done { color: var(--ink); }
.step-num {
  font-family: var(--mono);
  font-size: 11px;
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 1px solid currentColor;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.step.active .step-num { background: var(--accent); border-color: var(--accent); color: var(--ink); }
.step.done .step-num { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.step.active.done .step-num { background: var(--accent); color: var(--ink); border-color: var(--accent); }
.step-label { font-size: 14px; font-weight: 500; }
.step-sub { font-size: 11px; color: var(--ink-faint); font-family: var(--mono); }

.rail-estimate {
  margin-top: auto;
  padding: 16px;
  border: 1px solid var(--rule);
  border-radius: var(--r-md);
  background: var(--bg);
}
.rail-estimate .label { font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase; color: var(--ink-faint); font-family: var(--mono); }
.rail-estimate .amount { font-family: var(--mono); font-size: 22px; font-weight: 500; margin-top: 6px; }
.rail-estimate .range { font-size: 12px; color: var(--ink-soft); font-family: var(--mono); margin-top: 2px; }

/* Main content */
.main {
  padding: 48px 56px 120px;
  max-width: 1100px;
  width: 100%;
}
.page-head { margin-bottom: 32px; }
.page-head .eyebrow { margin-bottom: 8px; display: block; }
.page-head p { color: var(--ink-soft); margin: 8px 0 0; max-width: 640px; }

/* ===== Forms ===== */
.field-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 20px 24px;
}
.field-grid.one { grid-template-columns: 1fr; }
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.field { display: flex; flex-direction: column; gap: 6px; }
.field.span-2 { grid-column: span 2; }
.field label {
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-soft);
  letter-spacing: 0.02em;
}
.field label .req { color: var(--danger); margin-left: 2px; }
.input, .select, .textarea {
  font: inherit;
  font-family: var(--sans);
  font-size: 15px;
  font-weight: 500;
  min-height: 52px;
  padding: 0 14px;
  border: 1px solid #E0DBD1;
  background: #fff;
  border-radius: var(--r-md);
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
  width: 100%;
}
.textarea { padding: 12px 14px; }
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(201,120,27,.12);
}
.textarea { resize: vertical; min-height: 80px; }
.input.mono { font-family: var(--mono); }

/* Segmented control */
.segmented {
  display: flex;
  gap: 0;
  background: var(--rule-soft);
  padding: 3px;
  border-radius: var(--r-md);
  border: 1px solid var(--rule);
}
.segmented button {
  flex: 1;
  min-height: var(--tap-min);
  padding: 12px 14px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  border-radius: 6px;
  cursor: pointer;
  transition: background .12s, color .12s;
}
.segmented button.on {
  background: var(--bg-raised);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}

/* Chip group */
.chips { display: flex; flex-wrap: wrap; gap: 8px; }
.chip {
  min-height: var(--tap-min);
  padding: 10px 14px;
  border: 1px solid var(--rule);
  background: var(--bg-raised);
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  transition: all .12s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}
.chip:hover { border-color: var(--ink-faint); color: var(--ink); }
.chip.on { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.chip.on .dot { background: var(--accent); }
.chip .dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--ink-faint);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  border-radius: var(--r-md);
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  border: 1px solid transparent;
  transition: all .12s;
  text-decoration: none;
  min-height: var(--tap-min);
  touch-action: manipulation;
  user-select: none;
  -webkit-user-select: none;
  -webkit-tap-highlight-color: transparent;
}
.chip, .segmented button, .qp-chip, .wiz-bigchip, .wiz-cabnav-chip,
.wiz-fracstep-btn, .tool-btn, .vendor-header-btn {
  touch-action: manipulation;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  -webkit-user-select: none;
}
.btn {
  font-family: var(--sans);
  font-weight: 600;
}
.btn.primary {
  background: var(--accent);
  color: #fff;
  border-color: var(--accent);
  font-weight: 700;
  box-shadow: 0 6px 16px rgba(201,120,27,.30);
}
.btn.primary:hover { background: var(--accent-deep); border-color: var(--accent-deep); }
.btn.secondary { background: #fff; color: var(--ink); border-color: #E0DBD1; }
.btn.secondary:hover { border-color: var(--ink); }
.btn.ghost { background: transparent; color: var(--ink-soft); }
.btn.ghost:hover { color: var(--ink); background: var(--rule-soft); }
.btn.danger { color: var(--danger); background: transparent; }
.btn.danger:hover { background: #fef2f2; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.lg {
  padding: 0 22px;
  font-size: 16px;
  font-weight: 700;
  min-height: 56px;
  border-radius: var(--r-lg);
}

/* Nav footer */
.nav-foot {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 40px;
  padding-top: 24px;
  border-top: 1px solid var(--rule);
}

/* Cards */
.card {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 24px;
}
.card + .card { margin-top: 16px; }
.card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}

/* Section divider */
.section { margin-top: 40px; }
.section-head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--rule);
}
.section-head h3 { font-family: var(--serif); }

/* Area tabs */
.area-tabs {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--rule);
  margin-bottom: 24px;
  overflow-x: auto;
}
.area-tab {
  padding: 12px 16px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--ink-soft);
  cursor: pointer;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
  white-space: nowrap;
}
.area-tab:hover { color: var(--ink); }
.area-tab.active {
  color: var(--ink);
  border-bottom-color: var(--accent);
}
.area-tab .badge {
  font-family: var(--mono);
  font-size: 10px;
  background: var(--rule);
  padding: 2px 6px;
  border-radius: 4px;
  color: var(--ink-soft);
}
.area-tab.active .badge { background: var(--accent); color: var(--ink); }
.area-tab.add {
  color: var(--ink-faint);
  border: 1px dashed var(--rule);
  border-bottom: 1px dashed var(--rule);
  border-radius: 6px 6px 0 0;
  margin-left: 8px;
}
.area-tab.add:hover { color: var(--ink); border-color: var(--ink-faint); }

/* Photo capture */
.photo-dropzone {
  border: 2px dashed var(--rule);
  border-radius: var(--r-lg);
  padding: 60px 24px;
  text-align: center;
  background: var(--bg-raised);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 16px;
}
.photo-dropzone .icon {
  width: 56px; height: 56px;
  border-radius: 50%;
  background: var(--rule-soft);
  display: grid; place-items: center;
  color: var(--ink-soft);
}
.photo-dropzone p { margin: 0; color: var(--ink-soft); }
.photo-dropzone .tiny { font-size: 12px; color: var(--ink-faint); font-family: var(--mono); }
.capture-buttons { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; }

/* Markup canvas — stacked layout (photo on top, tools below) so the
   tool palette is never crowded against the photo. Works the same on
   desktop and mobile. */
.markup {
  display: flex;
  flex-direction: column;
  gap: 16px;
  align-items: stretch;
  max-width: 640px;
  margin: 0 auto;
}
.markup-stage {
  position: relative;
  background: var(--ink);
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
  user-select: none;
  /* touch-action: pan-y so vertical page scroll passes through the
     photo container when the markup tool is View. Was `none`, which
     blocked scrolling entirely because touch-action is restrictive
     and a parent's `none` overrides the SVG overlay's inline
     `touch-action: auto`. The overlay still sets touch-action: none
     in pin/draw mode (more restrictive — wins over pan-y) to capture
     strokes properly. */
  touch-action: pan-y;
  width: 100%;
  max-height: 480px;
}
@media (max-width: 880px) {
  .markup-stage {
    /* Edge-to-edge on mobile so the markup area is as big as possible */
    width: calc(100% + 28px);
    margin-left: -14px;
    border-radius: 0;
    max-height: none;
  }
}
.markup-stage .photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  /* 6-2 fix: kill the inline baseline gap that was shifting the SVG
     overlay's rendered position relative to the cursor's clientY.
     Also block events from being absorbed by the image. */
  display: block;
  pointer-events: none;
}
.markup-stage .overlay {
  position: absolute; inset: 0;
  cursor: crosshair;
  /* touch-action + pointer-events are now controlled per-tool by the
     SVG's inline style attribute (markup.jsx). In View mode the
     overlay is pointer-events:none + touch-action:auto so the page
     scrolls naturally; in Pin/Draw the overlay captures touches. */
}
.markup-stage.tool-pan .overlay { cursor: grab; }

.tool-palette {
  display: flex;
  flex-direction: column;
  gap: 12px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 16px;
}
@media (max-width: 880px) {
  .tool-palette {
    padding: 12px;
    gap: 8px;
  }
}
.tool-row { display: flex; gap: 6px; }
.tool-btn {
  flex: 1;
  padding: 12px 8px;
  border: 1px solid var(--rule);
  background: var(--bg);
  border-radius: var(--r-sm);
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  color: var(--ink-soft);
  font-weight: 500;
  transition: all .1s;
}
.tool-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
.tool-btn.active { background: var(--ink); color: var(--bg); border-color: var(--ink); }
.tool-btn.active svg { stroke: var(--accent); }

.color-swatches { display: flex; gap: 6px; }
.color-swatches button {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid transparent;
  cursor: pointer;
  padding: 0;
}
.color-swatches button.active { border-color: var(--ink); }

/* Pin editor popover — bottom sheet on mobile */
@media (max-width: 880px) {
  .markup-stage > div:last-child:has(input) {
    position: fixed !important;
    left: 0 !important; right: 0 !important;
    bottom: 0 !important; top: auto !important;
    transform: none !important;
    width: 100% !important;
    border-radius: 16px 16px 0 0 !important;
    box-shadow: 0 -10px 40px rgba(0,0,0,0.3) !important;
    z-index: 100 !important;
    padding: 20px !important;
  }
}

.markup-legend {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--rule);
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 6px;
  font-size: 13px;
  border-radius: var(--r-sm);
}
.legend-item:hover { background: var(--rule-soft); }
.legend-item .num {
  width: 22px; height: 22px;
  border-radius: 50%;
  display: grid; place-items: center;
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 600;
  color: #fff;
}
.legend-item .label { flex: 1; font-size: 13px; }
.legend-item .dim { font-family: var(--mono); font-size: 11px; color: var(--ink-faint); }
.legend-item button { opacity: 0; transition: opacity .1s; }
.legend-item:hover button { opacity: 1; }

/* Repair line rows */
.repair-row {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 12px;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.repair-row:last-child { border-bottom: none; }
.repair-row .name { font-weight: 500; }
.repair-row .meta { font-size: 12px; color: var(--ink-faint); font-family: var(--mono); margin-top: 2px; }
.repair-row .qty-box {
  display: flex; align-items: center; gap: 4px;
  border: 1px solid var(--rule);
  border-radius: var(--r-sm);
  background: var(--bg);
}
.repair-row .qty-box button {
  width: 28px; height: 32px;
  border: none; background: transparent;
  cursor: pointer; color: var(--ink-soft);
  font-size: 16px;
}
.repair-row .qty-box input {
  width: 48px;
  text-align: center;
  border: none;
  background: transparent;
  font-family: var(--mono);
  font-size: 14px;
  color: var(--ink);
  padding: 6px 0;
}
.repair-row .qty-box input:focus { outline: none; }
.repair-row .price {
  font-family: var(--mono);
  font-size: 14px;
  width: 90px;
  text-align: right;
  font-weight: 500;
}

/* Estimate summary */
.estimate-card {
  background: var(--ink);
  color: var(--bg);
  padding: 32px;
  border-radius: var(--r-lg);
  position: relative;
  overflow: hidden;
}
.estimate-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: repeating-linear-gradient(
    90deg,
    var(--accent) 0 8px,
    transparent 8px 16px
  );
}
.estimate-card .eyebrow { color: var(--oak-soft); }
.estimate-card .total-range {
  font-family: var(--mono);
  font-size: 42px;
  font-weight: 500;
  letter-spacing: -0.02em;
  margin-top: 12px;
  line-height: 1;
}
.estimate-card .total-sub { color: rgba(217,185,138,0.8); margin-top: 8px; font-size: 13px; }
.estimate-card .line-items { margin-top: 24px; display: flex; flex-direction: column; gap: 8px; }
.estimate-card .li {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  padding: 6px 0;
  border-bottom: 1px solid oklch(35% 0.01 80);
}
.estimate-card .li:last-child { border-bottom: none; }
.estimate-card .li .val { font-family: var(--mono); }
.estimate-card .li.total {
  margin-top: 8px;
  padding-top: 14px;
  border-top: 1px solid oklch(45% 0.01 80);
  font-size: 15px;
  font-weight: 500;
}

/* Summary / review */
.summary-grid {
  display: grid;
  grid-template-columns: 1fr 380px;
  gap: 32px;
  align-items: start;
}
.review-item {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 16px;
  padding: 10px 0;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 14px;
}
.review-item .k { color: var(--ink-faint); font-family: var(--mono); font-size: 12px; letter-spacing: 0.04em; text-transform: uppercase; }
.review-item .v { color: var(--ink); }
.review-item .v.mono { font-family: var(--mono); }

/* Work order (print-style) */
.workorder {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 48px;
  max-width: 820px;
  margin: 0 auto;
  box-shadow: var(--shadow-md);
}
.wo-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding-bottom: 20px;
  border-bottom: 2px solid var(--ink);
}
.wo-head h1 { font-size: 28px; }
.wo-num { font-family: var(--mono); font-size: 12px; color: var(--ink-faint); }
.wo-row {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin: 24px 0;
}
.wo-block h4 {
  font-family: var(--mono);
  font-size: 10px;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 8px;
  font-weight: 500;
}
.wo-block p { margin: 0; font-size: 14px; line-height: 1.6; }
.wo-area {
  padding: 16px 0;
  border-top: 1px solid var(--rule);
}
.wo-area h4 {
  font-family: var(--serif);
  font-size: 16px;
  font-weight: 500;
  color: var(--ink);
  margin-bottom: 10px;
  text-transform: none;
  letter-spacing: 0;
}
.wo-table { width: 100%; border-collapse: collapse; margin-top: 8px; }
.wo-table th, .wo-table td {
  text-align: left;
  padding: 8px 0;
  font-size: 13px;
  border-bottom: 1px solid var(--rule-soft);
}
.wo-table th {
  font-family: var(--mono);
  font-size: 10px;
  color: var(--ink-faint);
  letter-spacing: 0.1em;
  text-transform: uppercase;
  font-weight: 500;
}
.wo-table td.num { text-align: right; font-family: var(--mono); }
.wo-table th.num { text-align: right; }
.wo-total-row td {
  font-weight: 600;
  border-top: 2px solid var(--ink);
  border-bottom: none !important;
  padding-top: 14px;
  font-size: 14px;
}

/* Pricing table (Tweaks-exposed) */
.pricing-table { width: 100%; border-collapse: collapse; }
.pricing-table td, .pricing-table th {
  padding: 8px 10px;
  border-bottom: 1px solid var(--rule-soft);
  font-size: 13px;
}
.pricing-table th {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--ink-faint);
  text-align: left;
}
.pricing-table td.num { text-align: right; font-family: var(--mono); }
.pricing-table input { width: 80px; padding: 4px 6px; font-size: 12px; font-family: var(--mono); text-align: right; }

/* Print */
@media print {
  .rail, .nav-foot, .tweaks-toggle, .no-print { display: none !important; }
  .app { grid-template-columns: 1fr; }
  .main { padding: 0; max-width: 100%; }
  .workorder { border: none; box-shadow: none; padding: 20px; }
  body { background: white; }
}

/* Empty states */
.empty {
  text-align: center;
  padding: 40px 20px;
  color: var(--ink-faint);
  font-size: 14px;
}

/* Small utility */
.row { display: flex; align-items: center; gap: 12px; }
.spacer { flex: 1; }
.hint { font-size: 12px; color: var(--ink-faint); margin-top: 6px; }
.tape-rule {
  height: 4px;
  background: repeating-linear-gradient(
    90deg,
    var(--ink) 0 1px,
    transparent 1px 8px
  );
  opacity: 0.3;
  margin: 24px 0;
}


/* ===== Rail admin button ===== */
.rail-admin-btn {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--bg); border: 1px solid var(--rule);
  color: var(--ink-soft); cursor: pointer;
  display: grid; place-items: center;
  transition: all .15s ease;
}
.rail-admin-btn:hover {
  border-color: var(--accent); color: var(--accent-deep);
  background: var(--accent-soft);
}

/* ===== Rail estimate extra rows ===== */
.rail-est-rows {
  margin-top: 14px; padding-top: 12px;
  border-top: 1px dashed var(--rule);
  display: flex; flex-direction: column; gap: 4px;
}
.rail-est-row {
  display: flex; justify-content: space-between;
  font-size: 12px; color: var(--ink-soft);
}
.rail-est-foot {
  margin-top: 12px; padding-top: 10px;
  border-top: 1px dashed var(--rule);
  font-size: 10px; letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  font-family: var(--mono);
}

/* ===== Admin overlay ===== */
.admin-overlay {
  position: fixed; inset: 0;
  background: oklch(22% 0.01 80 / 0.55);
  display: grid; place-items: center;
  z-index: 200; padding: 20px;
  backdrop-filter: blur(2px);
}
.admin-shell {
  background: var(--bg);
  border-radius: 14px;
  width: 100%; max-width: 1100px;
  max-height: 90vh;
  display: flex; flex-direction: column;
  overflow: hidden;
  box-shadow: 0 30px 80px rgba(0,0,0,0.3);
}
.admin-head {
  padding: 24px 32px;
  border-bottom: 1px solid var(--rule);
  display: flex; justify-content: space-between; align-items: flex-end;
  gap: 24px;
  background: var(--bg-raised);
  flex-shrink: 0;
}
.admin-saved {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; color: var(--success);
  font-family: var(--mono);
  opacity: 0; transition: opacity .25s ease;
  padding: 4px 10px; border-radius: 4px;
  background: oklch(95% 0.04 150);
}
.admin-saved.on { opacity: 1; }

.admin-body {
  display: grid; grid-template-columns: 220px 1fr;
  flex: 1; overflow: hidden;
}
.admin-nav {
  border-right: 1px solid var(--rule);
  background: var(--bg-raised);
  padding: 16px 12px;
  display: flex; flex-direction: column; gap: 4px;
  overflow-y: auto;
}
.admin-nav-item {
  text-align: left; padding: 10px 14px;
  background: transparent; border: none; cursor: pointer;
  border-radius: 6px;
  font: inherit;
  color: var(--ink-soft);
  transition: all .12s ease;
}
.admin-nav-item:hover { background: var(--bg); color: var(--ink); }
.admin-nav-item.active {
  background: var(--ink); color: var(--bg-raised);
}
.admin-nav-item .t { font-size: 13px; font-weight: 500; }
.admin-nav-item .s { font-size: 11px; opacity: 0.7; font-family: var(--mono); margin-top: 2px; }

.admin-content {
  padding: 24px 32px;
  overflow-y: auto;
}
.admin-group-head {
  margin-bottom: 20px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--rule);
}
.admin-group-head h2 {
  font-family: var(--serif);
  font-size: 22px; margin-bottom: 4px;
}
.admin-group-head p {
  margin: 0; color: var(--ink-soft);
  font-size: 13px; max-width: 580px;
}

.admin-rows {
  display: flex; flex-direction: column;
  gap: 12px;
}
.admin-row {
  display: grid; grid-template-columns: 1fr 200px;
  gap: 24px; align-items: center;
  padding: 14px 16px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
}
.admin-row .row-label {
  font-size: 14px; font-weight: 500;
}
.admin-row .row-meta {
  font-size: 11px; font-family: var(--mono);
  color: var(--ink-faint);
  text-transform: uppercase; letter-spacing: 0.08em;
  margin-top: 2px;
}
.admin-row .row-note {
  font-size: 12px; color: var(--ink-soft);
  margin-top: 6px; line-height: 1.45;
}
.admin-row .row-input {
  display: flex; align-items: center; gap: 6px;
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 0 10px;
  transition: border-color .15s ease;
}
.admin-row .row-input:focus-within {
  border-color: var(--accent);
}
.admin-row .row-input .affix {
  font-family: var(--mono); font-size: 13px;
  color: var(--ink-faint);
}
.admin-row .row-input input {
  flex: 1; border: none; background: transparent;
  padding: 10px 0; font-family: var(--mono); font-size: 14px;
  outline: none; text-align: right;
  width: 100%; min-width: 0;
}

.admin-formula {
  margin-top: 24px;
  padding: 16px 20px;
  background: var(--ink); color: oklch(85% 0.02 80);
  border-radius: 8px;
  font-family: var(--mono); font-size: 12px;
  line-height: 1.7;
}
.admin-formula code {
  color: oklch(80% 0.04 70);
  font-family: var(--mono);
}

/* ===== Estimate tables ===== */
.estimate-card .estimate-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.estimate-card .estimate-table th {
  text-align: left;
  font-family: var(--mono);
  font-size: 10px; font-weight: 500;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--ink-faint);
  padding: 6px 12px 10px;
  border-bottom: 1px solid var(--rule);
}
.estimate-card .estimate-table th.num,
.estimate-card .estimate-table td.num { text-align: right; }
.estimate-card .estimate-table td {
  padding: 10px 12px;
  border-bottom: 1px solid var(--rule-soft);
  vertical-align: top;
}
.estimate-card .estimate-table td.detail {
  color: var(--ink-soft); font-size: 12px;
}
.estimate-card .estimate-table tr.li-side_panel td:first-child,
.estimate-card .estimate-table tr.li-side_panel td.detail {
  color: var(--ink-soft);
  padding-left: 28px;
}
.estimate-card .estimate-table tr.li-toe_kick {
  background: oklch(96% 0.01 80);
}
.estimate-card .estimate-table tr.li-surcharge,
.estimate-card .estimate-table tr.li-fee {
  background: var(--accent-soft);
  color: var(--ink);
}
.estimate-card .estimate-table tfoot td {
  border-bottom: none;
  border-top: 1px solid var(--rule);
  padding-top: 12px;
}
.estimate-card .estimate-table tfoot tr.total-row td {
  font-family: var(--serif);
  font-size: 18px;
  border-top: 2px solid var(--ink);
  padding-top: 14px;
}

/* Work-order estimate table */
.wo-table.estimate { font-size: 12px; }
.wo-table.estimate tfoot tr.total td {
  border-top: 2px solid var(--ink);
  padding-top: 8px;
  font-size: 14px;
}

@media (max-width: 880px) {
  .admin-body { grid-template-columns: 1fr; }
  .admin-nav { flex-direction: row; overflow-x: auto; border-right: none; border-bottom: 1px solid var(--rule); }
  .admin-nav-item { flex-shrink: 0; min-width: 140px; }
  .admin-row { grid-template-columns: 1fr; }
}


/* ===== Vendor portal banner ===== */
.vendor-banner {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px;
  background: linear-gradient(135deg, var(--accent-soft), oklch(96% 0.02 70));
  border: 1px solid var(--accent);
  border-radius: var(--r-md);
  margin-bottom: 24px;
}
.vb-mark {
  width: 44px; height: 44px; border-radius: 8px;
  background: var(--ink); color: var(--bg-raised);
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic;
  font-size: 22px; font-weight: 500;
  flex-shrink: 0;
}
.vb-eyebrow {
  font-family: var(--mono); font-size: 10px;
  letter-spacing: 0.14em; text-transform: uppercase;
  color: var(--accent-deep);
  font-weight: 500;
}
.vb-name {
  font-family: var(--serif); font-size: 20px;
  font-weight: 500; margin-top: 2px;
  letter-spacing: -0.01em;
}
.vb-msg {
  font-size: 13px; color: var(--ink-soft);
  margin-top: 4px;
  font-style: italic;
}

/* ===== Vendor code entry ===== */
.vendor-code-entry {
  background: var(--bg-raised);
  border: 1px dashed var(--rule);
  border-radius: var(--r-md);
  padding: 14px 16px;
  margin-bottom: 24px;
  max-width: 420px;
}
.vendor-code-entry input { width: 100%; }

/* ===== Vendors admin tab ===== */
.vendors-admin {
  display: flex; flex-direction: column; gap: 24px;
}
.vendors-list-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
}
.vendors-list-head .t { font-family: var(--serif); font-size: 17px; font-weight: 500; }
.vendors-list-head .s { font-size: 11px; color: var(--ink-faint); font-family: var(--mono); margin-top: 2px; }

.vendors-empty {
  padding: 32px;
  background: var(--bg-raised);
  border: 1px dashed var(--rule);
  border-radius: 8px;
  text-align: center;
  color: var(--ink-soft);
  font-size: 14px;
}

.vendors-rows {
  display: flex; flex-direction: column; gap: 8px;
}
.vendor-row {
  display: flex; align-items: stretch; gap: 8px;
  padding: 4px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 8px;
  transition: border-color .15s ease;
}
.vendor-row.editing {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.vendor-row-main {
  flex: 1; display: flex; align-items: center; gap: 12px;
  background: transparent; border: none; cursor: pointer;
  padding: 10px 12px; font: inherit; color: var(--ink);
  border-radius: 6px;
  text-align: left;
}
.vendor-row-main:hover { background: var(--bg); }
.vendor-mark {
  width: 32px; height: 32px; border-radius: 6px;
  background: var(--ink); color: var(--bg-raised);
  display: grid; place-items: center;
  font-family: var(--serif); font-style: italic;
  font-size: 16px; font-weight: 500;
  flex-shrink: 0;
}
.vendor-row .n { font-size: 14px; font-weight: 500; }
.vendor-row .m { font-size: 11px; color: var(--ink-faint); margin-top: 2px; }
.vendor-row .btn {
  align-self: center;
  flex-shrink: 0;
}

.vendor-edit {
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 10px;
  padding: 20px 24px;
}
.vendor-edit-head {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--rule);
}
.vendor-edit-head h3 {
  font-family: var(--serif); font-size: 18px; font-weight: 500;
}

.vendor-link-preview {
  background: var(--bg);
  border: 1px solid var(--rule);
  border-radius: 8px;
  padding: 14px 16px;
  margin-bottom: 20px;
}
.vendor-link-row {
  display: flex; gap: 8px; align-items: center;
  margin-top: 6px;
  background: var(--bg-raised);
  border: 1px solid var(--rule);
  border-radius: 6px;
  padding: 8px 10px;
}
.vendor-link-row code {
  flex: 1;
  font-family: var(--mono);
  font-size: 12px;
  color: var(--ink);
  word-break: break-all;
  background: transparent;
}
.vendor-link-row .btn { flex-shrink: 0; }

/* ============================================================
   Vendor Header — mobile-first top bar
   ============================================================ */
.vendor-header {
  position: sticky; top: 0; z-index: 50;
  background: var(--bg-raised); border-bottom: 1px solid var(--rule);
  /* The status-bar-style is black-translucent (see index.html), so iOS
     paints content under the clock/notch/battery row. Reserve that
     real estate with safe-area-inset-top + safe-area horizontal
     insets so the brand chip never lands under the camera island. */
  padding:
    calc(12px + var(--safe-top))
    max(16px, var(--safe-right))
    12px
    max(16px, var(--safe-left));
  display: flex; align-items: center; gap: 12px;
}
.vendor-header-brand {
  font-size: 11px; color: var(--ink-faint); text-transform: uppercase;
  letter-spacing: 0.06em; font-family: var(--sans);
  position: absolute;
  top: calc(6px + var(--safe-top));
  left: max(16px, var(--safe-left));
}
.vendor-header-name {
  font-family: var(--serif); font-size: 20px; font-weight: 600;
  color: var(--ink); flex: 1; padding-top: 10px;
}
.vendor-header-btn {
  display: flex; align-items: center; gap: 6px;
  padding: 6px 12px; border-radius: 8px;
  background: var(--bg); border: 1px solid var(--rule);
  font-size: 12px; font-weight: 500; color: var(--ink-soft);
  cursor: pointer; white-space: nowrap; margin-top: 8px;
}
.vendor-header-btn:hover { border-color: var(--accent); color: var(--accent-deep); }

/* ============================================================
   Vendor Form — single scrollable page
   ============================================================ */
.vendor-form-wrap {
  max-width: 680px; margin: 0 auto;
  padding:
    16px
    max(16px, var(--safe-right))
    100px
    max(16px, var(--safe-left));
}
.v-section {
  margin-bottom: 20px;
}
.v-section-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.v-section-title {
  font-family: var(--serif); font-size: 18px; font-weight: 600;
  color: var(--ink); margin: 0 0 12px;
}
.v-section-header .v-section-title { margin-bottom: 0; }

.v-fields {
  display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
}
.v-field { display: flex; flex-direction: column; gap: 4px; }
.v-field label { font-size: 12px; font-weight: 500; color: var(--ink-soft); }
.v-field.full { grid-column: 1 / -1; }

.btn.sm { padding: 6px 12px; font-size: 12px; }

/* Cabinet card — collapsible */
.v-cab-card {
  background: var(--bg-raised); border: 1px solid var(--rule);
  border-radius: var(--r-md); margin-bottom: 8px; overflow: hidden;
}
.v-cab-header {
  display: flex; align-items: center; gap: 8px; width: 100%;
  padding: 12px 14px; cursor: pointer;
  background: transparent; border: none; text-align: left;
}
.v-cab-header:hover { background: var(--bg); }
.v-cab-num { font-size: 11px; font-weight: 600; color: var(--accent-deep); font-family: var(--mono); }
.v-cab-label { flex: 1; font-size: 14px; font-weight: 500; color: var(--ink); }
.v-cab-dims { font-size: 12px; color: var(--ink-faint); }
.v-cab-chevron { font-size: 12px; color: var(--ink-faint); }
.v-cab-body {
  padding: 0 14px 14px;
  display: flex; flex-direction: column; gap: 12px;
  border-top: 1px solid var(--rule);
}

/* Estimate bar */
.v-estimate {
  background: var(--bg-raised); border: 1px solid var(--rule);
  border-radius: var(--r-md); padding: 20px;
  position: sticky; bottom: 0; z-index: 40;
  box-shadow: 0 -4px 20px rgba(0,0,0,0.08);
}
.v-estimate-row {
  display: flex; justify-content: space-between; align-items: center;
}
.v-estimate-note {
  font-size: 12px; color: var(--accent-deep); margin-top: 4px;
}

/* Cabinet size preset dropdown */
.size-preset-wrap { position: relative; }
.size-preset-trigger {
  display: flex; align-items: center; justify-content: space-between;
  width: 100%; padding: 10px 12px; border: 1px solid var(--rule);
  border-radius: var(--r-sm); background: var(--bg); cursor: pointer;
  font-size: 14px; text-align: left;
}
.size-preset-trigger:hover { border-color: var(--accent); }
.size-preset-code { font-family: var(--mono); font-weight: 600; color: var(--accent-deep); }
.size-preset-dims { font-family: var(--mono); font-size: 12px; color: var(--ink-soft); margin-left: 6px; }
.size-preset-placeholder { color: var(--ink-faint); }
.size-preset-arrow { color: var(--ink-faint); font-size: 12px; }

.size-preset-backdrop {
  position: fixed; inset: 0; z-index: 29;
}
.size-preset-dropdown {
  position: absolute; left: 0; right: 0; top: 100%; margin-top: 4px;
  background: var(--bg-raised); border: 1px solid var(--rule);
  border-radius: var(--r-md); box-shadow: var(--shadow-lg);
  z-index: 30; max-height: 320px; overflow: hidden;
  display: flex; flex-direction: column;
}
.size-preset-types {
  display: flex; gap: 2px; padding: 8px 8px 0;
  overflow-x: auto; flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
}
.size-preset-type-btn {
  padding: 5px 10px; border-radius: 6px; border: none;
  background: var(--bg); font-size: 11px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer; white-space: nowrap;
}
.size-preset-type-btn.on {
  background: var(--accent); color: var(--ink); font-weight: 600;
}
.size-preset-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 4px; padding: 8px; overflow-y: auto; flex: 1;
}
.size-preset-item {
  display: flex; flex-direction: column; align-items: center;
  padding: 8px 4px; border: 1px solid var(--rule); border-radius: 6px;
  background: var(--bg); cursor: pointer; transition: all .1s;
}
.size-preset-item:hover { border-color: var(--accent); background: var(--accent-soft); }
.size-preset-item.on { background: var(--accent); border-color: var(--accent); }
.size-preset-item-code { font-family: var(--mono); font-size: 13px; font-weight: 600; color: var(--ink); }
.size-preset-item.on .size-preset-item-code { color: var(--ink); }
.size-preset-item-dims { font-family: var(--mono); font-size: 10px; color: var(--ink-faint); margin-top: 2px; }

/* Quickpick dimension chips */
.qp-chips {
  display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px;
}
.qp-chip {
  min-height: var(--tap-min); min-width: var(--tap-min);
  padding: 10px 14px; border-radius: 6px;
  border: 1px solid var(--rule); background: var(--bg);
  font-family: var(--mono); font-size: 12px; font-weight: 500;
  color: var(--ink-soft); cursor: pointer; transition: all .1s;
  white-space: nowrap;
  display: inline-flex; align-items: center; justify-content: center;
}
.qp-chip:hover { border-color: var(--accent); color: var(--accent-deep); }
.qp-chip.on {
  background: var(--accent); border-color: var(--accent);
  color: var(--ink); font-weight: 600;
}
.dim-field-qp .input { max-width: 100px; }

@media (max-width: 600px) {
  .v-fields { grid-template-columns: 1fr; }
  .vendor-header-name { font-size: 18px; }
  .qp-chip { padding: 6px 12px; font-size: 13px; }
}

/* ============================================================
   Auth / Login
   ============================================================ */
.app-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 100dvh; gap: 16px; color: var(--ink-soft);
}
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100dvh; padding: 24px;
  background: var(--bg);
}
.login-card {
  width: 100%; max-width: 380px;
  background: var(--bg-raised); border: 1px solid var(--rule);
  border-radius: var(--r-lg); padding: 32px;
  box-shadow: var(--shadow-md);
}
.login-card h2 {
  font-family: var(--serif); font-size: 22px; margin: 0 0 4px; text-align: center;
}
.login-error {
  background: oklch(95% 0.04 25); border: 1px solid oklch(70% 0.18 25);
  border-radius: 6px; padding: 10px 12px; font-size: 13px;
  color: var(--danger); margin-top: 12px;
}

/* ============================================================
   Dashboard
   ============================================================ */
.dashboard {
  max-width: 900px; margin: 0 auto; padding: 24px 20px;
}
.dashboard-loading {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 60vh; gap: 16px; color: var(--ink-soft);
}
.spinner {
  width: 32px; height: 32px; border: 3px solid var(--rule);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Dashboard — dark char strip header + warm cream body, design refresh 2026-06-22 */
.dash-header {
  background: #1C1916;
  color: #F7F5F0;
  padding: 18px 20px 20px;
  margin: -16px -16px 18px;
  border-radius: 0;
  display: flex; flex-direction: column; gap: 8px;
}
.dash-header .dash-tagline {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.22em;
  color: var(--accent);
  text-transform: uppercase;
}
.dash-header .dash-row {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
}
.dash-header .dash-row-left { min-width: 0; flex: 1; }
.dash-title {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 19px;
  letter-spacing: -0.01em;
  line-height: 1.15;
  color: #fff;
  margin: 0;
}
.dash-sub {
  color: #A39C8F;
  font-family: var(--sans);
  font-weight: 500;
  font-size: 13px;
  margin-top: 2px;
}
.dash-avatar {
  width: 42px; height: 42px; flex: none;
  border-radius: 12px;
  background: #2c2820;
  display: flex; align-items: center; justify-content: center;
  font-family: var(--serif);
  font-weight: 700;
  font-size: 15px;
  color: var(--accent);
}
.dash-cards {
  display: grid; grid-template-columns: 1fr 1fr;
  gap: 12px; margin-bottom: 18px;
}
.dash-card {
  background: #fff;
  border: 1px solid var(--rule);
  border-radius: var(--r-lg);
  padding: 16px;
}
.dash-card.dash-card-hero { grid-column: 1 / -1; padding: 18px; }
.dash-card-label {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 10px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--ink-faint);
}
.dash-card-value {
  font-family: var(--serif);
  font-weight: 800;
  font-size: 26px;
  letter-spacing: -0.02em;
  color: var(--ink);
  margin: 6px 0 2px;
}
.dash-card.dash-card-hero .dash-card-value { font-size: 34px; }
.dash-card-sub {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-soft);
}

.dash-filter-row {
  display: flex; gap: 8px; margin-bottom: 16px;
}
.dash-filter-chip {
  padding: 6px 14px; border-radius: 20px; border: 1px solid var(--rule);
  background: var(--bg); font-size: 13px; cursor: pointer;
  color: var(--ink-soft); transition: all .15s;
}
.dash-filter-chip.active {
  background: var(--accent-soft); border-color: var(--accent);
  color: var(--accent-deep); font-weight: 500;
}

.dash-empty {
  text-align: center; padding: 48px 20px; color: var(--ink-faint);
}

.dash-orders-list {
  display: flex; flex-direction: column; gap: 4px;
}
.dash-order-row {
  display: flex; align-items: center; gap: 14px; padding: 12px 14px;
  background: var(--bg-raised); border: 1px solid var(--rule);
  border-radius: var(--r-md); cursor: pointer; transition: all .15s;
  text-align: left; width: 100%;
}
.dash-order-row:hover {
  border-color: var(--accent); box-shadow: var(--shadow-sm);
}
.dash-order-num { font-size: 13px; font-weight: 600; min-width: 110px; }
.dash-order-info { flex: 1; min-width: 0; }
.dash-order-client { font-size: 14px; font-weight: 500; }
.dash-order-addr { font-size: 12px; color: var(--ink-soft); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.dash-order-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.dash-order-total { font-size: 14px; font-weight: 600; }
.dash-order-date { font-size: 11px; color: var(--ink-faint); }
.dash-retail-quick {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 11px; font-weight: 600;
  background: var(--primary); color: #fff; border: 0;
  cursor: pointer; white-space: nowrap;
  transition: background .15s;
}
.dash-retail-quick:hover { background: var(--primary-deep); }

/* ============================================================
   Status Badge
   ============================================================ */
.status-badge {
  display: inline-block; padding: 3px 10px; border-radius: 12px;
  font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.03em; white-space: nowrap;
  background: color-mix(in oklch, var(--badge-color) 15%, transparent);
  color: var(--badge-color);
}

/* ============================================================
   Order Detail
   ============================================================ */
.order-detail {
  max-width: 800px; margin: 0 auto; padding: 24px 20px;
}
.order-detail-header {
  display: flex; align-items: center; gap: 14px; margin-bottom: 24px;
}
.order-detail-header h2 { font-family: var(--mono); font-size: 20px; margin: 0 0 4px; }
.order-detail-total { font-family: var(--mono); font-size: 24px; font-weight: 600; }

.status-timeline {
  display: flex; align-items: center; gap: 0; margin-bottom: 32px;
  padding: 16px 0;
}
.timeline-step {
  flex: 1; text-align: center; position: relative;
}
.timeline-step::before {
  content: ''; position: absolute; top: 10px; left: -50%; right: 50%;
  height: 2px; background: var(--rule); z-index: 0;
}
.timeline-step:first-child::before { display: none; }
.timeline-step.done::before { background: var(--accent); }
.timeline-dot {
  width: 20px; height: 20px; border-radius: 50%;
  border: 2px solid var(--rule); background: var(--bg);
  margin: 0 auto 6px; position: relative; z-index: 1;
}
.timeline-step.done .timeline-dot { background: var(--accent); border-color: var(--accent); }
.timeline-step.current .timeline-dot { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.timeline-label { font-size: 11px; color: var(--ink-faint); }
.timeline-step.done .timeline-label { color: var(--ink); font-weight: 500; }
.timeline-step.current .timeline-label { color: var(--accent-deep); font-weight: 600; }

.order-qr-section {
  text-align: center; padding: 24px;
  background: var(--bg-raised); border: 1px solid var(--rule);
  border-radius: var(--r-md); margin-bottom: 20px;
}
.order-qr-section h3 { margin: 0 0 4px; }
.order-qr-img { width: 200px; height: 200px; image-rendering: pixelated; border-radius: 8px; }

/* QR enlarged overlay — full screen for scanning */
.qr-overlay {
  position: fixed; inset: 0; z-index: 200;
  background: rgba(0,0,0,0.85);
  display: flex; align-items: center; justify-content: center;
  padding: 24px;
}
.qr-overlay-inner {
  background: white; border-radius: 20px; padding: 32px;
  text-align: center; max-width: 380px; width: 100%;
}
.qr-overlay-order {
  font-family: var(--mono); font-size: 18px; font-weight: 700;
  margin-bottom: 16px; color: var(--ink);
}
.qr-overlay-img {
  width: 100%; max-width: 300px; height: auto;
  image-rendering: pixelated; border-radius: 8px;
}
.qr-overlay-status { margin-top: 16px; }
.qr-overlay-hint {
  color: var(--ink-soft); font-size: 14px; margin-top: 12px;
}

.order-action-box {
  background: var(--accent-soft); border: 1px solid var(--accent);
  border-radius: var(--r-md); padding: 20px; text-align: center;
  margin-bottom: 20px;
}
.order-action-box p { margin: 0 0 12px; font-size: 14px; }

.order-detail-sections {
  display: flex; flex-direction: column; gap: 16px;
}
.order-detail-section {
  background: var(--bg-raised); border: 1px solid var(--rule);
  border-radius: var(--r-md); padding: 16px;
}
.order-detail-section h3 { font-family: var(--serif); font-size: 16px; margin: 0 0 12px; }
.detail-grid {
  display: grid; grid-template-columns: 1fr 1fr; gap: 8px;
}
.detail-grid > div { display: flex; flex-direction: column; gap: 2px; }
.detail-grid .label { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; }

.order-cabinet-card {
  border: 1px solid var(--rule); border-radius: 6px;
  padding: 12px; margin-bottom: 8px;
}
.order-cab-head {
  display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 6px;
}
.order-cab-specs {
  display: flex; flex-wrap: wrap; gap: 8px; font-size: 12px; color: var(--ink-soft);
}
.order-cab-specs span {
  background: var(--bg); padding: 2px 8px; border-radius: 4px; border: 1px solid var(--rule);
}
.order-cab-notes { font-size: 12px; color: var(--ink-soft); margin-top: 6px; }
.order-cab-photo { width: 100%; max-width: 200px; border-radius: 6px; margin-top: 8px; }

.estimate-table { width: 100%; }
.est-row {
  display: flex; gap: 12px; padding: 4px 0;
  border-bottom: 1px solid var(--rule);
  font-size: 13px;
}
.est-label { flex: 1; }
.est-detail { flex: 1; color: var(--ink-soft); font-size: 12px; }
.est-amount { min-width: 80px; text-align: right; font-weight: 500; }
.est-row.est-total { border-top: 2px solid var(--ink); font-weight: 600; font-size: 15px; }

.status-history { display: flex; flex-direction: column; gap: 8px; }
.history-entry {
  display: flex; align-items: center; gap: 10px; font-size: 13px;
}
.history-by { color: var(--ink-soft); }
.history-method { font-size: 11px; color: var(--accent); }
.history-time { font-size: 11px; color: var(--ink-faint); margin-left: auto; }

/* ============================================================
   Edit mode — inline editing + change tracking
   ============================================================ */
.edit-order-btn {
  font-size: 13px; padding: 8px 14px;
  animation: pulse-amber 2s ease-in-out infinite;
}
@keyframes pulse-amber {
  0%, 100% { box-shadow: 0 0 0 0 oklch(65% 0.14 60 / 0.4); }
  50% { box-shadow: 0 0 0 6px oklch(65% 0.14 60 / 0); }
}

/* Pulse-attn — used on required inputs that still need a value.
   Strong amber glow so the eye lands on them without further hints. */
.pulse-attn {
  animation: pulse-attn 1.6s ease-in-out infinite;
  border-color: oklch(65% 0.16 60) !important;
}
@keyframes pulse-attn {
  0%, 100% { box-shadow: 0 0 0 0 oklch(65% 0.18 60 / 0.55); }
  50%      { box-shadow: 0 0 0 8px oklch(65% 0.18 60 / 0); }
}

.edit-banner {
  display: flex; align-items: center; gap: 8px;
  padding: 10px 16px; margin-bottom: 12px;
  background: oklch(92% 0.08 60); border: 1px solid oklch(75% 0.12 60);
  border-radius: var(--r-md); font-size: 13px; font-weight: 500;
  color: oklch(35% 0.1 60);
}

.edit-field {
  display: flex; flex-direction: column; gap: 3px;
}
.edit-field.full { grid-column: 1 / -1; }
.edit-field .label { font-size: 11px; color: var(--ink-faint); text-transform: uppercase; }

.edit-old-value {
  font-size: 11px; color: var(--ink-faint);
  text-decoration: line-through;
  display: block; margin-bottom: 1px;
}

.input.edited, .select.edited, .textarea.edited {
  border-color: oklch(65% 0.14 60);
  background: oklch(97% 0.03 60);
}

.detail-old-value {
  display: block; font-size: 12px;
  color: var(--ink-faint); text-decoration: line-through;
  margin-bottom: 2px;
}

/* Edit history section */
.edit-history-entry {
  border: 1px solid var(--rule); border-radius: var(--r-sm);
  padding: 10px 12px; margin-bottom: 8px;
  background: oklch(97% 0.02 60);
}
.edit-history-header {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.edit-history-by { font-size: 13px; font-weight: 500; }
.edit-history-time { font-size: 11px; color: var(--ink-faint); }
.edit-history-changes { display: flex; flex-direction: column; gap: 4px; }
.edit-change-row {
  display: flex; align-items: center; gap: 6px; font-size: 12px;
  flex-wrap: wrap;
}
.edit-change-field {
  font-weight: 500; color: var(--ink-soft); min-width: 60px;
}
.edit-change-old {
  text-decoration: line-through; color: var(--ink-faint);
}
.edit-change-arrow { color: var(--ink-faint); font-size: 10px; }
.edit-change-new {
  font-weight: 600; color: oklch(45% 0.12 60);
}

.cab-edit-card { padding: 4px 0; }

/* ============================================================
   Mobile responsive for new components
   ============================================================ */
@media (max-width: 600px) {
  .dash-header { flex-direction: column; gap: 12px; }
  .dash-cards { grid-template-columns: 1fr; }
  .dash-order-row { flex-direction: column; align-items: flex-start; }
  .dash-order-meta { flex-direction: row; align-items: center; width: 100%; }
  .detail-grid { grid-template-columns: 1fr; }
  .order-detail-header { flex-wrap: wrap; }
  .status-timeline { overflow-x: auto; }
  .timeline-label { font-size: 11px; }
}

/* Cabinet Schematic Modal (vendor PWA) */
.schematic-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 12px;
}
.schematic-modal {
  background: var(--paper, #fff); border-radius: 12px;
  max-width: 980px; width: 100%; max-height: 90vh; overflow-y: auto;
  box-shadow: 0 20px 60px rgba(0,0,0,0.3);
}
.schematic-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 16px; border-bottom: 1px solid var(--rule, #e5e5e5);
  position: sticky; top: 0; background: var(--paper, #fff); z-index: 1;
}
.schematic-head h3 { margin: 2px 0 0; font-size: 18px; }
.schematic-close {
  background: none; border: 0; font-size: 28px; line-height: 1;
  color: var(--ink-soft, #666); cursor: pointer; padding: 0 8px;
}
.schematic-tabs {
  display: flex; gap: 4px; padding: 8px 16px;
  border-bottom: 1px solid var(--rule, #e5e5e5);
  flex-wrap: wrap;
}
.schematic-tab {
  background: var(--bg, #f5f5f0); border: 0;
  padding: 6px 12px; border-radius: 999px; font-size: 12px;
  cursor: pointer; color: var(--ink-soft, #555);
}
.schematic-tab.on { background: var(--accent-deep, #b8860b); color: white; }
.schematic-body {
  display: grid; grid-template-columns: 1fr 1fr; gap: 16px; padding: 16px;
}
@media (max-width: 760px) { .schematic-body { grid-template-columns: 1fr; } }
.schematic-cutlist h4 { margin: 0 0 8px; font-size: 13px; }
.schematic-cutlist table { width: 100%; font-size: 12px; border-collapse: collapse; }
.schematic-cutlist th { text-align: left; padding: 4px; color: var(--ink-soft, #666); font-size: 10px; text-transform: uppercase; letter-spacing: 0.5px; border-bottom: 1px solid var(--rule, #e5e5e5); }
.schematic-cutlist td { padding: 4px; border-bottom: 1px solid var(--bg, #f0f0f0); }
.schematic-cutlist-hidden {
  background: var(--bg, #f5f5f0); padding: 16px; border-radius: 8px;
  font-size: 13px; color: var(--ink-soft, #555); text-align: center;
}

/* Warranty landing page (homeowner-facing, no auth) */
.warranty-page {
  max-width: 480px; margin: 0 auto; padding: 24px 16px;
  font-family: var(--sans);
}
.warranty-head { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.warranty-head h2 { margin: 0; font-family: var(--serif); }
.warranty-card {
  background: var(--bg-raised); border: 1px solid var(--rule);
  border-radius: 12px; padding: 16px; margin-top: 16px;
}
.warranty-row {
  display: flex; justify-content: space-between; padding: 8px 0;
  border-bottom: 1px solid var(--rule-soft);
}
.warranty-row:last-child { border-bottom: 0; }
.warranty-label { color: var(--ink-soft); font-size: 13px; }

/* ============================================================
   Intake Wizard — full-screen step-by-step new-order flow.
   ============================================================ */
.wiz-shell {
  display: flex; flex-direction: column;
  min-height: 100dvh; background: var(--bg, #fafaf7);
  /* DO NOT set overflow-x here. Adding overflow-x:hidden made
     .wiz-shell the sticky scroll container for .wiz-footer, so on
     tall steps (e.g. step 7 toe-kick with multiple specs) the footer
     stuck to the BOTTOM OF THE WIZ-SHELL (off-screen below the fold)
     instead of the viewport. User reported "step 7 has no next
     button" on 2026-06-18. Horizontal lock lives on html + body
     where it doesn't break sticky positioning. */
  max-width: 100vw;
}
.wiz-progress { height: 4px; background: #E6E1D7; }
.wiz-progress-bar { height: 100%; background: var(--accent); transition: width 200ms ease; }
.wiz-body {
  flex: 1;
  padding:
    24px
    max(20px, var(--safe-right))
    /* Bottom padding has to clear the fixed mobile footer, which on
       the Review step stacks 3 rows (back/total, Save+Estimate, Submit)
       — about 200px tall with safe-area. The old 96px was enough for
       single-button steps but caused the Estimate hero to render
       behind the footer on Review. */
    220px
    max(20px, var(--safe-left));
  max-width: 640px; width: 100%; margin: 0 auto;
}
.wiz-stepnum {
  font-size: 11px; font-weight: 600;
  letter-spacing: 0.2em; text-transform: uppercase;
  color: var(--accent); font-family: var(--mono); margin-bottom: 4px;
}
.wiz-title {
  font-family: var(--serif);
  font-size: 25px; font-weight: 800; line-height: 1.1;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.wiz-sub { font-size: 14px; color: var(--ink-soft, #555); margin: 0 0 20px; }
.wiz-content > * + * { margin-top: 16px; }
.wiz-field { display: block; }
.wiz-label {
  display: block; font-size: 12px; color: var(--ink-soft, #555);
  margin-bottom: 6px; font-weight: 500;
}
.wiz-label .req { color: #b91c1c; }
.wiz-footer {
  /* FIXED, not sticky (2026-06-18). The v22 sticky-bottom flavor
     broke after the v20 body { overflow-x: hidden } turned the body
     into a scroll context — sticky-bottom then attached to the
     bottom of the body content (off-screen below the fold) instead
     of the viewport bottom. position:fixed always pins to the
     visual viewport regardless of overflow contexts upstream. The
     wiz-body's padding-bottom (96px) leaves room above the footer.
     transform: translateZ(0) + will-change: transform force this
     onto its own compositing layer so iOS PWA standalone mode keeps
     the hit-box aligned with the rendered visual. Without it, the
     button is visually at viewport bottom but the touch target
     stays at the layout-time position until the user scrolls (user-
     reported step-9 Next-button-needs-touch-to-activate bug). */
  position: fixed; bottom: 0; left: 0; right: 0;
  padding:
    12px
    max(20px, var(--safe-right))
    calc(12px + var(--safe-bottom))
    max(20px, var(--safe-left));
  background: var(--bg, #fff);
  border-top: 1px solid var(--rule-soft, #eee);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  z-index: 10;
  transform: translateZ(0);
  will-change: transform;
}
/* While iOS / Android software keyboard is open OR an editable field
   has focus, hide the sticky wizard footers. Lifting them above the
   keyboard (the old behavior) shoved the Back/Total/Next bar straight
   over the input the vendor was typing into. */
body.kb-open .wiz-footer,
body.kb-open .wiz-subfooter { display: none !important; }
.wiz-footer-multi { flex-wrap: wrap; }
.wiz-footer .btn:disabled { opacity: 0.4; }

/* Big yes/no/maybe cards */
.wiz-bigchips { display: grid; gap: 10px; }
.wiz-bigchip {
  display: block; width: 100%; text-align: left;
  background: #fff; border: 2px solid var(--rule, #ddd);
  border-radius: 12px; padding: 16px 18px;
  cursor: pointer; transition: border-color 120ms, transform 100ms;
}
.wiz-bigchip:hover { border-color: #C9781B; }
.wiz-bigchip.on { border-color: #0a2240; background: #FBF0E1; }
.wiz-bigchip-l {
  font-family: var(--serif, Georgia, serif);
  font-size: 18px; font-weight: 600; color: var(--ink, #111);
}
.wiz-bigchip-d { font-size: 13px; color: var(--ink-soft, #555); margin-top: 2px; }

/* Repair-toggle blocks */
.wiz-block {
  background: #fff; border: 1px solid var(--rule, #ddd);
  border-radius: 10px; padding: 12px;
}
.wiz-block + .wiz-block { margin-top: 10px; }
.wiz-block-head {
  display: flex; justify-content: space-between; align-items: center; gap: 12px;
}
.wiz-block-title { font-weight: 600; font-size: 14px; }
.wiz-block-sub { font-size: 11px; color: var(--ink-faint, #888); }
.wiz-checkbox {
  display: flex; align-items: center; gap: 8px;
  font-size: 13px; color: var(--ink-soft, #555);
  margin-top: 8px; cursor: pointer;
}
.wiz-checkbox input[type=checkbox] {
  width: 18px; height: 18px; accent-color: #0a2240;
}

/* Cabinet sub-wizard — DO NOT use overflow:hidden here, it was
   clipping the quick-pick grid to half a row. Let the parent page
   scroll naturally. */
.wiz-subshell {
  background: #fff; border: 1px solid var(--rule, #ddd);
  border-radius: 12px;
}
.wiz-subhead {
  display: flex; justify-content: space-between; align-items: center;
  padding: 10px 14px; background: #FBF0E1; border-bottom: 1px solid var(--rule, #ddd);
  font-size: 13px;
}
.wiz-substep { color: var(--ink-soft, #555); }
.wiz-subbody { padding: 14px; }
.wiz-subbody > * + * { margin-top: 14px; }
.wiz-subfooter {
  display: flex; justify-content: space-between; gap: 8px;
  /* Sticky — only renders on desktop (CabinetPaginatedDesktop). On
     mobile the cabinet accordion uses inline buttons, not this
     sub-footer. Keeping sticky here so it doesn't overlap the outer
     fixed wiz-footer on desktop. */
  position: sticky; bottom: 0;
  padding:
    12px
    max(16px, var(--safe-right))
    calc(12px + var(--safe-bottom))
    max(16px, var(--safe-left));
  background: var(--bg-raised, white);
  border-top: 1px solid var(--ink-faint);
  z-index: 5;
}

/* Review screen */
.wiz-review-block {
  background: #fff; border: 1px solid var(--rule, #ddd);
  border-radius: 10px; padding: 12px 14px; margin-top: 10px;
}
.wiz-review-h {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-faint, #888); margin-bottom: 6px;
  font-family: var(--mono, monospace);
}

/* Wizard quick-pick grid — let the page scroll naturally so nothing
   is clipped. No inner max-height; cards size for tap targets. */
.wiz-presetgrid {
  display: grid; grid-template-columns: repeat(2, 1fr); gap: 6px;
  padding: 6px; background: #fafaf7; border-radius: 6px;
}
@media (min-width: 480px) {
  .wiz-presetgrid { grid-template-columns: repeat(3, 1fr); }
}
@media (min-width: 720px) {
  .wiz-presetgrid { grid-template-columns: repeat(4, 1fr); }
}
.wiz-presetgrid .size-preset-item { min-height: 64px; }

/* Type tabs above the quick-pick grid */
.wiz-typetabs {
  display: flex; gap: 4px; overflow-x: auto;
  margin-bottom: 8px; padding-bottom: 4px;
  scrollbar-width: thin;
}
.wiz-typetab {
  flex: 0 0 auto;
  padding: 6px 12px;
  background: #fff; border: 1px solid var(--rule, #ddd);
  border-radius: 999px; font-size: 12px; cursor: pointer;
  white-space: nowrap;
}
.wiz-typetab.on { background: #0a2240; color: #fff; border-color: #0a2240; }

/* Inline cabinet preview after size selection */
.wiz-cabpreview-wrap {
  display: flex; justify-content: center;
  margin-top: 14px; padding: 16px 0 8px;
  border-top: 1px dashed var(--rule, #ddd);
}
.wiz-cabpreview { display: inline-block; text-align: center; }

/* Cabinet nav chips (when there are multiple cabinets) */
.wiz-cabnav {
  display: flex; flex-wrap: wrap; gap: 6px; margin: 8px 0 12px;
}
.wiz-cabnav-chip {
  padding: 4px 10px; font-size: 12px; border-radius: 999px;
  background: #fff; border: 1px solid var(--rule, #ddd);
  cursor: pointer; font-family: var(--mono, monospace);
}
.wiz-cabnav-chip.on { background: #0a2240; color: #fff; border-color: #0a2240; }

/* Quarter-inch stepper */
.wiz-fracstep {
  display: inline-flex; align-items: center; gap: 8px;
}
.wiz-fracstep-btn {
  width: 36px; height: 36px;
  border: 1px solid var(--rule, #ddd); background: #fff;
  border-radius: 6px; font-size: 18px; cursor: pointer;
}
.wiz-fracstep-btn:hover { background: #FBF0E1; border-color: #C9781B; }

/* Running total in footer */
.wiz-runningtotal {
  display: flex; flex-direction: column; align-items: center;
  font-family: var(--mono, monospace);
  padding: 0 8px;
}
.wiz-runningtotal-l {
  font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--ink-faint, #888);
}
.wiz-runningtotal-v {
  font-size: 16px; font-weight: 700; color: #0a2240;
}

/* Review screen — edit row + cabinet rows */
.wiz-review-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 6px;
}
.wiz-review-cabrow {
  display: flex; align-items: center; gap: 4px;
  padding: 6px 0;
  border-bottom: 1px solid var(--rule-soft, #eee);
}
.wiz-review-cabrow:last-child { border-bottom: 0; }

/* Insurance Estimate Wizard — fullscreen takeover */
.iw-fullscreen {
  position: fixed; inset: 0; z-index: 1000;
  background: #fafaf7;
  display: flex; flex-direction: column;
}
.iw-header {
  background: #0a2240; color: #fff;
  /* Same notch fix as .vendor-header — the iOS status bar is
     translucent so we have to reserve safe-area-inset-top, else
     the ✕ Close button sits under the clock/battery row. */
  padding:
    calc(12px + var(--safe-top))
    max(18px, var(--safe-right))
    12px
    max(18px, var(--safe-left));
  display: flex; justify-content: space-between; align-items: center;
  flex: 0 0 auto;
}
.iw-toolbar {
  background: #0a2240;
  padding:
    10px
    max(18px, var(--safe-right))
    10px
    max(18px, var(--safe-left));
  display: flex; gap: 8px; flex-wrap: wrap;
  flex: 0 0 auto;
}
.iw-body {
  flex: 1; overflow-y: auto;
  padding:
    24px
    max(24px, var(--safe-right))
    calc(24px + var(--safe-bottom))
    max(24px, var(--safe-left));
}
.iw-intro-card {
  background: #fff; border: 1px solid var(--rule, #ddd);
  border-radius: 12px; padding: 24px;
  max-width: 640px; margin: 0 auto;
  box-shadow: 0 4px 16px rgba(0,0,0,0.06);
}
.iw-intro-card h2 { font-family: var(--serif, Georgia, serif); }
.iw-intro-card h3 { font-family: var(--serif, Georgia, serif); margin-top: 18px; font-size: 15px; }
.iw-intro-card ul { padding-left: 20px; }
.iw-intro-card li { margin-bottom: 6px; font-size: 14px; line-height: 1.5; }

/* ============================================================
   Mobile-First Foundation — viewport collapses, chip scroll snap,
   bottom-sheet base, reduced motion, hover guards.
   ============================================================ */

/* Layout collapse — rail hides, app becomes single column */
@media (max-width: 760px) {
  .app { grid-template-columns: 1fr; }
  .rail { display: none; }
  .main { padding: 24px 16px 120px; }
}

/* Form / row grid collapse on phones */
@media (max-width: 600px) {
  .field-grid,
  .field-grid.three { grid-template-columns: 1fr; }
  .field.span-2 { grid-column: auto; }
  .v-fields { grid-template-columns: 1fr; }
  .wo-row { grid-template-columns: 1fr; }
  .summary-grid { grid-template-columns: 1fr; }
  .repair-row { grid-template-columns: 1fr 1fr; }
}

/* Horizontal scroll-snap rows for chip strips.
   .qp-chips is intentionally EXCLUDED here — width-quickpicks have 19
   values that used to scroll horizontally off-screen on phones. They
   now wrap to multiple rows (default .qp-chips style at line ~1337). */
.wiz-cabnav, .dash-filter-row, .area-tabs {
  display: flex;
  overflow-x: auto;
  flex-wrap: nowrap;
  gap: 8px;
  -webkit-overflow-scrolling: touch;
  scroll-snap-type: x mandatory;
  padding-bottom: 4px;
}
.wiz-cabnav > *,
.dash-filter-row > *,
.area-tabs > * {
  scroll-snap-align: start;
  flex: 0 0 auto;
}
.wiz-cabnav::-webkit-scrollbar,
.dash-filter-row::-webkit-scrollbar,
.area-tabs::-webkit-scrollbar { height: 0; }

/* Bottom sheet base — used by BottomSheet React component */
.pc-bottom-sheet-backdrop {
  position: fixed; inset: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex; align-items: flex-end; justify-content: center;
  z-index: 1000;
  animation: pc-fade-in 0.2s ease-out;
}
.pc-bottom-sheet {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  overflow-y: auto;
  background: var(--bg-raised, white);
  border-radius: 16px 16px 0 0;
  padding: 20px 20px calc(20px + var(--safe-bottom));
  animation: pc-slide-up 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}
@media (min-width: 600px) {
  .pc-bottom-sheet-backdrop { align-items: center; }
  .pc-bottom-sheet {
    border-radius: 16px;
    max-width: 420px;
    padding: 24px;
  }
}
@keyframes pc-fade-in { from { opacity: 0 } to { opacity: 1 } }
@keyframes pc-slide-up { from { transform: translateY(100%) } to { transform: translateY(0) } }

/* Reduced motion — kill animations for sensitive users */
@media (prefers-reduced-motion: reduce) {
  .spinner,
  .edit-order-btn,
  .pc-bottom-sheet,
  .pc-bottom-sheet-backdrop {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
  }
}

/* Hover guards — only fire hover styles on devices that actually hover.
   Touch devices fire hover on tap and get sticky :hover residue. */
@media (hover: hover) {
  .chip:hover { border-color: var(--ink-faint); color: var(--ink); }
  .btn.ghost:hover { color: var(--ink); background: var(--rule-soft); }
  .btn.secondary:hover { border-color: var(--ink-faint); }
  .btn.primary:hover { background: var(--primary-deep); }
  .btn.danger:hover { background: oklch(96% 0.03 28); }
  .step:hover { background: var(--rule-soft); }
  .tool-btn:hover { border-color: var(--ink-faint); color: var(--ink); }
  .area-tab:hover { color: var(--ink); }
  .qp-chip:hover { border-color: var(--accent); color: var(--accent-deep); }
  .wiz-bigchip:hover { border-color: #C9781B; }
  .wiz-fracstep-btn:hover { background: #FBF0E1; border-color: #C9781B; }
  .vendor-header-btn:hover { border-color: var(--accent); color: var(--accent-deep); }
}

/* ============================================================
   DDS DUAL-MODE (2026-06-22) — Doors / Drawers / Shelves +
   Hardware sub-step has two input layouts (Compact / Guided)
   that the vendor can toggle between. Both share these atoms.
   ============================================================ */

/* Mode toggle — pill pair at the top of the section */
.dds-mode-toggle {
  display: flex;
  gap: 6px;
  background: #EFEBE2;
  border-radius: 11px;
  padding: 4px;
  margin-bottom: 14px;
}
.dds-mode-toggle button {
  position: relative;
  flex: 1;
  height: 40px;
  border: none;
  border-radius: 8px;
  background: none;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
  color: var(--ink-soft);
  cursor: pointer;
  transition: color .12s;
}
.dds-mode-toggle button.on {
  background: #fff;
  color: var(--ink);
  box-shadow: 0 1px 3px rgba(0,0,0,.08);
}

/* Card — used by both Compact and Guided layouts */
.dds-card {
  background: #fff;
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  padding: 14px;
}
.dds-card + .dds-card { margin-top: 10px; }
.dds-card-title {
  font-family: var(--sans);
  font-weight: 700;
  font-size: 15px;
  color: var(--ink);
}
.dds-card-sub {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12px;
  color: var(--ink-faint);
  margin-top: 2px;
}

/* Stepper — the −/count/+ control */
.dds-stepper {
  display: inline-flex;
  align-items: center;
  border: 1px solid #E0DBD1;
  border-radius: 11px;
  overflow: hidden;
  flex: none;
  background: #fff;
}
.dds-stepper button {
  width: 46px; height: 46px;
  border: none;
  background: #F2EFE8;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 22px;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
}
.dds-stepper button:active { background: #E6E1D7; }
.dds-stepper button:disabled { color: #C2BBAE; cursor: not-allowed; }
.dds-stepper .dds-stepper-count {
  width: 46px;
  text-align: center;
  font-family: var(--mono);
  font-weight: 600;
  font-size: 18px;
  color: var(--ink);
  font-variant-numeric: tabular-nums;
}
.dds-stepper.dds-stepper-sm button { width: 40px; height: 42px; font-size: 19px; }
.dds-stepper.dds-stepper-sm .dds-stepper-count { width: 36px; font-size: 16px; }

/* Repair-check row — the "checkbox + label" pattern below each count */
.dds-repair-row {
  margin-top: 11px;
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  text-align: left;
  font-family: var(--sans);
}
.dds-repair-row.boxed {
  background: #F4F0E8;
  padding: 11px;
  border-radius: 10px;
}
.dds-repair-box {
  position: relative;
  width: 22px; height: 22px;
  flex: none;
  border: 1.5px solid #C2BBAE;
  border-radius: 6px;
  background: #fff;
}
.dds-repair-box.on {
  background: var(--success);
  border-color: var(--success);
}
.dds-repair-box.on::after {
  content: '✓';
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-family: var(--sans);
  font-weight: 700;
  font-size: 13px;
}
.dds-repair-label {
  flex: 1;
  font-weight: 600;
  font-size: 13.5px;
  color: var(--ink);
}
.dds-repair-label .dds-repair-rate {
  color: var(--success);
  font-weight: 600;
}

/* Mono label used above sub-options */
.dds-mono-label {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--ink-faint);
  margin-bottom: 7px;
}

/* Chip group — for Left/Right, hinge config, position chips */
.dds-chip-row {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.dds-chip {
  position: relative;
  flex: 1 1 80px;
  min-height: 42px;
  padding: 9px 12px;
  border: 1px solid #E0DBD1;
  border-radius: 10px;
  background: #fff;
  font-family: var(--sans);
  font-weight: 600;
  font-size: 13px;
  color: var(--ink);
  cursor: pointer;
  touch-action: manipulation;
  line-height: 1.2;
}
.dds-chip.on {
  border: 2px solid var(--accent);
  background: rgba(201,120,27,.06);
}

/* Internal divider — used inside a card to split sections */
.dds-card-divider {
  margin: 12px 0;
  padding-top: 12px;
  border-top: 1px dashed var(--rule);
}

/* Sub-row layout — "label on left, control on right" */
.dds-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}
.dds-row + .dds-row { margin-top: 10px; }
.dds-row-text { flex: 1; min-width: 0; }
.dds-row-text .dds-card-title { font-size: 13.5px; }
.dds-row-text .dds-card-sub { font-size: 11.5px; }

/* Guided tile (Mode B) — collapsible card with summary chip */
.dds-tile {
  background: #fff;
  border: 1px solid var(--rule-soft);
  border-radius: 12px;
  overflow: hidden;
}
.dds-tile + .dds-tile { margin-top: 9px; }
.dds-tile-head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px;
  background: none;
  border: none;
  cursor: pointer;
  text-align: left;
  font-family: var(--sans);
}
.dds-tile-title {
  font-weight: 700;
  font-size: 16px;
  color: var(--ink);
  flex: 1;
}
.dds-tile-summary {
  font-family: var(--mono);
  font-weight: 600;
  font-size: 12px;
  color: var(--ink-faint);
}
.dds-tile-chev {
  font-family: var(--sans);
  font-weight: 400;
  font-size: 18px;
  color: #B9B2A6;
}
.dds-tile-body { padding: 0 14px 14px; }

/* Help / context banner shown above the layouts */
.dds-help {
  display: flex;
  gap: 9px;
  align-items: flex-start;
  background: var(--accent-soft);
  border-radius: 11px;
  padding: 11px 12px;
  margin-bottom: 14px;
}
.dds-help-icon { color: var(--accent-deep); font-size: 13px; line-height: 1.3; }
.dds-help-text {
  font-family: var(--sans);
  font-weight: 500;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--ink-soft);
}
