/* ===== Cabinet Repair Intake — Design System ===== */

:root {
  /* Palette — navy + gold to match the Precision Cabinets logo */
  --bg: oklch(98% 0.005 250);
  --bg-raised: oklch(99% 0.003 250);
  --ink: oklch(22% 0.04 250);
  --ink-soft: oklch(42% 0.04 250);
  --ink-faint: oklch(62% 0.03 250);
  --rule: oklch(88% 0.012 250);
  --rule-soft: oklch(93% 0.008 250);
  /* Gold accent (matches caliper + wordmark) */
  --accent: oklch(72% 0.13 90);
  --accent-deep: oklch(58% 0.12 88);
  --accent-soft: oklch(95% 0.04 90);
  /* Navy primary (matches roundel) */
  --primary: oklch(28% 0.08 260);
  --primary-deep: oklch(20% 0.08 260);
  --primary-soft: oklch(94% 0.02 260);
  --danger: oklch(55% 0.17 28);
  --success: oklch(55% 0.12 150);

  /* Type */
  --serif: 'Newsreader', 'Georgia', serif;
  --sans: 'IBM Plex Sans', -apple-system, system-ui, sans-serif;
  --mono: 'JetBrains Mono', ui-monospace, monospace;

  /* Radii + shadows */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px oklch(22% 0.01 80 / 0.06);
  --shadow-md: 0 2px 8px oklch(22% 0.01 80 / 0.08), 0 1px 2px oklch(22% 0.01 80 / 0.04);
  --shadow-lg: 0 10px 30px oklch(22% 0.01 80 / 0.12), 0 2px 6px oklch(22% 0.01 80 / 0.06);
}

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

/* Typography */
h1, h2, h3, h4 { font-family: var(--serif); font-weight: 500; letter-spacing: -0.01em; margin: 0; }
h1 { font-size: 34px; line-height: 1.1; letter-spacing: -0.02em; }
h2 { font-size: 24px; line-height: 1.2; }
h3 { font-size: 18px; line-height: 1.3; }
.mono { font-family: var(--mono); font-feature-settings: 'tnum' 1; }
.eyebrow {
  font-family: var(--mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--ink-faint);
}

/* ===== 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: 18px;
  font-weight: 500;
  line-height: 1.1;
}
.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);
  padding: 11px 14px;
  border: 1px solid var(--rule);
  background: var(--bg-raised);
  border-radius: var(--r-md);
  color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
  width: 100%;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--ink);
  box-shadow: 0 0 0 3px oklch(22% 0.01 80 / 0.08);
}
.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;
  padding: 8px 12px;
  border: none;
  background: transparent;
  font: inherit;
  font-size: 13px;
  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 {
  padding: 8px 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;
}
.btn.primary { background: var(--primary); color: var(--bg); }
.btn.primary:hover { background: var(--primary-deep); }
.btn.secondary { background: var(--bg-raised); color: var(--ink); border-color: var(--rule); }
.btn.secondary:hover { border-color: var(--ink-faint); }
.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: oklch(96% 0.03 28); }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn.lg { padding: 14px 24px; font-size: 15px; }

/* 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 */
.markup {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
  align-items: start;
}
@media (max-width: 880px) {
  .markup {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}
.markup-stage {
  position: relative;
  background: var(--ink);
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
  user-select: none;
  touch-action: none;
  min-height: 250px;
}
@media (max-width: 880px) {
  .markup-stage {
    /* Full width on mobile, taller for easier markup */
    width: calc(100% + 28px);
    margin-left: -14px;
    border-radius: 0;
    min-height: 300px;
  }
}
.markup-stage .photo {
  position: absolute; inset: 0;
  width: 100%; height: 100%;
  object-fit: cover;
}
.markup-stage .overlay {
  position: absolute; inset: 0;
  cursor: crosshair;
}
.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: oklch(70% 0.01 80); }
.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: oklch(75% 0.01 80); 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);
  padding: 12px 16px;
  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: 6px; left: 16px;
}
.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; padding-bottom: 100px;
}
.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 {
  padding: 4px 10px; 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;
}
.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: 100vh; gap: 16px; color: var(--ink-soft);
}
.login-page {
  display: flex; align-items: center; justify-content: center;
  min-height: 100vh; 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); } }

.dash-header {
  display: flex; justify-content: space-between; align-items: flex-start;
  margin-bottom: 24px;
}
.dash-title {
  font-family: var(--serif); font-size: 26px; margin: 0;
}
.dash-sub {
  color: var(--ink-soft); font-size: 14px; margin-top: 4px;
}

.dash-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px; margin-bottom: 24px;
}
.dash-card {
  background: var(--bg-raised); border: 1px solid var(--rule);
  border-radius: var(--r-md); padding: 16px;
}
.dash-card-label { font-size: 12px; color: var(--ink-faint); text-transform: uppercase; letter-spacing: 0.04em; }
.dash-card-value { font-family: var(--mono); font-size: 28px; font-weight: 600; margin: 4px 0; }
.dash-card-sub { 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); }

/* ============================================================
   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); }
}

.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: 9px; }
}

/* 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: 100vh; background: var(--bg, #fafaf7);
}
.wiz-progress { height: 4px; background: var(--rule-soft, #eee); }
.wiz-progress-bar { height: 100%; background: #b08720; transition: width 200ms ease; }
.wiz-body {
  flex: 1; padding: 24px 20px 96px;
  max-width: 640px; width: 100%; margin: 0 auto;
}
.wiz-stepnum {
  font-size: 11px; letter-spacing: 0.12em; text-transform: uppercase;
  color: var(--ink-faint, #888); font-family: var(--mono, monospace); margin-bottom: 4px;
}
.wiz-title {
  font-family: var(--serif, Georgia, serif);
  font-size: 26px; line-height: 1.2; margin: 0 0 6px; color: var(--ink, #111);
}
.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 {
  position: sticky; bottom: 0; left: 0; right: 0;
  padding: 12px 20px; background: #fff;
  border-top: 1px solid var(--rule-soft, #eee);
  display: flex; justify-content: space-between; align-items: center; gap: 8px;
  z-index: 5;
}
.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: #b08720; }
.wiz-bigchip.on { border-color: #0a2240; background: #fdf8e9; }
.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: #fdf8e9; 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;
  padding: 12px 14px; border-top: 1px solid var(--rule-soft, #eee);
}

/* 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: #fdf8e9; border-color: #b08720; }

/* 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: 9px; 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;
  padding: 12px 18px;
  display: flex; justify-content: space-between; align-items: center;
  flex: 0 0 auto;
}
.iw-toolbar {
  background: #0a2240;
  padding: 10px 18px;
  display: flex; gap: 8px; flex-wrap: wrap;
  flex: 0 0 auto;
}
.iw-body {
  flex: 1; overflow-y: auto;
  padding: 24px;
}
.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; }
