/* ==========================================================================
   BIM2Bot Lab
   Blueprint ink for the building, safety orange for the robot layer.
   ========================================================================== */

:root {
  --bg: #eef1f4;
  --surface: #fbfcfd;
  --surface-2: #f2f5f8;
  --surface-3: #e5eaf0;
  --line: #dbe2e9;
  --line-strong: #c2ccd6;
  --ink: #12202e;
  --ink-2: #3a4959;
  --ink-3: #5f6f82;
  --accent: #1f5fbf;
  --accent-hover: #194f9f;
  --accent-ink: #ffffff;
  --accent-soft: rgba(31, 95, 191, 0.09);
  --accent-line: rgba(31, 95, 191, 0.34);
  --signal: #c94c0b;
  --signal-bright: #e0560f;
  --signal-soft: rgba(224, 86, 15, 0.1);
  --ok: #1f7a4a;
  --ok-soft: rgba(31, 122, 74, 0.1);
  --warn: #9a5b00;
  --warn-soft: rgba(196, 128, 0, 0.13);
  --danger: #b8232f;
  --danger-soft: rgba(198, 47, 58, 0.1);
  --violet: #6a42c2;
  --teal: #237f73;
  --hud: rgba(251, 252, 253, 0.92);
  --shadow-hud: 0 1px 2px rgba(18, 32, 46, 0.08), 0 8px 24px rgba(18, 32, 46, 0.12);
  --shadow-pop: 0 2px 4px rgba(18, 32, 46, 0.08), 0 18px 48px rgba(18, 32, 46, 0.2);
  --r-control: 6px;
  --r-card: 10px;
  --font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'Cascadia Mono', Consolas, monospace;
  --topbar-h: 56px;
  color-scheme: light;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0b141c; --surface: #111d28; --surface-2: #172634; --surface-3: #1f3142; --line: #213345; --line-strong: #2f465c;
    --ink: #e6edf4; --ink-2: #b4c2d0; --ink-3: #8597a9;
    --accent: #6aa8ff; --accent-hover: #8dbcff; --accent-ink: #08131d; --accent-soft: rgba(106, 168, 255, 0.12); --accent-line: rgba(106, 168, 255, 0.4);
    --signal: #ff8a3d; --signal-bright: #ff8a3d; --signal-soft: rgba(255, 138, 61, 0.13);
    --ok: #4cc38a; --ok-soft: rgba(76, 195, 138, 0.13); --warn: #f0b44c; --warn-soft: rgba(240, 180, 76, 0.13); --danger: #ff6b74; --danger-soft: rgba(255, 107, 116, 0.13);
    --violet: #b393ff; --teal: #4fd1bd;
    --hud: rgba(17, 29, 40, 0.92);
    --shadow-hud: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
    --shadow-pop: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 48px rgba(0, 0, 0, 0.5);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0b141c; --surface: #111d28; --surface-2: #172634; --surface-3: #1f3142; --line: #213345; --line-strong: #2f465c;
  --ink: #e6edf4; --ink-2: #b4c2d0; --ink-3: #8597a9;
  --accent: #6aa8ff; --accent-hover: #8dbcff; --accent-ink: #08131d; --accent-soft: rgba(106, 168, 255, 0.12); --accent-line: rgba(106, 168, 255, 0.4);
  --signal: #ff8a3d; --signal-bright: #ff8a3d; --signal-soft: rgba(255, 138, 61, 0.13);
  --ok: #4cc38a; --ok-soft: rgba(76, 195, 138, 0.13); --warn: #f0b44c; --warn-soft: rgba(240, 180, 76, 0.13); --danger: #ff6b74; --danger-soft: rgba(255, 107, 116, 0.13);
  --violet: #b393ff; --teal: #4fd1bd;
  --hud: rgba(17, 29, 40, 0.92);
  --shadow-hud: 0 1px 2px rgba(0, 0, 0, 0.4), 0 8px 24px rgba(0, 0, 0, 0.35);
  --shadow-pop: 0 2px 4px rgba(0, 0, 0, 0.4), 0 18px 48px rgba(0, 0, 0, 0.5);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body, #root { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  font-size: 13px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
button:disabled { cursor: default; }
a { color: var(--accent); }
code, kbd, .mono { font-family: var(--mono); font-feature-settings: 'zero' 0; }
code { font-size: 0.92em; background: var(--surface-2); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; }
kbd {
  display: inline-block;
  font-size: 11px;
  line-height: 16px;
  padding: 0 5px;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-bottom-width: 2px;
  border-radius: 4px;
  white-space: nowrap;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.muted { color: var(--ink-3); }
.icon { display: block; flex: 0 0 auto; }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: 10px; border: 3px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-track { background: transparent; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ---------- Buttons ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  height: 32px;
  padding: 0 12px;
  font-size: 13px;
  font-weight: 500;
  color: var(--ink);
  background: var(--surface);
  border: 1px solid var(--line-strong);
  border-radius: var(--r-control);
  white-space: nowrap;
  text-decoration: none;
  transition: background 0.12s, border-color 0.12s, color 0.12s;
}
.btn:hover:not(:disabled) { background: var(--surface-2); border-color: var(--ink-3); }
.btn:disabled { opacity: 0.45; }
.btn[data-active="true"] { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-ink); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); border-color: var(--accent-hover); color: var(--accent-ink); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover:not(:disabled) { background: var(--surface-2); border-color: transparent; }
.btn-sm { height: 28px; padding: 0 9px; font-size: 12.5px; }
.btn-lg { height: 42px; padding: 0 18px; font-size: 14px; }

.icon-btn {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  padding: 0;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  transition: background 0.12s, color 0.12s;
  flex: 0 0 auto;
}
.icon-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.icon-btn:disabled { opacity: 0.35; }
.icon-btn[data-active="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.icon-btn.sm { width: 24px; height: 24px; border-radius: 5px; }

/* ---------- App shell ---------- */
.app {
  display: grid;
  grid-template-columns: minmax(0, 1fr);
  grid-template-rows: var(--topbar-h) minmax(0, 1fr);
  height: 100vh;
  height: 100dvh;
}
.app-body {
  position: relative;
  display: grid;
  grid-template-columns: var(--left-w, 300px) minmax(0, 1fr) var(--right-w, 360px);
  grid-template-rows: minmax(0, 1fr) var(--bottom-h, 220px);
  min-height: 0;
}
.app-body > * { min-width: 0; min-height: 0; }
.app-body > .left-side { grid-column: 1; grid-row: 1 / span 2; }
.app-body > .viewer-region { grid-column: 2; grid-row: 1; }
.app-body > .right-side { grid-column: 3; grid-row: 1 / span 2; }
.app-body > .bottom-panel { grid-column: 2; grid-row: 2; }

.resize-handle { position: absolute; z-index: 30; touch-action: none; }
.resize-handle::after { content: ''; position: absolute; background: transparent; transition: background 0.12s; }
.resize-handle:hover::after, body.is-resizing .resize-handle::after { background: var(--accent); }
.rh-left, .rh-right { top: 0; bottom: 0; width: 7px; cursor: col-resize; }
.rh-left { left: calc(var(--left-w) - 4px); }
.rh-right { right: calc(var(--right-w) - 4px); }
.rh-left::after, .rh-right::after { top: 0; bottom: 0; left: 3px; width: 2px; }
.rh-bottom { left: var(--left-w); right: var(--right-w); bottom: calc(var(--bottom-h) - 4px); height: 7px; cursor: row-resize; }
.rh-bottom::after { left: 0; right: 0; top: 3px; height: 2px; }
body.is-resizing { user-select: none; }
body.is-resizing .viewer-wrap { pointer-events: none; }

/* ---------- Top bar ---------- */
.topbar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 0 14px 0 16px;
  background: var(--surface);
  border-bottom: 1px solid var(--line);
  min-width: 0;
}
.brand { display: flex; align-items: center; gap: 9px; flex: 0 0 auto; color: var(--ink); padding: 4px 8px 4px 4px; margin-left: -4px; border: 0; border-radius: 8px; background: transparent; }
.brand:hover { background: var(--surface-2); }
.brand-mark .brand-route { stroke: var(--signal-bright); }
.brand-mark .brand-node { fill: var(--signal-bright); }
.brand-name { font-size: 16px; font-weight: 700; letter-spacing: -0.02em; white-space: nowrap; }
.brand-two { color: var(--signal); }
.brand-lab { font-weight: 400; color: var(--ink-3); }

/* The pipeline switch: each workspace is a stage of BIM → Bot. */
.ws-switch { display: flex; align-items: center; flex: 0 0 auto; padding: 3px; background: var(--surface-2); border: 1px solid var(--line); border-radius: 9px; }
.ws-btn {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 40px;
  padding: 0 12px 0 6px;
  border: 0;
  border-radius: 7px;
  background: transparent;
  color: var(--ink-2);
  text-align: left;
  transition: background 0.15s, color 0.15s;
}
.ws-btn:hover:not(:disabled):not([aria-current]) { background: var(--surface-3); color: var(--ink); }
.ws-btn:disabled { opacity: 0.5; }
.ws-btn[aria-current="page"] { background: var(--ink); color: var(--bg); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2); }
.ws-icon { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 6px; background: var(--surface); color: var(--ink-2); border: 1px solid var(--line); }
.ws-btn[aria-current="page"] .ws-icon { background: var(--signal-bright); border-color: transparent; color: #fff; }
.ws-text { display: flex; flex-direction: column; line-height: 1.1; }
.ws-label { font-size: 13px; font-weight: 600; }
.ws-sub { font-size: 11px; color: inherit; opacity: 0.72; white-space: nowrap; }
.ws-link { display: grid; place-items: center; width: 16px; color: var(--signal); }

.file-chip {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 300px;
  height: 34px;
  padding: 0 4px 0 10px;
  color: var(--ink-2);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
}
.file-name { font-weight: 600; color: var(--ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.file-meta { font-size: 11.5px; color: var(--ink-3); }
.topbar-spacer { flex: 1 1 auto; min-width: 8px; }
.topbar-tools { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
/* Buy Me a Coffee: brand yellow pill on the start page, icon-only elsewhere. */
.bmc-btn { flex: 0 0 auto; background: #ffdd00; border-color: #ffdd00; color: #1a1a1a; font-weight: 600; }
.bmc-btn:hover:not(:disabled) { background: #ffe633; border-color: #f0cf00; color: #1a1a1a; }
.bmc-icon { text-decoration: none; }
.bmc-icon:hover:not(:disabled) { color: #c9a400; }

.search {
  position: relative;
  display: flex;
  align-items: center;
  gap: 8px;
  width: 300px;
  min-width: 160px;
  flex: 0 1 300px;
  height: 34px;
  padding: 0 6px 0 10px;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
}
.search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); background: var(--surface); }
.search[data-disabled="true"] { opacity: 0.55; }
.search input { flex: 1; min-width: 0; height: 100%; border: 0; outline: 0; background: transparent; color: var(--ink); }
.search input::placeholder { color: var(--ink-3); }
.search input::-webkit-search-cancel-button { display: none; }
.search-hints {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  right: 0;
  z-index: 60;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
}
.search-hints button { display: flex; align-items: baseline; gap: 10px; width: 100%; padding: 7px 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; color: var(--ink-3); }
.search-hints button:hover { background: var(--surface-2); }
.search-hints code { color: var(--ink); }

.menu-anchor, .popover-anchor { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  z-index: 80;
  min-width: 230px;
  padding: 5px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
}
.menu > button, .menu > a {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 100%;
  min-height: 34px;
  padding: 0 10px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: var(--ink);
  text-decoration: none;
  text-align: left;
  font-size: 13px;
}
.menu > button:hover, .menu > a:hover { background: var(--surface-2); }
.menu > button .icon, .menu > a .icon { color: var(--ink-3); }
.menu kbd, .menu .trail { margin-left: auto; }
.menu-sep { height: 1px; margin: 5px 4px; background: var(--line); }
.menu-title { padding: 6px 10px 6px; font-size: 12px; color: var(--ink-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 280px; }
.ctx-menu { position: fixed; right: auto; top: auto; z-index: 200; }

/* ---------- Side panels ---------- */
.side { display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.left-side { display: grid; grid-template-columns: 64px minmax(0, 1fr); border-right: 1px solid var(--line); }
.nav-side { display: flex; }
.right-side { border-left: 1px solid var(--line); }
.side-body { display: flex; flex-direction: column; min-height: 0; min-width: 0; flex: 1; }
.side-scroll { flex: 1; min-height: 0; overflow: auto; }

.rail { display: flex; flex-direction: column; gap: 2px; padding: 8px 6px; border-right: 1px solid var(--line); background: var(--surface-2); overflow: auto; }
.rail-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 9px 2px 8px;
  font-size: 11px;
  font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  border-radius: 8px;
}
.rail-tab:hover:not(:disabled) { color: var(--ink); background: var(--surface-3); }
.rail-tab[aria-selected="true"] { color: var(--accent); background: var(--surface); box-shadow: inset 0 0 0 1px var(--line); }
.rail-tab:disabled { opacity: 0.45; }

.field-search {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 10px 6px;
  height: 32px;
  padding: 0 4px 0 10px;
  color: var(--ink-3);
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  flex: 0 0 auto;
}
.field-search:focus-within { border-color: var(--accent-line); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-search input { flex: 1; min-width: 0; border: 0; outline: 0; background: transparent; color: var(--ink); }

.empty { padding: 36px 22px; text-align: center; color: var(--ink-3); }
.empty-icon { display: grid; place-items: center; width: 44px; height: 44px; margin: 0 auto 12px; border-radius: 12px; background: var(--surface-2); border: 1px solid var(--line); color: var(--ink-2); }
.empty h3 { margin: 0 0 6px; font-size: 14px; font-weight: 600; color: var(--ink); }
.empty p { margin: 0 auto; max-width: 34ch; line-height: 1.5; }
.hint-card { margin: 0 16px; padding: 12px 14px; display: grid; gap: 6px; font-size: 12.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-card); }

/* ---------- Tree ---------- */
.tree { padding: 2px 0 12px; }
.tree-row {
  position: relative;
  display: flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 8px;
  color: var(--ink-2);
  cursor: pointer;
  user-select: none;
}
.tree-row:hover { background: var(--surface-2); color: var(--ink); }
.tree-row[data-selected="true"] { background: var(--accent-soft); color: var(--ink); }
.tree-row[data-selected="true"]::before { content: ''; position: absolute; left: 0; top: 3px; bottom: 3px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.tree-row[data-hidden="true"] .tree-label, .tree-row[data-hidden="true"] .swatch { opacity: 0.4; }
.tree-row.is-group .tree-label { color: var(--ink-3); }
.tree-caret { display: grid; place-items: center; width: 16px; height: 16px; color: var(--ink-3); flex: 0 0 auto; border-radius: 4px; }
.tree-caret .icon { transition: transform 0.15s; }
.tree-caret:hover { background: var(--surface-3); }
.tree-caret.invisible { visibility: hidden; }
.swatch { display: inline-block; width: 10px; height: 10px; border-radius: 3px; flex: 0 0 auto; box-shadow: inset 0 0 0 1px rgba(0, 0, 0, 0.12); }
.tree-label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tree-label.mono, .tree-row .mono { font-size: 12px; }
.tree-kind { margin-right: 6px; font-size: 11px; color: var(--ink-3); }
.tree-id { font-size: 11px; color: var(--ink-3); flex: 0 0 auto; }
.tree-count, .tab-count {
  flex: 0 0 auto;
  min-width: 20px;
  padding: 0 6px;
  font-family: var(--mono);
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  color: var(--ink-3);
  background: var(--surface-2);
  border-radius: 9px;
}
.tab-count { margin-left: 6px; }
.row-actions { display: none; align-items: center; gap: 1px; flex: 0 0 auto; }
.tree-row:hover .row-actions, .tree-row:focus-within .row-actions { display: flex; }
.tree-row:hover .tree-count { display: none; }
.tree-more { padding: 10px 14px; font-size: 12px; color: var(--ink-3); }

.group-block { padding-bottom: 6px; }
.group-head { display: flex; align-items: center; gap: 8px; padding: 12px 12px 6px; font-size: 12px; font-weight: 600; color: var(--ink); }
.group-head > span:first-child { flex: 1; }
.group-actions { display: flex; gap: 1px; }

.list-pane { padding: 12px; }
.pane-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; font-weight: 600; }
.pane-note { margin: 6px 0; font-size: 12.5px; line-height: 1.5; color: var(--ink-3); }
.pane-note.pad { padding: 16px 18px; margin: 0; }
.list-row { display: flex; align-items: center; gap: 10px; padding: 8px; color: var(--ink-2); border-radius: 8px; cursor: pointer; }
.list-row:hover { background: var(--surface-2); }
.list-main { flex: 1; min-width: 0; color: var(--ink); overflow: hidden; text-overflow: ellipsis; }
.sub { font-size: 12px; color: var(--ink-3); }

/* ---------- Inspector ---------- */
.insp-header { padding: 14px 16px 12px; border-bottom: 1px solid var(--line); flex: 0 0 auto; }
.crumbs { display: flex; flex-wrap: wrap; gap: 2px 4px; margin-bottom: 8px; font-size: 12px; color: var(--ink-3); }
.crumbs > * { display: inline-flex; align-items: center; }
.crumbs > *:not(:last-child)::after { content: '/'; margin-left: 5px; color: var(--line-strong); }
.crumbs button { padding: 0; border: 0; background: none; color: var(--ink-3); }
.crumbs button:hover { color: var(--accent); }
.crumbs.static { margin: 4px 0 0; font-family: var(--mono); }
.insp-header .crumbs:not(.static) > button:last-child::after { content: '/'; margin-left: 5px; color: var(--line-strong); }
.insp-class { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--ink-2); }
.insp-multi { margin-left: auto; font-size: 12px; color: var(--accent); }
.insp-name { margin: 4px 0 4px; font-size: 18px; font-weight: 600; line-height: 1.25; letter-spacing: -0.01em; word-break: break-word; }
.insp-guid { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--ink-3); }
.insp-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.insp-loading { display: flex; align-items: center; gap: 8px; padding: 10px 16px; font-size: 12.5px; color: var(--ink-3); }

.insp-section { border-bottom: 1px solid var(--line); }
.insp-section-head {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 12px 16px;
  border: 0;
  background: transparent;
  text-align: left;
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}
.insp-section-head:hover { background: var(--surface-2); }
.insp-section-title { flex: 1; }
.insp-caret { color: var(--ink-3); transition: transform 0.15s; }
.insp-section[data-open="false"] .insp-caret { transform: rotate(-90deg); }
.insp-section-body { padding: 0 16px 14px; }
.insp-section.is-accent .insp-section-head { box-shadow: inset 3px 0 0 var(--signal-bright); }

.kv { display: grid; grid-template-columns: minmax(96px, 38%) 1fr; gap: 10px; padding: 5px 0; font-size: 12.5px; border-top: 1px solid var(--line); }
.insp-section-body > .kv:first-child, .kv-group > .kv:first-child { border-top: 0; }
.kv .k { color: var(--ink-3); }
.kv .v { min-width: 0; color: var(--ink); word-break: break-word; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }
.kv-group + .kv-group { margin-top: 8px; padding-top: 8px; border-top: 1px dashed var(--line); }
.kv-row { display: grid; grid-template-columns: minmax(96px, 42%) 1fr; gap: 10px; padding: 5px 0; font-size: 12.5px; border-top: 1px solid var(--line); }
.kv-row .k { color: var(--ink-2); min-width: 0; overflow-wrap: anywhere; }
.kv-row .v { color: var(--ink); font-family: var(--mono); font-size: 12px; overflow-wrap: anywhere; }
.kv-row .unit { color: var(--ink-3); }
.link-btn { padding: 0; border: 0; background: none; color: var(--accent); text-align: left; text-decoration: underline; text-decoration-color: var(--accent-line); text-underline-offset: 3px; }
.link-btn:hover { text-decoration-color: currentColor; }
.link-btn:disabled { color: var(--ink-3); text-decoration: none; }

.pset + .pset { margin-top: 12px; }
.pset-name { padding-bottom: 4px; font-size: 12px; font-weight: 500; color: var(--violet); }
.pset-name.is-qto { color: var(--teal); }
.material + .material { margin-top: 10px; }
.material-name { display: flex; align-items: center; gap: 7px; padding: 4px 0; font-weight: 500; }
.rel { padding: 7px 0; border-top: 1px solid var(--line); }
.rel:first-child { border-top: 0; }
.rel-type { font-size: 11px; color: var(--ink-3); }
.rel-desc { font-size: 12.5px; display: flex; flex-wrap: wrap; gap: 2px 8px; align-items: baseline; }

.raw-attrs { width: 100%; border-collapse: collapse; font-family: var(--mono); font-size: 11.5px; }
.raw-attrs td { padding: 4px 6px; border-top: 1px solid var(--line); vertical-align: top; }
.raw-attrs tr:first-child td { border-top: 0; }
.raw-attrs .idx { width: 24px; color: var(--ink-3); }
.raw-attrs .name { color: var(--ink-2); width: 38%; }
.raw-attrs .val { color: var(--ink); word-break: break-all; }
.raw-attrs .val.ref { color: var(--accent); }
.raw-attrs .val.null { color: var(--ink-3); }

.role { display: flex; gap: 10px; padding: 10px 12px; margin-bottom: 8px; border-radius: 8px; background: var(--surface-2); border: 1px solid var(--line); }
.role-dot { width: 10px; height: 10px; margin-top: 4px; border-radius: 50%; flex: 0 0 auto; background: var(--ink-3); }
.role-signal .role-dot { background: var(--signal-bright); box-shadow: 0 0 0 3px var(--signal-soft); }
.role-ok .role-dot { background: var(--ok); }
.role-danger .role-dot { background: var(--danger); }
.role-warn .role-dot { background: var(--warn); }
.role-name { font-weight: 600; }
.role-desc { font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.provenance { margin-top: 10px; padding: 8px 10px; font-size: 12px; color: var(--ink-2); border-left: 2px solid var(--signal-bright); background: var(--signal-soft); border-radius: 0 6px 6px 0; }
.provenance .mono { display: block; font-size: 11px; color: var(--signal); }
.pill { display: inline-block; padding: 0 7px; font-size: 11.5px; line-height: 18px; border-radius: 9px; }
.pill-ok { color: var(--ok); background: var(--ok-soft); }
.pill-danger { color: var(--danger); background: var(--danger-soft); }

.color-popover {
  position: absolute;
  top: calc(100% + 6px);
  right: 0;
  z-index: 40;
  display: grid;
  grid-template-columns: repeat(5, 24px);
  gap: 6px;
  padding: 8px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
}
.color-popover .sw { width: 24px; height: 24px; padding: 0; border: 1px solid rgba(0, 0, 0, 0.15); border-radius: 6px; }
.color-popover .sw.reset { display: grid; place-items: center; background: var(--surface-2); color: var(--ink-2); border-color: var(--line); }

/* ---------- Left panel ---------- */
.pane-title { display: flex; align-items: baseline; gap: 8px; padding: 12px 12px 0; flex: 0 0 auto; }
.pane-title h2 { margin: 0; font-size: 14px; font-weight: 600; letter-spacing: -0.005em; }
.pane-tools { display: flex; align-items: center; gap: 4px; padding: 0 12px 6px; font-size: 12px; flex: 0 0 auto; flex-wrap: wrap; }
.pane-tools > .muted { flex: 1 1 auto; white-space: nowrap; }
.pane-tools .check-field { font-size: 12px; }
.tree-guides {
  align-self: stretch;
  flex: 0 0 auto;
  margin-left: 6px;
  background-image: repeating-linear-gradient(to right, var(--line) 0 1px, transparent 1px 16px);
}
.tree-row[data-selected="true"] .tree-guides { opacity: 0.6; }
.tree-icon { display: grid; place-items: center; width: 18px; height: 18px; flex: 0 0 auto; color: var(--accent); }
.tree-row.is-spatial .tree-label { font-weight: 500; color: var(--ink); }
.tree-row .tree-kind { margin: 0 0 0 7px; font-size: 11.5px; font-weight: 400; color: var(--ink-3); }
.tree-label.two-line { display: flex; flex-direction: column; line-height: 1.2; white-space: nowrap; }
.tree-label.two-line > span { overflow: hidden; text-overflow: ellipsis; }
.tree-sub { font-size: 11px; color: var(--ink-3); }
.class-list .tree-row, .schema-tree .tree-row { height: 38px; }
.class-row { background-image: linear-gradient(to right, var(--accent-soft) var(--share), transparent var(--share)); background-repeat: no-repeat; background-size: 100% 3px; background-position: 0 100%; }
.discipline-list { padding: 0 8px 12px; }
.group-block { margin-top: 8px; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; padding-bottom: 4px; }
.group-block .group-head { padding: 9px 8px 7px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); }
.group-block .group-name { flex: 1; }
.group-block[data-hidden="true"] .group-name { color: var(--ink-3); }
.group-block .tree-row { padding-left: 12px; }
.swatch.is-abstract { background: transparent; box-shadow: inset 0 0 0 1.5px var(--ink-3); }
.swatch.lg { width: 16px; height: 16px; border-radius: 4px; }
.schema-tree .tree-row[data-empty="true"] .tree-label { color: var(--ink-3); }
.schema-detail-pane { padding: 4px 12px 20px; }
.back-btn { margin: 0 0 8px -6px; }
.schema-head { display: flex; align-items: center; gap: 10px; }
.schema-head h3 { margin: 0; font-size: 15px; font-weight: 600; word-break: break-all; }
.schema-crumbs { margin: 8px 0 0; font-size: 11.5px; }
.schema-detail-pane .schema-desc { margin: 10px 0 12px; font-size: 13px; }
.mini-stats { display: grid; grid-template-columns: 1fr 1fr; border: 1px solid var(--line); border-radius: var(--r-card); }
.mini-stats > div { display: flex; flex-direction: column; padding: 8px 10px; }
.mini-stats > div + div { border-left: 1px solid var(--line); }
.mini-stats .v { font-size: 14px; font-weight: 500; }
.mini-stats .k { font-size: 11.5px; color: var(--ink-3); }
.schema-section { margin-top: 18px; }
.schema-section h4 { margin: 0 0 8px; font-size: 13px; }
.def-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; padding: 6px 8px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: 12px; color: var(--accent); }
.def-link:hover { background: var(--surface-2); }
.def-row > span { min-width: 0; overflow-wrap: anywhere; }
.chip { max-width: 100%; overflow-wrap: anywhere; }
.def-props { padding: 6px 12px 8px; font-size: 12px; color: var(--ink-2); line-height: 1.5; }
.resume-btn { margin-bottom: 14px; }

/* ---------- Bottom panel ---------- */
.bottom-panel { display: flex; flex-direction: column; background: var(--surface); border-top: 1px solid var(--line); }
.bp-head { display: flex; align-items: center; gap: 8px; height: 40px; padding-right: 6px; border-bottom: 1px solid var(--line); flex: 0 0 auto; min-width: 0; }
.bottom-panel[data-collapsed="true"] .bp-head { border-bottom: 0; }
.bp-tabs { display: flex; height: 100%; min-width: 0; overflow-x: auto; scrollbar-width: none; }
.bp-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 100%;
  padding: 0 12px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-3);
  background: transparent;
  border: 0;
  white-space: nowrap;
  box-shadow: inset 0 -2px 0 transparent;
}
.bp-tab:hover:not(:disabled) { color: var(--ink); }
.bp-tab[aria-selected="true"] { color: var(--ink); box-shadow: inset 0 -2px 0 var(--accent); }
.bp-tab:disabled { opacity: 0.5; }
.bp-actions { display: flex; align-items: center; gap: 4px; margin-left: auto; flex: 0 0 auto; }
.bp-body { flex: 1; min-height: 0; overflow: auto; }

.dtbl { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.dtbl caption { caption-side: bottom; padding: 8px; color: var(--ink-3); font-size: 12px; }
.dtbl th { position: sticky; top: 0; z-index: 1; padding: 7px 12px; text-align: left; font-weight: 500; font-size: 12px; color: var(--ink-3); background: var(--surface); border-bottom: 1px solid var(--line); white-space: nowrap; }
.dtbl td { padding: 6px 12px; border-bottom: 1px solid var(--line); white-space: nowrap; max-width: 320px; overflow: hidden; text-overflow: ellipsis; }
.dtbl tbody tr { cursor: pointer; }
.dtbl tbody tr:hover td { background: var(--surface-2); }
.dtbl tbody tr[data-selected="true"] td { background: var(--accent-soft); }
.dtbl.compact th, .dtbl.compact td { padding: 5px 10px; }
.dtbl .num { text-align: right; }
.dtbl .strong { font-weight: 600; }
.class-chip { display: inline-flex; align-items: center; gap: 6px; }
.vis-dot { display: inline-block; width: 8px; height: 8px; margin-right: 4px; border-radius: 50%; background: var(--ok); }
.vis-dot[data-state="hidden"], .vis-dot[data-state="hidden by isolation"] { background: var(--ink-3); }
.table-toolbar { display: flex; align-items: center; gap: 6px; padding: 6px 12px; color: var(--ink-2); }
.table-toolbar > span { margin-right: 8px; }

.markup { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: 16px; padding: 12px 14px; }
.markup-col h4 { display: flex; align-items: center; justify-content: space-between; margin: 0 0 8px; font-size: 13px; }
.issue { display: flex; gap: 10px; padding: 10px; margin-bottom: 8px; border: 1px solid var(--line); border-radius: var(--r-card); }
.issue-num { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; font-size: 12px; font-weight: 600; color: #fff; background: var(--danger); flex: 0 0 auto; }
.issue[data-status="progress"] .issue-num { background: var(--warn); }
.issue[data-status="resolved"] .issue-num { background: var(--ok); }
.issue-main { flex: 1; min-width: 0; display: grid; gap: 6px; }
.issue-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; font-size: 12px; }
.issue-meta select, .field select, .field input, .quick-select select {
  height: 28px;
  padding: 0 8px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: var(--r-control);
  color: var(--ink);
}
.issue-actions { display: flex; flex-direction: column; gap: 2px; }
.input-inline { width: 100%; padding: 4px 6px; border: 1px solid transparent; border-radius: 5px; background: transparent; resize: vertical; }
.input-inline:hover { border-color: var(--line); }
.input-inline:focus { outline: 0; border-color: var(--accent-line); background: var(--surface-2); }
input.input-inline { font-weight: 600; }

.checks { padding: 6px 0; }
.check { display: flex; align-items: center; gap: 12px; padding: 9px 14px; border-bottom: 1px solid var(--line); }
.check-main { flex: 1; min-width: 0; }
.check-actions { display: flex; gap: 2px; }
.check-badge { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto; color: var(--ink-3); background: var(--surface-2); }
[data-severity="error"] .check-badge, [data-status="fail"] > .check-badge { color: var(--danger); background: var(--danger-soft); }
[data-severity="warn"] .check-badge, [data-status="warn"] > .check-badge { color: var(--warn); background: var(--warn-soft); }
[data-severity="pass"] .check-badge, [data-status="pass"] > .check-badge { color: var(--ok); background: var(--ok-soft); }
[data-severity="info"] .check-badge, [data-status="info"] > .check-badge { color: var(--accent); background: var(--accent-soft); }

.log-list { padding: 6px 0; font-size: 12.5px; }
.log-row { display: grid; grid-template-columns: 74px 46px 1fr; gap: 10px; padding: 3px 14px; align-items: baseline; }
.log-row .t { font-size: 11.5px; color: var(--ink-3); }
.log-row .l { font-size: 11px; font-weight: 600; }
.log-row.info .l { color: var(--accent); }
.log-row.ok .l { color: var(--ok); }
.log-row.warn .l { color: var(--warn); }
.log-row.error .l { color: var(--danger); }
.log-row .msg { color: var(--ink-2); }
.hl { color: var(--ink); font-weight: 600; }

.perf-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(180px, 1fr)); gap: 10px; padding: 12px 14px; }
.perf-card { padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-card); }
.perf-card .k { font-size: 12px; color: var(--ink-3); }
.perf-card .v { margin: 2px 0; font-size: 18px; font-weight: 500; }

/* ---------- Viewer region: 3D, split or plan ---------- */
.viewer-region { position: relative; display: flex; min-width: 0; min-height: 0; overflow: hidden; background: var(--bg); }
.viewer-region > .viewer-wrap { flex: 1 1 50%; min-width: 0; }
.viewer-region[data-layout="plan"] > .viewer-wrap { display: none; }
.viewer-region[data-layout="split"] > .plan-view { border-left: 1px solid var(--line); }
.plan-view { position: relative; flex: 1 1 50%; min-width: 0; display: flex; flex-direction: column; background: var(--surface); }
.plan-bar { display: flex; align-items: center; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); background: var(--surface); flex: 0 0 auto; overflow-x: auto; scrollbar-width: none; }
.plan-bar-spacer { flex: 1; min-width: 4px; }
.seg.tool-seg button { width: auto; padding: 0 8px; gap: 5px; display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.plan-canvas-wrap { position: relative; flex: 1; min-height: 0; }
.plan-canvas { position: absolute; inset: 0; width: 100%; height: 100%; display: block; touch-action: none; cursor: grab; }
.plan-view[data-tool]:not([data-tool="select"]) .plan-canvas { cursor: crosshair; }
.plan-canvas-wrap .hover-tip { pointer-events: none; }
.plan-legend { position: absolute; right: 10px; bottom: 8px; padding: 3px 8px; font-size: 11.5px; color: var(--ink-3); background: var(--hud); border-radius: 6px; pointer-events: none; }
.simulate-route { width: 100%; margin: 4px 0 10px; }
.pick-row { display: flex; flex-wrap: wrap; gap: 6px; margin: 2px 0 8px; }
.missions { margin-bottom: 10px; }

/* ---------- Viewer + HUD ---------- */
.viewer-wrap { position: relative; overflow: hidden; background: var(--bg); touch-action: none; }
.viewer-canvas { position: absolute; inset: 0; display: block; width: 100%; height: 100%; outline: 0; }
.hud { position: absolute; inset: 0; pointer-events: none; z-index: 5; }
.hud > * { pointer-events: auto; }
.hud .hover-tip, .hud .measure-label, .hud .status-chip { pointer-events: none; }

.hud-card, .status-chip, .viewbar, .dock, .navcube-actions {
  background: var(--hud);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-hud);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
}

/* View bar (top left): level, plan cut, layout. */
.viewbar {
  position: absolute;
  top: 12px;
  left: 12px;
  display: flex;
  align-items: center;
  gap: 4px;
  max-width: calc(100% - 180px);
  padding: 5px;
  border-radius: var(--r-card);
  overflow-x: auto;
  scrollbar-width: none;
}
.seg.layout-seg button { width: auto; padding: 0 9px; gap: 5px; display: inline-flex; align-items: center; font-size: 12.5px; font-weight: 500; }
.seg.layout-seg button span { line-height: 1; }

/* Dock (bottom centre): grouped view tools. */
.dock {
  position: absolute;
  left: 50%;
  bottom: 14px;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 5px;
  border-radius: 14px;
  max-width: calc(100% - 24px);
}
.dock-group { display: flex; align-items: center; gap: 2px; padding: 0 4px; }
.dock-group + .dock-group { border-left: 1px solid var(--line); }
.dock .icon-btn { width: 36px; height: 36px; border-radius: 9px; }
.dock .seg { margin-right: 2px; }
.dock .seg button { width: 34px; height: 30px; }
.dock-menu { top: auto; bottom: calc(100% + 12px); right: auto; left: 50%; transform: translateX(-50%); min-width: 250px; }
.menu-check { display: flex; width: 100%; min-height: 32px; padding: 0 10px; border-radius: 6px; }
.menu-check:hover { background: var(--surface-2); }
.menu-slider { padding: 8px 10px; grid-template-columns: auto 1fr 38px; }
.layers-menu { right: 0; min-width: 210px; }

/* Navigation cube (top right). */
/* Compact HUD when the 3D pane is narrow (split layout, small screens). */
.viewer-wrap { container-type: inline-size; }
.dock { overflow-x: auto; scrollbar-width: none; }
@container (max-width: 760px) {
  .dock .icon-btn { width: 30px; height: 30px; }
  .dock .seg button { width: 28px; height: 26px; }
  .dock-group { padding: 0 2px; }
  .viewbar .chip-btn span { display: none; }
  .viewbar { max-width: calc(100% - 132px); }
}
@container (max-width: 520px) {
  .navcube { transform: scale(0.8); transform-origin: top right; }
  .seg.layout-seg button span { display: none; }
  .dock { left: 8px; right: 8px; transform: none; justify-content: flex-start; }
  .dock-menu { left: 0; transform: none; }
}
.navcube { position: absolute; top: 8px; right: 10px; display: flex; flex-direction: column; align-items: center; gap: 4px; }
.navcube-host { width: 104px; height: 104px; }
.navcube-canvas { display: block; touch-action: none; }
.navcube-actions { display: flex; gap: 1px; padding: 3px; border-radius: 10px; }
.navcube-actions .icon-btn { width: 26px; height: 26px; border-radius: 6px; }

.quick-select { display: flex; align-items: center; gap: 6px; padding-left: 6px; color: var(--ink-3); flex: 0 0 auto; }
.quick-select select { max-width: 170px; height: 30px; }
.quick-sep { width: 1px; height: 20px; margin: 0 3px; background: var(--line); flex: 0 0 auto; }
.chip-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 30px;
  padding: 0 10px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink-2);
  background: transparent;
  border: 1px solid transparent;
  border-radius: var(--r-control);
  white-space: nowrap;
  flex: 0 0 auto;
}
.chip-btn:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.chip-btn[aria-pressed="true"] { background: var(--accent-soft); color: var(--accent); border-color: var(--accent-line); }
.chip-btn:disabled { opacity: 0.4; }
.seg { display: inline-flex; padding: 2px; background: var(--surface-2); border-radius: 7px; flex: 0 0 auto; }
.seg button { display: grid; place-items: center; width: 30px; height: 26px; border: 0; border-radius: 5px; background: transparent; color: var(--ink-3); }
.seg button:hover { color: var(--ink); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--accent); box-shadow: 0 1px 2px rgba(0, 0, 0, 0.12); }

.status-chip { position: absolute; left: 12px; top: 64px; display: flex; align-items: center; gap: 8px; max-width: calc(100% - 300px); padding: 6px 12px; font-size: 12.5px; color: var(--ink-2); border-radius: 999px; }
.status-chip .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); flex: 0 0 auto; }
.status-chip .dot[data-tone="signal"] { background: var(--signal-bright); }

.hud-card { position: absolute; padding: 10px 12px; border-radius: var(--r-card); }
.hud-card-head { display: flex; align-items: center; gap: 4px; margin-bottom: 4px; font-weight: 600; }
.hud-card-head > span { flex: 1; }
.hud-hint { margin: 0 0 8px; font-size: 12px; color: var(--ink-3); max-width: 30ch; }
.section-card { top: 64px; left: 12px; width: 270px; }
.slider-row { display: grid; grid-template-columns: auto 1fr 38px; align-items: center; gap: 10px; font-size: 12.5px; color: var(--ink-2); }
.section-card .slider-row { grid-template-columns: 52px 1fr 38px; padding: 2px 0; }
.slider-row .mono { font-size: 11.5px; text-align: right; color: var(--ink-3); }
input[type="range"] { width: 100%; height: 18px; margin: 0; accent-color: var(--accent); background: transparent; }

.measure-label {
  position: absolute;
  transform: translate(-50%, -140%);
  padding: 2px 7px;
  font-size: 12px;
  color: #fff;
  background: var(--signal-bright);
  border-radius: 5px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}
.anno-pin {
  position: absolute;
  width: 26px;
  height: 26px;
  margin: -26px 0 0 -13px;
  padding: 0;
  display: grid;
  place-items: center;
  color: #fff;
  background: var(--danger);
  border: 2px solid #fff;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}
.anno-pin span { transform: rotate(45deg); font-size: 11px; font-weight: 700; }
.anno-pin[data-status="progress"] { background: var(--warn); }
.anno-pin[data-status="resolved"] { background: var(--ok); }
.hover-tip {
  position: absolute;
  display: flex;
  flex-direction: column;
  max-width: 280px;
  padding: 6px 9px;
  font-size: 12px;
  line-height: 1.35;
  background: var(--ink);
  color: var(--bg);
  border-radius: 6px;
  box-shadow: var(--shadow-hud);
}
.tip-kind { font-size: 11px; opacity: 0.7; }
.tip-class { font-size: 11px; opacity: 0.75; }
.tip-name { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Navigate ---------- */
.nav-scroll { padding-bottom: 24px; }
.nav-intro { padding: 16px 16px 6px; }
.nav-intro h2 { margin: 0 0 4px; font-size: 16px; letter-spacing: -0.01em; }
.nav-intro p { margin: 0; color: var(--ink-3); font-size: 12.5px; line-height: 1.5; }
.nav-section { padding: 14px 16px; border-bottom: 1px solid var(--line); }
.nav-section h3 { display: flex; align-items: center; gap: 8px; margin: 0 0 10px; font-size: 13px; }
.nav-section h3 .icon { color: var(--signal); }
.field { display: grid; gap: 4px; margin-bottom: 8px; font-size: 12px; color: var(--ink-3); min-width: 0; }
.field select, .field input { width: 100%; height: 32px; font-size: 13px; }
.field-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.toggle-row { display: flex; flex-wrap: wrap; gap: 6px 16px; margin: 2px 0 4px; }
.check-field { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--ink-2); cursor: pointer; }
.check-field input { width: 15px; height: 15px; accent-color: var(--accent); margin: 0; }
.route-fields { display: grid; grid-template-columns: 1fr auto 1fr; align-items: end; gap: 6px; }
.route-fields .icon-btn { margin-bottom: 8px; }
.route-card { margin-top: 6px; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.route-card.is-empty { display: grid; gap: 4px; padding: 12px; font-size: 12.5px; color: var(--ink-2); border-color: var(--danger-soft); background: var(--danger-soft); }
.route-stats { display: grid; grid-template-columns: repeat(3, 1fr); border-bottom: 1px solid var(--line); background: var(--signal-soft); }
.route-stats > div { display: flex; flex-direction: column; padding: 9px 10px; }
.route-stats > div + div { border-left: 1px solid var(--line); }
.route-stats .v { font-size: 17px; font-weight: 500; color: var(--ink); }
.route-stats .k { font-size: 11.5px; color: var(--ink-3); }
.route-clearance { margin: 0; padding: 8px 10px; font-size: 12px; line-height: 1.45; color: var(--ink-2); border-bottom: 1px solid var(--line); }
.route-clearance[data-tone="warn"] { background: var(--warn-soft, var(--surface-2)); }
.route-steps { list-style: none; margin: 0; padding: 6px 0; max-height: 260px; overflow: auto; }
.route-steps li { position: relative; }
.route-steps li:not(:last-child)::before { content: ''; position: absolute; left: 19px; top: 18px; bottom: -10px; width: 2px; background: var(--signal-bright); opacity: 0.5; }
.route-steps button { position: relative; display: flex; align-items: center; gap: 10px; width: 100%; padding: 5px 10px 5px 14px; border: 0; background: transparent; text-align: left; color: var(--ink); }
.route-steps button:hover { background: var(--surface-2); }
.step-mark { width: 12px; height: 12px; border-radius: 50%; flex: 0 0 auto; background: var(--surface); border: 2px solid var(--signal-bright); z-index: 1; }
.route-steps li[data-kind="door"] .step-mark { border-radius: 3px; transform: rotate(45deg) scale(0.85); }
.route-steps li[data-kind="door"] .step-text, .route-steps li[data-kind="opening"] .step-text, .route-steps li[data-kind="landing"] .step-text { font-size: 12px; color: var(--ink-3); }
.route-steps li:first-child .step-mark { background: var(--accent); border-color: var(--accent); }
.route-steps li:last-child .step-mark { background: var(--signal-bright); }
.step-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step-action { display: grid; place-items: center; width: 22px; height: 22px; border-radius: 5px; color: var(--ink-3); }
.step-action:hover { background: var(--danger-soft); color: var(--danger); }
.route-foot { display: flex; gap: 6px; padding: 8px 10px; border-top: 1px solid var(--line); }
.legend { display: flex; flex-wrap: wrap; gap: 6px 14px; margin: 10px 0 4px; font-size: 12px; color: var(--ink-2); }
.legend span { display: inline-flex; align-items: center; gap: 6px; }
.lg { display: inline-block; width: 11px; height: 11px; }
.lg-space { border-radius: 50%; background: var(--accent); }
.lg-door { transform: rotate(45deg) scale(0.8); background: var(--signal-bright); }
.lg-opening { border-radius: 50%; background: var(--teal); width: 8px; height: 8px; }
.lg-landing { background: var(--violet); clip-path: polygon(50% 0, 100% 50%, 50% 100%, 0 50%); }
.lg-blocked { height: 2px; background: var(--danger); }
.meter { margin-bottom: 12px; }
.meter-label { display: flex; justify-content: space-between; gap: 8px; font-size: 12.5px; color: var(--ink-2); margin-bottom: 5px; }
.meter-track { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.meter-track > div { height: 100%; background: var(--signal-bright); border-radius: 4px; }
.readiness { list-style: none; margin: 0; padding: 0; }
.readiness li { display: flex; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line); }
.readiness li:first-child { border-top: 0; }
.readiness .check-badge { margin-top: 1px; }
.check-title { font-weight: 500; }
.check-step { margin-top: 3px; font-size: 11px; color: var(--ink-3); }
.readiness .btn { flex: 0 0 auto; }

/* ---------- Occupancy map + simulation ---------- */
.field-grid.three { grid-template-columns: repeat(3, 1fr); }
.seg-wide { display: flex; width: 100%; margin-bottom: 10px; }
.seg-wide button { flex: 1; width: auto; height: 28px; padding: 0 8px; font-size: 12.5px; font-weight: 500; white-space: nowrap; }
.check-field.whatif { margin-top: 8px; padding: 7px 9px; border: 1px dashed var(--signal-bright); border-radius: var(--r-control); background: var(--signal-soft); align-items: flex-start; }
.check-field.whatif input { margin-top: 2px; }
.warn-note { color: var(--warn); }
.pad-x { padding: 0 12px; }
.grid-legend { display: grid; gap: 4px; margin: 10px 0 6px; font-size: 12.5px; color: var(--ink-2); }
.grid-legend > div { display: grid; grid-template-columns: 14px 1fr auto; align-items: center; gap: 8px; }
.gl { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: 0 0 auto; }
.gl-free { background: rgba(47, 158, 143, 0.25); box-shadow: inset 0 0 0 1px var(--teal); }
.gl-door { background: var(--teal); }
.gl-inflated { background: rgba(224, 86, 15, 0.4); }
.gl-obstacle { background: var(--danger); }
.gl-user { background: var(--signal-bright); }
.gl-blocked { background: #78101c; }
.gl-zone { background: rgba(150, 40, 150, 0.75); }
.gl-slow { background: rgba(201, 133, 0, 0.35); box-shadow: inset 0 0 0 1.5px #b07400; }
.cell-card[data-state="7"] { border-left-color: #962896; }

/* Route comparison, door schedule, experiments */
.route-compare { margin: 8px 0 4px; padding: 10px 12px; border-top: 1px solid var(--line); }
.rc-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; font-size: 13px; }
.rc-table { margin: 0 -12px 8px; overflow-x: auto; }
.route-compare tr[data-muted="true"] td:first-child { color: var(--ink-3); }
.door-toggle { margin-top: 8px; }
.door-schedule { margin-top: 10px; padding: 10px; border: 1px dashed var(--line-strong); border-radius: var(--r-card); }
.exp-table { margin-top: 6px; }
.exp-table td.exp-bar { width: 22%; padding-left: 4px; }
.exp-bar > span { display: block; height: 8px; min-width: 2px; border-radius: 4px; background: var(--accent); }
.cell-card { margin: 10px 0; padding: 10px 12px; border: 1px solid var(--line); border-left: 3px solid var(--teal); border-radius: var(--r-card); background: var(--surface-2); }
.cell-card[data-state="2"], .cell-card[data-state="6"] { border-left-color: var(--danger); }
.cell-card[data-state="3"], .cell-card[data-state="5"] { border-left-color: var(--signal-bright); }
.cell-card[data-state="0"] { border-left-color: var(--ink-3); }
.cell-head { display: flex; align-items: center; justify-content: space-between; font-size: 11.5px; color: var(--ink-3); }
.cell-state { font-size: 14px; font-weight: 600; margin-top: 2px; }
.cell-card p { margin: 4px 0 6px; font-size: 12.5px; color: var(--ink-2); line-height: 1.45; }
.obstacle-list { margin-top: 8px; }
.obstacle-list .gl { margin-left: 2px; }

.sim-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 12px; }
.seed-row { align-items: end; }
.seed-row .btn { margin-bottom: 8px; }
.sim-clock { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.sim-clock > .mono { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; }
.sim-status { flex: 1; font-size: 12px; color: var(--ink-3); }
.sim-status[data-status="running"] { color: var(--signal); }
.sim-status[data-status="done"] { color: var(--ok); }
.sim-clock .seg button { width: auto; padding: 0 6px; font-size: 11.5px; font-family: var(--mono); }
.kpi-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0; margin-top: 10px; border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.kpi { padding: 8px 10px; border-top: 1px solid var(--line); }
.kpi:nth-child(-n + 2) { border-top: 0; }
.kpi:nth-child(even) { border-left: 1px solid var(--line); }
.kpi-v { font-size: 15px; font-weight: 500; color: var(--ink); }
.kpi-k { font-size: 11.5px; color: var(--ink-3); }
.kpi[data-tone="warn"] .kpi-v { color: var(--warn); }
.robot-dot { display: inline-block; width: 9px; height: 9px; margin-right: 7px; border-radius: 50%; vertical-align: 0; }
.ellipsis { max-width: 140px; overflow: hidden; text-overflow: ellipsis; }
.hotspots, .event-list { list-style: none; margin: 0; padding: 0; }
.hotspots button, .event-list button { display: grid; align-items: center; gap: 8px; width: 100%; padding: 6px 4px; border: 0; border-radius: 6px; background: transparent; text-align: left; font-size: 12.5px; color: var(--ink); }
.hotspots button { grid-template-columns: 56px 1fr auto; }
.hotspots button:hover, .event-list button:hover { background: var(--surface-2); }
.hs-bar { height: 8px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.hs-bar > span { display: block; height: 100%; background: var(--signal-bright); border-radius: 4px; }
.hs-text { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.event-list button { grid-template-columns: 44px 1fr; align-items: baseline; }
.event-list li[data-kind="near-miss"] button > span:last-child::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--warn); }
.event-list li[data-kind="deadlock"] button > span:last-child::before { content: ''; display: inline-block; width: 7px; height: 7px; margin-right: 6px; border-radius: 50%; background: var(--danger); }

/* ---------- Modals ---------- */
.modal-backdrop { position: fixed; inset: 0; z-index: 100; display: grid; place-items: center; padding: 16px; background: rgba(9, 16, 23, 0.45); backdrop-filter: blur(3px); animation: fade-in 0.14s ease-out; }
.modal {
  display: flex;
  flex-direction: column;
  width: min(620px, 100%);
  max-height: min(86vh, 900px);
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: var(--shadow-pop);
  overflow: hidden;
  outline: 0;
  animation: rise 0.16s ease-out;
}
.modal.is-wide { width: min(1080px, 100%); height: min(86vh, 820px); }
.modal-head { display: flex; align-items: flex-start; gap: 12px; padding: 16px 16px 14px 20px; border-bottom: 1px solid var(--line); }
.modal-head > div { flex: 1; min-width: 0; }
.modal-head h2 { margin: 0; font-size: 17px; letter-spacing: -0.01em; }
.modal-head .sub { margin-top: 2px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal-body { flex: 1; min-height: 0; overflow: auto; padding: 18px 20px; }
.modal-actions { display: flex; gap: 8px; margin-top: 22px; }
@keyframes fade-in { from { opacity: 0; } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }

.schema { display: grid; grid-template-columns: 280px 1fr; gap: 0; height: 100%; margin: -18px -20px; }
.schema .modal-body { padding: 0; }
.schema-list { display: flex; flex-direction: column; min-height: 0; border-right: 1px solid var(--line); }
.schema-row { display: flex; align-items: center; gap: 8px; width: 100%; padding: 6px 14px; border: 0; background: transparent; text-align: left; font-size: 12.5px; color: var(--ink); }
.schema-row .mono { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.schema-row:hover { background: var(--surface-2); }
.schema-row[aria-pressed="true"] { background: var(--accent-soft); box-shadow: inset 3px 0 0 var(--accent); }
.schema-row[data-empty="true"] { color: var(--ink-3); }
.schema-detail { min-height: 0; overflow: auto; padding: 20px 24px; }
.schema-detail h3 { display: flex; align-items: center; gap: 10px; margin: 0; font-size: 19px; font-weight: 500; }
.schema-detail h4 { margin: 22px 0 8px; font-size: 13px; display: flex; gap: 8px; align-items: baseline; }
.schema-detail h4 .muted { font-weight: 400; font-size: 12px; }
.schema-desc { max-width: 70ch; margin: 12px 0 16px; color: var(--ink-2); line-height: 1.55; }
.stat-row { display: grid; grid-template-columns: repeat(3, 1fr); border: 1px solid var(--line); border-radius: var(--r-card); }
.stat-row > div { padding: 10px 12px; }
.stat-row > div + div { border-left: 1px solid var(--line); }
.stat-row .k { font-size: 12px; color: var(--ink-3); }
.stat-row .v { font-size: 15px; font-weight: 500; }
.def-list, .def-block { border: 1px solid var(--line); border-radius: var(--r-card); overflow: hidden; }
.def-block + .def-block { margin-top: 8px; }
.def-head { display: flex; justify-content: space-between; gap: 8px; padding: 8px 12px; font-size: 12.5px; color: var(--violet); background: var(--surface-2); }
.def-row { display: flex; justify-content: space-between; gap: 12px; padding: 6px 12px; font-size: 12px; border-top: 1px solid var(--line); }
.def-list .def-row:first-child { border-top: 0; }
.req { color: var(--signal); }
.chip-row { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { padding: 3px 8px; font-size: 11.5px; color: var(--ink-2); background: var(--surface-2); border: 1px solid var(--line); border-radius: 6px; }

.help-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 8px 28px; }
.help-grid h4 { margin: 4px 0 6px; font-size: 13px; }
.help-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 6px 0; border-top: 1px solid var(--line); font-size: 12.5px; color: var(--ink-2); }

/* ---------- Building intelligence ---------- */
.intel .modal-body { background: var(--bg); }
.intel-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.intel-facts { grid-column: 1 / -1; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.fact { padding: 14px 16px; }
.fact + .fact { border-left: 1px solid var(--line); }
.fact-v { font-size: 24px; font-weight: 500; letter-spacing: -0.02em; color: var(--ink); }
.fact-k { font-size: 12.5px; color: var(--ink-2); }
.fact-sub { font-size: 11.5px; color: var(--ink-3); }
.intel-card { padding: 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); min-width: 0; }
.intel-card h3 { margin: 0 0 12px; font-size: 14px; }
.intel-pipeline { grid-column: span 4; display: flex; flex-direction: column; }
.intel-pipeline .btn { align-self: flex-start; margin-top: auto; }
.intel-levels { grid-column: span 8; overflow: auto; }
.intel-classes { grid-column: span 6; }
.intel-checks { grid-column: span 6; }
.pipeline { list-style: none; margin: 0 0 14px; padding: 0; counter-reset: step; }
.pipeline li { position: relative; display: flex; align-items: center; gap: 10px; padding: 7px 0; font-size: 13px; }
.pipeline li > span:nth-child(2) { flex: 1; }
.pipeline li:not(:last-child)::after { content: ''; position: absolute; left: 11px; top: 31px; height: 10px; width: 2px; background: var(--line-strong); }
.bars { list-style: none; margin: 0; padding: 0; }
.bars li { display: grid; grid-template-columns: minmax(110px, 34%) 1fr 56px; align-items: center; gap: 10px; padding: 4px 4px; border-radius: 6px; cursor: pointer; }
.bars li:hover { background: var(--surface-2); }
.bar-label { display: flex; align-items: center; gap: 7px; min-width: 0; font-size: 12px; }
.bar-label .mono { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bar-track { height: 10px; }
.bar-fill { display: block; height: 100%; background: var(--accent); border-radius: 0 4px 4px 0; }
.bar-value { font-size: 12px; text-align: right; color: var(--ink-2); }

/* ---------- Start screen ---------- */
.start {
  position: absolute;
  inset: 0;
  z-index: 40;
  overflow: auto;
  background-color: var(--bg);
  background-image:
    linear-gradient(to right, color-mix(in srgb, var(--line) 70%, transparent) 1px, transparent 1px),
    linear-gradient(to bottom, color-mix(in srgb, var(--line) 70%, transparent) 1px, transparent 1px);
  background-size: 32px 32px;
  background-position: -1px -1px;
}
.start-inner { width: min(1060px, 100%); margin: 0 auto; padding: clamp(28px, 7vh, 72px) 24px 48px; }
.start-hero { max-width: 720px; padding: 32px; background: var(--surface); border: 1px solid var(--line); border-radius: 16px; box-shadow: var(--shadow-hud); }
.start-hero h1 { margin: 0; font-size: clamp(30px, 4.6vw, 46px); line-height: 1.04; font-weight: 700; letter-spacing: -0.035em; max-width: 16ch; }
.start-hero p { max-width: 58ch; margin: 16px 0 0; font-size: 15px; line-height: 1.6; color: var(--ink-2); }
.start-actions { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 24px; }
.dropzone {
  display: grid;
  justify-items: start;
  gap: 2px;
  width: 100%;
  margin-top: 22px;
  padding: 14px 16px;
  text-align: left;
  color: var(--ink-2);
  background: var(--surface-2);
  border: 1.5px dashed var(--line-strong);
  border-radius: var(--r-card);
  transition: border-color 0.15s, background 0.15s;
}
.dropzone .icon { color: var(--accent); margin-bottom: 4px; }
.dropzone:hover, .dropzone[data-over="true"] { border-color: var(--accent); background: var(--accent-soft); }
.start-samples { margin-top: 28px; }
.start-samples h2 { margin: 0 0 10px; font-size: 15px; }
.sample-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; }
.sample-card { display: flex; flex-direction: column; gap: 6px; padding: 14px 16px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card); }
.sample-head { display: flex; align-items: center; gap: 8px; }
.sample-head h3 { flex: 1; margin: 0; font-size: 14px; }
.sample-head .icon { color: var(--accent); }
.sample-card p { margin: 0; color: var(--ink-2); font-size: 12.5px; line-height: 1.5; }
.sample-card .sample-credit a { color: var(--ink-3); font-size: 12px; }
.sample-card .btn { align-self: flex-start; margin-top: 4px; }
.start-roadmap { list-style: none; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 0; margin: 28px 0 0; padding: 0; }
.start-roadmap > li { position: relative; padding: 18px 20px 4px 0; }
.start-roadmap > li::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--line-strong); }
.start-roadmap > li[data-state="live"]::before { background: var(--accent); }
.start-roadmap > li[data-state="preview"]::before { background: linear-gradient(90deg, var(--signal-bright) 60%, var(--line-strong) 60%); }
.rm-head { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; font-size: 15px; font-weight: 600; }
.rm-head .icon { color: var(--ink-2); }
.rm-tag { font-size: 12px; font-weight: 500; color: var(--ink-3); }
.start-roadmap li[data-state="live"] .rm-tag { color: var(--accent); }
.start-roadmap li[data-state="preview"] .rm-tag { color: var(--signal); }
.start-roadmap p { margin: 6px 0 0; color: var(--ink-2); line-height: 1.55; max-width: 36ch; }

/* ---------- Loading ---------- */
.load-overlay { position: absolute; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: color-mix(in srgb, var(--bg) 82%, transparent); backdrop-filter: blur(4px); }
.load-card { width: min(460px, 100%); padding: 20px; background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow-pop); }
.load-head { display: flex; align-items: center; gap: 12px; }
.load-head > div { flex: 1; min-width: 0; }
.load-head h3 { margin: 0; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.load-pct { font-size: 13px; color: var(--ink-2); }
.load-bar { height: 6px; margin: 16px 0 12px; background: var(--surface-3); border-radius: 3px; overflow: hidden; }
.load-bar > div { height: 100%; background: var(--accent); border-radius: 3px; transition: width 0.25s; }
.load-log { list-style: none; margin: 0; padding: 0; display: grid; gap: 3px; font-size: 12px; color: var(--ink-3); }
.load-log li.error { color: var(--danger); }
.load-log li.warn { color: var(--warn); }
.spinner { display: inline-block; width: 16px; height: 16px; border: 2px solid var(--line-strong); border-top-color: var(--accent); border-radius: 50%; animation: spin 0.8s linear infinite; flex: 0 0 auto; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Toasts ---------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 300; display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
.toast {
  display: flex;
  align-items: center;
  gap: 10px;
  width: 340px;
  max-width: calc(100vw - 32px);
  padding: 9px 8px 9px 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--r-card);
  box-shadow: var(--shadow-pop);
  pointer-events: auto;
  animation: rise 0.16s ease-out;
}
.toast-ic { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; flex: 0 0 auto; color: var(--accent); background: var(--accent-soft); }
.toast[data-kind="ok"] .toast-ic { color: var(--ok); background: var(--ok-soft); }
.toast[data-kind="warn"] .toast-ic { color: var(--warn); background: var(--warn-soft); }
.toast[data-kind="error"] .toast-ic { color: var(--danger); background: var(--danger-soft); }
.toast-msg { flex: 1; min-width: 0; font-weight: 500; }
.toast-msg .sub { font-weight: 400; }

/* ---------- Visitor statistics popover ---------- */
.vc-popover { display: none; position: fixed; top: 64px; right: 14px; z-index: 400; width: 280px; max-width: calc(100vw - 28px); overflow: hidden; background: #111d28; border: 1px solid #2f465c; border-radius: var(--r-card); box-shadow: var(--shadow-pop); }
.vc-popover.vc-open { display: block; animation: rise 0.16s ease-out; }
.vc-popover-top { display: flex; align-items: center; justify-content: space-between; padding: 10px 12px; color: #b4c2d0; font-size: 12.5px; font-weight: 600; border-bottom: 1px solid #213345; }
.vc-pop-close { border: 0; background: transparent; color: #b4c2d0; font-size: 18px; line-height: 1; padding: 0 6px; border-radius: 4px; }
.vc-pop-close:hover { background: #1f3142; color: #fff; }
.vc-flag-link { display: block; padding: 12px; line-height: 0; }
.vc-flag-img { max-width: 100%; border-radius: 6px; }

.boot-error { max-width: 560px; margin: 15vh auto; padding: 24px; font-family: var(--font); color: var(--ink); }
.boot-error h1 { font-size: 22px; margin: 0 0 8px; }

/* Static loading screen in index.html; React replaces it on mount. */
.boot-screen[hidden] { display: none; }
.boot-screen { height: 100%; overflow-y: auto; display: grid; place-items: center; padding: 24px 16px; }
.boot-card { max-width: 600px; font-size: 14px; line-height: 1.55; color: var(--ink-2); }
.boot-card h1 { margin: 12px 0 2px; font-size: 26px; color: var(--ink); letter-spacing: -0.01em; }
.boot-card .boot-tagline { margin: 0 0 14px; font-size: 15px; font-weight: 600; color: var(--signal); }
.boot-card ul { padding-left: 18px; }
.boot-card li { margin-bottom: 6px; }
.boot-card strong { color: var(--ink); }
.boot-card .boot-status { margin-top: 18px; color: var(--ink-3); font-family: var(--mono); font-size: 12.5px; }
.boot-card .boot-links { color: var(--ink-3); font-size: 12.5px; }

/* ---------- Responsive ---------- */
@media (max-width: 1280px) {
  .ws-sub { display: none; }
  .ws-btn { height: 36px; }
  .search { flex-basis: 220px; }
  .file-meta { display: none; }
}

@media (max-width: 1100px) {
  .app-body { grid-template-columns: min(var(--left-w), 280px) minmax(0, 1fr) min(var(--right-w), 320px); }
  .resize-handle { display: none; }
  .brand-lab { display: none; }
  .intel-facts { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .fact:nth-child(4) { border-left: 0; }
  .fact:nth-child(n + 4) { border-top: 1px solid var(--line); }
  .intel-pipeline, .intel-levels, .intel-classes, .intel-checks { grid-column: 1 / -1; }
}

@media (max-width: 900px) {
  body { overflow: auto; }
  .app { height: auto; min-height: 100dvh; grid-template-rows: auto auto; }
  .topbar { flex-wrap: wrap; gap: 8px; padding: 8px 12px; }
  .brand-name { font-size: 15px; }
  .ws-switch { order: 5; width: 100%; justify-content: space-between; }
  .ws-btn { flex: 1; justify-content: center; }
  .ws-link { flex: 0 0 10px; }
  .file-chip { display: none; }
  .search { order: 6; flex: 1 1 100%; width: 100%; }
  .topbar-spacer { display: none; }
  .topbar > .btn-primary { margin-left: auto; }
  .app-body { display: flex; flex-direction: column; }
  .app-body > .viewer-region { order: 1; height: 72vh; min-height: 420px; flex: 0 0 auto; }
  .app-body > .left-side { order: 2; height: 360px; border-right: 0; border-top: 1px solid var(--line); flex: 0 0 auto; }
  .app-body > .nav-side { height: auto; max-height: 640px; }
  .app-body > .right-side { order: 3; height: 520px; border-left: 0; border-top: 1px solid var(--line); flex: 0 0 auto; }
  .app-body > .bottom-panel { order: 4; height: 320px; flex: 0 0 auto; }
  .app-body[data-collapsed="true"] > .bottom-panel { height: 41px; }
  .app[data-has-model="false"] .app-body > :not(.start):not(.load-overlay) { display: none; }
  .start, .load-overlay { position: relative; inset: auto; min-height: calc(100dvh - 110px); }
  .viewbar { top: 8px; left: 8px; max-width: calc(100% - 130px); }
  .dock { left: 8px; right: 8px; transform: none; bottom: 8px; overflow-x: auto; scrollbar-width: none; justify-content: flex-start; }
  .dock-menu { left: 0; transform: none; }
  .navcube { top: 6px; right: 4px; transform: scale(0.85); transform-origin: top right; }
  .status-chip { top: 58px; left: 8px; max-width: calc(100% - 140px); }
  .viewer-region[data-layout="split"] { flex-direction: column; }
  .viewer-region[data-layout="split"] > .plan-view { border-left: 0; border-top: 1px solid var(--line); }
  .section-card { top: 56px; left: 8px; }
  .schema { grid-template-columns: 1fr; grid-template-rows: 200px 1fr; }
  .schema-list { border-right: 0; border-bottom: 1px solid var(--line); }
  .modal.is-wide { height: calc(100dvh - 32px); }
  .start-roadmap { grid-template-columns: 1fr; gap: 14px; }
}

@media (max-width: 560px) {
  .brand-name { display: none; }
  .ws-btn { padding: 0 8px 0 4px; gap: 6px; }
  .ws-icon { width: 24px; height: 24px; }
  .topbar-tools .icon-btn { width: 30px; }
  .bmc-btn { width: 32px; padding: 0; }
  .bmc-btn span { display: none; }
  .start-inner { padding: 20px 16px 40px; }
  .start-hero { padding: 22px 18px; }
  .intel-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .fact:nth-child(odd) { border-left: 0; }
  .fact:nth-child(n + 3) { border-top: 1px solid var(--line); }
  .stat-row { grid-template-columns: 1fr; }
  .stat-row > div + div { border-left: 0; border-top: 1px solid var(--line); }
  .status-chip { display: none; }
  .seg.layout-seg button span, .seg.tool-seg button span { display: none; }
  .toasts { left: 12px; right: 12px; bottom: 12px; }
  .toast { width: auto; }
}

/* ---------------------------------------------------------------------------
   Floating popovers (rendered into <body>), info buttons and section titles.
   --------------------------------------------------------------------------- */
.floating { position: fixed; z-index: 200; }
.floating.menu { right: auto; bottom: auto; transform: none; max-height: calc(100vh - 24px); overflow-y: auto; }
.floating.menu.layers-pop { width: 212px; min-width: 0; padding: 4px; font-size: 12.5px; }
.layers-pop .menu-title { padding: 5px 8px 3px; font-size: 11.5px; }
.layers-pop .menu-check { gap: 7px; min-height: 27px; padding: 0 8px; font-size: 12.5px; }
.layers-pop > button { min-height: 28px; padding: 0 8px; font-size: 12.5px; }
.layers-pop .menu-sep { margin: 3px 4px; }
.layers-pop .menu-slider { padding: 6px 8px; grid-template-columns: auto 1fr 34px; gap: 6px; font-size: 12px; }
.layers-pop .menu-slider input { min-width: 0; }
.layers-pop .menu-check-label { flex: 1; }
.layers-pop .trail { font-size: 11.5px; }

.info-btn {
  display: inline-flex; align-items: center; justify-content: center;
  flex: none; width: 22px; height: 22px; padding: 0; margin: -3px 0;
  border: 0; border-radius: 50%; background: transparent; color: var(--ink-3); cursor: pointer;
}
.info-btn:hover, .info-btn[data-active="true"] { background: var(--accent-soft); color: var(--accent); }
.info-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.nav-section h3 .info-btn .icon, .info-btn .icon { color: inherit; }

.info-pop {
  width: min(320px, calc(100vw - 16px)); padding: 12px 14px;
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-card);
  box-shadow: var(--shadow-pop); font-size: 12.5px; line-height: 1.55; color: var(--ink-2);
}
.info-pop-title { margin-bottom: 4px; font-weight: 600; font-size: 13px; color: var(--ink); }
.info-pop-body p { margin: 0 0 6px; }
.info-pop-body p:last-child { margin-bottom: 0; }
.info-pop-body ul { margin: 4px 0 6px; padding-left: 18px; }

.section-title { display: flex; align-items: center; gap: 8px; }
.section-title .section-title-text { flex: 1; min-width: 0; }
.nav-intro .section-title { margin: 0 0 4px; font-size: 16px; letter-spacing: -0.01em; }
.inline-info { display: inline-flex; align-items: center; gap: 4px; }
.check-row { display: flex; align-items: center; gap: 4px; }
.check-row .check-field { flex: 1; min-width: 0; }
.route-foot .info-btn, .rc-head .info-btn { margin-left: auto; }
.rc-head .info-btn + .icon-btn { margin-left: 2px; }

/* ROS 2 export: a highlighted block with a full-width call to action. */
.nav-section.ros-export { background: var(--accent-soft); border-left: 3px solid var(--accent); }
.nav-section.ros-export h3 .icon { color: var(--accent); }
.ros-export-btn { width: 100%; justify-content: center; height: 40px; font-size: 13.5px; font-weight: 600; margin-top: 6px; }
.ros-export-note { margin: 6px 0 0; font-size: 12px; color: var(--ink-3); }
.lidar-list { list-style: none; margin: 4px 0 8px; padding: 0; display: grid; gap: 2px; font-size: 12.5px; }
.lidar-list li { display: flex; align-items: center; gap: 8px; color: var(--ink-2); }
.lidar-list .lidar-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lidar-list .mono { font-size: 11.5px; }
.sample-actions { display: flex; flex-wrap: wrap; gap: 6px; margin-top: auto; padding-top: 4px; }
.sample-actions .btn { margin-top: 0; text-decoration: none; }

/* Start page: hero beside the simulation previews; feature lists per stage. */
.start-inner { width: min(1180px, 100%); }
.start-top { display: grid; grid-template-columns: minmax(0, 1.35fr) minmax(280px, 1fr); gap: 20px; align-items: start; }
.start-top .start-hero { max-width: none; }
.start-media { display: grid; gap: 12px; align-content: start; }
.start-media figure { margin: 0; }
/* Previews sit on the page background; a soft mask fades their edges into the grid. */
.sim-preview {
  position: relative; aspect-ratio: 8 / 5; width: 100%;
  -webkit-mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent);
  -webkit-mask-composite: source-in;
  mask-image: linear-gradient(to right, transparent, #000 10%, #000 90%, transparent), linear-gradient(to bottom, transparent, #000 9%, #000 91%, transparent);
  mask-composite: intersect;
}
.sim-preview-3d { position: absolute; inset: 0; cursor: grab; }
.sim-preview-3d:active { cursor: grabbing; }
.sim-preview-3d .preview-canvas { display: block; width: 100%; height: 100%; touch-action: pan-y; }
.sim-preview img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.sim-preview-hint {
  position: absolute; left: 50%; bottom: 12%; transform: translateX(-50%);
  display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; border-radius: 999px;
  font-size: 11.5px; color: var(--ink-2); background: color-mix(in srgb, var(--surface) 85%, transparent);
  border: 1px solid var(--line); pointer-events: none; white-space: nowrap;
}
:root[data-theme="dark"] .start-media .only-light, :root:not([data-theme="dark"]) .start-media .only-dark { display: none; }
.start-media figcaption { display: flex; align-items: center; justify-content: center; gap: 6px; padding: 2px 12px 0; font-size: 12.5px; color: var(--ink-2); }
.start-media figcaption .icon { color: var(--accent); flex: none; }
.rm-list { margin: 8px 0 0; padding: 0 0 0 16px; color: var(--ink-2); font-size: 13px; line-height: 1.5; max-width: 40ch; }
.rm-list li { margin: 3px 0; }
.rm-list li::marker { color: var(--line-strong); }
.rm-new { display: inline-block; margin-right: 4px; padding: 0 6px; border-radius: 999px; font-size: 10.5px; font-weight: 600; line-height: 17px; color: var(--signal); background: var(--signal-soft); vertical-align: 1px; }
@media (max-width: 900px) {
  .start-top { grid-template-columns: 1fr; }
  .start-media { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
  .start-roadmap { grid-template-columns: 1fr; gap: 12px; }
}
