/* ============================================================
   DEFUSE R — design foundation
   Brand language drawn from the VIDA contractor-portal guide:
   hazard strip, midnight masthead, hi-vis amber action colour.
   ============================================================ */
:root {
  --rail-blue:#2774ae;
  --roads-orange:#ff9d14;     /* hi-vis amber — primary action */
  --services-orange:#ff5700;  /* danger / alert */
  --ai-violet:#7c4dff;        /* AI actions (Capture / Walk) — distinct from amber */
  --ai-violet-2:#9d6bff;
  --midnight:#002532;         /* dominant industrial dark */
  --midnight-2:#001820;
  --asphalt:#1a1f24;
  --slate:#3f4447;
  --concrete:#5a5b5d;
  --paper:#f5f1ec;
  --line:rgba(255,255,255,0.12);
  --line-strong:rgba(255,255,255,0.28);
  --hazard-yellow:#ffeb2c;
  --ok:#22c55e;
  --warn:#ff9d14;
  --down:#f85149;

  --font-display:"Barlow Condensed",Impact,sans-serif;
  --font-body:"Public Sans",system-ui,sans-serif;
  --font-mono:"JetBrains Mono",ui-monospace,monospace;

  --topbar-h:64px;
  --hazard-h:10px;
}

* { box-sizing:border-box; margin:0; padding:0; }
html, body {
  background:var(--paper);
  color:var(--asphalt);
  font-family:var(--font-body);
  font-size:15px; line-height:1.5;
  -webkit-font-smoothing:antialiased;
  -webkit-text-size-adjust:100%;
}
a { color:inherit; text-decoration:none; }
img { display:block; max-width:100%; }
h1,h2,h3 { font-family:var(--font-display); text-transform:uppercase; letter-spacing:0.01em; line-height:1; }
/* <FocusOnNavigate> focuses the page <h1> after navigation (screen-reader context) by
   giving it tabindex="-1"; it isn't interactive, so hide the resulting focus outline. */
[tabindex="-1"]:focus { outline: none; }

/* ---- boot screen (pre-WASM) ---- */
.boot-screen { position:relative; overflow:hidden; min-height:100vh; display:flex; flex-direction:column;
  align-items:center; justify-content:center; gap:0; padding:40px 20px; color:#fff;
  background:radial-gradient(circle at 50% 32%, #013242 0%, var(--midnight) 58%, #001016 100%); }
/* industrial hazard strips top + bottom */
.boot-hazard { position:absolute; left:0; right:0; height:8px;
  background:repeating-linear-gradient(135deg, var(--hazard-yellow) 0 14px, var(--asphalt) 14px 28px); }
.boot-hazard.top { top:0; } .boot-hazard.bottom { bottom:0; }
.boot-inner { z-index:2; display:flex; flex-direction:column; align-items:center; gap:18px; width:100%; max-width:520px; }
.boot-logo { height:62px; width:auto; max-width:90%; filter:drop-shadow(0 4px 18px rgba(0,0,0,.45)); }
.boot-scene { width:100%; max-width:480px; height:auto; opacity:.96;
  animation:boot-float 4.5s ease-in-out infinite; transform-origin:50% 100%; }
@keyframes boot-float { 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(-5px); } }
.boot-sub  { font-family:var(--font-mono); font-size:12px; letter-spacing:0.2em; text-transform:uppercase; color:#9aa3aa; }
/* indeterminate hazard-striped loading bar */
.boot-bar { position:relative; width:220px; height:6px; border-radius:3px; overflow:hidden; background:rgba(255,255,255,.12); }
.boot-bar span { position:absolute; top:0; bottom:0; width:42%; border-radius:3px;
  background:repeating-linear-gradient(135deg, var(--hazard-yellow) 0 8px, var(--asphalt) 8px 16px);
  animation:boot-sweep 1.25s ease-in-out infinite; }
@keyframes boot-sweep { 0%{ left:-42%; } 100%{ left:100%; } }
/* footer brand: VIDA Roads plate + tagline */
.boot-foot { position:absolute; bottom:26px; z-index:2; display:flex; flex-direction:column; align-items:center; gap:8px; }
.boot-plate { background:#fff; border-radius:6px; padding:7px 14px; display:flex; align-items:center;
  box-shadow:0 4px 16px rgba(0,0,0,.35); }
.boot-plate img { height:30px; width:auto; display:block; }
.boot-tag { font-family:var(--font-mono); font-size:11px; letter-spacing:0.18em; text-transform:uppercase; color:#5c6b73; }
/* update notice — shown when the startup version check finds a newer build */
.boot-update { display:flex; align-items:center; gap:14px; max-width:360px; padding:14px 18px;
  border:1px solid rgba(255,157,20,.55); border-radius:12px; background:rgba(255,157,20,.10);
  box-shadow:0 8px 28px rgba(0,0,0,.35); text-align:left; animation:boot-update-in .35s ease-out; }
.boot-update[hidden] { display:none; }
.boot-update-icon { width:30px; height:30px; flex:none; color:var(--roads-orange);
  animation:boot-bob 1.6s ease-in-out infinite; }
.boot-update-text { display:flex; flex-direction:column; gap:4px; }
.boot-update-text strong { font-family:var(--font-display); text-transform:uppercase;
  letter-spacing:0.04em; font-size:18px; color:#fff; }
.boot-update-sub { font-size:12.5px; line-height:1.45; color:#cdd5da; }
/* while updating, the generic "loading…" line is redundant — the notice says it all */
.boot-screen.is-updating .boot-sub { display:none; }
@keyframes boot-update-in { from { opacity:0; transform:translateY(8px); } to { opacity:1; transform:none; } }
@keyframes boot-bob { 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(4px); } }
@media (prefers-reduced-motion: reduce) { .boot-scene, .boot-bar span, .boot-update-icon { animation:none; } }

/* ============= APP SHELL ============= */
.app-shell { min-height:100vh; display:flex; flex-direction:column; }
.hazard-strip {
  height:var(--hazard-h);
  background:repeating-linear-gradient(135deg, var(--hazard-yellow) 0 16px, var(--asphalt) 16px 32px);
  border-bottom:1px solid #000;
}

/* ---- masthead / topbar ---- */
.masthead {
  background:var(--midnight);
  border-bottom:3px solid var(--roads-orange);
  position:sticky; top:0; z-index:50;
}
.nav-row { display:flex; align-items:stretch; gap:0; padding:0 20px; min-height:var(--topbar-h); }

.brand-lockup { display:flex; align-items:center; gap:14px; padding:10px 22px 10px 0; border-right:1px solid var(--line); }
.brand-plate { background:#fff; border-radius:6px; padding:7px 12px; display:flex; align-items:center; }
.brand-plate img { height:26px; width:auto; }
.brand-suffix { font-family:var(--font-display); font-weight:900; font-size:24px; letter-spacing:0.06em;
  color:#fff; text-transform:uppercase; }
.brand-suffix .x { color:var(--roads-orange); }

/* ---- primary nav ---- */
nav.primary { display:flex; flex:1; align-items:stretch; overflow-x:auto; }
nav.primary a {
  display:flex; align-items:center; gap:9px; padding:0 18px; white-space:nowrap;
  font-family:var(--font-display); font-weight:700; font-size:15px; letter-spacing:0.05em;
  text-transform:uppercase; color:#cbd3d9; border-right:1px solid var(--line);
  transition:background .15s, color .15s; position:relative;
}
nav.primary a:first-child { border-left:1px solid var(--line); }
nav.primary a:hover { background:var(--midnight-2); color:#fff; }
nav.primary a.active { color:#fff; background:var(--midnight-2); }
/* bottom:0 (not -3px): keep the underline INSIDE the nav box. nav.primary has
   overflow-x:auto, which forces overflow-y to auto too — a pseudo-element poking
   3px below the box adds vertical overflow → a stray vertical scrollbar on the
   navbar whenever a tab is active. */
nav.primary a.active::before { content:""; position:absolute; left:0; right:0; bottom:0; height:3px; background:var(--roads-orange); }
nav.primary a svg { width:18px; height:18px; flex:0 0 18px; color:var(--roads-orange); }

/* ---- right side: connectivity + user ---- */
.nav-aside { display:flex; align-items:center; gap:14px; margin-left:auto; padding-left:18px; }
/* Connectivity indicator: colour only (no text) — glows green online, red offline. */
.net-pill {
  display:inline-flex; align-items:center; justify-content:center; border:1px solid var(--line-strong);
  padding:7px; cursor:pointer; background:transparent; border-radius:50%;
}
.net-pill .dot { width:12px; height:12px; border-radius:50%; transition:background .3s ease; }
.net-pill.online  .dot { background:var(--ok);   animation:net-glow-ok 2.2s ease-in-out infinite; }
.net-pill.offline .dot { background:var(--down); animation:net-glow-down 2.2s ease-in-out infinite; }
.net-pill:hover { border-color:var(--roads-orange); }
@keyframes net-glow-ok   { 0%,100% { box-shadow:0 0 5px 1px var(--ok);   } 50% { box-shadow:0 0 12px 3px var(--ok);   } }
@keyframes net-glow-down { 0%,100% { box-shadow:0 0 5px 1px var(--down); } 50% { box-shadow:0 0 12px 3px var(--down); } }

/* User chip is now a button that opens a Sign-out dropdown (clicking it no longer logs out). */
.user-menu { position:relative; }
.user-chip { display:flex; align-items:center; gap:8px; color:#cbd3d9; font-size:13px;
  background:transparent; border:none; cursor:pointer; font-family:inherit; padding:4px 6px; border-radius:6px; }
.user-chip:hover { background:rgba(255,255,255,.08); }
.user-chip .avatar { width:30px; height:30px; border-radius:50%; background:var(--roads-orange); color:#000;
  display:flex; align-items:center; justify-content:center; font-weight:800; font-family:var(--font-display); }
.user-chip .caret { color:#cbd3d9; font-size:11px; }
.user-dropdown { position:absolute; right:0; top:calc(100% + 8px); min-width:180px; background:#fff;
  border:1px solid rgba(0,0,0,.12); border-radius:8px; box-shadow:0 10px 30px rgba(0,0,0,.3); padding:6px; z-index:1200; }
.user-dropdown-name { padding:8px 10px; font-size:12px; color:#5a6470; border-bottom:1px solid rgba(0,0,0,.08);
  margin-bottom:4px; word-break:break-word; }
.user-dropdown-item { display:block; width:100%; text-align:left; background:transparent; border:none;
  padding:9px 10px; font-size:14px; color:#221f20; cursor:pointer; border-radius:6px; font-family:inherit; }
.user-dropdown-item:hover { background:rgba(0,0,0,.06); }
/* Below the sticky masthead (z-index:50) so the dropdown — which lives inside the
   masthead's stacking context — paints ABOVE the scrim and stays clickable, while the
   scrim still covers page content to catch outside clicks. */
.menu-scrim { position:fixed; inset:0; z-index:40; background:transparent; }

/* ---- mobile nav toggle ---- */
.nav-burger { display:none; background:transparent; border:1px solid var(--line-strong); color:#fff;
  padding:8px 10px; cursor:pointer; align-self:center; }

/* ============= MAIN CONTENT ============= */
.layout-main { flex:1; width:100%; max-width:1480px; margin:0 auto; padding:28px 24px 96px; }
.page-head { display:flex; align-items:flex-end; justify-content:space-between; gap:24px; flex-wrap:wrap; margin-bottom:24px; }
.page-head .eyebrow { font-family:var(--font-mono); font-size:11px; letter-spacing:0.22em; text-transform:uppercase;
  color:var(--services-orange); margin-bottom:10px; display:flex; align-items:center; gap:10px; }
.page-head .eyebrow::before { content:""; width:28px; height:2px; background:var(--services-orange); display:inline-block; }
.page-head h1 { font-size:clamp(34px,5vw,56px); font-weight:900; color:var(--asphalt); }
/* Action buttons in a page header — flex so icon + text buttons line up (their
   baselines differ otherwise, e.g. an AiSpark button next to a text-only one). */
.head-actions { display:flex; align-items:center; gap:10px; flex-wrap:wrap; }

/* Shared line icons (Icon.razor) — sit on the text baseline when used inline. */
.ico { vertical-align:-0.15em; flex-shrink:0; }

/* Sortable table headers (click to sort; arrow shows the active column/direction). */
.data-table th.sortable { cursor:pointer; user-select:none; white-space:nowrap; }
.data-table th.sortable:hover { color:var(--roads-orange); }

/* ---- cards / tiles ---- */
.tile-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(220px,1fr)); gap:1px; background:rgba(0,0,0,.1);
  border:1px solid rgba(0,0,0,.1); margin-bottom:24px; }
.tile { background:#fff; padding:24px; display:flex; flex-direction:column; gap:6px; position:relative; transition:background .15s; }
.tile .k { font-family:var(--font-mono); font-size:10px; letter-spacing:0.18em; text-transform:uppercase; color:var(--concrete); }
.tile .v { font-family:var(--font-display); font-weight:800; font-size:38px; line-height:1; color:var(--asphalt); }
.tile .sub { font-size:13px; color:var(--slate); }

.card { background:#fff; border:1px solid rgba(0,0,0,.12); padding:22px; }
.card h2, .card h3 { color:var(--asphalt); margin-bottom:12px; }
.card-grid { display:grid; grid-template-columns:repeat(auto-fill,minmax(280px,1fr)); gap:16px; }

/* ---- buttons ---- */
.btn { font-family:var(--font-display); font-weight:800; text-transform:uppercase; letter-spacing:0.06em;
  font-size:14px; padding:13px 22px; display:inline-flex; align-items:center; gap:10px; border:none; cursor:pointer; transition:all .15s; }
.btn-primary { background:var(--roads-orange); color:#000; clip-path:polygon(9px 0,100% 0,calc(100% - 9px) 100%,0 100%); }
.btn-primary:hover { background:#ffb84d; }
/* AI actions — same rhombus shape as primary, violet to signal "AI" */
.btn-ai { background:var(--ai-violet); color:#fff; clip-path:polygon(9px 0,100% 0,calc(100% - 9px) 100%,0 100%); }
.btn-ai:hover { background:var(--ai-violet-2); }
.btn-ai-ghost { background:transparent; color:var(--ai-violet); border:1px solid rgba(124,77,255,.45); clip-path:polygon(9px 0,100% 0,calc(100% - 9px) 100%,0 100%); }
.btn-ai-ghost:hover { background:rgba(124,77,255,.08); border-color:var(--ai-violet); }
.btn-ghost { background:transparent; color:var(--asphalt); border:1px solid rgba(0,0,0,.25); }
.btn-ghost:hover { border-color:var(--roads-orange); color:var(--services-orange); }
.btn:disabled { opacity:.5; cursor:not-allowed; }
button.ghost { background:transparent; border:1px solid rgba(0,0,0,.25); padding:7px 14px; cursor:pointer; font-family:var(--font-body); font-size:13px; }
button.ghost:hover:not(:disabled) { border-color:var(--roads-orange); }
button.ghost:disabled { opacity:.45; cursor:not-allowed; }
.link { background:none; border:none; color:var(--rail-blue); cursor:pointer; padding:0; font:inherit; text-decoration:underline; }
.link.danger { color:var(--services-orange); }

/* ---- badges / status ---- */
.tag { font-family:var(--font-mono); font-size:10px; letter-spacing:0.12em; text-transform:uppercase; padding:3px 8px; border:1px solid rgba(0,0,0,.2); }
.badge { display:inline-block; font-size:11px; font-weight:600; padding:2px 9px; border-radius:999px; }
.badge.amber { background:rgba(255,157,20,.16); color:#9a5b00; }
.badge.blue  { background:rgba(39,116,174,.16); color:#1c5582; }
.badge.green { background:rgba(34,197,94,.16); color:#157a3a; }
.badge.grey  { background:rgba(0,0,0,.08); color:var(--slate); }
.badge.red   { background:rgba(224,50,45,.16); color:#b3261e; }

/* expandable defect rows (Defects page + Projects defects modal) */
.data-table tr.rowexpand { cursor:pointer; }
.data-table tr.rowexpand:hover { background:rgba(0,0,0,.03); }
.data-table tr.expanded { background:rgba(255,87,0,.07); }
.data-table tr.detail-row > td { background:rgba(0,0,0,.02); padding:14px 16px; }

.ok { color:var(--ok); font-weight:700; }
.down { color:var(--down); font-weight:700; }
.warn { color:var(--warn); font-weight:700; }
.muted { color:var(--concrete); }
.small { font-size:12px; }
.mono { font-family:var(--font-mono); }

/* ---- tables ---- */
.table-wrap { overflow-x:auto; border:1px solid rgba(0,0,0,.12); background:#fff; }
table.data-table { width:100%; border-collapse:collapse; font-size:14px; }
.data-table th { text-align:left; font-family:var(--font-mono); font-size:10px; letter-spacing:0.12em; text-transform:uppercase;
  color:var(--concrete); padding:12px 14px; border-bottom:1px solid rgba(0,0,0,.12); white-space:nowrap; }
.data-table td { padding:11px 14px; border-bottom:1px solid rgba(0,0,0,.06); }
.data-table tr:hover td { background:#fffbf3; }

/* ---- forms ---- */
label.field { display:block; margin-bottom:14px; }
label.field > span { display:block; font-family:var(--font-mono); font-size:10px; letter-spacing:0.12em;
  text-transform:uppercase; color:var(--concrete); margin-bottom:5px; }
input[type=text], input[type=email], input[type=password], input[type=number],
input[type=date], input[type=datetime-local], input[type=time], textarea, select {
  width:100%; padding:10px 12px; border:1px solid rgba(0,0,0,.22); background:#fff; font:inherit; color:var(--asphalt); }
textarea { min-height:84px; resize:vertical; }
input:focus, textarea:focus, select:focus { outline:2px solid var(--roads-orange); outline-offset:-1px; }

/* ============= MAP COMPONENT (ported) ============= */
.map-wrap { border:1px solid rgba(0,0,0,.14); background:#fff; position:relative; }
.map-canvas { width:100%; height:440px; }
/* on-map overlays (replaced the old top toolbar) */
.map-status, .map-hint { position:absolute; bottom:10px; z-index:5; background:rgba(255,255,255,.92);
  border:1px solid rgba(0,0,0,.12); border-radius:6px; padding:4px 9px; font-size:12px; color:#5a6470; pointer-events:none; }
.map-status { left:10px; font-family:var(--font-mono); letter-spacing:.04em; text-transform:uppercase; }
.map-hint { right:10px; }
/* hovered-project locator — a pulsing ring at the boundary centre so even tiny areas are obvious */
.boundary-highlight { width:12px; height:12px; border-radius:50%; background:#ff5700;
  border:2px solid #fff; pointer-events:none; animation:bh-pulse 1.3s ease-out infinite; }
@keyframes bh-pulse { 0% { box-shadow:0 0 0 0 rgba(255,87,0,.55); } 100% { box-shadow:0 0 0 34px rgba(255,87,0,0); } }
/* Pin sizes + stacking when defect / photo / walk-start overlap:
   photo (exif, smallest, in front) ‹ defect ‹ walk-start (manual, largest, behind).
   z-index is !important to beat MapLibre's per-marker inline z-index (lat-based). */
.map-pin { width:16px; height:16px; border-radius:50% 50% 50% 0; background:var(--rail-blue); transform:rotate(-45deg);
  border:2px solid #fff; box-shadow:0 1px 4px rgba(0,0,0,.4); cursor:pointer; z-index:6 !important; }
.map-pin.manual { background:var(--services-orange); width:24px; height:24px; z-index:2 !important; }

/* Directional photo pin — points in the compass bearing the photo was taken at.
   MapLibre owns the transform of the element it positions, so the rotatable
   pin lives on a CHILD (.map-pin-arrow) of a neutral wrapper (.map-pin-wrap)
   that MapLibre positions (anchor:center → wrapper centre = the geo point). */
.map-pin-wrap { position:absolute; width:0; height:0; z-index:6 !important; cursor:pointer; }
/* 0×0 box pinned at the geo point; transform-origin at that point so the inline
   rotate(bearing) pivots about the location. The ::before triangle is the
   pointer (apex north at 0°), its base on the point; ::after is the hub dot. */
.map-pin-arrow { position:absolute; left:0; top:0; width:0; height:0; transform-origin:0 0; }
.map-pin-arrow::before { content:""; position:absolute; left:-8px; bottom:0;
  border-left:8px solid transparent; border-right:8px solid transparent;
  border-bottom:26px solid var(--rail-blue);
  filter:drop-shadow(0 1px 2px rgba(0,0,0,.45)); }
.map-pin-arrow::after { content:""; position:absolute; left:-6px; top:-6px;
  width:12px; height:12px; border-radius:50%; background:#fff;
  box-shadow:0 0 0 3px var(--rail-blue), 0 1px 3px rgba(0,0,0,.4); }
.map-pin-arrow.manual::before { border-bottom-color:var(--services-orange); }
.map-pin-arrow.manual::after  { box-shadow:0 0 0 3px var(--services-orange), 0 1px 3px rgba(0,0,0,.4); }
/* hover-highlight: pulse the hub (transform is taken by the bearing rotation). */
.map-pin-arrow.hl { z-index:10 !important; }
.map-pin-arrow.hl::after { animation:pin-pulse 1.1s ease-out infinite; }
/* hover-highlight a pin (e.g. hovering its thumbnail in the defect detail gallery).
   MapLibre sets an inline transform on marker elements, so the highlight is an
   animated box-shadow PULSE (transform-independent) rather than a scale. */
.map-pin.hl { z-index:10 !important; animation:pin-pulse 1.1s ease-out infinite; }
@keyframes pin-pulse {
  0%   { box-shadow:0 0 0 0 rgba(255,87,0,.7); }
  70%  { box-shadow:0 0 0 16px rgba(255,87,0,0); }
  100% { box-shadow:0 0 0 0 rgba(255,87,0,0); }
}
/* defect markers plotted when a project is selected (colour-coded by severity) */
.defect-pin { width:18px; height:18px; border-radius:50%; background:#e0322d; border:2px solid #fff;
  box-shadow:0 1px 4px rgba(0,0,0,.45); cursor:pointer; z-index:4 !important; }
.defect-pin.sev-minor { background:#2e9e4f; }
.defect-pin.sev-moderate { background:#e8a317; }
.defect-pin.sev-major { background:#e0322d; }
.defect-pin.sev-critical { background:#a01313; }

/* ============= FOOTER ============= */
.site-footer { background:#000; border-top:4px solid var(--roads-orange); color:#9aa3aa;
  padding:14px 24px; display:flex; align-items:center; justify-content:space-between; gap:18px; flex-wrap:wrap;
  font-family:var(--font-mono); font-size:11px; letter-spacing:0.12em; text-transform:uppercase; }
.site-footer .wordmark { font-family:var(--font-display); font-weight:800; color:#fff; letter-spacing:0.08em; }
.site-footer .wordmark .x { color:var(--roads-orange); }

/* ============= FILTER TABS ============= */
.filter-tabs { display:flex; gap:2px; flex-wrap:wrap; margin-bottom:20px; border-bottom:2px solid rgba(0,0,0,.1); }
.filter-tab { background:transparent; border:none; border-bottom:3px solid transparent; margin-bottom:-2px; cursor:pointer;
  font-family:var(--font-display); font-weight:700; font-size:15px; text-transform:uppercase; letter-spacing:0.04em;
  color:var(--concrete); padding:10px 16px; display:inline-flex; align-items:center; gap:8px; }
.filter-tab:hover { color:var(--asphalt); }
.filter-tab.active { color:var(--asphalt); border-bottom-color:var(--roads-orange); }
.filter-tab .count { font-family:var(--font-mono); font-size:11px; background:rgba(0,0,0,.08); border-radius:999px; padding:1px 7px; }
.filter-tab.active .count { background:rgba(255,157,20,.22); color:#9a5b00; }

/* ============= PROJECTS ============= */
.proj-layout { display:grid; grid-template-columns:minmax(280px,1fr) minmax(360px,1.3fr); gap:18px; align-items:start; }
.proj-list { display:flex; flex-direction:column; gap:12px; max-height:560px; overflow-y:auto; }
.proj-card-head { display:flex; align-items:flex-start; justify-content:space-between; gap:10px; }
.proj-card h3 { font-size:20px; }
.proj-meta { display:flex; gap:8px; flex-wrap:wrap; margin:10px 0 6px; }
.proj-map { position:sticky; top:84px; }
.pin { background:none; border:none; cursor:pointer; font-size:22px; line-height:1; color:var(--concrete); }
.pin.on { color:var(--roads-orange); }
@media (max-width:860px){ .proj-layout { grid-template-columns:1fr; } .proj-map { position:static; } }

/* ============= CONFLICTS ============= */
.conflict-card { border-top:4px solid var(--services-orange); margin-bottom:20px; }
.conflict-item { border:1px solid rgba(0,0,0,.12); padding:14px; margin-top:12px; }
.conflict-head { display:flex; justify-content:space-between; align-items:center; margin-bottom:10px; }
.conflict-field { display:grid; grid-template-columns:120px 1fr 1fr; gap:8px; align-items:stretch; margin-bottom:8px; }
.cf-name { font-family:var(--font-mono); font-size:11px; letter-spacing:.1em; text-transform:uppercase; color:var(--concrete); align-self:center; }
.cf-choice { display:flex; align-items:center; gap:8px; border:1px solid rgba(0,0,0,.18); padding:8px 10px; cursor:pointer; font-size:13px; }
.cf-choice.sel { border-color:var(--roads-orange); background:rgba(255,157,20,.08); }
.cf-tag { font-family:var(--font-display); font-weight:700; text-transform:uppercase; font-size:11px; letter-spacing:.04em; }
.cf-val { color:var(--slate); overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
.conflict-item .btn-primary { margin-top:6px; }
@media (max-width:620px){ .conflict-field { grid-template-columns:1fr; } }

/* ============= TOOLBAR ============= */
.toolbar { display:flex; align-items:center; gap:14px; margin-bottom:14px; flex-wrap:wrap; }

/* ============= WIZARD ============= */
.wizard-steps { list-style:none; display:flex; gap:4px; flex-wrap:wrap; margin-bottom:18px; }
.wizard-steps li { display:flex; align-items:center; gap:8px; padding:8px 14px; font-family:var(--font-display); font-weight:700;
  text-transform:uppercase; letter-spacing:0.04em; font-size:13px; color:var(--concrete); background:#fff; border:1px solid rgba(0,0,0,.1); }
.wizard-steps li.active { color:var(--asphalt); border-bottom:3px solid var(--roads-orange); }
.wizard-steps li.done { color:var(--ok); }
.wizard-steps .num { width:22px; height:22px; border-radius:50%; background:rgba(0,0,0,.07); display:inline-flex; align-items:center; justify-content:center; font-size:12px; }
.wizard-steps li.active .num { background:var(--roads-orange); color:#000; }
.wizard-nav { display:flex; align-items:center; gap:14px; margin-top:18px; }
.wizard-nav .btn-primary { margin-left:auto; }

.form-grid { display:grid; grid-template-columns:1fr 1fr; gap:0 16px; }
.form-grid .span2 { grid-column:1 / -1; }
@media (max-width:620px){ .form-grid { grid-template-columns:1fr; } }

.media-grid { display:flex; flex-wrap:wrap; gap:10px; }
.media-grid.pool { min-height:96px; padding:8px; background:#faf8f4; border:1px dashed rgba(0,0,0,.18); }
.media-tile { position:relative; width:92px; height:92px; border:1px solid rgba(0,0,0,.15); background:#eee; overflow:hidden; }
.media-tile.sm { width:60px; height:60px; }
.media-tile img { width:100%; height:100%; object-fit:cover; }
.media-vid { width:100%; height:100%; display:flex; align-items:center; justify-content:center; font-size:28px; background:#222; }
.media-x { position:absolute; top:2px; right:2px; width:20px; height:20px; border:none; border-radius:50%; background:rgba(0,0,0,.6);
  color:#fff; cursor:pointer; line-height:1; font-size:14px; }
.media-gps { position:absolute; top:2px; left:2px; font-size:12px; line-height:1; padding:2px 4px;
  background:rgba(0,0,0,.6); border-radius:5px; color:#fff; }

.defects-layout { display:grid; grid-template-columns:200px 1fr; gap:18px; align-items:start; }
@media (max-width:720px){ .defects-layout { grid-template-columns:1fr; } }
.sub-h { font-family:var(--font-display); text-transform:uppercase; font-size:14px; letter-spacing:.04em; margin-bottom:8px; }
.occ-card { border:1px solid rgba(0,0,0,.14); padding:14px; margin-bottom:14px; }
.occ-head { display:flex; gap:8px; align-items:center; margin-bottom:10px; }
.occ-title { flex:1; font-weight:600; }
.media-grid.drop { min-height:70px; margin-top:8px; padding:6px; background:#faf8f4; border:1px dashed rgba(0,0,0,.18); align-items:center; }
.drop-hint { color:var(--concrete); font-size:12px; }

/* ============= LOGIN ============= */
.login-shell { min-height:100vh; background:linear-gradient(135deg,#001820 0%,var(--midnight) 55%,#002a3a 100%); }
.login-wrap { display:flex; align-items:center; justify-content:center; padding:48px 16px; min-height:calc(100vh - var(--hazard-h)); }
.login-card { background:#fff; width:100%; max-width:420px; padding:34px 30px; border-top:4px solid var(--roads-orange); }
.login-brand { display:flex; align-items:center; justify-content:space-between; gap:16px; margin-bottom:18px; }
/* VIDA Roads (left) + DEFUSE (right) on the auth screens — matched height, centred. */
.login-logo { height:38px; width:auto; max-width:48%; object-fit:contain; display:block; }
.login-error { background:rgba(255,87,0,.1); border:1px solid var(--services-orange); color:#9a2b00; padding:9px 12px; font-size:13px; margin-bottom:14px; }
.login-demo { margin-top:20px; padding-top:16px; border-top:1px solid rgba(0,0,0,.1); display:flex; align-items:center; gap:8px; flex-wrap:wrap; }

/* ============= ERROR UI ============= */
#blazor-error-ui { display:none; position:fixed; bottom:0; width:100%; background:var(--services-orange);
  color:#000; padding:10px 16px; font-family:var(--font-mono); font-size:13px; z-index:1000; }
#blazor-error-ui .reload { text-decoration:underline; }
#blazor-error-ui .dismiss { cursor:pointer; float:right; }

/* ============= RESPONSIVE ============= */
/* Bottom mobile nav + "desktop-only" helper are hidden until the phone breakpoint. */
.mobile-nav { display:none; }
@media (max-width:980px){
  nav.primary a span { display:none; }
  nav.primary a { padding:0 14px; }
}
@media (max-width:760px){
  .nav-burger { display:inline-flex; }
  nav.primary { position:absolute; top:var(--topbar-h); left:0; right:0; flex-direction:column; background:var(--midnight);
    border-top:1px solid var(--line); display:none; z-index:60; }
  nav.primary.open { display:flex; }
  nav.primary a { padding:14px 20px; border-right:none; border-bottom:1px solid var(--line); }
  nav.primary a span { display:inline; }
  nav.primary a.active::before { display:none; }
  nav.primary a.active { border-left:3px solid var(--roads-orange); }
  .brand-lockup { border-right:none; padding-right:10px; }
  .brand-suffix { font-size:20px; }
  .layout-main { padding:18px 14px 96px; }   /* clears the fixed bottom nav */
  .map-canvas { height:340px; }
  .nav-aside .user-chip span.uname { display:none; }

  /* hide elements not needed on mobile (e.g. Bulk Edit) */
  .hide-mobile { display:none !important; }

  /* page head + action rows stack; buttons become comfortable full-width taps */
  .page-head { gap:14px; margin-bottom:18px; }
  .page-head h1 { font-size:30px; }
  .page-head > div:last-child { width:100%; }
  .head-actions { width:100%; }
  .head-actions .btn { flex:1 1 40%; justify-content:center; padding:13px 14px; }
  .toolbar, .filter-tabs { flex-wrap:wrap; gap:8px; }
  .btn { padding:12px 16px; }
  /* tables stay swipe-scrollable; tighten so more fits on a narrow screen */
  .data-table { font-size:13px; }
  .data-table th, .data-table td { padding:9px 10px; }

  /* ---- fixed bottom section nav (cut-down mobile UI) ---- */
  .site-footer { display:none; }   /* replaced by the bottom nav on phones */
  .mobile-nav { display:flex; position:fixed; left:0; right:0; bottom:0; z-index:70;
    background:var(--midnight); border-top:2px solid var(--roads-orange);
    padding-bottom:env(safe-area-inset-bottom); }
  .mobile-nav a { flex:1; min-width:0; display:flex; flex-direction:column; align-items:center; justify-content:center;
    gap:3px; padding:8px 2px 7px; min-height:56px; text-decoration:none;
    font-family:var(--font-body); font-size:10px; letter-spacing:.02em; color:#9aa3aa; }
  .mobile-nav a svg { width:22px; height:22px; color:#9aa3aa; }
  .mobile-nav a span { max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap; }
  .mobile-nav a.active { color:#fff; }
  .mobile-nav a.active svg { color:var(--roads-orange); }
}
