/* NRD Site Snapshot - phone first. Brand: NRD green, blue, cream, sand, gold, slate. */
:root {
  --green: #0e7c3a; --green-deep: #0a5c2b; --blue: #1f4e8a; --gold: #D8C49C; --sand: #E9E3D6;
  --cream: #F3EFE6; --slate: #3E4951; --ink: #1d2428; --soft: #5f6b72; --line: #d6cfc0;
  --bg: var(--cream); --card: #ffffff; --bad: #c0392b; --ok: #0e7c3a;
  --radius: 14px; --gutter: 16px; --shadow: 0 1px 2px rgba(30, 40, 45, .08), 0 4px 14px rgba(30, 40, 45, .06);
  color-scheme: light dark;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #171c1f; --card: #21282c; --ink: #eef0ee; --soft: #a9b3b8; --line: #3a444a; --sand: #2b3338; --cream: #171c1f;
    --shadow: 0 1px 2px rgba(0, 0, 0, .4), 0 4px 14px rgba(0, 0, 0, .3);
  }
}
:root[data-theme="dark"] {
  --bg: #171c1f; --card: #21282c; --ink: #eef0ee; --soft: #a9b3b8; --line: #3a444a; --sand: #2b3338; --cream: #171c1f;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg); color: var(--ink);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased; padding-bottom: env(safe-area-inset-bottom);
}
a { color: var(--blue); }
h1 { font-size: 1.25rem; margin: 0 0 .35rem; line-height: 1.25; }
h2 { font-size: 1.05rem; margin: 0 0 .5rem; color: var(--green-deep); }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) h2 { color: #7fd39c; } }
.soft { color: var(--soft); font-size: .92rem; }
.small { font-size: .85rem; padding: .35rem .7rem; }
[hidden] { display: none !important; }

header.top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: calc(10px + env(safe-area-inset-top)) var(--gutter) 10px; background: var(--card);
  border-bottom: 1px solid var(--line); position: sticky; top: 0; z-index: 5;
}
.brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: inherit; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-text b { font-size: 1.05rem; }
.brand-text small { color: var(--soft); font-size: .75rem; }

main { max-width: 760px; margin: 0 auto; padding: 12px var(--gutter) 24px; }
.card { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); padding: 14px; margin-bottom: 12px; }

.mode { display: flex; gap: 6px; margin-bottom: 10px; }
.chip {
  border: 1px solid var(--line); background: transparent; color: var(--ink); border-radius: 999px;
  padding: .3rem .85rem; font-size: .9rem; cursor: pointer;
}
.chip.on { background: var(--green); border-color: var(--green); color: #fff; }
.row { display: flex; gap: 8px; align-items: center; }
.row + .row { margin-top: 8px; }
.row.alt { margin-top: 10px; flex-wrap: wrap; }
.hint { color: var(--soft); font-size: .88rem; }
input[type="text"], select {
  flex: 1; min-width: 0; font: inherit; padding: .65rem .8rem; border: 1px solid var(--line); border-radius: 10px;
  background: var(--bg); color: var(--ink);
}
input:focus, select:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.county label { font-size: .9rem; color: var(--soft); }
button { font: inherit; cursor: pointer; border-radius: 10px; border: 1px solid transparent; padding: .65rem 1rem; }
button.primary { background: var(--green); color: #fff; }
button.primary:active { background: var(--green-deep); }
button.ghost { background: transparent; color: var(--blue); border-color: var(--line); }
button:disabled { opacity: .55; cursor: default; }

.map-wrap { padding: 0; overflow: hidden; position: relative; }
#map { width: 100%; height: 46vh; min-height: 260px; max-height: 480px; }
.map-tools { position: absolute; top: 10px; right: 10px; z-index: 2; }
.map-tools button { background: var(--card); }
.map-note { padding: 6px 12px; font-size: .8rem; color: var(--soft); border-top: 1px solid var(--line); }
.pin { width: 22px; height: 22px; border-radius: 50% 50% 50% 0; background: var(--bad); border: 2px solid #fff; transform: rotate(-45deg); box-shadow: 0 2px 6px rgba(0,0,0,.35); }

.status { display: flex; align-items: center; gap: 10px; padding: 12px 14px; background: var(--sand); border-radius: var(--radius); margin-bottom: 12px; }
.status.err { background: #fbe9e7; color: #7a1f14; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .status.err { background: #4a2420; color: #ffd9d3; } }
.spin { width: 18px; height: 18px; border: 3px solid var(--line); border-top-color: var(--green); border-radius: 50%; animation: spin .9s linear infinite; flex: none; }
@keyframes spin { to { transform: rotate(360deg); } }

.head-row { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.sub { margin: 0; }
.pulled { margin: .35rem 0 0; color: var(--soft); font-size: .85rem; }

details.group { background: var(--card); border-radius: var(--radius); box-shadow: var(--shadow); margin-bottom: 10px; }
details.group > summary {
  list-style: none; cursor: pointer; padding: 12px 14px; font-weight: 600; display: flex; justify-content: space-between; align-items: center;
}
details.group > summary::-webkit-details-marker { display: none; }
details.group > summary .count { color: var(--soft); font-weight: 400; font-size: .85rem; }
details.group > summary::after { content: "+"; color: var(--soft); font-weight: 400; margin-left: 8px; }
details.group[open] > summary::after { content: "\2013"; }
.items { padding: 0 14px 10px; }
.item { padding: 8px 0; border-top: 1px solid var(--line); }
.item .label { color: var(--soft); font-size: .82rem; }
.item .value { font-size: .98rem; overflow-wrap: anywhere; }
.item .value.bad { color: var(--bad); }
.item .src { color: var(--soft); font-size: .78rem; margin-top: 2px; }

.permit dl { margin: 0; }
.permit dt { font-weight: 600; margin-top: 10px; }
.permit dd { margin: 2px 0 0; font-size: .95rem; }
.coverage p { margin: 0 0 .5rem; }
.notice { background: var(--sand); box-shadow: none; }
.notice p { margin: 0; font-size: .88rem; }

.welcome h1 { font-size: 1.2rem; }
footer { text-align: center; padding: 8px var(--gutter) 28px; font-size: .85rem; color: var(--soft); }
footer p { margin: .25rem 0; }

@media (min-width: 720px) {
  #map { height: 420px; }
  h1 { font-size: 1.45rem; }
}

/* ---- Records (records.html) ---- */
.top-right { display: flex; gap: 8px; align-items: center; }
.btn-link { display: inline-block; text-decoration: none; border: 1px solid var(--line); border-radius: 10px; padding: .35rem .7rem; color: var(--blue); background: transparent; }
.btn-row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.nav { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.nav a { text-decoration: none; color: var(--ink); padding: .3rem .6rem; border-radius: 8px; font-size: .92rem; }
.nav a.on { background: var(--green); color: #fff; }
.list { display: flex; flex-direction: column; }
.row-item { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 10px 0; border-top: 1px solid var(--line); text-decoration: none; color: inherit; }
.row-item:first-child { border-top: 0; }
.row-item.col { flex-direction: column; align-items: stretch; }
a.row-item:hover b { color: var(--blue); }
.small-text { font-size: .86rem; }
.badge { display: inline-block; background: var(--sand); color: var(--ink); border-radius: 999px; padding: .1rem .6rem; font-size: .78rem; white-space: nowrap; margin-left: 4px; }
.badge.bad { background: #fbe9e7; color: #7a1f14; }
.badge.warn { background: #fff3d6; color: #6b4b00; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .badge.bad { background: #4a2420; color: #ffd9d3; } :root:not([data-theme="light"]) .badge.warn { background: #4a3a14; color: #ffe2a3; } }
.btn-col { display: flex; flex-direction: column; gap: 6px; align-items: flex-end; flex: none; }
button.tiny { font-size: .78rem; padding: .2rem .55rem; }
.rform { display: grid; grid-template-columns: 1fr 1fr; gap: 8px 10px; margin-top: 8px; }
.rform.inline { grid-template-columns: 1fr auto; align-items: end; }
.rform .field { display: flex; flex-direction: column; gap: 3px; font-size: .85rem; color: var(--soft); }
.rform .field.wide { grid-column: 1 / -1; }
.rform input, .rform select, .rform textarea { font: inherit; padding: .5rem .65rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); width: 100%; }
.rform textarea { resize: vertical; }
.rform .actions { grid-column: 1 / -1; display: flex; gap: 8px; }
.actions { display: flex; gap: 8px; margin-top: 8px; }
details.add { margin-top: 8px; }
details.add > summary { cursor: pointer; color: var(--blue); font-size: .9rem; }
.cycles { margin: 6px 0 0 8px; padding-left: 10px; border-left: 2px solid var(--line); }
.cycle { padding: 4px 0; font-size: .9rem; }
.err-text { color: var(--bad); }
@media (max-width: 480px) { .rform { grid-template-columns: 1fr; } .nav a { padding: .3rem .45rem; font-size: .86rem; } }
.field-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
button.mic.on { background: var(--bad); color: #fff; border-color: var(--bad); animation: pulse 1.2s ease-in-out infinite; }
@keyframes pulse { 50% { opacity: .65; } }
.mono { font-family: ui-monospace, Consolas, monospace; overflow-wrap: anywhere; }
.email-body { white-space: pre-wrap; font-size: .88rem; margin: 6px 0 0; font-family: inherit; }
.preview { width: 100%; border-collapse: collapse; font-size: .8rem; margin-top: 6px; }
.preview th, .preview td { border-top: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; overflow-wrap: anywhere; }
.import input[type="file"] { font: inherit; font-size: .9rem; margin: 6px 0; max-width: 100%; }
/* ---- v5: follow-ups, pipeline, agencies ---- */
.kpis { display: flex; flex-wrap: wrap; gap: 8px; margin: 4px 0 8px; }
.kpi { background: var(--sand); border-radius: 10px; padding: 6px 10px; min-width: 72px; }
.kpi b { display: block; font-size: 1.15rem; line-height: 1.2; }
.kpi span { color: var(--soft); font-size: .78rem; }
.group-head { display: flex; align-items: center; gap: 8px; margin: 10px 0 2px; font-weight: 600; }
.group-head:first-child { margin-top: 0; }
.group-head .count { color: var(--soft); font-weight: 400; font-size: .85rem; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px; }
.chips .chip { font-size: .82rem; padding: .22rem .7rem; }
.row-item select.tiny { font: inherit; font-size: .8rem; padding: .2rem .4rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); max-width: 140px; }
.row-item.due-bad { border-left: 3px solid var(--bad); padding-left: 8px; }
.row-item.due-today { border-left: 3px solid #b8860b; padding-left: 8px; }
.links { font-size: .86rem; }
.links a + a { margin-left: 4px; }
.links a + a::before { content: "\00b7"; color: var(--soft); margin-right: 4px; }
details.later > summary { cursor: pointer; color: var(--blue); font-size: .9rem; padding: 6px 0; }
/* ---- 0.5.0: today, reviews, search, sample data ---- */
.search { display: flex; gap: 8px; margin-bottom: 12px; }
.search input[type="search"] { flex: 1; min-width: 0; font: inherit; padding: .55rem .8rem; border: 1px solid var(--line); border-radius: 10px; background: var(--card); color: var(--ink); }
.search input:focus { outline: 2px solid var(--green); outline-offset: 1px; }
.today-grid { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 720px) { .today-grid { grid-template-columns: 1fr 1fr; } .today-grid .wide { grid-column: 1 / -1; } }
.today-grid .card { margin-bottom: 0; }
.days { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }
.days.hot { color: var(--bad); }
.where { font-size: .78rem; }
.hit-kind { display: inline-block; min-width: 58px; color: var(--soft); font-size: .78rem; text-transform: uppercase; letter-spacing: .03em; }
.sample { border: 1px dashed var(--line); }
/* ---- 0.6.0: permit page ---- */
.timeline { margin: 6px 0 0; padding: 0; list-style: none; }
.timeline li { position: relative; padding: 8px 0 10px 18px; border-left: 2px solid var(--line); }
.timeline li::before { content: ""; position: absolute; left: -6px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--line); }
.timeline li.open::before { background: #b8860b; }
.timeline li.back::before { background: var(--bad); }
.timeline li.done::before { background: var(--green); }
.checklist { margin: 6px 0 0; padding: 0; list-style: none; }
.checklist li { display: flex; gap: 8px; align-items: flex-start; padding: 4px 0; border-top: 1px solid var(--line); }
.checklist li:first-child { border-top: 0; }
.checklist input[type="checkbox"] { margin-top: 4px; flex: none; }
.checklist .txt { flex: 1; min-width: 0; }
.checklist .done .txt { color: var(--soft); text-decoration: line-through; }
.checklist .resp { display: block; color: var(--soft); font-size: .85rem; text-decoration: none; }
.add-item { display: flex; gap: 6px; margin-top: 6px; }
.add-item input { flex: 1; min-width: 0; font: inherit; padding: .4rem .6rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.progress { height: 6px; background: var(--sand); border-radius: 3px; overflow: hidden; margin: 6px 0 2px; }
.progress b { display: block; height: 100%; background: var(--green); }
/* ---- 0.7.0: phases with the lot ledger ---- */
.lots { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 4px; font-size: .86rem; }
.lots .bar { flex: 1 1 140px; min-width: 120px; height: 8px; background: var(--sand); border-radius: 4px; overflow: hidden; position: relative; }
.lots .bar .sold { position: absolute; left: 0; top: 0; bottom: 0; background: var(--gold); }
.lots .bar .built { position: absolute; left: 0; top: 0; bottom: 0; background: var(--green); }
.milestones { display: flex; flex-wrap: wrap; gap: 4px 10px; margin-top: 4px; font-size: .82rem; color: var(--soft); }
.milestones .ok { color: var(--ink); }
.milestones .ok::before { content: "\2713 "; color: var(--green); }
/* ---- 1.0.0: reports, scorecard, documents ---- */
.bars { display: flex; align-items: flex-end; gap: 4px; height: 110px; padding: 6px 0 0; border-bottom: 1px solid var(--line); }
.bars .b { flex: 1; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; min-width: 0; }
.bars .b i { display: block; width: 100%; background: var(--green); border-radius: 3px 3px 0 0; min-height: 2px; }
.bars .b i.pale { background: var(--gold); }
.bars .b small { font-size: .62rem; color: var(--soft); margin-top: 3px; white-space: nowrap; }
.score { display: grid; grid-template-columns: 1fr auto; gap: 6px 10px; align-items: center; margin-top: 6px; }
.score label { font-size: .86rem; }
.score .w { color: var(--soft); font-size: .78rem; }
.score select { font: inherit; font-size: .86rem; padding: .25rem .4rem; border: 1px solid var(--line); border-radius: 8px; background: var(--bg); color: var(--ink); }
.verdict { font-weight: 700; margin-top: 8px; }
.verdict.go { color: var(--ok); } .verdict.care { color: #b8860b; } .verdict.no { color: var(--bad); }
.fee { font-variant-numeric: tabular-nums; white-space: nowrap; }
table.rep { width: 100%; border-collapse: collapse; font-size: .88rem; }
table.rep th, table.rep td { text-align: left; padding: 5px 6px; border-top: 1px solid var(--line); }
table.rep th { color: var(--soft); font-weight: 500; font-size: .78rem; border-top: 0; }
table.rep td.n, table.rep th.n { text-align: right; font-variant-numeric: tabular-nums; }
/* ---- 1.1.0: map, owners ---- */
#sites-map { width: 100%; height: 52vh; min-height: 300px; border-radius: var(--radius); overflow: hidden; }
.owner { color: var(--soft); font-size: .8rem; }
.toggle { display: inline-flex; border: 1px solid var(--line); border-radius: 999px; overflow: hidden; }
.toggle button { border: 0; border-radius: 0; background: transparent; color: var(--ink); padding: .25rem .7rem; font-size: .85rem; }
.toggle button.on { background: var(--green); color: #fff; }
.maplibregl-popup-content { color: #1d2428; font: 13px/1.4 -apple-system, "Segoe UI", Roboto, Arial, sans-serif; }
.maplibregl-popup-content a { color: #1f4e8a; }

