/* ---------------------------------------------------------------------
   Design system, redone after DroneSentry-C2 (DroneShield's real C-UAS
   platform — see CLAUDE.md): near-monochrome tactical, not pastel. The
   base is grayscale, desaturated real satellite imagery underneath; color
   is spent sparingly, on meaning only — one muted green for "ours/live/
   clear", one warm red for "threat/denied", amber for caution, everything
   else stays gray. No border-radius above 3px on chrome/rows: sharp reads
   as instrument. Color is never the only signal for a class — shape and
   text always corroborate it.
------------------------------------------------------------------------ */
:root {
  --void: #0a0b0d;        /* page background */
  --surface: #101214;     /* panel background */
  --surface-raised: #17191c; /* hover / active row */
  --line: #212427;        /* the only border weight in the system */
  --line-strong: #383c41;
  --ink: #e5e7ea;         /* primary text */
  --ink-dim: #868c93;     /* labels, secondary text */
  --ink-faint: #4c5157;   /* tertiary / placeholder */

  --signal: #5fbf7a;      /* UI chrome: live dot, focus ring, selection halo, site marker — "operational" */
  --signal-wash: rgba(95, 191, 122, 0.14);

  /* category identity — the one color each for "this is a sensor" /
     "this is an effector", reused for that unit's marker AND its coverage
     circle so the two always visually agree. Muted, not bright — accents,
     not decoration. */
  --sensor: #6f93b8;      /* muted slate blue */
  --sensor-wash: rgba(111, 147, 184, 0.14);
  --effector: #c98a4a;    /* muted amber-brown */
  --effector-wash: rgba(201, 138, 74, 0.16);

  /* semantic — track threat/status, reserved for meaning only */
  --ok: #5fbf7a;          /* bird / clear — same hue as --signal: both mean "benign" */
  --ok-wash: rgba(95, 191, 122, 0.14);
  --warn: #d1a34a;        /* commercial drone / caution */
  --warn-wash: rgba(209, 163, 74, 0.16);
  --danger: #d9573f;      /* fpv drone / denied / hard no-fire */
  --danger-wash: rgba(217, 87, 63, 0.18);
  --friendly: #5fbf7a;
  --friendly-wash: rgba(95, 191, 122, 0.14);
  --info: #7a828c;        /* unknown — deliberately hue-less: uncertain reads as gray */
  --info-wash: rgba(122, 130, 140, 0.14);

  --radius: 3px;
  --sans: -apple-system, BlinkMacSystemFont, "Segoe UI", "Inter", system-ui, sans-serif;
  --mono: ui-monospace, "SF Mono", "JetBrains Mono", "IBM Plex Mono", Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--void);
  color: var(--ink);
  font-family: var(--sans);
  font-size: 13px;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}
button { font-family: inherit; }
:focus-visible { outline: 1px solid var(--signal); outline-offset: 1px; }

/* Every numeric readout in the console shares this: tabular figures so
   columns of data don't jitter as digits change tick to tick. */
.num, .track-row .id, .track-row .meta, .effector-row .meta,
.audit-entry .t, .cda-detail, #simClock, .assess-header {
  font-family: var(--mono);
  font-variant-numeric: tabular-nums;
}

/* --------------------------------------------------------------- notice --- */
.notice {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 16px;
  font-size: 10.5px;
  letter-spacing: 0.03em;
  color: var(--warn);
  background: var(--warn-wash);
  border-bottom: 1px solid var(--line);
}
.notice b { color: var(--ink); font-weight: 600; }

/* --------------------------------------------------------------- topbar --- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 9px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}
.brand { display: flex; align-items: center; gap: 8px; }
.brand-mark { color: var(--signal); font-size: 15px; line-height: 1; }
.brand-name {
  font-size: 11.5px; font-weight: 600; letter-spacing: 0.14em;
  color: var(--ink);
}
.site-info { display: flex; align-items: center; gap: 10px; color: var(--ink-dim); font-size: 11.5px; }
.sep { color: var(--line-strong); }
.status-dot { display: flex; align-items: center; gap: 5px; font-family: var(--mono); }
.status-dot::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.status-connecting { color: var(--warn); }
.status-live { color: var(--ok); }
.status-down { color: var(--danger); }

/* --------------------------------------------------------------- layout --- */
/* The map is the whole canvas, edge to edge — not squeezed into a center
   grid column. Sensors/Effectors and Tracks/Assessment/Audit float over it
   as translucent, blurred cards (DroneSentry-C2's own layout — see
   CLAUDE.md), positioned absolutely within this single stacking context
   rather than laid out in a 3-column grid. */
.layout {
  flex: 1;
  position: relative;
  min-height: 0;
  overflow: hidden;
}

.panel-center {
  position: absolute; inset: 0;
  background: var(--void); /* fallback under the map before tiles paint */
  display: flex; flex-direction: column; padding: 0; min-width: 0;
  z-index: 1;
}

/* Floating side panels. Each .block inside still manages its own overflow
   (see below) — that's what keeps e.g. Effectors visible while a long
   Sensors list scrolls on its own, unchanged by floating over the map. */
.panel-left, .panel-right {
  position: absolute;
  z-index: 10;
  top: 52px; /* clears the view-toolbar, which now spans the full width above every panel */
  width: 280px;
  display: flex; flex-direction: column;
  background: rgba(14, 16, 18, 0.74);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid var(--line-strong);
  border-radius: 8px;
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.5);
  overflow: hidden; /* clip children to the rounded corners */
}
.panel-left { left: 12px; bottom: 96px; } /* leaves room for the zoom control, moved to bottom-left */
.panel-right { right: 12px; bottom: 24px; width: 300px; } /* leaves room for the attribution strip, bottom-right */

.block {
  border-bottom: 1px solid var(--line); padding: 14px 16px;
  display: flex; flex-direction: column; min-height: 0;
}
.block:last-child { border-bottom: none; }
/* Each grouped list gets a fair, independently-scrolling share of its
   panel's height; the assessment block is sized to its own content instead
   of stretching, since it's a form, not a list. */
.sensors-block, .effectors-block, .tracks-block, .audit-block { flex: 1 1 0; }
.assess-block { flex: 0 1 auto; overflow-y: auto; }
.block h2 {
  font-size: 10px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.12em;
  color: var(--ink-dim);
  margin: 0 0 10px;
  display: flex;
  align-items: center;
  gap: 6px;
  flex-shrink: 0;
}
.count { font-family: var(--mono); color: var(--ink-faint); font-weight: 400; }

/* ------------------------------------------------------------ flight rows --- */
/* Tracks and effectors render as hairline-divided rows with a 3px color
   spine, not boxed cards — a flight-strip board, not a stack of tiles. */
.track-list, .effector-list { display: flex; flex-direction: column; }
.scroll-list { flex: 1; overflow-y: auto; min-height: 48px; }
.empty-note { color: var(--ink-faint); font-size: 11.5px; padding: 4px 0; }

.track-row, .effector-row {
  display: flex;
  width: 100%;
  gap: 10px;
  padding: 8px 4px 8px 10px;
  border-left: 3px solid transparent;
  border-bottom: 1px solid var(--line);
  cursor: pointer;
  position: relative;
  /* Selectable rows are div[role=button], not <button>, because they now
     contain real nested <button> row-actions (configure/remove) — a
     <button> cannot legally contain another <button>. Keyboard operability
     is preserved by hand: tabindex + Enter/Space activation in app.js. */
  background: none;
  font: inherit;
  color: inherit;
  text-align: left;
}
.track-list .track-row:last-child, .effector-list .effector-row:last-child { border-bottom: none; }
.track-row:hover, .effector-row:hover { background: var(--surface); }
.track-row.selected, .effector-row.selected { background: var(--signal-wash); }

/* Inline configure/remove — real <button>s nested inside the row; their own
   click handlers stopPropagation so they never trigger row selection. */
.row-actions { display: flex; gap: 2px; flex-shrink: 0; }
.row-action {
  width: 20px; height: 20px; flex-shrink: 0; padding: 0;
  display: flex; align-items: center; justify-content: center;
  background: none; border: 1px solid transparent; border-radius: var(--radius);
  color: var(--ink-faint); font-family: var(--sans); font-size: 12px; line-height: 1; cursor: pointer;
}
.row-action:hover { border-color: var(--line-strong); color: var(--ink); }
.row-action.danger:hover { border-color: var(--danger); color: var(--danger); }

.track-row .spine, .effector-row .spine {
  position: absolute; left: -3px; top: 0; bottom: 0; width: 3px;
}
.spine-bird { background: var(--ok); }
.spine-drone_commercial { background: var(--warn); }
.spine-drone_fpv { background: var(--danger); }
.spine-unknown { background: var(--info); }
.spine-friendly { background: var(--friendly); }
.spine-ready { background: var(--ok); }
.spine-cooldown { background: var(--warn); }
.spine-engaging { background: var(--danger); }
.spine-offline { background: var(--ink-faint); }
.spine-sensor { background: var(--sensor); } /* effector rows keep status-colored spines (ready/cooldown/engaging above) — operationally more useful in a list than a flat identity color */

.row-main { flex: 1; min-width: 0; }
.row-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
/* Groups the type icon + name as one flex item so .row-top keeps its
   original two-slot space-between layout (title vs. row actions) — track
   rows have no icon and stay a bare .id, so this can't regress them. */
.row-title { display: flex; align-items: center; gap: 6px; min-width: 0; }
.row-icon {
  flex-shrink: 0; width: 20px; height: 20px; display: flex; align-items: center;
  justify-content: center; color: var(--void);
}
.row-icon svg { width: 12px; height: 12px; display: block; }
.row-icon-sensor { background: var(--sensor); border-radius: 50%; }
.row-icon-effector { background: var(--effector); border-radius: 5px; }
.row-top .id { font-weight: 600; letter-spacing: 0.01em; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.row-top .tag {
  font-size: 10px; letter-spacing: 0.04em; text-transform: uppercase;
}
.tag-bird { color: var(--ok); } .tag-drone_commercial { color: var(--warn); }
.tag-drone_fpv { color: var(--danger); } .tag-unknown { color: var(--info); }
.tag-friendly { color: var(--friendly); }
.tag-ready { color: var(--ok); } .tag-cooldown { color: var(--warn); }
.tag-engaging { color: var(--danger); } .tag-offline { color: var(--ink-faint); }
.tag-neutral { color: var(--ink-faint); }

.row-meta { color: var(--ink-dim); font-size: 11px; margin-top: 3px; display: flex; justify-content: space-between; gap: 8px; }
.row-meta .rf-on { color: var(--warn); }

.threat-track { height: 2px; background: var(--line); margin-top: 7px; overflow: hidden; }
.threat-track > div { height: 100%; background: var(--ink-dim); }
.threat-track.lv-ok > div { background: var(--ok); }
.threat-track.lv-warn > div { background: var(--warn); }
.threat-track.lv-danger > div { background: var(--danger); }

/* --------------------------------------------------------- view toolbar --- */
.view-toolbar {
  display: flex; justify-content: space-between; align-items: center;
  padding: 0 16px; border-bottom: 1px solid var(--line); background: var(--surface);
  flex-shrink: 0;
}
.view-toggle { display: flex; gap: 20px; }
.toggle-btn {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--ink-faint); cursor: pointer; font-family: var(--sans);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.1em;
  padding: 11px 0; margin-bottom: -1px;
  transition: color 0.15s ease, border-color 0.15s ease;
}
.toggle-btn:hover { color: var(--ink-dim); }
.toggle-btn.active { color: var(--signal); border-bottom-color: var(--signal); }

.legend { display: flex; align-items: center; gap: 14px; color: var(--ink-faint); font-size: 10.5px; }
.legend-item { display: flex; align-items: center; gap: 5px; }
.legend-sep { padding-left: 14px; border-left: 1px solid var(--line); }
.dot { width: 6px; height: 6px; border-radius: 50%; display: inline-block; }
.dot-bird { background: var(--ok); }
.dot-commercial { background: var(--warn); }
.dot-fpv { background: var(--danger); }
.dot-unknown { background: var(--info); }

/* --------------------------------------------------------------- deploy --- */
.deploy-bar { display: flex; gap: 8px; }
.deploy-select {
  background: var(--void); color: var(--ink-dim); border: 1px solid var(--line-strong);
  border-radius: var(--radius); padding: 5px 8px; font-family: var(--sans);
  font-size: 11px; cursor: pointer;
}
.deploy-select:hover { color: var(--signal); border-color: var(--signal); }
.deploy-select:focus-visible { color: var(--signal); }

.place-hint {
  display: flex; justify-content: center; gap: 6px;
  padding: 6px; font-size: 11px; letter-spacing: 0.02em;
  color: var(--signal); background: var(--signal-wash);
  border-bottom: 1px solid var(--line); flex-shrink: 0;
}
.place-hint b { font-weight: 700; }
.place-hint .key {
  font-family: var(--mono); border: 1px solid currentColor; border-radius: 2px;
  padding: 0 4px; font-size: 10px; opacity: 0.8;
}
.placing #leafletMap, .placing #threeContainer { cursor: crosshair !important; }
.placing #leafletMap .leaflet-interactive { cursor: crosshair !important; }

.view { display: none; flex: 1; position: relative; min-height: 0; }
.view.active { display: block; }
#leafletMap { width: 100%; height: 100%; background: var(--void); }
#threeContainer { width: 100%; height: 100%; }
.three-fallback {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  text-align: center; padding: 40px; color: var(--ink-dim); font-size: 12px; line-height: 1.6;
  background: var(--void); z-index: 20;
}
.hidden { display: none !important; }

/* ------------------------------------------------------------- leaflet --- */
/* Leaflet ships its own light-theme chrome; restyle its controls to match
   the console rather than leaving a bright white zoom widget in a dark UI. */
.leaflet-container {
  background: var(--void);
  font-family: var(--sans);
}
.leaflet-control-zoom a {
  background: var(--surface) !important; color: var(--ink) !important;
  border: 1px solid var(--line-strong) !important;
}
.leaflet-control-zoom a:hover { background: var(--surface-raised) !important; color: var(--signal) !important; }
.leaflet-control-locate a {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line-strong);
  display: flex; align-items: center; justify-content: center;
}
.leaflet-control-locate a:hover { background: var(--surface-raised); color: var(--signal); }
.leaflet-control-locate svg { width: 16px; height: 16px; }
.leaflet-control-locate a.locating svg { animation: locate-spin 0.9s linear infinite; color: var(--signal); }
@keyframes locate-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .leaflet-control-locate a.locating svg { animation: none; }
}
.leaflet-control-attribution {
  background: rgba(10, 12, 16, 0.75) !important; color: var(--ink-faint) !important;
  font-size: 9.5px !important;
}
.leaflet-control-attribution a { color: var(--ink-dim) !important; }
.leaflet-bar { border: none !important; box-shadow: none !important; }
/* Real satellite imagery (Esri World Imagery), desaturated toward a
   grayscale tactical look rather than shown in full color — matches
   DroneSentry-C2's map treatment; keep the 3D ground texture's filter
   (buildGroundTexture() in app.js) in lockstep with these values. */
.leaflet-tile-pane { filter: grayscale(0.9) brightness(0.55) contrast(1.2); }

/* -------------------------------------------------------------- pins --- */
/* Divicon markers: a small precise dot/reticle, not a teardrop pin —
   tactical map markers read as instrument sensor contacts, not delivery-app
   locations. One muted accent color per category (sensors/effectors), track
   class colors for tracks; a selected unit gets a target-lock double ring
   with a slow expanding pulse — this console's one deliberate motion
   signature, and the one place worth spending it: it's the exact moment an
   operator is about to make an engagement decision. */
.pin {
  width: 18px; height: 18px; position: relative;
  animation: pin-in 0.2s ease-out both;
}
.pin-sensor, .pin-effector { width: 24px; height: 24px; }
.pin-body {
  position: absolute; left: 5px; top: 5px; width: 8px; height: 8px;
  border-radius: 50%;
  border: 1.5px solid var(--void);
  box-shadow: 0 1px 4px rgba(0,0,0,0.6);
}
.pin-dot { display: none; }
/* Every pin kind reads its fill from the same --pin-color custom property,
   set inline per marker in app.js — that's what guarantees a unit's pin and
   its coverage circle (drawn separately, in Leaflet/canvas) never disagree:
   both are handed the same hex from the same SENSOR_COLOR/EFFECTOR_COLOR/
   CLASS_COLOR constant. */
.pin-track .pin-body { background: var(--pin-color, var(--info)); }
.pin-site .pin-body { background: var(--signal); width: 10px; height: 10px; left: 4px; top: 4px; border-width: 2px; }
/* "You are here" — same size/position as the site marker but --info so the
   two are never confused: the site is the fixed protected asset, this is
   wherever the operator's own device currently is. Always .pulsing (set in
   JS on creation) since it isn't a selectable unit and needs to read as
   "live" at a glance. */
.pin-me .pin-body { background: var(--info); width: 10px; height: 10px; left: 4px; top: 4px; border-width: 2px; }
.pin-me .pin-ring { border-color: var(--info); }

/* Sensors/effectors get a bigger badge carrying an actual type icon (radar
   dish, camera, antenna, missile, ...) from TYPE_ICON in app.js — category
   (sensor vs effector) still reads at a glance from shape+color (circle/blue
   vs rounded-square/amber) even before the icon registers; the icon is what
   says *which* radar/jammer/etc. this specific one is. */
.pin-sensor .pin-body, .pin-effector .pin-body {
  left: 1px; top: 1px; width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
}
.pin-sensor .pin-body { background: var(--pin-color, var(--sensor)); border-radius: 50%; }
.pin-effector .pin-body { background: var(--pin-color, var(--effector)); border-radius: 6px; }
.pin-icon { width: 14px; height: 14px; color: var(--void); pointer-events: none; }
.pin-icon svg { width: 100%; height: 100%; display: block; }

.pin.selected .pin-body { box-shadow: 0 0 0 1px var(--void), 0 0 0 3px var(--signal); }
.pin-ring {
  position: absolute; left: 9px; top: 9px; width: 8px; height: 8px;
  border: 1.5px solid var(--signal); border-radius: 50%; transform: translate(-50%, -50%);
  opacity: 0; pointer-events: none;
}
.pin.pulsing .pin-ring { animation: pin-pulse 1.6s ease-out infinite; }
.pin-label {
  position: absolute; left: 22px; top: 3px; white-space: nowrap;
  font-family: var(--mono); font-size: 10px; color: var(--ink-dim);
  text-shadow: 0 1px 3px var(--void), 0 0 6px var(--void);
}
.pin-sensor .pin-label, .pin-effector .pin-label { left: 28px; top: 5px; }
.pin.selected .pin-label { color: var(--signal); font-weight: 600; }

@keyframes pin-in { from { opacity: 0; transform: scale(0.4); } to { opacity: 1; transform: scale(1); } }
@keyframes pin-pulse {
  0% { transform: translate(-50%, -50%) scale(1); opacity: 0.8; }
  100% { transform: translate(-50%, -50%) scale(3.4); opacity: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .pin { animation: none; }
  .pin.pulsing .pin-ring { animation: none; }
}

/* Mirrors the .pin-sensor/.pin-effector badge shapes so the legend reads as
   the same vocabulary as the map: circle = sensor, rounded-square = effector. */
.pin-swatch { width: 9px; height: 9px; display: inline-block; background: var(--sensor); border-radius: 50%; }
.pin-swatch-effector { background: var(--effector); border-radius: 3px; }

/* Leaflet's default divIcon wrapper paints a white box+border — this console
   supplies its own pin markup, so strip that back out. */
.leaflet-div-icon.pin-icon-wrap { background: transparent; border: none; }

.leaflet-tooltip.zone-tip {
  background: rgba(10, 12, 16, 0.8); color: var(--ink-dim); border: 1px solid var(--line);
  border-radius: var(--radius); font-size: 10px; padding: 2px 6px; box-shadow: none;
}
.leaflet-tooltip.zone-tip::before { display: none; }

/* --------------------------------------------------------- assessment --- */
.assess-panel { display: flex; flex-direction: column; gap: 10px; }
.hint { color: var(--ink-dim); margin: 0; line-height: 1.6; font-size: 12px; }

.assess-header { display: flex; justify-content: space-between; align-items: baseline; }
.assess-header .id { font-weight: 600; color: var(--ink); }
.assess-header .cls { color: var(--ink-dim); font-size: 11px; }

.eff-select { display: flex; gap: 16px; border-bottom: 1px solid var(--line); }
.eff-tab {
  background: none; border: none; border-bottom: 2px solid transparent;
  color: var(--ink-faint); cursor: pointer; font-family: var(--sans);
  font-size: 11px; font-weight: 600; letter-spacing: 0.02em;
  padding: 0 0 8px; margin-bottom: -1px;
}
.eff-tab:hover { color: var(--ink-dim); }
.eff-tab.active { color: var(--signal); border-bottom-color: var(--signal); }

.btn {
  width: 100%; padding: 9px; border-radius: var(--radius); border: 1px solid var(--line-strong);
  background: transparent; color: var(--ink); cursor: pointer;
  font-family: var(--sans); font-size: 11px; font-weight: 600; letter-spacing: 0.05em;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.btn:hover:not(:disabled) { border-color: var(--signal); color: var(--signal); }
.btn:disabled { opacity: 0.35; cursor: not-allowed; }
.btn-danger { border-color: var(--danger); color: var(--danger); }
.btn-danger:hover:not(:disabled) { background: var(--danger-wash); border-color: var(--danger); color: var(--danger); }

.reco {
  font-weight: 700; padding: 7px 10px; border-radius: var(--radius);
  text-align: center; letter-spacing: 0.06em; font-size: 11px;
  border: 1px solid transparent;
}
.reco-clear { background: var(--ok-wash); color: var(--ok); border-color: var(--ok); }
.reco-caution { background: var(--warn-wash); color: var(--warn); border-color: var(--warn); }
.reco-denied { background: var(--danger-wash); color: var(--danger); border-color: var(--danger); }

.cda-detail { color: var(--ink-dim); font-size: 11px; line-height: 1.7; }
.cda-detail b { color: var(--ink); font-weight: 600; }
.cda-detail .row { display: flex; justify-content: space-between; gap: 8px; }

/* ------------------------------------------------------------- audit log --- */
.audit-log { display: flex; flex-direction: column; gap: 0; }
.audit-entry {
  font-size: 11px; padding: 7px 0 7px 12px; color: var(--ink-dim);
  border-left: 1px solid var(--line); position: relative; line-height: 1.5;
}
.audit-entry::before {
  content: ""; position: absolute; left: -3px; top: 11px; width: 5px; height: 5px; border-radius: 50%;
  background: var(--ink-faint);
}
.audit-entry.act-assess::before { background: var(--info); }
.audit-entry.act-engage_success::before { background: var(--ok); }
.audit-entry.act-engage_failed::before { background: var(--warn); }
.audit-entry.act-engage_denied::before { background: var(--danger); }
.audit-entry .t { color: var(--ink-faint); margin-right: 6px; }
.audit-entry .action-label { color: var(--ink); font-weight: 600; }

/* ------------------------------------------------------------------ modal --- */
.modal-backdrop {
  position: fixed; inset: 0; background: rgba(6, 7, 9, 0.7);
  display: flex; align-items: center; justify-content: center; z-index: 50;
  animation: fade-in 0.12s ease;
}
.modal {
  width: min(380px, calc(100vw - 40px));
  background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--radius);
  padding: 18px;
}
.modal h3 {
  margin: 0 0 10px; font-size: 11px; text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--danger); font-weight: 700;
}
.modal p { margin: 0 0 16px; font-size: 12.5px; line-height: 1.6; color: var(--ink); }
.modal p b { font-family: var(--mono); color: var(--signal); }
.modal h3.neutral { color: var(--signal); }

.modal-field { margin-bottom: 12px; }
.modal-field label {
  display: block; font-size: 10px; text-transform: uppercase; letter-spacing: 0.08em;
  color: var(--ink-dim); margin-bottom: 5px;
}
.modal-field input[type="text"], .modal-field input[type="number"], .modal-field select {
  width: 100%; background: var(--void); border: 1px solid var(--line-strong); border-radius: var(--radius);
  color: var(--ink); font-family: var(--mono); font-size: 12px; padding: 7px 8px;
}
.modal-field input:focus-visible, .modal-field select:focus-visible { outline: 1px solid var(--signal); outline-offset: 0; }
.modal-field-check { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--ink); }
.modal-field-hint { color: var(--ink-faint); font-size: 10.5px; margin-top: 4px; }
.modal-actions { display: flex; gap: 8px; }
@keyframes fade-in { from { opacity: 0; } to { opacity: 1; } }

/* ------------------------------------------------------------------ toast --- */
.toast-stack {
  position: fixed; top: 16px; left: 50%; transform: translateX(-50%);
  display: flex; flex-direction: column; gap: 8px; z-index: 60; align-items: center;
}
.toast {
  background: var(--surface); border: 1px solid var(--line-strong); border-left: 3px solid var(--ok);
  border-radius: var(--radius); padding: 9px 14px; font-size: 12px; color: var(--ink);
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  animation: toast-in 0.18s ease;
}
.toast.warn { border-left-color: var(--warn); }
.toast.danger { border-left-color: var(--danger); }
@keyframes toast-in { from { opacity: 0; transform: translateY(-6px); } to { opacity: 1; transform: translateY(0); } }

/* -------------------------------------------------------- reduced motion --- */
@media (prefers-reduced-motion: reduce) {
  .modal-backdrop, .toast { animation: none; }
  * { transition: none !important; }
}

/* --------------------------------------------------------------- mobile --- */
/* Floating translucent panels over a full-bleed map are a desktop map-app
   pattern — on a phone they'd either cover the whole map or be unreadably
   small. Below 900px, drop the overlay entirely: panels go back to normal
   stacked flow (map, then Sensors, then Effectors, ...) in one page scroll. */
@media (max-width: 900px) {
  .layout { position: static; display: block; overflow: visible; }
  .panel-center { position: static; height: 60vh; }
  .panel-left, .panel-right {
    position: static; width: auto; height: auto;
    background: var(--void); backdrop-filter: none; -webkit-backdrop-filter: none;
    border: none; border-top: 1px solid var(--line); border-radius: 0; box-shadow: none;
  }
  /* Nested inner-scroll regions are a poor fit for touch scrolling — let
     every block flow in the single page scroll instead of clipping itself. */
  .block { flex: none !important; }
  .scroll-list { flex: none; overflow-y: visible; max-height: none; }
  .view { min-height: 420px; }
}
