/* CertTrack: Tax Lien & Deed — production PWA styles
   Brand: navy #0c1f3a + gold #e9c766 (Star Players LLC). Mobile-first. */
:root {
  color-scheme: light dark;
  --navy: #0c1f3a;
  --navy-2: #123052;
  --gold: #e9c766;
  --gold-dark: #a8841c;
  --bg: #eef1f6;
  --surface: #ffffff;
  --surface-2: #e4eaf3;
  --text: #0d2137;
  --dim: #5b6b7d;
  --border: #d3dbe6;
  --accent: #0c1f3a;
  --accent-text: #ffffff;
  --danger: #b3261e;
  --amber: #9a6700;
  --amber-bg: #fdf3d7;
  --red-bg: #fdecea;
  --green: #146c2e;
  --green-bg: #e6f4ea;
  --radius: 14px;
  --font-sans: "IBM Plex Sans", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, SFMono-Regular, Menlo, monospace;
}
@media (prefers-color-scheme: dark) {
  :root {
    --bg: #060d18;
    --surface: #0e1d33;
    --surface-2: #16283f;
    --text: #e8eef7;
    --dim: #93a5bb;
    --border: #22344e;
    --accent: #1c3d68;
    --danger: #f28b82;
    --amber: #e9c766;
    --amber-bg: #3a2f10;
    --red-bg: #3d1714;
    --green: #7dd69a;
    --green-bg: #12351f;
  }
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
button, [role="button"], select, input:not([type="checkbox"]) { min-height: 2.5rem; }
button { font-family: inherit; cursor: pointer; }
a { color: inherit; }

/* ---------- app frame ---------- */
#app { max-width: 560px; margin: 0 auto; padding-bottom: 92px; }
.topbar {
  position: sticky; top: 0; z-index: 20;
  background: var(--navy); color: #fff;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.topbar img { width: 34px; height: 34px; border-radius: 8px; }
.topbar .title { font-weight: 700; font-size: 17px; line-height: 1.15; }
.topbar .subtitle { font-size: 12px; color: var(--gold); }
.topbar .spacer { flex: 1; }

main { padding: 14px 14px 8px; }
.view { display: none; }
.view.active { display: block; }

/* ---------- bottom nav ---------- */
.bottomnav {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 20;
  background: var(--surface); border-top: 1px solid var(--border);
  display: flex; justify-content: space-around;
  padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
  max-width: 560px; margin: 0 auto;
}
.navbtn {
  flex: 1; background: none; border: none; color: var(--dim);
  font-size: 11px; font-weight: 600; padding: 6px 2px;
  display: flex; flex-direction: column; align-items: center; gap: 2px;
  position: relative; border-radius: 10px;
}
.navbtn .ico { font-size: 19px; line-height: 1; }
.navbtn.active { color: var(--navy); }
@media (prefers-color-scheme: dark) { .navbtn.active { color: var(--gold); } }
.navbadge {
  position: absolute; top: 2px; right: calc(50% - 18px);
  background: var(--danger); color: #fff; font-size: 10px; font-weight: 700;
  min-width: 17px; height: 17px; border-radius: 999px; padding: 0 4px;
  display: flex; align-items: center; justify-content: center;
}

/* ---------- cards & rows ---------- */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 14px; margin-bottom: 12px;
}
.card h2 { margin: 0 0 4px; font-size: 16px; }
.card h3 { margin: 0 0 6px; font-size: 14px; }
.muted { color: var(--dim); font-size: 13px; }
.small { font-size: 12px; }
.row { display: flex; align-items: center; gap: 8px; }
.row.between { justify-content: space-between; }
.row.wrap { flex-wrap: wrap; }
.grow { flex: 1; min-width: 0; }
.divider { border: none; border-top: 1px solid var(--border); margin: 10px 0; }

.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.stat { background: var(--surface-2); border-radius: 12px; padding: 10px 12px; }
.stat .label { font-size: 11px; font-weight: 600; letter-spacing: .05em; text-transform: uppercase; color: var(--dim); }
.stat .value { font-size: 19px; font-weight: 700; margin-top: 2px; }

.cert-card { text-align: left; width: 100%; }
.cert-card .addr { font-weight: 700; font-size: 15px; }
.cert-card .meta { color: var(--dim); font-size: 12.5px; margin-top: 2px; }
.cert-card .payoff { text-align: right; }
.cert-card .payoff .amt { font-size: 17px; font-weight: 700; }
.cert-card .payoff .lbl { font-size: 11px; color: var(--dim); }

.chip {
  display: inline-block; font-size: 11px; font-weight: 700;
  border-radius: 999px; padding: 2px 8px; white-space: nowrap;
}
.chip.active { background: var(--green-bg); color: var(--green); }
.chip.redeemed { background: var(--surface-2); color: var(--dim); }
.chip.soon { background: var(--amber-bg); color: var(--amber); }
.chip.eligible { background: var(--red-bg); color: var(--danger); }
.chip.sample { background: var(--surface-2); color: var(--dim); border: 1px dashed var(--dim); }

/* ---------- buttons ---------- */
.btn {
  border: 1px solid var(--border); background: var(--surface); color: var(--text);
  border-radius: 10px; padding: 9px 14px; font-size: 14px; font-weight: 600;
  text-decoration: none; display: inline-flex; align-items: center; gap: 6px; justify-content: center;
}
.btn.primary { background: var(--navy); color: #fff; border-color: var(--navy); }
@media (prefers-color-scheme: dark) { .btn.primary { background: var(--gold); color: var(--navy); border-color: var(--gold); } }
.btn.gold { background: var(--gold); color: var(--navy); border-color: var(--gold); }
.btn.danger { color: var(--danger); border-color: var(--danger); background: transparent; }
.btn.block { width: 100%; }
.btn.small { padding: 6px 10px; font-size: 13px; min-height: 2.25rem; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.fab {
  position: fixed; right: max(16px, calc(50% - 264px)); bottom: 92px; z-index: 15;
  background: var(--gold); color: var(--navy); border: none; border-radius: 999px;
  font-weight: 700; font-size: 15px; padding: 13px 20px;
  box-shadow: 0 6px 18px rgba(12,31,58,.35);
}

/* ---------- forms ---------- */
.field { margin-bottom: 12px; }
.field label { display: block; font-size: 13px; font-weight: 600; margin-bottom: 4px; }
.field .hint { font-size: 12px; color: var(--dim); margin-top: 3px; }
.field input, .field select {
  width: 100%; padding: 10px 12px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 10px;
  background: var(--surface); color: var(--text); font-family: inherit;
}
.field input:focus, .field select:focus { outline: 2px solid var(--gold); outline-offset: 1px; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* ---------- tables / breakdown ---------- */
.breakdown { width: 100%; border-collapse: collapse; font-size: 14px; }
.breakdown td { padding: 6px 0; border-bottom: 1px solid var(--border); }
.breakdown td:last-child { text-align: right; }
.breakdown tr.total td { font-weight: 700; font-size: 16px; border-bottom: none; border-top: 2px solid var(--gold); padding-top: 9px; }

/* ---------- timeline ---------- */
.timeline { list-style: none; margin: 0; padding: 0; }
.timeline li { display: flex; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.timeline li:last-child { border-bottom: none; }
.timeline .dot { width: 12px; height: 12px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--border); }
.timeline .dot.done { background: var(--green); }
.timeline .dot.next { background: var(--gold); box-shadow: 0 0 0 3px var(--amber-bg); }
.timeline .dot.overdue { background: var(--danger); }

/* ---------- alerts ---------- */
.alert-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.alert-item:last-child { border-bottom: none; }
.alert-tier { font-size: 11px; font-weight: 700; border-radius: 6px; padding: 2px 7px; white-space: nowrap; }
.alert-tier.red { background: var(--red-bg); color: var(--danger); }
.alert-tier.amber { background: var(--amber-bg); color: var(--amber); }
.alert-tier.gray { background: var(--surface-2); color: var(--dim); }

/* ---------- county cards ---------- */
.county-card { text-align: left; width: 100%; }
.county-card .cname { font-weight: 700; font-size: 16px; }
.searchbar { position: relative; margin-bottom: 12px; }
.searchbar input {
  width: 100%; padding: 12px 14px 12px 40px; font-size: 15px;
  border: 1px solid var(--border); border-radius: 12px;
  background: var(--surface); color: var(--text);
}
.searchbar .sico { position: absolute; left: 13px; top: 50%; transform: translateY(-50%); color: var(--dim); }
.seg {
  display: flex; background: var(--surface-2); border-radius: 10px; padding: 3px; gap: 3px;
}
.seg button {
  flex: 1; border: none; background: transparent; color: var(--dim);
  font-weight: 600; font-size: 13px; border-radius: 8px; padding: 8px 6px;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: 0 1px 3px rgba(0,0,0,.15); }

/* ---------- sheets / modals ---------- */
.sheet-backdrop {
  position: fixed; inset: 0; background: rgba(4,10,20,.55); z-index: 40;
  display: none; align-items: flex-end; justify-content: center;
}
.sheet-backdrop.open { display: flex; }
.sheet {
  background: var(--surface); color: var(--text);
  width: 100%; max-width: 560px; max-height: 88vh; overflow-y: auto;
  border-radius: 18px 18px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
}
.sheet h2 { margin-top: 0; }
.sheet .close-x { float: right; background: none; border: none; font-size: 20px; color: var(--dim); padding: 2px 6px; }

/* ---------- vote bars ---------- */
.vote-row { padding: 9px 0; border-bottom: 1px solid var(--border); }
.vote-row:last-child { border-bottom: none; }
.vote-bar { height: 8px; border-radius: 99px; background: var(--surface-2); margin-top: 5px; overflow: hidden; }
.vote-bar > div { height: 100%; background: var(--gold); border-radius: 99px; }
.vote-row.voted .vname { color: var(--gold-dark); font-weight: 700; }
@media (prefers-color-scheme: dark) { .vote-row.voted .vname { color: var(--gold); } }

/* ---------- misc ---------- */
.banner {
  border-radius: var(--radius); padding: 12px 14px; margin-bottom: 12px; font-size: 13.5px;
}
.banner.info { background: var(--surface-2); }
.banner.warn { background: var(--amber-bg); color: var(--amber); }
.banner.danger { background: var(--red-bg); color: var(--danger); }
.empty { text-align: center; padding: 28px 16px; color: var(--dim); }
.empty .big { font-size: 34px; margin-bottom: 6px; }
.toast {
  position: fixed; left: 50%; transform: translateX(-50%) translateY(20px);
  bottom: 100px; z-index: 60; background: var(--navy); color: #fff;
  padding: 11px 18px; border-radius: 999px; font-size: 14px; font-weight: 600;
  opacity: 0; pointer-events: none; transition: all .25s ease; max-width: 88vw; text-align: center;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }
.backlink { background: none; border: none; color: var(--dim); font-size: 14px; font-weight: 600; padding: 4px 0; margin-bottom: 8px; }
.watch-btn { background: none; border: none; font-size: 20px; color: var(--dim); padding: 4px 8px; }
.watch-btn.on { color: var(--gold-dark); }
@media (prefers-color-scheme: dark) { .watch-btn.on { color: var(--gold); } }
.kv { display: flex; justify-content: space-between; padding: 5px 0; font-size: 14px; border-bottom: 1px solid var(--border); }
.kv:last-child { border-bottom: none; }
.kv .k { color: var(--dim); }
.footer-note { text-align: center; color: var(--dim); font-size: 12px; padding: 16px 8px 4px; }
