/* eaxCloud portal: Loop & Bus brand (brand/README.md), strict-CSP ready
   (no inline styles anywhere; every rule lives here). Light/dark from
   prefers-color-scheme plus a manual data-theme toggle on <html>. */

/* ---- fonts (self-hosted, SIL OFL; see fonts/*-OFL.txt) ------------------ */
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url('/fonts/archivo-latin-wdth-wght-normal.woff2') format('woff2');
  unicode-range: U+0000-00FF, U+0131, U+0152-0153, U+02BB-02BC, U+02C6, U+02DA, U+02DC, U+0304, U+0308, U+0329, U+2000-206F, U+20AC, U+2122, U+2191, U+2193, U+2212, U+2215, U+FEFF, U+FFFD;
}
@font-face {
  font-family: 'Archivo'; font-style: normal; font-display: swap; font-weight: 100 900; font-stretch: 62% 125%;
  src: url('/fonts/archivo-latin-ext-wdth-wght-normal.woff2') format('woff2');
  unicode-range: U+0100-02BA, U+02BD-02C5, U+02C7-02CC, U+02CE-02D7, U+02DD-02FF, U+1D00-1DBF, U+1E00-1E9F, U+1EF2-1EFF, U+2020, U+20A0-20AB, U+20AD-20C0, U+2113, U+2C60-2C7F, U+A720-A7FF;
}
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 400; src: url('/fonts/IBMPlexMono-Regular-Latin1.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 500; src: url('/fonts/IBMPlexMono-Medium-Latin1.woff2') format('woff2'); }
@font-face { font-family: 'IBM Plex Mono'; font-style: normal; font-display: swap; font-weight: 600 700; src: url('/fonts/IBMPlexMono-SemiBold-Latin1.woff2') format('woff2'); }

/* ---- tokens ------------------------------------------------------------- */
:root {
  color-scheme: light;
  --bg: #EEF1F4;               /* Steel */
  --surface: #FFFFFF;
  --surface-2: #F7F9FB;
  --surface-3: #E6EBF0;
  --hover: #EDF1F5;
  --border: #D9E0E8;
  --border-strong: #B9C4D1;
  --text: #12161B;             /* Graphite */
  --text-2: #334155;
  --text-3: #546174;           /* 6.3:1 on white */
  --accent: #167A49;           /* Field Green, AA text on white (5.4:1) */
  --accent-fill: #167A49;
  --accent-fill-hover: #11643B;
  --on-accent: #FFFFFF;
  --accent-soft: #DDF3E7;
  --signal: #E85A0C;           /* Signal Orange (light): bus, node, focus ring */
  --signal-text: #B9450A;      /* Signal Orange darkened for AA text on light grounds */
  --scada: #066878;            /* Process Cyan darkened: AA on white and on --scada-soft */
  --scada-soft: #DDF1F4;
  --plc: #8A5A00;              /* Safety Amber, AA on white */
  --plc-soft: #FBF0D5;
  --ok: #167A49;
  --ok-soft: #DDF3E7;
  --warn: #8A5A00;
  --warn-soft: #FBF0D5;
  --danger: #B91C1C;
  --danger-soft: #FBE4E4;
  --on-danger: #FFFFFF;
  --focus: #E85A0C;
  --scrim: rgba(18, 22, 27, .45);
  --shadow: 0 1px 2px rgba(15, 23, 42, .06), 0 6px 20px rgba(15, 23, 42, .08);
  --radius: 10px;
  --radius-sm: 6px;
  --tap: 44px;
  --nav-w: 264px;
  --font: 'Archivo', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'IBM Plex Mono', ui-monospace, 'SFMono-Regular', Consolas, monospace;
}
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #12161B;               /* Graphite */
  --surface: #181D24;
  --surface-2: #1D232B;
  --surface-3: #262E38;
  --hover: #222A33;
  --border: #2A323D;
  --border-strong: #3B4552;
  --text: #F1F5F9;
  --text-2: #CBD5E1;
  --text-3: #9AA7B8;
  --accent: #34C77B;           /* Field Green (dark) */
  --accent-fill: #34C77B;
  --accent-fill-hover: #52D690;
  --on-accent: #07130C;
  --accent-soft: #14301F;
  --signal: #FF6B1A;
  --signal-text: #FF8A47;
  --scada: #22C3DA;
  --scada-soft: #12303A;
  --plc: #F7B500;
  --plc-soft: #352B12;
  --ok: #34C77B;
  --ok-soft: #14301F;
  --warn: #F7B500;
  --warn-soft: #352B12;
  --danger: #F87171;
  --danger-soft: #3B1D20;
  --on-danger: #1A0B0B;
  --focus: #FF8A47;
  --scrim: rgba(0, 0, 0, .6);
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --bg: #12161B; --surface: #181D24; --surface-2: #1D232B; --surface-3: #262E38; --hover: #222A33;
    --border: #2A323D; --border-strong: #3B4552;
    --text: #F1F5F9; --text-2: #CBD5E1; --text-3: #9AA7B8;
    --accent: #34C77B; --accent-fill: #34C77B; --accent-fill-hover: #52D690; --on-accent: #07130C; --accent-soft: #14301F;
    --signal: #FF6B1A; --signal-text: #FF8A47; --scada: #22C3DA; --scada-soft: #12303A; --plc: #F7B500; --plc-soft: #352B12;
    --ok: #34C77B; --ok-soft: #14301F; --warn: #F7B500; --warn-soft: #352B12;
    --danger: #F87171; --danger-soft: #3B1D20; --on-danger: #1A0B0B; --focus: #FF8A47; --scrim: rgba(0, 0, 0, .6);
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  }
}

/* ---- base --------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
body {
  margin: 0; min-height: 100vh; background: var(--bg); color: var(--text);
  font: 400 15px/1.5 var(--font); font-stretch: 100%;
  overflow-x: hidden;
}
h1, h2, h3 { font-stretch: 115%; letter-spacing: -0.01em; line-height: 1.2; margin: 0; }
h1 { font-size: 26px; font-weight: 700; }
h2 { font-size: 18px; font-weight: 700; }
h3 { font-size: 15px; font-weight: 700; }
p { margin: 0 0 12px; }
a { color: var(--accent); text-underline-offset: 2px; }
a:hover { text-decoration-thickness: 2px; }
code, .mono { font-family: var(--mono); font-size: .92em; }
.muted { color: var(--text-3); }
.small { font-size: 13px; }
.nowrap { white-space: nowrap; }
.hidden, [hidden] { display: none !important; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
.skip-link { position: absolute; left: 8px; top: -60px; z-index: 100; background: var(--surface); color: var(--text); padding: 8px 12px; border-radius: var(--radius-sm); }
.skip-link:focus { top: 8px; }
img, svg { max-width: 100%; }

/* ---- wordmark ----------------------------------------------------------- */
.brand { display: inline-flex; align-items: center; gap: 10px; color: var(--text); text-decoration: none; }
.brand img { width: 28px; height: 28px; flex: none; }
.wordmark { font-stretch: 115%; font-size: 20px; letter-spacing: -0.01em; white-space: nowrap; }
.wm-eax { font-weight: 400; }
.wm-name { font-weight: 750; }
.mark-dark { display: none; }
:root[data-theme="dark"] .mark-light { display: none; }
:root[data-theme="dark"] .mark-dark { display: inline; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .mark-light { display: none; }
  :root:not([data-theme="light"]) .mark-dark { display: inline; }
}

/* ---- buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: var(--tap); padding: 0 16px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 600 15px/1.2 var(--font); cursor: pointer; text-decoration: none; white-space: nowrap;
}
.btn:hover { background: var(--hover); }
.btn:disabled, .btn[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.btn-primary { background: var(--accent-fill); border-color: var(--accent-fill); color: var(--on-accent); }
.btn-primary:hover { background: var(--accent-fill-hover); border-color: var(--accent-fill-hover); }
.btn-primary:focus-visible { outline-color: var(--signal); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--hover); }
.btn-danger { background: var(--surface); color: var(--danger); border-color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); }
.btn-small { min-height: 34px; padding: 0 10px; font-size: 14px; }
.btn-block { width: 100%; }
.btn-icon { width: var(--tap); padding: 0; }
.btn-row { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.link-btn { background: none; border: 0; padding: 0; color: var(--accent); font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }

/* icons are CSS-drawn so no inline SVG/style is needed */
.i { display: inline-block; width: 18px; height: 18px; flex: none; position: relative; }
.i-menu, .i-menu::before, .i-menu::after { }
.i-menu { border-top: 2px solid currentColor; border-bottom: 2px solid currentColor; height: 14px; }
.i-menu::after { content: ''; position: absolute; left: 0; right: 0; top: 4px; border-top: 2px solid currentColor; }
.i-close::before, .i-close::after { content: ''; position: absolute; left: 1px; right: 1px; top: 8px; border-top: 2px solid currentColor; transform: rotate(45deg); }
.i-close::after { transform: rotate(-45deg); }
.i-theme { border-radius: 50%; border: 2px solid currentColor; background: linear-gradient(90deg, currentColor 50%, transparent 50%); width: 18px; height: 18px; }
.i-copy { width: 14px; height: 16px; border: 2px solid currentColor; border-radius: 3px; }
.i-copy::before { content: ''; position: absolute; left: 3px; top: -6px; width: 12px; height: 14px; border: 2px solid currentColor; border-radius: 3px; border-left-color: transparent; border-bottom-color: transparent; }
.i-chevron { width: 10px; height: 10px; border-right: 2px solid currentColor; border-bottom: 2px solid currentColor; transform: rotate(45deg); margin-top: -4px; }

/* ---- forms -------------------------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 16px; min-width: 0; }
.field > label, .field-label { font-weight: 600; font-size: 14px; }
.field .hint { font-size: 13px; color: var(--text-3); }
.field .error { font-size: 13px; color: var(--danger); }
.input, select.input, textarea.input {
  width: 100%; min-height: var(--tap); padding: 10px 12px; border-radius: var(--radius-sm);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font: 400 15px/1.3 var(--font);
}
textarea.input { min-height: 88px; resize: vertical; }
.input:focus-visible { outline: 2px solid var(--focus); outline-offset: 0; border-color: var(--focus); }
.input[aria-invalid="true"] { border-color: var(--danger); }
.input-code {
  font: 600 24px/1 var(--mono); letter-spacing: .35em; text-align: center; padding: 12px 8px;
}
.check { display: flex; gap: 10px; align-items: flex-start; margin-bottom: 16px; }
.check input { width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent-fill); flex: none; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 16px; }
.strength { height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; }
.strength > span { display: block; height: 100%; width: 0; background: var(--danger); transition: width .2s; }
.strength[data-score="1"] > span { width: 25%; }
.strength[data-score="2"] > span { width: 50%; background: var(--warn); }
.strength[data-score="3"] > span { width: 75%; background: var(--ok); }
.strength[data-score="4"] > span { width: 100%; background: var(--ok); }
.stepper { display: inline-flex; align-items: center; border: 1px solid var(--border-strong); border-radius: var(--radius-sm); overflow: hidden; }
.stepper button { width: 40px; min-height: 40px; border: 0; background: var(--surface-2); color: var(--text); font: 700 18px/1 var(--font); cursor: pointer; }
.stepper button:hover { background: var(--hover); }
.stepper output { min-width: 44px; text-align: center; font: 600 15px/1 var(--mono); }
.switch { display: inline-flex; align-items: center; gap: 10px; cursor: pointer; }
.switch input { width: 40px; height: 22px; appearance: none; border-radius: 11px; background: var(--surface-3); border: 1px solid var(--border-strong); position: relative; cursor: pointer; margin: 0; }
.switch input::after { content: ''; position: absolute; top: 2px; left: 2px; width: 16px; height: 16px; border-radius: 50%; background: var(--text-3); transition: left .15s; }
.switch input:checked { background: var(--accent-fill); border-color: var(--accent-fill); }
.switch input:checked::after { left: 20px; background: var(--on-accent); }

/* ---- surfaces ----------------------------------------------------------- */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 20px; min-width: 0; }
.card + .card { margin-top: 16px; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.card.empty { text-align: center; color: var(--text-3); padding: 32px 20px; }
.grid { display: grid; gap: 16px; }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.stack > * + * { margin-top: 16px; }
.content > * + * { margin-top: 16px; }
.content > .page-head + * { margin-top: 0; }
.divider { border: 0; border-top: 1px solid var(--border); margin: 20px 0; }
.banner { display: flex; gap: 12px; align-items: flex-start; padding: 12px 16px; border-radius: var(--radius); border: 1px solid var(--border); background: var(--surface-2); margin-bottom: 16px; }
.banner p:last-child { margin-bottom: 0; }
.banner-info { border-color: var(--scada); background: var(--scada-soft); }
.banner-warn { border-color: var(--warn); background: var(--warn-soft); }
.banner-ok { border-color: var(--ok); background: var(--ok-soft); }
.banner-danger { border-color: var(--danger); background: var(--danger-soft); }
.facts { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 16px; margin: 0; }
.facts > div { display: contents; }
.facts dt { color: var(--text-3); }
.facts dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }

/* ---- badges ------------------------------------------------------------- */
.badge {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; border-radius: 999px;
  font: 600 12px/18px var(--font); border: 1px solid var(--border-strong); color: var(--text-2); background: var(--surface-2); white-space: nowrap;
}
.badge-cloud, .badge-ok { color: var(--ok); border-color: var(--ok); background: var(--ok-soft); }
.badge-scada { color: var(--scada); border-color: var(--scada); background: var(--scada-soft); }
.badge-plc { color: var(--plc); border-color: var(--plc); background: var(--plc-soft); }
.badge-warn { color: var(--warn); border-color: var(--warn); background: var(--warn-soft); }
.badge-danger { color: var(--danger); border-color: var(--danger); background: var(--danger-soft); }
.badge-dev { color: var(--signal-text); border-color: var(--signal); background: transparent; }
.dot { width: 8px; height: 8px; border-radius: 50%; background: var(--text-3); display: inline-block; flex: none; }
.dot-ok { background: var(--ok); }
.dot-warn { background: var(--warn); }
.dot-off { background: var(--border-strong); }
.kind { display: inline-flex; align-items: center; gap: 8px; font-weight: 600; }
.kind::before { content: ''; width: 10px; height: 10px; border-radius: 2px; background: currentColor; flex: none; }
.kind-scada { color: var(--scada); }
.kind-plc { color: var(--plc); }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }

/* ---- mono value with copy ----------------------------------------------- */
.mono-copy { display: inline-flex; align-items: center; gap: 4px; max-width: 100%; min-width: 0; }
.mono-copy > code { overflow-wrap: anywhere; word-break: break-all; background: var(--surface-2); border: 1px solid var(--border); border-radius: 4px; padding: 2px 6px; }
.mono-copy .btn { min-height: 32px; width: 32px; padding: 0; flex: none; }

/* ---- tables (stacked cards under 640 px) -------------------------------- */
.table-wrap { width: 100%; overflow-x: auto; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-weight: 600; color: var(--text-3); font-size: 13px; padding: 8px 12px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: 12px; border-bottom: 1px solid var(--border); vertical-align: middle; min-width: 0; }
.table tr:last-child td { border-bottom: 0; }
.table td.num, .table th.num { text-align: right; }
.table .actions { text-align: right; white-space: nowrap; }
.cell-title { font-weight: 600; }
.cell-sub { color: var(--text-3); font-size: 13px; }

/* ---- tabs --------------------------------------------------------------- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; overflow-x: auto; }
.tab { border: 0; background: none; color: var(--text-2); font: 600 14px/1 var(--font); padding: 12px 14px; cursor: pointer; border-bottom: 2px solid transparent; white-space: nowrap; min-height: var(--tap); }
.tab[aria-selected="true"] { color: var(--text); border-bottom-color: var(--accent); }
.tab:hover { color: var(--text); }

/* ---- stat tiles --------------------------------------------------------- */
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius); padding: 16px 18px; min-width: 0; }
.stat-label { color: var(--text-3); font-size: 13px; font-weight: 600; }
.stat-value { font: 700 30px/1.15 var(--font); font-stretch: 115%; margin-top: 4px; }
.stat-sub { color: var(--text-3); font-size: 13px; margin-top: 2px; }
.stat-warn .stat-value { color: var(--warn); }

/* ---- checklist ---------------------------------------------------------- */
.checklist { list-style: none; margin: 0; padding: 0; }
.checklist li { display: flex; gap: 12px; align-items: center; padding: 10px 0; border-bottom: 1px solid var(--border); }
.checklist li:last-child { border-bottom: 0; }
.checklist .tick { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border-strong); flex: none; position: relative; }
.checklist .done .tick { border-color: var(--ok); background: var(--ok); }
.checklist .done .tick::after { content: ''; position: absolute; left: 6px; top: 2px; width: 6px; height: 11px; border-right: 2px solid var(--on-accent); border-bottom: 2px solid var(--on-accent); transform: rotate(45deg); }
.checklist .done .label { color: var(--text-3); text-decoration: line-through; }
.checklist .label { flex: 1; min-width: 0; }

/* ---- timeline ----------------------------------------------------------- */
.timeline { list-style: none; margin: 0; padding: 0; display: flex; gap: 0; }
.timeline li { flex: 1; position: relative; padding-top: 28px; text-align: center; color: var(--text-3); font-size: 14px; }
.timeline li::before { content: ''; position: absolute; top: 6px; left: 50%; width: 14px; height: 14px; margin-left: -7px; border-radius: 50%; border: 2px solid var(--border-strong); background: var(--surface); z-index: 1; }
.timeline li::after { content: ''; position: absolute; top: 12px; left: -50%; width: 100%; border-top: 2px solid var(--border-strong); }
.timeline li:first-child::after { display: none; }
.timeline li.done { color: var(--text); font-weight: 600; }
.timeline li.done::before { background: var(--ok); border-color: var(--ok); }
.timeline li.done::after { border-color: var(--ok); }

/* ---- recovery codes ----------------------------------------------------- */
.codes { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 16px; padding: 16px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius); font: 500 15px/1.6 var(--mono); margin: 0 0 16px; list-style: none; }
.codes li { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.qr { width: 176px; height: 176px; background: #FFFFFF; padding: 4px; border-radius: var(--radius-sm); border: 1px solid var(--border); flex: none; display: block; }
.totp-row { display: flex; gap: 20px; align-items: flex-start; flex-wrap: wrap; margin-bottom: 16px; }
.totp-row > div { flex: 1; min-width: 200px; }

/* ---- choice cards ------------------------------------------------------- */
.choice { display: block; width: 100%; text-align: left; background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius); padding: 16px; cursor: pointer; color: var(--text); font: inherit; }
.choice:hover { border-color: var(--accent); }
.choice[aria-pressed="true"] { border-color: var(--accent); box-shadow: inset 0 0 0 1px var(--accent); }
.choice h3 { margin-bottom: 4px; }
.choice p { margin: 0; color: var(--text-3); font-size: 14px; }

/* ---- auth layout -------------------------------------------------------- */
.auth { min-height: 100vh; display: flex; flex-direction: column; align-items: center; padding: 32px 16px; }
.auth-top { width: 100%; max-width: 440px; display: flex; justify-content: space-between; align-items: center; margin-bottom: 24px; }
.auth-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--border); border-radius: 14px; padding: 28px; box-shadow: var(--shadow); }
.auth-card.wide { max-width: 600px; }
.auth-top.wide { max-width: 600px; }
.auth-card h1 { font-size: 24px; margin-bottom: 8px; }
.auth-card .lead { color: var(--text-2); margin-bottom: 20px; }
.auth-foot { margin-top: 20px; color: var(--text-3); font-size: 14px; text-align: center; }
.auth-legal { margin-top: auto; padding-top: 32px; color: var(--text-3); font-size: 13px; text-align: center; }

/* ---- app shell ---------------------------------------------------------- */
.app { min-height: 100vh; }
.sidenav {
  position: fixed; inset: 0 auto 0 0; width: var(--nav-w); background: var(--surface); border-right: 1px solid var(--border);
  display: flex; flex-direction: column; z-index: 30; overflow-y: auto;
}
.sidenav-head { padding: 18px 16px 12px; display: flex; align-items: center; justify-content: space-between; }
.sidenav .close-nav { display: none; }
.org-switch { margin: 0 12px 8px; position: relative; }
.org-switch > button {
  width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 8px; text-align: left;
  min-height: 52px; padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); background: var(--surface-2); color: var(--text); font: inherit; cursor: pointer;
}
.org-switch > button:hover { background: var(--hover); }
.org-switch .org-name { font-weight: 700; display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.org-switch .org-role { font-size: 12px; color: var(--text-3); display: block; }
.org-switch .org-text { min-width: 0; }
.org-menu { position: absolute; left: 0; right: 0; top: calc(100% + 4px); background: var(--surface); border: 1px solid var(--border-strong); border-radius: var(--radius-sm); box-shadow: var(--shadow); z-index: 5; padding: 4px; list-style: none; margin: 0; }
.org-menu a { display: block; padding: 8px 10px; border-radius: 4px; color: var(--text); text-decoration: none; }
.org-menu a:hover, .org-menu a[aria-current="true"] { background: var(--hover); }
.nav-group { padding: 8px 12px; }
.nav-group + .nav-group { border-top: 1px solid var(--border); }
.nav-title { font-size: 12px; font-weight: 700; color: var(--text-3); text-transform: uppercase; letter-spacing: .06em; padding: 6px 10px; }
.nav-link { display: flex; align-items: center; justify-content: space-between; gap: 8px; min-height: 40px; padding: 0 10px; border-radius: var(--radius-sm); color: var(--text-2); text-decoration: none; font-weight: 600; }
.nav-link:hover { background: var(--hover); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--accent-soft); color: var(--text); box-shadow: inset 3px 0 0 var(--accent); }
.sidenav-foot { margin-top: auto; padding: 12px 16px; border-top: 1px solid var(--border); display: flex; align-items: center; gap: 8px; }
.user-chip { flex: 1; min-width: 0; }
.user-chip .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.user-chip .email { font-size: 12px; color: var(--text-3); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.topbar { display: none; }
.main { margin-left: var(--nav-w); padding: 28px 32px 48px; max-width: calc(var(--nav-w) + 1180px); min-width: 0; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 20px; }
.page-head h1 { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.page-head .sub { color: var(--text-3); margin: 6px 0 0; }
.crumbs { font-size: 14px; color: var(--text-3); margin-bottom: 8px; }
.crumbs a { color: var(--text-3); }
.ribbon { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 16px; }
.ribbon-test { background: var(--warn-soft); color: var(--warn); border: 1px dashed var(--warn); border-radius: var(--radius-sm); padding: 6px 12px; font: 700 13px/1.3 var(--mono); letter-spacing: .04em; }
.ribbon-dev { background: transparent; color: var(--signal-text); border: 1px dashed var(--signal); border-radius: var(--radius-sm); padding: 6px 12px; font: 600 13px/1.3 var(--mono); }
.scrim { position: fixed; inset: 0; background: var(--scrim); z-index: 25; }

/* ---- drawer & modal ----------------------------------------------------- */
dialog { border: 0; padding: 0; background: transparent; color: var(--text); max-width: 100vw; max-height: 100vh; }
dialog::backdrop { background: var(--scrim); }
.modal { width: min(520px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--border); border-radius: 14px; box-shadow: var(--shadow); }
.drawer { position: fixed; inset: 0 0 0 auto; margin: 0 0 0 auto; height: 100vh; width: min(440px, 100vw); background: var(--surface); border-left: 1px solid var(--border); box-shadow: var(--shadow); }
.dlg-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.dlg-body { padding: 20px; overflow-y: auto; }
.drawer .dlg-body { height: calc(100vh - 140px); }
.dlg-foot { display: flex; justify-content: flex-end; gap: 8px; padding: 16px 20px; border-top: 1px solid var(--border); flex-wrap: wrap; }

/* ---- toast -------------------------------------------------------------- */
.toasts { position: fixed; right: 16px; bottom: 16px; z-index: 60; display: flex; flex-direction: column; gap: 8px; max-width: calc(100vw - 32px); }
.toast { background: var(--text); color: var(--bg); padding: 12px 16px; border-radius: var(--radius-sm); box-shadow: var(--shadow); font-weight: 600; max-width: 380px; }
.toast-error { background: var(--danger); color: var(--on-danger); }

/* ---- product columns (buy) ---------------------------------------------- */
.product-col h2 { display: flex; align-items: center; gap: 10px; margin-bottom: 4px; }
.sku { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 14px 0; border-top: 1px solid var(--border); }
.sku:first-of-type { border-top: 0; }
.sku-name { font-weight: 700; }
.sku-price { font: 700 20px/1.2 var(--font); font-stretch: 115%; }
.sku-extra { grid-column: 1 / -1; }
.summary-line { display: flex; justify-content: space-between; gap: 12px; padding: 6px 0; }
.summary-total { border-top: 1px solid var(--border); margin-top: 8px; padding-top: 12px; font-weight: 700; font-size: 18px; }
.unavailable .sku-price { color: var(--text-2); }

/* ---- downloads ---------------------------------------------------------- */
.artefact { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 8px 16px; align-items: center; padding: 12px 0; border-top: 1px solid var(--border); }
.artefact:first-child { border-top: 0; }
details.older summary { cursor: pointer; font-weight: 600; padding: 8px 0; }
ol.howto { padding-left: 20px; margin: 0; }
ol.howto li { margin-bottom: 8px; }

/* ---- fleet placeholder -------------------------------------------------- */
.placeholder { border: 2px dashed var(--border-strong); background: transparent; }
.ghost-tiles .stat { border-style: dashed; background: transparent; }

/* ---- dev mail (server-rendered) ----------------------------------------- */
.devmail-head { display: flex; align-items: center; gap: 12px; padding: 16px; border-bottom: 1px solid var(--border); background: var(--surface); }
.devmail-main { max-width: 860px; margin: 0 auto; padding: 24px 16px 48px; }
.devmail-main h1 { margin-bottom: 8px; }
.mail-item { margin-top: 16px; }
.mail-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.mail-subject { font-size: 16px; min-width: 0; overflow-wrap: anywhere; }
.mail-body { margin: 12px 0 0; padding: 12px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius-sm); font: 400 13px/1.5 var(--mono); white-space: pre-wrap; overflow-wrap: anywhere; }

/* ---- responsive --------------------------------------------------------- */
@media (max-width: 1180px) {
  .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 960px) {
  .sidenav { transform: translateX(-100%); transition: transform .2s; width: min(300px, 86vw); box-shadow: var(--shadow); visibility: hidden; }
  .nav-open .sidenav { transform: none; visibility: visible; }
  .sidenav .close-nav { display: inline-flex; }
  .topbar {
    display: flex; position: sticky; top: 0; z-index: 20; align-items: center; justify-content: space-between; gap: 8px;
    height: 56px; padding: 0 8px; background: var(--surface); border-bottom: 1px solid var(--border);
  }
  .topbar .brand { flex: 1; min-width: 0; }
  .main { margin-left: 0; padding: 20px 16px 40px; }
  .grid-2 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 640px) {
  h1 { font-size: 22px; }
  .grid-3, .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
  .grid-3.stack-sm { grid-template-columns: minmax(0, 1fr); }
  .card { padding: 16px; }
  .form-row { grid-template-columns: minmax(0, 1fr); }
  .stat-value { font-size: 24px; }
  .auth { padding: 16px; }
  .auth-card { padding: 20px 16px; }
  .codes { grid-template-columns: minmax(0, 1fr); }
  .timeline li { font-size: 12px; }
  /* tables become stacked cards */
  .table, .table tbody, .table tr, .table td { display: block; width: 100%; }
  .table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .table tr { border: 1px solid var(--border); border-radius: var(--radius); padding: 8px 12px; margin-bottom: 10px; background: var(--surface); }
  .table td { border: 0; padding: 6px 0; display: grid; grid-template-columns: 112px minmax(0, 1fr); gap: 10px; align-items: center; overflow-wrap: anywhere; }
  .table td::before { content: attr(data-label); color: var(--text-3); font-size: 12px; font-weight: 600; }
  .table td.num, .table .actions { text-align: left; white-space: normal; }
  .table td.actions { display: flex; flex-wrap: wrap; gap: 8px; }
  .table td.actions::before { display: none; }
  .table td[data-label=""] { grid-template-columns: minmax(0, 1fr); }
  .table td[data-label=""]::before { display: none; }
  .table-wrap { overflow-x: visible; }
  .drawer { width: 100vw; }
  .page-head .btn-row { width: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* ---- page-specific ------------------------------------------------------ */
a.site-card { display: block; color: var(--text); text-decoration: none; }
a.site-card:hover { border-color: var(--accent); }
a.site-card h2 { overflow-wrap: anywhere; }
.buy-grid { grid-template-columns: minmax(0, 1fr) 340px; align-items: start; }
.buy-summary { position: sticky; top: 16px; }
.buy-summary h2 { margin-bottom: 8px; }
.buy-summary .btn { margin: 16px 0 12px; }
.subhead { margin: 20px 0 8px; }
.settings-actions { margin-top: 16px; }
.danger-zone { border-color: var(--danger); }
.danger-row { display: flex; justify-content: space-between; align-items: center; gap: 16px; padding: 12px 0; border-top: 1px solid var(--border); flex-wrap: wrap; }
.danger-row:first-of-type { border-top: 0; }
.danger-row p { margin: 4px 0 0; }
.audit-filters { margin-bottom: 4px; }
fieldset.field { border: 0; padding: 0; margin: 0 0 16px; }
fieldset.field .check { margin-bottom: 8px; }
@media (max-width: 960px) {
  .buy-grid { grid-template-columns: minmax(0, 1fr); }
  .buy-summary { position: static; }
}

/* ---- layout fixes ------------------------------------------------------- */
.grid > .card + .card, .grid > .stack + .card { margin-top: 0; }
.stepper { justify-self: start; }
.stepper button:disabled { opacity: .45; cursor: not-allowed; }
@media (min-width: 961px) {
  /* the nav column keeps its ground below the fold */
  .app { background: linear-gradient(to right, var(--surface) calc(var(--nav-w) - 1px), var(--border) calc(var(--nav-w) - 1px), var(--border) var(--nav-w), transparent var(--nav-w)); }
}
.table select.input { min-width: 180px; }
.policy { margin: 0 0 12px; padding-left: 20px; }
.policy li { margin-bottom: 4px; }
.dlg-head h2 { min-width: 0; overflow-wrap: anywhere; }
.modal { max-width: calc(100vw - 32px); }
.dlg-body { overflow-wrap: anywhere; }
