/* PrimeTrack — styled after fivestarbathsolutions.com: #009AFF blue, gold stars, DM Sans + Inter. */
[hidden] { display: none !important; }
@font-face { font-family: "DM Sans"; src: url("/static/fonts/dmsans.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }
@font-face { font-family: "Inter"; src: url("/static/fonts/inter.woff2") format("woff2"); font-weight: 400 700; font-display: swap; }

:root {
  --navy: #0e2440;
  --navy-2: #163556;
  --blue: #009aff;          /* brand accent: bars, dots, focus */
  --blue-strong: #0072c9;   /* buttons + links (white text passes contrast) */
  --blue-tint: #e7f5ff;
  --gold: #f6b704;
  --ink: #1a1d20;
  --muted: #5d6877;
  --bg: #f3f7fb;
  --card: #ffffff;
  --line: #dfe7ef;
  --red: #c62f2f;  --red-bg: #fde7e7;
  --orange: #b25f00; --orange-bg: #fff0d6;
  --green: #18804a; --green-bg: #e1f5e9;
  --grey: #5d6877; --grey-bg: #edf1f5;
  --shadow: 0 1px 2px rgba(14, 36, 64, .06), 0 4px 16px rgba(14, 36, 64, .06);
  --radius: 14px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --navy: #0a1a2e; --navy-2: #12283f;
    --blue-strong: #3aa9ff; --blue-tint: #10304d;
    --ink: #e8edf3; --muted: #9aa8b8; --bg: #0d141c; --card: #151f2a; --line: #26333f;
    --red: #ff7b7b; --red-bg: #3a1a1c; --orange: #ffb35c; --orange-bg: #3a2810;
    --green: #5fd394; --green-bg: #12301f; --grey: #9aa8b8; --grey-bg: #1d2834;
    --shadow: 0 1px 2px rgba(0,0,0,.4);
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--ink);
  font: 16px/1.5 "Inter", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-feature-settings: "tnum" 1, "cv11" 1;
}
h1, h2, h3, .brand, .kpi-value, .logo-lockup strong { font-family: "DM Sans", "Inter", system-ui, sans-serif; letter-spacing: -.01em; }
h1 { font-size: 1.6rem; line-height: 1.2; margin: .2rem 0 1rem; }
h1 small { font-size: 1rem; font-weight: 500; }
h2 { font-size: 1.1rem; margin: 0 0 .75rem; }
a { color: var(--blue-strong); text-decoration: none; }
a:hover { text-decoration: underline; }
small, .small { font-size: .85rem; }
.muted { color: var(--muted); }
.ok { color: var(--green); }
.owed { color: var(--orange); font-weight: 600; }
code { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; }

/* ---------- header ---------- */
.top {
  position: sticky; top: 0; z-index: 10;
  display: flex; align-items: center; gap: 1rem;
  padding: .55rem max(16px, env(safe-area-inset-left)) .55rem max(16px, env(safe-area-inset-right));
  background: var(--navy); color: #fff;
  border-bottom: 3px solid var(--blue);
}
.brand { color: #fff; font-weight: 700; font-size: 1.15rem; display: flex; align-items: center; gap: .5rem; white-space: nowrap; }
.brand:hover { text-decoration: none; }
.dot { width: .8rem; height: .8rem; border-radius: 50%; border: 3px solid var(--blue); display: inline-block; flex: none; position: relative; }
.dot::after { content: ""; position: absolute; width: .35rem; height: .35rem; border-radius: 50%; background: var(--gold); top: -.55rem; right: -.45rem; }
.dot.big { width: 1.6rem; height: 1.6rem; border-width: 5px; }
.dot.big::after { width: .6rem; height: .6rem; top: -.85rem; right: -.7rem; }
.nav { display: flex; gap: .15rem; overflow-x: auto; scrollbar-width: none; flex: 1; -webkit-overflow-scrolling: touch; }
.nav::-webkit-scrollbar { display: none; }
.nav a { color: #c9d6e6; padding: .45rem .7rem; border-radius: 999px; white-space: nowrap; font-size: .93rem; font-weight: 500; }
.nav a:hover { color: #fff; background: var(--navy-2); text-decoration: none; }
.nav a[aria-current="page"] { color: #fff; background: var(--blue-strong); }
.acct { color: #c9d6e6; font-size: 1.25rem; padding: .2rem .4rem; }
.acct:hover { color: #fff; text-decoration: none; }

/* ---------- layout ---------- */
.page { max-width: 1100px; margin: 0 auto; padding: 1.25rem 16px 4rem; }
.page.narrow { max-width: 440px; padding-top: 8vh; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow); padding: 1.1rem 1.2rem; margin-bottom: 1rem; }
.card.flush { padding: 0; overflow: hidden; }
.pad { padding: 1.1rem 1.2rem; }
.row-head { display: flex; align-items: center; justify-content: space-between; gap: .5rem 1rem; flex-wrap: wrap; margin-bottom: 1rem; }
.row-head h1, .row-head h2 { margin: 0; }
.crumb { font-size: .9rem; }
.center { text-align: center; margin-top: .75rem; }
.empty { text-align: left; }

/* ---------- KPIs ---------- */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem; margin-bottom: 1rem; }
.kpis.three { grid-template-columns: repeat(3, 1fr); }
.kpis .card { margin: 0; }
.kpi-label { color: var(--muted); font-size: .85rem; font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.kpi-value { font-size: 1.75rem; font-weight: 700; line-height: 1.25; margin: .15rem 0 .6rem; }
.kpi-value small { font-size: .9rem; font-weight: 500; color: var(--muted); }
.kpis.three .kpi-value { font-size: 1.3rem; margin-bottom: 0; }
.bar { display: flex; height: 12px; border-radius: 999px; background: var(--grey-bg); overflow: hidden; }
.bar .fill { background: var(--blue); height: 100%; }
.bar .fill.soft { background: var(--blue); opacity: .3; }
.bar .fill.good { background: var(--green); }
.kpi-foot { display: flex; flex-wrap: wrap; gap: .35rem 1rem; margin-top: .55rem; font-size: .85rem; }
.sw { display: inline-block; width: .7rem; height: .7rem; border-radius: 3px; background: var(--blue); margin-right: .3rem; vertical-align: -1px; }
.sw.soft { opacity: .3; }

.alerts { display: flex; flex-wrap: wrap; gap: .5rem; margin-bottom: 1rem; }
.pill { display: inline-block; padding: .35rem .8rem; border-radius: 999px; background: var(--grey-bg); color: var(--ink); font-size: .9rem; font-weight: 500; }
.pill.red { background: var(--red-bg); color: var(--red); }
.pill.warn { background: var(--orange-bg); color: var(--orange); }

/* ---------- tables ---------- */
.scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table.list { width: 100%; border-collapse: collapse; font-size: .95rem; }
table.list.wide { min-width: 760px; }
.list th { text-align: left; font-size: .78rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); font-weight: 600; padding: .55rem .6rem; border-bottom: 1px solid var(--line); background: var(--card); }
.card.flush .list th { background: var(--blue-tint); color: var(--ink); }
.list td { padding: .6rem; border-bottom: 1px solid var(--line); vertical-align: top; }
.list tbody tr:last-child td { border-bottom: 0; }
.list tr[data-href] { cursor: pointer; }
.list tr[data-href]:hover td { background: var(--blue-tint); }
.list tfoot td { font-weight: 700; border-top: 2px solid var(--line); border-bottom: 0; background: var(--bg); }
.list tr.dim td { opacity: .55; }
.num, .list th.num, .list td.num { text-align: right; white-space: nowrap; }

.tag { display: inline-block; padding: .1rem .55rem; border-radius: 999px; font-size: .8rem; font-weight: 600; background: var(--grey-bg); color: var(--grey); white-space: nowrap; }
.tag.sold { background: var(--blue-tint); color: var(--blue-strong); }
.tag.installed { background: var(--green-bg); color: var(--green); }
.tag.cancelled { background: var(--red-bg); color: var(--red); }
.tag.big { font-size: .95rem; padding: .3rem .9rem; }

/* ---------- forms ---------- */
.filters { display: flex; flex-wrap: wrap; gap: .75rem; align-items: flex-end; margin-bottom: 1rem; }
.filters label { margin: 0; }
.form fieldset { border: 0; border-top: 1px solid var(--line); margin: 1rem 0 0; padding: 1rem 0 0; }
.form legend { font-family: "DM Sans", sans-serif; font-weight: 700; font-size: 1.05rem; padding: 0 .5rem 0 0; }
label { display: block; font-weight: 600; font-size: .9rem; margin-bottom: .85rem; }
label small { font-weight: 400; }
input, select, textarea {
  display: block; width: 100%; margin-top: .3rem;
  font: inherit; font-size: 16px; /* stops iOS zoom-on-focus */
  color: var(--ink); background: var(--card);
  border: 1px solid var(--line); border-radius: 10px; padding: .6rem .7rem; min-height: 44px;
}
input[type="checkbox"] { display: inline-block; width: 1.25rem; height: 1.25rem; min-height: 0; margin: 0 .5rem 0 0; vertical-align: -4px; accent-color: var(--blue-strong); }
input:focus, select:focus, textarea:focus { outline: 3px solid color-mix(in srgb, var(--blue) 35%, transparent); border-color: var(--blue); }
label.check { font-weight: 500; display: flex; align-items: center; }
.pad-top { padding-top: 1.7rem; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; }
.actions { display: flex; justify-content: flex-end; gap: .75rem; margin-top: 1rem; }
.form.inline { display: flex; gap: .75rem; align-items: flex-end; flex-wrap: wrap; }
.form.inline label { margin: 0; }
.owed-line { background: var(--blue-tint); border-radius: 10px; padding: .6rem .8rem; margin: 0 0 .5rem; }
input.code { font-size: 1.6rem; letter-spacing: .3em; text-align: center; font-family: ui-monospace, Menlo, monospace; }

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 44px; padding: .55rem 1.1rem; border-radius: 999px;
  border: 1px solid var(--line); background: var(--card); color: var(--ink);
  font: inherit; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { text-decoration: none; border-color: var(--blue); }
.btn.primary { background: var(--blue-strong); border-color: var(--blue-strong); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { background: var(--red); border-color: var(--red); color: #fff; }
.btn.small { min-height: 34px; padding: .3rem .8rem; font-size: .9rem; }
.btn.wide { width: 100%; }
.btn[disabled] { opacity: .5; cursor: not-allowed; }
.btn-row { display: flex; flex-wrap: wrap; gap: .6rem; }
.btn-row form { margin: 0; }
button.link { background: none; border: 0; color: var(--blue-strong); font: inherit; cursor: pointer; padding: .3rem; }
button.link.danger { color: var(--red); }

.flash { background: var(--green-bg); color: var(--green); border-radius: 10px; padding: .7rem 1rem; margin-bottom: 1rem; font-weight: 600; }
.err { color: var(--red); font-weight: 600; }
.err-box { background: var(--red-bg); color: var(--red); border-radius: 10px; padding: .8rem 1rem; margin-bottom: 1rem; }
.err-box ul { margin: .3rem 0 0; padding-left: 1.2rem; }

/* ---------- details / sections ---------- */
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
details.card > summary h2 { display: inline; margin: 0; }
details.card > summary::after { content: "▾"; float: right; color: var(--muted); }
details.card[open] > summary { margin-bottom: 1rem; }
details.add { margin-top: 1rem; }
details.add > summary { display: inline-flex; }
details.add[open] > summary { margin-bottom: 1rem; }
.danger-zone summary h2 { color: var(--red); }
.history { list-style: none; padding: 0; margin: 0; font-size: .9rem; }
.history li { padding: .35rem 0; border-bottom: 1px solid var(--line); }

/* ---------- materials ---------- */
.materials { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; margin-bottom: 1rem; }
.mat { margin: 0; border-radius: 12px; padding: .6rem .7rem; border: 1px solid transparent; }
.mat select { background: transparent; font-weight: 600; }
.tone-red { background: var(--red-bg); color: var(--red); }
.tone-orange { background: var(--orange-bg); color: var(--orange); }
.tone-green { background: var(--green-bg); color: var(--green); }
.tone-grey { background: var(--grey-bg); color: var(--grey); }
.mat select { color: inherit; border-color: color-mix(in srgb, currentColor 30%, transparent); }

/* ---------- auth ---------- */
.auth h1 { font-size: 1.3rem; margin-top: 1rem; }
.logo-lockup { display: flex; align-items: center; gap: .9rem; margin-bottom: 1.25rem; padding-top: .4rem; }
.logo-lockup strong { display: block; font-size: 1.5rem; line-height: 1.1; }
.logo-lockup small { color: var(--muted); }
.steps { padding-left: 1.2rem; margin: .5rem 0; }
.steps li { margin-bottom: .5rem; }
.qr { background: #fff; border-radius: 12px; padding: .75rem; width: 220px; max-width: 100%; margin: .5rem auto 1rem; }
.qr svg { display: block; width: 100%; height: auto; }
.key { display: block; padding: .6rem; background: var(--grey-bg); border-radius: 8px; margin: .5rem 0 1rem; word-break: break-all; font-size: 1rem; letter-spacing: .05em; }

/* ---------- phone ---------- */
@media (max-width: 720px) {
  .top { flex-wrap: wrap; gap: .35rem .75rem; }
  .nav { order: 3; flex-basis: 100%; margin: 0 -16px; padding: 0 12px; }
  .acct { margin-left: auto; }
  h1 { font-size: 1.35rem; }
  .kpis.three { grid-template-columns: 1fr 1fr 1fr; gap: .5rem; }
  .kpis.three .card { padding: .7rem; }
  .kpis.three .kpi-value { font-size: 1rem; }
  .kpis.three .kpi-label { font-size: .7rem; }
  .materials { grid-template-columns: 1fr 1fr; }
  .card { padding: .95rem; }
  .list td, .list th { padding: .5rem .45rem; }
}
@media (max-width: 460px) {
  .grid2 { grid-template-columns: 1fr; }
  .pad-top { padding-top: 0; }
}

/* ---------- modules 2–7 (2026-10-03) ---------- */
.legend { display: flex; flex-wrap: wrap; align-items: center; gap: .35rem .9rem; color: var(--muted); font-size: .88rem; margin: -.25rem 0 1rem; }
.sw-tone { display: inline-block; width: .9rem; height: .9rem; border-radius: 4px; vertical-align: -2px; margin-right: .3rem; }
.target-key { display: inline-block; width: 2px; height: .9rem; background: var(--gold); vertical-align: -2px; margin: 0 .3rem 0 .6rem; }
.subnav { margin: -.25rem 0 1rem; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0 1rem; }
.kpis.four { grid-template-columns: repeat(4, 1fr); }
.kpis.plain { display: grid; gap: 1rem; margin-bottom: 1rem; }
.kpi-value.small { font-size: 1.25rem; margin-bottom: .1rem; }
.neg { color: var(--red); }
.inline-label { display: flex; align-items: center; gap: .5rem; margin: 0; }
.inline-label select { width: auto; margin: 0; }
.tag.warn { background: var(--orange-bg); color: var(--orange); }

/* deposit-sheet colours (Lane's legend) */
.row-blue { background: var(--blue-tint); }
.row-red { background: var(--red-bg); }
.row-orange { background: var(--orange-bg); }
.row-grey { background: var(--grey-bg); }
.tone-row td:first-child { box-shadow: inset 4px 0 0 var(--tone, transparent); }
.tone-row.row-blue { --tone: var(--blue); }
.tone-row.row-red { --tone: var(--red); }
.tone-row.row-orange { --tone: var(--orange); }
.tone-row.row-grey { --tone: var(--line); }
.tone-row.row-cancelled td { opacity: .5; text-decoration: line-through; }
.list tr.tone-row.row-grey td { color: var(--muted); }
.list tr.tone-row.row-grey td a { color: var(--ink); }

/* active-jobs grid */
.list tr.group td { background: var(--bg); font-weight: 700; font-size: .82rem; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); padding-top: .8rem; }
.active-grid td { vertical-align: middle; }
.matcell { margin: 0; border-radius: 10px; padding: .15rem .35rem; min-width: 8.5rem; }
.matcell select { margin: 0; min-height: 36px; padding: .25rem .4rem; border: 0; background: transparent; color: inherit; font-weight: 600; font-size: 15px; }
.matcell .kind { display: block; font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; padding: .15rem .4rem 0; }
.matcell .na { display: block; padding: .45rem .4rem; font-weight: 600; }
.matcell.saving { opacity: .55; }

/* check-in */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 1rem; }
.job-card { color: var(--ink); display: block; margin: 0; }
.job-card:hover { text-decoration: none; border-color: var(--blue); }
.job-card .row-head { margin-bottom: .6rem; }
.chips { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip { display: inline-block; padding: .2rem .6rem; border-radius: 999px; font-size: .82rem; font-weight: 600; }
.checklist .row-head { margin-bottom: .5rem; }
label.tick { display: flex; gap: .7rem; align-items: flex-start; font-weight: 500; font-size: 1rem; padding: .7rem .2rem; margin: 0; border-top: 1px solid var(--line); cursor: pointer; }
label.tick input { width: 1.6rem; height: 1.6rem; flex: none; margin: 0; }
label.tick .num-key { color: var(--muted); font-weight: 700; min-width: 2.2rem; }
label.tick:has(input:checked) span:last-child { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }
.sticky-save { position: sticky; bottom: 0; background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(6px); padding: .75rem 0; align-items: center; justify-content: space-between; }

/* revenue month bars */
.month-bars { display: grid; gap: .35rem; }
.mrow { display: grid; grid-template-columns: 2.6rem 1fr 6.5rem 4.5rem; gap: .75rem; align-items: center; color: var(--ink); padding: .3rem .4rem; border-radius: 8px; }
.mrow:hover { background: var(--blue-tint); text-decoration: none; }
.mrow.now { background: var(--blue-tint); }
.mname { font-weight: 700; }
.mbar { position: relative; display: flex; height: 16px; background: var(--grey-bg); border-radius: 999px; overflow: visible; }
.mbar .fill { background: var(--blue); height: 100%; }
.mbar .fill:first-child { border-radius: 999px 0 0 999px; }
.mbar .fill.soft { opacity: .3; }
.target-line { position: absolute; top: -3px; bottom: -3px; width: 2px; background: var(--gold); }
.mval { text-align: right; font-weight: 700; }
.mjobs { font-size: .85rem; }

/* monthly + cash flow */
input.cell, select.cell { min-height: 36px; padding: .3rem .45rem; margin: 0; width: 7.5rem; text-align: right; }
select.cell { text-align: left; width: 7rem; }
input.cell.tiny { width: 4rem; text-align: center; }
.list.monthly td { vertical-align: middle; }
.list tr.scheduled td { background: color-mix(in srgb, var(--blue-tint) 50%, transparent); }
.list.totals td:first-child { font-weight: 600; }
.add-order { margin-top: 1rem; }
.share { display: inline-block; width: 4rem; height: 8px; background: var(--grey-bg); border-radius: 999px; overflow: hidden; vertical-align: middle; }
.share span { display: block; height: 100%; background: var(--blue); }
.cashflow th.now, .cashflow td.now { background: var(--blue-tint); }
.cashflow tr.strong td { font-weight: 700; }
.cashflow tr.end td { border-top: 2px solid var(--line); font-size: 1.02rem; }
.cashflow td:first-child { white-space: nowrap; font-weight: 600; }

@media (max-width: 720px) {
  .kpis.four { grid-template-columns: 1fr 1fr; gap: .5rem; }
  .kpis.four .card { padding: .7rem; }
  .kpis.four .kpi-value { font-size: 1.1rem; }
  .grid3 { grid-template-columns: 1fr 1fr; }
  .mrow { grid-template-columns: 2.4rem 1fr 5.5rem; }
  .mjobs { display: none; }
}
@media (max-width: 460px) { .grid3 { grid-template-columns: 1fr; } }
.row-head form.btn-row { align-items: center; flex-wrap: nowrap; }
.row-head form.btn-row select { width: auto; margin: 0; }
.list.monthly td:nth-child(2), .list.wide td:first-child a { white-space: nowrap; }
.legend .sw-tone.tone-red { background: var(--red); } .legend .sw-tone.tone-orange { background: var(--orange); }
.legend .sw-tone.tone-green { background: var(--green); } .legend .sw-tone.tone-grey { background: var(--grey); }
.legend .sw-tone.row-blue { background: var(--blue); } .legend .sw-tone.row-red { background: var(--red); }
.legend .sw-tone.row-orange { background: var(--orange); } .legend .sw-tone.row-grey { background: var(--grey); opacity: .5; }
input.cell, select.cell { display: inline-block; vertical-align: middle; }
