/* ===== Crest to Peak Estimator — styles =====
   Two worlds: the APP (dark, orange, built for thumbs) and the PAPER (white, printable). */

:root {
  --bg: #0b0b0b;
  --bg-2: #161616;
  --card: #1c1c1c;
  --card-2: #242424;
  --line: #2e2e2e;
  --text: #f4f4f4;
  --muted: #a3a3a3;
  --orange: #ff8a00;
  --orange-2: #ffb400;
  --yellow: #ffd200;
  --red: #ff3b30;
  --green: #30d158;
  --accent-grad: linear-gradient(135deg, #ff6a00 0%, #ff9f00 55%, #ffd200 100%);
  --radius: 14px;
  --tab-h: 64px;
  --font-display: "Barlow Condensed", "Arial Narrow", Impact, sans-serif;
  --font-body: "Inter", -apple-system, "Segoe UI", Roboto, sans-serif;
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text); font-family: var(--font-body); font-size: 16px; line-height: 1.4;
  padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom));
}
a { color: var(--orange-2); text-decoration: none; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: .02em; margin: 0; }
h1 { font-size: 30px; font-weight: 800; text-transform: uppercase; }
h2 { font-size: 24px; font-weight: 700; text-transform: uppercase; }
h3 { font-size: 20px; font-weight: 700; }
small, .muted { color: var(--muted); }
hr { border: 0; border-top: 1px solid var(--line); margin: 14px 0; }
img { max-width: 100%; }
[hidden] { display: none !important; }

/* ---- top bar / tab bar ---- */
.topbar {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center; justify-content: space-between;
  padding: 8px 14px; padding-top: calc(8px + env(safe-area-inset-top)); background: rgba(11,11,11,.92); backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--line);
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: var(--font-display); font-size: 20px; font-weight: 700; text-transform: uppercase; }
.brand img { height: 36px; width: auto; border-radius: 6px; }
.topbar-actions { display: flex; gap: 8px; }
.tabbar {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; display: flex; height: calc(var(--tab-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); background: #111; border-top: 1px solid var(--line);
}
.tabbar a { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; color: var(--muted); font-size: 12px; font-weight: 600; }
.tabbar a .ico { font-size: 20px; }
.tabbar a.active { color: var(--orange-2); }

/* ---- layout ---- */
main { max-width: 900px; margin: 0 auto; padding: 14px 14px 30px; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.card-head h2 { font-size: 22px; }
.section-title { display: flex; align-items: center; gap: 10px; margin: 18px 0 8px; color: var(--orange-2); font-family: var(--font-display); font-size: 16px; text-transform: uppercase; letter-spacing: .08em; }
.section-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
.grid-2 { display: grid; gap: 10px; grid-template-columns: 1fr 1fr; }
.grid-3 { display: grid; gap: 10px; grid-template-columns: repeat(3, 1fr); }
.stack { display: flex; flex-direction: column; gap: 10px; }
.spread { display: flex; justify-content: space-between; align-items: center; gap: 10px; }

/* ---- forms ---- */
label.field { display: flex; flex-direction: column; gap: 5px; font-size: 13px; font-weight: 600; color: var(--muted); }
label.field > span.hint { font-weight: 400; font-size: 12px; }
input[type=text], input[type=number], input[type=email], input[type=tel], input[type=date], select, textarea {
  width: 100%; min-height: 46px; padding: 10px 12px; border-radius: 10px; border: 1px solid #3a3a3a; background: #0f0f0f; color: var(--text);
  font: inherit; font-size: 16px; outline: none;
}
input:focus, select:focus, textarea:focus { border-color: var(--orange); box-shadow: 0 0 0 3px rgba(255,138,0,.2); }
input[type=number] { font-variant-numeric: tabular-nums; }
input, select, textarea, .unit, .grid > *, .grid-2 > *, .grid-3 > *, .list-row > *, label.field { min-width: 0; }
.unit input { flex: 1 1 0; width: 0; }
textarea { min-height: 90px; resize: vertical; line-height: 1.4; }
select { appearance: none; background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%); background-position: calc(100% - 18px) 20px, calc(100% - 13px) 20px; background-size: 5px 5px; background-repeat: no-repeat; padding-right: 34px; }
.check { display: flex; align-items: center; gap: 10px; min-height: 44px; font-size: 15px; font-weight: 500; color: var(--text); cursor: pointer; }
.check input { width: 22px; height: 22px; accent-color: var(--orange); flex: none; }
.unit { display: flex; align-items: center; }
.unit input { border-top-right-radius: 0; border-bottom-right-radius: 0; }
.unit span { min-height: 46px; display: flex; align-items: center; padding: 0 10px; border: 1px solid #3a3a3a; border-left: 0; border-radius: 0 10px 10px 0; background: #1a1a1a; color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; }
.seg { display: inline-flex; background: #0f0f0f; border: 1px solid #3a3a3a; border-radius: 10px; overflow: hidden; }
.seg button { padding: 10px 14px; background: transparent; border: 0; color: var(--muted); font: inherit; font-weight: 600; min-height: 44px; }
.seg button.on { background: var(--orange); color: #000; }

/* ---- buttons ---- */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 46px; padding: 10px 16px; border-radius: 12px; border: 1px solid #3a3a3a; background: var(--card-2); color: var(--text); font: inherit; font-weight: 600; font-size: 15px; cursor: pointer; white-space: nowrap; }
.btn:active { transform: translateY(1px); }
.btn.primary { background: var(--accent-grad); color: #000; border-color: transparent; }
.btn.danger { color: var(--red); border-color: rgba(255,59,48,.4); }
.btn.ghost { background: transparent; }
.btn.sm { min-height: 36px; padding: 6px 12px; font-size: 13px; border-radius: 9px; }
.btn.block { width: 100%; }
.btn.icon { width: 44px; padding: 0; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 12px; }
.actions .btn { flex: 1; }

/* ---- pills / badges ---- */
.pill { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; background: #2a2a2a; color: var(--muted); }
.pill.draft { background: #2a2a2a; color: #ccc; }
.pill.sent { background: rgba(255,180,0,.18); color: var(--orange-2); }
.pill.accepted { background: rgba(48,209,88,.18); color: var(--green); }
.pill.invoiced { background: rgba(10,132,255,.18); color: #6fb3ff; }
.pill.paid { background: rgba(48,209,88,.3); color: #8cf0a9; }
.pill.lost { background: rgba(255,59,48,.18); color: #ff8a80; }

/* ---- job list ---- */
.job { display: block; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; margin-bottom: 10px; color: var(--text); }
.job .top { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.job .name { font-weight: 700; font-size: 17px; }
.job .addr { color: var(--muted); font-size: 14px; }
.job .amt { font-family: var(--font-display); font-size: 24px; font-weight: 700; color: var(--orange-2); }
.job .meta { display: flex; gap: 10px; align-items: center; margin-top: 8px; font-size: 13px; color: var(--muted); }
.job .lastnote { margin-top: 6px; font-size: 13px; color: #ddd; background: #141414; border-left: 3px solid var(--orange); padding: 4px 8px; border-radius: 0 6px 6px 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 60ch; }
.job .lastnote b { color: var(--orange-2); }
.note { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 8px 0; border-top: 1px solid var(--line); }
.note:first-child { border-top: 0; }
.note-date { font-family: var(--font-display); font-weight: 700; color: var(--orange-2); white-space: nowrap; font-size: 15px; padding-top: 2px; }
.note-text { font-size: 15px; line-height: 1.4; }
.search { margin-bottom: 12px; width: 100%; }
.job .meta .btn { margin-left: 8px; }
@media (max-width: 480px) { .job .meta { flex-wrap: wrap; } .job .meta .btn { flex: 1; margin: 6px 0 0; } }
.empty { text-align: center; padding: 40px 20px; color: var(--muted); }
.empty h2 { color: var(--text); margin-bottom: 6px; }

/* ---- trade toggles ---- */
.trade-toggle { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.switch { position: relative; width: 52px; height: 30px; flex: none; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .knob { position: absolute; inset: 0; background: #3a3a3a; border-radius: 999px; transition: .2s; }
.switch .knob::before { content: ""; position: absolute; width: 24px; height: 24px; left: 3px; top: 3px; background: #fff; border-radius: 50%; transition: .2s; }
.switch input:checked + .knob { background: var(--orange); }
.switch input:checked + .knob::before { transform: translateX(22px); }

/* ---- computed readouts ---- */
.readout { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 8px; margin-top: 10px; }
.readout div { background: #0f0f0f; border: 1px solid var(--line); border-radius: 10px; padding: 8px 10px; }
.readout b { display: block; font-family: var(--font-display); font-size: 20px; color: var(--orange-2); }
.readout span { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

/* ---- option list in editor ---- */
.opt { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line); }
.opt:first-child { border-top: 0; }
.opt input[type=checkbox] { width: 22px; height: 22px; accent-color: var(--orange); }
.opt .info { flex: 1; min-width: 0; }
.opt .info b { display: block; }
.opt .info small { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.opt .price { font-family: var(--font-display); font-size: 22px; font-weight: 700; color: var(--orange-2); white-space: nowrap; }
.opt .rec { font-size: 11px; font-weight: 700; color: var(--muted); display: flex; align-items: center; gap: 4px; }
.opt .rec input { accent-color: var(--green); width: 18px; height: 18px; }

/* line-item breakdown */
details.breakdown { margin-top: 8px; }
details.breakdown summary { cursor: pointer; color: var(--orange-2); font-weight: 600; font-size: 14px; padding: 6px 0; }
table.items { width: 100%; border-collapse: collapse; font-size: 13px; }
table.items th, table.items td { padding: 6px 4px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
table.items td.n, table.items th.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
table.items tr.sub td { font-weight: 700; color: var(--orange-2); }
table.items tr.cat td { color: var(--muted); text-transform: uppercase; font-size: 11px; letter-spacing: .05em; padding-top: 10px; }

/* sticky total bar */
.totalbar { position: sticky; bottom: calc(var(--tab-h) + env(safe-area-inset-bottom) + 8px); z-index: 10; display: flex; align-items: center; justify-content: space-between; gap: 10px; background: #141414; border: 1px solid #333; border-radius: 14px; padding: 10px 14px; margin-top: 14px; box-shadow: 0 8px 30px rgba(0,0,0,.6); }
.totalbar .amt { font-family: var(--font-display); font-size: 28px; font-weight: 800; color: var(--orange-2); }
.totalbar small { display: block; }

/* list editor (sections / walls) */
.list-rows { display: flex; flex-direction: column; gap: 8px; }
.list-row { display: grid; gap: 8px; align-items: end; }
.list-row.sections { grid-template-columns: 1.2fr 1fr 1fr 1fr auto; }
.list-row.walls { grid-template-columns: 1.4fr 1fr 1fr auto; }
.list-row.extras { grid-template-columns: 2fr 1fr auto; }
.list-row .btn.icon { min-height: 46px; }

/* toast + modal */
/* ---- calendar ---- */
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 4px; margin-top: 10px; }
.cal-dow { margin-top: 12px; font-size: 11px; font-weight: 700; color: var(--muted); text-align: center; letter-spacing: .06em; }
.cal-cell { min-height: 92px; border-radius: 10px; border: 1px solid var(--line); background: #0f0f0f; color: var(--text); font: inherit; display: flex; flex-direction: column; align-items: stretch; gap: 3px; padding: 4px; cursor: pointer; min-width: 0; }
.cal-cell.empty { border: 0; background: transparent; cursor: default; }
.cal-cell .n { font-weight: 700; font-size: 14px; line-height: 1; margin: 2px 2px 3px; }
.cal-cell.today .n { color: var(--orange-2); }
.cal-cell.today { border-color: var(--orange); }
.cal-cell.sel { background: #2a1a05; border-color: var(--orange); box-shadow: inset 0 0 0 1px var(--orange); }
.cal-cell.sel .n { color: var(--orange-2); }
.chip { font-size: 11px; line-height: 1.2; padding: 3px 5px; border-radius: 5px; background: #2a2a2a; color: #eee; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; border-left: 3px solid #999; cursor: pointer; }
.chip.visit { border-left-color: #6fb3ff; } .chip.call { border-left-color: var(--orange-2); } .chip.install { border-left-color: var(--green); } .chip.other { border-left-color: #c8a2ff; }
.chip.done { opacity: .45; text-decoration: line-through; }
.chip.more { background: transparent; border-left: 0; color: var(--muted); padding-left: 2px; }
.chip:hover { background: #3a3a3a; }
@media (max-width: 600px) {
  .cal-grid { gap: 2px; }
  .cal-cell { min-height: 74px; padding: 3px 2px; border-radius: 7px; }
  .cal-cell .n { font-size: 12px; }
  .chip { font-size: 9.5px; padding: 2px 3px; border-left-width: 2px; }
  .cal-dow { font-size: 10px; }
}
.week { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.wday { border: 1px solid var(--line); border-radius: 10px; padding: 8px 12px; background: #0f0f0f; }
.wday.today { border-color: var(--orange); }
.wday-head { display: flex; justify-content: space-between; align-items: center; font-size: 15px; margin-bottom: 4px; }
.wday .ev { padding: 8px 0; }
.dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background: #999; }
.dot.visit { background: #6fb3ff; } .dot.call { background: var(--orange-2); } .dot.install { background: var(--green); } .dot.other { background: #c8a2ff; }
.dot.done { opacity: .35; }
.cal-cell.sel .dot { outline: 1px solid rgba(0,0,0,.4); }
.ev { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: center; padding: 10px 0; border-top: 1px solid var(--line); }
.ev:first-of-type { border-top: 0; }
.ev-check { width: 30px; height: 30px; border-radius: 8px; border: 2px solid #555; background: #0f0f0f; color: var(--green); font-size: 16px; font-weight: 800; cursor: pointer; }
.ev.done .ev-check { border-color: var(--green); }
.ev.done .ev-title, .ev.done .ev-meta { text-decoration: line-through; color: var(--muted); }
.ev.overdue .ev-check { border-color: var(--red); }
.ev-body { cursor: pointer; min-width: 0; }
.ev-title { font-weight: 700; font-size: 16px; }
.ev-meta { font-size: 13px; color: var(--muted); }
.ev-notes { font-size: 13px; color: #ccc; margin-top: 2px; white-space: pre-wrap; }
.card.today { border-color: rgba(255,138,0,.5); }

/* sign-in screen */
.modal.login { align-items: center; z-index: 45; }
.login-sheet { max-width: 420px; border-radius: 18px; text-align: left; }
.login-sheet img { width: 70%; max-width: 280px; display: block; margin: 0 auto 14px; border-radius: 10px; }
.login-sheet h2 { margin-bottom: 4px; }
.brand.pending::after { content: ""; width: 9px; height: 9px; border-radius: 50%; background: var(--orange); box-shadow: 0 0 0 3px rgba(255,138,0,.25); }

.toast { position: fixed; left: 50%; bottom: calc(var(--tab-h) + 20px); transform: translateX(-50%); background: #fff; color: #000; padding: 10px 16px; border-radius: 999px; font-weight: 600; z-index: 50; box-shadow: 0 6px 24px rgba(0,0,0,.5); }
.modal { position: fixed; inset: 0; z-index: 40; background: rgba(0,0,0,.7); display: flex; align-items: flex-end; justify-content: center; }
.modal .sheet { background: var(--card); width: 100%; max-width: 640px; max-height: 88vh; overflow: auto; border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
@media (min-width: 700px) { .modal { align-items: center; } .modal .sheet { border-radius: 18px; } }
.guide svg { width: 100%; height: auto; background: #0f0f0f; border-radius: 10px; }
.guide p { font-size: 14px; }
.guide dt { font-weight: 700; color: var(--orange-2); margin-top: 8px; }
.guide dd { margin: 2px 0 0; font-size: 14px; color: #ddd; }

/* price book */
.pb-table { width: 100%; border-collapse: collapse; font-size: 14px; }
.pb-table th { text-align: left; color: var(--muted); font-size: 11px; text-transform: uppercase; letter-spacing: .05em; padding: 4px; }
.pb-table td { padding: 4px; vertical-align: middle; }
.pb-table input { min-height: 40px; padding: 6px 8px; font-size: 15px; }
.pb-card { background: #0f0f0f; border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 10px; }
.pb-card .grid { grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); }

/* ---------- document toolbar ---------- */
.doc-toolbar { position: sticky; top: 0; z-index: 30; display: flex; gap: 8px; flex-wrap: wrap; align-items: center; background: #111; border-bottom: 1px solid var(--line); padding: 10px 12px; padding-top: calc(10px + env(safe-area-inset-top)); }
.doc-toolbar .btn { min-height: 40px; }
.doc-wrap { background: #3a3a3a; padding: 12px 0 40px; }
body.doc-mode { padding-bottom: calc(var(--tab-h) + env(safe-area-inset-bottom)); }
body.doc-mode .topbar { display: none; }
@media (max-width: 480px) { .brand span { display: none; } .topbar-actions .btn { padding: 6px 10px; } }
body.doc-mode main { max-width: none; padding: 0; }

/* ============================================================
   THE PAPER — estimate & invoice. Printable, letter sized.
   ============================================================ */
.paper {
  --ink: #111;
  --ink-2: #555;
  --rule: #e2e2e2;
  --brand: #ff8a00;
  --brand-2: #ffb400;
  --brand-dark: #0b0b0b;
  --fx: .32in;   /* frame padding, horizontal */
  --fy: .22in;   /* frame padding, vertical */
  width: 8.5in; max-width: 100%; margin: 0 auto; color: var(--ink);
  font-family: var(--font-body); font-size: 10.5pt; line-height: 1.45;
}
.paper h1, .paper h2, .paper h3, .paper h4 { font-family: var(--font-display); color: var(--ink); }
/* Each .sheet is one printed page. The .frame draws the border inside the page margins. */
.paper .sheet { background: #fff; padding: .42in; margin: 0 auto 18px; min-height: 11in; box-shadow: 0 10px 40px rgba(0,0,0,.5); display: flex; }
.paper .frame { flex: 1; position: relative; border: 1.5px solid var(--brand-dark); border-radius: 4px; padding: var(--fy) var(--fx) .08in; display: flex; flex-direction: column; box-sizing: border-box; -webkit-box-decoration-break: clone; box-decoration-break: clone; }
.paper .sheet-body { flex: 1; }
.paper .sheet-foot { margin-top: 4px; padding-top: 3px; border-top: 1px solid var(--rule); font-size: 7pt; line-height: 1.3; color: var(--ink-2); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.paper .head { display: flex; justify-content: space-between; align-items: stretch; gap: 16px; background: var(--brand-dark); color: #fff; margin: calc(-1 * var(--fy)) calc(-1 * var(--fx)) 0; padding: .12in var(--fx) .1in; border-radius: 3px 3px 0 0; }
.paper .head img { height: .92in; width: auto; display: block; }
.paper .head-sm { display: flex; align-items: center; gap: 12px; background: var(--brand-dark); color: #fff; margin: calc(-1 * var(--fy)) calc(-1 * var(--fx)) 0; padding: .1in var(--fx); border-radius: 3px 3px 0 0; }
.paper .head-sm img { height: .55in; width: auto; display: block; }
.paper .hs-co { display: flex; flex-direction: column; font-size: 8.5pt; color: #ddd; line-height: 1.3; }
.paper .hs-co b { font-family: var(--font-display); font-size: 13pt; color: #fff; text-transform: uppercase; letter-spacing: .03em; }
.paper .hs-meta { margin-left: auto; text-align: right; font-size: 8.5pt; color: #ddd; }
.paper .hs-meta b { display: block; font-family: var(--font-display); font-size: 11pt; color: var(--brand-2); text-transform: uppercase; letter-spacing: .05em; }
.paper .h4 { font-family: var(--font-display); font-size: 10pt; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin: 14px 0 5px; }
/* handwritten notes box: fills whatever is left on the page */
.paper .sheet-body { display: flex; flex-direction: column; }
.paper .sheet-body > * { flex: none; }
.paper .notes-box { flex: 1 1 auto; display: flex; flex-direction: column; min-height: 1.6in; margin-top: 12px; border: 1px solid var(--rule); border-radius: 6px; padding: 6px 10px 8px; }
.paper .notes-box .lines { flex: 1; min-height: 1.2in; background: repeating-linear-gradient(to bottom, transparent 0, transparent calc(.3in - 1px), #d8d8d8 calc(.3in - 1px), #d8d8d8 .3in); }
.paper .head .co { text-align: right; display: flex; flex-direction: column; justify-content: center; font-size: 9.5pt; line-height: 1.5; color: #e5e5e5; }
.paper .head .co b { font-family: var(--font-display); font-size: 15pt; color: #fff; letter-spacing: .03em; text-transform: uppercase; }
.paper .head .co .lic { color: var(--brand-2); font-weight: 600; }
.paper .stripe { height: 7px; background: linear-gradient(90deg, #ff6a00, #ffb400, #ffd200); margin: 0 calc(-1 * var(--fx)); }
.paper .stripe.thin { height: 4px; }

.paper .docbar { display: flex; justify-content: space-between; align-items: flex-end; margin: 8px 0 6px; gap: 12px; }
.paper .docbar h1 { font-size: 24pt; font-weight: 800; line-height: 1; letter-spacing: .02em; text-transform: uppercase; }
.paper .docbar h1 span { color: var(--brand); }
.paper .meta { text-align: right; font-size: 9.5pt; color: var(--ink-2); line-height: 1.6; }
.paper .meta b { color: var(--ink); }
.paper .parties { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 8px; }
.paper .party { border: 1px solid var(--rule); border-left: 4px solid var(--brand); border-radius: 6px; padding: 6px 10px; font-size: 9.5pt; line-height: 1.35; }
.paper .party .lbl { font-size: 8pt; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; color: var(--ink-2); margin-bottom: 2px; }
.paper .party b { font-size: 11.5pt; }

.paper .intro { font-size: 9.5pt; color: #333; margin: 0 0 8px; }

.paper .trade { margin-top: 10px; }
.paper .trade-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; border-bottom: 2px solid var(--brand-dark); padding-bottom: 4px; margin-bottom: 8px; break-after: avoid; }
.paper .trade-block { break-inside: avoid; }
.paper .scope li { break-inside: avoid; }
.paper .closing { break-inside: avoid; }
.paper .trade-head h2 { font-size: 19pt; font-weight: 800; text-transform: uppercase; letter-spacing: .03em; }
.paper .trade-head .facts { font-size: 9pt; color: var(--ink-2); text-align: right; }

.paper .options { display: grid; grid-template-columns: repeat(var(--cols, 3), 1fr); gap: 10px; margin-bottom: 8px; }
.paper .option { border: 1.5px solid var(--rule); border-radius: 10px; padding: 9px 11px 10px; position: relative; display: flex; flex-direction: column; break-inside: avoid; }
.paper .option.rec { border-color: var(--brand); box-shadow: inset 0 0 0 1px var(--brand); }
.paper .option .ribbon { position: absolute; top: -9px; right: 10px; background: var(--brand); color: #000; font-family: var(--font-display); font-weight: 700; font-size: 8.5pt; letter-spacing: .08em; text-transform: uppercase; padding: 2px 8px; border-radius: 999px; }
.paper .option .letter { font-family: var(--font-display); font-weight: 800; font-size: 9pt; letter-spacing: .1em; color: var(--ink-2); text-transform: uppercase; }
.paper .option .tier { font-family: var(--font-display); font-weight: 800; font-size: 15pt; text-transform: uppercase; line-height: 1.1; }
.paper .option .prod { font-weight: 600; font-size: 10pt; margin-top: 2px; }
.paper .option .warr { font-size: 8.5pt; color: var(--ink-2); margin-top: 4px; flex: 1; }
.paper .option .price { font-family: var(--font-display); font-weight: 800; font-size: 22pt; color: var(--brand-dark); margin-top: 8px; line-height: 1; }
.paper .option .price small { font-family: var(--font-body); font-size: 8pt; font-weight: 500; color: var(--ink-2); display: block; margin-top: 3px; }
.paper .addon { border: 1px dashed #bbb; border-radius: 8px; padding: 6px 12px; font-size: 9.5pt; display: flex; justify-content: space-between; align-items: center; margin-bottom: 8px; }
.paper .addon b { font-family: var(--font-display); font-size: 13pt; }

.paper .scope h4 { font-size: 10pt; text-transform: uppercase; letter-spacing: .08em; color: var(--brand); margin-bottom: 4px; }
.paper .scope ul { margin: 0; padding-left: 0; list-style: none; }
.paper .scope li { position: relative; padding-left: 16px; margin-bottom: 1px; font-size: 9pt; line-height: 1.35; }
.paper .scope li::before { content: "✔"; position: absolute; left: 0; top: 0; color: var(--brand); font-weight: 700; font-size: 9pt; }

.paper .summary { margin-top: 16px; break-inside: avoid; }
.paper table.sum { width: 100%; border-collapse: collapse; font-size: 10pt; }
.paper table.sum th { text-align: left; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em; font-size: 9.5pt; background: var(--brand-dark); color: #fff; padding: 6px 10px; }
.paper table.sum th.n, .paper table.sum td.n { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.paper table.sum td { padding: 6px 10px; border-bottom: 1px solid var(--rule); }
.paper table.sum tr.total td { border-top: 2px solid var(--brand-dark); border-bottom: 0; font-family: var(--font-display); font-size: 15pt; font-weight: 800; background: #fff7eb; }
.paper table.sum tr.total td small { font-family: var(--font-body); font-size: 8.5pt; font-weight: 500; color: var(--ink-2); display: block; }
.paper table.sum tr.sub td { font-weight: 600; }

.paper .terms { margin-top: 10px; font-size: 8.5pt; color: #333; break-inside: avoid; }
.paper .terms h4 { font-size: 10pt; text-transform: uppercase; letter-spacing: .08em; margin-bottom: 4px; }
.paper .terms ol { margin: 0; padding-left: 18px; }
.paper .terms li { margin-bottom: 2px; }

.paper .choose { margin-top: 12px; border: 1.5px solid var(--brand-dark); border-radius: 8px; padding: 8px 12px; font-size: 9.5pt; break-inside: avoid; }
.paper .choose b { font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em; }
.paper .choose .boxes { display: flex; flex-wrap: wrap; gap: 6px 18px; margin-top: 4px; }
.paper .choose .box { display: inline-flex; align-items: center; gap: 6px; }
.paper .choose .box i { display: inline-block; width: 13px; height: 13px; border: 1.5px solid var(--ink); border-radius: 3px; }

.paper .sign { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-top: 22px; break-inside: avoid; }
.paper .sign .line { border-top: 1.5px solid var(--ink); padding-top: 4px; font-size: 8.5pt; color: var(--ink-2); display: flex; justify-content: space-between; margin-top: 30px; }
.paper .ack { font-size: 8pt; color: var(--ink-2); margin-top: 8px; }
.paper .foot { margin-top: 18px; padding-top: 8px; border-top: 1px solid var(--rule); font-size: 8.5pt; color: var(--ink-2); display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.paper .thanks { margin-top: 8px; padding: 6px 12px; background: #fff7eb; border-left: 4px solid var(--brand); font-size: 9.5pt; border-radius: 0 6px 6px 0; }

/* invoice-specific */
.paper table.inv { width: 100%; border-collapse: collapse; font-size: 10pt; margin-top: 8px; }
.paper table.inv th { text-align: left; background: var(--brand-dark); color: #fff; font-family: var(--font-display); text-transform: uppercase; letter-spacing: .05em; font-size: 9.5pt; padding: 7px 10px; }
.paper table.inv td { padding: 5px 10px; border-bottom: 1px solid var(--rule); vertical-align: top; }
.paper table.inv td.n, .paper table.inv th.n { text-align: right; white-space: nowrap; font-variant-numeric: tabular-nums; width: 1.1in; }
.paper table.inv td .sub { color: var(--ink-2); font-size: 8pt; line-height: 1.28; }
.paper .inv-bottom { display: grid; grid-template-columns: 1fr 3.2in; gap: 18px; margin-top: 10px; align-items: start; break-inside: avoid; }
.paper .inv-bottom .terms { margin-top: 0; }
.paper .inv-bottom .thanks { margin-top: 8px; }
.paper .inv-totals { margin: 0; width: auto; font-size: 10pt; }
.paper .inv-totals div { display: flex; justify-content: space-between; padding: 3px 10px; border-bottom: 1px solid var(--rule); }
.paper .inv-totals div.due { background: var(--brand-dark); color: #fff; font-family: var(--font-display); font-size: 16pt; font-weight: 800; border-radius: 6px; margin-top: 4px; padding: 6px 10px; }
.paper .paidstamp { position: absolute; top: 3.2in; right: .8in; transform: rotate(-14deg); border: 4px solid #2a9d4a; color: #2a9d4a; font-family: var(--font-display); font-size: 34pt; font-weight: 800; letter-spacing: .1em; padding: 2px 16px; border-radius: 8px; opacity: .85; }

/* narrow screens: let the paper reflow */
@media (max-width: 700px) {
  .paper { width: 100%; --fx: 12px; --fy: 12px; }
  .paper .sheet { padding: 8px; min-height: 0; box-shadow: none; margin-bottom: 10px; }
  .paper .head { padding: 14px 12px; flex-direction: column; align-items: center; text-align: center; }
  .paper .head img { height: auto; width: 70%; }
  .paper .head .co { text-align: center; }
  .paper .head-sm { flex-wrap: wrap; }
  .paper .hs-meta { margin-left: 0; text-align: left; width: 100%; }
  .paper .docbar { flex-direction: column; align-items: flex-start; }
  .paper .meta { text-align: left; }
  .paper .parties, .paper .sign { grid-template-columns: 1fr; }
  .paper .options { grid-template-columns: 1fr; }
  .paper .inv-bottom { grid-template-columns: 1fr; }
  .grid-3, .list-row.sections { grid-template-columns: 1fr 1fr; }
  .list-row.sections { grid-template-columns: 1fr 1fr 1.3fr auto; }
  .list-row.sections label:first-child { grid-column: 1 / -1; }
  .list-row .unit span { display: none; }
  .list-row .unit input { border-radius: 10px; }
}

/* ============ PRINT ============ */
@page { size: letter; margin: .35in; }
@media print {
  body { background: #fff !important; padding: 0 !important; }
  .app-chrome, .doc-toolbar, .tabbar, .topbar, .toast, .modal { display: none !important; }
  .doc-wrap { background: #fff; padding: 0; }
  .paper { width: 100%; max-width: none; margin: 0; }
  .paper .sheet { padding: 0; margin: 0; min-height: 0; box-shadow: none; display: block; break-after: page; }
  .paper .sheet:last-child { break-after: auto; }
  .paper .frame { min-height: 10.05in; }
  * { -webkit-print-color-adjust: exact !important; print-color-adjust: exact !important; }
  a { color: inherit; }
}
