@font-face { font-family: "Archivo"; src: url(fonts/archivo.woff2) format("woff2"); font-weight: 400 800; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(fonts/plexmono-400.woff2) format("woff2"); font-weight: 400; font-display: swap; }
@font-face { font-family: "Plex Mono"; src: url(fonts/plexmono-600.woff2) format("woff2"); font-weight: 600; font-display: swap; }

:root {
  --bg: #1a1417;
  --panel: #241c20;
  --panel-2: #2e2429;
  --line: #3d3137;
  --ink: #f3ece6;
  --ink-2: #b8aaa6;
  --ink-3: #85777a;
  --mag: #e8117f;
  --mag-ink: #ff5aa8;
  --ok: #5fc28d;
  --warn: #f0b64a;
  --bad: #ff6b5e;
  --paper: #f7f1e6;
  --paper-ink: #231c1a;
  --paper-2: #6c605a;
  --paper-rule: #d8ccbb;
  --r-s: 6px;
  --r-m: 10px;
  --r-l: 14px;
  --ui: "Archivo", "Segoe UI", Roboto, sans-serif;
  --num: "Plex Mono", ui-monospace, Consolas, monospace;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); font-family: var(--ui); font-size: 16px; }
body { min-height: 100dvh; -webkit-tap-highlight-color: transparent; }
button, input, select, textarea { font: inherit; color: inherit; }
[hidden] { display: none !important; }

/* ── top bar ───────────────────────────────────────── */
.top {
  position: sticky; top: 0; z-index: 5;
  display: flex; align-items: center; gap: 14px;
  padding: calc(env(safe-area-inset-top) + 10px) 16px 10px;
  background: color-mix(in oklab, var(--bg) 92%, transparent);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.brand { font-weight: 800; font-stretch: 112%; letter-spacing: .01em; font-size: 19px; }
.brand::before { content: ""; display: inline-block; width: 9px; height: 9px; background: var(--mag); border-radius: 2px; margin-right: 8px; transform: translateY(-2px); }
.tabs { display: flex; gap: 4px; background: var(--panel); padding: 3px; border-radius: var(--r-m); }
.tabs button { border: 0; background: none; padding: 7px 14px; border-radius: var(--r-s); color: var(--ink-2); font-weight: 600; cursor: pointer; }
.tabs button[aria-selected="true"] { background: var(--panel-2); color: var(--ink); }
.sheet-status { margin-left: auto; font-size: 12.5px; color: var(--ink-3); text-align: right; }
.sheet-status.local { color: var(--warn); }

/* ── quote layout ──────────────────────────────────── */
.quote { display: grid; gap: 16px; padding: 16px; max-width: 1400px; margin: 0 auto; }
@media (min-width: 820px) {
  .quote { grid-template-columns: minmax(0, 1fr) minmax(320px, 400px); align-items: start; }
  .receipt { position: sticky; top: 72px; max-height: calc(100dvh - 88px); overflow: auto; }
}

.group { margin-bottom: 22px; }
.group > h2 {
  font-size: 12px; font-weight: 700; letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); margin: 0 0 8px; display: flex; align-items: center; gap: 10px;
}
.group > h2 .count { font-family: var(--num); color: var(--ink-2); letter-spacing: 0; }

.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip {
  border: 1px solid var(--line); background: var(--panel); color: var(--ink);
  padding: 9px 13px; border-radius: 999px; cursor: pointer; font-weight: 600; font-size: 15px;
}
.chip[aria-pressed="true"] { background: var(--mag); border-color: var(--mag); color: #fff; }
.chip.add { border-style: dashed; color: var(--ink-2); background: none; }
.chip.off { opacity: .45; }
.hint b { color: var(--ink-2); font-weight: 600; }
.chip small { font-weight: 400; opacity: .75; margin-left: 4px; }

.toggle { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; user-select: none; font-size: 15px; color: var(--ink-2); }
.toggle input { appearance: none; width: 38px; height: 22px; border-radius: 999px; background: var(--line); position: relative; margin: 0; cursor: pointer; transition: background .15s; }
.toggle input::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: var(--ink-2); transition: transform .15s, background .15s; }
.toggle input:checked { background: var(--mag); }
.toggle input:checked::after { transform: translateX(16px); background: #fff; }
.toggle:has(input:checked) { color: var(--ink); }

.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-l);
  padding: 12px; margin-bottom: 8px;
}
.card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.card-head .tag { font-family: var(--num); font-size: 12px; color: var(--mag-ink); font-weight: 600; }
.card-head .x { margin-left: auto; border: 0; background: none; color: var(--ink-3); font-size: 22px; line-height: 1; cursor: pointer; padding: 2px 6px; }
.fields { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); align-items: end; }
.field { display: grid; gap: 4px; }
.field > span { font-size: 12px; color: var(--ink-3); }
.field.wide { grid-column: 1 / -1; }
select, input[type="number"], input[type="text"], input[type="search"], textarea {
  width: 100%; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-s);
  padding: 9px 10px; font-size: 15px; min-height: 40px;
}
input[type="number"] { font-family: var(--num); }
select:focus, input:focus, textarea:focus, button:focus-visible { outline: 2px solid var(--mag); outline-offset: 1px; }
.seg { display: inline-flex; background: var(--bg); border: 1px solid var(--line); border-radius: var(--r-s); padding: 2px; }
.seg button { border: 0; background: none; padding: 7px 12px; border-radius: 4px; color: var(--ink-2); cursor: pointer; font-weight: 600; font-size: 14px; }
.seg button[aria-pressed="true"] { background: var(--panel-2); color: var(--ink); }
.toggles { display: flex; flex-wrap: wrap; gap: 14px 20px; margin-top: 10px; }
select.tier { width: auto; min-height: 34px; padding: 4px 8px; font-size: 14px; }
.hint { font-size: 12.5px; color: var(--ink-3); margin-top: 6px; }
.row-actions { display: flex; flex-wrap: wrap; gap: 6px; }

.acc-row { display: grid; grid-template-columns: 1fr 110px 70px 32px; gap: 6px; margin-bottom: 6px; }
.acc-row button { border: 0; background: none; color: var(--ink-3); font-size: 20px; cursor: pointer; }
.code-row { display: flex; gap: 6px; }
.code-row input { text-transform: uppercase; font-family: var(--num); }
.btn {
  border: 1px solid var(--line); background: var(--panel-2); padding: 9px 14px;
  border-radius: var(--r-s); cursor: pointer; font-weight: 600; white-space: nowrap;
}
.btn.primary { background: var(--mag); border-color: var(--mag); color: #fff; }
.btn.ghost { background: none; }
.btn:active { transform: translateY(1px); }

/* ── receipt ───────────────────────────────────────── */
.receipt {
  background: var(--paper); color: var(--paper-ink); border-radius: var(--r-m);
  padding: 18px 18px 14px; font-family: var(--num); font-size: 13.5px;
  box-shadow: 0 1px 0 #0003;
  -webkit-mask: radial-gradient(circle 5px at 50% 100%, #0000 98%, #000) 50% 100% / 14px 100% repeat-x;
          mask: radial-gradient(circle 5px at 50% 100%, #0000 98%, #000) 50% 100% / 14px 100% repeat-x;
  padding-bottom: 22px;
}
.receipt h3 { font-family: var(--ui); font-size: 11px; letter-spacing: .14em; text-transform: uppercase; color: var(--paper-2); margin: 0 0 2px; font-weight: 700; }
.big { font-size: 38px; font-weight: 600; letter-spacing: -.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.big small { font-size: 15px; font-weight: 400; color: var(--paper-2); letter-spacing: 0; }
.sub { color: var(--paper-2); font-size: 12.5px; margin: 3px 0 0; }
.sub b { color: var(--paper-ink); font-weight: 600; }
.items { list-style: none; margin: 10px 0 0; padding: 0; border-top: 1px dashed var(--paper-rule); }
.items li { display: flex; justify-content: space-between; gap: 12px; padding: 5px 0; border-bottom: 1px dashed var(--paper-rule); }
.items li span:first-child { color: var(--paper-2); font-family: var(--ui); font-size: 13.5px; }
.items li span:last-child { font-variant-numeric: tabular-nums; white-space: nowrap; }
.items li.neg span:last-child { color: #1d7a4a; }
.items li.est span:first-child::after { content: " ≈"; }
.block { padding: 14px 0; border-bottom: 2px solid var(--paper-ink); }
.block:first-child { padding-top: 0; }
.block:last-of-type { border-bottom: 0; }
.steps { list-style: none; padding: 0; margin: 8px 0 0; }
.steps li { display: flex; justify-content: space-between; padding: 2px 0; }
.compare { margin-top: 12px; padding: 10px; border: 1px solid var(--paper-rule); border-radius: var(--r-s); font-size: 12.5px; }
.compare b { font-weight: 600; }
.warns { margin: 12px 0 0; padding: 0; list-style: none; font-family: var(--ui); font-size: 13px; }
.warns li { padding: 6px 8px; border-radius: 4px; background: #f6dcc0; color: #6b3a07; margin-top: 4px; }
.warns li.verify { background: #ece4d6; color: var(--paper-2); }
.receipt .actions { display: flex; gap: 8px; margin-top: 14px; font-family: var(--ui); }
.receipt .actions .btn { background: var(--paper-ink); color: var(--paper); border-color: var(--paper-ink); flex: 1; }
.receipt .actions .btn.ghost { background: none; color: var(--paper-ink); }
.empty { color: var(--paper-2); font-family: var(--ui); padding: 30px 0; text-align: center; }

/* phones: totals pinned to the bottom, tap to jump to the receipt */
.totbar { display: none; }
@media (max-width: 819px) {
  .totbar:not(:empty) {
    display: flex; justify-content: space-between; gap: 12px; align-items: baseline;
    position: sticky; bottom: 0; z-index: 4; width: 100%; border: 0; cursor: pointer;
    padding: 12px 16px calc(env(safe-area-inset-bottom) + 12px);
    background: var(--paper); color: var(--paper-ink); font-family: var(--num); font-size: 20px; font-weight: 600;
    box-shadow: 0 -6px 18px #0006;
  }
  .totbar small { font-family: var(--ui); font-size: 11px; letter-spacing: .12em; text-transform: uppercase; color: var(--paper-2); font-weight: 700; margin-right: 6px; }
  body:has(#tab-prices:not([hidden])) .totbar { display: none; }
}

/* ── customer view ─────────────────────────────────── */
.customer {
  position: fixed; inset: 0; z-index: 20; background: var(--paper); color: var(--paper-ink);
  padding: calc(env(safe-area-inset-top) + 24px) 24px 24px; overflow: auto; font-family: var(--ui);
}
.customer .wrap { max-width: 720px; margin: 0 auto; }
.customer .close { position: fixed; top: calc(env(safe-area-inset-top) + 12px); right: 12px; }
.customer .close .btn { background: var(--paper-ink); color: var(--paper); border: 0; }
.customer h2 { font-size: 13px; letter-spacing: .14em; text-transform: uppercase; color: var(--paper-2); margin: 28px 0 4px; }
.customer .huge { font-family: var(--num); font-size: clamp(48px, 13vw, 92px); font-weight: 600; letter-spacing: -.03em; line-height: 1; font-variant-numeric: tabular-nums; }
.customer .huge small { font-size: .3em; color: var(--paper-2); font-weight: 400; letter-spacing: 0; }
.customer .note { font-size: 17px; color: var(--paper-2); margin-top: 8px; }
.customer .note b { color: var(--paper-ink); }
.customer ul { list-style: none; padding: 0; margin: 14px 0 0; font-size: 17px; }
.customer li { display: flex; justify-content: space-between; gap: 16px; padding: 8px 0; border-bottom: 1px solid var(--paper-rule); }
.customer li span:last-child { font-family: var(--num); }
.customer .fine { font-size: 13px; color: var(--paper-2); margin-top: 28px; }

/* ── prices editor ─────────────────────────────────── */
.prices { padding: 16px; max-width: 1400px; margin: 0 auto; }
.prices .bar { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-bottom: 16px; }
.prices .bar .spacer { flex: 1; }
.prices .msg { font-size: 14px; color: var(--ink-2); }
.prices .msg.bad { color: var(--bad); }
.prices .msg.good { color: var(--ok); }
.prices details { background: var(--panel); border: 1px solid var(--line); border-radius: var(--r-m); margin-bottom: 10px; }
.prices summary { padding: 12px 14px; cursor: pointer; font-weight: 700; display: flex; gap: 10px; align-items: center; }
.prices summary .n { font-family: var(--num); font-weight: 400; color: var(--ink-3); font-size: 13px; }
.prices summary .unv { font-size: 12px; color: var(--warn); font-weight: 600; }
.prices .inner { padding: 0 14px 14px; overflow-x: auto; }
table.ed { border-collapse: collapse; width: 100%; font-size: 14px; }
table.ed th { text-align: left; font-size: 11.5px; color: var(--ink-3); font-weight: 600; padding: 4px 4px 6px; white-space: nowrap; }
table.ed td { padding: 3px 4px; vertical-align: middle; }
table.ed input[type="text"], table.ed input[type="number"], table.ed select { min-height: 34px; padding: 5px 7px; font-size: 14px; min-width: 70px; }
table.ed td.name input { min-width: 200px; }
table.ed tr.unverified td:first-child { box-shadow: inset 3px 0 var(--warn); }
table.ed input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--mag); }
table.ed .del { border: 0; background: none; color: var(--ink-3); font-size: 18px; cursor: pointer; }
table.ed a { color: var(--ink-3); font-size: 12px; }
.kv { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 10px; }
.prices textarea { min-height: 50vh; font-family: var(--num); font-size: 12.5px; }

@media (max-width: 520px) {
  .top { flex-wrap: wrap; row-gap: 6px; }
  .sheet-status { width: 100%; text-align: left; margin: 0; }
  .big { font-size: 32px; }
}

/* ── T-Mobile check ────────────────────────────────── */
.tabs .badge { display: inline-block; min-width: 18px; padding: 1px 5px; margin-left: 4px; border-radius: 999px; background: var(--mag); color: #fff; font: 600 11px/16px var(--num); text-align: center; }
.prices .check-status { font-size: 12.5px; color: var(--ink-3); }
.prices .btn[disabled] { opacity: .5; cursor: default; }
.prices details.changes { border-color: color-mix(in oklab, var(--mag) 45%, var(--line)); }
.prices details.changes .warns li { background: color-mix(in oklab, var(--warn) 18%, var(--panel)); color: var(--ink); }
.chg-h { margin: 16px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .06em; color: var(--ink-3); }
.chg-h .n { font-family: var(--num); font-weight: 400; }
.chg { list-style: none; margin: 0; padding: 0; }
.chg li { display: flex; flex-wrap: wrap; gap: 8px 12px; align-items: center; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); }
.chg-t { flex: 1 1 320px; font-size: 14px; line-height: 1.4; }
.chg-t .kind { font: 600 11px var(--num); text-transform: uppercase; color: var(--ink-3); margin-right: 4px; }
.chg-added .kind { color: var(--ok); }
.chg-removed .kind { color: var(--bad); }
.chg-changed .kind { color: var(--warn); }
.chg-t .unv { font-size: 12px; color: var(--warn); font-weight: 600; margin-left: 6px; }
.chg-t a { font-size: 12px; color: var(--mag-ink); margin-left: 6px; }
.chg-b { display: flex; gap: 6px; }
.chg-b .btn { padding: 6px 12px; font-size: 14px; }
.check-none { margin: 0 0 12px; }
