:root {
  /* Geotechnics brand: deep purple #23113E, red #E6223F (from geotechnics.co.uk) */
  --brand: #23113e;
  --brand-red: #e6223f;
  --bg: #150a26;
  --panel: #23113e;
  --line: #3d2b5c;
  --text: #f4f2f8;
  --muted: #b3a9c6;
  --accent: #e6223f;
  --on-accent: #ffffff;
  --ok: #3ccf6e;
  --bad: #ff7a6e;
  --warn: #f2c94c;
  --r: 10px;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--text);
  font: 17px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; }
body { min-height: 100vh; padding-bottom: env(safe-area-inset-bottom); }
[hidden] { display: none !important; }

.topbar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 10px;
  padding: 10px 14px 14px; padding-top: calc(10px + env(safe-area-inset-top));
  background: var(--brand); }
/* red "shard" stripe, like the Geotechnics website footer */
.topbar::after { content: ""; position: absolute; left: 0; right: 0; bottom: 0; height: 5px;
  background: repeating-linear-gradient(-55deg, var(--brand-red) 0 10px, transparent 10px 18px); }
.topbar h1 { font-size: 19px; margin: 0; flex: 1; line-height: 1.15; }
.brand-name { display: block; font-size: 11px; font-weight: 600; letter-spacing: .22em; color: var(--muted); text-transform: uppercase; }
.net { font-size: 13px; padding: 3px 9px; border-radius: 99px; background: #3a2222; color: #ffb0a8; }
.net.on { background: #1d3a26; color: #9ff0b8; }
.icon-btn { background: none; border: 0; color: var(--text); font-size: 26px; padding: 0 6px; }

.screen { padding: 16px; max-width: 760px; margin: 0 auto; }
h2 { font-size: 16px; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin: 22px 0 8px; }
.muted { color: var(--muted); }
.hint { color: var(--muted); display: block; margin-top: 4px; }
.hint.ok { color: var(--ok); } .hint.bad { color: var(--bad); }

button { font: inherit; color: var(--text); background: var(--panel); border: 1px solid var(--line);
  border-radius: var(--r); cursor: pointer; }
button:active { transform: scale(.98); }
button.big { width: 100%; min-height: 58px; padding: 12px 16px; font-weight: 600; margin: 6px 0; }
button.small { min-height: 48px; padding: 8px 14px; }
button.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
button.danger { color: var(--bad); background: transparent; }
button:disabled { opacity: .45; }
.link-btn { display: block; margin: 8px auto 0; background: none; border: 0; color: var(--muted);
  text-decoration: underline; padding: 10px; }
.badge { display: inline-block; min-width: 24px; padding: 1px 7px; border-radius: 99px;
  background: #00000040; font-size: 14px; }

.row-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.row-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 8px; }
.inline { display: flex; gap: 8px; }
.inline input { flex: 1; }

label { display: block; margin: 14px 0; font-weight: 600; }
input { display: block; width: 100%; margin-top: 6px; min-height: 52px; padding: 10px 12px;
  font: inherit; color: var(--text); background: #0e061a; border: 1px solid var(--line); border-radius: var(--r); }
input:focus { outline: 2px solid #ffffffaa; border-color: transparent; }
input.invalid { border-color: var(--bad); }
fieldset { border: 0; padding: 0; margin: 14px 0; }
legend { font-weight: 600; margin-bottom: 6px; }
.seg { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.seg.wrap { grid-template-columns: repeat(4, 1fr); }
.seg.col { grid-template-columns: 1fr; }
.seg button { min-height: 52px; padding: 8px; font-weight: 600; }
.seg button.on { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.form-errors { background: #3a2222; color: #ffd0cb; padding: 10px 12px; border-radius: var(--r); }

.demo-banner { margin: 10px 0; padding: 10px 12px; border-radius: var(--r);
  background: #3b3216; color: #f6e3a8; font-size: 15px; }

.item-list { list-style: none; margin: 0; padding: 0; }
.item-list li { display: flex; gap: 12px; align-items: center; padding: 10px; margin: 8px 0;
  background: var(--panel); border: 1px solid var(--line); border-radius: var(--r); }
.item-list img { width: 72px; height: 54px; object-fit: cover; border-radius: 8px; background: #000; }
.item-list .meta { flex: 1; min-width: 0; }
.item-list .meta b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.item-list .meta span { color: var(--muted); font-size: 14px; }
.status { font-size: 13px; padding: 3px 8px; border-radius: 99px; background: #3d2b5c; white-space: nowrap; }
.status.queued { background: #3b3216; color: #f6e3a8; }
.status.uploaded { background: #1d3a26; color: #9ff0b8; }
.status.failed { background: #3a2222; color: #ffb0a8; }

/* Camera */
.screen.camera { padding: 0; max-width: none; }
.viewfinder { position: relative; width: 100%; height: calc(100vh - 330px); height: calc(100dvh - 330px); min-height: 300px; background: #000; overflow: hidden; }
.viewfinder video { width: 100%; height: 100%; object-fit: contain; display: block; }
.guide { position: absolute; border: 3px dashed #ffffffcc; border-radius: 6px;
  box-shadow: 0 0 0 9999px #00000055; transition: border-color .2s; pointer-events: none; }
.guide.ok { border-color: var(--ok); border-style: solid; }
.guide-label { position: absolute; top: -30px; left: 0; font-size: 14px; background: #000a; padding: 2px 8px; border-radius: 6px; }
.rotate-hint { position: absolute; inset: auto 0 16px 0; margin: auto; width: max-content; padding: 8px 14px;
  background: var(--warn); color: #222; font-weight: 700; border-radius: 99px; }
.checks { display: grid; grid-template-columns: repeat(4, 1fr); gap: 6px; padding: 8px 10px 0; }
.chk { display: flex; align-items: center; gap: 6px; justify-content: center; padding: 8px 4px;
  background: var(--panel); border-radius: 10px; font-size: 14px; font-weight: 600; }
.chk i { width: 12px; height: 12px; border-radius: 50%; background: #666; }
.chk.ok i { background: var(--ok); } .chk.bad i { background: var(--bad); } .chk.na { opacity: .45; }
.live-tip { min-height: 44px; padding: 8px 14px; text-align: center; color: var(--warn); font-weight: 600; }
.live-tip.ok { color: var(--ok); }
.cam-controls { display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 12px; padding: 0 16px; }
.cam-controls .small:first-child { justify-self: start; }
.cam-controls .small:last-child { justify-self: end; }
.invisible { visibility: hidden; }
.shutter { width: 78px; height: 78px; border-radius: 50%; background: #fff; border: 6px solid #9aa6b2; }
.shutter.ready { border-color: var(--ok); }
.shutter { box-shadow: 0 0 0 3px var(--brand-red); }
.shutter.override { border-color: var(--warn); }

.sheet { position: fixed; left: 0; right: 0; bottom: 0; z-index: 20; padding: 18px 16px calc(18px + env(safe-area-inset-bottom));
  background: var(--panel); border-top: 1px solid var(--line); border-radius: 18px 18px 0 0;
  box-shadow: 0 -10px 40px #000a; max-width: 760px; margin: 0 auto; }
.sheet h3 { margin: 0 0 8px; }
.sheet ul { padding-left: 18px; }
.sheet li { margin: 8px 0; }
.sheet li b { color: var(--bad); }

/* Review */
.item-head { font-weight: 700; font-size: 18px; margin: 0 0 4px; }
.shots { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; }
.shot { position: relative; border: 3px solid transparent; border-radius: 10px; overflow: hidden; padding: 0; background: #000; }
.shot img { width: 100%; aspect-ratio: 4/3; object-fit: cover; display: block; }
.shot.sel { border-color: var(--accent); }
.shot .score { position: absolute; left: 4px; bottom: 4px; font-size: 12px; background: #000b; padding: 1px 6px; border-radius: 6px; }
.shot .star { position: absolute; right: 6px; top: 2px; color: var(--accent); font-size: 20px; text-shadow: 0 0 4px #000; }
.shot .ovr { position: absolute; left: 4px; top: 4px; font-size: 11px; background: var(--warn); color: #222; padding: 0 5px; border-radius: 5px; }
.preview-wrap { margin: 12px 0; background: #000; border-radius: var(--r); overflow: hidden; text-align: center; }
.preview-wrap img { max-width: 100%; max-height: 50vh; display: block; margin: 0 auto; }
.checklist { list-style: none; padding: 0; margin: 0; }
.checklist li { padding: 10px 12px; margin: 6px 0; border-radius: 10px; background: var(--panel); border-left: 5px solid #666; }
.checklist li.pass { border-left-color: var(--ok); }
.checklist li.fail { border-left-color: var(--bad); }
.checklist li.warn { border-left-color: var(--warn); }
.checklist li.wait { border-left-color: #5b7ea8; }
.checklist li small { display: block; color: var(--muted); }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 30;
  background: #000e; padding: 12px 18px; border-radius: 99px; max-width: 90vw; text-align: center; }

@media (min-width: 700px) {
  .viewfinder { height: calc(100dvh - 320px); }
}
