:root {
  --navy: #1a2b4a;
  --navy2: #243b66;
  --gold: #c4a035;
  --bg: #f4f6f9;
  --card: #fff;
  --border: #d8dee8;
  --muted: #5c6b7e;
  --ok: #1b7a3d;
  --danger: #b00020;
  --radius: 12px;
  --shadow: 0 2px 10px rgba(26,43,74,.08);
  font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: #1c2430; }
body { min-height: 100vh; }
.app-header {
  background: linear-gradient(135deg, var(--navy), var(--navy2));
  color: #fff; padding: 12px 16px; display: flex; align-items: center; gap: 12px;
  position: sticky; top: 0; z-index: 20; box-shadow: var(--shadow);
}
.app-header img.logo { height: 40px; width: auto; background: #fff; border-radius: 6px; padding: 4px; }
.app-header h1 { font-size: 1rem; margin: 0; font-weight: 600; line-height: 1.25; }
.app-header .user { margin-left: auto; font-size: .8rem; opacity: .9; text-align: right; }
.wrap { max-width: 960px; margin: 0 auto; padding: 16px; }
.screen { display: none; }
.screen.active { display: block; }
.card {
  background: var(--card); border: 1px solid var(--border); border-radius: var(--radius);
  padding: 20px; box-shadow: var(--shadow); margin-bottom: 16px;
}
.hero { text-align: center; padding: 32px 16px; }
.hero h2 { color: var(--navy); margin: 8px 0 4px; }
.hero p { color: var(--muted); }
.btn-row { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 16px; }
button, .btn {
  appearance: none; border: none; border-radius: 10px; padding: 12px 18px;
  font-size: 1rem; font-weight: 600; cursor: pointer; background: var(--navy); color: #fff;
}
button.secondary, .btn.secondary { background: #e8eef6; color: var(--navy); }
button.ghost, .btn.ghost { background: transparent; color: var(--navy); border: 1px solid var(--border); }
button.danger { background: var(--danger); }
button:disabled { opacity: .45; cursor: not-allowed; }
button.gold { background: var(--gold); color: #1a1a1a; }
label { display: block; font-size: .85rem; font-weight: 600; color: var(--muted); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: 8px;
  font-size: 1rem; background: #fff;
}
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.form-grid .full { grid-column: 1 / -1; }
.step-title { margin: 0 0 4px; color: var(--navy); }
.step-sub { margin: 0 0 14px; color: var(--muted); font-size: .92rem; }
.opt-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 12px;
}
.opt-card {
  background: #fff; border: 2px solid var(--border); border-radius: 12px; padding: 10px;
  text-align: center; cursor: pointer; position: relative; min-height: 140px;
  display: flex; flex-direction: column; align-items: center; justify-content: flex-start;
}
.opt-card.selected { border-color: var(--navy); box-shadow: 0 0 0 2px rgba(36,59,102,.2); }
.opt-card .thumb {
  width: 100%; height: 88px; display: flex; align-items: center; justify-content: center;
  background: #f0f3f7; border-radius: 8px; margin-bottom: 8px; overflow: hidden;
}
.opt-card .thumb img, .opt-card .thumb svg { max-width: 100%; max-height: 100%; object-fit: contain; }
.opt-card .label { font-size: .82rem; font-weight: 600; color: var(--navy); line-height: 1.2; }
.opt-card .aka { font-size: .72rem; color: var(--muted); font-weight: 400; }
.opt-card .check {
  display: none; position: absolute; top: 6px; right: 6px; background: var(--ok); color: #fff;
  width: 22px; height: 22px; border-radius: 50%; font-size: 12px; line-height: 22px;
}
.opt-card.selected .check { display: block; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 12px; }
.chip {
  font-size: .75rem; padding: 4px 10px; border-radius: 999px; background: #e8eef6; color: var(--navy);
  border: none; font-weight: 600; cursor: pointer;
}
.chip.done { background: #d7f0e0; }
.chip.current { background: var(--navy); color: #fff; }
.search-bar { display: flex; gap: 8px; margin-bottom: 12px; }
.quote-list { list-style: none; padding: 0; margin: 0; }
.quote-list li {
  background: #fff; border: 1px solid var(--border); border-radius: 10px; padding: 12px;
  margin-bottom: 8px; display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
}
.quote-list .meta { flex: 1; min-width: 180px; }
.quote-list .meta strong { display: block; color: var(--navy); }
.muted { color: var(--muted); font-size: .85rem; }
.money { font-variant-numeric: tabular-nums; font-weight: 700; color: var(--navy); }
.quote-sheet { background: #fff; border: 1px solid var(--border); border-radius: 12px; padding: 20px; }
.quote-sheet .shop { display: flex; gap: 16px; align-items: flex-start; border-bottom: 2px solid var(--navy); padding-bottom: 12px; margin-bottom: 16px; }
.quote-sheet .shop img { height: 56px; }
.quote-sheet table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.quote-sheet th, .quote-sheet td { border-bottom: 1px solid var(--border); padding: 8px 6px; text-align: left; vertical-align: top; }
.quote-sheet th { color: var(--muted); font-size: .75rem; text-transform: uppercase; }
.quote-sheet .num { text-align: right; white-space: nowrap; }
.grand { text-align: right; font-size: 1.25rem; margin-top: 12px; color: var(--navy); }
.banner { background: #fff3cd; border: 1px solid #ffe08a; color: #5c4800; padding: 10px 12px; border-radius: 8px; margin-bottom: 12px; }
.error { background: #fde8ec; border: 1px solid #f5c2cb; color: var(--danger); padding: 10px 12px; border-radius: 8px; }
@media (max-width: 640px) {
  .form-grid { grid-template-columns: 1fr; }
  .app-header h1 { font-size: .9rem; }
  .opt-grid { grid-template-columns: repeat(2, 1fr); }
}
@media print {
  .app-header, .no-print, .btn-row { display: none !important; }
  body { background: #fff; }
  .wrap { max-width: none; padding: 0; }
  .screen { display: none !important; }
  .screen.print-active { display: block !important; }
  .quote-sheet { border: none; box-shadow: none; }
}


/* Back navigation — always visible and obvious */
#btn-back, button.btn-back {
  font-weight: 700;
  border-color: var(--navy);
  color: var(--navy);
  min-width: 5.5rem;
}
.step-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}
.door-price {
  font-weight: 700;
  color: var(--navy);
  white-space: nowrap;
}
.quote-list .meta .door-price { display: block; margin-top: 4px; }
.line-actions { white-space: nowrap; }
.line-actions button { margin-left: 4px; padding: 4px 8px; font-size: .75rem; }
.running-total {
  margin-top: 12px;
  padding: 10px 12px;
  background: #f3f6fb;
  border-radius: 8px;
  font-weight: 700;
  color: var(--navy);
}
@media print {
  .line-actions, .no-print { display: none !important; }
}
