/* ============================================================
   Repair booking + tracking + admin (DEMO)
   Reuses base.css tokens + pages.css form styles.
   ============================================================ */
:root { --danger: oklch(0.64 0.19 27); --ok: var(--signal); }

/* App pages use a static header so the demo banner can sit above it */
body.app .site-header { position: static; background: var(--bg); backdrop-filter: none; border-bottom: 1px solid var(--line); }
body.app .site-header.hide { transform: none; }

/* Demo banner */
.demo-banner {
  background: repeating-linear-gradient(45deg, oklch(0.66 0.185 46 / 0.16) 0 14px, oklch(0.66 0.185 46 / 0.08) 14px 28px);
  border-bottom: 1px solid oklch(0.6 0.14 55 / 0.5);
  color: var(--amber); font-family: var(--font-mono); font-size: 0.78rem;
  text-align: center; padding: 0.5rem 1rem; letter-spacing: 0.02em;
}
.demo-banner b { color: var(--ink); }

/* App header (no hero image) */
.app-head { padding-top: 2.5rem; padding-bottom: 2rem; border-bottom: 1px solid var(--line); background: var(--bg-2); }
.photo-row { display: flex; gap: 0.6rem; flex-wrap: wrap; }
.photo-ph { font-family: var(--font-mono); font-size: 0.72rem; color: var(--muted); background: var(--bg); border: 1px dashed var(--line-strong); border-radius: 8px; padding: 1.4rem 1rem; min-width: 120px; text-align: center; }
.app-head .crumb { margin-bottom: 0.8rem; }
.app-head h1 { font-size: clamp(2.2rem, 1.5rem + 3vw, 3.4rem); }
.app-head .lead { margin-top: 0.8rem; }

.app-main { padding-block: clamp(2rem, 1.5rem + 3vw, 3.5rem); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); padding: clamp(1.3rem, 1rem + 1.5vw, 2rem); }
.card + .card { margin-top: 1.2rem; }
.muted-note { color: var(--muted); font-size: 0.9rem; }
fieldset { border: 0; padding: 0; margin: 0 0 1.6rem; }
fieldset legend { font-family: var(--font-mono); font-size: 0.78rem; letter-spacing: 0.04em; color: var(--signal); margin-bottom: 1rem; padding: 0; }
.checkline { display: grid; grid-template-columns: 22px 1fr; gap: 0.7rem; align-items: start; color: var(--muted); font-size: 0.95rem; }
.checkline input { margin-top: 3px; accent-color: var(--amber); width: 18px; height: 18px; }
.pricing-callout { display: flex; gap: 0.9rem; align-items: center; background: oklch(0.66 0.185 46 / 0.1); border: 1px solid oklch(0.6 0.14 55 / 0.4); border-radius: var(--radius-sm); padding: 1rem 1.1rem; margin-bottom: 1.6rem; }
.pricing-callout .big { font-family: var(--font-display); font-size: 2rem; color: var(--amber); line-height: 1; }
.pricing-callout p { color: var(--muted); font-size: 0.92rem; }
.pricing-callout p b { color: var(--ink); }
.book-facts { list-style: none; padding: 0; margin: 0 0 1.6rem; display: grid; gap: 0.55rem; }
.book-facts li { position: relative; padding-left: 1.5rem; color: var(--muted); font-size: 0.92rem; line-height: 1.5; }
.book-facts li::before { content: ""; position: absolute; left: 0; top: 0.5em; width: 7px; height: 7px; border-radius: 50%; background: var(--amber); }
.book-facts li b { color: var(--ink); }
.book-facts li.warn::before { background: var(--signal); }
.acc-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 0.5rem; }
.acc { display: flex; align-items: center; gap: 0.55rem; font-size: 0.92rem; color: var(--ink); background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.6em 0.8em; cursor: pointer; transition: border-color 0.2s; }
.acc:hover { border-color: var(--line-strong); }
.acc input { accent-color: var(--amber); width: 17px; height: 17px; flex: none; }
.book-contact { margin-top: 1.6rem; display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); }
.book-contact .bc { display: grid; grid-template-columns: 22px 1fr; gap: 0.7rem; align-items: start; color: var(--muted); font-size: 0.94rem; }
.book-contact .bc svg { width: 18px; height: 18px; color: var(--amber); margin-top: 3px; }
.book-contact .bc b { color: var(--ink); display: block; }
.book-contact .bc a { color: var(--ink); } .book-contact .bc a:hover { color: var(--amber); }

/* Job reference confirmation */
.ref-box { text-align: center; padding: clamp(1.5rem, 1rem + 2vw, 2.5rem); }
.ref-box .tick { width: 62px; height: 62px; margin: 0 auto 1rem; border-radius: 50%; background: oklch(0.5 0.12 150 / 0.18); border: 1.5px solid var(--signal); display: grid; place-items: center; color: var(--signal); }
.ref-box .tick svg { width: 30px; height: 30px; }
.ref-num { font-family: var(--font-mono); font-size: clamp(1.4rem, 1rem + 2.5vw, 2.1rem); color: var(--amber); letter-spacing: 0.04em; margin: 0.6rem 0; font-weight: 600; }
.ref-copy { display: inline-flex; gap: 0.5rem; align-items: center; font-family: var(--font-mono); font-size: 0.8rem; color: var(--muted); cursor: pointer; }

/* Lookup */
.lookup { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.4rem; }
.lookup input { flex: 1 1 220px; }
.lookup .btn { flex: none; }
.lookup-hint { margin-top: 0.9rem; font-size: 0.85rem; color: var(--faint); }
.lookup-hint code { color: var(--amber); background: var(--surface); padding: 0.1em 0.4em; border-radius: 5px; cursor: pointer; }

/* Status pill */
.pill { display: inline-flex; align-items: center; gap: 0.45rem; font-family: var(--font-mono); font-size: 0.76rem; padding: 0.35em 0.75em; border-radius: 100px; border: 1px solid var(--line-strong); color: var(--ink); white-space: nowrap; }
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.pill.g-new, .pill.g-arrival { color: var(--muted); }
.pill.g-diagnosis, .pill.g-parts, .pill.g-progress { color: var(--amber); border-color: oklch(0.6 0.14 60 / 0.5); }
.pill.g-approval { color: var(--amber-bright); border-color: var(--amber); }
.pill.g-testing { color: var(--signal-dim); }
.pill.g-ready, .pill.g-dispatch, .pill.g-completed { color: var(--signal); border-color: oklch(0.6 0.14 150 / 0.5); }
.pill.g-closed { color: var(--danger); border-color: oklch(0.6 0.15 27 / 0.5); }

/* Customer timeline stepper */
.stepper { display: grid; gap: 0; margin: 1.5rem 0; }
.stepper .step { display: grid; grid-template-columns: 34px 1fr; gap: 1rem; position: relative; padding-bottom: 1.4rem; }
.stepper .step:not(:last-child)::before { content: ""; position: absolute; left: 16px; top: 30px; bottom: -4px; width: 2px; background: var(--line); }
.stepper .step.done:not(:last-child)::before { background: var(--signal); }
.stepper .dot { width: 34px; height: 34px; border-radius: 50%; border: 2px solid var(--line-strong); display: grid; place-items: center; background: var(--bg); color: var(--faint); font-family: var(--font-mono); font-size: 0.8rem; z-index: 1; }
.stepper .step.done .dot { border-color: var(--signal); color: var(--signal); }
.stepper .step.current .dot { border-color: var(--amber); color: var(--on-amber); background: var(--amber); box-shadow: 0 0 0 4px oklch(0.66 0.185 46 / 0.2); }
.stepper .st-label { font-weight: 600; padding-top: 0.35rem; }
.stepper .step.pending .st-label { color: var(--faint); }
.stepper .st-sub { font-size: 0.82rem; color: var(--muted); font-family: var(--font-mono); }

/* Portal layout */
.portal-head { display: flex; flex-wrap: wrap; gap: 1rem; justify-content: space-between; align-items: flex-start; }
.portal-head .ref-num { margin: 0; font-size: 1.4rem; }
.kv { display: grid; grid-template-columns: max-content 1fr; gap: 0.5rem 1.2rem; font-size: 0.95rem; }
.kv dt { color: var(--muted); font-family: var(--font-mono); font-size: 0.82rem; }
.kv dd { color: var(--ink); }
.update-latest { border-left: 0; background: oklch(0.5 0.1 150 / 0.08); border: 1px solid oklch(0.6 0.14 150 / 0.3); border-radius: var(--radius-sm); padding: 1rem 1.1rem; }
.update-latest .u-date { font-family: var(--font-mono); font-size: 0.75rem; color: var(--signal); }

/* Estimate table */
.est-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; margin-top: 0.5rem; }
.est-table th { text-align: left; font-family: var(--font-mono); font-size: 0.72rem; letter-spacing: 0.04em; color: var(--muted); font-weight: 500; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.est-table td { padding: 0.55rem 0; border-bottom: 1px solid var(--line); }
.est-table td.num, .est-table th.num { text-align: right; font-variant-numeric: tabular-nums; }
.est-table tr.total td { font-weight: 700; color: var(--ink); border-bottom: 0; padding-top: 0.9rem; font-size: 1.05rem; }
.est-table tr.total td.num { color: var(--amber); }

.approve-box { margin-top: 1.4rem; border: 1px solid oklch(0.6 0.14 55 / 0.5); border-radius: var(--radius-sm); padding: 1.2rem; }
.approve-actions { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1rem; }
.btn-decline { background: transparent; color: var(--danger); box-shadow: inset 0 0 0 1.5px oklch(0.6 0.15 27 / 0.6); }
.btn-decline:hover { background: oklch(0.6 0.15 27 / 0.12); }
.paybar { display: flex; gap: 0.7rem; flex-wrap: wrap; margin-top: 1.2rem; }

/* Admin */
.admin-gate { max-width: 420px; margin: 3rem auto; }
.admin-topbar { display: flex; flex-wrap: wrap; gap: 1rem; align-items: center; justify-content: space-between; margin-bottom: 1.5rem; }
.admin-search { flex: 1 1 260px; position: relative; }
.admin-search input { width: 100%; }
.filter-chips { display: flex; gap: 0.5rem; flex-wrap: wrap; margin-bottom: 1.5rem; }
.chip-f { font-family: var(--font-mono); font-size: 0.8rem; padding: 0.45em 0.85em; border-radius: 100px; border: 1px solid var(--line-strong); color: var(--muted); background: var(--surface); cursor: pointer; transition: 0.2s; display: inline-flex; gap: 0.5rem; align-items: center; }
.chip-f .count { background: var(--bg); border-radius: 100px; padding: 0 0.5em; font-size: 0.72rem; color: var(--ink); }
.chip-f:hover { border-color: var(--amber); color: var(--ink); }
.chip-f.active { border-color: var(--amber); color: var(--on-amber); background: var(--amber); }
.chip-f.active .count { background: oklch(0.16 0.02 60 / 0.25); color: var(--on-amber); }
.chip-f.danger.active { background: var(--danger); border-color: var(--danger); }

.job-list { display: grid; gap: 0.7rem; }
.job-row { display: grid; grid-template-columns: 1fr auto; gap: 0.8rem 1rem; align-items: center; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 1rem 1.1rem; cursor: pointer; transition: 0.2s; text-align: left; width: 100%; }
.job-row:hover { border-color: var(--line-strong); transform: translateY(-1px); }
.job-row .jr-ref { font-family: var(--font-mono); font-size: 0.8rem; color: var(--amber); }
.job-row .jr-cust { font-weight: 600; }
.job-row .jr-eq { font-size: 0.88rem; color: var(--muted); }
.job-row .jr-right { text-align: right; display: grid; gap: 0.4rem; justify-items: end; }
.job-row .jr-flag { font-family: var(--font-mono); font-size: 0.68rem; color: var(--danger); }

.empty { text-align: center; color: var(--faint); padding: 3rem 1rem; font-family: var(--font-mono); font-size: 0.9rem; }

/* Job detail modal */
.modal-back { position: fixed; inset: 0; z-index: var(--z-modal, 800); background: oklch(0.1 0.006 60 / 0.7); backdrop-filter: blur(4px); display: none; padding: 1rem; overflow-y: auto; }
.modal-back.open { display: grid; place-items: start center; }
.modal { background: var(--bg-2); border: 1px solid var(--line-strong); border-radius: var(--radius); width: min(760px, 100%); margin: 2rem auto; max-height: none; }
.modal-head { position: sticky; top: 0; background: var(--bg-2); border-bottom: 1px solid var(--line); padding: 1.2rem 1.4rem; display: flex; justify-content: space-between; align-items: center; gap: 1rem; border-radius: var(--radius) var(--radius) 0 0; z-index: 2; }
.modal-body { padding: 1.4rem; display: grid; gap: 1.4rem; }
.modal-close { width: 40px; height: 40px; border-radius: 50%; box-shadow: inset 0 0 0 1.5px var(--line-strong); display: grid; place-items: center; flex: none; }
.sect-title { font-family: var(--font-mono); font-size: 0.74rem; letter-spacing: 0.06em; color: var(--signal); margin-bottom: 0.7rem; }
.note { border-radius: var(--radius-sm); padding: 0.8rem 0.95rem; font-size: 0.9rem; margin-bottom: 0.6rem; border: 1px solid var(--line); }
.note.customer { background: oklch(0.5 0.1 150 / 0.07); border-color: oklch(0.6 0.14 150 / 0.25); }
.note.private { background: oklch(0.66 0.185 46 / 0.08); border-color: oklch(0.6 0.14 55 / 0.3); }
.note .n-meta { font-family: var(--font-mono); font-size: 0.68rem; color: var(--muted); margin-bottom: 0.3rem; display: flex; gap: 0.5rem; }
.note.private .n-meta { color: var(--amber); }
.line-add { display: grid; grid-template-columns: 1fr 110px auto; gap: 0.5rem; align-items: end; }
.mini-btn { font-family: var(--font-body); font-weight: 600; font-size: 0.85rem; padding: 0.6em 1em; border-radius: 100px; border: 1px solid var(--line-strong); color: var(--ink); background: var(--surface); }
.mini-btn:hover { border-color: var(--amber); color: var(--amber); }
.row-actions { display: flex; flex-wrap: wrap; gap: 0.5rem; }

/* Email log / toast */
.toast-wrap { position: fixed; bottom: 1.2rem; left: 50%; transform: translateX(-50%); z-index: var(--z-toast); display: grid; gap: 0.5rem; width: min(420px, 92vw); }
.toast { background: var(--surface-2); border: 1px solid oklch(0.6 0.14 150 / 0.5); border-radius: var(--radius-sm); padding: 0.85rem 1rem; font-size: 0.88rem; box-shadow: 0 10px 30px oklch(0.05 0 0 / 0.5); animation: toastin 0.3s var(--ease-out); }
.toast b { color: var(--signal); font-family: var(--font-mono); font-size: 0.72rem; display: block; margin-bottom: 0.15rem; letter-spacing: 0.04em; }
@keyframes toastin { from { opacity: 0; transform: translateY(10px); } }

/* Invoice / job sheet (print) */
.print-doc { display: none; }
@media print {
  body * { visibility: hidden; }
  .print-doc, .print-doc * { visibility: visible; }
  .print-doc { display: block; position: absolute; inset: 0; background: #fff; color: #111; padding: 24mm 18mm; font-family: Arial, sans-serif; }
}
.invoice-preview { background: #fff; color: #1a1a1a; border-radius: var(--radius); padding: clamp(1.4rem, 1rem + 2vw, 2.4rem); font-family: Arial, Helvetica, sans-serif; }
.invoice-preview h2, .invoice-preview h3, .invoice-preview b { color: #111; }
.invoice-preview .inv-head { display: flex; justify-content: space-between; flex-wrap: wrap; gap: 1rem; border-bottom: 2px solid #111; padding-bottom: 1rem; margin-bottom: 1.2rem; }
.invoice-preview .inv-brand b { font-size: 1.2rem; }
.invoice-preview .inv-meta { text-align: right; font-size: 0.85rem; color: #444; }
.invoice-preview table { width: 100%; border-collapse: collapse; margin: 1rem 0; font-size: 0.9rem; }
.invoice-preview th { text-align: left; border-bottom: 1px solid #ccc; padding: 0.5rem 0; color: #555; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
.invoice-preview td { padding: 0.5rem 0; border-bottom: 1px solid #eee; }
.invoice-preview td.num, .invoice-preview th.num { text-align: right; }
.invoice-preview .inv-total td { font-weight: 700; font-size: 1.05rem; border-bottom: 0; padding-top: 0.8rem; }
.invoice-preview .inv-foot { margin-top: 1.4rem; font-size: 0.8rem; color: #555; border-top: 1px solid #ccc; padding-top: 1rem; }
.invoice-preview .paid-stamp { display: inline-block; border: 2px solid #1a7f37; color: #1a7f37; font-weight: 700; padding: 0.2em 0.7em; border-radius: 6px; transform: rotate(-4deg); }
.invoice-preview .due-stamp { display: inline-block; border: 2px solid #b42318; color: #b42318; font-weight: 700; padding: 0.2em 0.7em; border-radius: 6px; }

@media (min-width: 720px) {
  .portal-2col { display: grid; grid-template-columns: 1.4fr 1fr; gap: 1.2rem; align-items: start; }
  .line-add { grid-template-columns: 1fr 120px auto; }
}
@media (min-width: 900px) {
  .stepper { grid-template-columns: repeat(6, 1fr); gap: 0.5rem; }
  .stepper .step { grid-template-columns: 1fr; text-align: center; padding-bottom: 0; }
  .stepper .step:not(:last-child)::before { left: calc(50% + 20px); right: calc(-50% + 20px); top: 16px; bottom: auto; width: auto; height: 2px; }
  .stepper .dot { margin: 0 auto; }
  .stepper .st-label { padding-top: 0.6rem; }
}
