/* View360 — construction site monitoring UI */
:root {
  --bg: #f3f4f6;
  --surface: #ffffff;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #5a6675;          /* 5.0:1 on white; #64748b measured 4.3:1 at 12px */
  --line: #e2e8f0;
  --line-2: #cbd5e1;
  --brand: #0b1220;
  --brand-2: #16213a;
  --accent: #ea580c;
  --accent-2: #c2410c;
  --accent-soft: #fff1e8;
  --blue: #2563eb;
  --blue-soft: #e8efff;
  --green: #15803d;
  --red: #dc2626;
  --radius: 10px;
  --shadow: 0 1px 2px rgba(15, 23, 42, 0.06), 0 4px 16px rgba(15, 23, 42, 0.08);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "Cascadia Mono", "SF Mono", Menlo, Consolas, monospace;
  --header-h: 60px;
  --nav-h: 46px;
}
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; }
body {
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  font-size: 15px;
  line-height: 1.45;
}
a { color: var(--blue); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 700; letter-spacing: -0.01em; }
h1 { font-size: 22px; }
h2 { font-size: 18px; }
h3 { font-size: 15px; }
p { margin: 0 0 10px; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.mono { font-family: var(--mono); }
.hidden { display: none !important; }
.nowrap { white-space: nowrap; }
.right { text-align: right; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.grow { flex: 1; }
.stack { display: flex; flex-direction: column; gap: 10px; }

/* ---------- buttons ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 9px 14px; border-radius: 8px; border: 1px solid var(--line-2);
  background: var(--surface); color: var(--ink); font: inherit; font-weight: 600; font-size: 14px;
  cursor: pointer; text-decoration: none; white-space: nowrap; line-height: 1.2;
  transition: background 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.btn:hover { background: #f8fafc; border-color: #94a3b8; text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: default; }
.btn-primary { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn-primary:hover { background: var(--accent-2); border-color: var(--accent-2); }
.btn-dark { background: var(--brand); border-color: var(--brand); color: #fff; }
.btn-dark:hover { background: var(--brand-2); border-color: var(--brand-2); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: rgba(15, 23, 42, 0.06); border-color: transparent; }
.btn-danger { color: var(--red); }
.btn-danger:hover { background: #fef2f2; border-color: #fca5a5; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-xs { padding: 3px 8px; font-size: 12px; }
.btn-lg { padding: 12px 20px; font-size: 15px; }
.btn-block { width: 100%; }
.btn svg { width: 18px; height: 18px; flex: none; }

/* ---------- forms ---------- */
.field { display: flex; flex-direction: column; gap: 5px; }
.field label, label.lbl { font-size: 12px; font-weight: 600; color: var(--ink-2); text-transform: uppercase; letter-spacing: 0.04em; }
/* The background is a TOKEN, not a literal white.
 *
 * The workspace rails remap --ink, --line and the rest so that every component app.css defines
 * lands correctly on a dark panel. That remap could not reach this rule, because the text colour
 * was a token and the background was the constant `#fff` — so in a dark rail every dropdown became
 * #e6e9ee text on #ffffff, a contrast ratio of 1.22, which is text you cannot see at all. Ten
 * controls in the 3D panel were in that state. */
.input, select.input, textarea.input {
  font: inherit; font-size: 14px; padding: 9px 11px; border: 1px solid var(--line-2); border-radius: 8px;
  background: var(--input-bg, #fff); color: var(--ink); width: 100%;
}
.input:focus { outline: 2px solid rgba(37, 99, 235, 0.35); border-color: var(--blue); }
textarea.input { min-height: 80px; resize: vertical; }
.input-sm { padding: 6px 9px; font-size: 13px; }
.help { font-size: 12px; color: var(--muted); }
.checkbox { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; cursor: pointer; }

/* ---------- surfaces ---------- */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04); }
.card-body { padding: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.card-head h2, .card-head h3 { display: flex; align-items: center; gap: 8px; }
.badge { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11.5px; font-weight: 700; letter-spacing: 0.02em; background: #eef2f7; color: var(--ink-2); text-transform: uppercase; }
.badge-accent { background: var(--accent-soft); color: var(--accent-2); }
.badge-blue { background: var(--blue-soft); color: var(--blue); }
.badge-green { background: #dcfce7; color: var(--green); }
.badge-red { background: #fee2e2; color: var(--red); }
.badge-gray { background: #f1f5f9; color: var(--muted); }
.empty { padding: 32px; text-align: center; color: var(--muted); border: 1px dashed var(--line-2); border-radius: var(--radius); background: #fafbfc; }
.divider { height: 1px; background: var(--line); margin: 12px 0; }
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%); z-index: 9999;
  background: var(--brand); color: #fff; padding: 10px 16px; border-radius: 8px; box-shadow: var(--shadow); font-size: 14px;
  opacity: 0; pointer-events: none; transition: opacity 0.2s;
}
.toast.show { opacity: 1; }
.toast.err { background: var(--red); }

/* ---------- app shell ---------- */
.app { display: flex; flex-direction: column; height: 100dvh; min-height: 100vh; }
.topbar {
  height: var(--header-h); flex: none; background: var(--brand); color: #fff;
  display: flex; align-items: center; gap: 16px; padding: 0 18px;
}
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; letter-spacing: 0.02em; font-size: 15px; color: #fff; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-mark { width: 28px; height: 28px; border-radius: 7px; background: var(--accent); display: grid; place-items: center; }
.brand-mark svg { width: 16px; height: 16px; }
.topbar .sep { width: 1px; height: 28px; background: rgba(255, 255, 255, 0.15); }
.proj-title { min-width: 0; flex: 1; }
.proj-title h1 { font-size: 16px; line-height: 1.2; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.proj-title .addr { font-size: 12.5px; color: rgba(255, 255, 255, 0.65); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.topbar .meta { font-size: 12.5px; color: rgba(255, 255, 255, 0.7); text-align: right; line-height: 1.3; }
.topbar .meta b { color: #fff; font-weight: 600; display: block; }
.topbar select.input { width: auto; background: rgba(255, 255, 255, 0.08); color: #fff; border-color: rgba(255, 255, 255, 0.2); font-weight: 600; }
.topbar select.input option { color: var(--ink); }
.mainnav { height: var(--nav-h); flex: none; display: flex; background: var(--surface); border-bottom: 1px solid var(--line); padding: 0 18px; gap: 4px; }
.mainnav a {
  display: inline-flex; align-items: center; gap: 8px; padding: 0 14px; font-size: 13px; font-weight: 700; letter-spacing: 0.06em;
  color: var(--muted); text-decoration: none; border-bottom: 3px solid transparent; margin-bottom: -1px; text-transform: uppercase;
}
.mainnav a svg { width: 16px; height: 16px; }
.mainnav a:hover { color: var(--ink); }
.mainnav a.active { color: var(--ink); border-bottom-color: var(--accent); }
.view { flex: 1; position: relative; min-height: 0; }
.panel { position: absolute; inset: 0; display: none; }
.panel.active { display: block; }
.panel.scroll { overflow-y: auto; -webkit-overflow-scrolling: touch; }
.container { max-width: 1100px; margin: 0 auto; padding: 22px 18px 48px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.page-head p { color: var(--muted); margin: 4px 0 0; }

/* ---------- map ---------- */
.map-wrap { position: absolute; inset: 0; background: #d9dde3; }
.map { position: absolute; inset: 0; background: #d9dde3; }
.leaflet-container { font-family: var(--font); }
.map-overlay-status {
  position: absolute; inset: 0; display: grid; place-items: center; z-index: 500; text-align: center; padding: 24px;
  color: var(--muted); background: repeating-linear-gradient(45deg, #e9ecf0 0 12px, #e2e6eb 12px 24px);
}
.map-overlay-status .card { padding: 22px 26px; max-width: 380px; }
.map-info {
  position: absolute; left: 10px; bottom: 10px; z-index: 800; background: rgba(255, 255, 255, 0.92); backdrop-filter: blur(6px);
  border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; font-size: 12.5px; color: var(--ink-2); box-shadow: var(--shadow); max-width: 70%;
}
.map-info b { color: var(--ink); }
.leaflet-bar a { color: var(--ink); }
.pano-marker {
  width: 24px; height: 24px; border-radius: 50%; background: var(--accent); color: #fff; border: 2px solid #fff;
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.45); display: grid; place-items: center; font-size: 11px; font-weight: 800; cursor: pointer;
  transition: transform 0.1s;
}
.pano-marker:hover { transform: scale(1.15); }
.pano-marker.active { background: var(--blue); width: 30px; height: 30px; font-size: 12px; box-shadow: 0 0 0 4px rgba(37, 99, 235, 0.35), 0 1px 4px rgba(0, 0, 0, 0.45); }
.pano-marker.unplaced { background: #94a3b8; }
.leaflet-marker-icon.pano-icon { background: transparent; border: 0; }
.pano-cone { pointer-events: none; }

/* measure control */
.leaflet-control-measure a { display: grid; place-items: center; }
.leaflet-control-measure a svg { width: 17px; height: 17px; }
.leaflet-control-measure a.active { background: var(--accent); color: #fff; }
.measure-panel {
  position: absolute; top: 10px; left: 50%; transform: translateX(-50%); z-index: 900;
  background: var(--brand); color: #fff; border-radius: 10px; padding: 10px 12px; display: none; box-shadow: var(--shadow);
  min-width: 260px; max-width: calc(100% - 100px); font-size: 13px;
}
.measure-panel.show { display: block; }
.measure-panel .mp-title { font-weight: 700; font-size: 12px; text-transform: uppercase; letter-spacing: 0.06em; color: rgba(255, 255, 255, 0.7); }
.measure-panel .mp-value { font-size: 16px; font-weight: 700; margin: 4px 0 6px; font-family: var(--mono); }
.measure-panel .mp-hint { color: rgba(255, 255, 255, 0.7); font-size: 12px; }
.measure-panel .row { margin-top: 8px; }
.measure-panel .btn { padding: 5px 10px; font-size: 12px; }
.measure-label { background: var(--brand); color: #fff; border: 0; border-radius: 6px; padding: 4px 8px; font-weight: 700; font-family: var(--mono); font-size: 12px; box-shadow: var(--shadow); }
.measure-label::before { display: none; }
.measure-seg { background: rgba(255, 255, 255, 0.92); color: var(--ink); border: 1px solid var(--line-2); border-radius: 4px; padding: 1px 5px; font-family: var(--mono); font-size: 11px; box-shadow: none; }
.measure-seg::before { display: none; }
.leaflet-container.measuring { cursor: crosshair; }

/* ---------- 360 tour ---------- */
.tour-wrap { position: absolute; inset: 0; background: #111; }
.tour-viewer { position: absolute; inset: 0; }
.tour-hud {
  position: absolute; top: 12px; left: 12px; z-index: 50; background: rgba(11, 18, 32, 0.85); color: #fff; backdrop-filter: blur(6px);
  border-radius: 10px; padding: 10px 14px; max-width: calc(100% - 24px); box-shadow: var(--shadow);
}
.tour-hud .t-title { font-weight: 700; font-size: 15px; }
.tour-hud .t-sub { font-size: 12.5px; color: rgba(255, 255, 255, 0.7); }
.tour-nav { position: absolute; left: 50%; bottom: 62px; transform: translateX(-50%); z-index: 50; display: flex; gap: 8px; align-items: center; }
.tour-nav .btn { background: rgba(11, 18, 32, 0.85); color: #fff; border-color: rgba(255, 255, 255, 0.15); backdrop-filter: blur(6px); }
.tour-nav .btn:hover { background: rgba(11, 18, 32, 1); }
.tour-nav .t-count { color: #fff; font-weight: 700; font-size: 13px; padding: 0 6px; background: rgba(11, 18, 32, 0.85); border-radius: 8px; height: 38px; display: flex; align-items: center; }
.tour-back { position: absolute; top: 12px; right: 12px; z-index: 50; }
.tour-back .btn { background: rgba(11, 18, 32, 0.85); color: #fff; border-color: rgba(255, 255, 255, 0.15); backdrop-filter: blur(6px); }
.minimap {
  position: absolute; right: 12px; bottom: 62px; z-index: 50; width: 260px; height: 190px; border-radius: 10px; overflow: hidden;
  border: 2px solid rgba(255, 255, 255, 0.85); box-shadow: var(--shadow); background: #d9dde3;
}
.minimap .map { inset: 0; }
.minimap-toggle { position: absolute; right: 12px; bottom: 62px; z-index: 51; display: none; }
.minimap-toggle .btn { background: rgba(11, 18, 32, 0.85); color: #fff; border-color: rgba(255, 255, 255, 0.15); }
/* An overlay message needs its own ground.
 *
 * This was transparent, which reads correctly over the empty dark viewport and badly over anything
 * else — and there IS something else whenever a scene was drawn before the message appeared: the
 * canvas keeps its last frame, so "3D needs a full browser" was landing on top of a frozen point
 * cloud. The scrim makes the message readable whatever is behind it, and the measure keeps the
 * lines short enough to read on a phone. */
.tour-empty {
  position: absolute; inset: 0; display: grid; place-items: center;
  color: #cbd5e1; text-align: center; padding: 24px;
  background: rgba(15, 21, 30, 0.9);
  backdrop-filter: blur(2px);
}
.tour-empty > div { max-width: 42ch; }
.tour-empty p { margin: 0 0 10px; line-height: 1.5; }
.tour-empty p:last-child { margin-bottom: 0; }
.psv-container { font-family: var(--font); }
.psv-navbar { background: rgba(11, 18, 32, 0.85); }

/* ---------- history ---------- */
.timeline { display: flex; gap: 8px; overflow-x: auto; padding: 4px 2px 10px; scrollbar-width: thin; }
.timeline .chip {
  flex: none; display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 10px 16px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--line); cursor: pointer; min-width: 110px; font-weight: 600; transition: all 0.12s;
}
.timeline .chip .d { font-size: 15px; }
.timeline .chip .y { font-size: 11px; color: var(--muted); font-weight: 500; }
.timeline .chip:hover { border-color: var(--line-2); }
.timeline .chip.active { background: var(--brand); border-color: var(--brand); color: #fff; }
.timeline .chip.active .y { color: rgba(255, 255, 255, 0.65); }
.timeline .chip.latest::after { content: "LATEST"; font-size: 9px; letter-spacing: 0.08em; color: var(--accent); font-weight: 800; }
.timeline .chip.active.latest::after { color: #fdba74; }
.visit-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; margin-top: 8px; }
.visit-preview { position: relative; display: block; border-radius: var(--radius); overflow: hidden; background: #d9dde3; min-height: 260px; border: 1px solid var(--line); }
.visit-preview img { width: 100%; height: 100%; object-fit: cover; display: block; aspect-ratio: 4 / 3; }
.visit-preview .ph { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); }
.visit-preview .cta { position: absolute; left: 12px; bottom: 12px; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.stat { background: #f8fafc; border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; }
.stat .v { font-size: 20px; font-weight: 800; }
.stat .l { font-size: 11.5px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.05em; font-weight: 600; }
.photo-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 8px; }
.photo-grid a, .photo-grid .ph-item { position: relative; display: block; aspect-ratio: 4 / 3; border-radius: 8px; overflow: hidden; background: #e2e8f0; border: 1px solid var(--line); }
.photo-grid img { width: 100%; height: 100%; object-fit: cover; display: block; }
.photo-grid .cap { position: absolute; left: 0; right: 0; bottom: 0; padding: 4px 8px; font-size: 11px; background: rgba(0, 0, 0, 0.55); color: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pano-strip { display: flex; gap: 8px; overflow-x: auto; padding-bottom: 6px; }
.pano-strip a { flex: none; width: 170px; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); background: #e2e8f0; position: relative; }
.pano-strip img { width: 100%; height: 85px; object-fit: cover; display: block; }
.pano-strip .n { position: absolute; left: 6px; top: 6px; }
.pano-strip .cap { padding: 5px 8px; font-size: 12px; font-weight: 600; color: var(--ink); background: #fff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* compare */
.compare { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; height: calc(100dvh - var(--header-h) - var(--nav-h) - 130px); min-height: 380px; }
.compare .pane { position: relative; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #d9dde3; }
.compare .pane .map { inset: 0; }
.compare .pane-head { position: absolute; top: 8px; right: 8px; z-index: 800; display: flex; gap: 6px; align-items: center; }
.compare .pane-head select { width: auto; background: rgba(255, 255, 255, 0.95); font-weight: 600; }
.compare-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 10px; flex-wrap: wrap; }

/* ---------- downloads ---------- */
.dl-group { margin-bottom: 20px; }
.dl-group h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.file-list { display: flex; flex-direction: column; }
.file-row { display: flex; align-items: center; gap: 12px; padding: 11px 16px; border-top: 1px solid var(--line); }
.file-row:first-child { border-top: 0; }
.file-row .f-icon { width: 36px; height: 36px; border-radius: 8px; background: var(--accent-soft); color: var(--accent-2); display: grid; place-items: center; flex: none; }
.file-row .f-icon svg { width: 18px; height: 18px; }
.file-row .f-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.file-row .f-meta { font-size: 12px; color: var(--muted); }
.file-row .f-main { flex: 1; min-width: 0; }

/* ---------- lightbox / modal ---------- */
.lightbox { position: fixed; inset: 0; z-index: 5000; background: rgba(0, 0, 0, 0.92); display: none; align-items: center; justify-content: center; }
.lightbox.show { display: flex; }
.lightbox img { max-width: 96vw; max-height: 88vh; object-fit: contain; box-shadow: 0 8px 40px rgba(0, 0, 0, 0.6); }
.lightbox .lb-cap { position: absolute; bottom: 14px; left: 0; right: 0; text-align: center; color: #fff; font-size: 13px; }
.lightbox .lb-btn { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(255, 255, 255, 0.12); color: #fff; border: 0; width: 44px; height: 44px; border-radius: 50%; font-size: 22px; cursor: pointer; }
.lightbox .lb-prev { left: 14px; }
.lightbox .lb-next { right: 14px; }
.lightbox .lb-close { position: absolute; top: 12px; right: 14px; background: rgba(255, 255, 255, 0.12); color: #fff; border: 0; width: 40px; height: 40px; border-radius: 50%; font-size: 20px; cursor: pointer; }
.modal-bg { position: fixed; inset: 0; z-index: 4000; background: rgba(15, 23, 42, 0.55); display: none; align-items: center; justify-content: center; padding: 16px; }
.modal-bg.show { display: flex; }
.modal { background: var(--surface); border-radius: 12px; width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35); max-height: 92vh; overflow: auto; }
.modal.wide { max-width: 1000px; }
.modal .card-head { position: sticky; top: 0; background: var(--surface); z-index: 1; }
.modal-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 12px 16px; border-top: 1px solid var(--line); }

/* ---------- login / index ---------- */
.center-page { min-height: 100dvh; display: grid; place-items: center; padding: 20px; background: var(--brand); }
.login-card { width: 100%; max-width: 380px; padding: 28px; }
.login-card .brand { color: var(--ink); margin-bottom: 18px; }

/* ---------- admin ---------- */
.admin-shell { display: grid; grid-template-columns: 280px 1fr; min-height: calc(100dvh - var(--header-h)); }
.admin-side { background: var(--surface); border-right: 1px solid var(--line); padding: 14px; overflow-y: auto; }
.admin-main { padding: 20px 24px 60px; overflow-y: auto; }
.proj-list a { display: block; padding: 10px 12px; border-radius: 8px; color: var(--ink); text-decoration: none; }
.proj-list a:hover { background: #f1f5f9; }
.proj-list a.active { background: var(--brand); color: #fff; }
.proj-list a .s { font-size: 12px; opacity: 0.7; }
.visit-tabs { display: flex; gap: 6px; flex-wrap: wrap; }
.visit-tabs .chip { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--line); background: var(--surface); cursor: pointer; font-weight: 600; font-size: 13px; display: inline-flex; gap: 6px; align-items: center; }
.visit-tabs .chip.active { background: var(--brand); color: #fff; border-color: var(--brand); }
/* minmax(0,...) rather than 1fr, and min-width:0 on the card.
   A grid item defaults to min-width:auto, so ONE wide child — a table, a log box, a long path —
   sets the whole track and the track cannot shrink back. Measured on a phone before this: the
   single column computed to 1,317 px inside a 375 px screen and 320 elements sat off-screen, so
   most of the admin was simply unreachable there. */
.admin-grid { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.admin-grid > * { min-width: 0; }
.admin-grid .span2 { grid-column: 1 / -1; }
.drop {
  border: 2px dashed var(--line-2); border-radius: var(--radius); padding: 18px; text-align: center; color: var(--muted); background: #fafbfc; cursor: pointer; font-size: 13.5px;
}
.drop:hover, .drop.over { border-color: var(--accent); background: var(--accent-soft); color: var(--accent-2); }
.drop input { display: none; }
.progress { height: 6px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-top: 8px; }
.progress i { display: block; height: 100%; background: var(--accent); width: 0; transition: width 0.15s; }
.list { display: flex; flex-direction: column; gap: 6px; }
.list-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: 8px; background: #fff; }
.list-item img { width: 64px; height: 40px; object-fit: cover; border-radius: 4px; background: #e2e8f0; flex: none; }
.list-item .li-main { flex: 1; min-width: 0; }
.list-item .li-name { font-weight: 600; font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-item .li-sub { font-size: 12px; color: var(--muted); }
.list-item.placing { outline: 2px solid var(--accent); }
.admin-map { position: relative; height: 480px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); }
.admin-map .map { inset: 0; }
.share-box { display: flex; gap: 8px; align-items: center; }
.share-box .input { font-family: var(--mono); font-size: 13px; }
.kv { display: grid; grid-template-columns: auto 1fr; gap: 4px 14px; font-size: 13px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; font-weight: 600; }
.north-viewer { height: 420px; background: #000; border-radius: 8px; overflow: hidden; position: relative; }
.north-line { position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; background: var(--accent); z-index: 5; pointer-events: none; box-shadow: 0 0 6px rgba(0,0,0,.6); }

/* ---------- responsive ---------- */
@media (max-width: 860px) {
  .visit-grid { grid-template-columns: 1fr; }
  .admin-shell { grid-template-columns: 1fr; }
  .admin-side { border-right: 0; border-bottom: 1px solid var(--line); }
  .admin-grid { grid-template-columns: minmax(0, 1fr); }
  .compare { grid-template-columns: 1fr; height: auto; }
  .compare .pane { height: 320px; }
}
@media (max-width: 640px) {
  :root { --header-h: 56px; --nav-h: 50px; }
  .topbar { padding: 0 12px; gap: 10px; }
  .topbar .brand span { display: none; }
  .topbar .meta { display: none; }
  .topbar select.input { font-size: 13px; padding: 7px 8px; }
  .mainnav { padding: 0; }
  .mainnav a { flex: 1; justify-content: center; padding: 0 4px; font-size: 11.5px; letter-spacing: 0.03em; gap: 5px; }
  .mainnav a .long { display: none; }
  .container { padding: 16px 12px 40px; }
  .minimap { width: 150px; height: 120px; bottom: 60px; }
  .tour-hud { padding: 8px 10px; }
  .tour-hud .t-title { font-size: 13px; }
  .tour-nav { bottom: 60px; left: 12px; transform: none; }
  .measure-panel { top: auto; bottom: 12px; min-width: 0; width: calc(100% - 24px); }
  .map-info { display: none; }
  .stat-row { grid-template-columns: repeat(3, 1fr); }
  .stat .v { font-size: 17px; }
  /* Rows of controls wrap on a phone instead of running off the side. A <select> is as wide as
     its longest option — "Drone survey (current conditions)" set a 420 px row inside a 375 px
     screen — so the control is capped too and the option text ellipsises rather than the panel. */
  .row { flex-wrap: wrap; }
  .row > .field, .row > select, .row > input, .row > .input { max-width: 100%; min-width: 0; }
  select.input, input.input, .field { max-width: 100%; }
  .admin-main { padding: 14px 12px 60px; }
  .admin-map { height: 360px; }
}

/* ---------- 3D view ---------- */
.v3d-wrap { position: absolute; inset: 0; background: #1b2430; overflow: hidden; }
.v3d-viewport { position: absolute; inset: 0; }
.v3d-render { position: absolute; inset: 0; }
.v3d-render canvas { outline: none; }
.v3d-wrap.measuring .v3d-render { cursor: crosshair; }
.v3d-toolbar { position: absolute; top: 12px; left: 12px; z-index: 40; display: flex; flex-wrap: wrap; gap: 6px; max-width: calc(100% - 300px); }
.v3d-toolbar .btn { background: rgba(11, 18, 32, 0.88); color: #fff; border-color: rgba(255, 255, 255, 0.14); backdrop-filter: blur(6px); }
.v3d-toolbar .btn.active { background: var(--accent); border-color: var(--accent); }
.v3d-toolbar .btn:disabled { opacity: 0.4; }
.v3d-toolbar .sep { width: 1px; background: rgba(255, 255, 255, 0.2); margin: 4px 2px; }
/* ---------- view cube ---------- */
.v3d-cube-host { position: absolute; top: 54px; right: 12px; z-index: 41; filter: drop-shadow(0 4px 10px rgba(0,0,0,.45)); }
.v3d-cube { display: flex; flex-direction: column; align-items: center; gap: 4px; user-select: none; }
.v3d-cube svg { display: block; overflow: visible; }
.v3d-cube .vc-compass text {
  fill: #e2e8f0; font: 700 10px var(--font); letter-spacing: 0.06em;
  text-anchor: middle; dominant-baseline: middle; opacity: 0.85;
}
.v3d-cube .vc-compass text:first-child { fill: #fdba74; }   /* north, matching the needle */
/* The three faces are lit as a solid would be: the top catches the light, the two sides fall away
 * from it. Shading is what makes a flat isometric drawing read as a cube at 100 px. */
.v3d-cube .vc-face polygon {
  stroke: rgba(226, 232, 240, 0.32); stroke-width: 1; stroke-linejoin: round;
  transition: fill 0.14s ease, stroke 0.14s ease;
}
.v3d-cube .vc-face[data-view="top"] polygon { fill: #55647a; }
.v3d-cube .vc-face[data-view="west"] polygon { fill: #38455a; }
.v3d-cube .vc-face[data-view="south"] polygon { fill: #2a3547; }
.v3d-cube .vc-face text {
  fill: #cbd5e1; font: 700 9px var(--font); text-anchor: middle; dominant-baseline: middle;
  pointer-events: none; letter-spacing: 0.04em;
}
.v3d-cube .vc-face { cursor: pointer; }
.v3d-cube .vc-face:hover polygon { fill: var(--accent); stroke: #fdba74; }
.v3d-cube .vc-face:focus-visible { outline: none; }
.v3d-cube .vc-face:focus-visible polygon { stroke: #fff; stroke-width: 2; }
.v3d-cube .vc-face.on polygon { fill: var(--accent); stroke: #fdba74; }
.v3d-cube .vc-face.on text { fill: #fff; }
.v3d-cube .vc-face:hover text { fill: #fff; }
.v3d-cube .vc-edge polyline, .v3d-cube .vc-edge line {
  fill: none; stroke: rgba(226, 232, 240, 0.42); stroke-width: 1; pointer-events: none;
}

/* the bearing ring the cube sits in */
.v3d-cube .vc-ring circle { fill: rgba(9, 14, 24, 0.72); stroke: rgba(226, 232, 240, 0.18); stroke-width: 1; }
.v3d-cube .vc-ring line { stroke: rgba(226, 232, 240, 0.3); stroke-width: 1; }
.v3d-cube .vc-ring line.major { stroke: rgba(226, 232, 240, 0.6); stroke-width: 1.4; }
.v3d-cube .vc-needle { fill: var(--accent); }
.v3d-cube .vc-more { display: flex; gap: 3px; }
.v3d-cube .vc-btn {
  min-width: 22px; height: 20px; padding: 0 5px;
  font: 600 10.5px var(--font); color: #cbd5e1;
  background: rgba(11, 18, 32, 0.82); border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 3px; cursor: pointer;
}
.v3d-cube .vc-btn:hover { background: var(--accent); color: #fff; border-color: #fdba74; }
.v3d-cube .vc-btn.on { background: var(--accent); color: #fff; border-color: #fdba74; }
.v3d-cube .vc-fit { min-width: 30px; }

/* "Fit site" survives the pad that used to sit here. Zoom and tilt are gestures now — a pinch and
   a two-finger slide — but "I have lost the site" is not a gesture, and it is the one thing somebody
   needs a button for. */
.v3d-cube .vc-wide {
  margin-top: 4px; width: 100%; height: 26px; padding: 0 8px;
  font: 600 10.5px var(--font); color: #cbd5e1; white-space: nowrap;
  background: rgba(11, 18, 32, .86); border: 1px solid rgba(255, 255, 255, .18);
  border-radius: 4px; cursor: pointer;
}
.v3d-cube .vc-wide:hover { background: var(--accent); color: #fff; border-color: #fdba74; }
@media (max-width: 860px) { .v3d-cube-host { top: 46px; right: 8px; } .v3d-cube svg { width: 84px; height: 88px; } }
@media (max-width: 700px) {
  /* Thumb-sized, and the compass gets out of their way rather than the other way round. */
  .v3d-cube svg { width: 64px; height: 68px; }
  .v3d-cube .vc-btn { min-width: 34px; height: 30px; font-size: 12px; }
  .v3d-cube .vc-wide { height: 32px; font-size: 12px; }
}
@media (prefers-reduced-motion: reduce) { .v3d-cube .vc-face polygon { transition: none; } }

/* ---------- touch: the viewer's own controls ----------
 *
 * Keyed on `hover: none` rather than on width, because a fingertip is the actual condition and a
 * narrow window on a laptop still has a mouse. The width-keyed rules above set the compass buttons
 * to 34x30 under a comment calling them "thumb-sized"; they are not. 44 px is the size a fingertip
 * can hit without aiming, and these sit in the middle of a scene the user is dragging around, so a
 * miss does not just fail — it rotates the camera. */
@media (hover: none) {
  .v3d-cube .vc-btn { min-width: 44px; height: 44px; font-size: 14px; }
  .v3d-cube .vc-wide { height: 44px; font-size: 13px; }

  /* SAY THAT THE TOOLBAR SCROLLS.
   *
   * On a phone it is one row that scrolls sideways, which keeps every tool reachable and the height
   * at one row instead of five stacked over the scene. But it is cut off flush at the right edge,
   * so it reads as "the app has three tools and the rest are missing" — Distance, Area, Height, and
   * nothing to suggest that Elevation, Clear, Stats, Save, Annotate, Boundary and Classify are a
   * swipe away. The fade is the affordance: content that dissolves at an edge is content that
   * continues past it. */
  .v3d-toolbar {
    -webkit-mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
    mask-image: linear-gradient(to right, #000 calc(100% - 28px), transparent);
  }
  /* Scrolled to the end there is nothing more to promise, so the fade goes away. The class is put
     on by the viewer as the toolbar scrolls. */
  .v3d-toolbar.at-end { -webkit-mask-image: none; mask-image: none; }
}


/* WHAT YOUR FINGERS DO, SAID ONCE.
 *
 * Gestures beat buttons for moving a camera and are worse at announcing themselves — nobody tries
 * a two-finger drag on a picture of a hillside unless they are told it does something. So it is
 * told, one time, on the first visit to the 3D view on a touch screen, and then never again. */
.v3d-gestures {
  position: absolute; left: 50%; bottom: 74px; transform: translateX(-50%);
  z-index: 42; width: max-content; max-width: min(92%, 380px);
  display: flex; flex-direction: column; gap: 10px; align-items: stretch;
  padding: 14px 16px; border-radius: 12px;
  background: rgba(11, 18, 32, .93); border: 1px solid rgba(255, 255, 255, .16);
  box-shadow: 0 10px 30px rgba(0, 0, 0, .45);
  font: 13px/1.35 var(--font); color: #e2e8f0;
}
.v3d-gestures dl { display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; margin: 0; }
.v3d-gestures dt { font-size: 20px; line-height: 1; text-align: center; }
.v3d-gestures dd { margin: 0; align-self: center; }
.v3d-gestures dd b { display: block; font-weight: 600; }
.v3d-gestures dd span { color: #94a3b8; font-size: 12px; }
.v3d-gestures button {
  height: 40px; font: 600 13px var(--font); color: #fff;
  background: var(--accent); border: 0; border-radius: 7px; cursor: pointer;
}

.v3d-status { position: absolute; left: 12px; bottom: 12px; z-index: 40; background: rgba(11, 18, 32, 0.88); color: #fff; border-radius: 8px; padding: 8px 12px; font-size: 12.5px; font-family: var(--mono); backdrop-filter: blur(6px); min-width: 200px; pointer-events: none; line-height: 1.4; }
.v3d-status .sub, .m3d-label .sub { opacity: 0.7; font-size: 11px; font-weight: 500; }
.v3d-status:empty { display: none; }
.v3d-panel { position: absolute; top: 12px; right: 12px; bottom: 12px; width: 290px; z-index: 40; background: rgba(255, 255, 255, 0.96); border-radius: 10px; box-shadow: var(--shadow); overflow-y: auto; padding: 12px; font-size: 13px; }
.v3d-panel h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 10px 0 6px; }
.v3d-panel h4:first-child { margin-top: 0; }
.v3d-layer { border: 1px solid var(--line); border-radius: 8px; padding: 8px 10px; margin-bottom: 6px; background: #fff; }
.v3d-layer .l-head { display: flex; align-items: center; gap: 8px; }
/* collapsible: the head is the list, the body is one layer's settings */
.v3d-layer.collapsible > .l-head { cursor: pointer; }
.v3d-layer.collapsible > .l-head::after {
  content: ''; flex: none; margin-left: auto; width: 0; height: 0;
  border-left: 4px solid currentColor; border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent;
  opacity: 0.4; transform: rotate(90deg); transition: transform 0.12s ease;
}
.v3d-layer.collapsible.closed > .l-head::after { transform: none; }
.v3d-layer.collapsible.closed > .l-body { display: none; }
.v3d-layer.collapsible.closed { padding-top: 6px; padding-bottom: 6px; }
@media (prefers-reduced-motion: reduce) { .v3d-layer.collapsible > .l-head::after { transition: none; } }
.v3d-layer .l-head label { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; font-weight: 600; cursor: pointer; }
.v3d-layer .l-head .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.v3d-layer .l-body { margin-top: 8px; display: grid; gap: 6px; }
.v3d-layer .l-row { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.v3d-layer .l-row label { color: var(--muted); width: 58px; flex: none; font-size: 11.5px; }
.v3d-layer select.input, .v3d-layer input[type=range] { flex: 1; min-width: 0; }
.v3d-layer .input { padding: 4px 6px; font-size: 12.5px; }
.v3d-layer .warn { color: var(--accent-2); font-size: 11.5px; }
.v3d-layer .note { color: var(--muted); font-size: 11px; line-height: 1.35; }
/* A folded warning: the line worth reading at a glance, the rest one click away. The marker is
   the only affordance, so it stays visible and turns; hiding it would leave a summary that looks
   like plain text and nobody would open. */
details.note > summary { cursor: pointer; list-style: none; display: flex; gap: 5px; align-items: flex-start; }
details.note > summary::-webkit-details-marker { display: none; }
details.note > summary::after { content: "›"; margin-left: auto; transition: transform .15s; opacity: .7; }
details.note[open] > summary::after { transform: rotate(90deg); }
details.note > span { display: block; margin-top: 4px; }
.chips { display: flex; flex-wrap: wrap; gap: 4px; }
.chips .chip-sm { font-size: 11px; padding: 2px 7px; border-radius: 999px; border: 1px solid var(--line-2); background: #fff; cursor: pointer; }
.chips .chip-sm.off { opacity: 0.4; text-decoration: line-through; }
.v3d-layers-toggle { display: none; position: absolute; top: 12px; right: 12px; z-index: 41; }
.m3d-labels { position: absolute; inset: 0; pointer-events: none; z-index: 30; }
.m3d-label { position: absolute; transform: translate(-50%, -120%); background: var(--brand); color: #fff; padding: 4px 8px; border-radius: 6px; font: 700 12px var(--mono); white-space: nowrap; box-shadow: var(--shadow); text-align: center; }
.m3d-label.seg { background: rgba(255, 255, 255, 0.92); color: var(--ink); font-size: 11px; font-weight: 600; padding: 1px 5px; transform: translate(-50%, -50%); }
.m3d-label.main { transform: translate(-50%, -130%); }
.zx { display: flex; align-items: center; gap: 8px; font-size: 12.5px; }
.zx input { flex: 1; }
.potree_container, .potree_render_area { background: transparent; }
#potree_description, .potree_info_text, #potree_annotations { display: none !important; }

/* ---------- compare / volumes ---------- */
.vol-form { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.vol-form .span2 { grid-column: 1 / -1; }
.vol-side { border: 1px solid var(--line); border-radius: 8px; padding: 10px 12px; background: #f8fafc; }
.vol-side h4 { font-size: 12px; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-bottom: 6px; }
.vol-map { position: relative; height: 420px; border-radius: var(--radius); overflow: hidden; border: 1px solid var(--line); background: #d9dde3; margin-top: 10px; }
.vol-map .map { inset: 0; }
.vol-map .vm-tools { position: absolute; top: 8px; right: 8px; z-index: 800; display: flex; gap: 6px; }
.vol-results { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 12px; }
.vol-results .stat .v { font-size: 22px; }
.vol-results .stat .u { font-size: 12px; color: var(--muted); font-weight: 600; }
.vol-results .stat.cut { border-color: #fca5a5; background: #fef2f2; }
.vol-results .stat.fill { border-color: #93c5fd; background: #eff6ff; }
/* Ground the point cloud never reached, under a quantity measured on it (server/datasets/dtmaudit.js).
   Marked rather than coloured like cut or fill: those two are results, this is a caveat on them. */
.vol-results .stat.unmeasured { border-color: #fcd34d; background: #fffbeb; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .vol-results .stat.unmeasured { border-color: #78560f; background: #2a2210; } }
:root[data-theme="dark"] .vol-results .stat.unmeasured { border-color: #78560f; background: #2a2210; }
.legend { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--muted); margin-top: 10px; }
.legend .bar { flex: 1; height: 12px; border-radius: 6px; background: linear-gradient(90deg, #b2182b, #ef8a62, #f7f7f7, #67a9cf, #2166ac); border: 1px solid var(--line-2); }
.an-list .list-item { cursor: pointer; }
.an-list .list-item.active { outline: 2px solid var(--accent); }
@media (max-width: 860px) {
  .vol-form, .vol-results { grid-template-columns: 1fr 1fr; }
  .v3d-panel { display: none; top: auto; right: 8px; left: 8px; bottom: 8px; width: auto; max-height: 55%; }
  .v3d-panel.open { display: block; }
  .v3d-layers-toggle { display: inline-flex; }
  /* One scrolling row, never a growing block.
   *
   * The toolbar wraps by design, which is right on a desktop where it has room for two rows. On a
   * phone the same rule turns eleven buttons into five or six stacked rows of an absolutely
   * positioned element — so it grows DOWN over the scene, and over any message shown in the
   * viewport, which is what made the 3D error unreadable in an in-app browser. Scrolling sideways
   * keeps every tool reachable and the height fixed at one row. */
  .v3d-toolbar {
    max-width: none; left: 8px; right: 92px; top: 8px;
    flex-wrap: nowrap; overflow-x: auto; overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none; padding-bottom: 2px;
  }
  .v3d-toolbar::-webkit-scrollbar { display: none; }
  .v3d-toolbar .btn { flex: 0 0 auto; }
  .v3d-status { bottom: 8px; left: 8px; right: 8px; min-width: 0; }
}
@media (max-width: 640px) {
  .mainnav a .short { display: inline; }
  .mainnav a .long { display: none; }
  .vol-results { grid-template-columns: 1fr 1fr; }
}
.mainnav a .short { display: none; }

/* ---------- update banner ---------- */
.update-banner { position: fixed; top: 10px; left: 50%; transform: translateX(-50%); z-index: 9998; background: var(--brand); color: #fff; padding: 10px 14px; border-radius: 10px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: center; font-size: 14px; }
.update-banner .btn { padding: 5px 10px; font-size: 13px; }

/* ---------- 3D stats / GPU panel ---------- */
.v3d-stats { position: absolute; left: 12px; bottom: 12px; z-index: 45; width: 340px; max-width: calc(100% - 24px); max-height: 60%; overflow: auto; background: rgba(11, 18, 32, 0.92); color: #e2e8f0; border-radius: 10px; padding: 10px 12px; font: 12px var(--mono); backdrop-filter: blur(6px); box-shadow: var(--shadow); }
.v3d-stats h5 { margin: 6px 0 3px; font: 700 10.5px var(--font); letter-spacing: 0.08em; text-transform: uppercase; color: #94a3b8; }
.v3d-stats .kv2 { display: grid; grid-template-columns: auto 1fr; gap: 1px 10px; }
.v3d-stats .kv2 span:nth-child(odd) { color: #94a3b8; }
.v3d-stats .warn { color: #fdba74; margin-top: 4px; font-family: var(--font); }
.v3d-stats .ok { color: #86efac; }
.v3d-stats .bar { height: 6px; background: rgba(255,255,255,0.15); border-radius: 3px; overflow: hidden; margin: 3px 0 4px; }
.v3d-stats .bar i { display: block; height: 100%; background: #60a5fa; }
.v3d-stats .bar i.hot { background: #f97316; }
.v3d-status.with-stats { bottom: auto; top: 60px; }

/* ---- drone flights ---- */
.flight-thumbs { display: flex; gap: 6px; overflow-x: auto; padding-bottom: 4px; align-items: center; }
.flight-thumbs img { width: 96px; height: 64px; object-fit: cover; border-radius: 6px; border: 1px solid var(--line); background: #e2e8f0; flex: none; }
.flight-thumbs .more { flex: none; font-size: 12px; color: var(--muted); padding: 0 8px; }
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 6px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); }
.outputs { display: flex; flex-wrap: wrap; gap: 6px 14px; font-size: 13px; }
.outputs span { display: inline-flex; align-items: center; gap: 5px; }
.outputs .ok { color: var(--green); font-weight: 700; }
.outputs .no { color: var(--muted); }
.flight-stage { display: flex; align-items: center; gap: 10px; font-size: 13px; }
.flight-stage .progress { flex: 1; }

/* ---- georeferenced 2D map ---- */
.map-panel { position: absolute; top: 46px; right: 12px; max-height: calc(100% - 58px); width: 280px; z-index: 900; background: rgba(255, 255, 255, 0.96); border-radius: 10px; box-shadow: var(--shadow); overflow-y: auto; padding: 12px; font-size: 13px; }
.map-panel h4 { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted); margin: 10px 0 6px; }
.map-panel h4:first-child { margin-top: 0; }
.map-panel .lyr { display: grid; grid-template-columns: auto 1fr auto; align-items: center; gap: 6px 8px; padding: 5px 0; border-bottom: 1px solid var(--line); }
.map-panel .lyr:last-child { border-bottom: 0; }
.map-panel .lyr label { display: flex; align-items: center; gap: 7px; font-weight: 600; min-width: 0; cursor: pointer; }
.map-panel .lyr .name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-panel .lyr .sub { grid-column: 1 / 4; font-size: 11.5px; color: var(--muted); }
.map-panel .lyr > .badge { justify-self: start; }

/* ---------- collapsible layer groups ---------- */
.map-panel .lg { border-bottom: 1px solid var(--line); }
.map-panel .lg:last-of-type { border-bottom: 0; }
.map-panel .lg > summary {
  display: flex; align-items: center; gap: 8px;
  padding: 7px 2px; cursor: pointer; list-style: none;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--ink); user-select: none;
}
.map-panel .lg > summary::-webkit-details-marker { display: none; }
/* one caret, drawn rather than typed, so it rotates with the group */
.map-panel .lg > summary::before {
  content: ''; flex: none; width: 0; height: 0;
  border-left: 5px solid currentColor; border-top: 4px solid transparent; border-bottom: 4px solid transparent;
  opacity: 0.55; transition: transform 0.12s ease;
}
.map-panel .lg[open] > summary::before { transform: rotate(90deg); }
.map-panel .lg > summary:hover { color: var(--ink); }
.map-panel .lg .lg-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.map-panel .lg .lg-count {
  flex: none; font-size: 10.5px; font-weight: 600; letter-spacing: 0;
  color: var(--muted); font-variant-numeric: tabular-nums;
}
.map-panel .lg .lg-all { flex: none; margin: 0; }
.map-panel .lg-body { padding: 0 0 6px 13px; }
.map-panel .lg-body .lyr:last-child { border-bottom: 0; }

/* an expandable layer row: one line at rest, its settings underneath */
.map-panel .lyr-x { display: block; padding: 0; border-bottom: 1px solid var(--line); }
.map-panel .lyr-x > summary {
  display: flex; align-items: center; gap: 7px;
  padding: 6px 2px; cursor: pointer; list-style: none;
}
.map-panel .lyr-x > summary::-webkit-details-marker { display: none; }
.map-panel .lyr-x > summary::after {
  content: ''; flex: none; margin-left: 2px; width: 0; height: 0;
  border-left: 4px solid currentColor; border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent;
  opacity: 0.4; transition: transform 0.12s ease;
}
.map-panel .lyr-x[open] > summary::after { transform: rotate(90deg); }
.map-panel .lyr-x > summary:hover { background: var(--bg); border-radius: 4px; }
.map-panel .lyr-x > summary .name {
  flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  font-weight: 500; color: var(--ink);
}
.map-panel .lyr-x > summary input[type=checkbox] { flex: none; margin: 0; }
.map-panel .kindbadge { flex: none; font-size: 10px; }
.map-panel .lyr-detail { padding: 2px 0 8px 21px; display: grid; gap: 5px; }
.map-panel .lyr-detail .lr { display: flex; align-items: center; gap: 8px; font-size: 11.5px; color: var(--muted); }
.map-panel .lyr-detail .lr > span { flex: none; width: 48px; }
.map-panel .lyr-detail .lr input[type=range] { flex: 1; width: auto; }
.map-panel .lyr-detail .lr select.input { flex: 1; width: auto; padding: 2px 4px; font-size: 12px; }
.map-panel .lyr-detail .sub { font-size: 11.5px; color: var(--muted); }

/* the CAD layer list, which used to sit open in the middle of everything */
.map-panel .chips-d { grid-column: 1 / 4; }
.map-panel .chips-d > summary {
  cursor: pointer; list-style: none; font-size: 11.5px; color: var(--muted);
  padding: 2px 0; display: inline-flex; align-items: center; gap: 5px;
}
.map-panel .chips-d > summary::-webkit-details-marker { display: none; }
.map-panel .chips-d > summary::before {
  content: ''; width: 0; height: 0;
  border-left: 4px solid currentColor; border-top: 3.5px solid transparent; border-bottom: 3.5px solid transparent;
  opacity: 0.6; transition: transform 0.12s ease;
}
.map-panel .chips-d[open] > summary::before { transform: rotate(90deg); }
.map-panel .chips-d > summary:hover { color: var(--ink-2); }
.map-panel .chips-d .chips { padding: 4px 0 2px; }
@media (prefers-reduced-motion: reduce) {
  .map-panel .lg > summary::before, .map-panel .chips-d > summary::before { transition: none; }
}
.map-panel .lyr input[type=range] { width: 70px; }
.map-panel .lyr select.input { padding: 2px 4px; font-size: 12px; grid-column: 2 / 4; width: 100%; }
.map-panel .quality { font-size: 11.5px; color: var(--muted); margin-top: 4px; }
.map-panel-toggle { position: absolute; top: 12px; right: 12px; z-index: 901; }
.map-panel.hidden { display: none; }
.leaflet-container .basemap-tiles { filter: saturate(0.85); }
.map-coords { position: absolute; left: 50%; bottom: 10px; transform: translateX(-50%); z-index: 900; background: rgba(11, 18, 32, 0.85); color: #fff; padding: 5px 10px; border-radius: 8px; font-size: 12px; font-family: var(--mono); white-space: nowrap; pointer-events: none; max-width: calc(100% - 24px); overflow: hidden; text-overflow: ellipsis; }
.profile-panel { display: none; position: absolute; left: 12px; bottom: 34px; z-index: 900; background: #fff; border-radius: 10px; box-shadow: var(--shadow); padding: 10px 12px; max-width: calc(100% - 24px); }
.profile-panel.show { display: block; }
.profile-panel .pp-head { display: flex; align-items: center; gap: 10px; font-size: 12.5px; margin-bottom: 4px; flex-wrap: wrap; }
.profile-panel .pp-hint, .profile-panel .pp-stats { font-size: 12px; color: var(--muted); }
.swipe-bar { position: absolute; left: 12px; right: 12px; bottom: 12px; z-index: 900; background: rgba(255, 255, 255, 0.95); border-radius: 10px; box-shadow: var(--shadow); padding: 8px 12px; display: flex; align-items: center; gap: 10px; font-size: 12.5px; }
.swipe-bar input[type=range] { flex: 1; }
.swipe-divider { position: absolute; top: 0; bottom: 0; width: 3px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.35); z-index: 850; pointer-events: none; }
.swipe-label { position: absolute; top: 12px; z-index: 850; background: rgba(11, 18, 32, 0.85); color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 12px; pointer-events: none; }
@media (max-width: 800px) { .map-panel { width: 230px; } }

/* ---- project objects: annotations, measurements, piles, volumes ---- */
.wtable { width: 100%; border-collapse: collapse; font-size: 13px; }
.wtable th, .wtable td { text-align: left; padding: 7px 8px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.wtable th { font-size: 11px; text-transform: uppercase; letter-spacing: .04em; color: var(--muted); white-space: nowrap; }
.wtable td.num, .wtable th.num { text-align: right; font-variant-numeric: tabular-nums; }
.wtable tr.clickable { cursor: pointer; }
.wtable tr.clickable:hover { background: #f8fafc; }
.wtable tr.active { background: #eff6ff; }
.wtable .btn { padding: 3px 8px; font-size: 12px; }
.wtable .row { gap: 4px; flex-wrap: nowrap; justify-content: flex-end; }
.wtable-wrap { overflow-x: auto; }
.status-pill { display: inline-block; padding: 2px 8px; border-radius: 999px; font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.status-open { background: #fee2e2; color: #b91c1c; } .status-in_progress { background: #fef3c7; color: #b45309; } .status-resolved, .status-completed { background: #dcfce7; color: #15803d; } .status-monitor { background: #dbeafe; color: #1d4ed8; } .status-archived { background: #e2e8f0; color: #475569; }
.change-pos { color: var(--green); font-weight: 700; } .change-neg { color: var(--red); font-weight: 700; }
.drawer-bg { position: fixed; inset: 0; background: rgba(15, 23, 42, .35); z-index: 1200; display: none; }
.drawer-bg.show { display: block; }
.drawer { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: #fff; z-index: 1201; box-shadow: -8px 0 30px rgba(0,0,0,.18); overflow-y: auto; padding: 16px 18px; transform: translateX(100%); transition: transform .2s; }
.drawer.show { transform: none; }
.drawer h2 { font-size: 18px; margin: 0; }
.drawer .code { font-family: var(--mono); font-size: 12px; color: var(--muted); }
.timeline-v { border-left: 2px solid var(--line-2); margin: 8px 0 8px 6px; padding-left: 14px; display: grid; gap: 8px; }
.timeline-v .ev { position: relative; font-size: 12.5px; }
.timeline-v .ev::before { content: ""; position: absolute; left: -20px; top: 4px; width: 10px; height: 10px; border-radius: 50%; background: var(--brand); border: 2px solid #fff; box-shadow: 0 0 0 1px var(--line-2); }
.timeline-v .ev .d { color: var(--muted); font-size: 11.5px; }
.att-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(110px, 1fr)); gap: 6px; }
.att-grid a { display: block; aspect-ratio: 4/3; border-radius: 6px; overflow: hidden; border: 1px solid var(--line); background: #e2e8f0; }
.att-grid img { width: 100%; height: 100%; object-fit: cover; }
.map-tools { position: absolute; top: 12px; left: 56px; z-index: 900; display: flex; gap: 6px; flex-wrap: wrap; max-width: calc(100% - 380px); }
.map-tools .btn { background: rgba(11, 18, 32, 0.88); color: #fff; border-color: rgba(255,255,255,.14); backdrop-filter: blur(6px); }
.map-tools .btn.active { background: var(--accent); border-color: var(--accent); }
.leaflet-container .feat-icon { background: transparent; border: 0; }
.feat-marker { width: 26px; height: 26px; border-radius: 50% 50% 50% 0; transform: rotate(-45deg); border: 2px solid #fff; box-shadow: 0 2px 6px rgba(0,0,0,.35); display: flex; align-items: center; justify-content: center; }
.feat-marker span { transform: rotate(45deg); color: #fff; font-size: 12px; font-weight: 800; line-height: 1; }
.feat-marker.open { background: #dc2626; } .feat-marker.in_progress { background: #d97706; } .feat-marker.resolved, .feat-marker.completed { background: #16a34a; } .feat-marker.monitor { background: #2563eb; } .feat-marker.archived { background: #64748b; } .feat-marker.previous { opacity: .55; }
.feat-label { background: rgba(255,255,255,.9); border: 1px solid var(--line-2); border-radius: 6px; padding: 2px 6px; font-size: 11px; font-weight: 600; white-space: nowrap; box-shadow: 0 1px 3px rgba(0,0,0,.15); }
.vol-tabs { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.vol-tabs .btn.active { background: var(--brand); color: #fff; border-color: var(--brand); }
.kpi { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.kpi .stat .v { font-size: 20px; }

/* while a drawing / measuring tool is active, existing objects must not swallow clicks */
.leaflet-container.measuring .leaflet-interactive, .leaflet-container.measuring .leaflet-marker-icon, .leaflet-container.measuring .leaflet-marker-pane { pointer-events: none !important; }

/* ---------- flight path (raw imagery QA layer) ---------- */
.leaflet-container .fp-arrow { background: transparent; border: 0; }
.fp-arrow svg { width: 14px; height: 14px; display: block; filter: drop-shadow(0 1px 1px rgba(0,0,0,.3)); }
.fp-pop { display: grid; gap: 6px; }
.fp-pop img { width: 100%; border-radius: 6px; display: block; background: #e2e8f0; }
.fp-pop-name { font-size: 12.5px; word-break: break-all; }
.fp-pop-meta { display: flex; flex-wrap: wrap; gap: 4px 10px; font-size: 11.5px; color: var(--muted); }
.fp-warn { position: absolute; left: 12px; bottom: 12px; z-index: 900; max-width: 380px; background: rgba(255,255,255,.97); border: 1px solid #fdba74; border-left: 4px solid #ea580c; border-radius: 8px; padding: 8px 10px; box-shadow: 0 4px 14px rgba(0,0,0,.18); font-size: 12px; }
.fp-warn-head { display: flex; justify-content: space-between; align-items: center; gap: 8px; margin-bottom: 4px; }
.fp-warn-list { margin: 0; padding-left: 16px; display: grid; gap: 3px; }
.fp-warn-files { margin: 4px 0 0; padding-left: 16px; max-height: 160px; overflow: auto; color: var(--muted); font-size: 11.5px; }
.fp-warn details summary { cursor: pointer; margin-top: 6px; color: var(--muted); }
@media (max-width: 720px) { .fp-warn { max-width: calc(100% - 24px); } }

/* ---------- pile inspector ---------- */
.pile-wrap { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 12px; margin-top: 12px; }
@media (max-width: 900px) { .pile-wrap { grid-template-columns: 1fr; } }
.pile-3d { position: relative; height: min(60vh, 520px); background: #0f172a; border-radius: 8px; overflow: hidden; border: 1px solid var(--line); }
.pile-3d .hint { position: absolute; left: 10px; bottom: 10px; color: #cbd5e1; font-size: 11.5px; background: rgba(15,23,42,.72); padding: 4px 8px; border-radius: 4px; pointer-events: none; }
.pile-views { position: absolute; top: 10px; left: 10px; display: flex; gap: 6px; z-index: 2; }
.pile-views .btn { background: rgba(15,23,42,.85); color: #fff; border-color: rgba(255,255,255,.16); }
.pile-views .btn.active { background: var(--accent); border-color: var(--accent); }
.pile-readout { position: absolute; top: 10px; right: 10px; z-index: 2; background: rgba(15,23,42,.88); color: #e2e8f0; border-radius: 6px; padding: 7px 10px; font-family: var(--mono); font-size: 12px; min-width: 150px; }
.pile-readout .big { font-size: 15px; font-weight: 700; color: #fff; }
.pile-side { display: flex; flex-direction: column; gap: 10px; }
.pile-side h4 { margin: 0 0 6px; font-size: 12px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.pile-stats { display: grid; grid-template-columns: 1fr auto; gap: 3px 10px; font-size: 13px; align-items: baseline; }
.pile-stats dt { color: var(--muted); }
.pile-stats dd { margin: 0; text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }
.pile-stats dd.big { font-size: 17px; font-weight: 700; }
.pile-layers { display: grid; gap: 4px; font-size: 13px; }
.pile-layers label { display: flex; gap: 7px; align-items: center; cursor: pointer; }
.pile-layers .swatch { width: 11px; height: 11px; border-radius: 2px; flex: none; border: 1px solid rgba(0,0,0,.2); }
.pile-note { font-size: 12px; color: var(--muted); line-height: 1.45; }
.pile-warn { font-size: 12px; color: var(--accent-2); }

/* ---------- boundary editing ---------- */
.boundary-edit { position: absolute; left: 12px; bottom: 12px; z-index: 950; background: rgba(255,255,255,.97); border: 1px solid var(--line-2); border-left: 4px solid var(--accent); border-radius: 8px; padding: 9px 12px; box-shadow: 0 4px 16px rgba(0,0,0,.2); max-width: 380px; font-size: 13px; }
.boundary-edit .be-row { display: flex; justify-content: space-between; gap: 12px; align-items: baseline; }
.boundary-edit .be-area { font-family: var(--mono); font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; }
.boundary-edit .be-hint { color: var(--muted); font-size: 11.5px; margin-top: 3px; line-height: 1.4; }
.boundary-edit .be-bad { color: var(--red); font-size: 12px; margin-top: 5px; }
.boundary-edit .be-actions { display: flex; gap: 6px; margin-top: 8px; flex-wrap: wrap; }
.leaflet-container.editing-boundary { cursor: crosshair; }

/* A selected map object — what the Delete key will remove. The ring is drawn outside the marker
   so it reads as "picked" rather than as a change of status colour. */
.feat-icon.feat-selected .feat-marker,
.feat-marker.feat-selected {
  outline: 3px solid var(--accent-2, #2563eb);
  outline-offset: 2px;
  box-shadow: 0 0 0 6px rgba(37, 99, 235, .25), 0 2px 6px rgba(0, 0, 0, .35);
}
.leaflet-container.has-selection { cursor: default; }
/* the "press Delete to remove" hint that appears while something is selected */
.sel-hint {
  position: absolute; left: 50%; bottom: 16px; transform: translateX(-50%);
  z-index: 900; pointer-events: none;
  background: rgba(15, 23, 42, .9); color: #fff;
  font-size: 12.5px; line-height: 1; padding: 8px 12px; border-radius: 999px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, .3); white-space: nowrap;
}
.sel-hint kbd {
  font: inherit; background: rgba(255, 255, 255, .18); border-radius: 4px;
  padding: 2px 6px; margin: 0 2px;
}

/* ---- Downloads, grouped by what the file is for ---- */
.dl-sec { margin: 0 0 22px; }
.dl-sec > h3 {
  font-size: 11.5px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase;
  color: var(--muted, #64748b); margin: 0 0 8px;
}
.dl-formats { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; }
.dl-warn { color: var(--amber, #b45309); font-weight: 600; }
/* engine working files: present, but not competing with the deliverables */
.dl-extras { margin: 4px 0 22px; }
.dl-extras > summary {
  cursor: pointer; font-size: 13px; color: var(--muted, #64748b);
  padding: 8px 2px; list-style: revert;
}
.dl-extras > summary:hover { color: var(--ink, #0f172a); }
.dl-extras[open] > summary { margin-bottom: 8px; }
@media (max-width: 640px) {
  .file-row { flex-wrap: wrap; }
  .dl-formats { justify-content: flex-start; width: 100%; padding-left: 34px; }
}

/* ---- Downloads: resolution choices, photo picking ---- */
.btn .dl-size { display: block; font-style: normal; font-size: 10px; opacity: .75; margin-top: 1px; font-weight: 500; }
.dl-formats .btn { text-align: center; line-height: 1.25; }
/* A stated limitation, not an error: something worked but the reader has to know what it means. */
.warn { background: #fffbeb; border: 1px solid #fcd34d; color: #92400e; border-radius: 6px; padding: 7px 10px; font-size: 12.5px; line-height: 1.45; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="light"]) .warn { background: #2a2210; border-color: #78560f; color: #fcd34d; } }
:root[data-theme="dark"] .warn { background: #2a2210; border-color: #78560f; color: #fcd34d; }
.dl-fmt { display: inline-flex; margin-top: 6px; border: 1px solid var(--line); border-radius: 6px; overflow: hidden; }
.dl-fmt button { border: 0; background: transparent; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 600; padding: 3px 10px; cursor: pointer; }
.dl-fmt button + button { border-left: 1px solid var(--line); }
.dl-fmt button.on { background: var(--accent-2); color: #fff; }
.dl-fmt button:not(.on):hover { background: var(--bg-2, rgba(0, 0, 0, .04)); color: var(--ink); }
.dl-fmt-note { font-style: italic; }
.dl-mark { display: inline-flex; align-items: center; gap: 6px; margin: 6px 0 0 10px; font-size: 11.5px; color: var(--muted); cursor: pointer; }
.dl-mark input { margin: 0; }
.dl-note { display: flex; gap: 14px; flex-wrap: wrap; margin-top: 6px; font-size: 11.5px; color: var(--muted, #64748b); }
.dl-note span { white-space: nowrap; }

/* site photos: pick some, or take them all */
.dl-photos { display: grid; grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 8px; margin: 10px 0 8px; }
.dl-photo { position: relative; display: block; cursor: pointer; border-radius: 4px; overflow: hidden; border: 2px solid transparent; }
.dl-photo img { display: block; width: 100%; height: 76px; object-fit: cover; background: var(--panel-2, #eef2f6); }
.dl-photo input { position: absolute; top: 5px; left: 5px; z-index: 2; width: 16px; height: 16px; cursor: pointer; }
.dl-photo:has(input:checked) { border-color: var(--accent, #ea580c); }
.dl-photo:has(input:checked) img { opacity: .82; }
.dl-photo .cap {
  position: absolute; left: 0; right: 0; bottom: 0; padding: 3px 6px;
  font-size: 10.5px; color: #fff; background: rgba(0,0,0,.6);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.dl-photo-actions { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---- Edit dialog: rename a stockpile, correct an annotation ---- */
.edit-modal {
  position: fixed; inset: 0; z-index: 4000;
  background: rgba(15, 23, 42, .45);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.edit-card {
  background: var(--panel, #fff); color: var(--ink, #0f172a);
  border-radius: 8px; padding: 20px 22px; width: min(460px, 100%);
  box-shadow: 0 20px 50px -12px rgba(0, 0, 0, .4);
  max-height: 90vh; overflow-y: auto;
}
.edit-card h3 { margin: 0 0 14px; font-size: 16px; font-weight: 700; }
.edit-card .field { margin-bottom: 12px; }
.edit-card .field label { display: block; font-size: 12px; font-weight: 600; margin-bottom: 4px; color: var(--muted, #475569); }
.edit-card textarea.input { resize: vertical; font-family: inherit; }
.edit-actions { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 16px; flex-wrap: wrap; }
.edit-actions kbd {
  font: inherit; font-size: 11px; background: var(--panel-2, #eef2f6);
  border: 1px solid var(--rule, #cbd5e1); border-radius: 3px; padding: 1px 5px;
}
/* the internal reference next to a stockpile's real name — present, but not the title */
.code-ref { font-size: 11px; font-weight: 600; color: var(--muted, #64748b); letter-spacing: .02em; }

/* the live drawing hint on the map toolbar — what is being drawn and which keys act on it */
.map-tools .draw-hint {
  display: inline-flex; align-items: center; gap: 4px;
  margin-left: 6px; padding: 0 8px;
  font-size: 11.5px; color: var(--muted, #475569); white-space: nowrap;
}
.map-tools .draw-hint kbd {
  font: inherit; font-size: 10.5px; background: var(--panel-2, #eef2f6);
  border: 1px solid var(--rule, #cbd5e1); border-radius: 3px; padding: 0 4px;
}

/* ---- Two-point slope readout ---- */
.slope-panel {
  position: absolute; left: 54px; top: 12px; z-index: 800;
  background: var(--panel, #fff); border: 1px solid var(--rule, #cbd5e1);
  border-radius: 6px; box-shadow: 0 6px 20px -6px rgba(15, 23, 42, .3);
  padding: 10px 12px; min-width: 250px; max-width: 320px;
  font-size: 13px; display: none;
}
.slope-panel.show { display: block; }
.slope-panel .sp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; }
.slope-panel .sp-head b { font-size: 13px; }
.slope-panel .sp-head .muted { font-size: 11.5px; color: var(--muted, #64748b); flex: 1; }
.slope-panel .sp-hint { font-size: 12.5px; color: var(--muted, #475569); line-height: 1.45; }
.slope-panel .sp-hint kbd,
.slope-panel kbd { font: inherit; font-size: 11px; background: var(--panel-2, #eef2f6); border: 1px solid var(--rule, #cbd5e1); border-radius: 3px; padding: 0 4px; }
.slope-panel .sp-table { width: 100%; border-collapse: collapse; }
.slope-panel .sp-table td { padding: 3px 0; }
.slope-panel .sp-table td.num { text-align: right; font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.slope-panel .sp-table tr.sp-key td { border-top: 1px solid var(--rule-2, #e2e8f0); padding-top: 6px; font-size: 14px; }
.slope-panel .sp-table tr.sp-key td.num { color: var(--accent, #b45309); }
.slope-panel .sp-foot { margin-top: 8px; font-size: 11px; color: var(--muted, #64748b); display: flex; align-items: center; justify-content: space-between; gap: 8px; }

/* ---------------------------------------------------------------------------
   Link colours, reclaimed from the 3D viewer's stylesheet.

   potree.css ships `a:hover, a:visited, a:link, a:active { color: #ccf }` — a
   pale lilac meant for its own dark panels, applied to every anchor on the
   page. Because `a:link` is specificity (0,1,1) it outranks `.btn` at (0,1,0),
   so every link styled as a button — the CSV and KML exports on Measurements,
   the format buttons on Downloads — rendered at 1.54:1 against white. That is
   not a colour anyone chose; it is a vendor stylesheet escaping its scope.

   These rules match that specificity or beat it, and app.css loads after it.
   --------------------------------------------------------------------------- */
a:link, a:visited, a:hover, a:active { color: var(--blue); }
.btn:link, .btn:visited, .btn:hover, .btn:active { color: var(--ink); }
.btn-primary:link, .btn-primary:visited, .btn-primary:hover, .btn-primary:active,
.btn-dark:link, .btn-dark:visited, .btn-dark:hover, .btn-dark:active,
.btn-danger:link, .btn-danger:visited, .btn-danger:hover, .btn-danger:active { color: #fff; }
/* the 3D viewer's own chrome keeps its palette */
#v3dViewport a:link, #v3dViewport a:visited, #v3dViewport a:hover, #v3dViewport a:active { color: inherit; }

/* White on #ea580c is 3.56:1 — under the 4.5:1 a label needs. The darker orange
   already in the palette reaches 5.0:1, and the lighter one becomes the hover. */
.btn-primary { background: var(--accent-2); border-color: var(--accent-2); }
.btn-primary:hover { background: var(--accent); border-color: var(--accent); }

/* ---- site linework: the layer schedule on the downloads page ---------------------------- */
/* The colours are the ACI indices datasets/dxfwrite.js writes, so the swatch here and the layer
   colour in CAD are the same decision seen twice rather than two lists that can drift. */
.dl-linework { margin-top: 8px; }
.dl-std { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.dl-std select { font: inherit; padding: 2px 6px; border: 1px solid var(--line); border-radius: 6px; background: transparent; color: var(--ink); }
.dl-layers { margin-top: 6px; }
.dl-layers > summary { cursor: pointer; font-size: 11.5px; color: var(--muted); font-weight: 600; }
.dl-layers dl { margin: 8px 0 0; display: grid; grid-template-columns: minmax(0, auto) minmax(0, 1fr); gap: 4px 14px; align-items: baseline; }
.dl-layers dt { font-size: 11.5px; font-weight: 600; white-space: nowrap; display: flex; align-items: center; gap: 6px; }
.dl-layers dt em { font-style: normal; font-weight: 400; color: var(--muted); }
.dl-layers dd { margin: 0; font-size: 11.5px; color: var(--muted); }
.dl-layers p { font-size: 11.5px; margin: 10px 0 0; }
.lw-swatch { width: 10px; height: 10px; border-radius: 2px; flex: none; border: 1px solid rgba(0, 0, 0, .25); }
.lw-white { background: #f2f2f2; } .lw-red { background: #e8322d; } .lw-grey { background: #9aa0a6; }
.lw-cyan { background: #21c7d6; } .lw-green { background: #2ecc40; } .lw-blue { background: #2f6fe4; }
.lw-yellow { background: #e9c400; } .lw-magenta { background: #d63bd6; }

/* ---------------------------------------------------------------- overview
   Four numbers and four buttons. A tile is a number and at most three words: the moment one needs
   a sentence it is a page, and the page already exists — the tile links to it.
   Tokens only, so the workspace rails' dark remap (workspace.css) reaches every one of these. */
.ov-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 14px; flex-wrap: wrap; margin-bottom: 16px; }
.ov-head h1 { margin: 0 0 2px; font-size: 22px; letter-spacing: -0.01em; }
.ov-head p { margin: 0; color: var(--muted); font-size: 13px; }

/* auto-fit against the CONTAINER, not the viewport. This lives in a sheet that docks as a ~440 px
   column beside the map as well as filling a 1,280 px page, and a viewport media query cannot
   tell those apart — measured, four tiles in the docked sheet came out 73-119 px wide with a
   26 px number in them. minmax lets the row become two, then one, as the column narrows. */
.ov-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 10px; }
.ov-tile { display: block; min-width: 0; padding: 14px 15px; border: 1px solid var(--line); border-radius: 10px; background: var(--panel, #fff); text-decoration: none; color: inherit; transition: border-color .12s, transform .12s; }
.ov-tile:hover { border-color: var(--accent); transform: translateY(-1px); }
.ov-tile .ov-v { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ov-tile .ov-u { font-size: 13px; font-weight: 600; color: var(--muted); margin-left: 4px; }
.ov-tile .ov-l { font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--muted); margin-top: 6px; }
.ov-tile .ov-s { font-size: 12px; color: var(--muted); margin-top: 3px; }
.ov-tile.up .ov-v { color: #1d4ed8; }
.ov-tile.down .ov-v { color: #b91c1c; }
.ov-tile.warn { border-color: #fcd34d; background: #fffbeb; }

.ov-actions { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 10px; margin-top: 12px; }
.ov-act { display: block; min-width: 0; padding: 11px 13px; border: 1px solid var(--line); border-radius: 10px; text-decoration: none; color: inherit; background: var(--panel, #fff); }
.ov-act:hover { border-color: var(--accent); }
.ov-act b { display: block; font-size: 13.5px; }
.ov-act span { display: block; font-size: 11.5px; color: var(--muted); margin-top: 1px; }

.ov-recent { margin-top: 16px; }
.ov-row { display: flex; align-items: baseline; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--line-2, var(--line)); text-decoration: none; color: inherit; font-size: 13px; }
.ov-row:last-child { border-bottom: 0; }
.ov-row:hover .ov-row-t { text-decoration: underline; }
.ov-row-t { flex: 1; }
.ov-row-w { color: var(--muted); font-size: 12px; }
.ov-row-s { font-variant-numeric: tabular-nums; }
.ov-row-s.up { color: #1d4ed8; }
.ov-row-s.down { color: #b91c1c; }
.ov-row-s.warn { color: var(--accent-2, #b45309); }

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .ov-tile.warn { border-color: #78560f; background: #2a2210; }
  :root:not([data-theme="light"]) .ov-tile.up .ov-v { color: #93c5fd; }
  :root:not([data-theme="light"]) .ov-tile.down .ov-v { color: #fca5a5; }
}
:root[data-theme="dark"] .ov-tile.warn { border-color: #78560f; background: #2a2210; }
:root[data-theme="dark"] .ov-tile.up .ov-v { color: #93c5fd; }
:root[data-theme="dark"] .ov-tile.down .ov-v { color: #fca5a5; }

/* --------------------------------------------------------- processing phases
   Six named steps, so a four-hour run says which part is slow and what already survived. Wraps
   rather than scrolls: a step that has scrolled off is a step nobody knows about. */
.fp-phases { display: flex; flex-wrap: wrap; gap: 6px; list-style: none; margin: 0 0 2px; padding: 0; }
.fp-phases li { display: flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 600; color: var(--muted); border: 1px solid var(--line); border-radius: 999px; padding: 3px 9px 3px 3px; }
.fp-phases .fp-dot { display: inline-grid; place-items: center; width: 17px; height: 17px; border-radius: 50%; background: var(--line); color: var(--muted); font-size: 10px; font-weight: 700; }
.fp-phases li.done { color: var(--ink); border-color: #bbf7d0; }
.fp-phases li.done .fp-dot { background: #16a34a; color: #fff; }
.fp-phases li.now { color: var(--ink); border-color: var(--accent); background: var(--accent-soft, #fff1e8); }
.fp-phases li.now .fp-dot { background: var(--accent); color: #fff; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .fp-phases li.done { border-color: #14532d; }
  :root:not([data-theme="light"]) .fp-phases li.now { background: #2a1a10; }
}
:root[data-theme="dark"] .fp-phases li.done { border-color: #14532d; }
:root[data-theme="dark"] .fp-phases li.now { background: #2a1a10; }

/* A folded warning in the admin lists — same rule as the client's layer rails. */
details.note-fold > summary { cursor: pointer; list-style: none; display: flex; gap: 5px; align-items: flex-start; }
details.note-fold > summary::-webkit-details-marker { display: none; }
details.note-fold > summary::after { content: "›"; margin-left: auto; opacity: .7; transition: transform .15s; }
details.note-fold[open] > summary::after { transform: rotate(90deg); }
details.note-fold > span { display: block; margin-top: 3px; }
.li-sub.warn-note, .li-sub.warn-note > summary { color: var(--accent-2); }

/* --------------------------------------------------------- projects dashboard
   A row, not a card: thumbnail | what it is | when and what state | open. Four columns and one
   line of detail each, so a normal screen holds eight or nine projects. A grid of tall cards holds
   three, and three is not a dashboard for somebody managing a hundred sites.
   The sidebar is out of the way while this is up — choosing a project IS this screen's job. */
:root.on-dashboard .admin-side { display: none; }
:root.on-dashboard .admin-shell { grid-template-columns: 1fr; }

.pj-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 14px; }
.pj-head h1 { margin: 0 0 2px; font-size: 21px; letter-spacing: -0.01em; }
.pj-head p { margin: 0; color: var(--muted); font-size: 13px; }

.pj-bar { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-bottom: 12px; }
.pj-search { flex: 1 1 260px; min-width: 0; max-width: 420px; }
.pj-filters { display: flex; gap: 4px; flex-wrap: wrap; }
.pj-f { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 7px; padding: 6px 10px; font-size: 12.5px; font-weight: 600; cursor: pointer; }
.pj-f span { opacity: .65; font-variant-numeric: tabular-nums; }
.pj-f:hover { border-color: var(--accent); }
.pj-f.on { border-color: var(--accent); color: var(--ink); background: var(--accent-soft, #fff1e8); }

.pj-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.pj-row { display: grid; grid-template-columns: 104px minmax(0, 1fr) minmax(0, 210px) auto; gap: 14px;
  align-items: center; padding: 10px 14px 10px 10px; border-bottom: 1px solid var(--line);
  text-decoration: none; color: inherit; background: var(--panel, #fff); }
.pj-row:last-child { border-bottom: 0; }
.pj-row:hover { background: var(--accent-soft, #fff7f2); }

.pj-thumb { width: 104px; height: 66px; border-radius: 6px; overflow: hidden; background: var(--line-2, #eef1f5); display: grid; place-items: center; }
.pj-thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.pj-nothumb { font-size: 10.5px; color: var(--muted); letter-spacing: .04em; text-transform: uppercase; }

.pj-main { min-width: 0; display: block; }
.pj-name { display: block; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.pj-has { display: block; margin-top: 3px; font-size: 11px; color: var(--muted); }
.pj-has i { font-style: normal; }
.pj-has i + i::before { content: " · "; opacity: .55; }
.pj-has i.none { opacity: .7; }

.pj-when { min-width: 0; }
.pj-when > b { display: block; font-size: 13px; font-variant-numeric: tabular-nums; }
.pj-tags { display: flex; gap: 5px; flex-wrap: wrap; margin-top: 3px; }
.pj-tags i { font-style: normal; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; border-radius: 4px; padding: 1px 6px; border: 1px solid var(--line); color: var(--muted); }
.pj-tags i.live { border-color: #86efac; color: #15803d; }
.pj-tags i.draft { border-color: var(--line); }
.pj-tags i.busy { border-color: #93c5fd; color: #1d4ed8; text-transform: none; letter-spacing: 0; font-weight: 600; }

.pj-go { font-size: 12.5px; font-weight: 650; color: var(--accent); white-space: nowrap; }
.pj-empty { border: 1px dashed var(--line); border-radius: 10px; padding: 28px; text-align: center; color: var(--muted); font-size: 13.5px; }

/* Tablet: the "when" column moves under the name; the thumbnail stays, because it is the thing
   that identifies the site. */
@media (max-width: 900px) {
  .pj-row { grid-template-columns: 88px minmax(0, 1fr) auto; row-gap: 6px; }
  .pj-thumb { width: 88px; height: 58px; }
  .pj-when { grid-column: 2 / 4; }
  .pj-go { grid-column: 3; grid-row: 1; align-self: center; }
}
@media (max-width: 560px) {
  .pj-row { grid-template-columns: 72px minmax(0, 1fr); padding: 10px; }
  .pj-thumb { width: 72px; height: 48px; }
  .pj-when { grid-column: 1 / 3; }
  .pj-search { max-width: none; }
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .pj-tags i.live { border-color: #14532d; color: #4ade80; }
  :root:not([data-theme="light"]) .pj-tags i.busy { border-color: #1e3a8a; color: #93c5fd; }
}
:root[data-theme="dark"] .pj-tags i.live { border-color: #14532d; color: #4ade80; }
:root[data-theme="dark"] .pj-tags i.busy { border-color: #1e3a8a; color: #93c5fd; }

/* `a:link, a:visited…` (0,2,1) beats a plain class, so a row that is a link came out link-blue
   however many times `color: inherit` was written on it. Matched at the same shape to win. */
.pj-row, .pj-row:link, .pj-row:visited, .pj-row:hover, .pj-row:active { color: var(--ink); text-decoration: none; }
.pj-row:hover .pj-name { text-decoration: underline; }

/* The hidden attribute has to beat a component's own display.
   `.btn { display: inline-flex }` outranks the user agent's `[hidden] { display: none }`, so a
   button carrying the attribute stayed on screen — the "← Projects" button was visible on the
   projects page itself. This is the one place !important earns its keep: hidden means hidden. */
[hidden] { display: none !important; }

/* Two ways into a project from a row: work on it, or look at it. */
.pj-actions { display: flex; align-items: center; gap: 10px; white-space: nowrap; }
.pj-manage { border: 1px solid var(--line); background: transparent; color: var(--muted); border-radius: 6px; padding: 4px 9px; font-size: 12px; font-weight: 600; cursor: pointer; }
.pj-manage:hover { border-color: var(--accent); color: var(--accent); }
@media (max-width: 560px) { .pj-actions { grid-column: 1 / 3; justify-content: flex-start; } .pj-actions .pj-go { display: none; } }

/* A client's admin page is a dashboard and nothing else: no project sidebar, no staff chrome. */
:root.role-client .admin-side { display: none; }
:root.role-client .admin-shell { grid-template-columns: 1fr; }

/* --------------------------------------------------------------- people
   Person | role | where they can go | what you can do. Rows, like the projects list, so an
   organization of forty fits on a screen. */
.admin-nav { display: flex; gap: 2px; margin-left: 14px; }
.admin-nav button { background: transparent; border: 0; color: rgba(255,255,255,.68); font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 7px; cursor: pointer; }
.admin-nav button:hover { color: #fff; background: rgba(255,255,255,.09); }
.admin-nav button.on { color: #fff; background: rgba(255,255,255,.14); }

.us-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.us-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 130px minmax(0, 1.6fr) auto; gap: 14px;
  align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel, #fff); }
.us-row:last-child { border-bottom: 0; }
.us-row.off { opacity: .55; }
.us-row.pending { background: var(--accent-soft, #fff7f2); }
.us-who { min-width: 0; }
.us-who b { display: block; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.us-sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.us-role { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.us-where { min-width: 0; font-size: 12px; color: var(--muted); }
.us-where i { font-style: normal; }
.us-where i + i::before { content: " · "; opacity: .55; }
.us-where i.all { color: var(--ink); font-weight: 600; }
.us-where i.none { opacity: .75; }
.us-act { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.us-act .tag.off { font-style: normal; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.us-h { margin: 20px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.us-foot { margin-top: 12px; }
.us-picks { display: grid; gap: 6px; max-height: 320px; overflow: auto; }

@media (max-width: 760px) {
  .us-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .us-role { grid-column: 1; font-size: 12px; }
  .us-where { grid-column: 1 / 3; }
  .us-act { grid-column: 2; grid-row: 1; }
  .admin-nav { margin-left: 6px; }
  .admin-nav button { padding: 6px 8px; font-size: 12px; }
}

/* --------------------------------------------------------------- people
   Person | role | where they can go | what you can do. Rows, like the projects list, so an
   organization of forty fits on a screen. */
.admin-nav { display: flex; gap: 2px; margin-left: 14px; }
.admin-nav button { background: transparent; border: 0; color: rgba(255,255,255,.68); font-size: 13px; font-weight: 600; padding: 6px 11px; border-radius: 7px; cursor: pointer; }
.admin-nav button:hover { color: #fff; background: rgba(255,255,255,.09); }
.admin-nav button.on { color: #fff; background: rgba(255,255,255,.14); }

.us-list { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; }
.us-row { display: grid; grid-template-columns: minmax(0, 1.4fr) 130px minmax(0, 1.6fr) auto; gap: 14px;
  align-items: center; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--panel, #fff); }
.us-row:last-child { border-bottom: 0; }
.us-row.off { opacity: .55; }
.us-row.pending { background: var(--accent-soft, #fff7f2); }
.us-who { min-width: 0; }
.us-who b { display: block; font-size: 14px; font-weight: 650; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.us-sub { display: block; font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.us-role { font-size: 12.5px; font-weight: 600; color: var(--muted); }
.us-where { min-width: 0; font-size: 12px; color: var(--muted); }
.us-where i { font-style: normal; }
.us-where i + i::before { content: " · "; opacity: .55; }
.us-where i.all { color: var(--ink); font-weight: 600; }
.us-where i.none { opacity: .75; }
.us-act { display: flex; gap: 6px; align-items: center; white-space: nowrap; }
.us-act .tag.off { font-style: normal; font-size: 10.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; border: 1px solid var(--line); border-radius: 4px; padding: 1px 6px; }
.us-h { margin: 20px 0 8px; font-size: 13px; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); }
.us-foot { margin-top: 12px; }
.us-picks { display: grid; gap: 6px; max-height: 320px; overflow: auto; }

@media (max-width: 760px) {
  .us-row { grid-template-columns: minmax(0, 1fr) auto; row-gap: 6px; }
  .us-role { grid-column: 1; font-size: 12px; }
  .us-where { grid-column: 1 / 3; }
  .us-act { grid-column: 2; grid-row: 1; }
  .admin-nav { margin-left: 6px; }
  .admin-nav button { padding: 6px 8px; font-size: 12px; }
}

/* ------------------------------------------------------------ sign in
   Two panels: what this is, and the form. Flat colour rather than gradients, one accent, no
   floating cards and no decorative statistics — the look the brief asked for is professional
   surveying software, and that reads as restraint. */
.signin-body { margin: 0; }
.signin { display: grid; grid-template-columns: 1.05fr 0.95fr; min-height: 100dvh; }

.signin-brand { background: var(--nav, #0b1424); color: #fff; display: grid; place-items: center; padding: 48px 40px; }
.signin-brand-in { max-width: 460px; }
.brand-lg { font-size: 19px; font-weight: 700; margin-bottom: 34px; }
.signin-brand h1 { font-size: 30px; line-height: 1.2; letter-spacing: -0.02em; margin: 0 0 14px; font-weight: 650; }
.signin-brand p { color: rgba(255,255,255,.72); font-size: 14.5px; line-height: 1.55; margin: 0 0 22px; }
.signin-points { list-style: none; margin: 0 0 28px; padding: 0; display: grid; gap: 9px; }
.signin-points li { position: relative; padding-left: 22px; font-size: 13.5px; color: rgba(255,255,255,.86); line-height: 1.45; }
.signin-points li::before { content: ""; position: absolute; left: 2px; top: 7px; width: 7px; height: 7px; border-radius: 2px; background: var(--accent); }
.signin-fine { font-size: 12px; color: rgba(255,255,255,.45); margin: 0; }

.signin-form { display: grid; place-items: center; padding: 40px 28px; background: var(--bg, #f4f6f9); }
.signin-form-in { width: 100%; max-width: 380px; }
.brand-sm-only { display: none; font-size: 17px; font-weight: 700; margin-bottom: 22px; }

@media (max-width: 900px) {
  .signin { grid-template-columns: 1fr; min-height: 0; }
  /* The pitch goes below the form on a phone: somebody on a small screen came here to sign in. */
  .signin-brand { order: 2; padding: 34px 24px; }
  .signin-brand h1 { font-size: 22px; }
  .signin-form { order: 1; padding: 32px 24px; min-height: 60dvh; }
  .brand-sm-only { display: flex; }
}

/* ------------------------------------------------------ authentication pages
   One panel over a site plan. No feature cards, no testimonials, no gradients — the brief asked for
   surveying software rather than a landing page, and that reads as restraint and contrast.

   THE BACKGROUND IS A DRAWING, NOT A PHOTOGRAPH, and that is a privacy decision rather than an
   aesthetic one: this page is public, so a real orthomosaic here would publish a customer's site to
   anyone who loaded it. Drop your own picture at public/img/login-bg.jpg and it is used instead —
   point this one rule at it. It was written as a two-URL fallback so a missing file would drop
   through to the drawing, but a background-image that 404s logs an error on every load, and this
   application asserts a clean console. One source, changed in one place. */
.auth-body { margin: 0; min-height: 100dvh; background: #0b1424; }
.auth-bg {
  position: fixed; inset: 0; z-index: 0;
  background-image: url('/img/login-map.svg');
  background-size: cover; background-position: center;
  filter: saturate(.6) brightness(.62);
}
/* A flat scrim over the picture: the panel needs a fixed contrast to sit on, and an image that
   happens to be pale in one corner must not decide whether the labels are readable. */
.auth-bg::after { content: ""; position: absolute; inset: 0; background: rgba(9, 16, 28, .46); }

.auth-wrap { position: relative; z-index: 1; min-height: 100dvh; display: grid; place-items: center; padding: 32px 20px; }
.auth-card {
  width: 100%; max-width: 396px; background: var(--panel, #fff);
  border: 1px solid rgba(255,255,255,.10); border-radius: 12px;
  padding: 30px 30px 24px; box-shadow: 0 18px 50px rgba(0,0,0,.34);
}
.auth-brand { display: flex; align-items: center; gap: 9px; font-size: 16px; font-weight: 700; letter-spacing: -0.01em; margin-bottom: 22px; }
.auth-card h1 { font-size: 22px; letter-spacing: -0.02em; margin: 0 0 4px; font-weight: 650; }
.auth-lede { margin: 0 0 20px; color: var(--muted); font-size: 13.5px; }
.auth-card .field { margin-bottom: 14px; }
.auth-card label { display: block; font-size: 12.5px; font-weight: 600; margin-bottom: 5px; }
.auth-card .two { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }

/* The show/hide control sits inside the field, and the input is padded so text never runs under it. */
.input-with-btn { position: relative; }
.input-with-btn .input { width: 100%; padding-right: 62px; }
.reveal {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  border: 0; background: transparent; color: var(--muted);
  font-size: 12px; font-weight: 650; padding: 6px 8px; border-radius: 6px; cursor: pointer;
}
.reveal:hover { color: var(--ink); background: var(--line-2, #eef1f5); }

.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin: 2px 0 16px; }
.auth-row .checkbox { font-size: 12.5px; color: var(--muted); }
.linkish { border: 0; background: transparent; color: var(--blue); font-size: 12.5px; font-weight: 600; cursor: pointer; padding: 0; }
.linkish:hover { text-decoration: underline; }

.auth-card .warn { margin: 0 0 14px; font-size: 12.5px; }
.auth-foot { margin: 18px 0 0; text-align: center; font-size: 13px; color: var(--muted); }
.auth-note { margin: 8px 0 0; text-align: center; font-size: 11.5px; color: var(--muted); opacity: .8; line-height: 1.45; }

/* Focus has to be visible on a page whose whole job is a form. */
.auth-card .input:focus-visible, .auth-card .btn:focus-visible, .reveal:focus-visible, .linkish:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

@media (max-width: 420px) {
  .auth-card { padding: 24px 20px 20px; border-radius: 10px; }
  .auth-card .two { grid-template-columns: 1fr; gap: 0; }
}
