/* =============================================================================
   AEONIS · 4D Construction Monitor
   Glassmorphism dark UI + ArcGIS widget overrides
   ============================================================================= */

/* ---------- Design tokens ---------- */
:root {
  --bg: #060912;
  --glass: rgba(6, 9, 16, 0.66);
  --glass-strong: rgba(4, 6, 12, 0.85);
  --glass-border: rgba(140, 170, 230, 0.18);
  --glass-border-soft: rgba(140, 170, 230, 0.1);
  --text: #e8eefc;
  --text-dim: #c2cfee; /* brighter body text — WCAG AA on glass */
  --text-faint: #aab6d4; /* lifted from #5f6f93 for legibility */
  --label: #d1d5db; /* crisp light gray for subheadings */
  --accent: #38e2ea; /* neon cyan */
  --accent-bright: #48dfe5; /* luminous cyan for accent labels */
  --accent-2: #7c5cff; /* violet */
  --accent-3: #4ade80; /* mint (brightened for status text) */
  --glow-cyan: 0 0 8px rgba(72, 223, 229, 0.4); /* subtle neon glow */
  --danger: #fb7185;
  --radius: 18px;
  --blur: 22px;
  --shadow: 0 24px 60px -24px rgba(0, 0, 0, 0.85);
  --font: "Inter", "Segoe UI", system-ui, -apple-system, sans-serif;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  height: 100%;
  width: 100%;
  overflow: hidden;
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  -webkit-font-smoothing: antialiased;
}

#viewDiv {
  position: absolute;
  inset: 0;
}

/* Subtle vignette + scanline atmosphere over the scene */
#viewDiv::after {
  content: "";
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(120% 90% at 50% 18%, transparent 55%, rgba(2, 4, 10, 0.55) 100%);
  z-index: 1;
}

/* ---------- Reusable glass surface ---------- */
.glass {
  background: var(--glass);
  backdrop-filter: blur(var(--blur)) saturate(140%);
  -webkit-backdrop-filter: blur(var(--blur)) saturate(140%);
  border: 1px solid var(--glass-border);
  box-shadow: var(--shadow), inset 0 1px 0 rgba(255, 255, 255, 0.06);
  border-radius: var(--radius);
}

.phone-notice {
  position: fixed;
  inset: 0;
  display: flex;
  padding: 24px;
  overflow: auto;
  background: var(--bg);
}
.phone-notice__card {
  width: min(100%, 480px);
  margin: auto;
  padding: clamp(24px, 5vw, 40px);
}
.phone-notice__icon {
  display: block;
  width: 56px;
  height: 56px;
  margin: 32px 0 20px;
  fill: none;
  stroke: var(--accent);
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}
.phone-notice h1 { margin: 0; font-size: clamp(1.5rem, 6vw, 2rem); line-height: 1.2; }
.phone-notice p { margin: 16px 0 0; color: var(--text-dim); font-size: .95rem; line-height: 1.6; }
.phone-notice .phone-notice__url {
  padding: 12px;
  border: 1px solid var(--glass-border);
  border-radius: 8px;
  background: var(--bg);
  color: var(--accent);
  font-size: .85rem;
  overflow-wrap: anywhere;
  -webkit-user-select: all;
  user-select: all;
}
.phone-notice .brand:focus-visible { outline: 2px solid var(--accent); outline-offset: 4px; }

.kicker {
  display: block;
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--label);
  font-weight: 700;
}

/* =============================================================================
   Boot veil
   ============================================================================= */
.boot {
  position: absolute;
  inset: 0;
  z-index: 50;
  display: grid;
  place-content: center;
  gap: 22px;
  justify-items: center;
  background: #05070e;
  transition: opacity 0.6s ease, visibility 0.6s ease;
}
.boot.is-hidden {
  opacity: 0;
  visibility: hidden;
}
.boot__mark {
  position: relative;
  width: 96px;
  height: 96px;
  display: grid;
  place-items: center;
}
.boot__logo {
  width: 96px;
  height: 96px;
  position: relative;
  z-index: 1;
  animation: boot-glow 2s ease-in-out infinite;
}
/* Pulse is a blue silhouette of the logo (mask) so it hugs the squircle shape
   instead of a square box, expanding and fading behind it. */
.boot__pulse {
  position: absolute;
  inset: 0;
  z-index: 0;
  background: #0079c1;
  -webkit-mask: url(../assets/dev-logo.png) center / contain no-repeat;
  mask: url(../assets/dev-logo.png) center / contain no-repeat;
  animation: pulse 1.9s ease-out infinite;
}
.boot__text {
  color: var(--text-dim);
  letter-spacing: 0.12em;
  font-size: 13px;
}
.boot__dots::after {
  content: "";
  animation: dots 1.4s steps(4, end) infinite;
}
@keyframes pulse {
  0% { transform: scale(1); opacity: 0.5; }
  70% { opacity: 0; }
  100% { transform: scale(1.75); opacity: 0; }
}
@keyframes boot-glow {
  0%, 100% { filter: drop-shadow(0 0 7px rgba(0, 121, 193, 0.5)); }
  50% { filter: drop-shadow(0 0 22px rgba(0, 121, 193, 0.9)); }
}
@keyframes dots {
  0% { content: ""; }
  25% { content: "."; }
  50% { content: ".."; }
  75% { content: "..."; }
}

/* =============================================================================
   Top bar
   ============================================================================= */
.topbar {
  position: absolute;
  top: 18px;
  left: 18px;
  right: 18px;
  z-index: 10;
  height: 64px;
  padding: 0 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.brand {
  display: flex;
  align-items: center;
  gap: 13px;
  text-decoration: none;
  color: inherit;
}
.brand__logo-wrap {
  position: relative;
  display: inline-flex;
  border-radius: 12px;
}
.brand__logo {
  position: relative;
  z-index: 1;
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: block;
  transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
}
.brand__glow {
  position: absolute;
  inset: -2px;
  border-radius: 13px;
  background: #0079c1;
  filter: blur(15px);
  opacity: 0;
  transition: opacity 0.3s ease;
  z-index: 0;
}
.brand:hover .brand__logo {
  transform: scale(1.07);
}
.brand:hover .brand__glow {
  opacity: 0.6;
}
.brand__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  line-height: 1.15;
}
.brand__badge {
  font-size: 15px;
  font-weight: 600;
  color: #e6ecff;
  letter-spacing: 0.005em;
}
.brand__accent {
  font-weight: 700;
  color: #2e9bd6;
  transition: color 0.3s ease;
}
.brand:hover .brand__accent {
  color: #46b4ec;
}
.brand__title {
  font-size: 10.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  font-weight: 600;
  color: var(--text-dim);
}
.topbar__status {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-bright);
  text-shadow: var(--glow-cyan);
}
.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--text-faint);
}
.dot--live {
  background: var(--accent-3);
  box-shadow: 0 0 10px var(--accent-3);
  animation: blink 1.8s ease-in-out infinite;
}
@keyframes blink {
  50% { opacity: 0.35; }
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* View-switch tab (planned schedule ↔ current progress) */
.topbar__nav {
  display: flex;
  align-items: center;
  gap: 10px;
}
.tab-link {
  display: inline-flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border-radius: 999px;
  text-decoration: none;
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text);
  background: linear-gradient(135deg, rgba(0, 121, 193, 0.32), rgba(169, 123, 244, 0.2));
  border: 1px solid rgba(46, 155, 214, 0.55);
  box-shadow: 0 0 18px -8px rgba(0, 121, 193, 0.6);
  transition: all 0.22s ease;
}
.tab-link:hover {
  border-color: #46b4ec;
  box-shadow: 0 0 22px -4px rgba(46, 155, 214, 0.7);
  transform: translateY(-1px);
}
.tab-link:active {
  transform: translateY(0) scale(0.98);
}
.tab-link__icon {
  font-size: 14px;
  filter: drop-shadow(0 0 6px rgba(46, 155, 214, 0.85));
}

/* =============================================================================
   Welcome modal — intro dialog, parked: hidden unless the URL has ?welcome.
   ============================================================================= */
.welcome {
  position: fixed;
  inset: 0;
  z-index: 70;
  display: grid;
  place-items: center;
  padding: 24px;
}
.welcome[hidden] {
  display: none;
}
.welcome__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.68);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
}
.welcome__panel {
  position: relative;
  width: min(560px, calc(100vw - 48px));
  padding: 32px 34px 28px;
  border-radius: 20px;
  text-align: center;
  animation: welcome-in 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes welcome-in {
  from { opacity: 0; transform: translateY(14px) scale(0.96); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}
.welcome.is-closing .welcome__panel {
  animation: welcome-out 0.24s ease forwards;
}
.welcome.is-closing .welcome__backdrop {
  opacity: 0;
  transition: opacity 0.24s ease;
}
@keyframes welcome-out {
  to { opacity: 0; transform: translateY(10px) scale(0.97); }
}
.welcome__badge {
  display: block;
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--accent-bright);
  text-shadow: var(--glow-cyan);
}
.welcome__title {
  margin: 10px 0 0;
  font-size: clamp(25px, 3.2vw, 33px);
  font-weight: 800;
  line-height: 1.12;
  letter-spacing: -0.015em;
  color: #fff;
}
.welcome__made {
  margin: 12px 0 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-dim);
}
.welcome__made strong {
  color: var(--accent-bright);
  font-weight: 700;
}
.welcome__desc {
  margin: 16px auto 0;
  max-width: 46ch;
  font-size: 14.5px;
  line-height: 1.5;
  color: var(--text-faint);
}
.welcome__btn {
  margin-top: 26px;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 24px;
  border-radius: 999px;
  border: 1px solid rgba(46, 155, 214, 0.55);
  background: linear-gradient(135deg, rgba(0, 121, 193, 0.42), rgba(169, 123, 244, 0.3));
  color: #eaf6ff;
  font: 700 14px/1 "Inter", "Segoe UI", system-ui, sans-serif;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 30px -12px rgba(0, 121, 193, 0.7), 0 0 18px -6px rgba(72, 223, 229, 0.5);
  transition: transform 0.18s ease, box-shadow 0.18s ease, border-color 0.18s ease;
}
.welcome__btn:hover {
  transform: translateY(-1px);
  border-color: #46b4ec;
  box-shadow: 0 14px 34px -10px rgba(0, 121, 193, 0.85), 0 0 26px -4px rgba(72, 223, 229, 0.75);
}
.welcome__btn:active {
  transform: translateY(0) scale(0.98);
}
.welcome__btn:focus-visible {
  outline: 2px solid rgba(72, 223, 229, 0.8);
  outline-offset: 2px;
}
.welcome__esri {
  display: block;
  width: 140px;
  height: auto;
  margin: 24px auto 0;
  opacity: 0.95;
}
@media (prefers-reduced-motion: reduce) {
  .welcome__panel { animation: none; }
}

/* =============================================================================
   Left dashboard
   ============================================================================= */
.dashboard {
  position: absolute;
  top: 98px;
  left: 18px;
  z-index: 10;
  width: 368px;
  max-height: calc(100vh - 118px);
  padding: 16px 20px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow-y: auto;
}

/* Progress view fills more vertical space so every layer filter fits without a
   scrollbar (its breakdown + isolate list are taller than the home dashboard). */
.dashboard--progress {
  max-height: calc(100vh - 108px);
  gap: 13px;
}
.dashboard--progress .status-list {
  gap: 9px;
}
.dashboard__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
}
.dashboard__head--stack {
  flex-direction: column;
  align-items: flex-start;
  gap: 4px;
}
.dashboard__head h2 {
  margin: 0;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--label);
}
.dashboard__sub {
  font-size: 11px;
  color: var(--accent-bright);
  font-weight: 600;
  text-shadow: var(--glow-cyan);
  font-variant-numeric: tabular-nums;
}

/* Headline slider date — a glowing live chip so the current date stands out. */
#dashDate {
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.03em;
  padding: 3px 11px;
  border-radius: 999px;
  background: rgba(56, 226, 234, 0.1);
  border: 1px solid rgba(56, 226, 234, 0.3);
  color: var(--accent-bright);
  text-shadow: var(--glow-cyan);
}

/* Progress ring card */
.ring-card {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(56, 226, 234, 0.08), rgba(124, 92, 255, 0.06));
  border: 1px solid var(--glass-border-soft);
}
.ring {
  position: relative;
  width: 96px;
  height: 96px;
  flex-shrink: 0;
}
.ring svg {
  transform: rotate(-90deg);
  width: 100%;
  height: 100%;
}
.ring__bg {
  fill: none;
  stroke: rgba(255, 255, 255, 0.08);
  stroke-width: 9;
}
.ring__bar {
  fill: none;
  stroke: url(#ringGrad);
  stroke: var(--accent);
  stroke-width: 9;
  stroke-linecap: round;
  stroke-dasharray: 327; /* 2πr, r=52 */
  stroke-dashoffset: 327;
  filter: drop-shadow(0 0 6px rgba(56, 226, 234, 0.6));
  transition: stroke-dashoffset 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
.ring__label {
  position: absolute;
  inset: 0;
  display: grid;
  place-content: center;
  text-align: center;
}
.ring__label span {
  font-size: 22px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}
.ring__label small {
  font-size: 9px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--label);
  font-weight: 700;
}
.ring-card__meta strong {
  display: block;
  margin-top: 4px;
  font-size: 15px;
  line-height: 1.25;
}

/* Metric tiles */
.metrics {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.metric {
  padding: 10px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--glass-border-soft);
}
.metric strong {
  display: block;
  margin-top: 6px;
  font-size: 18px;
  font-variant-numeric: tabular-nums;
}
.metric strong.is-behind {
  color: var(--danger);
  text-shadow: 0 0 12px rgba(251, 113, 133, 0.4);
}

/* Panel footer — source-model provenance (IFC → I3S) + buildingSMART IFC logo */
.dashboard__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border-soft);
}
.dashboard__foot-note {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
}
.dashboard__foot-sub {
  font-size: 13px;
  font-weight: 700;
  color: var(--accent-bright);
  letter-spacing: 0.01em;
  text-shadow: var(--glow-cyan);
}
.dashboard__foot-logo {
  height: 36px;
  width: auto;
  display: block;
  flex-shrink: 0;
  opacity: 0.95;
  pointer-events: none;
  -webkit-user-drag: none;
}

/* Progress view — schedule-slippage emphasis + CStatus breakdown */
.dashboard__sub.is-behind {
  color: var(--danger);
  text-shadow: 0 0 10px rgba(251, 113, 133, 0.4);
}
/* Illustrative-data footnote at the base of the financials view */
.fin-disclaimer {
  display: flex;
  align-items: center;
  gap: 7px;
  margin: 14px 0 2px;
  padding-top: 12px;
  border-top: 1px solid var(--glass-border-soft);
  font-size: 10.5px;
  font-style: italic;
  color: var(--text-faint);
  letter-spacing: 0.01em;
}
.fin-disclaimer::before {
  content: "ⓘ";
  flex-shrink: 0;
  font-style: normal;
  font-size: 12px;
  color: rgba(251, 191, 36, 0.7);
}
.status-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.status-row {
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 7px 10px;
}
.status-row__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-row__name {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-dim);
}
.status-row__val {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  font-weight: 700;
  white-space: nowrap;
}
.status-row__bar {
  grid-column: 1 / -1;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}
.status-row__fill {
  display: block;
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s cubic-bezier(0.22, 1, 0.36, 1);
}
/* Colour-matched breathing glow to mirror the sequencing panel bars. */
.status-row__fill.is-lit {
  animation: layer-pulse 2.4s ease-in-out infinite;
}

/* Layer list */
.layer-list {
  list-style: none;
  margin: 10px 0 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.layer-list li {
  display: grid;
  grid-template-columns: 10px 1fr auto;
  column-gap: 8px;
  row-gap: 5px;
  align-items: center;
  padding: 7px 12px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid transparent;
  font-size: 12.5px;
  cursor: pointer;
  user-select: none;
  transition: background 0.3s ease, border-color 0.3s ease, transform 0.3s ease;
}
.layer-list li:hover {
  background: rgba(56, 226, 234, 0.1);
  border-color: rgba(56, 226, 234, 0.25);
  transform: translateX(2px);
}
.layer-list li:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
.layer-list li.is-isolated {
  background: rgba(56, 226, 234, 0.16);
  border-color: var(--accent);
  box-shadow: 0 0 18px -6px var(--accent);
}
.layer-list .swatch {
  grid-column: 1;
  grid-row: 1;
  width: 9px;
  height: 9px;
  border-radius: 50%;
  opacity: 0.35;
  transition: opacity 0.3s ease;
}
.layer-list li.is-building .swatch,
.layer-list li.is-complete .swatch {
  opacity: 1;
}
.layer-list .layer-name {
  grid-column: 2;
  grid-row: 1;
  color: var(--text-dim);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.layer-list li.is-building .layer-name,
.layer-list li.is-complete .layer-name {
  color: var(--text);
}
.layer-list .layer-pct {
  grid-column: 3;
  grid-row: 1;
  font-size: 14px;
  font-weight: 700;
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  min-width: 42px;
  text-align: right;
  transition: color 0.3s ease;
}
.layer-list li.is-building .layer-pct {
  color: var(--text);
}
.layer-list li.is-complete .layer-pct {
  color: #4ade80;
}
.layer-list .layer-bar {
  grid-column: 1 / -1;
  grid-row: 2;
  position: relative;
  height: 9px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.09);
}
.layer-list .layer-bar__fill {
  position: absolute;
  top: 0;
  left: 0;
  bottom: 0;
  width: 0%;
  border-radius: 999px;
  background: var(--layer-c, var(--accent));
  transition: width 0.6s cubic-bezier(0.33, 1, 0.68, 1);
}
/* Active trades breathe a soft glow in their own colour. */
.layer-list li.is-building .layer-bar__fill {
  animation: layer-pulse 2.4s ease-in-out infinite;
}
.layer-list li.is-complete .layer-bar__fill {
  box-shadow: 0 0 10px -1px var(--layer-c, var(--accent));
}
@keyframes layer-pulse {
  0%, 100% { box-shadow: 0 0 4px -1px var(--layer-c, var(--accent)); }
  50% { box-shadow: 0 0 16px 0 var(--layer-c, var(--accent)); }
}

/* Isolate / filter glyph on each progress-panel layer row */
.layer-iso {
  flex-shrink: 0;
  font-size: 13px;
  line-height: 1;
  color: var(--text-faint);
  opacity: 0.5;
  transition: color 0.25s ease, opacity 0.25s ease, text-shadow 0.25s ease;
}
.layer-list li:hover .layer-iso {
  opacity: 0.9;
  color: var(--accent);
}
.layer-list li.is-isolated .layer-iso {
  opacity: 1;
  color: var(--accent);
  text-shadow: var(--glow-cyan);
}

/* Construction Layers header + reset control */
.layers__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 4px;
}
.btn-reset {
  font-family: var(--font);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent-bright);
  background: rgba(56, 226, 234, 0.08);
  border: 1px solid rgba(56, 226, 234, 0.28);
  border-radius: 8px;
  padding: 4px 10px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.btn-reset:hover {
  background: rgba(56, 226, 234, 0.18);
  border-color: var(--accent);
  box-shadow: 0 0 14px -4px var(--accent);
}
.btn-reset:active {
  transform: scale(0.96);
}

/* =============================================================================
   Dashboard view switch (Schedule 4D ↔ Financials 5D)
   ============================================================================= */
.dash-toggle {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 4px;
  padding: 4px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border-soft);
}
.dash-toggle__btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.03em;
  color: var(--text-faint);
  background: transparent;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s ease;
}
.dash-toggle__btn:hover {
  color: var(--text);
}
.dash-toggle__btn.is-active {
  color: var(--accent-bright);
  background: rgba(56, 226, 234, 0.16);
  border-color: rgba(56, 226, 234, 0.45);
  box-shadow: 0 0 16px -6px var(--accent);
}
.dash-toggle__d {
  font-size: 9px;
  font-weight: 800;
  opacity: 0.7;
  padding: 1px 4px;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.08);
}
.dash-toggle__btn.is-active .dash-toggle__d {
  background: rgba(56, 226, 234, 0.22);
  opacity: 1;
}

/* Stacked views inside the dashboard — only one is shown at a time. */
.dash-view {
  display: flex;
  flex-direction: column;
  gap: 13px;
}
.dash-view.is-inactive {
  display: none;
}

/* =============================================================================
   Financials (5D) panel
   ============================================================================= */
.fin-badge {
  font-size: 9px;
  font-weight: 800;
  letter-spacing: 0.08em;
  color: var(--accent-bright);
  background: rgba(56, 226, 234, 0.14);
  border: 1px solid rgba(56, 226, 234, 0.4);
  border-radius: 6px;
  padding: 1px 5px;
  vertical-align: middle;
  margin-left: 4px;
}

/* Executive doughnut — blue cost fill + red overrun sliver */
.ring__bar--cost {
  stroke: #3b82f6;
  filter: drop-shadow(0 0 6px rgba(59, 130, 246, 0.55));
  stroke-dasharray: 0 327;
  stroke-dashoffset: 0;
}
.ring__bar--over {
  stroke: var(--danger);
  filter: drop-shadow(0 0 6px rgba(251, 113, 133, 0.6));
  stroke-dasharray: 0 327;
  stroke-dashoffset: 0;
}

/* "Big three" contract figures beside the doughnut */
.fin-lines {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  flex: 1;
  min-width: 0;
}
.fin-lines li {
  display: flex;
  flex-direction: column;
  gap: 1px;
}
.fin-lines strong {
  font-size: 14px;
  font-variant-numeric: tabular-nums;
  line-height: 1.15;
  color: var(--text);
}
.fin-note {
  font-style: normal;
  font-size: 10px;
  font-weight: 700;
  color: var(--danger);
  letter-spacing: 0.02em;
}

/* EVM health check — two indices side by side */
.metrics--evm {
  grid-template-columns: repeat(2, 1fr);
}
.metrics--evm .metric {
  padding: 10px;
}
.metrics--evm .metric strong {
  font-size: 22px;
  margin-top: 5px;
}
.metric__sub {
  display: block;
  margin-top: 5px;
  font-size: 10px;
  line-height: 1.4;
  color: var(--text-faint);
}

/* Financial value tints */
.fin-lines .is-over,
.metric strong.is-over,
.fin-risk__val.is-over {
  color: var(--danger);
  text-shadow: 0 0 12px rgba(251, 113, 133, 0.35);
}
.metric strong.is-warn,
.fin-risk__val.is-warn {
  color: #fbbf24;
  text-shadow: 0 0 12px rgba(251, 191, 36, 0.28);
}
.fin-risk__val.is-cyan {
  color: var(--accent-bright);
  text-shadow: var(--glow-cyan);
}
.fin-risk__val.is-violet {
  color: #a78bfa;
  text-shadow: 0 0 12px rgba(167, 139, 250, 0.3);
}

.fin-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

/* Current billing draw / pay application */
.fin-bill {
  list-style: none;
  margin: 0;
  padding: 12px 14px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.035);
  border: 1px solid var(--glass-border-soft);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fin-bill li {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  font-size: 12.5px;
  color: var(--text-dim);
}
.fin-bill strong {
  font-variant-numeric: tabular-nums;
  font-weight: 600;
  color: var(--text);
}
.fin-bill .is-muted {
  color: var(--text-faint);
  font-weight: 500;
}
.fin-bill__total {
  margin-top: 2px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border);
}
.fin-bill__total span {
  color: var(--text);
  font-weight: 600;
}
.fin-bill__total strong {
  font-size: 18px;
  font-weight: 800;
  color: #34d399;
  text-shadow: 0 0 14px rgba(52, 211, 153, 0.4);
}

/* Generate AIA billing button */
.fin-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: 100%;
  font-family: var(--font);
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
  color: var(--accent-bright);
  background: rgba(13, 18, 32, 0.6);
  border: 1px solid rgba(56, 226, 234, 0.32);
  border-radius: 11px;
  padding: 11px 14px;
  cursor: pointer;
  transition: all 0.22s ease;
}
.fin-btn:hover {
  background: rgba(56, 226, 234, 0.1);
  border-color: var(--accent);
  box-shadow: 0 0 20px -6px var(--accent);
  transform: translateY(-1px);
}
.fin-btn:active {
  transform: translateY(0) scale(0.99);
}
.fin-btn:disabled {
  cursor: default;
}
.fin-btn.is-loading,
.fin-btn.is-loading:hover {
  background: #1e293b;
  border-color: rgba(148, 163, 184, 0.35);
  color: #cbd5e1;
  box-shadow: none;
  transform: none;
  cursor: progress;
}
.fin-btn.is-success,
.fin-btn.is-success:hover {
  background: rgba(16, 185, 129, 0.2);
  border-color: rgba(16, 185, 129, 0.5);
  color: #34d399;
  font-weight: 800;
  box-shadow: 0 0 20px -6px rgba(52, 211, 153, 0.55);
  transform: none;
}
.fin-btn__icon {
  flex-shrink: 0;
}
.fin-btn__icon--spin,
.fin-btn__icon--check {
  display: none;
}
.fin-btn.is-loading .fin-btn__icon--file,
.fin-btn.is-success .fin-btn__icon--file {
  display: none;
}
.fin-btn.is-loading .fin-btn__icon--spin {
  display: inline-block;
  animation: fin-spin 0.8s linear infinite;
}
.fin-btn.is-success .fin-btn__icon--check {
  display: inline-block;
}
@keyframes fin-spin {
  to {
    transform: rotate(360deg);
  }
}

/* Risk & variance — schedule slippage translated to dollars; each card also
   toggles a mocked 3D-map overlay filter. */
.fin-risk {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.fin-risk__card {
  width: 100%;
  display: grid;
  grid-template-columns: auto 1fr auto;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid var(--glass-border-soft);
  font-family: var(--font);
  text-align: left;
  cursor: pointer;
  transition: all 0.2s ease;
}
.fin-risk__card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(140, 170, 230, 0.28);
}
.fin-risk__card[data-risk="schedule"].is-active {
  background: rgba(244, 63, 94, 0.1);
  border-color: rgba(244, 63, 94, 0.5);
  box-shadow: 0 0 15px rgba(244, 63, 94, 0.15);
}
.fin-risk__card[data-risk="delayed"].is-active {
  background: rgba(251, 191, 36, 0.1);
  border-color: rgba(251, 191, 36, 0.5);
  box-shadow: 0 0 15px rgba(251, 191, 36, 0.15);
}
.fin-risk__card[data-risk="pending"].is-active {
  background: rgba(34, 211, 238, 0.1);
  border-color: rgba(34, 211, 238, 0.5);
  box-shadow: 0 0 15px rgba(34, 211, 238, 0.15);
}
.fin-risk__card[data-risk="environmental"].is-active {
  background: rgba(167, 139, 250, 0.1);
  border-color: rgba(167, 139, 250, 0.5);
  box-shadow: 0 0 15px rgba(167, 139, 250, 0.15);
}
.fin-risk__banner {
  margin: 4px 2px 0;
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 10.5px;
  font-weight: 500;
  line-height: 1.35;
}
.fin-risk__banner[hidden] {
  display: none;
}
.fin-risk__banner::before {
  content: "";
  flex-shrink: 0;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: currentColor;
  box-shadow: 0 0 8px currentColor;
  animation: fin-pulse 1.4s ease-in-out infinite;
}
.fin-risk__banner.is-rose {
  color: #fb7185;
}
.fin-risk__banner.is-amber {
  color: #fbbf24;
}
.fin-risk__banner.is-cyan {
  color: var(--accent-bright);
}
.fin-risk__banner.is-violet {
  color: #a78bfa;
}
@keyframes fin-pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.35;
  }
}
.fin-risk__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--dot, var(--accent));
  box-shadow: 0 0 8px var(--dot, var(--accent));
  align-self: start;
  margin-top: 4px;
}
.fin-risk__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fin-risk__label {
  font-size: 12.5px;
  color: var(--text);
  font-weight: 600;
}
.fin-risk__sub {
  font-size: 10px;
  color: var(--text-faint);
  line-height: 1.35;
}
.fin-risk__val {
  font-size: 14px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}

/* 3D map cost overlays */
.fin-overlays {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
}
.fin-pill {
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border-soft);
  border-radius: 999px;
  padding: 7px 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.fin-pill:hover {
  color: var(--text);
  border-color: rgba(56, 226, 234, 0.35);
}
.fin-pill.is-active {
  color: var(--accent-bright);
  background: rgba(56, 226, 234, 0.16);
  border-color: rgba(56, 226, 234, 0.5);
  box-shadow: 0 0 16px -6px var(--accent);
}

/* "Clear filters" — resets the cost overlay + layer isolation to the initial view */
.fin-clear {
  margin-top: 11px;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: var(--font);
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid var(--glass-border-soft);
  border-radius: 10px;
  padding: 8px 13px;
  cursor: pointer;
  transition: all 0.2s ease;
}
.fin-clear:hover {
  color: var(--text);
  border-color: rgba(56, 226, 234, 0.4);
  background: rgba(56, 226, 234, 0.1);
  box-shadow: 0 0 16px -8px var(--accent);
}
.fin-clear__icon {
  font-size: 13px;
  line-height: 1;
}

/* =============================================================================
   Drill-down modal (delayed components breakdown)
   ============================================================================= */
.fin-modal {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: grid;
  place-items: center;
  padding: 24px;
}
.fin-modal[hidden] {
  display: none;
}
.fin-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(2, 6, 23, 0.62);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.fin-modal__panel {
  position: relative;
  width: 420px;
  max-width: 100%;
  padding: 0;
  overflow: hidden;
  border-radius: 16px;
  animation: fin-modal-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.2);
}
@keyframes fin-modal-in {
  from {
    opacity: 0;
    transform: translateY(12px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}
.fin-modal__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--glass-border-soft);
}
.fin-modal__title-wrap {
  display: flex;
  align-items: center;
  gap: 11px;
}
.fin-modal__icon {
  display: grid;
  place-items: center;
  width: 32px;
  height: 32px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(56, 226, 234, 0.15);
  color: var(--accent-bright);
  font-size: 13px;
}
.fin-modal__head h3 {
  margin: 0;
  font-size: 13.5px;
  letter-spacing: 0.02em;
  color: var(--text);
}
.fin-modal__sub {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-dim);
}
.fin-modal__list {
  list-style: none;
  margin: 0;
  padding: 10px;
  max-height: 288px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(140, 170, 230, 0.35) transparent;
}
.fin-modal__list::-webkit-scrollbar {
  width: 6px;
}
.fin-modal__list::-webkit-scrollbar-thumb {
  background: rgba(140, 170, 230, 0.25);
  border-radius: 999px;
}
.fin-modal__list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 12px;
  border-radius: 10px;
  font-size: 12px;
  color: var(--text-dim);
  transition: background 0.2s ease;
}
.fin-modal__list li:hover {
  background: rgba(255, 255, 255, 0.04);
}
.fin-modal__list strong {
  font-variant-numeric: tabular-nums;
  color: var(--danger);
}
.fin-modal__foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 18px;
  border-top: 1px solid var(--glass-border-soft);
}
.fin-modal__synced {
  font-size: 10.5px;
  color: var(--accent-bright);
}
.fin-modal__close-btn {
  padding: 7px 16px;
  border-radius: 10px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
}
.fin-modal__close-btn:hover {
  border-color: var(--accent);
  background: rgba(56, 226, 234, 0.1);
  color: var(--accent-bright);
}

/* ---- Per-risk theming (schedule=rose / delayed=amber / pending=cyan) ---- */
.fin-modal__panel[data-theme="rose"] .fin-modal__icon {
  background: rgba(251, 113, 133, 0.16);
  color: #fb7185;
}
.fin-modal__panel[data-theme="amber"] .fin-modal__icon {
  background: rgba(251, 191, 36, 0.16);
  color: #fbbf24;
}
.fin-modal__panel[data-theme="cyan"] .fin-modal__icon {
  background: rgba(56, 226, 234, 0.16);
  color: #48dfe5;
}
.fin-modal__panel[data-theme="violet"] .fin-modal__icon {
  background: rgba(167, 139, 250, 0.16);
  color: #a78bfa;
}
.fin-modal__panel[data-theme="rose"] .fin-modal__head {
  box-shadow: inset 0 2px 0 #fb7185;
}
.fin-modal__panel[data-theme="amber"] .fin-modal__head {
  box-shadow: inset 0 2px 0 #fbbf24;
}
.fin-modal__panel[data-theme="cyan"] .fin-modal__head {
  box-shadow: inset 0 2px 0 #48dfe5;
}
.fin-modal__panel[data-theme="violet"] .fin-modal__head {
  box-shadow: inset 0 2px 0 #a78bfa;
}

/* Headline total strip */
.fin-modal__total {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 18px;
  border-bottom: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.02);
}
.fin-modal__total-k {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-dim);
}
.fin-modal__total-v {
  font-size: 23px;
  font-weight: 800;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.fin-modal__panel[data-theme="rose"] .fin-modal__total-v {
  color: #fb7185;
}
.fin-modal__panel[data-theme="amber"] .fin-modal__total-v {
  color: #fbbf24;
}
.fin-modal__panel[data-theme="cyan"] .fin-modal__total-v {
  color: #48dfe5;
}
.fin-modal__panel[data-theme="violet"] .fin-modal__total-v {
  color: #a78bfa;
}

/* Two-line row label + meta, themed amount, staggered reveal */
.fin-modal__row-label {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.fin-modal__row-label > span:first-child {
  color: var(--text);
  font-weight: 500;
}
.fin-modal__row-meta {
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--text-faint);
}
.fin-modal__panel[data-theme="rose"] .fin-modal__list strong {
  color: #fb7185;
}
.fin-modal__panel[data-theme="amber"] .fin-modal__list strong {
  color: #fbbf24;
}
.fin-modal__panel[data-theme="cyan"] .fin-modal__list strong {
  color: #48dfe5;
}
.fin-modal__panel[data-theme="violet"] .fin-modal__list strong {
  color: #a78bfa;
}
.fin-modal__panel[data-theme="rose"] .fin-modal__synced {
  color: #fb7185;
}
.fin-modal__panel[data-theme="amber"] .fin-modal__synced {
  color: #fbbf24;
}
.fin-modal__list li {
  opacity: 0;
  animation: fin-row-in 0.34s ease forwards;
  animation-delay: calc(var(--i, 0) * 45ms);
}
@keyframes fin-row-in {
  from {
    opacity: 0;
    transform: translateX(-7px);
  }
  to {
    opacity: 1;
    transform: none;
  }
}

/* =============================================================================
   Right custom nav controls
   ============================================================================= */
.nav-stack {
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 10;
  padding: 8px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.nav-btn {
  width: 42px;
  height: 42px;
  border-radius: 12px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  font-size: 18px;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}
.nav-btn:hover {
  background: rgba(56, 226, 234, 0.16);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 18px -4px var(--accent);
}
.nav-btn:active {
  transform: scale(0.94);
}
.nav-btn.is-active {
  background: rgba(56, 226, 234, 0.2);
  border-color: var(--accent);
  color: var(--accent);
  box-shadow: 0 0 20px -4px var(--accent);
}
/* Exploded view: pulses while its first use prepares the per-zone layers. */
.nav-btn.is-busy {
  cursor: progress;
  animation: nav-btn-busy 1.1s ease-in-out infinite;
}
@keyframes nav-btn-busy {
  50% {
    border-color: var(--accent);
    box-shadow: 0 0 22px -2px var(--accent);
  }
}
@media (prefers-reduced-motion: reduce) {
  .nav-btn.is-busy {
    animation: none;
    border-color: var(--accent);
  }
}

/* =============================================================================
   Slice tool (interactive cut-plane through the 3D model)
   ============================================================================= */
.slice-panel {
  position: absolute;
  right: 84px;
  top: 50%;
  transform: translateY(-50%) translateX(12px);
  z-index: 12;
  width: 262px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}
.slice-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(-50%) translateX(0);
}
.slice-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.slice-panel__hint {
  margin: 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-faint);
}
.slice-panel__widget {
  border-radius: 12px;
  overflow: hidden;
}
/* Blend the embedded Esri Slice widget into the glass panel. */
.slice-panel__widget .esri-widget,
.slice-panel__widget .esri-slice {
  background: transparent;
  color: var(--text-dim);
  box-shadow: none;
}

/* =============================================================================
   Layer visibility panel
   ============================================================================= */
.layers-panel {
  position: absolute;
  top: 98px;
  right: 18px;
  z-index: 11;
  width: 216px;
  max-height: calc(50vh - 80px);
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.layers-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.panel-collapse {
  width: 22px;
  height: 22px;
  border-radius: 7px;
  border: 1px solid rgba(56, 226, 234, 0.28);
  background: rgba(56, 226, 234, 0.08);
  color: var(--accent-bright);
  font-size: 15px;
  line-height: 1;
  cursor: pointer;
  display: grid;
  place-items: center;
  transition: all 0.2s ease;
}
.panel-collapse:hover {
  background: rgba(56, 226, 234, 0.18);
  border-color: var(--accent);
  box-shadow: 0 0 12px -4px var(--accent);
}
.toggle-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 7px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 226, 234, 0.4) transparent;
}
.toggle-list::-webkit-scrollbar {
  width: 6px;
}
.toggle-list::-webkit-scrollbar-thumb {
  background: rgba(56, 226, 234, 0.35);
  border-radius: 999px;
}
.toggle-list::-webkit-scrollbar-track {
  background: transparent;
}
.layers-panel.is-collapsed {
  max-height: none;
  width: 216px;
  overflow: hidden;
}
.layers-panel.is-collapsed .toggle-list {
  display: none;
}
.toggle-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 8px 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.025);
  border: 1px solid transparent;
  font-size: 12.5px;
  transition: all 0.25s ease;
}
.toggle-row:hover {
  background: rgba(56, 226, 234, 0.1);
  border-color: rgba(56, 226, 234, 0.25);
}
.toggle-name {
  flex: 1;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.switch {
  position: relative;
  flex-shrink: 0;
  width: 34px;
  height: 18px;
  cursor: pointer;
}
.switch input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}
.switch .track {
  position: absolute;
  inset: 0;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid var(--glass-border-soft);
  transition: all 0.25s ease;
}
.switch .track::after {
  content: "";
  position: absolute;
  top: 2px;
  left: 2px;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--text-faint);
  transition: all 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.switch input:checked + .track {
  background: rgba(56, 226, 234, 0.32);
  border-color: var(--accent);
  box-shadow: 0 0 14px -4px var(--accent);
}
.switch input:checked + .track::after {
  left: 18px;
  background: var(--accent);
  box-shadow: var(--glow-cyan);
}
.switch input:focus-visible + .track {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* =============================================================================
   Bottom playback dock + custom time scrubber
   ============================================================================= */
.dock {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  width: min(560px, calc(100vw - 48px));
  padding: 14px 18px;
  display: flex;
  align-items: center;
  gap: 16px;
  border-radius: 18px;
  /* Dark, translucent glassmorphism pill */
  background: rgba(14, 18, 32, 0.55);
  border: 1px solid rgba(255, 255, 255, 0.08);
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 12px 40px -12px rgba(0, 0, 0, 0.7);
}

/* Compact bottom-center dock holding just the Spin orbit toggle (progress view) */
.spin-dock {
  position: absolute;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 10;
  display: flex;
}

/* The TimeSlider runs headlessly as the time engine — keep its DOM out of view. */
.time-engine,
.esri-time-slider {
  display: none !important;
}

/* Cinematic button */
.cine-btn {
  flex-shrink: 0;
  position: relative;
  overflow: hidden;
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 12px 20px;
  border-radius: 14px;
  border: 1px solid rgba(124, 92, 255, 0.45);
  background: linear-gradient(135deg, rgba(124, 92, 255, 0.22), rgba(56, 226, 234, 0.14));
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.04em;
  cursor: pointer;
  transition: all 0.25s ease;
}
.cine-btn:hover {
  box-shadow: 0 0 26px -6px var(--accent-2);
  transform: translateY(-1px);
}
.cine-btn.is-playing {
  border-color: var(--accent);
  background: linear-gradient(135deg, rgba(56, 226, 234, 0.28), rgba(124, 92, 255, 0.18));
  box-shadow: 0 0 26px -6px var(--accent);
}
.cine-btn__icon {
  font-size: 12px;
}

/* Scrubber column: date label sits directly above the range slider */
.scrub {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 0;
}
.scrub__date {
  align-self: center;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.08em;
  color: #48dfe5;
  text-shadow: 0 0 10px rgba(72, 223, 229, 0.55);
}

/* Custom HTML5 range — track is painted via a JS-driven gradient on .scrub__range */
.scrub__range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 6px;
  border-radius: 999px;
  cursor: pointer;
  background: linear-gradient(90deg, #48dfe5 0%, #48dfe5 0%, #2a3142 0%, #2a3142 100%);
  outline: none;
}
/* WebKit thumb — glowing neon cyan circle */
.scrub__range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #48dfe5;
  border: 2px solid #0b0f1a;
  box-shadow: 0 0 12px #48dfe5, 0 0 4px #48dfe5;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.scrub__range::-webkit-slider-thumb:hover {
  transform: scale(1.18);
  box-shadow: 0 0 18px #48dfe5, 0 0 6px #48dfe5;
}
/* Firefox thumb */
.scrub__range::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #48dfe5;
  border: 2px solid #0b0f1a;
  box-shadow: 0 0 12px #48dfe5, 0 0 4px #48dfe5;
}
.scrub__range::-moz-range-track {
  height: 6px;
  border-radius: 999px;
  background: #2a3142;
}
.scrub__range::-moz-range-progress {
  height: 6px;
  border-radius: 999px;
  background: #48dfe5;
}

/* =============================================================================
   Esri attribution badge (bottom-right)
   ============================================================================= */
.esri-badge {
  position: absolute;
  bottom: 24px;
  right: 18px;
  z-index: 10;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 7px 12px 7px 8px;
  border-radius: 12px;
  text-decoration: none;
  color: var(--text-dim);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  transition: all 0.2s ease;
}
.esri-badge:hover {
  color: var(--text);
  border-color: var(--accent);
  box-shadow: var(--shadow), 0 0 18px -6px var(--accent);
  transform: translateY(-1px);
}
.esri-badge img {
  display: block;
  border-radius: 7px;
  background: #fff; /* logo ships on a white field — keep it crisp on a chip */
  padding: 3px;
}

/* =============================================================================
   Custom hit-test tooltip
   ============================================================================= */
.tooltip {
  position: absolute;
  z-index: 20;
  min-width: 220px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1px solid rgba(56, 226, 234, 0.4);
  box-shadow: var(--shadow), 0 0 30px -8px var(--accent);
  pointer-events: none;
  opacity: 0;
  transform: translateY(8px) scale(0.96);
  transition: opacity 0.18s ease, transform 0.18s ease;
}
.tooltip.is-visible {
  opacity: 1;
  transform: translateY(0) scale(1);
}
.tooltip__tag {
  display: inline-block;
  font-size: 9.5px;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent);
  padding: 3px 9px;
  border-radius: 999px;
  background: rgba(56, 226, 234, 0.12);
  border: 1px solid rgba(56, 226, 234, 0.3);
}
.tooltip h3 {
  margin: 10px 0 12px;
  font-size: 16px;
}
.tooltip__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  padding: 6px 0;
  font-size: 12px;
  color: var(--text-dim);
  border-top: 1px solid var(--glass-border-soft);
}
.tooltip__status {
  color: var(--accent-3);
}

/* =============================================================================
   ArcGIS widget overrides
   --------------------------------------------------------------------------
   The TimeSlider renders a set of .esri-* elements inside #timeSlider. We
   neutralize the default Esri card chrome and restyle the internals so the
   widget reads like a sleek media-player scrubber.
   ============================================================================= */

/* Kill the default widget "panel" look (background, border, shadow, padding) */
.esri-time-slider,
.esri-widget {
  background: transparent !important;
  box-shadow: none !important;
  color: var(--text) !important;
}
.esri-time-slider {
  --calcite-ui-text-1: var(--text);
  --calcite-ui-text-3: var(--text-dim);
  border: none !important;
}

/* The slider track: turn it into a thin neon rail */
.esri-slider__track {
  height: 5px !important;
  background: rgba(255, 255, 255, 0.1) !important;
  border-radius: 999px !important;
  border: none !important;
}

/* The "elapsed" segment between the two handles — the construction-to-date bar */
.esri-slider__segment {
  background: linear-gradient(90deg, var(--accent-2), var(--accent)) !important;
  height: 5px !important;
  border-radius: 999px !important;
  box-shadow: 0 0 12px -2px var(--accent);
}

/* Handles → glowing pucks */
.esri-slider__thumb {
  width: 16px !important;
  height: 16px !important;
  background: #0a0f1c !important;
  border: 2px solid var(--accent) !important;
  border-radius: 50% !important;
  box-shadow: 0 0 0 4px rgba(56, 226, 234, 0.15), 0 0 14px -2px var(--accent) !important;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
}
.esri-slider__thumb:hover {
  transform: scale(1.12);
  box-shadow: 0 0 0 6px rgba(56, 226, 234, 0.22), 0 0 18px -1px var(--accent) !important;
}

/* Tick labels along the timeline */
.esri-slider__tick {
  background: rgba(255, 255, 255, 0.18) !important;
}
.esri-slider__tick-label,
.esri-slider__label {
  color: var(--text-faint) !important;
  font-family: var(--font) !important;
  font-size: 10.5px !important;
  letter-spacing: 0.04em;
}

/* The min/max extent labels above the timeline */
.esri-time-slider__min,
.esri-time-slider__max,
.esri-time-slider__time-extent-date,
.esri-time-slider__time-extent {
  color: var(--text-dim) !important;
  font-family: var(--font) !important;
  font-size: 11px !important;
}

/* Native play/previous/next controls — restyle to match, keep them compact */
.esri-time-slider__row .esri-widget--button,
.esri-time-slider__playback-button {
  background: rgba(255, 255, 255, 0.05) !important;
  border: 1px solid var(--glass-border-soft) !important;
  border-radius: 10px !important;
  color: var(--text) !important;
  transition: all 0.2s ease;
}
.esri-time-slider__row .esri-widget--button:hover {
  background: rgba(56, 226, 234, 0.16) !important;
  border-color: var(--accent) !important;
  color: var(--accent) !important;
}

/* Tidy scrollbars inside the glass panels */
.dashboard::-webkit-scrollbar {
  width: 6px;
}
.dashboard::-webkit-scrollbar-thumb {
  background: rgba(140, 170, 230, 0.25);
  border-radius: 999px;
}

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 720px) {
  .dashboard {
    width: calc(100vw - 36px);
    max-height: 40vh;
  }
  .nav-stack {
    display: none;
  }
  .slice-panel {
    display: none;
  }
  .dock {
    bottom: 16px;
    padding: 8px 12px;
  }
  /* Collapse the view-switch tab to just its icon so the top bar never wraps. */
  .tab-link__label {
    display: none;
  }
  .tab-link {
    padding: 9px 12px;
  }
}

/* =============================================================================
   Timeline assistant (local date/phrase command box)
   ============================================================================= */
.asst-fab {
  position: absolute;
  left: 50%;
  bottom: 104px;
  transform: translateX(-50%);
  z-index: 30;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 16px;
  border-radius: 999px;
  border: 1px solid rgba(72, 223, 229, 0.4);
  background: rgba(14, 18, 32, 0.62);
  color: #eaf6f7;
  font: inherit;
  font-size: 13px;
  cursor: pointer;
  -webkit-backdrop-filter: blur(10px);
  backdrop-filter: blur(10px);
  box-shadow: 0 10px 30px -12px rgba(0, 0, 0, 0.7),
    0 0 18px -6px rgba(72, 223, 229, 0.6);
  transition: opacity 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}
.asst-fab:hover {
  box-shadow: 0 10px 30px -10px rgba(0, 0, 0, 0.8),
    0 0 26px -4px rgba(72, 223, 229, 0.85);
}
.asst-fab__icon {
  font-size: 15px;
  filter: drop-shadow(0 0 6px rgba(72, 223, 229, 0.8));
}
.asst-fab.is-hidden {
  opacity: 0;
  pointer-events: none;
  transform: translate(-50%, 10px);
}

.asst {
  position: absolute;
  top: 88px;
  left: 18px;
  z-index: 31;
  width: min(380px, calc(100vw - 36px));
  max-height: min(440px, 62vh);
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  border: 1px solid rgba(72, 223, 229, 0.28);
  background: rgba(14, 18, 32, 0.72);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  box-shadow: 0 18px 50px -16px rgba(0, 0, 0, 0.8),
    0 0 30px -10px rgba(72, 223, 229, 0.45);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  overflow: hidden;
}
.asst.is-open {
  opacity: 1;
  pointer-events: auto;
}
.asst.is-dragging {
  transition: none;
  box-shadow: 0 24px 60px -14px rgba(0, 0, 0, 0.85),
    0 0 36px -8px rgba(72, 223, 229, 0.6);
}
.asst__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 14px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.asst__head:active {
  cursor: grabbing;
}
.asst__title {
  font-size: 13px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: #48dfe5;
  text-shadow: 0 0 10px rgba(72, 223, 229, 0.5);
}
.asst__close {
  border: none;
  background: transparent;
  color: #9fb2c4;
  font-size: 14px;
  cursor: pointer;
  padding: 2px 6px;
  border-radius: 8px;
  transition: color 0.15s ease, background 0.15s ease;
}
.asst__close:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.06);
}
.asst__log {
  flex: 1;
  min-height: 80px;
  overflow-y: auto;
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 226, 234, 0.4) transparent;
}
.asst__log::-webkit-scrollbar {
  width: 6px;
}
.asst__log::-webkit-scrollbar-thumb {
  background: rgba(56, 226, 234, 0.35);
  border-radius: 999px;
}
.asst__log::-webkit-scrollbar-track {
  background: transparent;
}
.asst-msg {
  max-width: 85%;
  padding: 8px 11px;
  border-radius: 12px;
  font-size: 13px;
  line-height: 1.4;
  white-space: pre-wrap;
  word-break: break-word;
}
.asst-msg--bot {
  align-self: flex-start;
  background: rgba(255, 255, 255, 0.05);
  color: #d7e3ee;
  border-bottom-left-radius: 4px;
}
.asst-msg--user {
  align-self: flex-end;
  background: rgba(72, 223, 229, 0.16);
  color: #eafdff;
  border: 1px solid rgba(72, 223, 229, 0.32);
  border-bottom-right-radius: 4px;
}
.asst__form {
  display: flex;
  gap: 8px;
  padding: 11px 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}
.asst__input {
  flex: 1;
  min-width: 0;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(0, 0, 0, 0.28);
  color: #eaf6f7;
  font: inherit;
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.asst__input::placeholder {
  color: #7c8da0;
}
.asst__input:focus {
  border-color: rgba(72, 223, 229, 0.6);
  box-shadow: 0 0 0 3px rgba(72, 223, 229, 0.15);
}
.asst__send {
  flex-shrink: 0;
  padding: 9px 16px;
  border-radius: 10px;
  border: 1px solid rgba(72, 223, 229, 0.5);
  background: rgba(72, 223, 229, 0.18);
  color: #eafdff;
  font: inherit;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.15s ease, box-shadow 0.15s ease;
}
.asst__send:hover {
  background: rgba(72, 223, 229, 0.3);
  box-shadow: 0 0 16px -4px rgba(72, 223, 229, 0.8);
}

@media (max-width: 720px) {
  .asst-fab {
    bottom: 92px;
  }
  .asst {
    top: 72px;
    left: 18px;
    right: 18px;
    width: auto;
  }
}

/* =============================================================================
   IDS model audit (buildingSMART openBIM validation)
   ============================================================================= */
.audit-panel {
  position: absolute;
  right: 74px;
  top: 96px;
  z-index: 47;
  width: 460px;
  max-width: calc(100vw - 108px);
  max-height: calc(100dvh - 210px);
  padding: 0;
  display: flex;
  flex-direction: column;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translateX(16px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}
.audit-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}
.audit-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--glass-border-soft);
  cursor: grab;
  user-select: none;
  touch-action: none;
}
.audit-panel__head:active {
  cursor: grabbing;
}
.audit-panel.is-dragging {
  transition: none;
}
.audit-panel__handle {
  display: flex;
  align-items: center;
  gap: 8px;
}
.audit-panel__grip {
  color: var(--text-faint);
  font-size: 13px;
  letter-spacing: -2px;
  opacity: 0.7;
}
/* Match the audit header label to the dashboard panel title size */
.audit-panel__handle .kicker {
  font-size: 14px;
}
.audit-panel__right {
  display: flex;
  align-items: center;
  gap: 14px;
}
.audit-standards {
  display: flex;
  align-items: center;
  gap: 14px;
  min-width: 0;
}
.audit-standards__logo {
  height: 38px;
  width: auto;
  display: block;
  opacity: 0.95;
  pointer-events: none;
  -webkit-user-drag: none;
}
.audit-standards__sep {
  width: 1px;
  height: 28px;
  background: var(--glass-border-soft);
  border-radius: 1px;
}
.audit-body {
  padding: 14px 16px 16px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 226, 234, 0.4) transparent;
}
.audit-body::-webkit-scrollbar {
  width: 6px;
}
.audit-body::-webkit-scrollbar-thumb {
  background: rgba(56, 226, 234, 0.35);
  border-radius: 999px;
}

/* Loading / error states */
.audit-loading,
.audit-error {
  color: var(--text-dim);
  font-size: 13px;
  line-height: 1.5;
  padding: 8px 2px;
}
.audit-error strong {
  display: block;
  margin-bottom: 4px;
  color: var(--danger);
}

/* "What's happening" validation sequence (audience-friendly, shown while running) */
.audit-running {
  padding: 6px 2px 2px;
  animation: audit-running-in 0.3s ease both;
}
@keyframes audit-running-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}
.audit-running__title {
  margin: 5px 0 6px;
  font-size: 18px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: 0.01em;
}
.audit-running__intro {
  margin: 0;
  font-size: 13px;
  line-height: 1.55;
  color: var(--text-dim);
}
.audit-running__steps {
  list-style: none;
  margin: 16px 0 14px;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 11px;
}
.audit-step {
  display: flex;
  align-items: flex-start;
  gap: 11px;
  opacity: 0.4;
  transform: translateX(-2px);
  transition: opacity 0.35s ease, transform 0.35s ease;
}
.audit-step.is-active,
.audit-step.is-done {
  opacity: 1;
  transform: none;
}
.audit-step__mark {
  flex: 0 0 auto;
  width: 18px;
  height: 18px;
  margin-top: 1px;
  border-radius: 50%;
  border: 2px solid var(--glass-border);
  position: relative;
  transition: border-color 0.3s ease, background 0.3s ease, box-shadow 0.3s ease;
}
.audit-step.is-active .audit-step__mark {
  border-color: var(--accent);
  animation: audit-step-pulse 1s ease-in-out infinite;
}
@keyframes audit-step-pulse {
  0%, 100% { box-shadow: 0 0 0 3px rgba(56, 226, 234, 0.10), var(--glow-cyan); }
  50% { box-shadow: 0 0 0 6px rgba(56, 226, 234, 0.20), var(--glow-cyan); }
}
.audit-step.is-done .audit-step__mark {
  border-color: var(--accent-3);
  background: var(--accent-3);
}
.audit-step.is-done .audit-step__mark::after {
  content: "\2713";
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-size: 11px;
  font-weight: 800;
  color: #04121a;
}
.audit-step__text {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.audit-step__label {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text);
}
.audit-step__sub {
  font-size: 12px;
  line-height: 1.4;
  color: var(--text-faint);
}
.audit-running__bar {
  height: 4px;
  border-radius: 999px;
  background: rgba(140, 170, 230, 0.14);
  overflow: hidden;
}
.audit-running__fill {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--accent), var(--accent-3));
  box-shadow: var(--glow-cyan);
}
.audit-running__bar.is-working {
  position: relative;
}
.audit-running__bar.is-working::after {
  content: "";
  position: absolute;
  top: 0;
  bottom: 0;
  left: -40%;
  width: 40%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.45), transparent);
  animation: audit-bar-sweep 1.1s ease-in-out infinite;
}
@keyframes audit-bar-sweep {
  from { left: -40%; }
  to { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .audit-running { animation: none; }
  .audit-step { opacity: 1; transform: none; transition: none; }
  .audit-step.is-active .audit-step__mark { animation: none; }
  .audit-running__bar.is-working::after { animation: none; display: none; }
}

/* Summary header */
.audit-summary {
  display: flex;
  gap: 14px;
  align-items: center;
  margin-bottom: 14px;
}
.audit-score {
  --pct: 0;
  position: relative;
  width: 92px;
  height: 92px;
  flex-shrink: 0;
  border-radius: 50%;
  display: grid;
  place-content: center;
  text-align: center;
  background: conic-gradient(
    var(--accent) calc(var(--pct) * 1%),
    rgba(255, 255, 255, 0.08) calc(var(--pct) * 1%)
  );
}
.audit-score::before {
  content: "";
  position: absolute;
  inset: 7px;
  border-radius: 50%;
  background: var(--glass-strong);
}
.audit-score strong {
  position: relative;
  font-size: 22px;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.audit-score small {
  position: relative;
  display: block;
  max-width: 58px;
  margin-top: 3px;
  font-size: 9px;
  line-height: 1.15;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-faint);
}
.audit-summary__meta {
  min-width: 0;
}
.audit-panel__title {
  margin: 2px 0 4px;
  font-size: 15px;
  line-height: 1.25;
}
.audit-summary__sub {
  margin: 0 0 8px;
  font-size: 11px;
  color: var(--text-faint);
}
.audit-tally {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
}
.audit-tally__item {
  font-size: 11px;
  color: var(--text-dim);
}
.audit-tally__item strong {
  font-size: 13px;
  font-variant-numeric: tabular-nums;
}
.audit-tally__item--pass strong {
  color: var(--accent-3);
}
.audit-tally__item--partial strong {
  color: #f6c445;
}
.audit-tally__item--fail strong {
  color: var(--danger);
}

/* Status chips + dots */
.audit-chip {
  flex-shrink: 0;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 999px;
  border: 1px solid transparent;
}
.audit-chip--pass {
  color: var(--accent-3);
  background: rgba(74, 222, 128, 0.12);
  border-color: rgba(74, 222, 128, 0.4);
}
.audit-chip--partial {
  color: #f6c445;
  background: rgba(246, 196, 69, 0.12);
  border-color: rgba(246, 196, 69, 0.4);
}
.audit-chip--fail {
  color: var(--danger);
  background: rgba(251, 113, 133, 0.12);
  border-color: rgba(251, 113, 133, 0.4);
}
.audit-chip--na {
  color: var(--text-faint);
  background: rgba(255, 255, 255, 0.05);
  border-color: var(--glass-border-soft);
}
.audit-dot,
.audit-req__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.audit-dot--pass,
.audit-req__dot.is-pass {
  background: var(--accent-3);
  box-shadow: 0 0 8px rgba(74, 222, 128, 0.5);
}
.audit-dot--partial,
.audit-req__dot.is-partial {
  background: #f6c445;
  box-shadow: 0 0 8px rgba(246, 196, 69, 0.5);
}
.audit-dot--fail,
.audit-req__dot.is-fail {
  background: var(--danger);
  box-shadow: 0 0 8px rgba(251, 113, 133, 0.5);
}

/* Specification cards */
.audit-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.audit-spec {
  border-radius: 12px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.025);
  overflow: hidden;
}
.audit-spec__head {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  background: transparent;
  border: 0;
  cursor: pointer;
  text-align: left;
  font-family: var(--font);
  color: var(--text);
}
.audit-spec__head:hover {
  background: rgba(56, 226, 234, 0.06);
}
.audit-spec__heading {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.audit-spec__name {
  font-size: 12.5px;
  font-weight: 600;
  line-height: 1.25;
}
.audit-spec__ratio {
  font-size: 10.5px;
  color: var(--text-faint);
}
.audit-spec__caret {
  color: var(--text-faint);
  font-size: 11px;
  transition: transform 0.2s ease;
}
.audit-spec.is-open .audit-spec__caret {
  transform: rotate(90deg);
}
.audit-spec__detail {
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease;
}
.audit-spec.is-open .audit-spec__detail {
  max-height: 960px;
}
.audit-spec__desc {
  margin: 0 12px 8px;
  font-size: 11.5px;
  line-height: 1.5;
  color: var(--text-dim);
}
.audit-spec__layers {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 0 10px 6px;
}
.audit-layer {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 6px 8px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: rgba(255, 255, 255, 0.02);
  cursor: pointer;
  font-family: var(--font);
  font-size: 11.5px;
  color: var(--text-dim);
  text-align: left;
  transition: background 0.2s ease, border-color 0.2s ease, transform 0.2s ease;
}
.audit-layer:hover {
  background: rgba(56, 226, 234, 0.1);
  border-color: rgba(56, 226, 234, 0.25);
  transform: translateX(2px);
}
.audit-layer__name {
  flex: 1;
  color: var(--text);
}
.audit-layer__entity {
  font-size: 10px;
  color: var(--text-faint);
}
.audit-layer__count {
  font-size: 10.5px;
  font-variant-numeric: tabular-nums;
  color: var(--text-dim);
}

/* Requirement evidence block */
.audit-req-list {
  padding: 8px 12px;
  margin: 4px 10px 8px;
  border-radius: 9px;
  background: rgba(0, 0, 0, 0.18);
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.audit-req-list .kicker {
  margin-bottom: 2px;
}
.audit-req {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
}
.audit-req__label {
  flex: 1;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-req__evidence {
  color: var(--text-faint);
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
}
.audit-spec__note {
  margin: 0 12px 12px;
  font-size: 11px;
  line-height: 1.5;
  color: var(--text-faint);
}
.audit-spec__note strong {
  color: var(--accent-bright);
}

/* BCF issue actions (shown on failing / partial specs) */
.audit-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 12px 12px;
}
.audit-actions__btn {
  flex: 1 1 auto;
  font-family: var(--font);
  font-size: 11px;
  font-weight: 600;
  color: var(--text-dim);
  padding: 7px 10px;
  border-radius: 9px;
  border: 1px solid rgba(251, 146, 60, 0.35);
  background: rgba(251, 146, 60, 0.08);
  cursor: pointer;
  transition: background 0.18s ease, border-color 0.18s ease, color 0.18s ease,
    transform 0.18s ease;
}
.audit-actions__btn:hover {
  color: var(--text);
  border-color: rgba(251, 146, 60, 0.6);
  background: rgba(251, 146, 60, 0.16);
  transform: translateY(-1px);
}
.audit-actions__btn:disabled {
  opacity: 0.6;
  cursor: progress;
  transform: none;
}

/* Footer */
.audit-foot {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid var(--glass-border-soft);
}
.audit-foot__link {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  font-weight: 600;
  color: var(--accent-bright);
  text-decoration: none;
  padding: 5px 10px;
  border-radius: 8px;
  border: 1px solid rgba(56, 226, 234, 0.28);
  background: rgba(56, 226, 234, 0.08);
}
.audit-foot__link:hover {
  border-color: var(--accent);
  box-shadow: 0 0 12px -4px var(--accent);
}
.audit-foot__note {
  margin: 8px 0 0;
  font-size: 10px;
  line-height: 1.5;
  color: var(--text-faint);
}

/* Buttons (setup + footer actions) */
.audit-btn {
  font-family: var(--font);
  font-size: 12px;
  font-weight: 600;
  border-radius: 9px;
  padding: 8px 12px;
  cursor: pointer;
  border: 1px solid transparent;
  transition: background 0.18s ease, border-color 0.18s ease, box-shadow 0.18s ease,
    transform 0.18s ease, color 0.18s ease;
}
.audit-btn--ghost {
  color: var(--text-dim);
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--glass-border-soft);
}
.audit-btn--ghost:hover {
  color: var(--text);
  border-color: rgba(56, 226, 234, 0.4);
  background: rgba(56, 226, 234, 0.08);
}
.audit-btn--primary {
  width: 100%;
  margin-top: 14px;
  padding: 11px 14px;
  font-size: 13px;
  color: #04121a;
  background: linear-gradient(180deg, #5eeaf0, var(--accent));
  border-color: transparent;
  box-shadow: 0 8px 24px -10px rgba(56, 226, 234, 0.8);
}
.audit-btn--primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 12px 28px -8px rgba(56, 226, 234, 0.95);
}

/* Setup / upload screen */
.audit-setup__title {
  margin: 6px 0 6px;
  font-size: 16px;
  line-height: 1.25;
}
.audit-setup__intro {
  margin: 0 0 14px;
  font-size: 12px;
  line-height: 1.55;
  color: var(--text-dim);
}
.audit-source {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 12px;
  border: 1px solid var(--glass-border-soft);
  background: rgba(255, 255, 255, 0.03);
}
.audit-source__icon {
  display: grid;
  place-items: center;
  width: 34px;
  height: 34px;
  flex-shrink: 0;
  border-radius: 9px;
  background: rgba(56, 226, 234, 0.12);
  color: var(--accent-bright);
  font-size: 17px;
}
.audit-source__meta {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.audit-source__name {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.audit-source__tag {
  font-size: 10px;
  color: var(--text-faint);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.audit-source__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}
.audit-upload {
  display: block;
  margin-top: 12px;
  cursor: pointer;
}
.audit-upload__input {
  position: absolute;
  width: 1px;
  height: 1px;
  opacity: 0;
  pointer-events: none;
}
.audit-upload__btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 10px 12px;
  border-radius: 10px;
  border: 1px dashed rgba(140, 170, 230, 0.35);
  background: rgba(255, 255, 255, 0.02);
  color: var(--text-dim);
  font-size: 12px;
  font-weight: 600;
  transition: border-color 0.18s ease, color 0.18s ease, background 0.18s ease;
}
.audit-upload:hover .audit-upload__btn {
  border-color: rgba(56, 226, 234, 0.5);
  color: var(--text);
  background: rgba(56, 226, 234, 0.06);
}
.audit-upload__note {
  margin: 8px 2px 0;
  font-size: 10.5px;
  line-height: 1.5;
  color: var(--text-faint);
}
.audit-upload__note.is-error {
  color: var(--danger);
}
.audit-foot__actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 4px;
}
.audit-foot__actions .audit-btn {
  flex: 1;
}

@media (max-width: 720px) {
  .audit-panel {
    right: 14px;
    left: 14px;
    width: auto;
    max-width: none;
  }
}

/* On-screen caption naming what the active 3D audit review is showing. */
.audit-review-caption {
  position: absolute;
  top: 96px;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  flex-direction: column;
  gap: 5px;
  max-width: min(720px, 80vw);
  padding: 16px 26px;
  background: var(--glass-strong);
  border: 1px solid var(--glass-border);
  border-left: 4px solid var(--danger);
  border-radius: 14px;
  box-shadow: var(--shadow);
  backdrop-filter: blur(var(--blur));
  -webkit-backdrop-filter: blur(var(--blur));
  color: var(--text);
  font-family: var(--font);
  text-align: center;
  pointer-events: none;
  z-index: 60;
}
.audit-review-caption__kicker {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.audit-review-caption__why {
  font-size: 22px;
  font-weight: 800;
  line-height: 1.28;
  color: var(--text);
  margin: 2px 0 1px;
}
.audit-review-caption__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-dim);
}
.audit-review-caption__detail {
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-faint);
}
.audit-review-caption__action {
  margin-top: 8px;
  padding-top: 9px;
  border-top: 1px solid var(--glass-border);
  font-size: 14.5px;
  font-weight: 600;
  letter-spacing: 0.01em;
  color: var(--accent-bright);
}

@media (max-width: 720px) {
  .audit-review-caption {
    max-width: calc(100vw - 28px);
  }
}

/* =============================================================================
   Site environmental sensors (Current Construction Progress view)
   Live, draggable telemetry panel pinned to the top-right corner.
   ============================================================================= */
.sensor-panel {
  position: absolute;
  top: 96px;
  right: 84px;
  z-index: 12;
  width: 252px;
  max-height: calc(100vh - 132px);
  padding: 13px 14px 11px;
  display: flex;
  flex-direction: column;
  gap: 9px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sensor-panel__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  cursor: grab;
  touch-action: none;
  user-select: none;
}
.sensor-panel.is-dragging,
.sensor-panel.is-dragging .sensor-panel__head {
  cursor: grabbing;
}
.sensor-panel__id {
  display: flex;
  flex: 1;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.sensor-panel__id .kicker {
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sensor-live {
  flex: none;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #34d399;
  box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.55);
  animation: sensorPulse 2.2s ease-out infinite;
}
@keyframes sensorPulse {
  0% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0.5);
  }
  70% {
    box-shadow: 0 0 0 7px rgba(52, 211, 153, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(52, 211, 153, 0);
  }
}
.sensor-panel__meta {
  display: flex;
  justify-content: space-between;
  gap: 8px;
  margin-top: -3px;
  font-size: 13px;
  font-weight: 500;
  letter-spacing: 0.02em;
  color: #e2e8f0;
}
.sensor-activity {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  margin-top: -1px;
}
.sensor-activity__stat {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 8px 10px;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.sensor-activity__icon {
  flex: none;
  display: flex;
  color: var(--accent-bright);
  opacity: 0.92;
}
.sensor-activity__val {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
  min-width: 0;
}
.sensor-activity__val strong {
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
}
.sensor-activity__val small {
  font-size: 11px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.78;
}
.sensor-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.sensor-row {
  display: grid;
  grid-template-columns: 1fr auto 9px;
  align-items: center;
  gap: 9px;
  padding: 6px 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.sensor-row:first-child {
  border-top: 0;
}
.sensor-row__label {
  display: flex;
  align-items: baseline;
  gap: 5px;
  font-size: 14px;
  color: var(--text);
  opacity: 1;
}
.sensor-row__q {
  font-size: 10.5px;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  opacity: 0.75;
}
.sensor-row__read {
  display: flex;
  align-items: baseline;
  gap: 3px;
  justify-self: end;
  font-variant-numeric: tabular-nums;
}
.sensor-row__read strong {
  font-size: 18px;
  font-weight: 650;
  line-height: 1;
  color: var(--accent-bright);
  transition: color 0.3s ease;
}
.sensor-row__read small {
  font-size: 11.5px;
  opacity: 0.85;
  white-space: nowrap;
}
.sensor-row__read--dual {
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
}
.sensor-row__read--dual > span {
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.sensor-row__read--dual strong {
  font-size: 14px;
}
.sensor-row--gas {
  display: block;
  padding: 8px 1px;
}
.sensor-gas__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
}
.sensor-gas__watch {
  margin-left: auto;
  text-align: right;
  font-size: 11.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  line-height: 1.25;
  color: #94a3b8;
}
.sensor-gas__grid {
  margin-top: 8px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px 12px;
}
.gas-chip {
  display: flex;
  align-items: baseline;
  gap: 5px;
}
.gas-chip em {
  font-style: normal;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.02em;
  opacity: 0.72;
  min-width: 30px;
}
.gas-chip strong {
  margin-left: auto;
  font-size: 15px;
  font-weight: 650;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  color: var(--accent-bright);
  transition: color 0.3s ease;
}
.gas-chip small {
  font-size: 10px;
  opacity: 0.7;
  white-space: nowrap;
  min-width: 32px;
}
.sensor-row__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  justify-self: center;
  background: #38e2ea;
  box-shadow: 0 0 8px -1px #38e2ea;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.sensor-summary {
  display: flex;
  gap: 9px;
  margin-top: 4px;
  padding-top: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.sensor-summary__dot {
  flex: none;
  width: 10px;
  height: 10px;
  margin-top: 4px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 9px -1px #4ade80;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.sensor-summary__text {
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.sensor-summary__text strong {
  font-size: 13.5px;
  font-weight: 700;
  letter-spacing: 0.01em;
  transition: color 0.3s ease;
}
.sensor-summary__text span {
  font-size: 12.5px;
  line-height: 1.42;
  color: #dbe4ee;
}
.sensor-panel.is-collapsed {
  gap: 0;
}
.sensor-panel.is-collapsed .sensor-panel__meta,
.sensor-panel.is-collapsed .sensor-activity,
.sensor-panel.is-collapsed .sensor-list,
.sensor-panel.is-collapsed .sensor-summary,
.sensor-panel.is-collapsed .sensor-help-button {
  display: none;
}
/* Head buttons (detail + collapse sit side by side). */
.sensor-panel__btns {
  display: flex;
  align-items: center;
  gap: 4px;
  flex: none;
}

/* Summary and detail are two separate panels — opening one hides the other. */
.sensor-panel.is-hidden {
  display: none;
}

/* Detail panel: a tall, scrollable right-hand panel with the full breakdown. */
.sensor-detail-panel {
  position: absolute;
  top: 96px;
  right: 84px;
  z-index: 48;
  width: 430px;
  max-height: calc(100vh - 132px);
  padding: 13px 15px 12px;
  display: none;
  flex-direction: column;
  gap: 10px;
  overflow-y: auto;
  overflow-x: hidden;
}
.sensor-detail-panel.is-open {
  display: flex;
}
/* Both sensor panels share the app's thin cyan scrollbar so the taller detail
   panel never shows the chunky default bar. */
.sensor-panel,
.sensor-detail-panel {
  scrollbar-width: thin;
  scrollbar-color: rgba(56, 226, 234, 0.4) transparent;
}
.sensor-panel::-webkit-scrollbar,
.sensor-detail-panel::-webkit-scrollbar {
  width: 6px;
}
.sensor-panel::-webkit-scrollbar-thumb,
.sensor-detail-panel::-webkit-scrollbar-thumb {
  background: rgba(56, 226, 234, 0.35);
  border-radius: 999px;
}
.sensor-panel::-webkit-scrollbar-track,
.sensor-detail-panel::-webkit-scrollbar-track {
  background: transparent;
}
.sensor-detail {
  display: flex;
  flex-direction: column;
  gap: 11px;
}

/* Click-to-inspect card — a live, anonymised reading popup for one sensor. */
.sensor-pop {
  position: fixed;
  z-index: 100002;
  width: 226px;
  padding: 12px 14px 11px;
  border-radius: 14px;
  display: none;
  flex-direction: column;
  cursor: grab;
  touch-action: none;
}
.sensor-pop.is-visible {
  display: flex;
}
.sensor-pop.is-dragging {
  cursor: grabbing;
  user-select: none;
}
.sensor-pop__close {
  position: absolute;
  top: 7px;
  right: 8px;
  width: 22px;
  height: 22px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: #cbd5e1;
  font-size: 17px;
  line-height: 1;
  cursor: pointer;
}
.sensor-pop__close:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}
.sensor-pop__tag {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--accent-bright);
}
.sensor-pop__name {
  margin-top: 1px;
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  padding-right: 20px;
}
.sensor-pop__status {
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 7px;
}
.sensor-pop__dot {
  width: 9px;
  height: 9px;
  border-radius: 50%;
  flex: none;
}
.sensor-pop__cat {
  font-size: 11.5px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.sensor-pop__hero {
  display: flex;
  align-items: baseline;
  gap: 5px;
  margin: 5px 0 9px;
}
.sensor-pop__hero strong {
  font-size: 30px;
  font-weight: 800;
  line-height: 1;
  color: var(--accent-bright);
  font-variant-numeric: tabular-nums;
}
.sensor-pop__unit {
  font-size: 12.5px;
  opacity: 0.75;
}
.sensor-pop__note {
  margin: -2px 0 9px;
  font-size: 11px;
  font-weight: 650;
  letter-spacing: 0.01em;
}
.sensor-pop__rows {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.sensor-pop__rows li {
  display: flex;
  justify-content: space-between;
  gap: 14px;
  font-size: 12px;
}
.sensor-pop__rows li span {
  opacity: 0.62;
}
.sensor-pop__rows li b {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  text-align: right;
}
.sensor-pop__foot {
  margin-top: 9px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  font-size: 10px;
  letter-spacing: 0.02em;
  opacity: 0.6;
}

/* Section label inside the detail dashboard. */
.dp-label {
  margin-top: 2px;
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cbd5e1;
}

/* Big, scannable condition tiles: icon + large value + label + status dot. */
.metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.metric-tile {
  position: relative;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border-radius: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
}
.metric-tile--wide {
  grid-column: 1 / -1;
}
.metric-tile__icon {
  flex: none;
  display: flex;
  color: var(--accent-bright);
  opacity: 0.9;
}
.metric-tile__text {
  display: flex;
  flex-direction: column;
  gap: 3px;
  min-width: 0;
  line-height: 1.02;
}
.metric-tile__top {
  display: flex;
  align-items: baseline;
  gap: 3px;
}
.metric-tile__top strong {
  font-size: 21px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--accent-bright);
  transition: color 0.3s ease;
}
.metric-tile__top small {
  font-size: 10.5px;
  opacity: 0.82;
  white-space: nowrap;
}
.metric-tile__label {
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.75;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.metric-tile__dot {
  position: absolute;
  top: 9px;
  right: 9px;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #38e2ea;
  box-shadow: 0 0 8px -1px #38e2ea;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.sensor-detail__sources {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
}
.src-chip {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 6px 9px;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 12px;
}
.src-chip__dot {
  flex: none;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #94a3b8;
  box-shadow: 0 0 8px -1px #94a3b8;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.src-chip__name {
  font-weight: 600;
  color: var(--text);
}
.src-chip__state {
  margin-left: auto;
  font-size: 10.5px;
  letter-spacing: 0.02em;
  opacity: 0.82;
}
.sensor-detail__group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.sensor-detail__title {
  display: flex;
  align-items: baseline;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cbd5e1;
}
.sensor-detail__title small {
  font-size: 10.5px;
  font-weight: 500;
  letter-spacing: 0.02em;
  text-transform: none;
  opacity: 0.72;
}
.sensor-mini {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
}
.sensor-mini li {
  display: grid;
  grid-template-columns: 1fr auto 8px;
  align-items: center;
  gap: 8px;
  padding: 4px 1px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
}
.sensor-mini li:first-child {
  border-top: 0;
}
.sensor-mini__label {
  display: flex;
  align-items: baseline;
  gap: 5px;
  min-width: 0;
  font-size: 13px;
  color: var(--text);
}
.sensor-mini__label small {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  opacity: 0.7;
}
.sensor-mini__read {
  display: flex;
  align-items: baseline;
  gap: 3px;
  justify-self: end;
  font-variant-numeric: tabular-nums;
  font-size: 15px;
  font-weight: 650;
  color: var(--accent-bright);
  transition: color 0.3s ease;
}
.sensor-mini__read small {
  font-size: 10.5px;
  font-weight: 500;
  opacity: 0.8;
  white-space: nowrap;
}
.sensor-mini__dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  justify-self: center;
  background: #38e2ea;
  box-shadow: 0 0 7px -1px #38e2ea;
  transition: background 0.3s ease, box-shadow 0.3s ease;
}
.sensor-mini li.is-offsite .sensor-mini__label {
  opacity: 0.66;
}
.sensor-detail__foot {
  margin: 2px 0 0;
  font-size: 11.5px;
  line-height: 1.5;
  color: #93a4b8;
}
.sensor-detail__foot strong {
  color: #cbd5e1;
  font-weight: 650;
}

.sensor-detail__sources[hidden] { display: none; }
.sensor-help-button {
  position: sticky;
  bottom: 0;
  z-index: 1;
  flex-shrink: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 7px 10px;
  border: 1px solid rgba(56, 226, 234, 0.25);
  border-radius: 8px;
  background: #18232f;
  color: var(--accent-bright);
  font: inherit;
  font-size: 12px;
  font-weight: 600;
  line-height: 1.4;
  cursor: pointer;
}
.sensor-help-button span { font-weight: 800; }
.sensor-help-button:hover { background: #213440; }
.sensor-help-button:focus-visible { outline: 2px solid var(--accent-bright); outline-offset: 2px; }

/* Sensor-location map controls (show/hide + per-type filters) — in both panels. */
.loc-controls {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-top: 4px;
  padding-top: 11px;
  border-top: 1px solid rgba(255, 255, 255, 0.09);
}
.loc-controls__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}
.loc-controls__title {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: #cbd5e1;
}
.loc-toggle {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 10px 14px;
  border-radius: 11px;
  border: 1px solid rgba(56, 226, 234, 0.5);
  background: rgba(56, 226, 234, 0.14);
  color: #bff6fa;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 0 18px -7px rgba(56, 226, 234, 0.6);
  transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.loc-toggle__icon {
  flex: none;
  width: 16px;
  height: 16px;
  opacity: 0.95;
}
.loc-toggle:hover {
  background: rgba(56, 226, 234, 0.22);
  border-color: rgba(56, 226, 234, 0.8);
  box-shadow: 0 0 26px -5px rgba(56, 226, 234, 0.85);
}
.loc-toggle.is-on {
  background: rgba(56, 226, 234, 0.26);
  border-color: rgba(56, 226, 234, 0.85);
  color: #e2fdff;
}
.loc-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  transition: opacity 0.2s ease;
}
.loc-chips.is-disabled {
  opacity: 0.4;
}
.loc-chip {
  display: inline-flex;
  align-items: center;
  padding: 4px 10px;
  border-radius: 999px;
  border: 1px solid rgba(255, 255, 255, 0.16);
  background: rgba(255, 255, 255, 0.06);
  color: var(--text);
  font: inherit;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
  cursor: pointer;
  transition: background 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}
.loc-chip::before {
  content: "";
  display: inline-block;
  width: 7px;
  height: 7px;
  margin-right: 6px;
  border-radius: 50%;
  background: var(--chip, #94a3b8);
  box-shadow: 0 0 7px -1px var(--chip, #94a3b8);
}
.loc-chip[data-type="noise"] {
  --chip: #c4b5fd;
}
.loc-chip[data-type="dust"] {
  --chip: #fcd34d;
}
.loc-chip[data-type="gas"] {
  --chip: #f9a8d4;
}
.loc-chip[data-type="wind"] {
  --chip: #7dd3fc;
}
.loc-chip:hover {
  background: rgba(255, 255, 255, 0.12);
}
.loc-chip--all::before {
  display: none;
}
.loc-chip.is-active {
  border-color: var(--chip, #cbd5e1);
  background: rgba(255, 255, 255, 0.14);
  color: #fff;
}
.loc-chip.is-active::before {
  box-shadow: 0 0 8px 0 var(--chip, #cbd5e1);
}
.loc-chip:disabled {
  cursor: default;
}

/* Progress view: the "Live Sensors on Site" panel sits just to the left of the
   right-hand nav-stack (which folds in the Layers flyout, mirroring Slice) —
   both are anchored to the top-right, side by side. The Layers/Slice flyouts
   open to the left of the sensor panel so nothing overlaps it. */
body[data-help="progress"] .nav-stack {
  top: 96px;
  transform: none;
}
body[data-help="progress"] .layers-panel {
  top: 96px;
  right: 344px;
  bottom: auto;
  z-index: 12;
  transform: translateX(12px);
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}
body[data-help="progress"] .layers-panel.is-open {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateX(0);
}
body[data-help="progress"] .slice-panel {
  top: 96px;
  right: 344px;
  transform: translateX(12px);
}
body[data-help="progress"] .slice-panel.is-open {
  transform: translateX(0);
}

/* Planning view: match the progress page — anchor the nav-stack to the top-right
   corner, with the Layers panel just to its left and the Slice flyout opening to
   the left of that, all top-aligned. */
body[data-help="index"] .nav-stack {
  top: 96px;
  transform: none;
}
body[data-help="index"] .layers-panel {
  top: 96px;
  right: 84px;
}
body[data-help="index"] .slice-panel {
  top: 96px;
  right: 308px;
  transform: translateX(12px);
}
body[data-help="index"] .slice-panel.is-open {
  transform: translateX(0);
}

@media (max-height: 720px) {
  .sensor-panel,
  .sensor-detail-panel {
    top: 88px;
  }
}

/* =============================================================================
   Projects — Vertical (building) | Linear (roadway)
   <html data-project> is set by each page's inline <head> script, so the other
   project's UI is hidden before first paint.
   ============================================================================= */
html[data-project="linear"] .vertical-only,
html[data-project="vertical"] .linear-only {
  display: none !important;
}

/* Top bar: the project switch sits with the view link in the middle. */
.topbar__center {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}
.project-switch {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--glass-border);
}
.project-switch__opt {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 5px 14px 5px 10px;
  border-radius: 999px;
  color: var(--text-dim);
  text-decoration: none;
  white-space: nowrap;
  transition: background 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
}
.project-switch__opt:hover {
  color: var(--text);
  background: rgba(56, 226, 234, 0.1);
}
.project-switch__opt:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
html[data-project="vertical"] .project-switch__opt[data-project-link="vertical"],
html[data-project="linear"] .project-switch__opt[data-project-link="linear"] {
  color: var(--text);
  background: linear-gradient(135deg, rgba(56, 226, 234, 0.22), rgba(124, 92, 255, 0.16));
  box-shadow: inset 0 0 0 1px rgba(56, 226, 234, 0.5), 0 0 16px -6px var(--accent);
}
.project-switch__icon {
  flex-shrink: 0;
  color: var(--accent-bright);
}
.project-switch__text {
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.15;
}
.project-switch__kind {
  font-size: 12.5px;
  font-weight: 700;
  letter-spacing: 0.02em;
}
.project-switch__name {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-faint);
}

@media (max-width: 1320px) {
  .project-switch__name {
    display: none;
  }
}
@media (max-width: 1120px) {
  .topbar__status {
    display: none;
  }
}
@media (max-width: 720px) {
  .topbar {
    padding: 0 10px;
    gap: 6px;
  }
  .brand {
    gap: 10px;
  }
  .topbar__center {
    gap: 6px;
  }
  .project-switch {
    padding: 2px;
    gap: 2px;
  }
  .project-switch__text {
    display: none;
  }
  .project-switch__opt {
    padding: 6px 8px;
  }
}

/* Long lists (the roadway's ten systems): one line per row, bar inline. */
.layer-list--compact {
  gap: 3px;
}
.layer-list--compact li {
  grid-template-columns: 10px 1fr 64px auto;
  padding: 6px 12px;
}
.layer-list--compact .layer-bar {
  grid-column: 3;
  grid-row: 1;
  height: 6px;
}
.layer-list--compact .layer-pct {
  font-size: 13px;
  min-width: 38px;
  grid-column: 4;
}

/* Nav-stack buttons switched off for a reason (title says why). */
.nav-btn[aria-disabled="true"] {
  opacity: 0.38;
  cursor: not-allowed;
}
.nav-btn[aria-disabled="true"]:hover {
  background: rgba(255, 255, 255, 0.04);
  border-color: var(--glass-border-soft);
  color: var(--text);
  box-shadow: none;
}
.nav-btn svg {
  display: block;
}

/* Short status line under the top bar (basemap switching). */
.toast {
  position: absolute;
  top: 96px;
  left: 50%;
  z-index: 40;
  max-width: min(520px, calc(100vw - 36px));
  padding: 10px 16px;
  border-radius: 12px;
  font-size: 12.5px;
  line-height: 1.45;
  color: var(--text);
  text-align: center;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  transform: translate(-50%, -6px);
  transition: opacity 0.25s ease, transform 0.25s ease, visibility 0.25s ease;
}
.toast.is-visible {
  opacity: 1;
  visibility: visible;
  transform: translate(-50%, 0);
}
.toast[data-tone="warn"] {
  border-color: rgba(246, 196, 69, 0.5);
}

/* Progress view, linear project: no IoT panel, so the Layers / Slice flyouts
   open right next to the nav stack. */
html[data-project="linear"] body[data-help="progress"] .layers-panel,
html[data-project="linear"] body[data-help="progress"] .slice-panel {
  right: 84px;
}

@media (prefers-reduced-motion: reduce) {
  .toast,
  .project-switch__opt {
    transition: none;
  }
}
