/*
 * Shared styles for the quote app: the owner dashboard, the customer's quote
 * page and the request form. Colors and fonts come from /brand/brand.css
 * (the --b-... values), so one set of styles fits every client's brand.
 * Built for phones first.
 */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font: 400 1.0625rem/1.55 var(--b-body, system-ui, sans-serif);
  color: var(--b-ink, #111);
  background: var(--b-paper, #f6f6f6);
}

h1, h2, h3 { font-family: var(--b-display, inherit); font-weight: var(--b-display-weight, 700); line-height: 1.15; margin: 0; }
h1 { font-size: clamp(1.7rem, 1.3rem + 2vw, 2.3rem); }
h2 { font-size: 1.35rem; }
h3 { font-size: 1.1rem; }
p { margin: 0; }
a { color: var(--b-accent); text-underline-offset: 0.16em; }
[hidden] { display: none !important; }

.wrap { width: min(100% - 32px, 1040px); margin-inline: auto; }
.wrap.narrow { width: min(100% - 32px, 760px); }
.stack { display: grid; gap: 16px; }
.stack.tight { gap: 8px; }
.row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.row.between { justify-content: space-between; }
.grow { flex: 1; min-width: 0; }
.soft { color: var(--b-ink-soft); }
.small { font-size: 0.875rem; }
.num { font-family: var(--b-numbers, inherit); font-variant-numeric: tabular-nums; }
.right { text-align: right; }
.pre { white-space: pre-wrap; overflow-wrap: anywhere; }
.label { font: 700 0.75rem/1.2 var(--b-body); letter-spacing: 0.09em; text-transform: uppercase; color: var(--b-ink-soft); }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

/* ---------- Top bar ---------- */
.topbar { background: var(--b-band); color: var(--b-on-band); }
.topbar .wrap { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 20px; padding-block: 10px; }
.brandmark { display: flex; align-items: center; gap: 10px; color: inherit; text-decoration: none; min-width: 0; }
.brandmark img { height: 34px; width: auto; max-width: 72px; background: #fff; border-radius: 6px; padding: 3px; }
.brandmark strong { font: var(--b-display-weight, 700) 1.15rem/1.1 var(--b-display); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav { display: flex; flex-wrap: wrap; gap: 2px; margin-left: auto; max-width: 100%; }
.nav a, .nav button {
  font: 600 0.95rem/1 var(--b-body); color: var(--b-on-band); background: none; border: 0; cursor: pointer;
  padding: 10px 12px; border-radius: var(--b-radius); text-decoration: none; white-space: nowrap; opacity: 0.85;
}
.nav a:hover, .nav button:hover { opacity: 1; text-decoration: underline; }
.nav a[aria-current="page"] { opacity: 1; box-shadow: inset 0 -3px 0 var(--b-band-accent); }
.badge { display: inline-block; min-width: 1.35em; padding: 1px 6px; margin-left: 6px; border-radius: 99px; background: var(--b-band-accent); color: var(--b-band); font-size: 0.75rem; font-weight: 700; text-align: center; }

/* Phones: the menu becomes two tidy rows so nothing hides off the edge. */
@media (max-width: 700px) {
  .nav { display: grid; grid-template-columns: repeat(3, 1fr); width: 100%; margin-left: 0; }
  .nav a, .nav button { text-align: center; padding: 11px 4px; }
}

main { padding-block: 24px 64px; }

/* ---------- Cards ---------- */
.card { background: var(--b-panel); border: 1px solid var(--b-rule); border-radius: var(--b-radius); padding: clamp(16px, 3vw, 24px); }
.tiles { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.tile { display: grid; gap: 4px; text-decoration: none; color: inherit; }
.tile b { font: 500 1.9rem/1 var(--b-numbers); font-variant-numeric: tabular-nums; }
.tile:hover { border-color: var(--b-ink); }
@media (min-width: 760px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; text-decoration: none;
  font: 600 1rem/1 var(--b-body); padding: 13px 18px; border-radius: var(--b-radius); border: 0;
  background: var(--b-accent); color: var(--b-on-accent); min-height: 46px;
}
.btn:hover { text-decoration: underline; text-decoration-thickness: 2px; }
.btn.ghost { background: transparent; color: var(--b-ink); box-shadow: inset 0 0 0 1.5px var(--b-ink); }
.btn.quiet { background: transparent; color: var(--b-ink-soft); padding-inline: 10px; min-height: 40px; }
.btn.danger { background: transparent; color: #a11212; box-shadow: inset 0 0 0 1.5px #a11212; }
.btn.small { padding: 9px 12px; min-height: 38px; font-size: 0.9rem; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; text-decoration: none; }
.btn.block { width: 100%; }
:focus-visible { outline: 3px solid var(--b-accent); outline-offset: 2px; }
.topbar :focus-visible { outline-color: var(--b-band-accent); }

/* ---------- Forms ---------- */
.field { display: grid; gap: 6px; min-width: 0; }
.field > span, .field > label { font: 600 0.9rem/1.3 var(--b-body); }
.field .hint { font-weight: 400; color: var(--b-ink-soft); }
.fields { display: grid; gap: 14px; }
@media (min-width: 620px) { .fields.two { grid-template-columns: repeat(2, minmax(0, 1fr)); } .fields.three { grid-template-columns: repeat(3, minmax(0, 1fr)); } .span-all { grid-column: 1 / -1; } }
input[type="text"], input[type="email"], input[type="tel"], input[type="password"], input[type="number"], input[type="date"], input[type="search"], select, textarea {
  font: 400 1rem/1.4 var(--b-body); color: var(--b-ink); background: var(--b-panel);
  border: 1px solid var(--b-rule); border-radius: var(--b-radius); padding: 11px 12px; width: 100%; min-width: 0;
}
textarea { resize: vertical; min-height: 84px; }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: 3px solid var(--b-accent); outline-offset: 1px; border-color: var(--b-accent); }
input.num { text-align: right; }
.check { display: inline-flex; align-items: center; gap: 8px; font-size: 0.95rem; cursor: pointer; }
.check input { width: 20px; height: 20px; accent-color: var(--b-accent); margin: 0; flex: none; }
.honeypot { position: absolute; left: -9999px; width: 1px; height: 1px; opacity: 0; }

.notice { padding: 12px 14px; border-radius: var(--b-radius); border: 1px solid var(--b-rule); background: var(--b-tint); }
.notice.error { border-color: #a11212; background: #fdecec; color: #6d0c0c; font-weight: 600; }
.notice.good { border-color: #1c7a43; background: #e8f6ee; color: #0f4d29; }

/* ---------- Status chips ---------- */
.chip { display: inline-block; padding: 4px 10px; border-radius: 99px; font: 700 0.72rem/1.2 var(--b-body); letter-spacing: 0.07em; text-transform: uppercase; background: var(--b-tint); color: var(--b-ink); white-space: nowrap; }
.chip.draft { background: #ececec; color: #444; }
.chip.sent, .chip.viewed, .chip.new { background: #fff1c9; color: #6b4a00; }
.chip.accepted, .chip.quoted { background: #dcf3e4; color: #0f4d29; }
.chip.declined, .chip.expired, .chip.archived { background: #f6dede; color: #6d0c0c; }

.filters { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 2px; }
.filters button { font: 600 0.9rem/1 var(--b-body); padding: 9px 14px; border-radius: 99px; border: 1px solid var(--b-rule); background: var(--b-panel); color: var(--b-ink); cursor: pointer; white-space: nowrap; }
.filters button[aria-pressed="true"] { background: var(--b-ink); color: var(--b-panel); border-color: var(--b-ink); }

/* ---------- Lists (requests, quotes) ---------- */
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list a { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 4px 12px; align-items: center; padding: 14px 16px; background: var(--b-panel); border: 1px solid var(--b-rule); border-radius: var(--b-radius); color: inherit; text-decoration: none; }
.list a:hover { border-color: var(--b-ink); }
.list .who { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .what { grid-column: 1; color: var(--b-ink-soft); font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list .amt { grid-row: 1; grid-column: 2; text-align: right; font-weight: 500; }
.list .meta { grid-column: 2; text-align: right; }
.empty { padding: 28px 16px; text-align: center; color: var(--b-ink-soft); border: 1px dashed var(--b-rule); border-radius: var(--b-radius); }

/* ---------- Quote editor ---------- */
.editor { display: grid; gap: 16px; align-items: start; }
@media (min-width: 900px) { .editor { grid-template-columns: minmax(0, 1fr) 300px; } .editor .side { position: sticky; top: 12px; } }
.item { display: grid; gap: 10px; padding: 14px; border: 1px solid var(--b-rule); border-radius: var(--b-radius); background: var(--b-paper); }
.item.optional { border-style: dashed; }
.item .nums { display: grid; grid-template-columns: 1fr 1fr 1.3fr; gap: 8px; align-items: end; }
.item .foot { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; }
.item .line-total { margin-left: auto; font-weight: 500; white-space: nowrap; }
.item textarea { min-height: 68px; }
.totals { display: grid; gap: 6px; }
.totals div { display: flex; justify-content: space-between; gap: 12px; }
.totals .grand { font-size: 1.3rem; font-weight: 700; padding-top: 8px; margin-top: 2px; border-top: 2px solid var(--b-ink); }
.totals .grand span:last-child { color: var(--b-accent); }
.totals .grand + .grand { border-top: 0; padding-top: 0; }
.totals .repeat { font-weight: 700; }
.side .totals .grand { font-size: 1.12rem; }
.photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 8px; margin-top: 6px; }
.photos img { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: var(--b-radius); border: 1px solid var(--b-rule); display: block; }
input[type="file"] { font: 400 0.95rem/1.4 var(--b-body); max-width: 100%; }
.pricerow-flags { grid-column: 1 / -1; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; font-size: 0.9rem; }
.timeline time { display: block; color: var(--b-ink-soft); font-size: 0.8rem; }
.share { display: grid; gap: 10px; }
.share .linkrow { display: flex; gap: 8px; }
.share input { font-size: 0.85rem; }
.pricerow { display: grid; gap: 8px; padding: 12px; border: 1px solid var(--b-rule); border-radius: var(--b-radius); background: var(--b-panel); }
@media (min-width: 760px) { .pricerow { grid-template-columns: 2fr 3fr 150px 130px; align-items: center; } }

/* In-page question boxes */
dialog.ask { border: 1px solid var(--b-rule); border-radius: var(--b-radius); padding: 22px; width: min(100% - 32px, 460px); color: var(--b-ink); background: var(--b-panel); box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3); }
dialog.ask::backdrop { background: rgba(8, 18, 36, 0.55); }
.btn.danger-fill { background: #a11212; color: #fff; }

/* Getting started, and "since your last visit" */
.setup { border-left: 6px solid var(--b-accent); }
.setup ol { margin: 0; padding: 0; list-style: none; display: grid; gap: 8px; }
.setup li { display: flex; gap: 10px; align-items: baseline; }
.setup li::before { content: "○"; color: var(--b-ink-soft); flex: none; }
.setup li.done { color: var(--b-ink-soft); }
.setup li.done::before { content: "✓"; color: #1c7a43; font-weight: 700; }
.meter { height: 10px; border-radius: 99px; background: var(--b-tint); overflow: hidden; border: 1px solid var(--b-rule); }
.meter span { display: block; height: 100%; background: var(--b-accent); }

/* Phones and small tablets: the total and the main button ride along at the bottom of the quote builder. */
.actionbar { display: none; }
@media (max-width: 899px) {
  .actionbar { display: flex; align-items: center; gap: 12px; position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; padding: 10px 16px calc(10px + env(safe-area-inset-bottom)); background: var(--b-panel); border-top: 1px solid var(--b-rule); box-shadow: 0 -6px 20px rgba(8, 18, 36, 0.12); }
  .actionbar .sum { flex: 1; min-width: 0; display: grid; }
  .actionbar .sum b { font: 700 1.15rem/1.2 var(--b-numbers); color: var(--b-accent); }
  .has-actionbar { padding-bottom: 84px; }
  .has-actionbar ~ .toast, body:has(.actionbar) .toast { bottom: 96px; }
}

.toast { position: fixed; left: 50%; bottom: 20px; transform: translateX(-50%); background: var(--b-ink); color: var(--b-panel); padding: 12px 18px; border-radius: 99px; font-weight: 600; font-size: 0.95rem; z-index: 20; max-width: calc(100% - 32px); box-shadow: 0 8px 24px rgba(0, 0, 0, 0.25); }

/* ---------- The quote sheet the customer sees ---------- */
.sheet { background: var(--b-panel); border: 1px solid var(--b-rule); border-top: var(--b-sheet-top, 6px solid var(--b-ink)); border-radius: var(--b-radius); padding: clamp(18px, 4vw, 40px); display: grid; gap: 24px; box-shadow: 0 14px 34px rgba(8, 18, 36, 0.08); }
.sheet-head { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 16px 24px; padding-bottom: 18px; border-bottom: 2px solid var(--b-ink); }
.sheet-brand { display: flex; align-items: center; gap: 14px; min-width: 0; }
.sheet-brand img { height: 60px; width: auto; max-width: 110px; }
.sheet-brand strong { display: block; font: var(--b-display-weight, 700) 1.5rem/1.1 var(--b-display); }
.sheet-brand span { display: block; line-height: 1.3; margin-top: 4px; }
.sheet-meta { display: grid; gap: 2px; text-align: right; margin-left: auto; }
.sheet-meta .no { font: 500 1.1rem/1.2 var(--b-numbers); color: var(--b-accent); letter-spacing: 0.04em; }
.lines { width: 100%; border-collapse: collapse; }
.lines th { font: 700 0.72rem/1.2 var(--b-body); letter-spacing: 0.09em; text-transform: uppercase; color: var(--b-ink-soft); text-align: left; padding: 0 8px 8px 0; border-bottom: 1px solid var(--b-rule); }
.lines td { padding: 12px 8px 12px 0; border-bottom: 1px solid var(--b-rule); vertical-align: top; }
.lines th:last-child, .lines td:last-child { padding-right: 0; text-align: right; white-space: nowrap; }
.lines .qty { white-space: nowrap; color: var(--b-ink-soft); }
.lines .desc { color: var(--b-ink-soft); font-size: 0.92rem; }
.extras { display: grid; gap: 8px; }
.extra { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border: 1.5px dashed var(--b-rule); border-radius: var(--b-radius); cursor: pointer; }
.extra:has(input:checked) { border-style: solid; border-color: var(--b-accent); background: var(--b-tint); }
.extra input { width: 22px; height: 22px; margin-top: 2px; accent-color: var(--b-accent); flex: none; }
.sheet .totals { margin-left: auto; width: min(100%, 320px); }
.accept { display: grid; gap: 14px; padding: clamp(16px, 3vw, 24px); background: var(--b-tint); border-radius: var(--b-radius); }
.banner { padding: 14px 16px; border-radius: var(--b-radius); font-weight: 600; }
.banner.accepted { background: #dcf3e4; color: #0f4d29; }
.banner.declined, .banner.expired { background: #f6dede; color: #6d0c0c; }
.banner.preview { background: #fff1c9; color: #6b4a00; }
.credit { text-align: center; font-size: 0.8rem; color: var(--b-ink-soft); padding-block: 20px; }
.credit a { color: inherit; }

@media (max-width: 560px) {
  .sheet-meta { text-align: left; margin-left: 0; }
  .lines thead { display: none; }
  .lines tr { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 2px 12px; padding: 12px 0; border-bottom: 1px solid var(--b-rule); }
  .lines td { padding: 0; border: 0; }
  .lines td.name { grid-column: 1; }
  .lines td.amount { grid-column: 2; grid-row: 1; }
  .lines td.qty { grid-column: 1 / -1; font-size: 0.9rem; }
  .lines td.unit-price { display: none; }
}

@media print {
  body { background: #fff; font-size: 11pt; }
  .no-print, .topbar, .toast { display: none !important; }
  .sheet { border: 0; box-shadow: none; padding: 0; }
  .wrap, .wrap.narrow { width: 100%; }
  main { padding: 0; }
  .accept, .banner { border: 1px solid #999; background: none !important; color: #000 !important; }
  a { color: inherit; text-decoration: none; }
}

@media (prefers-reduced-motion: no-preference) { html { scroll-behavior: smooth; } }
