:root {
  /* Light theme — sunrise gold accent on warm off-white, dark ink text. */
  --ink: #faf6ee;
  --panel: #ffffff;
  --panel-2: #f1ebdc;
  --border: #e3d9c2;
  --gold: #b8790a;
  --gold-dim: #8f5f08;
  --cream: #2a2318;
  --muted: #7d735f;
  --danger: #b3402a;
  --ok: #3f7a3c;
  --radius: 14px;
  font-size: 16px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--ink);
  color: var(--cream);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  -webkit-tap-highlight-color: transparent;
}

#app { max-width: 640px; margin: 0 auto; padding-bottom: 100px; min-height: 100vh; }

header.topbar {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  background: linear-gradient(180deg, var(--ink) 80%, rgba(23,19,15,0));
  border-bottom: 1px solid var(--border);
}
header.topbar img { width: 32px; height: 32px; border-radius: 8px; }
header.topbar h1 { font-size: 17px; margin: 0; flex: 1; letter-spacing: 0.2px; }
header.topbar .back-btn {
  background: none; border: 1px solid var(--border); color: var(--cream);
  border-radius: 10px; padding: 8px 12px; font-size: 14px;
}

main { padding: 16px; }

h2 { font-size: 20px; margin: 4px 0 14px; }
h3 { font-size: 15px; color: var(--gold); text-transform: uppercase; letter-spacing: 0.6px; margin: 22px 0 8px; }
p.hint { color: var(--muted); font-size: 13px; margin: 4px 0 0; }
p.lead { color: var(--muted); font-size: 14px; margin-top: -6px; }

.card {
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 14px 16px;
  margin-bottom: 12px;
}

.field { margin-bottom: 16px; }
.field label { display: block; font-size: 13.5px; color: var(--muted); margin-bottom: 6px; }
.field input[type="text"],
.field input[type="number"],
.field input[type="email"],
.field input[type="tel"],
.field select,
.field textarea {
  width: 100%;
  padding: 12px 12px;
  background: var(--panel-2);
  border: 1px solid var(--border);
  border-radius: 10px;
  color: var(--cream);
  font-size: 16px;
}
.field textarea { min-height: 90px; resize: vertical; }
.field input:focus, .field select:focus, .field textarea:focus { outline: 2px solid var(--gold-dim); }

.toggle-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 0;
  border-bottom: 1px solid var(--border);
}
.toggle-row:last-child { border-bottom: none; }
.toggle-row .toggle-label { font-size: 14.5px; }
.toggle-row .toggle-hint { color: var(--muted); font-size: 12.5px; margin-top: 2px; }

.switch { position: relative; width: 46px; height: 27px; flex-shrink: 0; }
.switch input { opacity: 0; width: 100%; height: 100%; margin: 0; position: absolute; z-index: 2; cursor: pointer; }
.switch .track { position: absolute; inset: 0; background: var(--panel-2); border: 1px solid var(--border); border-radius: 20px; transition: 0.15s; }
.switch .thumb { position: absolute; top: 3px; left: 3px; width: 19px; height: 19px; border-radius: 50%; background: var(--muted); transition: 0.15s; }
.switch input:checked + .track { background: var(--gold-dim); border-color: var(--gold); }
.switch input:checked + .track + .thumb { transform: translateX(19px); background: var(--ink); }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: none; border-radius: 12px;
  padding: 13px 18px;
  font-size: 15px; font-weight: 600;
  cursor: pointer;
}
.btn-primary { background: var(--gold); color: #201808; }
.btn-secondary { background: var(--panel-2); color: var(--cream); border: 1px solid var(--border); }
.btn-danger { background: transparent; color: var(--danger); border: 1px solid var(--danger); }
.btn-block { width: 100%; }
.btn:disabled { opacity: 0.5; }

.wizard-actions {
  position: fixed; bottom: 0; left: 0; right: 0;
  display: flex; gap: 10px;
  padding: 12px 16px calc(12px + env(safe-area-inset-bottom));
  background: linear-gradient(0deg, var(--ink) 70%, rgba(23,19,15,0));
  max-width: 640px; margin: 0 auto;
}
.wizard-actions .btn { flex: 1; }

.progress { display: flex; gap: 4px; margin: 10px 0 18px; }
.progress span { flex: 1; height: 4px; border-radius: 3px; background: var(--panel-2); }
.progress span.done { background: var(--gold); }
.progress span.active { background: var(--gold-dim); }

.step-label { color: var(--muted); font-size: 12.5px; text-transform: uppercase; letter-spacing: 0.6px; }

.callout {
  border-radius: 12px; padding: 12px 14px; margin: 10px 0; font-size: 13.5px; line-height: 1.5;
}
.callout.warn { background: rgba(184, 121, 10, 0.1); border: 1px solid var(--gold-dim); color: var(--gold-dim); }
.callout.danger { background: rgba(179, 64, 42, 0.08); border: 1px solid var(--danger); color: var(--danger); }
.callout.ok { background: rgba(63, 122, 60, 0.08); border: 1px solid var(--ok); color: var(--ok); }

.quote-item {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px; margin-bottom: 10px;
  background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius);
}
.quote-item .qi-name { font-weight: 600; font-size: 15px; }
.quote-item .qi-meta { color: var(--muted); font-size: 12.5px; margin-top: 3px; }
.quote-item .qi-total { color: var(--gold); font-weight: 700; font-size: 16px; }
.status-pill {
  display: inline-block; font-size: 11px; padding: 3px 8px; border-radius: 20px;
  text-transform: uppercase; letter-spacing: 0.4px; margin-top: 4px;
}
.status-pill.draft { background: var(--panel-2); color: var(--muted); }
.status-pill.sent { background: rgba(184, 121, 10, 0.14); color: var(--gold-dim); }
.status-pill.accepted { background: rgba(63, 122, 60, 0.14); color: var(--ok); }

.empty-state { text-align: center; padding: 60px 20px; color: var(--muted); }

.fab {
  position: fixed; right: 18px; bottom: 24px;
  width: 58px; height: 58px; border-radius: 50%;
  background: var(--gold); color: #201808; font-size: 30px; line-height: 1;
  border: none; box-shadow: 0 6px 18px rgba(42,35,24,0.25);
}

table.line-items { width: 100%; border-collapse: collapse; font-size: 14px; }
table.line-items td { padding: 8px 0; border-bottom: 1px solid var(--border); }
table.line-items td.amt { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; }
table.line-items tr.total td { font-weight: 700; color: var(--gold); font-size: 17px; border-bottom: none; padding-top: 12px; }
.cat-heading { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.5px; padding-top: 10px; }

.tabbar { display: flex; gap: 8px; margin-bottom: 14px; }
.tabbar button {
  flex: 1; padding: 10px; border-radius: 10px; border: 1px solid var(--border);
  background: var(--panel-2); color: var(--muted); font-size: 13.5px; font-weight: 600;
}
.tabbar button.active { background: var(--gold); color: #201808; border-color: var(--gold); }

/* ---- Customer Quote (print-friendly, light) ---- */
#quote-doc {
  background: #fff; color: #221c16; border-radius: var(--radius);
  padding: 24px 20px; margin-bottom: 14px;
}
#quote-doc h2 { color: #221c16; }
#quote-doc .qd-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; margin-bottom: 14px; }
#quote-doc .qd-brand { font-weight: 800; font-size: 20px; }
#quote-doc .qd-meta { font-size: 12.5px; color: #6b6152; text-align: right; }
#quote-doc .qd-section-title { font-size: 12px; text-transform: uppercase; letter-spacing: 0.6px; color: #8a7d68; margin: 18px 0 6px; }
#quote-doc table { width: 100%; border-collapse: collapse; font-size: 14px; }
#quote-doc table td { padding: 7px 0; border-bottom: 1px solid #e7dfcd; }
#quote-doc table td.amt { text-align: right; }
#quote-doc table tr.grand td { font-weight: 800; font-size: 17px; border-bottom: none; padding-top: 10px; }
#quote-doc .qd-fine { font-size: 11.5px; color: #6b6152; white-space: pre-line; line-height: 1.5; margin-top: 10px; }

@media print {
  body * { visibility: hidden; }
  #quote-doc, #quote-doc * { visibility: visible; }
  #quote-doc { position: absolute; top: 0; left: 0; width: 100%; border-radius: 0; padding: 0; margin: 0; }
  header.topbar, .wizard-actions, .fab { display: none !important; }
}

a.link-btn { color: var(--gold); font-size: 13.5px; text-decoration: underline; }

.save-toast {
  position: fixed; left: 50%; bottom: 90px; transform: translate(-50%, 10px);
  background: var(--ok); color: #fff; font-size: 13.5px; font-weight: 600;
  padding: 9px 16px; border-radius: 20px; box-shadow: 0 4px 14px rgba(42,35,24,0.2);
  opacity: 0; pointer-events: none; transition: opacity 0.2s, transform 0.2s; z-index: 20;
}
.save-toast.show { opacity: 1; transform: translate(-50%, 0); }
