:root{
  --bg:#E3E6E9; --surface:#F6F7F8; --ink:#17202B; --muted:#586271; --line:#C7CDD4;
  --brand:#1C4ED8; --brand-ink:#FFFFFF; --accent:#F2B01E; --accent-ink:#1A1405;
  --ok:#17784A; --bad:#B42318; --warn:#8A5A00; --field:#FFFFFF;
  color-scheme: light;
}
@media (prefers-color-scheme: dark){
  :root:not([data-theme="light"]){
    --bg:#101419; --surface:#1A2029; --ink:#E6EAF0; --muted:#98A3B1; --line:#2D3642;
    --brand:#7196FF; --brand-ink:#0B1020; --accent:#F4BE3F; --accent-ink:#1A1405;
    --ok:#4CC38A; --bad:#FF8A7E; --warn:#E3B341; --field:#12171E;
    color-scheme: dark;
  }
}
:root{ box-sizing:border-box; padding-top:env(safe-area-inset-top,0px); padding-bottom:env(safe-area-inset-bottom,0px); }
html{ scroll-padding-top:calc(64px + env(safe-area-inset-top,0px)); }
*,*::before,*::after{ box-sizing:inherit; }
[hidden]{ display:none !important; }
body{
  margin:0; background:var(--bg); color:var(--ink);
  font-family:'Archivo', system-ui, -apple-system, 'Segoe UI', Roboto, Arial, sans-serif;
  font-size:16px; line-height:1.45; -webkit-text-size-adjust:100%;
}
img{ max-width:100%; }
a{ color:var(--brand); }

/* header */
.top{
  position:sticky; top:env(safe-area-inset-top,0px); z-index:5;
  display:flex; align-items:center; justify-content:space-between; gap:12px;
  padding:10px 16px; background:var(--bg); border-bottom:1px solid var(--line);
}
.brand{ font-weight:800; font-stretch:70%; font-size:24px; letter-spacing:.005em; line-height:1; }
.who{ background:transparent; border:1px solid var(--line); color:var(--ink); max-width:60%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }

.banner{ max-width:640px; margin:0 auto; padding:0 16px; }
.note{ display:flex; gap:10px; align-items:center; justify-content:space-between; background:var(--surface); border:1px solid var(--line); border-left:4px solid var(--warn); border-radius:10px; padding:10px 12px; font-size:14px; margin-top:12px; }
.note.info{ border-left-color:var(--brand); }
.note .acts{ display:flex; gap:6px; flex:none; }

main{ max-width:640px; margin:0 auto; padding:14px 16px calc(96px + env(safe-area-inset-bottom,0px)); }
.panel{ background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:16px; margin-bottom:14px; }
h1{ font-weight:800; font-stretch:70%; font-size:40px; line-height:1; margin:0 0 8px; }
h2{ font-size:18px; margin:0 0 12px; font-weight:700; }
h3{ font-size:15px; margin:18px 0 8px; font-weight:700; }
.head{ display:flex; justify-content:space-between; align-items:center; gap:10px; margin-bottom:4px; }
.head h2{ margin:0; }
.hint{ color:var(--muted); font-size:14px; margin:6px 0 12px; }

/* forms */
label{ display:block; font-size:14px; color:var(--muted); margin-bottom:12px; font-weight:500; }
input,select,textarea{
  display:block; width:100%; margin-top:4px; font:inherit; font-size:16px; color:var(--ink);
  background:var(--field); border:1px solid var(--line); border-radius:8px; padding:10px 12px; min-height:44px;
}
textarea{ resize:vertical; }
input.auto{ border-style:dashed; }
:focus-visible{ outline:2px solid var(--brand); outline-offset:2px; }
.row2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }
.row3{ display:grid; grid-template-columns:1fr 1fr 1fr; gap:10px; }
@media (max-width:360px){ .row2,.row3{ grid-template-columns:1fr; } }

/* buttons */
button,.btn{
  font:inherit; cursor:pointer; min-height:44px; border-radius:10px; padding:10px 14px;
  border:1px solid transparent; font-weight:600; text-decoration:none;
  display:inline-flex; align-items:center; justify-content:center; gap:6px;
}
button:disabled{ opacity:.6; cursor:default; }
.primary{ background:var(--brand); color:var(--brand-ink); }
.ghost{ background:transparent; color:var(--ink); border-color:var(--line); }
.wide{ width:100%; }
.big{ min-height:56px; font-size:17px; }
.sm{ min-height:38px; padding:6px 12px; font-size:14px; }
.ok{ background:var(--ok); color:#fff; }
.bad{ background:transparent; color:var(--bad); border-color:var(--bad); }
.linkbtn{ background:none; border:0; color:var(--brand); padding:0; min-height:0; font-weight:600; text-decoration:underline; }
.seg{ display:inline-flex; border:1px solid var(--line); border-radius:10px; overflow:hidden; }
.seg button{ border-radius:0; min-height:36px; padding:4px 12px; background:transparent; color:var(--muted); font-size:14px; }
.seg button[aria-pressed="true"]{ background:var(--ink); color:var(--bg); }

/* measurements */
.mrow{ display:grid; grid-template-columns:18px 1fr 14px 1fr 44px; align-items:end; gap:6px; margin-bottom:8px; }
.drow{ grid-template-columns:1fr 14px 1fr 64px 44px; }
.mrow label{ margin-bottom:0; font-size:13px; }
.x,.idx{ padding-bottom:12px; color:var(--muted); text-align:center; font-variant-numeric:tabular-nums; }
.rm{ min-height:44px; width:44px; padding:0; background:transparent; border:1px solid var(--line); color:var(--muted); font-size:15px; }
.plate{ margin-top:18px; background:var(--accent); color:var(--accent-ink); border-radius:4px; padding:16px 18px 14px; box-shadow:inset 0 0 0 3px rgba(26,20,5,.14); }
.plate-num{ font-weight:800; font-stretch:62%; font-size:clamp(60px,19vw,92px); line-height:.9; font-variant-numeric:tabular-nums; letter-spacing:-.01em; }
.plate-unit{ font-weight:700; font-size:17px; margin-top:4px; }
.plate-sub{ font-size:14px; opacity:.82; margin-top:2px; font-variant-numeric:tabular-nums; }
.report-plate{ margin:0 0 14px; }

/* location */
.gps{ display:flex; align-items:center; gap:10px; border:1px solid var(--line); border-radius:10px; padding:8px 8px 8px 12px; margin-bottom:10px; font-size:14px; }
.gps .gtext{ flex:1; font-variant-numeric:tabular-nums; }
.dot{ width:10px; height:10px; border-radius:50%; background:var(--muted); flex:none; }
.gps.good .dot{ background:var(--ok); } .gps.fair .dot{ background:var(--accent); }
.gps.poor .dot,.gps.bad .dot{ background:var(--bad); }
.gps.wait .dot{ animation:pulse 1.2s ease-in-out infinite; }
@keyframes pulse{ 50%{ opacity:.25; } }
@media (prefers-reduced-motion:reduce){ .gps.wait .dot{ animation:none; } }
.geo{ margin-bottom:12px; font-size:14px; }
.geo .addr{ margin:0 0 8px; }
.geo .muted{ color:var(--muted); }
.places{ display:flex; flex-wrap:wrap; gap:8px; }
.place{ min-height:38px; padding:6px 12px; border-radius:999px; background:var(--field); border:1px solid var(--line); color:var(--ink); font-size:14px; font-weight:500; text-align:left; }
.place small{ color:var(--muted); margin-left:4px; }
.place[aria-pressed="true"]{ border-color:var(--brand); box-shadow:inset 0 0 0 1px var(--brand); }

.thumbs{ display:grid; grid-template-columns:repeat(2,1fr); gap:8px; margin-bottom:12px; }
.thumbs figure{ margin:0; position:relative; aspect-ratio:16/9; border-radius:8px; overflow:hidden; background:var(--bg); }
.thumbs img{ width:100%; height:100%; object-fit:cover; display:block; }
.thumbs .rm{ position:absolute; top:4px; right:4px; width:32px; min-height:32px; background:rgba(0,0,0,.6); color:#fff; border:0; border-radius:50%; }
.thumbs figcaption{ position:absolute; left:0; right:0; bottom:0; background:var(--bad); color:#fff; font-size:11px; padding:2px 6px; }

/* walls list */
.chips{ display:flex; gap:8px; overflow-x:auto; padding-bottom:4px; margin-bottom:12px; }
.chip{ min-height:38px; padding:6px 12px; background:var(--surface); color:var(--ink); border:1px solid var(--line); border-radius:999px; font-size:14px; white-space:nowrap; }
.chip[aria-pressed="true"]{ background:var(--ink); color:var(--bg); border-color:var(--ink); }
.chip span{ opacity:.7; font-variant-numeric:tabular-nums; }
.card{ background:var(--surface); border:1px solid var(--line); border-radius:14px; padding:12px; margin-bottom:12px; }
.card-top{ display:grid; grid-template-columns:104px 1fr; gap:12px; }
.card-top img,.noimg{ width:104px; height:80px; object-fit:cover; border-radius:8px; display:flex; align-items:center; justify-content:center; background:var(--bg); color:var(--muted); font-size:12px; }
.card-title{ font-weight:700; font-size:16px; line-height:1.25; }
.card-meta{ color:var(--muted); font-size:13px; }
.card-sft{ font-weight:800; font-stretch:70%; font-size:28px; line-height:1.1; font-variant-numeric:tabular-nums; }
.card-sft small{ font-size:14px; font-weight:600; font-stretch:100%; color:var(--muted); }
.pill{ display:inline-block; font-size:12px; font-weight:700; padding:2px 8px; border-radius:999px; border:1px solid currentColor; }
.pill.pending{ color:var(--warn); } .pill.approved{ color:var(--ok); } .pill.rejected{ color:var(--bad); } .pill.queued{ color:var(--brand); }
.flags{ display:flex; flex-wrap:wrap; gap:6px; margin-top:10px; }
.flags span{ font-size:12px; color:var(--bad); border:1px dashed var(--bad); border-radius:6px; padding:2px 6px; }
details{ margin-top:10px; border-top:1px solid var(--line); padding-top:6px; }
summary{ cursor:pointer; font-size:14px; font-weight:600; padding:6px 0; }
dl{ display:grid; grid-template-columns:auto 1fr; gap:4px 12px; font-size:14px; margin:6px 0; }
dt{ color:var(--muted); } dd{ margin:0; overflow-wrap:anywhere; }
.gallery{ display:flex; gap:8px; overflow-x:auto; margin-top:8px; }
.gallery img{ height:120px; border-radius:8px; }
.card-actions{ display:flex; flex-wrap:wrap; gap:8px; margin-top:12px; }
.empty{ text-align:center; padding:32px 16px; color:var(--muted); }
.empty p{ margin:0 0 14px; }

/* report */
.tablewrap{ overflow-x:auto; }
table{ width:100%; border-collapse:collapse; font-size:15px; font-variant-numeric:tabular-nums; }
th,td{ text-align:left; padding:8px 6px; border-bottom:1px solid var(--line); }
th{ color:var(--muted); font-weight:600; font-size:13px; }
td.n,th.n{ text-align:right; }
tfoot td{ font-weight:700; border-bottom:0; }
.conclusion{ margin:0; line-height:1.55; }
.actions2{ display:grid; grid-template-columns:1fr 1fr; gap:10px; }

/* bottom tabs */
.tabs{
  position:fixed; left:0; right:0; bottom:0; z-index:6; display:grid;
  background:var(--surface); border-top:1px solid var(--line); padding-bottom:env(safe-area-inset-bottom,0px);
}
.tabs button{ border-radius:0; background:transparent; color:var(--muted); min-height:60px; font-size:15px; border-top:3px solid transparent; }
.tabs button[aria-current="page"]{ color:var(--ink); border-top-color:var(--brand); }

/* sign-in and open-in-browser screens */
.gate{ min-height:100%; display:flex; align-items:center; justify-content:center; padding:24px 16px; }
.gate-box{ width:100%; max-width:420px; }
.gate-box .panel{ margin-top:18px; }
.gate .err{ color:var(--bad); font-size:14px; margin:0 0 12px; }
.linkbox{ font-size:14px; word-break:break-all; background:var(--field); border:1px solid var(--line); border-radius:8px; padding:10px 12px; margin:8px 0 12px; }
ol.steps{ padding-left:20px; margin:0 0 16px; }
ol.steps li{ margin-bottom:8px; }

/* modal, toast */
.modal{ position:fixed; inset:0; z-index:20; background:rgba(0,0,0,.45); display:flex; align-items:flex-end; justify-content:center; padding:16px; padding-bottom:calc(16px + env(safe-area-inset-bottom,0px)); }
.sheet{ background:var(--surface); color:var(--ink); border-radius:16px; padding:18px; width:100%; max-width:480px; max-height:85vh; overflow:auto; }
.sheet p{ margin:0 0 16px; }
.toast{ position:fixed; left:50%; transform:translateX(-50%); bottom:calc(76px + env(safe-area-inset-bottom,0px)); z-index:30; background:var(--ink); color:var(--bg); padding:10px 16px; border-radius:10px; font-size:14px; max-width:calc(100% - 32px); opacity:0; pointer-events:none; transition:opacity .2s; }
.toast.show{ opacity:1; }

/* camera */
.cam{ position:fixed; inset:0; z-index:40; background:#000; display:flex; flex-direction:column; }
.cam-view{ position:relative; flex:1; min-height:0; }
.cam video{ position:absolute; inset:0; width:100%; height:100%; object-fit:contain; background:#000; }
.cam-turn{ position:absolute; inset:0; display:flex; flex-direction:column; align-items:center; justify-content:center; gap:8px; padding:24px; text-align:center; color:#fff; background:rgba(0,0,0,.55); font-size:15px; }
.cam-turn strong{ font-size:22px; }
.cam-note{ position:absolute; left:50%; top:12px; transform:translateX(-50%); background:rgba(0,0,0,.65); color:#fff; font-size:13px; padding:6px 12px; border-radius:999px; white-space:nowrap; }
.shutter:disabled{ opacity:.35; }
.cam-bar{ display:flex; align-items:center; justify-content:space-between; gap:12px; padding:16px 20px; padding-bottom:calc(16px + env(safe-area-inset-bottom,0px)); background:#000; }
.cam-bar .ghost{ color:#fff; border-color:#555; }
.cam-spacer{ width:80px; }
.shutter{ width:72px; height:72px; border-radius:50%; background:#fff; border:5px solid #888; padding:0; }
.cam-gps{ color:#ddd; font-size:13px; padding:10px 16px; padding-top:calc(10px + env(safe-area-inset-top,0px)); background:#000; }
.sr{ position:absolute; width:1px; height:1px; overflow:hidden; clip:rect(0 0 0 0); }
