/* VIA Serviceability stylesheet.

   The palette above is the family's, kept byte-for-byte so PSA looks like
   Scout, Racked and Tickets. Everything BELOW it is PSA's own.

   This file deliberately does NOT carry Racked's component CSS. It did at
   first -- the whole stylesheet was copied for the palette -- and the generic
   names collided: Racked defines `.grid { display: grid }` for a photo grid,
   which turned every table on this page into a grid container and flattened
   the rows, and `.status { display: inline-flex }` fought the run status line.
   Copying a stylesheet for four colour variables is how you inherit a hundred
   rules you never look at. Take the palette; write the components.
*/
:root {
  /* VIA family palette — navy / signal blue / amber on light (matches VIA Scout) */
  --bg: #eef1f5;
  --panel: #ffffff;
  --panel2: #f7fafc;
  --line: #e2e8f0;
  --text: #1a202c;
  --navy: #14304a;
  --muted: #718096;
  --accent: #2b6cb0;
  --accent2: #2b6cb0;
  --amber: #f5a623;
  --ok: #2f855a;
  --warn: #c05621;
  --err: #c53030;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  -webkit-text-size-adjust: 100%;
}
input, select, button { font-family: inherit; }
input[type=text], input[type=email], input[type=password], select {
  border: 1px solid var(--line); border-radius: 5px; background: var(--panel);
  color: var(--text);
}
a { color: var(--accent); }

/* ---- VIA Serviceability app shell ------------------------------------------------- */
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--navy); color: #fff; padding: 10px 16px;
}
.topbar .brand { font-size: 18px; font-weight: 700; letter-spacing: .5px;
                 display: flex; align-items: center; gap: 8px; }
.topbar .brandmark { display: block; border-radius: 5px; }
.rv-head .brandmark { display: block; border-radius: 4px; }
.topbar .brand-via { color: var(--amber); }
.topbar-right { display: flex; align-items: center; gap: 12px; font-size: 14px; }
.topbar .muted { color: #cbd5e0; }
.wrap { max-width: 1200px; margin: 0 auto; padding: 16px; }
.row-between { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; }
.row-gap { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin-top: 10px; }
.muted { color: var(--muted); }
.panel {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 14px 16px; margin: 16px 0;
}
.panel h3 { margin: 0 0 6px; font-size: 15px; }
.btn {
  background: var(--accent); color: #fff; border: 0; border-radius: 6px;
  padding: 8px 14px; font-size: 14px; cursor: pointer;
}
.btn-sm {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 5px; padding: 3px 8px; font-size: 12px; cursor: pointer;
  text-decoration: none;
}
.btn-link { background: none; border: 0; color: var(--accent); cursor: pointer; font-size: 14px; }
.topbar .btn-link { color: #fff; text-decoration: underline; }
.cards { display: flex; flex-wrap: wrap; gap: 10px; margin: 14px 0; }
.card {
  background: var(--panel); border: 1px solid var(--line); border-radius: 8px;
  padding: 10px 14px; min-width: 120px;
}
/* The phantom-bill count is the commercial answer the audit exists to produce,
   so it is the one number given emphasis. */
.card-accent { border-color: var(--amber); border-width: 2px; }
.card-n { font-size: 24px; font-weight: 700; color: var(--navy); }
.card-l { font-size: 12px; color: var(--muted); }
table.grid { width: 100%; border-collapse: collapse; font-size: 14px; background: var(--panel); }
table.grid th, table.grid td { border-bottom: 1px solid var(--line); padding: 7px 9px; text-align: left; }
table.grid th { background: var(--panel2); font-weight: 600; color: var(--navy); }
table.grid td.num, table.grid th.num { text-align: right; }
table.grid td.ok { color: var(--ok); font-weight: 700; }
table.grid td.bad { color: var(--err); font-weight: 700; }
.status { font-size: 13px; color: var(--muted); min-height: 18px; margin-top: 6px; }
.status.ok { color: var(--ok); }
.status.warn { color: var(--warn); }
.status.bad { color: var(--err); }
label.inline { font-size: 13px; margin: 0 10px; }
#new-audit-dialog { border: 1px solid var(--line); border-radius: 8px; padding: 18px; }
#new-audit-dialog label { display: block; margin: 8px 0; font-size: 13px; }
#new-audit-dialog input { display: block; width: 320px; padding: 6px; margin-top: 3px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 10px; margin-top: 14px; }

/* ---- run controls ------------------------------------------------------ */
.run-controls { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 14px; margin: 10px 0; }
.run-controls label { font-size: 12px; color: var(--muted); display: block; }
.run-controls select { display: block; margin-top: 3px; padding: 6px; font-size: 13px; }
.progress {
  height: 10px; background: var(--panel2); border: 1px solid var(--line);
  border-radius: 5px; overflow: hidden; margin: 10px 0 6px;
}
.progress-bar { height: 100%; width: 0; background: var(--accent); transition: width .4s ease; }
#run-history { font-size: 12px; margin-top: 8px; }
#run-estimate { font-size: 13px; margin-top: 4px; }

/* ---- Results Viewer ----------------------------------------------------
   Ported from ~/vision-bench/rv.py. Colour carries the verdict: green when a
   supply was located, red when none was. Red is the case that ends up on a
   phantom-bill list at $96.60/month, so it must never read as routine. */
:root { --cols: 6; }
.rv-body { background: var(--bg); }
.rv-head {
  display: flex; gap: .5rem; align-items: center; flex-wrap: wrap;
  padding: .6rem .9rem; background: var(--panel); border-bottom: 1px solid var(--line);
  position: sticky; top: 0; z-index: 20;
}
.rv-head b { font-size: 14px; color: var(--navy); }

.rv-head .sp { flex: 1; }
.pill { font-size: 11.5px; color: var(--muted); }
.rv-head button, .rv-head .btn-link {
  background: var(--panel2); color: var(--text); border: 1px solid var(--line);
  border-radius: 5px; padding: .3rem .6rem; font-size: 12px; cursor: pointer;
}
.rv-head button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
.rv-head button[disabled] { opacity: .45; cursor: default; }
.cols { display: flex; align-items: center; gap: .4rem; font-size: 12px; color: var(--muted); }
.cols input { width: 104px; }
.cols b { min-width: 1.1rem; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }

main#grid {
  padding: 1rem; display: grid; gap: .8rem;
  grid-template-columns: repeat(var(--cols, 6), minmax(0, 1fr));
}
@media (max-width: 820px) {
  main#grid { grid-template-columns: repeat(auto-fill, minmax(240px, 1fr)); }
}
nav#pager { display: flex; gap: .3rem; justify-content: center; align-items: center; padding: 1rem; flex-wrap: wrap; }
nav#pager button { min-width: 2.2rem; padding: .3rem .55rem; background: var(--panel); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
nav#pager button.on { background: var(--navy); color: #fff; border-color: var(--navy); }
nav#pager button[disabled] { opacity: .45; cursor: default; }
nav#pager .gap { color: var(--muted); padding: 0 .2rem; }
nav#pager .info { color: var(--muted); font-size: 12.5px; margin-right: .6rem; }
.none { padding: 2rem; text-align: center; color: var(--muted); grid-column: 1 / -1; }

.card {
  background: var(--panel); border-radius: 10px; overflow: hidden;
  border-top: 3px solid #ccc; box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.card.yes { border-top-color: var(--ok); }
.card.no { border-top-color: var(--err); }
/* the one that costs the client money if we are right, and costs us our
   credibility if we are wrong */
.card.phantom { box-shadow: 0 0 0 2px var(--amber), 0 1px 3px rgba(0,0,0,.12); }
.hd { display: flex; gap: .5rem; align-items: baseline; padding: .55rem .8rem .2rem; flex-wrap: wrap; }
.hd b { font-size: 15px; }
.tag { font-size: 11px; font-weight: 700; letter-spacing: .04em; }
.yes .tag { color: var(--ok); } .no .tag { color: var(--err); }
.amps { margin-left: auto; color: var(--muted); font-size: 12px; white-space: nowrap; font-variant-numeric: tabular-nums; }
.views { display: flex; gap: 2px; background: #000; cursor: zoom-in; }
.views figure { margin: 0; flex: 1; min-width: 0; position: relative; }
.views img { width: 100%; display: block; }
.views .noimg {
  display: flex; align-items: center; justify-content: center; text-align: center;
  min-height: 90px; padding: 8px; color: #bbb; font-size: 11px; background: #1a1a1a;
}
.views figcaption {
  position: absolute; left: 0; bottom: 0; background: rgba(0,0,0,.6); color: #fff;
  font-size: 10.5px; padding: 1px 5px; letter-spacing: .03em;
}
.ask { padding: .5rem .7rem .4rem; font-size: 12.5px; line-height: 1.45; font-weight: 700; }
.ask .src { display: block; font-size: 14px; letter-spacing: .04em; text-transform: uppercase; color: var(--navy); font-weight: 800; margin-bottom: .1rem; }
.ask i { font-style: normal; font-weight: 600; opacity: .75; }
.yes .ask { color: #0a7d0a; } .yes .ask b { color: #086b08; }
.no .ask { color: #c0392b; }  .no .ask b { color: #a52d2d; }
.why { padding: .1rem .8rem .4rem; font-size: 12px; color: #444; min-height: 2.1em; border-top: 1px solid var(--line); margin-top: .15rem; }
/* Imagery old enough that the verdict cannot speak to the billing period being
   argued over. --warn, not --err: this is a weaker claim, not a wrong one. */
.why .stale { color: var(--warn); font-weight: 600; }
/* three verdicts on one row, the two links on the next: at 215px a single
   wrapping row stranded one button per line */
.bar { display: flex; gap: .3rem; padding: .35rem .7rem; }
.bar .v { flex: 1; padding: .32rem .2rem; font-size: 12px; font-weight: 600; white-space: nowrap; background: var(--panel2); border: 1px solid var(--line); border-radius: 5px; cursor: pointer; }
.v-yes.on { background: var(--ok); color: #fff; border-color: var(--ok); }
.v-no.on { background: var(--err); color: #fff; border-color: var(--err); }
.v-maybe.on { background: var(--amber); color: #111; border-color: #e09c00; }
.bar2 { display: flex; gap: .3rem; padding: 0 .7rem .7rem; }
.bar2 .lk { flex: 1; font-size: 11.5px; padding: .26rem .2rem; color: var(--accent); border: 1px solid #cfe0ff; background: var(--panel); border-radius: 5px; text-align: center; text-decoration: none; cursor: pointer; }
.bar2 .lk:hover { background: #eef5ff; }

#research-dialog { border: 1px solid var(--line); border-radius: 8px; padding: 18px; max-width: 520px; }
#research-dialog label { display: block; margin: 10px 0; font-size: 13px; }
#research-dialog select { display: block; margin-top: 4px; padding: 6px; }

/* ---- the comparison modal: still | live Street View | live satellite ----- */
.pager { display: flex; gap: 10px; align-items: center; justify-content: center; padding: 8px; font-size: 12px; }
.cols { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--muted); }
.cols input { width: 104px; }
.cols b { min-width: 1.1rem; text-align: center; color: var(--text); font-variant-numeric: tabular-nums; }
.rv-frame[data-act] { cursor: zoom-in; }

.modal {
  position: fixed; inset: 0; background: rgba(0,0,0,.88); z-index: 60; display: none;
  flex-direction: column; padding: .8rem; height: 100vh; height: 100dvh;
}
.modal.on { display: flex; }
.mhd { display: flex; gap: .8rem; align-items: center; color: #fff; padding: .2rem .3rem .7rem; flex-wrap: wrap; }
.mhd b { font-size: 1.05rem; }
.mhd .m { color: #bbb; font-size: 12.5px; }
.mhd .sp { flex: 1; }
/* The judged still is square and the live panels are not, so give the still a
   narrower column rather than letterboxing a 640x640 into a wide slot. */
.panes {
  flex: 1 1 auto; display: grid;
  grid-template-columns: minmax(240px, 0.8fr) 1.4fr 1.4fr;
  gap: .6rem; min-height: 0; height: 100%;
}
.pane { background: #000; border-radius: 8px; overflow: hidden; position: relative; min-height: 0; display: flex; }
/* The iframes live inside #msv / #mae. Without an explicit height on the
   WRAPPER, the iframe's height:100% resolves against auto and collapses to a
   sliver — which is why the live panels once used a tenth of the screen. */
.pane > div { flex: 1; min-height: 0; width: 100%; height: 100%; display: flex; }
/* the shield: pointer events stop here until the reviewer clicks */
.live-wrap { position: relative; flex: 1; min-height: 0; width: 100%; height: 100%; display: flex; }
.pane .shield {
  position: absolute; inset: 0; z-index: 3; border: 0; cursor: pointer;
  background: transparent; display: flex; align-items: flex-end; justify-content: center;
  padding-bottom: 18px;
}
.pane .shield span {
  background: rgba(0,0,0,.72); color: #fff; font-size: 12px; padding: 5px 12px;
  border-radius: 14px; letter-spacing: .02em;
}
.pane .shield:hover span { background: rgba(0,0,0,.88); }
.pane iframe { flex: 1; width: 100%; height: 100%; border: 0; display: block; min-height: 0; }
.pane img { width: 100%; height: 100%; border: 0; display: block; object-fit: contain; background: #000; }
.pane .cap {
  position: absolute; left: 0; top: 0; background: rgba(0,0,0,.65); color: #fff;
  font-size: 11px; padding: 2px 7px; letter-spacing: .03em; z-index: 2;
}
.pane .nokey { color: #ccc; font-size: 13px; padding: 2rem; text-align: center; margin: auto; }
@media (max-width: 1100px) {
  .panes { grid-template-columns: 1fr; overflow: auto; height: auto; }
  .pane { min-height: 60vh; }
}

.sub-head { margin: 22px 0 4px; font-size: 14px; color: var(--navy); }

/* ---- the escalation ladder ---------------------------------------------- */
.ladder {
  display: flex; flex-wrap: wrap; gap: 14px; align-items: center;
  padding: 8px 16px; background: var(--panel2); border-bottom: 1px solid var(--line);
  font-size: 12px; color: var(--muted);
}
.ladder .sp { flex: 1; }
.ladder .rung b { color: var(--navy); font-size: 13px; font-variant-numeric: tabular-nums; }
/* the end of the ladder is a truck roll, so it does not read like the rest */
.ladder .rung-manual b { color: var(--err); }
.manual-panel {
  margin: 14px 16px; padding: 12px 14px; background: var(--panel);
  border: 1px solid var(--line); border-left: 3px solid var(--err); border-radius: 8px;
}
.manual-panel h3 { margin: 0; font-size: 14px; }
.manual-panel table.grid { margin-top: 8px; }

/* A card that could NOT be answered. Amber, deliberately not the red of "no
   structure": 9% of rural locations land here and they are work for a person,
   not a rejection. Giving them the same colour is how they get read as one. */
.card.maybe { border-color: var(--amber); }
.card.maybe .tag { background: var(--amber); color: #1a202c; }
/* The tax-roll flag: a roof the assessor charges nothing for. --warn, because
   it is a caution to check, never a verdict. */
.flag {
  margin: 0 .8rem .4rem; padding: .35rem .5rem; font-size: 11.5px;
  color: var(--warn); background: #fff7ed; border-left: 2px solid var(--warn);
  border-radius: 2px;
}
