/* Meridian Court — operations console.

   Built as an instrument, not a card dashboard: panels are defined by hairline
   rules rather than elevation, corners are square, nothing casts a shadow, and
   every number is monospaced and tabular so columns of figures line up and a
   changing digit does not reflow the row. Density is deliberate — an operator
   should see the whole estate without scrolling.

   Colour follows the TwinLab data-viz reference. The categorical slots are the
   validated dark steps (all 8 pass lightness, chroma, CVD and 3:1 contrast on
   this surface). The status palette is reserved and never used for a series;
   because warning and serious sit close in hue, status ALWAYS ships with a
   monospace text token (OK / WATCH / DEGR / CRIT / OFF) as well as its colour. */

/* Design system: Pico CSS v2 (MIT) for typography, forms, buttons and cards;
   Open Props (MIT) for the colour scales; Inter (OFL) as the typeface. Pico is
   loaded before this file and re-themed to the dark palette below via its
   --pico-* variables; app.css supplies the layout the app needs on top. */

/* Hallmark · pre-emit critique: P4 H4 E4 S4 R4 V4
 * Type is a PAIRING, not one family (anti-pattern: "Inter-everywhere").
 * Bricolage Grotesque carries display + wordmark; Inter carries body/UI. */
@font-face {
  font-family: "Inter Variable";
  font-style: normal;
  font-weight: 100 900;
  font-display: swap;
  src: url("/vendor/inter.woff2") format("woff2");
}
@font-face {
  font-family: "Bricolage Grotesque";
  font-style: normal;
  font-weight: 200 800;
  font-display: swap;
  src: url("/vendor/bricolage.woff2") format("woff2");
}

/* Re-theme Pico to the Twinton dark palette so its components match. */
:root {
  --pico-font-family: "Inter Variable", system-ui, sans-serif;
  --pico-font-family-sans-serif: "Inter Variable", system-ui, sans-serif;
  --pico-border-radius: 10px;
  --pico-primary: var(--accent);
  --pico-primary-background: var(--accent);
  --pico-primary-hover-background: var(--accent-2);
  --pico-background-color: var(--ground);
  --pico-color: var(--ink);
  --pico-muted-color: var(--ink-3);
  --pico-h1-color: var(--ink); --pico-h2-color: var(--ink);
  --pico-h3-color: var(--ink); --pico-h4-color: var(--ink);
  --pico-card-background-color: var(--panel);
  --pico-card-border-color: var(--rule);
  --pico-form-element-background-color: var(--panel-2);
  --pico-form-element-border-color: var(--rule);
  --pico-form-element-color: var(--ink);
  --pico-spacing: 1rem;
}

:root {
  color-scheme: dark;

  /* OKLCH palette, anchor hue 235 (cool slate). No pure black — every
     neutral carries a trace of the anchor's chroma, per Hallmark colour.md.
     ONE accent (signal cyan 205), deliberately clear of the reserved status
     hues; it occupies ~3% of any viewport and never fills a hero. */
  --ground:      oklch(13% 0.012 235);
  --panel:       oklch(16.5% 0.013 235);
  --panel-2:     oklch(20% 0.014 235);
  --panel-3:     oklch(24% 0.015 235);
  --rule:        oklch(29% 0.014 235);
  --rule-bright: oklch(40% 0.016 235);

  --ink:         oklch(95% 0.006 235);
  --ink-2:       oklch(76% 0.012 235);
  --ink-3:       oklch(58% 0.014 235);

  --accent:      oklch(74% 0.128 205);
  --accent-2:    var(--accent);     /* one accent — no second hue, no gradient */
  --accent-dim:  oklch(24% 0.045 205);
  --accent-glow: transparent;       /* shadow-glow on dark is an anti-pattern */

  /* Reserved status palette. */
  --good:     var(--green-6);      /* #2f9e44 */
  --warning:  var(--yellow-6);     /* #f59f00 */
  --serious:  var(--orange-6);     /* #e8590c */
  --critical: var(--red-6);        /* #f03e3e */
  --offline:  var(--gray-6);       /* #868e96 */
  --good-fill: var(--green-7);     /* #2b8a3e — calmer for big fills */

  /* Categorical series — Open Props *-5 steps, fixed order. */
  --series-1: var(--blue-4);    --series-2: var(--orange-5);
  --series-3: var(--teal-5);    --series-4: var(--yellow-5);
  --series-5: var(--pink-4);    --series-6: var(--green-5);
  --series-7: var(--violet-4);  --series-8: var(--red-4);

  --mono: var(--font-mono, ui-monospace, "SF Mono", Menlo, monospace);
  --sans: "Inter Variable", -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
  --display: "Bricolage Grotesque", "Inter Variable", system-ui, sans-serif;

  --shadow-1: 0 1px 2px hsl(220 40% 2% / .5);
  --shadow-2: 0 4px 20px hsl(220 40% 2% / .45), 0 1px 2px hsl(220 40% 2% / .5);
  --shadow-3: 0 20px 55px hsl(220 45% 2% / .6), 0 4px 12px hsl(220 40% 2% / .5);

  --strip-h: 52px;
  --rail-w: 200px;
  --row-h: 32px;
}

:root[data-theme="light"] {
  color-scheme: light;
  --ground:      var(--gray-1);    /* #f1f3f5 */
  --panel:       #ffffff;
  --panel-2:     var(--gray-0);    /* #f8f9fa */
  --panel-3:     var(--gray-1);
  --rule:        var(--gray-3);    /* #dee2e6 */
  --rule-bright: var(--gray-4);    /* #ced4da */
  --ink:         var(--gray-9);    /* #212529 */
  --ink-2:       var(--gray-7);    /* #495057 */
  --ink-3:       var(--gray-6);
  --accent:      var(--indigo-6);  /* #4263eb */
  --accent-2:    var(--violet-6);  /* #7048e8 */
  --accent-dim:  var(--indigo-0);  /* #edf2ff */
  --accent-glow: hsl(228 80% 55% / .18);
  --good:        var(--green-7);
  --good-fill:   var(--green-6);
  --warning:     var(--yellow-7);
  --serious:     var(--orange-7);
  --critical:    var(--red-7);
  --offline:     var(--gray-5);
  --shadow-1: 0 1px 2px hsl(220 20% 40% / .1);
  --shadow-2: 0 6px 24px hsl(220 25% 40% / .12), 0 1px 2px hsl(220 20% 40% / .08);
  --shadow-3: 0 20px 50px hsl(220 30% 40% / .18), 0 4px 12px hsl(220 25% 40% / .1);
  --series-1: var(--blue-6);    --series-2: var(--orange-6);
  --series-3: var(--teal-7);    --series-4: var(--yellow-8);
  --series-5: var(--pink-6);    --series-6: var(--green-8);
  --series-7: var(--violet-7);  --series-8: var(--red-7);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }

/* --- Pico compatibility ---------------------------------------------------
   Pico is a classless framework: it styles bare <nav>, <article>, <table>,
   form controls etc. We keep its typography/forms/buttons but reclaim the
   structural elements the app lays out itself, so its global rules (e.g.
   nav{display:flex}) don't collapse the shell. */
.sidebar { display: block; }
.topbar { display: flex; }
nav.sidebar ul, nav.lander-nav-links { margin: 0; padding: 0; }
.nav-item { margin: 0; }
:where(.card, .panel-card, .mkt-cat, .template-card) { margin: 0; }
/* Pico scales :root font-size responsively; pin ours for a dense app. */
:root { font-size: 100%; }
table { --pico-spacing: 0; }
tbody tr:nth-child(even) { --pico-table-row-stripped-background-color: transparent; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--ground); color: var(--ink);
  font: 13px/1.5 var(--sans);
  -webkit-font-smoothing: antialiased;
  font-variant-numeric: tabular-nums;
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 600; letter-spacing: -.01em; }
.page-head h1, .section-head h2, .card > h3:not(.label) { font-family: var(--display); }
p { margin: 0; }
svg { display: block; }

.muted { color: var(--ink-3); }
.mono  { font-family: var(--mono); font-size: 12px; }
.num   { text-align: right; font-family: var(--mono); font-variant-numeric: tabular-nums; }

/* A label is small, spaced, uppercase and never competes with data. */
.label, .card > h3, .nav-sep, thead th, .stat .label, .legend-box h4, .sub {
  font: 500 10px/1.2 var(--mono);
  letter-spacing: .12em;
  text-transform: uppercase;
  color: var(--ink-3);
}

/* ------------------------------------------------------------- status strip */
.topbar {
  position: fixed; inset: 0 0 auto 0; height: var(--strip-h); z-index: 40;
  display: flex; align-items: stretch; gap: 0;
  background: var(--panel); border-bottom: 1px solid var(--rule);
}
.brand {
  display: flex; align-items: center; gap: 9px; padding: 0 14px;
  border-right: 1px solid var(--rule);
}
.brand-mark {
  width: 15px; height: 15px; flex: none; position: relative;
  border: 1.5px solid var(--accent);
}
.brand-mark::after {
  content: ""; position: absolute; inset: 3px 3px auto auto;
  width: 4px; height: 4px; background: var(--accent);
}
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text strong {
  font-family: var(--display); font-size: 15px; font-weight: 700;
  letter-spacing: -.02em; text-transform: none; line-height: 1.1;
}
.brand-text em {
  font: 400 9.5px/1.2 var(--mono); font-style: normal;
  letter-spacing: .1em; text-transform: uppercase; color: var(--ink-3);
}
.topbar-spacer { flex: 1; }

/* The live readout: fixed-width mono cells divided by hairlines. */
.live {
  display: flex; align-items: center; gap: 0;
  font: 11px var(--mono); color: var(--ink-2);
  border-left: 1px solid var(--rule);
}
.live .cell {
  padding: 0 13px; display: flex; align-items: center; gap: 6px;
  align-self: stretch; border-right: 1px solid var(--rule);
  white-space: nowrap;
}
.live .cell b { color: var(--ink); font-weight: 500; }
/* A stalled feed is the only state worth colouring — the pulse stops moving
   and goes grey, so "paused" reads at a glance instead of blinking reassuringly
   while nothing arrives. */
.live .cell.is-stalled { color: var(--ink-3); }
.live .cell.is-stalled b { color: var(--ink-2); }
.live .cell.is-stalled .pulse { background: var(--offline); animation: none; }
.pulse {
  width: 6px; height: 6px; flex: none; background: var(--good);
  animation: blink 2s steps(1, end) infinite;
}
@keyframes blink { 50% { opacity: .25; } }
@media (prefers-reduced-motion: reduce) { .pulse { animation: none; } }

.icon-btn {
  position: relative; cursor: pointer; width: 42px; align-self: stretch;
  display: grid; place-items: center; color: var(--ink-2);
  border: 0; border-left: 1px solid var(--rule); background: none;
}
.icon-btn:hover { background: var(--panel-3); color: var(--ink); }
.badge {
  position: absolute; top: 8px; right: 7px; min-width: 15px; height: 14px;
  padding: 0 3px; background: var(--critical); color: #fff;
  font: 500 9.5px/14px var(--mono); text-align: center;
}
.nav-toggle { display: none; border-left: 0; border-right: 1px solid var(--rule); }

/* --------------------------------------------------------------------- rail */
.sidebar {
  position: fixed; top: var(--strip-h); bottom: 0; left: 0; width: var(--rail-w);
  z-index: 30; overflow-y: auto; padding-bottom: 24px;
  background: var(--panel); border-right: 1px solid var(--rule);
}
.nav-item {
  display: flex; align-items: center; gap: 9px; height: 28px; padding: 0 14px;
  color: var(--ink-2); font-size: 12.5px; text-decoration: none;
  border-left: 2px solid transparent;
}
.nav-item i { display: block; width: 16px; height: 16px; color: var(--ink-3); }
.nav-item:hover { background: var(--panel-3); color: var(--ink); text-decoration: none; }
.nav-item:hover i { color: var(--ink-2); }
.nav-item.active {
  background: var(--accent-dim); color: var(--ink);
  border-left-color: var(--accent);
}
.nav-item.active i { color: var(--accent); }
.nav-sep {
  padding: 16px 14px 5px; border-bottom: 1px solid var(--rule);
  margin-bottom: 5px;
}

/* --------------------------------------------------------------------- main */
.main {
  margin: var(--strip-h) 0 0 var(--rail-w);
  padding: 0 0 60px; min-height: calc(100vh - var(--strip-h));
}
.loading { color: var(--ink-3); padding: 30px 18px; font: 11px var(--mono);
           letter-spacing: .1em; text-transform: uppercase; }

.page-head {
  display: flex; align-items: center; gap: 16px; flex-wrap: wrap;
  padding: 12px 18px; border-bottom: 1px solid var(--rule);
  background: var(--panel);
}
.page-head h1 {
  font: 600 13px/1.2 var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.page-head p { color: var(--ink-3); font-size: 12px; margin-top: 3px; max-width: 78ch; }
.page-head .grow { flex: 1; }

.toolbar {
  display: flex; gap: 10px; flex-wrap: wrap; align-items: center;
  padding: 9px 18px; border-bottom: 1px solid var(--rule); background: var(--panel);
}

select, input[type="search"], input[type="text"] {
  font: 12px var(--mono); padding: 5px 9px; color: var(--ink);
  background: var(--panel-2); border: 1px solid var(--rule); border-radius: 0;
}
select:focus, input:focus { outline: 1px solid var(--accent); outline-offset: -1px; }
label.muted { font: 500 10px var(--mono); letter-spacing: .12em; text-transform: uppercase; }

button.btn {
  font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase;
  cursor: pointer; padding: 5px 11px; border-radius: 0;
  border: 1px solid var(--rule); background: var(--panel-2); color: var(--ink-2);
}
button.btn:hover { border-color: var(--rule-bright); color: var(--ink);
                   background: var(--panel-3); }
button.btn.primary { background: var(--accent); border-color: var(--accent); color: #fff; }
button.btn.primary:hover { filter: brightness(1.12); }
button.btn.sm { padding: 3px 8px; font-size: 10px; }
button.btn:disabled { opacity: .4; cursor: not-allowed; }

/* ------------------------------------------------------------------ panels */
.grid { display: grid; gap: 1px; background: var(--rule); }
.section { padding: 0; }
/* min(100%, …) on every auto-fit track: a bare minimum wider than the phone
   viewport cannot collapse, and the grid pushes the document sideways. */
.cols-2 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 430px), 1fr)); }
.cols-3 { grid-template-columns: repeat(auto-fit, minmax(min(100%, 300px), 1fr)); }
/* The readout cluster: cells separated by the container's own hairline. */
.cols-4 { grid-template-columns: repeat(auto-fit, minmax(170px, 1fr)); }
/* List beside detail. The second track is minmax(0,1fr), not 1fr, so the pane
   can shrink below its content instead of pushing the row wide; below the
   split point the two panes stack. Was two inline styles that did neither. */
.split-pane { grid-template-columns: minmax(240px, 320px) minmax(0, 1fr);
  align-items: start; }
.split-pane.wide { grid-template-columns: minmax(320px, 420px) minmax(0, 1fr); }
@media (max-width: 760px) {
  .split-pane, .split-pane.wide { grid-template-columns: minmax(0, 1fr); }
}

.card {
  background: var(--panel); border: 1px solid var(--rule); border-radius: 10px;
  padding: 15px 16px 16px; box-shadow: var(--shadow-1);
}
/* Inside a grid or stack the container's 1px gap already draws the divider,
   so the cell must not add a second line beside it. */
.grid > .card, .stack > .card { border: 0; border-radius: 0; box-shadow: none; }
.card > h3 {
  display: block; padding: 0 0 9px; margin: 0 0 11px;
  border-bottom: 1px solid var(--rule);
}
.card-flush { padding: 0; }
.card-flush > h3 { padding: 12px 15px 9px; margin-bottom: 0; }

/* Instrument readout cell. */
.stat { padding: 12px 15px 13px; }
.stat .figure {
  font: 400 27px/1 var(--mono); letter-spacing: -.02em; margin: 9px 0 3px;
  font-variant-numeric: tabular-nums;
}
.stat .sub { font: 11px var(--mono); color: var(--ink-3); }
.stat.alarm .figure { color: var(--critical); }
.stat.warn  .figure { color: var(--warning); }

/* ------------------------------------------------------------------ tables */
table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
thead th {
  text-align: left; padding: 7px 12px; background: var(--panel);
  border-bottom: 1px solid var(--rule-bright);
  position: sticky; top: 0; z-index: 1; white-space: nowrap;
}
thead th.num { text-align: right; }
tbody td {
  padding: 0 12px; height: var(--row-h);
  border-bottom: 1px solid var(--rule); vertical-align: middle;
}
tbody tr:last-child td { border-bottom: 0; }
tbody tr:nth-child(even) { background: color-mix(in srgb, var(--panel-2) 55%, transparent); }
tbody tr.clickable { cursor: pointer; }
tbody tr.clickable:hover td { background: var(--accent-dim); }
.table-wrap { max-height: 68vh; overflow: auto; background: var(--panel); }

/* --------------------------------------------------------------- status tag */
/* Colour plus a monospace token — never colour alone. */
.chip {
  display: inline-flex; align-items: center; gap: 5px;
  font: 500 10.5px/1 var(--mono); letter-spacing: .07em; text-transform: uppercase;
  padding: 3px 6px; border: 1px solid var(--rule); background: var(--panel-2);
  color: var(--ink-2); white-space: nowrap;
}
.chip .dot { width: 6px; height: 6px; flex: none; }
.chip.good     { color: var(--good);     border-color: color-mix(in srgb, var(--good) 45%, var(--rule)); }
.chip.warning  { color: var(--warning);  border-color: color-mix(in srgb, var(--warning) 45%, var(--rule)); }
.chip.serious  { color: var(--serious);  border-color: color-mix(in srgb, var(--serious) 45%, var(--rule)); }
.chip.critical { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 50%, var(--rule)); }
.chip.offline  { color: var(--offline); }
.chip.p1 { color: var(--critical); border-color: color-mix(in srgb, var(--critical) 50%, var(--rule)); }
.chip.p2 { color: var(--serious); }
.chip.solid { background: var(--accent); border-color: var(--accent); color: #fff; }

.sev-dot { width: 7px; height: 7px; display: inline-block; flex: none; }
.bg-good { background: var(--good); }
.bg-warning { background: var(--warning); }
.bg-serious { background: var(--serious); }
.bg-critical { background: var(--critical); }
.bg-offline { background: var(--offline); }

/* ------------------------------------------------------------------ charts */
/* Height follows the viewBox ratio now, so the chart never distorts its type.
   overflow:hidden, not visible — spilled axis text was widening the whole
   document and putting a horizontal scrollbar on the overview at phone widths. */
.chart { width: 100%; height: auto; display: block; overflow: hidden; }
.chart text { font: 10px var(--mono); fill: var(--ink-3); }
.chart .axis-line { stroke: var(--rule-bright); stroke-width: 1; }
.chart .grid-line { stroke: var(--rule); stroke-width: 1; }
.chart .series-line { fill: none; stroke-width: 1.5; stroke-linecap: butt;
                      stroke-linejoin: miter; }
.chart .marker { stroke: var(--panel); stroke-width: 1.5; }
.chart-legend {
  display: flex; gap: 14px; flex-wrap: wrap; align-items: center;
  margin: 0 0 10px; font: 10.5px var(--mono); letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-2);
}
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; }
.chart-legend i { width: 9px; height: 3px; display: block; }
.chart-wrap { position: relative; }
.tooltip {
  position: absolute; pointer-events: none; z-index: 5; min-width: 132px;
  background: var(--panel-3); border: 1px solid var(--rule-bright);
  padding: 7px 9px; font: 11px var(--mono); opacity: 0; transition: opacity .08s;
}
.tooltip strong { display: block; margin-bottom: 5px; color: var(--ink-3);
                  font-weight: 500; letter-spacing: .08em; text-transform: uppercase; }
.tooltip .row { display: flex; align-items: center; gap: 10px;
                justify-content: space-between; }
.tooltip .row i { width: 8px; height: 3px; display: inline-block; }
.tooltip .row b { font-weight: 500; }

.stackbar { display: flex; height: 10px; overflow: hidden; gap: 1px;
            background: var(--rule); }
.stackbar > span { display: block; }

/* -------------------------------------------------------------- 3D + 2D */
.viewport {
  position: relative; height: min(70vh, 680px);
  border-top: 1px solid var(--rule); border-bottom: 1px solid var(--rule);
  overflow: hidden; background: var(--panel-2);
}
.viewport canvas { display: block; width: 100%; height: 100%; }
.viewport-overlay {
  position: absolute; top: 0; left: 0; display: flex; flex-direction: column;
  pointer-events: none; border-right: 1px solid var(--rule);
  border-bottom: 1px solid var(--rule);
  background: color-mix(in srgb, var(--panel) 88%, transparent);
  backdrop-filter: blur(6px);
}
.viewport-overlay > * { pointer-events: auto; }
.legend-box { padding: 9px 12px; border-bottom: 1px solid var(--rule); }
.legend-box:last-child { border-bottom: 0; }
.legend-box h4 { margin-bottom: 7px; }
.legend-box .row {
  display: flex; align-items: center; gap: 7px; padding: 2px 0;
  font: 11px var(--mono); color: var(--ink-2);
}
.hover-card {
  position: absolute; pointer-events: none; padding: 7px 10px; font: 11px var(--mono);
  background: var(--panel-3); border: 1px solid var(--rule-bright);
  opacity: 0; transition: opacity .08s; max-width: 270px; line-height: 1.5;
}
.plan-svg { width: 100%; height: auto; display: block; }
.plan-svg .space { stroke: var(--rule-bright); stroke-width: 1; cursor: pointer; }
.plan-svg .space:hover { stroke: var(--accent); stroke-width: 2; }
.plan-svg .asset-dot { cursor: pointer; stroke: var(--panel); stroke-width: 1; }
.plan-svg text { font: 9.5px var(--mono); fill: var(--ink-3); pointer-events: none;
                 letter-spacing: .06em; text-transform: uppercase; }

/* ------------------------------------------------------------------ drawer */
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; width: min(640px, 100vw);
  z-index: 60; background: var(--panel); border-left: 1px solid var(--rule-bright);
  display: flex; flex-direction: column;
}
.drawer-head {
  display: flex; align-items: stretch; gap: 0;
  border-bottom: 1px solid var(--rule); background: var(--panel-2);
}
.drawer-head > div:first-child { flex: 1; padding: 11px 15px; }
.drawer-head h2 { font: 600 13px/1.3 var(--mono); letter-spacing: .06em;
                  text-transform: uppercase; }
.drawer-head p { font: 11px var(--mono); color: var(--ink-3); margin-top: 3px; }
.drawer-head .icon-btn { border-left: 1px solid var(--rule); }
.drawer-body { flex: 1; overflow-y: auto; }
.drawer-body > .row-gap:first-child { padding: 11px 15px; border-bottom: 1px solid var(--rule); }
.scrim { position: fixed; inset: 0; z-index: 50; background: rgba(0,0,0,.55); }

.tabs {
  display: flex; gap: 0; border-bottom: 1px solid var(--rule);
  overflow-x: auto; background: var(--panel-2);
}
.tabs button {
  font: 500 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase;
  cursor: pointer; padding: 8px 12px; border: 0; background: none;
  color: var(--ink-3); border-bottom: 2px solid transparent; white-space: nowrap;
}
.tabs button:hover { color: var(--ink-2); background: var(--panel-3); }
.tabs button.active { color: var(--ink); border-bottom-color: var(--accent);
                      background: var(--panel); }
.drawer-body > div:last-child { padding: 14px 15px 26px; }

.kv { display: grid; grid-template-columns: minmax(110px, auto) 1fr; gap: 0; font-size: 12.5px; }
.kv dt {
  font: 500 10px var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink-3); padding: 5px 0; border-bottom: 1px solid var(--rule);
}
.kv dd { margin: 0; padding: 5px 0; border-bottom: 1px solid var(--rule);
         font-family: var(--mono); font-size: 12px; }

/* -------------------------------------------------------------------- chat */
.chat { display: flex; flex-direction: column; gap: 11px; }
.chat-log { display: flex; flex-direction: column; gap: 9px; min-height: 70px; }
.bubble {
  padding: 9px 12px; font-size: 12.5px; max-width: 94%;
  border: 1px solid var(--rule); background: var(--panel-2);
  border-left: 2px solid var(--rule-bright);
}
.bubble.me {
  align-self: flex-end; background: var(--accent-dim);
  border-color: color-mix(in srgb, var(--accent) 40%, var(--rule));
  border-left-color: var(--accent);
}
.bubble .who {
  font: 500 9.5px var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-3); margin-bottom: 5px;
}
.bubble p { margin: 0 0 6px; }
.bubble p:last-child { margin-bottom: 0; }
.bubble ul, .bubble ol { margin: 4px 0; padding-left: 17px; }
.bubble li { margin-bottom: 2px; }
.bubble code { font: 11.5px var(--mono); background: var(--panel-3); padding: 1px 4px; }
.bubble.sev-critical { border-left-color: var(--critical); }
.bubble.sev-serious  { border-left-color: var(--serious); }
.bubble.sev-warning  { border-left-color: var(--warning); }
.chat-input { display: flex; gap: 7px; }
.chat-input input { flex: 1; }
.suggestions { display: flex; gap: 5px; flex-wrap: wrap; }
.suggestions button {
  font: 10.5px var(--mono); cursor: pointer; padding: 4px 8px;
  border: 1px solid var(--rule); background: none; color: var(--ink-3);
}
.suggestions button:hover { color: var(--accent); border-color: var(--accent); }

/* ---------------------------------------------------------------- popovers */
.popover {
  position: fixed; top: var(--strip-h); right: 0; z-index: 70;
  width: min(420px, 100vw); max-height: calc(100vh - var(--strip-h));
  overflow-y: auto; background: var(--panel);
  border: 1px solid var(--rule-bright); border-top: 0; border-right: 0;
}
.popover header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 0 0 14px; border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; background: var(--panel-2); z-index: 2; height: 34px;
}
.popover header strong { font: 500 10.5px var(--mono); letter-spacing: .12em;
                         text-transform: uppercase; color: var(--ink-2); }
.popover header .icon-btn { height: 34px; align-self: stretch; }
.alert-row {
  padding: 9px 14px; border-bottom: 1px solid var(--rule);
  display: flex; gap: 10px; align-items: flex-start;
}
.alert-row:hover { background: var(--panel-2); }
.alert-row .body { flex: 1; min-width: 0; }
.alert-row .body strong { display: block; font: 500 12px var(--mono); }
.alert-row .body span { font-size: 11.5px; color: var(--ink-3); }

/* -------------------------------------------------------------- field apps */
.phone-frame {
  width: min(374px, 100%); background: var(--panel);
  border: 1px solid var(--rule-bright);
}
.phone-head { padding: 12px 14px; background: var(--panel-2);
              border-bottom: 1px solid var(--rule); }
.phone-body { padding: 12px 14px 20px; max-height: 62vh; overflow-y: auto; }
.job-card {
  border: 1px solid var(--rule); border-left: 2px solid var(--rule-bright);
  padding: 9px 11px; margin-bottom: 7px; background: var(--panel-2); cursor: pointer;
}
.job-card:hover { border-color: var(--rule-bright); background: var(--panel-3); }
.job-card .top { display: flex; align-items: center; gap: 8px;
                 justify-content: space-between; margin-bottom: 3px; }
.job-card h4 { font-size: 12.5px; }
.job-card .meta { font: 11px var(--mono); color: var(--ink-3); }

/* ------------------------------------------------------------------- docs */
.doc-body {
  font-size: 12.5px; line-height: 1.62; color: var(--ink-2);
  background: var(--panel-2); border: 1px solid var(--rule);
  padding: 13px 15px; max-height: 48vh; overflow-y: auto;
}
.doc-body h2 {
  font: 500 11px var(--mono); letter-spacing: .1em; text-transform: uppercase;
  color: var(--ink); margin: 0 0 10px; padding-bottom: 7px;
  border-bottom: 1px solid var(--rule);
}
.doc-body ol, .doc-body ul { padding-left: 18px; margin: 7px 0; }
.doc-body li { margin-bottom: 4px; }
.doc-body table { font: 11.5px var(--mono); margin: 8px 0; }
.doc-body td { padding: 4px 8px; border-bottom: 1px solid var(--rule); }
.doc-body strong { color: var(--ink); font-weight: 500; }
.doc-body p { margin-bottom: 7px; }

/* Prose and controls that sit on the page rather than inside a panel still
   need the page gutter, since panels themselves are now full-bleed. */
.view > p, .view > button, .view > .row-gap { margin: 12px 18px; }
.view > p { color: var(--ink-3); font-size: 12px; max-width: 82ch; }

.empty {
  padding: 22px 15px; text-align: center; color: var(--ink-3);
  font: 11px var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.spread { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
/* Ruled stack: children separated by the container's own hairline. */
.stack { display: flex; flex-direction: column; gap: 1px; background: var(--rule); }
.stack > * { background: var(--panel); }
/* Plain vertical rhythm, no rules — used inside panels. */
.bar-rows { display: flex; flex-direction: column; gap: 9px; }
.mini-list { display: flex; flex-direction: column; }
.mini-list > div {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  height: 26px; border-bottom: 1px solid var(--rule); cursor: pointer;
  font-size: 12.5px;
}
.mini-list > div:last-child { border-bottom: 0; }
.mini-list > div:hover { background: var(--accent-dim); }
.mini-list .who { display: flex; align-items: center; gap: 8px; min-width: 0; }
.mini-list .who span.name { overflow: hidden; text-overflow: ellipsis;
                            white-space: nowrap; }
.row-gap { display: flex; gap: 7px; flex-wrap: wrap; align-items: center; }

/* -------------------------------------------------------------- responsive */
@media (max-width: 940px) {
  .nav-toggle { display: grid; }
  .sidebar { transform: translateX(-100%); transition: transform .16s; }
  .sidebar.open { transform: none; }
  .main { margin-left: 0; }
  .brand-text em { display: none; }
  .live .cell.optional { display: none; }
}
@media (max-width: 640px) {
  .live { display: none; }
}


/* ---------------------------------------------------------------- 3D view */
/* The model never moves out of the way: it owns the left column and the rail
   is a sibling, not an overlay. */
.site-root { display: flex; flex-direction: column;
             height: calc(100vh - var(--strip-h)); }
.lens-bar {
  display: flex; gap: 0; overflow-x: auto; flex: none;
  background: var(--panel); border-bottom: 1px solid var(--rule);
}
.lens-btn {
  display: flex; align-items: center; gap: 7px; padding: 0 13px; height: 36px;
  border: 0; border-right: 1px solid var(--rule); background: none;
  color: var(--ink-3); cursor: pointer; white-space: nowrap;
  font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase;
  border-bottom: 2px solid transparent;
}
.lens-btn i { width: 15px; height: 15px; }
.lens-btn:hover { background: var(--panel-3); color: var(--ink-2); }
.lens-btn.active { color: var(--ink); background: var(--accent-dim);
                   border-bottom-color: var(--accent); }
.lens-btn.active i { color: var(--accent); }

.site-stage { flex: 1; display: grid; grid-template-columns: 1fr 372px;
              min-height: 0; }
.site-stage > .viewport {
  height: auto; min-height: 0; border: 0; border-right: 1px solid var(--rule);
}
.site-panel {
  background: var(--panel); overflow-y: auto; min-height: 0;
  display: flex; flex-direction: column;
}
.panel-head { padding: 10px 13px; border-bottom: 1px solid var(--rule);
              background: var(--panel-2); position: sticky; top: 0; z-index: 2; }
.panel-lens { margin: 7px 0 8px; }
.panel-lens strong { display: block; font: 600 12px var(--mono);
                     letter-spacing: .08em; text-transform: uppercase; }
.panel-lens span { display: block; font-size: 11.5px; color: var(--ink-3);
                   margin-top: 2px; line-height: 1.45; }
.crumb { display: flex; align-items: center; gap: 5px; flex-wrap: wrap;
         font: 10.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; }
.crumb .sep { color: var(--ink-3); }
.crumb-link { border: 0; background: none; cursor: pointer; padding: 0;
              color: var(--accent); font: inherit; }
.crumb-link:hover { text-decoration: underline; }
.crumb-here { color: var(--ink); }

.ramp { padding: 9px 13px; border-bottom: 1px solid var(--rule); }
.ramp-bar { display: flex; height: 8px; }
.ramp-bar > span { flex: 1; }
.ramp-labels { display: flex; justify-content: space-between; margin-top: 4px;
               font: 10px var(--mono); color: var(--ink-3); }

.panel-body { display: flex; flex-direction: column; gap: 1px;
              background: var(--rule); padding-bottom: 1px; }
.panel-card { background: var(--panel); padding: 11px 13px 13px; }
.panel-card > h3 { display: block; padding-bottom: 7px; margin-bottom: 9px;
                   border-bottom: 1px solid var(--rule); }
.panel-body > .btn { margin: 8px 13px; }

.readout { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px;
           background: var(--rule); }
.readout-cell { background: var(--panel); padding: 9px 10px; }
.readout-cell .figure { font: 400 17px/1.1 var(--mono); margin-top: 5px; }
.readout-cell .label { font-size: 9px; }

/* Hover card: dense, high contrast, never washed out. */
.hover-card b { display: block; font: 600 12px var(--mono); color: var(--ink);
                letter-spacing: .05em; margin-bottom: 4px; }
.hover-card span { display: block; color: var(--ink-2); font-size: 11px;
                   line-height: 1.5; }

@media (max-width: 1100px) {
  .site-stage { grid-template-columns: 1fr; grid-template-rows: 1fr auto; }
  .site-stage > .viewport { border-right: 0; border-bottom: 1px solid var(--rule);
                            min-height: 46vh; }
  .site-panel { max-height: 46vh; }
}
/* On a phone the model takes the larger share: it is what the visitor came to
   see, and the panel below it scrolls for the rest. */
@media (max-width: 900px) {
  .site-stage > .viewport { min-height: 58vh; }
  .site-panel { max-height: 38vh; overflow-y: auto; }
}

/* ------------------------------------------------------------------ chrome off */
/* The lander is a product page, not an app tab: drop the rail + status strip. */
body.chromeless .topbar,
body.chromeless .sidebar { display: none; }
body.chromeless .main { margin: 0; }

/* Button variants used on the lander and elsewhere. */
button.btn.ghost, .btn.ghost {
  background: transparent; border-color: var(--rule-bright); color: var(--ink);
}
button.btn.ghost:hover { background: var(--panel-2); }
button.btn.lg, .btn.lg {
  padding: 11px 20px; font-size: 12.5px; letter-spacing: .04em;
  border-radius: 9px; text-transform: none;
}
/* Flat accent fill, dark ink on it. Elevation on dark comes from surface
   lightness, never a coloured halo. */
button.btn.primary {
  background: var(--accent); border-color: var(--accent);
  color: oklch(18% 0.03 205); font-weight: 600;
}
button.btn.primary:hover { background: oklch(80% 0.13 205); }

/* ------------------------------------------------------------------ lander */
/* Rebuilt against Hallmark's anti-pattern list: no gradient headline, no
   aurora blob, no full-viewport centred hero, no icon-tile 3-up grid, no
   eyebrow, no shadow-glow. Left-biased asymmetric hero; display face carries
   the statement; elevation comes from surface lightness, not coloured haze. */
.lander { min-height: 100vh; background: var(--ground); }
.lander-nav {
  position: sticky; top: 0; z-index: 20; display: flex; align-items: center;
  gap: 24px; padding: 18px 40px;
  background: color-mix(in srgb, var(--ground) 86%, transparent);
  backdrop-filter: blur(12px); border-bottom: 1px solid var(--rule);
}
.lander-logo {
  display: flex; align-items: center; gap: 10px;
  font-family: var(--display); font-weight: 700; font-size: 19px;
  letter-spacing: -.02em;
}
.lander-logo .brand-mark { width: 18px; height: 18px; }
.lander-nav-links { display: flex; gap: 24px; }
.lander-nav-links a { color: var(--ink-2); font-size: 13.5px; text-decoration: none; }
.lander-nav-links a:hover { color: var(--ink); }
.lander-nav .grow { flex: 1; }

/* Asymmetric two-column hero: statement left, ledger right. */
.lander-hero {
  display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(0, 1fr);
  gap: 56px; align-items: start;
  max-width: 1160px; margin: 0 auto; padding: 64px 40px 44px;
}
.hero-say h1 {
  font-family: var(--display);
  /* Stepped down from 52px: the headline is one 58-character sentence now, not
     two short stacked ones, and display sizes are for short statements. */
  font-size: clamp(30px, 3.6vw, 44px); font-weight: 700;
  letter-spacing: -.03em; line-height: 1.1; color: var(--ink);
  overflow-wrap: anywhere; min-width: 0;
}
/* The hero action reads as text, not a third button competing with the nav. */
.hero-act { margin-top: 18px; }
.linky {
  border: 0; background: none; padding: 0; cursor: pointer;
  font: inherit; font-size: 13.5px; color: var(--accent);
  border-bottom: 1px solid transparent;
}
.linky:hover { border-bottom-color: var(--accent); }
.linky:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.lander-nav .linky { font-size: 13.5px; color: var(--ink-2); }
.lander-nav .linky:hover { color: var(--ink); border-bottom-color: var(--ink-3); }
.lander .lead {
  color: var(--ink-2); font-size: 16px; line-height: 1.6; max-width: 54ch;
  margin: 20px 0 0;
}
.hero-note {
  margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--rule);
  color: var(--ink-3); font-size: 13px; line-height: 1.55; max-width: 54ch;
}
/* The figures as a ruled ledger, not glowing stat cards. */
.hero-ledger { margin: 6px 0 0; display: grid; gap: 0; }
.hero-ledger > div {
  display: flex; align-items: baseline; justify-content: space-between;
  gap: 16px; padding: 11px 0; border-bottom: 1px solid var(--rule);
}
.hero-ledger > div:first-child { border-top: 1px solid var(--rule); }
.hero-ledger dt {
  font-size: 12.5px; color: var(--ink-3); letter-spacing: .01em;
}
.hero-ledger dd {
  margin: 0; font-family: var(--display); font-weight: 600; font-size: 24px;
  color: var(--ink); letter-spacing: -.02em; font-variant-numeric: tabular-nums;
}

.lander-body { max-width: 1160px; margin: 0 auto; padding: 8px 40px 80px; }
.section-head { margin: 30px 0 18px; }
.section-head h2 {
  font-family: var(--display); font-size: 22px; font-weight: 650;
  letter-spacing: -.02em;
}
.section-head p { color: var(--ink-3); font-size: 14px; margin-top: 6px;
  max-width: 66ch; }

/* Broken grid: the lead template spans, the rest are a ruled list. */
/* Explicit tracks, not auto-fill: `grid-column: 1 / -1` only spans the
   explicit grid reliably, and the broken rhythm (one wide lead + a ruled row
   of three) needs a track count we control. */
.template-grid {
  display: grid; gap: 14px; grid-template-columns: repeat(3, minmax(0, 1fr));
}
@media (max-width: 1000px) { .template-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@media (max-width: 700px)  { .template-grid { grid-template-columns: minmax(0, 1fr); } }
.template-card {
  grid-column: span 1; text-align: left; cursor: pointer; font: inherit;
  color: var(--ink); background: var(--panel);
  border: 1px solid var(--rule); border-radius: 12px;
  padding: 16px 18px 18px; display: flex; flex-direction: column; gap: 8px;
  transition: background .14s, border-color .14s;
}
/* Flex, not grid: a <button> is an unreliable grid container across engines,
   and the band silently collapsed to shrink-to-fit. Flex row is stable. */
.template-card.is-lead {
  width: 100%; margin-bottom: 14px; background: var(--panel-2);
  display: flex; flex-direction: row; align-items: center;
  gap: 28px; padding: 22px 24px;
}
.template-card.is-lead .template-head { flex: 0 0 auto; }
.template-card.is-lead > p { flex: 1 1 auto; max-width: 62ch; }
.template-card.is-lead .template-meta { flex: 0 0 auto; justify-content: flex-end; }
.template-card:hover { background: var(--panel-3); border-color: var(--rule-bright); }
.template-card.onboarding { opacity: .55; pointer-events: none; }
/* Icon inline with the name — never a coloured tile stacked above it. */
.template-head { display: flex; align-items: center; gap: 9px; }
.template-glyph { color: var(--accent); display: flex; flex: none; }
.template-card h3 {
  font-family: var(--display); font-size: 16.5px; font-weight: 620;
  letter-spacing: -.015em; flex: 1;
}
.template-card.is-lead h3 { font-size: 21px; }
.template-card p { color: var(--ink-2); font-size: 13.5px; line-height: 1.5; }
.template-meta { display: flex; gap: 14px; flex-wrap: wrap;
  font-size: 12px; color: var(--ink-3); }
.template-go {
  font-size: 12.5px; color: var(--accent); opacity: 0; transition: opacity .14s;
}
.template-card:hover .template-go { opacity: 1; }

.ws-grid { display: grid; gap: 10px; margin-top: 4px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 320px), 1fr)); }
.ws-card {
  display: flex; align-items: center; gap: 13px; padding: 14px 16px;
  background: var(--panel); border: 1px solid var(--rule); border-radius: 11px;
  cursor: pointer; color: var(--ink); text-align: left; font: inherit;
  transition: background .14s, border-color .14s;
}
.ws-card:hover { background: var(--panel-3); border-color: var(--rule-bright); }
.ws-card .ws-icon { width: 34px; height: 34px; flex: none; display: grid;
  place-items: center; border-radius: 9px; background: var(--panel-3);
  color: var(--accent); }
.ws-card strong { font-family: var(--display); font-size: 14.5px; font-weight: 600; }
.lander-foot { margin-top: 48px; padding-top: 20px;
  border-top: 1px solid var(--rule); color: var(--ink-3); font-size: 12.5px;
  line-height: 1.6; max-width: 80ch; }

@media (max-width: 860px) {
  .lander-hero { grid-template-columns: 1fr; gap: 28px; padding: 40px 22px 30px; }
  .lander-nav { padding: 14px 22px; }
  .lander-nav-links { display: none; }
  .lander-body { padding: 8px 22px 60px; }
  .template-card.is-lead { flex-direction: column; align-items: flex-start; gap: 8px; }
  .template-card.is-lead .template-meta { justify-content: flex-start; }
}

/* ------------------------------------------------------------------ studio */
.studio { display: flex; flex-direction: column; height: calc(100vh - var(--strip-h)); }
/* One column now the duplicated chat is gone. It is measure-bound rather than
   full-bleed: a dropzone and a file list stretched across 1100px is the same
   dead space the chat column used to hold, just emptier. */
.studio-cols { flex: 1; display: block; min-height: 0; overflow-y: auto;
  background: var(--panel); }
.studio-side { background: var(--panel); padding-bottom: 24px; }
/* The twin stated as a sentence rather than a row of census figures. */
.twin-line { padding: 13px 14px; color: var(--ink-2); font-size: 13.5px;
  line-height: 1.55; border-bottom: 1px solid var(--rule); }
.twin-line b { color: var(--ink); font-weight: 600; }
.studio-col-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 14px;
  border-bottom: 1px solid var(--rule); background: var(--panel-2);
  font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2);
}
.studio-col-head strong { color: var(--ink-2); font-weight: 500; }
.assistant-hello { padding: 20px 4px; }
.assistant-hello h3 { font-size: 15px; margin-bottom: 8px; }
.action-chip {
  display: inline-flex; align-items: center; gap: 5px; margin-top: 7px;
  padding: 3px 7px; background: color-mix(in srgb, var(--good) 15%, var(--panel-2));
  border: 1px solid color-mix(in srgb, var(--good) 40%, var(--rule));
  color: var(--good); font: 500 10.5px var(--mono); letter-spacing: .04em;
}
.dropzone {
  display: flex; flex-direction: column; align-items: center; gap: 5px;
  text-align: center; padding: 22px 14px; margin: 12px 14px 0;
  border: 1.5px dashed var(--rule-bright); color: var(--ink-3);
  cursor: pointer; transition: .12s;
}
.dropzone:hover, .dropzone.over { border-color: var(--accent);
  background: var(--accent-dim); color: var(--ink-2); }
.dropzone strong { color: var(--ink); font-size: 13px; }
.dropzone span { font-size: 11.5px; }
/* Fills whatever width the workbench has now that it is not a 380px rail. */
.upload-gallery { display: grid; gap: 8px; padding: 12px 14px;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, 160px), 1fr)); }
.upload-tile {
  display: flex; flex-direction: column; border: 1px solid var(--rule);
  background: var(--panel-2); overflow: hidden; text-decoration: none;
  color: var(--ink-2);
}
.upload-tile:hover { border-color: var(--rule-bright); text-decoration: none; }
.upload-tile img { width: 100%; height: 84px; object-fit: cover;
  background: var(--panel-3); }
.upload-doc { height: 84px; display: grid; place-items: center;
  color: var(--ink-3); background: var(--panel-3); }
.upload-name { font-size: 11px; padding: 5px 7px 0; white-space: nowrap;
  overflow: hidden; text-overflow: ellipsis; }
.upload-kind { font: 9.5px var(--mono); letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); padding: 1px 7px 5px; }
.cam-modal { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.8);
  display: grid; place-items: center; }
.cam-inner { background: var(--panel); border: 1px solid var(--rule-bright);
  padding: 14px; max-width: 92vw; }
.cam-inner video { max-width: 640px; width: 100%; background: #000; }

.ws-pill {
  display: flex; align-items: center; gap: 6px; padding: 0 12px;
  align-self: stretch; border-left: 1px solid var(--rule);
  font: 11px var(--mono); color: var(--ink-2); cursor: pointer;
  background: none; border-top: 0; border-bottom: 0; border-right: 0;
}
.ws-pill:hover { background: var(--panel-3); color: var(--ink); }
.ws-pill b { color: var(--ink); font-weight: 500; }

@media (max-width: 1000px) {
  .studio-side { max-width: none; border-right: 0; }
}

/* ---------------------------------------------------------------- sims mode */
.sims-stage { display: grid; grid-template-columns: 300px 1fr; gap: 1px;
  background: var(--rule); position: relative; }
.sims-left { background: var(--panel); overflow-y: auto; max-height: calc(100vh - 150px); }
.sims-wallet { padding: 12px 13px; border-bottom: 1px solid var(--rule); }
.sims-palette { padding: 4px 13px 20px; }
.sims-cat-row { display: flex; flex-direction: column; gap: 4px; }
.sims-item {
  display: flex; align-items: center; gap: 8px; padding: 6px 8px;
  border: 1px solid var(--rule); background: var(--panel-2); cursor: pointer;
  color: var(--ink); text-align: left; font: inherit; width: 100%;
}
.sims-item:hover { border-color: var(--rule-bright); background: var(--panel-3); }
.sims-item.active { border-color: var(--accent); background: var(--accent-dim); }
.sims-item .swatch { width: 16px; height: 16px; flex: none; border-radius: 2px; }
.sims-item-name { flex: 1; font-size: 12px; }
.sims-item-price { font: 10.5px var(--mono); color: var(--ink-3); }
.sims-grid-wrap { background: var(--panel); padding: 16px; overflow: auto;
  display: flex; flex-direction: column; gap: 12px; align-items: flex-start; }
.sims-hint { font-size: 12px; color: var(--ink-3); }
.sims-hint b { color: var(--ink); }
.sims-grid { touch-action: none; user-select: none; }
.sims-piece:active { cursor: grabbing; }
.sims-menu {
  position: fixed; z-index: 80; background: var(--panel);
  border: 1px solid var(--rule-bright); display: flex; flex-direction: column;
  gap: 1px; padding: 6px; min-width: 130px;
}
.sims-menu-title { font: 10.5px var(--mono); letter-spacing: .08em;
  text-transform: uppercase; color: var(--ink-3); padding: 3px 4px 6px; }
.sims-menu .btn { width: 100%; }
.sims-flash {
  position: absolute; top: 12px; left: 50%; transform: translateX(-50%);
  background: var(--panel-3); border: 1px solid var(--rule-bright);
  padding: 8px 14px; font: 12px var(--mono); z-index: 20;
}
@media (max-width: 900px) { .sims-stage { grid-template-columns: 1fr; } }

/* ------------------------------------------------------------------ world map */
.map-root { display: flex; flex-direction: column; height: calc(100vh - var(--strip-h)); }
.map-wrap { flex: 1; position: relative; min-height: 0; }
.map-canvas { position: absolute; inset: 0; background: var(--panel-2); }
.map-layer-toggle { display: flex; gap: 0; }
.map-layer-toggle .btn { border-radius: 0; }
.map-layer-toggle .btn:not(:last-child) { border-right: 0; }
.map-layer-toggle .btn.active { background: var(--accent-dim); color: var(--ink);
  border-color: var(--accent); }
.map-legend { position: absolute; top: 12px; right: 12px; z-index: 500;
  display: flex; flex-direction: column; gap: 8px; width: 210px; }
.map-card { background: color-mix(in srgb, var(--panel) 92%, transparent);
  backdrop-filter: blur(8px); border: 1px solid var(--rule-bright);
  border-radius: 10px; padding: 10px 12px; box-shadow: var(--shadow-2); }
.map-weather { display: flex; gap: 10px; font: 600 15px var(--sans);
  color: var(--ink); margin-top: 5px; }
.map-leg-row { display: flex; align-items: center; gap: 7px; padding: 2px 0;
  font-size: 12px; color: var(--ink-2); }
.map-check { font-size: 12px; color: var(--ink-2); cursor: pointer;
  display: flex; align-items: center; gap: 4px; }
/* Leaflet popups themed to match the console. */
.leaflet-popup-content-wrapper, .leaflet-popup-tip {
  background: var(--panel); color: var(--ink); border: 1px solid var(--rule-bright);
  box-shadow: var(--shadow-3); border-radius: 10px; }
.leaflet-popup-content { margin: 11px 13px; font: 12.5px var(--sans); }
.map-pop b { font-size: 13.5px; }
.map-pop div { color: var(--ink-2); margin-top: 3px; }
.map-pop-btn { margin-top: 8px; width: 100%; cursor: pointer;
  background: var(--accent); color: oklch(18% 0.03 205);
  border: 0; border-radius: 7px; padding: 6px; font: 600 12px var(--sans); }
.leaflet-container { font-family: var(--sans); background: var(--panel-2); }
.leaflet-bar a { background: var(--panel); color: var(--ink); border-color: var(--rule); }
.leaflet-bar a:hover { background: var(--panel-3); }

/* ---------------------------------------------------------------- marketplace */
.mkt-body { display: flex; flex-direction: column; }
.mkt-domain { border-bottom: 1px solid var(--rule); }
.mkt-domain-head { display: flex; align-items: center; gap: 10px;
  padding: 14px 18px 10px; }
.mkt-domain-head i { width: 16px; height: 16px; color: var(--accent); }
.mkt-domain-head h2 { font-size: 15px; }
.mkt-domain-head .muted { font-size: 12px; }
.mkt-grid { display: grid; gap: 1px; background: var(--rule);
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); }
.mkt-cat { background: var(--panel); padding: 13px 15px 14px;
  display: flex; flex-direction: column; gap: 7px; }
.mkt-cat-head { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.mkt-cat-head strong { font-size: 13.5px; }
.mkt-cat p { font-size: 12px; line-height: 1.45; flex: 0; }
.mkt-srcs { display: flex; flex-direction: column; gap: 4px; margin-top: 4px; }
.mkt-src { display: flex; align-items: center; gap: 8px; padding: 5px 8px;
  border: 1px solid var(--rule); background: var(--panel-2); border-radius: 7px;
  cursor: pointer; color: var(--ink); text-align: left; font: inherit; width: 100%; }
.mkt-src:hover { border-color: var(--rule-bright); background: var(--panel-3); }
.mkt-src.on { border-color: color-mix(in srgb, var(--good) 45%, var(--rule)); }
.mkt-dot { width: 7px; height: 7px; border-radius: 99px; flex: none;
  background: var(--ink-3); }
.mkt-dot.live { background: var(--good);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 22%, transparent); }
.mkt-src-name { flex: 1; font-size: 12px; overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; }
.mkt-src-state { font: 10px var(--mono); letter-spacing: .06em;
  text-transform: uppercase; color: var(--ink-3); }
.mkt-src.on .mkt-src-state { color: var(--good); }
.mkt-add { display: flex; align-items: center; gap: 5px; padding: 5px 8px;
  border: 1px dashed var(--rule-bright); background: none; border-radius: 7px;
  cursor: pointer; color: var(--ink-3); font: 11px var(--mono);
  letter-spacing: .04em; text-transform: uppercase; }
.mkt-add:hover { color: var(--accent); border-color: var(--accent); }
.picker-scrim { position: fixed; inset: 0; z-index: 90; background: rgba(0,0,0,.6);
  display: grid; place-items: start center; padding-top: 8vh; }
.picker { width: min(560px, 92vw); max-height: 76vh; display: flex;
  flex-direction: column; background: var(--panel);
  border: 1px solid var(--rule-bright); border-radius: 12px;
  box-shadow: var(--shadow-3); overflow: hidden; }
.picker-head { display: flex; align-items: center; justify-content: space-between;
  padding: 12px 14px; border-bottom: 1px solid var(--rule); background: var(--panel-2); }
.picker input { margin: 12px 14px; }
.picker-list { overflow-y: auto; padding: 0 8px 10px; }
.picker-row { display: flex; align-items: center; gap: 10px; width: 100%;
  padding: 9px 10px; border: 0; border-radius: 8px; background: none;
  cursor: pointer; color: var(--ink); text-align: left; font: inherit; }
.picker-row:hover { background: var(--panel-3); }

/* ---------------------------------------------------- world-map inset in 3D */
.site-minimap-wrap {
  position: absolute; right: 12px; bottom: 12px; z-index: 500;
  width: 260px; background: var(--panel); border: 1px solid var(--rule-bright);
  border-radius: 12px; overflow: hidden; box-shadow: var(--shadow-3);
}
.site-minimap-head {
  display: flex; align-items: center; gap: 7px; padding: 7px 10px;
  border-bottom: 1px solid var(--rule); background: var(--panel-2);
  font: 500 10px var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2);
}
.site-minimap-head i { width: 13px; height: 13px; color: var(--accent); }
.site-minimap-head .mini-expand { margin-left: auto; cursor: pointer;
  border: 1px solid var(--rule); background: none; color: var(--ink-3);
  font: 9.5px var(--mono); letter-spacing: .08em; text-transform: uppercase;
  padding: 2px 7px; border-radius: 5px; }
.site-minimap-head .mini-expand:hover { color: var(--accent); border-color: var(--accent); }
.site-minimap { height: 168px; background: var(--panel-2); }
@media (max-width: 1100px) { .site-minimap-wrap { display: none; } }

/* ----------------------------------------------------------- organization */
.org-split { display: grid; grid-template-columns: 1fr 380px; gap: 1px;
  background: var(--rule); }
.org-tree { background: var(--panel); padding: 10px 6px 20px;
  max-height: 70vh; overflow-y: auto; }
.org-detail { background: var(--panel); padding: 12px; display: flex;
  flex-direction: column; gap: 1px; max-height: 70vh; overflow-y: auto; }
.org-row { display: flex; align-items: center; gap: 8px; padding: 5px 10px;
  cursor: pointer; border-radius: 7px; font-size: 12.5px; }
.org-row:hover { background: var(--panel-3); }
.org-row.sel { background: var(--accent-dim); }
.org-row i { width: 14px; height: 14px; color: var(--ink-3); }
.org-twist { width: 10px; color: var(--ink-3); font-size: 10px; }
.org-name { flex: 1; }
.org-kind { font: 9.5px var(--mono); letter-spacing: .1em;
  text-transform: uppercase; color: var(--ink-3); }
.org-counts { font-size: 10.5px; color: var(--ink-3); min-width: 62px;
  text-align: right; }
.org-kids { margin-left: 16px; border-left: 1px solid var(--rule);
  padding-left: 4px; }
.org-kids.collapsed { display: none; }
.org-more { margin: 3px 0 3px 10px; background: none; cursor: pointer;
  border: 1px dashed var(--rule-bright); color: var(--ink-3); border-radius: 6px;
  font: 10px var(--mono); letter-spacing: .06em; text-transform: uppercase;
  padding: 3px 8px; }
.org-more:hover { color: var(--accent); border-color: var(--accent); }
@media (max-width: 1000px) { .org-split { grid-template-columns: 1fr; } }

/* ------------------------------------------------------- assistant rail */
/* Docked to every view but the lander. The app gutters right by the rail
   width so nothing hides underneath it. */
:root { --arail-w: 340px; }
body.arail-open.has-arail .main { margin-right: var(--arail-w); }
body.arail-open.has-arail .topbar { right: var(--arail-w); }
.arail {
  position: fixed; top: var(--strip-h); right: 0; bottom: 0; width: var(--arail-w);
  z-index: 45; display: flex; flex-direction: column;
  background: var(--panel); border-left: 1px solid var(--rule);
}
.arail-head {
  display: flex; align-items: center; gap: 8px; padding: 11px 12px;
  border-bottom: 1px solid var(--rule); background: var(--panel-2);
  font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2);
}
.arail-head i { width: 14px; height: 14px; color: var(--accent); }
.arail-head .grow { flex: 1; }
.arail-min { border: 0; background: none; color: var(--ink-3); cursor: pointer;
  font-size: 17px; line-height: 1; padding: 0 4px; }
.arail-min:hover { color: var(--ink); }
.arail-log { flex: 1; overflow-y: auto; padding: 12px;
  display: flex; flex-direction: column; gap: 9px; }
.arail-hello { color: var(--ink-3); font-size: 12.5px; line-height: 1.6; }
.arail-hello ul { margin: 8px 0 0; padding-left: 16px; }
.arail-hello li { margin-bottom: 3px; }
.arail-sugg { display: flex; flex-wrap: wrap; gap: 5px; padding: 0 12px 8px; }
.arail-sugg button {
  font: 10.5px var(--mono); cursor: pointer; padding: 4px 8px;
  border: 1px solid var(--rule); background: none; color: var(--ink-3);
  border-radius: 6px;
}
.arail-sugg button:hover { color: var(--accent); border-color: var(--accent); }
.arail-input { display: flex; gap: 6px; padding: 10px 12px;
  border-top: 1px solid var(--rule); }
.arail-input input { flex: 1; min-width: 0; }
.arail-tab {
  position: fixed; right: 0; top: calc(var(--strip-h) + 16px); z-index: 45;
  display: flex; align-items: center; gap: 6px; cursor: pointer;
  padding: 9px 12px; border: 1px solid var(--rule); border-right: 0;
  border-radius: 9px 0 0 9px; background: var(--panel); color: var(--ink-2);
  font: 500 10.5px var(--mono); letter-spacing: .1em; text-transform: uppercase;
}
.arail-tab:hover { color: var(--accent); border-color: var(--accent); }
/* On a phone the rail becomes a sheet that slides over the content, and the
   content keeps the full width beneath it — a 3D view squeezed into the strip
   above a permanent sheet is worth less than the model at full bleed with the
   assistant one tap away. */
@media (max-width: 900px) {
  body.arail-open.has-arail .main,
  body.arail-open.has-arail .topbar { margin-right: 0; right: 0; }
  .arail {
    top: auto; left: 0; right: 0; width: auto; height: min(56vh, 460px);
    border-left: 0; border-top: 1px solid var(--rule);
    border-radius: 14px 14px 0 0; box-shadow: 0 -12px 32px rgb(0 0 0 / .5);
  }
  /* A thumb-reachable pill rather than a tab pinned under the top strip. */
  .arail-tab {
    top: auto; bottom: 14px; right: 14px; border-right: 1px solid var(--rule);
    border-radius: 999px; padding: 11px 15px;
    box-shadow: 0 6px 20px rgb(0 0 0 / .45);
  }
  .arail-sugg { flex-wrap: nowrap; overflow-x: auto; padding-bottom: 10px; }
  .arail-sugg button { white-space: nowrap; flex: none; }
}

/* ------------------------------------------------- organizations & account */
/* The org pill sits left of the twin pill: which tenant, then which twin. */
.org-pill {
  display: flex; align-items: center; gap: 7px; cursor: pointer;
  padding: 5px 10px; border: 1px solid var(--rule); border-radius: 8px;
  background: var(--panel-2); color: var(--ink-2); font-size: 12.5px;
  max-width: 260px;
}
.org-pill:hover { border-color: var(--accent); color: var(--ink); }
.org-pill-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-pill i { color: var(--ink-3); }
.org-dot { width: 8px; height: 8px; border-radius: 3px; flex: none; }
.org-dot.lg { width: 11px; height: 11px; border-radius: 4px; }
.org-dot.xl { width: 26px; height: 26px; border-radius: 8px; display: block;
              margin: 0 auto 10px; }
.chip.tiny { font-size: 9.5px; padding: 1px 5px; }
.chip.warn { color: var(--warning); border-color: color-mix(in oklab, var(--warning) 45%, transparent); }

.org-menu {
  position: fixed; z-index: 90; width: min(320px, calc(100vw - 16px));
  background: var(--panel); border: 1px solid var(--rule); border-radius: 12px;
  box-shadow: 0 18px 44px rgb(0 0 0 / .5); padding: 6px; overflow: hidden;
}
.org-menu-head, .org-menu-sep {
  font: 500 9.5px var(--mono); letter-spacing: .14em; text-transform: uppercase;
  color: var(--ink-3); padding: 8px 10px 6px;
}
.org-menu-sep { border-top: 1px solid var(--rule); margin-top: 4px; padding: 6px 10px 2px; }
.org-menu-empty { color: var(--ink-3); font-size: 12px; padding: 4px 10px 8px; }
.org-menu-item, .org-menu-act {
  display: flex; align-items: center; gap: 9px; width: 100%; text-align: left;
  padding: 8px 10px; border: 0; border-radius: 8px; background: none;
  color: var(--ink-2); cursor: pointer; font-size: 13px;
}
.org-menu-item:hover, .org-menu-act:hover { background: var(--panel-3); color: var(--ink); }
.org-menu-item.active { background: var(--accent-dim); color: var(--ink); }
.org-menu-item small, .org-menu-who small {
  display: block; color: var(--ink-3); font-size: 11px; margin-top: 1px;
}
.org-menu-item strong { font-weight: 500; }
.org-menu-act i { width: 14px; height: 14px; color: var(--ink-3); }
.org-menu-act.strong { color: var(--accent); }
.org-menu-who { padding: 6px 10px 8px; }

/* The sign-in sheet, the invite sheet — one modal shape for both. */
.sheet-back {
  position: fixed; inset: 0; z-index: 100; display: grid; place-items: center;
  background: rgb(0 0 0 / .6); padding: 16px; backdrop-filter: blur(3px);
}
.sheet {
  position: relative; width: min(420px, 100%); background: var(--panel);
  border: 1px solid var(--rule); border-radius: 14px; padding: 26px 24px 24px;
  box-shadow: 0 24px 60px rgb(0 0 0 / .55);
}
.sheet h2 { font-family: var(--display); font-size: 21px; margin: 0 0 4px; }
.sheet > .muted { font-size: 13px; line-height: 1.55; }
.sheet-x {
  position: absolute; top: 10px; right: 12px; border: 0; background: none;
  color: var(--ink-3); font-size: 20px; line-height: 1; cursor: pointer;
}
.sheet-x:hover { color: var(--ink); }
.form { display: flex; flex-direction: column; gap: 11px; margin-top: 16px; }
.form label { display: flex; flex-direction: column; gap: 5px; }
.form label > span {
  font: 500 9.5px var(--mono); letter-spacing: .13em; text-transform: uppercase;
  color: var(--ink-3);
}
.form-2, .form-3 { display: grid; gap: 10px; }
.form-2 { grid-template-columns: 1fr 1fr; }
.form-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.form-error { color: var(--critical); font-size: 12.5px; margin: 0; }
.linkish { border: 0; background: none; color: var(--accent); cursor: pointer;
           font: inherit; padding: 0; text-decoration: underline; }
.tiny { font-size: 11.5px; }
.invite-out { margin-top: 12px; display: flex; flex-direction: column; gap: 7px; }
.invite-out code {
  display: block; word-break: break-all; font-size: 11px; padding: 8px;
  background: var(--panel-3); border-radius: 7px; color: var(--ink-2);
}

/* Customer console + team view */
.eng-row, .member-row {
  display: flex; align-items: center; gap: 11px; padding: 11px 14px;
  border-top: 1px solid var(--rule);
}
.eng-row .grow, .member-row .grow { flex: 1; min-width: 0; }
.eng-row p, .member-row p { margin: 2px 0 0; }
.avatar {
  width: 28px; height: 28px; border-radius: 9px; flex: none; display: grid;
  place-items: center; background: var(--panel-3); color: var(--ink-2);
  font-size: 12px; font-weight: 600;
}
.avatar.sq { border-radius: 8px; color: var(--accent); }
.role-select, .form select, .form input, .wizard input, .wizard select {
  background: var(--panel-3); border: 1px solid var(--rule); color: var(--ink);
  border-radius: 8px; padding: 8px 10px; font: inherit; font-size: 13px;
}
/* Pico gives every select width:100%, which inside a flex row starves its
   siblings down to one character per line. Let this one size to its content. */
.role-select { padding: 4px 26px 4px 8px; font-size: 12px; width: auto;
               flex: none; margin: 0; }

/* Card headers that carry an action button on the right. */
.card > header {
  display: flex; align-items: center; gap: 10px; padding: 0 0 9px;
  margin: 0 0 2px; border-bottom: 1px solid var(--rule);
  font: 500 10.5px var(--mono); letter-spacing: .12em; text-transform: uppercase;
  color: var(--ink-2); background: none;
}
.card > header > .btn, .card > header > .chip { margin-left: auto; }
.card > header > .btn ~ .btn, .card > header > .chip ~ .chip { margin-left: 0; }
.eng-row:first-of-type, .member-row:first-of-type { border-top: 0; }
.card.accent { border-color: color-mix(in oklab, var(--accent) 40%, var(--rule)); }
.card .pad { padding: 14px; }
.card.pad-lg { padding: 30px 24px; }
.card.center { text-align: center; }
.handover-box {
  margin-top: 12px; padding: 14px; border: 1px solid var(--rule);
  border-radius: 10px; background: var(--panel-2);
}
.handover-box h4 { margin: 0 0 4px; font-size: 14px; }
.handover-box .form-2 { margin: 12px 0; }

/* The build wizard: answers on the left, the twin they produce on the right. */
.wizard {
  display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 28px;
  align-items: start; max-width: 900px;
}
.wizard-say h1 { font-family: var(--display); font-size: 28px; margin: 0 0 8px; }
.wizard-say .lead { color: var(--ink-2); font-size: 14px; line-height: 1.6;
                    max-width: 54ch; }
.plan-preview {
  border: 1px solid var(--rule); border-radius: 12px; padding: 16px;
  background: var(--panel-2); position: sticky; top: 78px;
}
.plan-preview h4 {
  margin: 0 0 10px; font: 500 9.5px var(--mono); letter-spacing: .14em;
  text-transform: uppercase; color: var(--ink-3);
}
.plan-dl { margin: 0; display: flex; flex-direction: column; gap: 8px; }
.plan-dl > div { display: flex; justify-content: space-between; gap: 12px;
                 border-bottom: 1px solid var(--rule); padding-bottom: 7px; }
.plan-dl dt { color: var(--ink-3); font-size: 11.5px; }
.plan-dl dd { margin: 0; font-size: 12.5px; text-align: right; }
@media (max-width: 820px) { .wizard { grid-template-columns: 1fr; } }

/* The two ways in, on the lander. */
.route-split { display: grid; grid-template-columns: 1fr 1fr; gap: 12px;
               margin: 4px 0 8px; }
.route-card {
  text-align: left; padding: 18px; border: 1px solid var(--rule);
  border-radius: 12px; background: var(--panel-2); cursor: pointer;
  color: var(--ink-2);
}
.route-card:hover { border-color: var(--accent); }
.route-card h3 { margin: 10px 0 5px; font-size: 15px; color: var(--ink); }
.route-card p { margin: 0; font-size: 12.5px; line-height: 1.55; }
.route-glyph { color: var(--accent); display: block; }
.route-go { display: inline-block; margin-top: 10px; font: 500 10.5px var(--mono);
            letter-spacing: .1em; text-transform: uppercase; color: var(--accent); }
.join-view { max-width: 460px; margin: 40px auto; }
@media (max-width: 700px) { .route-split { grid-template-columns: 1fr; } }
