:root {
  --green: #0b3d2e; --green2: #13664c; --red: #d62828; --red-d: #a4161a; --ink: #14201b; --muted: #5d6b65;
  --bg: #f3f6f4; --card: #fff; --line: #dfe6e2; --ok: #1b8a4b; --warn: #b26a00;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--ink); }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
[hidden] { display: none !important; }
h1 { font-size: 26px; margin: 8px 0; }
h2 { font-size: 19px; margin: 0; }
h3 { font-size: 15px; margin: 18px 0 8px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.muted { color: var(--muted); }
.small { font-size: 13px; }

.top { position: sticky; top: 0; z-index: 5; display: flex; justify-content: space-between; align-items: center;
  padding: calc(10px + env(safe-area-inset-top)) 16px 10px; background: var(--green); color: #fff; }
.brand { font-weight: 800; font-size: 17px; }
.who { font-size: 13px; opacity: .85; }
.net { display: flex; align-items: center; gap: 6px; border: 1px solid rgba(255,255,255,.35); background: transparent; color: #fff;
  border-radius: 20px; padding: 6px 10px; font-size: 13px; }
.net .dot { width: 9px; height: 9px; border-radius: 50%; background: #9aa; }
.net.online .dot { background: #4ade80; }
.net.offline .dot { background: #fbbf24; }

.view { padding: 14px 16px 30px; max-width: 560px; margin: 0 auto; }
.view.full { position: fixed; inset: 0; z-index: 20; padding: 0; max-width: none; background: #000; }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 14px; margin: 10px 0; }
label { display: block; font-weight: 600; font-size: 14px; margin: 10px 0; }
input, select { display: block; width: 100%; margin-top: 6px; font-size: 18px; padding: 12px; border: 1px solid #bfcac5; border-radius: 10px; background: #fff; color: var(--ink); }
input:focus, select:focus { outline: 3px solid #8fd3b6; border-color: var(--green2); }
.error { color: var(--red); font-weight: 600; min-height: 1em; }

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; border: 0; border-radius: 12px; padding: 12px 16px;
  font-size: 16px; font-weight: 700; text-decoration: none; cursor: pointer; }
.btn.big { width: 100%; padding: 16px; font-size: 18px; margin-top: 8px; }
.btn.primary { background: var(--green2); color: #fff; }
.btn.danger { background: var(--red); color: #fff; }
.btn.ghost { background: transparent; color: var(--green2); border: 2px solid var(--green2); }
.btn.ghost.light { color: #fff; border-color: rgba(255,255,255,.7); }
a.btn.ghost { width: 100%; margin-top: 14px; }

.station h2 { font-size: 18px; }
.station .meta { color: var(--muted); font-size: 14px; margin-top: 4px; }
.station .warn { color: var(--warn); font-weight: 600; font-size: 14px; margin-top: 6px; }
.station button { margin-top: 10px; }

.help-wrap { display: flex; justify-content: center; margin: 18px 0; }
.help { position: relative; width: 190px; height: 190px; border-radius: 50%; border: 0; background: radial-gradient(circle at 35% 30%, #ff5a5a, var(--red) 55%, var(--red-d));
  color: #fff; box-shadow: 0 10px 30px rgba(214,40,40,.35); touch-action: none; user-select: none; -webkit-user-select: none; -webkit-touch-callout: none; }
.help .help-label { display: block; font-size: 40px; font-weight: 900; letter-spacing: .06em; }
.help .help-sub { display: block; font-size: 14px; opacity: .9; }
.help .ring { position: absolute; inset: 0; transform: rotate(-90deg); }
.help .ring circle { fill: none; stroke: #fff; stroke-width: 7; stroke-dasharray: 340; stroke-dashoffset: 340; }
.help.holding .ring circle { transition: stroke-dashoffset 2s linear; stroke-dashoffset: 0; }
.help.holding { transform: scale(.97); }

.grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.tile { background: var(--card); border: 1px solid var(--line); border-radius: 14px; padding: 18px 10px; font-size: 16px; font-weight: 700; color: var(--ink); }
.tile .ico { display: block; font-size: 30px; margin-bottom: 6px; }
.tracking { margin-top: 14px; background: #fff4e5; border: 1px solid #f3c27b; color: #7a4a00; border-radius: 12px; padding: 12px; font-weight: 600;
  display: flex; justify-content: space-between; align-items: center; gap: 10px; }
.tracking button { border: 0; background: var(--warn); color: #fff; border-radius: 8px; padding: 8px 10px; font-weight: 700; }

.bar { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.back { border: 0; background: transparent; font-size: 17px; color: var(--green2); font-weight: 700; padding: 6px 4px; }
.search { margin: 0 0 10px; }
.list { list-style: none; margin: 0; padding: 0; }
.list li { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 12px; margin-bottom: 8px; }
.list li button { all: unset; display: block; width: 100%; cursor: pointer; }
.list .t { font-weight: 700; }
.list .s { color: var(--muted); font-size: 13px; margin-top: 2px; }
.list .bad { color: var(--red); }
.list .good { color: var(--ok); }
details summary { font-weight: 700; color: var(--green2); cursor: pointer; }

video#camVideo, video#vidLive, video#vidReview, #camShot { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.cam-hint { position: absolute; top: calc(14px + env(safe-area-inset-top)); left: 0; right: 0; text-align: center; color: #fff; font-weight: 700;
  text-shadow: 0 1px 3px #000; font-size: 16px; }
.cam-bar { position: absolute; left: 0; right: 0; bottom: 0; display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); background: linear-gradient(transparent, rgba(0,0,0,.75)); }
.cam-bar .spacer { width: 84px; }
.shutter { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255,255,255,.25); }
.shutter.rec { background: var(--red); }
.shutter.rec.on { border-radius: 18px; width: 64px; height: 64px; }
.verdict { color: #fff; font-weight: 800; text-align: center; flex: 1; }
.verdict.bad { color: #fca5a5; }
.verdict.ok { color: #86efac; }
.note { flex: 1; margin: 0; font-size: 15px; padding: 10px; }

.thumb { width: 100%; max-height: 220px; object-fit: contain; background: #000; border-radius: 12px; cursor: zoom-in; }
.cand { display: grid; grid-template-columns: 10px 1fr 110px; align-items: center; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line); }
.cand .chip { width: 10px; height: 38px; border-radius: 4px; }
.cand .n { font-weight: 700; }
.cand .p { font-size: 12px; color: var(--muted); }
.cand input { margin: 0; text-align: right; font-size: 22px; font-variant-numeric: tabular-nums; padding: 10px; }
.cand .read { grid-column: 3; text-align: right; font-size: 12px; color: var(--muted); }
.total input { font-size: 22px; text-align: right; }
.check { padding: 10px; border-radius: 10px; font-weight: 700; margin: 8px 0; }
.check.ok { background: #e7f6ed; color: var(--ok); }
.check.bad { background: #fde8e8; color: var(--red); }

dialog { border: 0; border-radius: 16px; padding: 18px; width: min(92vw, 460px); }
dialog::backdrop { background: rgba(0,0,0,.5); }
dialog .row { display: flex; gap: 10px; margin-top: 14px; }
dialog .row .btn { flex: 1; }
.sumrow { display: flex; justify-content: space-between; padding: 6px 0; border-bottom: 1px solid var(--line); font-size: 16px; }
.sumrow b { font-variant-numeric: tabular-nums; }

.overlay { position: fixed; inset: 0; z-index: 30; background: rgba(10,20,15,.88); display: flex; align-items: center; justify-content: center; padding: 20px; }
.overlay-box { background: #fff; border-radius: 18px; padding: 22px; width: min(92vw, 420px); text-align: center; }
.overlay-box .btn { width: 100%; margin-top: 10px; }
.big-ico { font-size: 54px; }
.overlay.zoom { background: #000; padding: 0; overflow: auto; align-items: flex-start; justify-content: flex-start; }
.overlay.zoom img { width: 200%; max-width: none; }

.toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%); z-index: 40;
  background: var(--ink); color: #fff; padding: 12px 18px; border-radius: 12px; font-weight: 600; max-width: 90vw; }

.tile.wide { width: 100%; display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; padding: 16px; }
.tile.wide b { font-size: 26px; font-variant-numeric: tabular-nums; }
.ico-inline { font-size: 22px; margin-right: 6px; }
.counter { text-align: center; font-size: 84px; font-weight: 900; font-variant-numeric: tabular-nums; margin: 10px 0; }
.plus { width: 100%; height: 150px; border: 0; border-radius: 20px; background: var(--green2); color: #fff; font-size: 34px; font-weight: 900;
  box-shadow: 0 8px 20px rgba(19,102,76,.3); touch-action: manipulation; }
.plus:active { transform: scale(.98); background: var(--green); }
.row2 { display: flex; gap: 10px; margin: 14px 0; }
.row2 .btn { flex: 1; }
.install { display: flex; justify-content: space-between; align-items: center; gap: 10px; background: #e7f6ed; border-bottom: 1px solid #bfe3cf;
  padding: 10px 16px; font-weight: 600; font-size: 14px; }
.install .btn { padding: 8px 14px; }

.of { text-align: center; color: var(--muted); font-weight: 600; margin-top: -6px; }
.vprog { height: 10px; background: #e3e9e6; border-radius: 5px; margin: 10px 0 14px; overflow: hidden; }
.vprog i { display: block; height: 100%; background: var(--green2); width: 0; }
.vprog.over i { background: var(--red); }
.counter.over { color: var(--red); }
.overwarn { background: #fde8e8; color: var(--red); border: 2px solid var(--red); border-radius: 12px; padding: 12px; font-weight: 800; text-align: center; margin-bottom: 12px; }
