/* SSOA Common Area Map. Layout: ledger panel on the left (totals, then parcels), aerial map fills the rest; stacked on phones. */

/* Base reset */
*, *::before, *::after { box-sizing: border-box; }
:root { padding-top: env(safe-area-inset-top, 0px); padding-bottom: env(safe-area-inset-bottom, 0px); }
body { margin: 0; font: 14px/1.45 system-ui, sans-serif; }
img { max-width: 100%; }
[hidden] { display: none !important; }
:root {
  --bg: #eef2ee; --panel: #fbfcfa; --ink: #1b2620; --muted: #5a685f; --line: #d3dcd4; --chip: #e3e9e3;
  --accent: #1d6a86; --accent-ink: #ffffff;
  --turf: #2e9a52; --tree: #c39410; --hard: #858b94; --review: #c25e08; --out: #98a0a5; --sketch: #7b4cb8;
  /* bid zone colors */
  --z0: #2f6fd6; --z1: #d1497b; --z2: #1f9e89; --z3: #b7791f; --z4: #7a52c7; --z5: #c2410c; --z6: #4d7c0f; --z7: #0e7490;
  --font-display: "Archivo", "Arial Narrow", "Helvetica Neue", Arial, sans-serif;
  --font-body: "Public Sans", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  --font-mono: "IBM Plex Mono", ui-monospace, "SFMono-Regular", Menlo, Consolas, monospace;
}
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) {
  --bg: #111714; --panel: #171e1a; --ink: #e2eae4; --muted: #98a69d; --line: #2a352f; --chip: #222b26;
  --accent: #58b2d0; --accent-ink: #0c1a20;
  --turf: #47bf70; --tree: #ddb23a; --hard: #9ba1ab; --review: #f08a3c; --out: #7d868b; --sketch: #a983e0;
  --z0: #6ea0f0; --z1: #ec7aa6; --z2: #4fc7b1; --z3: #e0aa52; --z4: #a88bea; --z5: #f08155; --z6: #8fc046; --z7: #45b4d0; color-scheme: dark } }
:root[data-theme="dark"] {
  --bg: #111714; --panel: #171e1a; --ink: #e2eae4; --muted: #98a69d; --line: #2a352f; --chip: #222b26;
  --accent: #58b2d0; --accent-ink: #0c1a20;
  --turf: #47bf70; --tree: #ddb23a; --hard: #9ba1ab; --review: #f08a3c; --out: #7d868b; --sketch: #a983e0;
  --z0: #6ea0f0; --z1: #ec7aa6; --z2: #4fc7b1; --z3: #e0aa52; --z4: #a88bea; --z5: #f08155; --z6: #8fc046; --z7: #45b4d0; color-scheme: dark }

html, body { height: 100%; }
body { background: var(--bg); color: var(--ink); font-family: var(--font-body); font-size: 14px; line-height: 1.45; }
.app { display: grid; grid-template-columns: minmax(340px, 420px) 1fr; height: 100%; }
.panel { background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; min-width: 0;
  padding-block: 20px 28px; padding-left: max(18px, env(safe-area-inset-left, 0px)); padding-right: 18px;
  display: flex; flex-direction: column; gap: 22px; }
.mapwrap { position: relative; min-width: 0; }
#map { position: absolute; inset: 0; background: var(--bg); }
@media (max-width: 860px) {
  html, body { height: auto; }
  .app { display: flex; flex-direction: column-reverse; height: auto; }
  .mapwrap { height: 62vh; min-height: 360px; }
  .panel { border-right: 0; border-top: 1px solid var(--line); overflow: visible; padding-right: max(16px, env(safe-area-inset-right, 0px)); padding-left: max(16px, env(safe-area-inset-left, 0px)); }
}

h1, h2, h3 { font-family: var(--font-display); text-wrap: balance; margin: 0; }
.eyebrow { font-family: var(--font-display); font-stretch: 85%; font-weight: 600; font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--accent); }
h1 { font-size: 30px; font-weight: 800; font-stretch: 80%; line-height: 1.02; letter-spacing: -.01em; margin-top: 4px; }
h2 { font-size: 15px; font-weight: 700; font-stretch: 88%; letter-spacing: .04em; text-transform: uppercase; }
.sub { color: var(--muted); margin: 6px 0 0; font-size: 13px; }
.num { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
.muted { color: var(--muted); }
.sync { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--muted); margin-top: 10px; }
.sync .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--out); flex: none; }
.sync[data-state="live"] .dot { background: var(--turf); }
.sync[data-state="local"] .dot { background: var(--review); }
.notice { margin-top: 10px; border: 1px solid var(--review); background: color-mix(in srgb, var(--review) 10%, var(--panel)); border-radius: 6px; padding: 10px 12px; font-size: 13px; display: flex; flex-direction: column; gap: 4px; }
.notice b { font-weight: 600; }

/* Scope ledger */
.ledger { display: flex; flex-direction: column; gap: 12px; }
.headline { display: flex; flex-direction: column; gap: 2px; }
.headline .label { font-size: 12.5px; color: var(--muted); }
.headline .big { font-family: var(--font-display); font-weight: 800; font-stretch: 78%; font-size: 44px; line-height: 1; letter-spacing: -.01em; font-variant-numeric: tabular-nums; }
.headline .big small { font-size: 18px; font-weight: 600; font-stretch: 90%; color: var(--muted); margin-left: 6px; letter-spacing: 0; }
.bar { display: flex; height: 12px; border-radius: 3px; overflow: hidden; background: var(--chip); }
.bar span { display: block; height: 100%; transition: width .3s ease; }
.rows { display: grid; grid-template-columns: auto 1fr auto auto; gap: 6px 12px; align-items: baseline; font-size: 13px; }
.rows .sw { width: 10px; height: 10px; border-radius: 2px; align-self: center; }
.rows .r { text-align: right; }
.rows .tot { border-top: 1px solid var(--line); padding-top: 6px; }
.formula { font-size: 12.5px; color: var(--muted); }
.streets summary { cursor: pointer; font-size: 13px; font-weight: 600; color: var(--accent); }
.streets ol { list-style: none; margin: 8px 0 0; padding: 0; display: grid; grid-template-columns: 1fr 1fr; column-gap: 18px; font-size: 12.5px; }
.streets li { display: flex; justify-content: space-between; gap: 8px; min-width: 0; padding: 2px 0; border-bottom: 1px dotted var(--line); }
.streets li span:last-child { font-family: var(--font-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; }
@media (max-width: 420px) { .streets ol { grid-template-columns: 1fr; } }
.actions { display: flex; flex-wrap: wrap; gap: 8px; }
button, select, input, textarea { font: inherit; color: inherit; }
.btn { border: 1px solid var(--line); background: var(--panel); border-radius: 6px; padding: 7px 12px; cursor: pointer; font-weight: 600; font-size: 13px; }
.btn:hover { border-color: var(--accent); }
.btn.primary { background: var(--accent); color: var(--accent-ink); border-color: var(--accent); }
.btn.primary:hover { filter: brightness(1.08); }
.btn.danger { color: var(--review); }
.btn:disabled { opacity: .5; cursor: default; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.toast { font-size: 12.5px; color: var(--muted); min-height: 1em; }

/* Toggles */
.layers { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.layers label { display: inline-flex; gap: 6px; align-items: center; cursor: pointer; }
.layers input { accent-color: var(--accent); }

/* Segmented status control */
.seg { display: inline-flex; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; flex: none; }
.seg button { border: 0; background: transparent; padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; color: var(--muted); }
.seg button + button { border-left: 1px solid var(--line); }
.seg button[aria-pressed="true"][data-s="in"] { background: var(--accent); color: var(--accent-ink); }
.seg button[aria-pressed="true"][data-s="review"] { background: var(--review); color: #fff; }
.seg button[aria-pressed="true"][data-s="out"] { background: var(--out); color: #fff; }
.seg button:disabled { cursor: default; }

/* Selected parcel */
.detail { border: 1px solid var(--line); border-radius: 8px; padding: 12px 14px; display: flex; flex-direction: column; gap: 10px; background: var(--panel); cursor: default; }
.plist li .detail { grid-column: 2 / -1; margin: 6px 0 4px; }
.plist .chev { display: inline-block; width: 0; height: 0; border-left: 5px solid var(--muted); border-top: 4px solid transparent; border-bottom: 4px solid transparent; transition: transform .15s ease; align-self: center; }
.plist li[aria-expanded="true"] .chev { transform: rotate(90deg); }
.plist li[aria-expanded="true"] .stripe { grid-row: span 2; }
.detail dl { display: grid; grid-template-columns: auto 1fr; gap: 3px 12px; margin: 0; font-size: 13px; }
.detail dt { color: var(--muted); }
.detail dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.svc { border: 0; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.svc legend { font-size: 12.5px; color: var(--muted); padding: 0; margin-bottom: 2px; }
.svc .grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 4px 12px; font-size: 13px; }
.svc label { display: flex; gap: 7px; align-items: center; cursor: pointer; }
.svc input { accent-color: var(--accent); margin: 0; }
.svc input:disabled + span { opacity: .7; }
.plist .l3 { display: flex; gap: 4px; flex-wrap: wrap; margin-top: 3px; }
.plist .tag { font-size: 11px; font-weight: 600; color: var(--ink); background: var(--chip); border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.detail textarea { width: 100%; box-sizing: border-box; min-height: 58px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: var(--panel); resize: vertical; }
.detail a { color: var(--accent); }

/* Lists */
.listhead { display: flex; justify-content: space-between; align-items: baseline; gap: 10px; flex-wrap: wrap; }
.filters { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.filters input[type="search"] { flex: 1 1 140px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; background: var(--panel); }
.filters select { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--panel); }
.plist { list-style: none; margin: 0; padding: 0; border-top: 1px solid var(--line); }
.plist li { display: grid; grid-template-columns: 4px 1fr auto; gap: 4px 10px; padding: 9px 4px 9px 0; border-bottom: 1px solid var(--line); cursor: pointer; align-items: center; }
.plist li:hover, .plist li[aria-current="true"] { background: var(--chip); }
.plist .stripe { align-self: stretch; border-radius: 2px; background: var(--accent); }
.plist li[data-s="review"] .stripe { background: var(--review); }
.plist li[data-s="out"] .stripe { background: var(--out); }
.plist li[data-s="out"] .main { opacity: .6; }
.plist .main { min-width: 0; }
.plist .l1 { display: flex; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.plist .pid { font-family: var(--font-mono); font-size: 13px; font-weight: 500; }
.plist .subn { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.plist .l2 { font-size: 12px; color: var(--muted); display: flex; gap: 10px; flex-wrap: wrap; }
.plist .l2 b { font-weight: 600; color: var(--ink); font-family: var(--font-mono); font-size: 11.5px; }
.plist .note-flag { color: var(--review); font-weight: 600; }
.plist .basis { font-size: 11px; font-weight: 600; letter-spacing: .02em; color: var(--accent); border: 1px solid var(--line); border-radius: 4px; padding: 0 5px; white-space: nowrap; }
@media (max-width: 520px) {
  .plist li { grid-template-columns: 4px 1fr; }
  .plist li .seg { grid-column: 2; justify-self: start; }
  .plist li .stripe { grid-row: span 2; }
  .plist li[aria-expanded="true"] .stripe { grid-row: span 3; }
}
.empty { color: var(--muted); font-size: 13px; padding: 10px 0; }
.alist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.alist li { display: flex; gap: 10px; align-items: center; justify-content: space-between; border: 1px solid var(--line); border-radius: 6px; padding: 7px 10px; }
.alist .nm { font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.alist .kind { font-size: 12px; color: var(--muted); }
.alist .kind.add { color: var(--sketch); }
.sketchbox { border: 1px dashed var(--sketch); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.sketchbox input[type="text"] { border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; background: var(--panel); min-width: 0; }
.sketchbox .radio { display: flex; gap: 14px; flex-wrap: wrap; font-size: 13px; }
.sketchbox .radio label { display: inline-flex; gap: 6px; align-items: center; }

.method { font-size: 12.5px; color: var(--muted); display: flex; flex-direction: column; gap: 8px; border-top: 1px solid var(--line); padding-top: 14px; }
.method p { margin: 0; max-width: 62ch; }
.method a { color: var(--accent); }

/* Map chrome */
.leaflet-container { font-family: var(--font-body); background: var(--bg); }
.leaflet-bar a { background: var(--panel); color: var(--ink); border-bottom-color: var(--line); }
.leaflet-bar a:hover { background: var(--chip); }
.leaflet-control-attribution { background: color-mix(in srgb, var(--panel) 85%, transparent) !important; color: var(--muted); font-size: 10.5px; }
.leaflet-control-attribution a { color: var(--accent); }
.leaflet-tooltip.ptip { background: var(--panel); color: var(--ink); border: 1px solid var(--line); box-shadow: 0 2px 8px rgb(0 0 0 / .18); font-size: 12px; padding: 5px 8px; }
.leaflet-tooltip.ptip::before { display: none; }
.ptip .pid { font-family: var(--font-mono); font-weight: 500; }
.maplegend { position: absolute; left: max(10px, env(safe-area-inset-left, 0px)); bottom: 24px; z-index: 500; background: color-mix(in srgb, var(--panel) 92%, transparent);
  border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.maplegend div { display: flex; gap: 7px; align-items: center; }
.maplegend i { width: 12px; height: 12px; border-radius: 2px; display: inline-block; }
.maplegend i.ln { height: 0; border-top: 2px solid var(--accent); border-radius: 0; }
.maplegend i.ln.rv { border-top: 2px dashed var(--review); }
.maplegend i.ln.ot { border-top: 2px dashed var(--out); }
.sketchhint { position: absolute; top: max(12px, env(safe-area-inset-top, 0px)); left: 50%; transform: translateX(-50%); z-index: 600; background: var(--sketch); color: #fff;
  padding: 7px 12px; border-radius: 6px; font-size: 13px; font-weight: 600; box-shadow: 0 2px 10px rgb(0 0 0 / .25); max-width: calc(100% - 100px); text-align: center; }
.sketching .leaflet-container { cursor: crosshair; }
.st-label { pointer-events: none; }
.st-label span { position: absolute; left: 0; top: 0; transform-origin: 0 0; white-space: nowrap; font-family: var(--font-display); font-stretch: 85%; font-weight: 600; font-size: 12px; letter-spacing: .02em;
  color: #fff; text-shadow: 0 0 2px #10201a, 0 0 3px #10201a, 0 0 6px rgb(16 32 26 / .7); }
.st-label.major span { font-size: 13.5px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; }
@media (prefers-reduced-motion: reduce) { .bar span, .plist .chev { transition: none; } }

/* Sign-in bar and board management */
.authbar { display: flex; flex-wrap: wrap; gap: 8px 10px; align-items: center; margin-top: 12px; font-size: 13px; }
.authbar .who { color: var(--muted); min-width: 0; overflow-wrap: anywhere; }
.authbar .role { font-size: 11px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--accent); border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.signin-box { border: 1px solid var(--line); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 10px; background: var(--bg); margin-top: 10px; }
.signin-box form { display: flex; gap: 8px; flex-wrap: wrap; }
.signin-box input[type="email"] { flex: 1 1 200px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: var(--panel); }
.signin-box .or { font-size: 12px; color: var(--muted); }
.board { display: flex; flex-direction: column; gap: 10px; }
.board ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.board li { display: flex; justify-content: space-between; align-items: center; gap: 10px; border: 1px solid var(--line); border-radius: 6px; padding: 6px 10px; font-size: 13px; }
.board li .em { min-width: 0; overflow-wrap: anywhere; }
.board form { display: flex; gap: 8px; flex-wrap: wrap; }
.board input[type="email"] { flex: 1 1 200px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; background: var(--panel); }
.board select { border: 1px solid var(--line); border-radius: 6px; padding: 6px 8px; background: var(--panel); }
.notice.info { border-color: var(--accent); background: color-mix(in srgb, var(--accent) 8%, var(--panel)); }

/* Shared bits for the newer sections */
.small { font-size: 12.5px; }
p.small { margin: 0; }
.stack { display: flex; flex-direction: column; gap: 10px; }
.tablewrap { overflow-x: auto; }
table.qty { width: 100%; border-collapse: collapse; font-size: 13px; }
table.qty th { text-align: left; font-weight: 600; font-size: 12px; color: var(--muted); padding: 4px 6px 4px 0; border-bottom: 1px solid var(--line); white-space: nowrap; }
table.qty td { padding: 5px 6px 5px 0; border-bottom: 1px solid var(--line); vertical-align: top; }
table.qty td .unit.small { font-size: 11.5px; line-height: 1.3; display: inline-block; margin-top: 2px; }
table.qty td.r, table.qty th.r { text-align: right; font-family: var(--font-mono); font-variant-numeric: tabular-nums; font-size: 12px; white-space: nowrap; }
table.qty td .unit { color: var(--muted); }
table.qty tr.zero td { color: var(--muted); }
table.qty input[type="text"] { width: 100%; min-width: 0; border: 1px solid var(--line); border-radius: 4px; padding: 2px 5px; background: var(--panel); font-size: 13px; }
table.qty .zsw { display: inline-block; width: 11px; height: 11px; border-radius: 3px; vertical-align: -1px; margin-right: 6px; border: 0; padding: 0; cursor: pointer; }
table.qty button.link { border: 0; background: none; color: var(--review); cursor: pointer; font-size: 12px; padding: 0; }
.inline-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.inline-form input[type="text"] { flex: 1 1 160px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 6px 9px; background: var(--panel); }
.inline-form select, .logform select, .logform input, #logFilter, .reportbox select, .detail select, .detail input[type="date"], .detail input[type="number"] {
  border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: var(--panel); min-width: 0; }
.reportbox { border: 1px dashed var(--review); border-radius: 8px; padding: 12px; display: flex; flex-direction: column; gap: 6px; }
.reportbox textarea { width: 100%; min-height: 64px; border: 1px solid var(--line); border-radius: 6px; padding: 7px 9px; background: var(--panel); resize: vertical; }
.logform { display: grid; grid-template-columns: auto 1fr 1fr; gap: 8px; }
.logform input[type="text"] { grid-column: 1 / -1; }
.logform button { grid-column: 1 / -1; justify-self: start; }
#logFilter { align-self: flex-start; }
.rlist, .vlist { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.rlist li { border: 1px solid var(--line); border-radius: 6px; padding: 8px 10px; display: flex; flex-direction: column; gap: 4px; font-size: 13px; cursor: pointer; }
.rlist li[aria-current="true"] { border-color: var(--accent); }
.rlist .top { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; flex-wrap: wrap; }
.rlist .cat { font-weight: 600; }
.rlist .meta { color: var(--muted); font-size: 12px; }
.rlist .reply { border-left: 2px solid var(--line); padding-left: 8px; }
.rlist .manage { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; cursor: default; }
.rlist .manage input { flex: 1 1 160px; min-width: 0; border: 1px solid var(--line); border-radius: 6px; padding: 5px 8px; background: var(--panel); }
.chip { font-size: 11px; font-weight: 600; border-radius: 4px; padding: 1px 6px; white-space: nowrap; }
.chip.open { background: color-mix(in srgb, var(--review) 18%, var(--panel)); color: var(--review); }
.chip.progress { background: color-mix(in srgb, var(--accent) 16%, var(--panel)); color: var(--accent); }
.chip.done { background: var(--chip); color: var(--muted); }
.vlist li { display: flex; justify-content: space-between; gap: 10px; align-items: baseline; border-bottom: 1px solid var(--line); padding: 4px 0; font-size: 13px; }
.vlist .when { font-family: var(--font-mono); font-size: 12px; white-space: nowrap; }
.vlist .what { min-width: 0; flex: 1; overflow-wrap: anywhere; }
.plist .zonetag { font-size: 11px; font-weight: 600; border-radius: 4px; padding: 0 6px; color: var(--panel); white-space: nowrap; }
.plist .vtag { font-size: 11px; font-weight: 600; color: var(--turf); white-space: nowrap; }
.plist .bn-flag { color: var(--sketch); font-weight: 600; }
.detail .row2 { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; font-size: 13px; }
.detail .row2 label { display: inline-flex; gap: 6px; align-items: center; }
.detail input[type="number"] { width: 9em; }
.detail details.hist summary { cursor: pointer; font-size: 12.5px; color: var(--accent); font-weight: 600; }
.detail details.hist ol { list-style: none; margin: 6px 0 0; padding: 0; font-size: 12.5px; display: flex; flex-direction: column; gap: 4px; }
.detail details.hist li { border-left: 2px solid var(--line); padding-left: 8px; }
.detail details.hist .when { color: var(--muted); }
.detail .private { border: 1px dashed var(--sketch); border-radius: 6px; padding: 8px; display: flex; flex-direction: column; gap: 4px; }
.zlegend { display: flex; flex-direction: column; gap: 4px; border-top: 1px solid var(--line); padding-top: 4px; }
.rlegend { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; border-top: 1px solid var(--line); padding-top: 4px; }
.maplegend i.pin { width: 11px; height: 11px; border-radius: 50%; border: 2px solid #fff; box-shadow: 0 1px 2px rgb(0 0 0 / .45); margin-left: 2px; }
.rlegend { font-size: 12px; }
.maplegend i.pin.open { background: var(--review); }
.maplegend i.pin.progress { background: var(--accent); }
.vmark { color: #fff; background: var(--turf); border-radius: 50%; width: 16px; height: 16px; display: flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 700; box-shadow: 0 0 0 2px #fff; }
.picking .leaflet-container { cursor: crosshair; }
@media (max-width: 520px) { .logform { grid-template-columns: 1fr; } }
