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

:root {
  /* Palette */
  --bg: oklch(97% 0.008 80);
  --bg-raised: oklch(99% 0.005 80);
  --ink: oklch(22% 0.01 80);
  --ink-soft: oklch(42% 0.015 80);
  --ink-faint: oklch(62% 0.015 80);
  --rule: oklch(88% 0.012 80);
  --rule-soft: oklch(93% 0.01 80);
  --accent: oklch(65% 0.14 60);
  --accent-deep: oklch(52% 0.14 55);
  --accent-soft: oklch(94% 0.04 70);
  --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: var(--ink);
  color: var(--bg);
  display: grid;
  place-items: center;
  font-family: var(--serif);
  font-size: 20px;
  font-style: italic;
}
.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(--ink); color: var(--bg); }
.btn.primary:hover { background: oklch(28% 0.01 80); }
.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;
}
.markup-stage {
  position: relative;
  background: var(--ink);
  border-radius: var(--r-lg);
  overflow: hidden;
  aspect-ratio: 4/3;
  user-select: none;
  touch-action: none;
}
.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;
}
.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); }

.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; }
