/* ==========================================================================
   AI Safety and Governance — front end stylesheet. Phone-first (§2.8).
   Edition tokens set by `html[data-edition]` (frontend/js/app.js and
   opening.js write the attribute from /api/brand `edition`, default AU).
   Each edition carries exactly three colours: --edition-primary,
   --edition-secondary, --edition-accent, which the AU/default dark theme
   below maps onto the working --accent/--accent-2/--bg family. Desktop
   overrides mid-file; hard phone overrides at the very end (§2.8, §10.14).
   ========================================================================== */

:root {
  /* -------- edition colours (default: AU) --------
     The Australian flag, matured: formal navy, pearl white, deep claret. */
  --edition-primary: #0b1b3f;    /* AU formal navy */
  --edition-secondary: #e9e4d8;  /* AU pearl white (the stars) */
  --edition-accent: #8e1b2e;     /* AU deep claret */

  /* Light ground (no data-theme, light OS scheme): ivory paper, navy ink. */
  --bg: #f3f1ea;
  --bg-elevated: #fbfaf6;
  --bg-sunken: #e9e6dc;
  --border: #d9d4c6;
  --border-strong: #bfb8a6;
  --text: #0b1b3f;
  --text-muted: #46506e;
  --text-faint: #5f6884;
  --accent: #0b1b3f;
  --accent-strong: #06122b;
  --accent-2: #8e1b2e;
  --accent-soft: rgba(11, 27, 63, 0.08);
  --accent-contrast: #f5f1e8;
  --danger: #8e1b2e;
  --danger-rgb: 142, 27, 46; --claret-rgb: 142, 27, 46;
  --danger-soft: rgba(142, 27, 46, 0.10);
  --amber: #8a5a10;
  --amber-soft: rgba(138, 90, 16, 0.12);
  --neutral-chip: #e9e6dc;
  --panel: rgba(251, 250, 246, 0.72);
  --grid-line: rgba(11, 27, 63, 0.04);
  --glow-rgb: 11, 27, 63;
  --shadow-sm: 0 1px 2px rgba(11, 27, 63, 0.06);
  --shadow-md: 0 4px 18px rgba(11, 27, 63, 0.08);
  --shadow-lg: 0 14px 36px rgba(11, 27, 63, 0.14);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;
  --sidebar-w: 260px;
  --topbar-h: 60px;
  --tabbar-h: 60px;
  --font-mono: ui-monospace, "SF Mono", "Menlo", "Consolas", monospace;
  /* headings and the wordmark: a dignified system serif, no download */
  --font-display: "Iowan Old Style", "Palatino Linotype", Palatino, "Book Antiqua", Georgia, "Times New Roman", serif;
}

/* Light theme: ivory paper, navy ink, claret accents (AU default). */
:root[data-theme="light"] {
  --bg: #f3f1ea; --bg-elevated: #fbfaf6; --bg-sunken: #e9e6dc;
  --border: #d9d4c6; --border-strong: #bfb8a6;
  --text: #0b1b3f; --text-muted: #46506e; --text-faint: #5f6884;
  --accent: #0b1b3f; --accent-strong: #06122b; --accent-2: #8e1b2e;
  --accent-soft: rgba(11, 27, 63, 0.08); --accent-contrast: #f5f1e8;
  --danger: #8e1b2e; --danger-rgb: 142, 27, 46; --claret-rgb: 142, 27, 46; --danger-soft: rgba(142, 27, 46, 0.10);
  --amber: #8a5a10; --amber-soft: rgba(138, 90, 16, 0.12);
  --neutral-chip: #e9e6dc; --panel: rgba(251, 250, 246, 0.72);
  --grid-line: rgba(11, 27, 63, 0.04); --glow-rgb: 11, 27, 63;
  --shadow-sm: 0 1px 2px rgba(11, 27, 63, 0.06);
  --shadow-md: 0 4px 18px rgba(11, 27, 63, 0.08);
  --shadow-lg: 0 14px 36px rgba(11, 27, 63, 0.14);
}

/* Dark theme (default): formal navy ground, ivory ink, champagne hairlines,
   claret as the one fill colour. The same table lives in kits.css for the
   AU edition; this is what paints before the edition attribute is written. */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #071531; --bg-elevated: #0d1f47; --bg-sunken: #040c20;
    --border: #1b2d58; --border-strong: #2b4179;
    --text: #f1ede4; --text-muted: #b4bdd3; --text-faint: #8b96b4;
    --accent: #d6cbb0; --accent-strong: #ece5d2; --accent-2: #8e1b2e;
    --accent-soft: rgba(214, 203, 176, 0.10); --accent-contrast: #f5f1e8;
    --danger: #e8586b; --danger-rgb: 232, 88, 107; --claret-rgb: 142, 27, 46; --danger-soft: rgba(232, 88, 107, 0.12);
    --amber: #d8b46e; --amber-soft: rgba(216, 180, 110, 0.12);
    --neutral-chip: #132650; --panel: rgba(13, 31, 71, 0.62);
    --grid-line: rgba(214, 203, 176, 0.0); --glow-rgb: 52, 84, 160;
    --shadow-sm: 0 1px 2px rgba(2, 8, 30, 0.4);
    --shadow-md: 0 6px 22px rgba(2, 8, 30, 0.45);
    --shadow-lg: 0 16px 40px rgba(2, 8, 30, 0.55);
  }
}
:root[data-theme="dark"] {
  --bg: #071531; --bg-elevated: #0d1f47; --bg-sunken: #040c20;
  --border: #1b2d58; --border-strong: #2b4179;
  --text: #f1ede4; --text-muted: #b4bdd3; --text-faint: #8b96b4;
  --accent: #d6cbb0; --accent-strong: #ece5d2; --accent-2: #8e1b2e;
  --accent-soft: rgba(214, 203, 176, 0.10); --accent-contrast: #f5f1e8;
  --danger: #e8586b; --danger-rgb: 232, 88, 107; --claret-rgb: 142, 27, 46; --danger-soft: rgba(232, 88, 107, 0.12);
  --amber: #d8b46e; --amber-soft: rgba(216, 180, 110, 0.12);
  --neutral-chip: #132650; --panel: rgba(13, 31, 71, 0.62);
  --grid-line: rgba(214, 203, 176, 0.0); --glow-rgb: 52, 84, 160;
  --shadow-sm: 0 1px 2px rgba(2, 8, 30, 0.4);
  --shadow-md: 0 6px 22px rgba(2, 8, 30, 0.45);
  --shadow-lg: 0 16px 40px rgba(2, 8, 30, 0.55);
}

/* ---------- per-edition token overrides (dark) ----------
   Three colours each: --edition-primary / --edition-secondary /
   --edition-accent. AU/NZ additionally flag --edition-southern-cross:1
   so the constellation motif knows to render (§ Southern Cross). */
html[data-edition="AU"] { --edition-primary: #0b1b3f; --edition-secondary: #e9e4d8; --edition-accent: #8e1b2e; --edition-southern-cross: 1; }
html[data-edition="US"] {
  --edition-primary: #0a3161; --edition-secondary: #b31942; --edition-accent: #ffffff;
}
html[data-edition="US"]:not([data-theme="light"]) {
  --accent: #b31942; --accent-strong: #d94868; --accent-2: #0a3161;
  --accent-soft: rgba(179, 25, 66, 0.14); --accent-contrast: #ffffff; --glow-rgb: 179, 25, 66;
}
html[data-edition="GB"] { --edition-primary: #012169; --edition-secondary: #c8102e; --edition-accent: #ffffff; }
html[data-edition="GB"]:not([data-theme="light"]) {
  --accent: #c8102e; --accent-strong: #e2465c; --accent-2: #012169;
  --accent-soft: rgba(200, 16, 46, 0.14); --accent-contrast: #ffffff; --glow-rgb: 200, 16, 46;
}
html[data-edition="CA"] { --edition-primary: #d80621; --edition-secondary: #ffffff; --edition-accent: #2b2b2b; }
html[data-edition="CA"]:not([data-theme="light"]) {
  --accent: #d80621; --accent-strong: #f0475e; --accent-2: #8a8a8a;
  --accent-soft: rgba(216, 6, 33, 0.14); --accent-contrast: #ffffff; --glow-rgb: 216, 6, 33;
}
html[data-edition="NZ"] {
  --edition-primary: #0a0a0a; --edition-secondary: #ffffff; --edition-accent: #c8102e;
  --edition-southern-cross: 1;
}
html[data-edition="NZ"]:not([data-theme="light"]) {
  --accent: #c0c5c1; --accent-strong: #e6e9e7; --accent-2: #c8102e;
  --accent-soft: rgba(192, 197, 193, 0.14); --accent-contrast: #0a0a0a; --glow-rgb: 192, 197, 193;
}
html[data-edition="TR"] { --edition-primary: #e30a17; --edition-secondary: #ffffff; --edition-accent: #7a0610; }
html[data-edition="TR"]:not([data-theme="light"]) {
  --accent: #e30a17; --accent-strong: #f24a54; --accent-2: #7a0610;
  --accent-soft: rgba(227, 10, 23, 0.14); --accent-contrast: #ffffff; --glow-rgb: 227, 10, 23;
}
html[data-edition="FR"] { --edition-primary: #0055a4; --edition-secondary: #ffffff; --edition-accent: #ef4135; }
html[data-edition="FR"]:not([data-theme="light"]) {
  --accent: #0055a4; --accent-strong: #3f83c9; --accent-2: #ef4135;
  --accent-soft: rgba(0, 85, 164, 0.14); --accent-contrast: #ffffff; --glow-rgb: 0, 85, 164;
}
html[data-edition="DE"] { --edition-primary: #0a0a0a; --edition-secondary: #dd0000; --edition-accent: #ffce00; }
html[data-edition="DE"]:not([data-theme="light"]) {
  --accent: #ffce00; --accent-strong: #ffe066; --accent-2: #dd0000;
  --accent-soft: rgba(255, 206, 0, 0.14); --accent-contrast: #241a04; --glow-rgb: 255, 206, 0;
}
html[data-edition="SA"] { --edition-primary: #006c35; --edition-secondary: #ffffff; --edition-accent: #073b3a; }
html[data-edition="SA"]:not([data-theme="light"]) {
  --accent: #16a05c; --accent-strong: #4fce8c; --accent-2: #073b3a;
  --accent-soft: rgba(22, 160, 92, 0.14); --accent-contrast: #ffffff; --glow-rgb: 22, 160, 92;
}
html[data-edition="AE"] { --edition-primary: #ef3340; --edition-secondary: #009739; --edition-accent: #0a0a0a; }
html[data-edition="AE"]:not([data-theme="light"]) {
  --accent: #ef3340; --accent-strong: #f56a74; --accent-2: #009739;
  --accent-soft: rgba(239, 51, 64, 0.14); --accent-contrast: #ffffff; --glow-rgb: 239, 51, 64;
}
html[data-edition="SG"] { --edition-primary: #ef3340; --edition-secondary: #ffffff; --edition-accent: #3a3f42; }
html[data-edition="SG"]:not([data-theme="light"]) {
  --accent: #ef3340; --accent-strong: #f56a74; --accent-2: #7d868b;
  --accent-soft: rgba(239, 51, 64, 0.14); --accent-contrast: #ffffff; --glow-rgb: 239, 51, 64;
}
html[data-edition="JP"] { --edition-primary: #bc002d; --edition-secondary: #ffffff; --edition-accent: #1a1a1a; }
html[data-edition="JP"]:not([data-theme="light"]) {
  --accent: #bc002d; --accent-strong: #dd4763; --accent-2: #6b6b6b;
  --accent-soft: rgba(188, 0, 45, 0.14); --accent-contrast: #ffffff; --glow-rgb: 188, 0, 45;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0; background: var(--bg); color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px; line-height: 1.5; -webkit-font-smoothing: antialiased;
  background:
    radial-gradient(1100px 560px at 100% -10%, rgba(var(--glow-rgb), 0.10), transparent 60%),
    radial-gradient(900px 520px at -10% 110%, rgba(var(--claret-rgb, 142, 27, 46), 0.05), transparent 60%),
    linear-gradient(var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px,
    linear-gradient(90deg, var(--grid-line) 1px, transparent 1px) 0 0 / 32px 32px,
    var(--bg);
  background-attachment: fixed;
  overflow-x: hidden;
}
button, input, select, textarea { font-family: inherit; font-size: inherit; color: inherit; }
a { color: var(--accent); }
.sr-only { position: absolute; 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(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.app { height: 100dvh; max-width: 100vw; }

/* ---------- opening (§10.0) ---------- */

.opening-screen {
  position: fixed; inset: 0; z-index: 90; background: var(--bg);
  display: flex; align-items: center; justify-content: center; flex-direction: column;
  gap: 22px; padding: 24px calc(16px + env(safe-area-inset-right)) calc(24px + env(safe-area-inset-bottom)) calc(16px + env(safe-area-inset-left));
  text-align: center;
}
.opening-shield { width: 56px; height: 56px; object-fit: contain; }
.opening-tap-label { font-size: 15px; font-weight: 700; color: var(--text-muted); letter-spacing: 0.02em; }
.opening-enter-btn { min-height: 48px; min-width: 160px; padding: 0 32px; border: 0; border-radius: var(--radius-pill); background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-contrast); font: 700 16px/1 var(--font-mono); letter-spacing: 0.18em; text-transform: uppercase; cursor: pointer; box-shadow: 0 0 0 1px rgba(var(--glow-rgb), .35), 0 8px 28px rgba(var(--glow-rgb), .28); }
.opening-enter-btn:focus-visible { outline: 2px solid var(--accent-strong); outline-offset: 4px; }
.opening-mute-btn { min-height: 44px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--border); background: transparent; color: var(--text-faint); font-size: 12px; cursor: pointer; }
.opening-wordmark { font-family: var(--font-display); font-size: clamp(22px, 6vw, 34px); font-weight: 500; letter-spacing: 0.02em; min-height: 1.4em; }
.opening-wordmark .brand-word-ink { color: var(--text); }
.opening-wordmark .brand-word-accent { color: var(--accent); }
.opening-chip { display: inline-flex; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-strong); font-size: 11px; font-weight: 700; align-items: center; }
.opening-loader-track { width: min(320px, 80vw); height: 4px; border-radius: var(--radius-pill); background: var(--bg-sunken); overflow: hidden; }
.opening-loader-fill { height: 100%; width: 0%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); transition: width 0.25s ease; }
.opening-status-lines { list-style: none; margin: 0; padding: 0; font-family: var(--font-mono); font-size: 11.5px; color: var(--text-faint); min-height: 60px; display: flex; flex-direction: column; gap: 4px; }
.opening-status-lines { min-width: min(340px, 86vw); }
.opening-status-lines li { display: flex; gap: 10px; align-items: baseline; opacity: 0; transform: translateY(3px); transition: opacity .25s ease, transform .25s ease; }
.opening-status-lines li.shown { opacity: 1; transform: none; }
.opening-status-lines li .mark { width: 1.2em; flex: none; text-align: center; }
.opening-status-lines li .label { color: var(--text-muted); }
.opening-status-lines li .detail { margin-left: auto; color: var(--text-faint); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 46%; }
.opening-status-lines li.pending .mark::before { content: "…"; color: var(--text-faint); }
.opening-status-lines li.ok .mark::before { content: "✓"; color: var(--accent); }
.opening-status-lines li.fail .mark::before { content: "✗"; color: var(--danger); }
.opening-status-lines li.fail .label, .opening-status-lines li.fail .detail { color: var(--danger); }
.opening-result { display: grid; justify-items: center; gap: 16px; margin-top: 6px; animation: opening-rise .35s ease both; }
.opening-result-text { margin: 0; font: 700 13px/1.4 var(--font-mono); letter-spacing: .14em; text-transform: uppercase; color: var(--accent-strong); text-align: center; }
.opening-result-text.fail { color: var(--danger); }
.opening-result-actions { display: flex; gap: 10px; flex-wrap: wrap; justify-content: center; }
.opening-retry-btn { min-height: 48px; padding: 0 20px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: transparent; color: var(--text-muted); font: 600 13px/1 var(--font-mono); cursor: pointer; }
@keyframes opening-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@media (prefers-reduced-motion: reduce) { .opening-status-lines li { transition: none; } .opening-result { animation: none; } }
.opening-controls { display: flex; gap: 10px; }

/* ---------- generic buttons / switches ---------- */

.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 18px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--bg-elevated); cursor: pointer; font-weight: 600; transition: background .15s ease, border-color .15s ease, transform .05s ease; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; }
.btn-block { width: 100%; }
.btn-primary { background: linear-gradient(135deg, var(--accent), var(--accent-2)); border-color: var(--accent); color: var(--accent-contrast); box-shadow: 0 0 0 1px rgba(var(--glow-rgb),.35), 0 6px 22px rgba(var(--glow-rgb),.22); }
.btn-primary:disabled { background: var(--border-strong); box-shadow: none; color: var(--text-muted); }
.btn-secondary { background: var(--bg-sunken); border-color: var(--border); color: var(--text); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.icon-btn { display: inline-flex; align-items: center; justify-content: center; width: 44px; height: 44px; border-radius: var(--radius-pill); border: none; background: transparent; color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--bg-sunken); }
.icon-btn-sm { width: 32px; height: 32px; min-width: 44px; min-height: 44px; }

.switch { position: relative; width: 42px; height: 26px; min-width: 44px; min-height: 44px; padding: 0; border: none; background: transparent; cursor: pointer; display: inline-flex; align-items: center; justify-content: center; }
.switch::before { content: ""; position: absolute; width: 42px; height: 24px; border-radius: var(--radius-pill); background: var(--border-strong); transition: background .15s ease; }
.switch[aria-checked="true"]::before { background: linear-gradient(90deg, var(--accent), var(--accent-2)); box-shadow: 0 0 14px rgba(var(--glow-rgb), .45); }
.switch-thumb { position: absolute; left: calc(50% - 20px); width: 20px; height: 20px; border-radius: 50%; background: #fff; box-shadow: var(--shadow-sm); transition: transform .15s ease; }
.switch[aria-checked="true"] .switch-thumb { transform: translateX(18px); }
.switch:disabled, .switch[aria-disabled="true"] { cursor: not-allowed; opacity: .6; }
.lock-icon { color: var(--text-muted); }

/* ---------- login ---------- */

.view-login { min-height: 100dvh; display: flex; align-items: center; justify-content: center; padding: 24px 16px calc(24px + env(safe-area-inset-bottom)); }
.login-card { width: 100%; max-width: 420px; background: var(--panel); backdrop-filter: blur(10px) saturate(1.1); border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); padding: 28px 22px; position: relative; }
.login-card::after { content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--glow-rgb), .6), transparent); }
.brand { display: flex; align-items: center; gap: 10px; }
.brand-centered { justify-content: center; margin-bottom: 20px; }
.brand-mark { flex-shrink: 0; filter: drop-shadow(0 0 6px rgba(var(--glow-rgb), .5)); object-fit: contain; }
.brand-word { font-weight: 600; font-size: 20px; letter-spacing: 0.01em; font-family: var(--font-display); }
.brand-word-ink { color: var(--text); }
.brand-word-accent { color: var(--accent); }
.brand-edition { display: inline-flex; height: 20px; padding: 0 8px; margin-left: 4px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-strong); font-size: 10.5px; font-weight: 700; align-items: center; }
.brand-edition-chip { display: none; height: 20px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-strong); font-size: 10px; font-weight: 700; font-family: var(--font-mono); align-items: center; }
@media (max-width: 899.98px) { .brand-edition-chip:not([hidden]) { display: inline-flex; } }

.login-tabs { display: flex; gap: 4px; background: var(--bg-sunken); border-radius: var(--radius-pill); padding: 4px; margin-bottom: 20px; }
.login-tab { flex: 1; min-height: 40px; border: none; border-radius: var(--radius-pill); background: transparent; cursor: pointer; font-weight: 600; color: var(--text-muted); }
.login-tab.is-active { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-sm); }
.login-panel { display: flex; flex-direction: column; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-muted); margin: 12px 0 6px; }
.field-label:first-child { margin-top: 0; }
.field-input { min-height: 44px; padding: 0 14px; border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--bg); color: var(--text); width: 100%; }
.field-input:focus { border-color: var(--accent); }
.login-panel .btn-primary { margin-top: 18px; }
.form-error { color: var(--danger); font-size: 12.5px; margin: 8px 0 0; min-height: 1em; }
.nda-block { margin-top: 16px; }
.nda-title { font-weight: 700; font-size: 14px; margin: 0 0 8px; }
.nda-box { max-height: 160px; overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-sunken); padding: 12px 14px; font-size: 12.5px; color: var(--text-muted); white-space: pre-wrap; }
.nda-check { display: flex; align-items: flex-start; gap: 10px; margin-top: 12px; font-size: 13px; cursor: pointer; min-height: 44px; }
.nda-check input { width: 20px; height: 20px; margin-top: 2px; flex-shrink: 0; }
.app-footer { text-align: center; font-size: 10.5px; color: var(--text-faint); margin: 14px 0 0; }
.core-down-banner { margin: 0 0 14px; padding: 10px 12px; border-radius: var(--radius-md); background: var(--danger-soft); color: var(--danger); font-size: 12.5px; font-weight: 600; text-align: center; }

/* ---------- shell / layout ---------- */

.shell { height: 100dvh; display: flex; overflow: hidden; }
/* Both sidebars are positioned by the panel grammar in css/side-panel.css
   (left: rooms and account; right: new chat, search and history). */
.history-group-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--text-faint); padding: 10px 8px 4px; }
.history-item { display: block; width: 100%; text-align: left; min-height: 40px; padding: 8px 10px; border: none; background: transparent; border-radius: var(--radius-sm); color: var(--text); cursor: pointer; font-size: 13.5px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.history-item:hover, .history-item.is-active { background: var(--bg-sunken); }
.sidebar-nav { display: flex; flex-direction: column; gap: 2px; padding: 6px 8px; border-top: 1px solid var(--border); }
.nav-item { display: flex; align-items: center; gap: 10px; min-height: 44px; padding: 8px 10px; border-radius: var(--radius-sm); color: var(--text); text-decoration: none; font-size: 14px; font-weight: 500; }
.nav-item:hover { background: var(--bg-sunken); }
.nav-item.is-active { background: linear-gradient(90deg, rgba(var(--glow-rgb), .16), rgba(var(--glow-rgb), .02)); color: var(--accent-strong); box-shadow: inset 2px 0 0 var(--accent); }
.nav-item svg { flex-shrink: 0; }
.sidebar-user { border-top: 1px solid var(--border); padding: 8px; position: relative; }
.user-row { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 44px; padding: 6px 8px; border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.user-row:hover { background: var(--bg-sunken); }
.avatar { width: 30px; height: 30px; border-radius: 50%; background: var(--accent); color: var(--accent-contrast); display: flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 700; flex-shrink: 0; }
.user-name { flex: 1; text-align: left; font-size: 13.5px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 10px; color: var(--text-faint); text-transform: uppercase; }
.user-menu { position: absolute; bottom: 62px; left: 8px; right: 8px; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 10px; z-index: 45; }
.user-menu-section { margin-bottom: 8px; }
.user-menu-label { font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); display: block; margin-bottom: 6px; }
.theme-switch { display: flex; gap: 4px; background: var(--bg-sunken); border-radius: var(--radius-pill); padding: 3px; }
.theme-opt { flex: 1; min-height: 34px; border: none; border-radius: var(--radius-pill); background: transparent; cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.theme-opt.is-active { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-sm); }
.user-menu-item { width: 100%; text-align: left; min-height: 40px; padding: 8px 10px; border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); }
.user-menu-item:hover { background: var(--bg-sunken); }

.main { flex: 1; min-width: 0; display: flex; flex-direction: column; height: 100dvh; }
.topbar { display: flex; align-items: center; gap: 8px; min-height: var(--topbar-h); padding: env(safe-area-inset-top) 10px 0; border-bottom: 1px solid var(--border); flex-wrap: wrap; background: color-mix(in srgb, var(--bg) 72%, transparent); backdrop-filter: blur(10px); }
.topbar-controls { display: flex; align-items: center; gap: 8px; flex: 1; min-width: 0; padding: 8px 0; }
.room-title-mobile { font-weight: 700; font-size: 14px; }
.model-select-wrap { position: relative; display: inline-flex; align-items: center; }
.model-select-btn { appearance: none; display: inline-flex; align-items: center; gap: 6px; min-height: 40px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--bg-sunken); color: var(--text); font-weight: 600; font-size: 12.5px; font-family: var(--font-mono); letter-spacing: .02em; cursor: pointer; }
.model-menu { position: absolute; top: 46px; left: 0; min-width: 260px; max-width: 86vw; background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 6px; z-index: 40; max-height: 60vh; overflow-y: auto; }
.model-menu-section-label { font-size: 10.5px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); padding: 8px 10px 4px; }
.model-menu-item { display: flex; align-items: center; justify-content: space-between; gap: 8px; width: 100%; text-align: left; min-height: 44px; padding: 6px 10px; border: none; background: transparent; border-radius: var(--radius-sm); cursor: pointer; color: var(--text); font-size: 13px; }
.model-menu-item:hover { background: var(--bg-sunken); }
.model-menu-item.is-active { background: var(--accent-soft); color: var(--accent-strong); }
.model-menu-item .mm-note { font-size: 10.5px; color: var(--text-faint); }
.status-pill { display: inline-flex; align-items: center; height: 24px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--neutral-chip); color: var(--text-muted); font-size: 11px; font-weight: 700; font-family: var(--font-mono); letter-spacing: .06em; }
.status-pill-on { background: var(--accent-soft); color: var(--accent-strong); }
.status-pill-off { background: var(--danger-soft); color: var(--danger); }
.print-pdf-btn { display: inline-flex; align-items: center; gap: 6px; min-height: 36px; padding: 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--bg-sunken); color: var(--text); font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; }

.topbar-right { display: flex; align-items: center; gap: 14px; padding: 8px 4px; width: 100%; }
.toggle-group { display: flex; align-items: center; gap: 16px; flex-wrap: wrap; }
.deep-safety-wrap { display: flex; align-items: center; gap: 4px; position: relative; }
.deep-safety-label-txt { font-size: 12.5px; font-weight: 600; color: var(--text-muted); }
.deep-safety-wrap.is-disabled { opacity: .5; }
.info-popover { position: absolute; top: 40px; left: 0; width: min(320px, 84vw); background: var(--bg-elevated); border: 1px solid var(--border); border-radius: var(--radius-md); box-shadow: var(--shadow-lg); padding: 14px; font-size: 12.5px; color: var(--text-muted); z-index: 42; }
.safety-off-strip { padding: 8px 14px; background: var(--amber-soft); color: var(--amber); font-size: 12.5px; font-weight: 600; border-bottom: 1px solid var(--border); }
.byok-notice { padding: 10px 14px; background: var(--amber-soft); color: var(--amber); font-size: 12.5px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 10px; flex-wrap: wrap; }
.kill-banner { padding: 10px 14px; background: var(--danger); color: #fff; font-weight: 700; font-size: 13px; text-align: center; box-shadow: 0 0 26px rgba(255,107,94,.28); }
.core-down-strip { padding: 10px 14px; background: var(--danger-soft); color: var(--danger); font-size: 12.5px; font-weight: 700; text-align: center; border-bottom: 1px solid var(--border); }

.view { flex: 1; min-height: 0; display: none; flex-direction: column; overflow: hidden; }
.view.is-visible { display: flex; }
.view.view-login:not([hidden]) { display: flex; overflow-y: auto; }

.room-header { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 16px 14px 0; flex-wrap: wrap; }
.view-title { font-size: 20px; font-weight: 700; margin: 0 0 4px; }
.view-sub { font-size: 13px; color: var(--text-muted); margin: 0 0 16px; }

/* ---------- chat ---------- */

.chat-scroll { flex: 1; overflow-y: auto; padding: 0 12px; }
.empty-state { height: 40vh; display: flex; align-items: center; justify-content: center; text-align: center; }
.empty-state h1 { font-size: 26px; font-weight: 500; color: var(--text); font-family: var(--font-display); letter-spacing: 0.005em; }
.empty-state.is-hidden { display: none; }
.messages { max-width: 760px; margin: 0 auto; padding: 12px 0 24px; display: flex; flex-direction: column; gap: 22px; }
.msg { display: flex; }
.msg-user { justify-content: flex-end; }
.msg-assistant { justify-content: flex-start; flex-direction: column; align-items: flex-start; }
.msg-assistant-row { display: flex; align-items: flex-start; gap: 10px; width: 100%; }
.orb-mini-wrap { flex-shrink: 0; width: 48px; height: 48px; margin-top: 2px; }
.msg-bubble { max-width: 82%; background: var(--accent-soft); color: var(--text); padding: 10px 16px; border-radius: 18px; border-bottom-right-radius: 6px; white-space: pre-wrap; word-break: break-word; }
.msg-attachments { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; max-width: 82%; justify-content: flex-end; }
.msg-attachment-chip { display: inline-flex; align-items: center; height: 26px; padding: 0 10px; border-radius: var(--radius-pill); background: var(--bg-sunken); color: var(--text-muted); font-size: 11px; }
.msg-assistant-body { width: 100%; color: var(--text); }
.msg-assistant-body p { margin: 0 0 10px; }
.msg-assistant-body p:last-child { margin-bottom: 0; }
.msg-assistant-body ul { margin: 0 0 10px; padding-left: 20px; }
.msg-assistant-body table { border-collapse: collapse; margin: 0 0 10px; width: 100%; font-size: 13px; }
.msg-assistant-body th, .msg-assistant-body td { border: 1px solid var(--border); padding: 6px 8px; text-align: left; }
.msg-assistant-body code { font-family: var(--font-mono); background: var(--bg-sunken); padding: 2px 5px; border-radius: 5px; font-size: .9em; }
.code-block { position: relative; background: var(--bg-sunken); border: 1px solid var(--border); border-radius: var(--radius-md); margin: 0 0 10px; overflow: hidden; }
.code-block pre { margin: 0; padding: 14px; overflow-x: auto; font-family: var(--font-mono); font-size: 12.5px; line-height: 1.5; }
.code-copy-btn { position: absolute; top: 6px; right: 6px; min-width: 44px; min-height: 32px; padding: 0 10px; border-radius: var(--radius-sm); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text-muted); font-size: 11px; cursor: pointer; }
.msg-actions { display: flex; align-items: center; gap: 4px; margin-top: 8px; flex-wrap: wrap; }
.msg-action-btn { display: inline-flex; align-items: center; justify-content: center; width: 34px; height: 34px; min-width: 44px; min-height: 44px; border: none; background: transparent; border-radius: var(--radius-pill); color: var(--text-muted); cursor: pointer; }
.msg-action-btn:hover { background: var(--bg-sunken); color: var(--text); }
.msg-action-btn.is-active { color: var(--accent-strong); background: var(--accent-soft); }

.verdict-chip { display: inline-flex; align-items: center; min-height: 44px; height: 28px; padding: 0 12px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 700; cursor: pointer; border: 1px solid transparent; background: var(--neutral-chip); color: var(--text-muted); }
.verdict-chip.verdict-blocked { background: var(--danger-soft); color: var(--danger); }
.verdict-chip.verdict-deep { background: var(--accent-soft); color: var(--accent-strong); }
.verdict-chip.verdict-corrected { background: var(--amber-soft); color: var(--amber); }
.verdict-chip.verdict-halted { background: var(--danger-soft); color: var(--danger); }
.verdict-panel { margin-top: 8px; padding: 10px 14px; border-radius: var(--radius-md); background: var(--bg-sunken); border: 1px solid var(--border); font-size: 12.5px; color: var(--text-muted); max-width: 82%; }
.verdict-panel dt { font-weight: 700; color: var(--text); margin-top: 6px; }
.verdict-panel dt:first-child { margin-top: 0; }
.verdict-panel dd { margin: 2px 0 0; }
.verdict-panel .vp-part { padding: 6px 0; border-top: 1px dashed var(--border); }
.verdict-panel .vp-part:first-of-type { border-top: none; }

.wrong-btn { font-size: 11px; color: var(--text-faint); background: none; border: none; cursor: pointer; text-decoration: underline; min-height: 44px; }

.composer { padding: 8px 12px calc(10px + env(safe-area-inset-bottom)); border-top: 1px solid var(--border); background: var(--bg); }
.composer-inner { max-width: 760px; margin: 0 auto; display: flex; align-items: flex-end; gap: 6px; background: var(--panel); backdrop-filter: blur(10px) saturate(1.1); border: 1px solid var(--border-strong); border-radius: 26px; padding: 8px 8px 8px 16px; box-shadow: var(--shadow-md); }
.composer-inner:focus-within { border-color: rgba(var(--glow-rgb), .55); box-shadow: 0 0 0 1px rgba(var(--glow-rgb), .3), 0 0 28px rgba(var(--glow-rgb), .14); }
.prompt-input { flex: 1; border: none; background: transparent; resize: none; outline: none; max-height: 160px; min-height: 28px; line-height: 1.5; padding: 8px 0; color: var(--text); width: 100%; }
.prompt-input::placeholder { color: var(--text-faint); }
/* every other field kept the browser's grey placeholder (#757575), 3.6:1 on the navy glass */
input::placeholder, textarea::placeholder { color: var(--text-faint); opacity: 1; }
/* prompt-mic.js wraps the textarea in .prompt-mic-wrap; inside the composer
   flex row the wrap must take over the textarea's own flex role. */
.composer-inner > .prompt-mic-wrap { flex: 1; min-width: 0; display: flex; }
.composer-inner > .prompt-mic-wrap > .prompt-input { flex: 1; }
.composer-icon-btn { width: 40px; height: 40px; min-width: 44px; min-height: 44px; border-radius: 50%; border: none; background: transparent; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; }
.composer-icon-btn:hover { background: var(--bg-sunken); }
.composer-icon-btn.is-active { color: #fff; background: var(--danger); }
.attach-input { display: none; }
.attachment-preview-row { display: flex; flex-wrap: wrap; gap: 6px; max-width: 760px; margin: 0 auto 6px; padding: 0 4px; }
.attachment-chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 8px 0 12px; border-radius: var(--radius-pill); background: var(--bg-sunken); border: 1px solid var(--border); font-size: 11.5px; }
.attachment-chip button { width: 22px; height: 22px; min-width: 22px; min-height: 22px; border: none; background: transparent; color: var(--text-faint); cursor: pointer; border-radius: 50%; }
.send-btn { width: 44px; height: 44px; border-radius: 50%; border: none; background: linear-gradient(135deg, var(--accent), var(--accent-2)); color: var(--accent-contrast); cursor: pointer; display: flex; align-items: center; justify-content: center; flex-shrink: 0; box-shadow: 0 0 0 1px rgba(var(--glow-rgb),.35), 0 6px 22px rgba(var(--glow-rgb),.22); }
.send-btn:disabled { background: var(--border-strong); cursor: not-allowed; box-shadow: none; }
.send-btn.is-stop { background: var(--text); }
.composer-note { text-align: center; font-size: 11px; color: var(--text-faint); max-width: 760px; margin: 8px auto 0; }

/* ---------- voice ---------- */

.voice-stage { flex: 1; overflow-y: auto; display: flex; flex-direction: column; align-items: center; justify-content: flex-start; padding: 26px 16px calc(20px + env(safe-area-inset-bottom)); gap: 14px; text-align: center; }
.orb-frame { width: min(347px, 83vw); height: min(347px, 83vw); min-width: 44px; min-height: 44px; flex-shrink: 0; border: none; background: transparent; padding: 0; margin: 0; cursor: pointer; border-radius: 50%; display: block; }
.orb-frame:focus-visible { outline: 2px solid var(--accent); outline-offset: 6px; }
.orb-frame canvas { width: 100% !important; height: 100% !important; display: block; pointer-events: none; }
.voice-status { font-weight: 700; font-size: 15px; margin: 0; }
.voice-transcript { min-height: 44px; width: 100%; max-width: 480px; font-size: 13.5px; color: var(--text-muted); }
.voice-transcript .vt-line { margin-bottom: 6px; }
.voice-transcript .vt-you { color: var(--text); font-weight: 600; }
.voice-controls { display: flex; align-items: center; gap: 16px; }
.orb-btn { width: 56px; height: 56px; min-width: 44px; min-height: 44px; border-radius: 50%; border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); cursor: pointer; display: flex; align-items: center; justify-content: center; box-shadow: var(--shadow-sm); position: relative; }
.orb-btn-primary { background: var(--accent); border-color: var(--accent); color: var(--accent-contrast); width: 64px; height: 64px; }
.orb-btn-primary.is-active { background: var(--danger); border-color: var(--danger); }
.orb-btn-end { color: var(--danger); }
.voice-keyboard-row { display: flex; gap: 8px; width: 100%; max-width: 480px; }
.voice-keyboard-row input { flex: 1; min-height: 44px; padding: 0 14px; border-radius: var(--radius-pill); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); width: 100%; }
.voice-keyboard-row > .prompt-mic-wrap { flex: 1; min-width: 0; display: flex; }
.voice-keyboard-row > .prompt-mic-wrap > input { flex: 1; }
.voice-verdict { width: 100%; max-width: 480px; }
.voice-footnote { font-size: 11.5px; color: var(--text-faint); margin: 0; }

/* ---------- compare ---------- */

.compare-wrap { flex: 1; overflow-y: auto; padding: 18px 14px 10px; }
.compare-tabs { display: flex; gap: 4px; background: var(--bg-sunken); border-radius: var(--radius-pill); padding: 4px; margin-bottom: 14px; overflow-x: auto; }
.compare-tab { flex: 1; min-height: 40px; border: none; border-radius: var(--radius-pill); background: transparent; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--text-muted); white-space: nowrap; padding: 0 10px; }
.compare-tab.is-active { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-sm); }
.compare-columns { display: flex; flex-direction: column; gap: 14px; }
.compare-col { display: none; flex-direction: column; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel); overflow: hidden; position: relative; }
.compare-col.is-active { display: flex; }
.compare-col-head { padding: 10px 14px; border-bottom: 1px solid var(--border); display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.compare-col-head h2 { margin: 0; font-size: 13.5px; font-weight: 700; }
.compare-col-body { padding: 14px; min-height: 120px; font-size: 13.5px; white-space: pre-wrap; word-break: break-word; }
.compare-col-stats { padding: 8px 14px; border-top: 1px solid var(--border); font-size: 11.5px; color: var(--text-faint); font-family: var(--font-mono); }
.compare-add-model { min-height: 36px; padding: 0 10px; border-radius: var(--radius-pill); border: 1px dashed var(--border-strong); background: transparent; color: var(--text-muted); font-size: 12px; cursor: pointer; }

/* ---------- safety test ---------- */

.safety-test-wrap { flex: 1; overflow-y: auto; padding: 18px 14px calc(20px + env(safe-area-inset-bottom)); }
.st-controls { display: flex; flex-direction: column; gap: 10px; margin-bottom: 16px; }
.st-field { display: flex; flex-direction: column; gap: 6px; }
.st-field label { font-size: 12px; font-weight: 700; color: var(--text-muted); }
.st-field select, .st-field input { min-height: 44px; padding: 0 12px; border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--bg-elevated); color: var(--text); }
.st-field-grow { flex: 1; min-width: 160px; }
.st-progress-wrap { display: flex; align-items: center; gap: 10px; margin-bottom: 16px; }
.st-progress-track { flex: 1; height: 8px; border-radius: var(--radius-pill); background: var(--bg-sunken); overflow: hidden; }
.st-progress-fill { height: 100%; width: 0%; background: var(--accent); transition: width .2s ease; }
.st-progress-label { font-size: 12px; font-weight: 700; color: var(--text-muted); min-width: 34px; text-align: right; }
.st-not-run { padding: 24px 16px; text-align: center; color: var(--text-faint); background: var(--bg-elevated); border: 1px dashed var(--border-strong); border-radius: var(--radius-md); font-size: 13px; }
.st-headline { display: flex; flex-direction: column; align-items: center; gap: 4px; padding: 22px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 16px; }
.st-headline-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.st-headline-value { font-size: 40px; font-weight: 800; color: var(--accent-strong); font-variant-numeric: tabular-nums; }
.st-headline-sub { font-size: 12px; color: var(--text-faint); }
.st-table { width: 100%; border-collapse: collapse; font-size: 12.5px; margin-bottom: 20px; }
.st-table th, .st-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); }
.st-table th { color: var(--text-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; }
.st-escapes-title { font-size: 15px; font-weight: 700; margin: 0 0 4px; }
.st-escapes-note { font-size: 12px; color: var(--text-muted); margin: 0 0 12px; }
.st-escapes-list { display: flex; flex-direction: column; gap: 10px; }
.st-escape-item { padding: 12px 14px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-elevated); font-size: 12.5px; }
.st-escape-item .se-label { font-weight: 700; color: var(--text-muted); font-size: 11px; text-transform: uppercase; margin-top: 6px; display: block; }
.st-not-admin { padding: 12px 14px; border-radius: var(--radius-md); background: var(--bg-sunken); color: var(--text-muted); font-size: 12.5px; }

/* ---------- energy ---------- */

.energy-wrap { flex: 1; overflow-y: auto; padding: 18px 14px calc(20px + env(safe-area-inset-bottom)); }
.energy-headline { padding: 22px 16px; background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 16px; text-align: center; }
.energy-headline-label { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; }
.energy-headline-value { font-size: 34px; font-weight: 800; font-variant-numeric: tabular-nums; }
.energy-headline-value.is-negative { color: var(--danger); }
.energy-headline-value.is-positive { color: var(--accent-strong); }

/* ---------- metrics / audit / governance / media / settings ---------- */

.metrics-wrap, .audit-wrap, .gov-wrap, .media-wrap, .settings-wrap { flex: 1; overflow-y: auto; padding: 18px 14px calc(20px + env(safe-area-inset-bottom)); }
.tile-grid { display: grid; grid-template-columns: 1fr; gap: 10px; margin-bottom: 20px; }
@media (min-width: 560px) { .tile-grid { grid-template-columns: repeat(2, 1fr); } }
.tile { display: flex; flex-direction: column; gap: 2px; padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--panel); position: relative; }
.tile::after { content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--glow-rgb), .6), transparent); }
.tile-label { font-size: 10px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); letter-spacing: .04em; font-family: var(--font-mono); }
.tile-title { font-size: 12.5px; color: var(--text-muted); font-weight: 600; margin-top: 2px; }
.tile-value { font-size: 26px; font-weight: 800; margin-top: 2px; font-variant-numeric: tabular-nums; text-shadow: none; }
.tile-sub { font-size: 11.5px; color: var(--text-faint); }
.tile-link a { font-weight: 600; }
.chart-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel); padding: 14px 16px; margin-bottom: 16px; position: relative; }
.chart-card::after { content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--glow-rgb), .6), transparent); }
.chart-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; gap: 8px; }
.chart-card-head h2 { font-size: 13.5px; font-weight: 700; margin: 0; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 10px; }
.legend-item { display: flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-muted); }
.legend-swatch { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.method-panel { font-size: 12px; color: var(--text-muted); background: var(--bg-sunken); border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 16px; }
.method-panel dt { font-weight: 700; color: var(--text); margin-top: 6px; }
.method-panel dt:first-child { margin-top: 0; }
.method-panel dd { margin: 2px 0 0; }

.audit-ledger-head { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--panel); margin-bottom: 16px; }
.ledger-badge { display: inline-flex; align-items: center; gap: 8px; width: fit-content; padding: 6px 12px; border-radius: var(--radius-pill); background: var(--accent-soft); color: var(--accent-strong); font-weight: 700; font-size: 12.5px; box-shadow: 0 0 0 1px rgba(var(--glow-rgb), .35), 0 0 18px rgba(var(--glow-rgb), .18); }
.ledger-badge.is-broken { background: var(--danger-soft); color: var(--danger); box-shadow: none; }
.ledger-status { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); word-break: break-all; }
.audit-filters { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.audit-filters .st-field select, .audit-filters .st-field input { width: 100%; }
.audit-actions { display: flex; gap: 10px; margin-bottom: 16px; flex-wrap: wrap; }
.audit-table { width: 100%; border-collapse: collapse; font-size: 12px; display: none; }
.audit-table th, .audit-table td { text-align: left; padding: 8px 6px; border-bottom: 1px solid var(--border); white-space: nowrap; }
.audit-table th { color: var(--text-muted); font-weight: 700; font-size: 10.5px; text-transform: uppercase; }
.hash-cell, .cell-mono { font-family: var(--font-mono); font-size: 11px; }
.audit-cards { display: flex; flex-direction: column; gap: 10px; position: relative; padding-left: 14px; }
.audit-cards::before { content: ""; position: absolute; top: 6px; bottom: 6px; left: 4px; width: 2px; background: var(--border-strong); }
.audit-card { position: relative; padding: 10px 12px; border-radius: var(--radius-md); border: 1px solid var(--border); background: var(--bg-elevated); font-size: 12px; cursor: pointer; }
.audit-card::before { content: ""; position: absolute; left: -13px; top: 16px; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); }
.audit-card-row { display: flex; justify-content: space-between; gap: 8px; margin-bottom: 4px; }
.event-chip { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--radius-pill); background: var(--neutral-chip); color: var(--text-muted); font-size: 10.5px; font-weight: 700; text-transform: uppercase; }
.audit-footnote, .empty-note { font-size: 11px; color: var(--text-faint); margin-top: 16px; }
.audit-drawer-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.audit-drawer { width: 100%; max-width: 640px; max-height: 80dvh; overflow-y: auto; background: var(--bg-elevated); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 16px 16px calc(16px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
.audit-drawer-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.audit-drawer-head h2 { margin: 0; font-size: 15px; }
.audit-drawer pre { background: var(--bg-sunken); border-radius: var(--radius-md); padding: 14px; overflow-x: auto; font-family: var(--font-mono); font-size: 11.5px; line-height: 1.6; margin: 0; }

.gov-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel); padding: 16px; margin-bottom: 14px; position: relative; }
.gov-card::after { content: ""; position: absolute; left: 18px; right: 18px; top: -1px; height: 1px; background: linear-gradient(90deg, transparent, rgba(var(--glow-rgb), .6), transparent); }

/* ---------- Southern Cross (AU / NZ editions only) ----------
   Five-star constellation (Alpha, Beta, Gamma, Delta, Epsilon Crucis),
   positioned as on the flag's fly: four seven-pointed stars plus the
   small five-pointed Epsilon. Shown only where --edition-southern-cross
   is set (AU, NZ); every other edition keeps these elements empty/hidden
   via [hidden] on the wrapping element written in markup. */
.southern-cross { display: none; }
html[data-edition="AU"] .southern-cross,
html[data-edition="NZ"] .southern-cross { display: block; }

.gov-constitution-header {
  position: relative; border-radius: var(--radius-lg); overflow: hidden;
  padding: 28px 20px 22px; margin-bottom: 16px; text-align: center;
  background: radial-gradient(120% 140% at 50% -10%, rgba(var(--glow-rgb), 0.16), transparent 65%), var(--bg-sunken);
  border: 1px solid var(--border);
}
.gov-constitution-header .southern-cross {
  position: absolute; inset: 0; width: 100%; height: 100%; opacity: 0.16;
  filter: drop-shadow(0 0 18px rgba(var(--glow-rgb), .35));
  pointer-events: none;
}
.gov-constitution-header .southern-cross-fg {
  position: relative; z-index: 1;
}
.gov-constitution-header h1 { margin: 0 0 4px; }

/* Sovereign glass — the four constitution tier cards, AU/NZ styling. */
html[data-edition="AU"] .gov-card, html[data-edition="NZ"] .gov-card {
  background: linear-gradient(160deg, rgba(var(--glow-rgb), 0.08), var(--panel) 55%);
  box-shadow: inset 0 1px 0 rgba(var(--glow-rgb), .14), var(--shadow-md);
}
.gov-card-head h2 { position: relative; padding-left: 0; }
html[data-edition="AU"] .gov-card-head h2::before,
html[data-edition="NZ"] .gov-card-head h2::before {
  content: ""; display: inline-block; width: 10px; height: 10px; margin-right: 8px;
  background: var(--edition-secondary, var(--accent));
  clip-path: polygon(50% 0%, 61% 35%, 98% 35%, 68% 57%, 79% 91%, 50% 70%, 21% 91%, 32% 57%, 2% 35%, 39% 35%);
  vertical-align: middle;
}

/* Tiny Southern Cross accents: opening wordmark, sidebar foot watermark. */
.opening-southern-cross-mini, .sidebar-southern-cross-mini { display: none; opacity: 0.5; }
html[data-edition="AU"] .opening-southern-cross-mini, html[data-edition="NZ"] .opening-southern-cross-mini,
html[data-edition="AU"] .sidebar-southern-cross-mini, html[data-edition="NZ"] .sidebar-southern-cross-mini {
  display: inline-block;
}
.sidebar-southern-cross-mini { width: 30px; height: 30px; margin: 0 auto; }
.gov-card-kill { border-color: var(--border-strong); }
.gov-card-head { display: flex; align-items: center; gap: 8px; margin-bottom: 8px; flex-wrap: wrap; }
.gov-card-head h2 { font-size: 14.5px; font-weight: 700; margin: 0; flex: 1; }
.gov-card-desc { font-size: 12.5px; color: var(--text-muted); margin: 0 0 10px; }
.gov-tier-meta { font-size: 11.5px; color: var(--text-faint); display: flex; flex-wrap: wrap; gap: 10px; margin-top: 8px; }
.kill-toggle { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 52px; padding: 0 16px; border-radius: var(--radius-pill); border: 2px solid var(--border-strong); background: var(--bg-sunken); cursor: pointer; font-weight: 700; }
.kill-toggle-thumb { width: 20px; height: 20px; border-radius: 50%; background: var(--text-faint); flex-shrink: 0; }
.kill-toggle[aria-checked="true"] { border-color: var(--danger); background: var(--danger-soft); }
.kill-toggle[aria-checked="true"] .kill-toggle-thumb { background: var(--danger); }
.kill-toggle-text { color: var(--text); }
.kill-toggle[aria-checked="true"] .kill-toggle-text { color: var(--danger); }

.geometry-wrap { flex: 1; overflow-y: auto; padding: 18px 14px calc(20px + env(safe-area-inset-bottom)); }
.geometry-tabs { display: flex; gap: 4px; background: var(--bg-sunken); border-radius: var(--radius-pill); padding: 4px; margin-bottom: 16px; }
.geometry-tab { flex: 1; min-height: 40px; border: none; border-radius: var(--radius-pill); background: transparent; cursor: pointer; font-weight: 600; font-size: 12.5px; color: var(--text-muted); }
.geometry-tab.is-active { background: var(--bg-elevated); color: var(--text); box-shadow: var(--shadow-sm); }
.geometry-figure { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel); padding: 14px; }
.geometry-svg { width: 100%; height: auto; display: block; max-height: 70vh; }
.geometry-svg-tall { max-height: 76vh; }
.geometry-detail { margin-top: 12px; font-size: 12.5px; color: var(--text-muted); min-height: 20px; }
.geometry-detail h3 { margin: 0 0 6px; font-size: 13.5px; color: var(--text); }
.geometry-detail-list { display: grid; grid-template-columns: auto 1fr; gap: 2px 10px; margin: 0; }
.geometry-detail-list dt { font-weight: 700; color: var(--text-faint); font-size: 11px; text-transform: uppercase; }
.geometry-detail-list dd { margin: 0; }
#geometry-chain .btn { margin-top: 12px; }

.media-list { display: flex; flex-direction: column; gap: 12px; }
.media-item { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel); padding: 14px; }
.media-item h3 { margin: 0 0 6px; font-size: 14px; }
.media-item audio, .media-item video { width: 100%; margin: 8px 0; }
.media-transcript { font-size: 12px; color: var(--text-muted); max-height: 140px; overflow-y: auto; background: var(--bg-sunken); border-radius: var(--radius-sm); padding: 10px; }

.settings-section { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel); padding: 16px; margin-bottom: 14px; }
.settings-section h2 { font-size: 14.5px; margin: 0 0 10px; }
.settings-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.settings-row:last-child { border-bottom: none; }
.roster-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.roster-row:last-child { border-bottom: none; }
.roster-name { font-weight: 600; font-size: 13.5px; }
.roster-meta { font-size: 11px; color: var(--text-faint); }
.key-sheet-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.key-sheet { width: 100%; max-width: 420px; background: var(--bg-elevated); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 20px 18px calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
.key-sheet h2 { margin: 0 0 8px; font-size: 16px; }
.key-sheet p { font-size: 12.5px; color: var(--text-muted); }

/* ---------- NDA copy card ---------- */
.nda-copy-card { border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--panel); padding: 16px; position: relative; }
.nda-copy-card h2 { margin: 0 0 6px; font-size: 15px; }
.nda-copy-card p { margin: 0 0 12px; font-size: 12.5px; color: var(--text-muted); }
.nda-copy-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.nda-copy-note { margin: 10px 0 0; font-size: 11.5px; color: var(--text-faint); }
.nda-copy-note.is-error { color: var(--danger); }
.nda-copy-close { position: absolute; top: 10px; right: 10px; width: 32px; height: 32px; min-width: 32px; min-height: 32px; border-radius: 50%; border: none; background: transparent; color: var(--text-muted); cursor: pointer; display: flex; align-items: center; justify-content: center; }
.nda-copy-close:hover { background: var(--bg-sunken); }
.nda-copy-sheet-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 60; display: flex; align-items: flex-end; justify-content: center; }
.nda-copy-sheet-scrim .nda-copy-card { width: 100%; max-width: 420px; border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }

/* ---------- empty / not-connected states ---------- */

.core-down-view { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px; padding: 30px; text-align: center; }
.core-down-view h2 { margin: 0; font-size: 16px; }
.core-down-view p { margin: 0; color: var(--text-muted); font-size: 13px; max-width: 340px; }

/* ---------- phone tab bar (§10.14) ---------- */

.tabbar { display: none; }
.more-sheet-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; display: flex; align-items: flex-end; justify-content: center; }
.more-sheet { width: 100%; background: var(--bg-elevated); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 14px 10px calc(14px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
.more-sheet-item { display: flex; align-items: center; gap: 12px; width: 100%; min-height: 48px; padding: 8px 14px; border: none; background: transparent; border-radius: var(--radius-md); color: var(--text); font-size: 14px; cursor: pointer; text-align: left; }
.more-sheet-item:hover { background: var(--bg-sunken); }
.shield-sheet-scrim { position: fixed; inset: 0; background: rgba(0,0,0,.45); z-index: 55; display: flex; align-items: flex-end; justify-content: center; }
.shield-sheet { width: 100%; background: var(--bg-elevated); border-radius: var(--radius-lg) var(--radius-lg) 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); box-shadow: var(--shadow-lg); }
.shield-sheet h2 { margin: 0 0 12px; font-size: 15px; }

/* ==========================================================================
   PHONE OVERRIDES — kept at the end of the file (§2.8, §10.14). Desktop
   rules above are widened here upward as needed.
   ========================================================================== */

@media (min-width: 900px) {
  .shell { flex-direction: row; }
  .login-card { padding: 36px 32px; }
  .tile-grid { grid-template-columns: repeat(3, 1fr); }
  .compare-tabs { display: none; }
  .compare-columns { flex-direction: row; }
  .compare-col { display: flex !important; flex: 1; }
  .st-controls { flex-direction: row; align-items: flex-end; }
  .st-field { flex: 1; }
  .audit-filters { flex-direction: row; flex-wrap: wrap; align-items: flex-end; }
  .audit-filters .st-field { flex: 1; min-width: 140px; }
  .audit-table { display: table; }
  .audit-cards { display: none; }
  .room-title-mobile { display: none; }
  .tabbar { display: none !important; }
}

@media (max-width: 899.98px) {
  .main { padding-bottom: var(--tabbar-h); }
  .tabbar { display: flex; position: fixed; left: 0; right: 0; bottom: 0; height: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); padding-bottom: env(safe-area-inset-bottom); background: color-mix(in srgb, var(--bg-elevated) 92%, transparent); backdrop-filter: blur(14px); border-top: 1px solid var(--border); z-index: 35; }
  .tabbar-item { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; min-height: 44px; border: none; background: transparent; color: var(--text-muted); font-size: 10.5px; font-weight: 600; cursor: pointer; }
  .tabbar-item.is-active { color: var(--accent-strong); }
  .topbar-controls .model-select-btn { font-size: 11.5px; padding: 0 10px; }
  .toggle-group { display: none; }
  .shield-toggle-btn { display: inline-flex !important; }
}
@media (min-width: 900px) {
  .shield-toggle-btn { display: none !important; }
}

html, body { overflow-x: hidden; }
.app, .shell, .main { max-width: 100vw; }

@media (max-width: 480px) {
  .topbar { padding-left: 6px; padding-right: 6px; }
  .model-select-btn { font-size: 12px; }
  .info-popover { left: 12px; right: 12px; width: auto; }
  .st-headline-value { font-size: 32px; }
  .messages { padding-left: 2px; padding-right: 2px; }
}

/* opening: diagnostics layout */
.opening-loader-track { width: min(340px, 86vw); }
.opening-mute-btn { display: block; margin: 4px auto 0; }

/* ---------- energy room v2 (docs/ENERGY.md) ----------
   Phone first: one column, the waterfall as a vertical list, tables as
   cards. On a desk the waterfall and "What each saving rests on" sit side
   by side. Navy / pearl / claret, serif headings, glass cards. */
.en-wrap { display: flex; flex-direction: column; gap: 14px; }
.en-card { background: var(--panel); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px 16px; box-shadow: var(--shadow-sm); -webkit-backdrop-filter: blur(14px); backdrop-filter: blur(14px); min-width: 0; overflow-wrap: anywhere; }
.en-h2 { font-family: var(--font-display); font-size: 18px; font-weight: 600; margin: 0 0 8px; color: var(--text); display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.en-h3 { font-family: var(--font-display); font-size: 14px; font-weight: 600; margin: 14px 0 6px; color: var(--text-muted); display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.en-note { font-size: 12.5px; color: var(--text-muted); margin: 8px 0 0; line-height: 1.45; }
.en-empty { color: var(--text-muted); margin: 0; }
.en-mono { font-family: var(--font-mono); font-size: 11.5px; color: var(--text-muted); margin: 6px 0 0; word-break: break-all; }
.en-badge { display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: var(--radius-pill); font-family: var(--font-mono); font-size: 10px; font-weight: 700; letter-spacing: .06em; white-space: nowrap; border: 1px solid transparent; }
.en-badge--measured { background: var(--accent-soft); color: var(--accent-strong); border-color: var(--border-strong); }
.en-badge--derived { background: var(--bg-sunken); color: var(--text); border-color: var(--border-strong); }
.en-badge--estimated { background: var(--amber-soft); color: var(--amber); border-color: rgba(138, 90, 16, 0.35); }
.en-badge--forecast { background: var(--danger-soft); color: var(--danger); border-color: rgba(var(--claret-rgb), 0.35); }
.en-status { display: inline-flex; align-items: center; min-height: 22px; padding: 0 9px; border-radius: var(--radius-pill); font-size: 11.5px; font-weight: 700; }
.en-status--on { background: var(--accent-soft); color: var(--accent-strong); }
.en-status--off { background: var(--danger-soft); color: var(--danger); }
.en-status--ctx { background: var(--neutral-chip); color: var(--text-muted); }
.en-basis-line { margin: 8px 0 0; font-size: 12.5px; color: var(--text-muted); line-height: 1.5; }
.en-head-top { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; justify-content: space-between; }
.en-kicker { font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .05em; }
.en-head-value { font-family: var(--font-display); font-size: 30px; font-weight: 700; color: var(--accent-strong); margin: 6px 0 4px; font-variant-numeric: tabular-nums; line-height: 1.15; }
.en-head-sentence { margin: 0 0 8px; font-size: 15px; color: var(--text); }
.en-head-facts { display: grid; grid-template-columns: 1fr; gap: 6px; margin: 0; }
.en-head-facts div { display: flex; justify-content: space-between; gap: 8px; flex-wrap: wrap; border-top: 1px solid var(--border); padding-top: 6px; }
.en-head-facts dt { color: var(--text-muted); font-size: 13px; }
.en-head-facts dd { margin: 0; font-weight: 700; font-variant-numeric: tabular-nums; }
.en-head-be { margin: 10px 0 0; font-size: 13.5px; line-height: 1.5; }
.en-duo { display: grid; grid-template-columns: minmax(0, 1fr); gap: 14px; }
.en-rows { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.en-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 3px; }
.en-row-head { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; font-size: 13.5px; font-weight: 600; }
.en-row-value { font-size: 12.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; }
.en-row--sub { padding-left: 14px; opacity: .85; }
.en-row--sub .en-row-head { font-weight: 500; color: var(--text-muted); }
.en-row--total { border-top: 1px solid var(--border-strong); padding-top: 8px; }
.en-row--caption { font-size: 12px; color: var(--text-faint); padding-left: 14px; font-style: italic; }
.en-track { position: relative; height: 12px; background: var(--bg-sunken); border-radius: var(--radius-pill); overflow: hidden; }
.en-zero { position: absolute; left: 50%; top: 0; bottom: 0; width: 1px; background: var(--border-strong); }
.en-bar { position: absolute; top: 2px; bottom: 2px; border-radius: 3px; }
.en-bar--spent { background: rgba(var(--claret-rgb), 0.55); }
.en-bar--cost { background: rgba(var(--claret-rgb), 0.75); }
.en-bar--context { background: rgba(95, 104, 132, 0.45); }
.en-bar--saved { background: rgba(11, 27, 63, 0.55); }
.en-bar--net { background: var(--accent-2); }
.en-bar--hollow { background: transparent; border: 1.5px solid var(--text-faint); }
.en-whisker { position: absolute; top: 5px; height: 2px; background: var(--text); opacity: .55; }
.en-rest-list { display: flex; flex-direction: column; gap: 10px; }
.en-rest { border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg-elevated); }
.en-rest header { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.en-rest-name { font-family: var(--font-display); font-weight: 600; font-size: 15px; }
.en-rest-status { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-bottom: 6px; }
.en-rest-reason { font-size: 12.5px; color: var(--text-muted); }
.en-rest-dl { margin: 0; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; }
.en-rest-dl div { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; }
.en-rest-dl dt { font-size: 11.5px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.en-rest-dl dd { margin: 0; font-size: 13px; font-variant-numeric: tabular-nums; }
.en-context { margin: 8px 0 0; font-size: 12px; color: var(--text-faint); font-style: italic; }
.en-turns { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.en-turn { border: 1px solid var(--border); border-radius: var(--radius-sm); background: var(--bg-elevated); }
.en-turn-head { all: unset; box-sizing: border-box; cursor: pointer; display: grid; grid-template-columns: minmax(0, 1fr); gap: 4px; width: 100%; min-height: 44px; padding: 10px 12px; }
.en-turn-head:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: var(--radius-sm); }
.en-turn-time { font-weight: 700; font-size: 13px; }
.en-turn-tags { font-size: 12px; color: var(--text-muted); }
.en-turn-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 4px 10px; font-size: 12px; font-variant-numeric: tabular-nums; }
.en-turn-grid em { display: block; font-style: normal; color: var(--text-faint); font-size: 10.5px; text-transform: uppercase; letter-spacing: .04em; }
.en-turn-foot { margin: 0; padding: 0 12px 8px; font-size: 12px; color: var(--danger); }
.en-turn-detail { padding: 0 12px 12px; border-top: 1px solid var(--border); }
.en-card-head { font-size: 12.5px; color: var(--text-muted); margin: 10px 0 8px; }
.en-calls { display: flex; flex-direction: column; gap: 6px; margin-bottom: 8px; }
.en-call { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; padding: 6px 8px; border-radius: 6px; background: var(--bg-sunken); font-size: 12px; font-variant-numeric: tabular-nums; }
.en-call--model { opacity: .7; }
.en-call-layer { font-weight: 700; font-family: var(--font-mono); font-size: 11.5px; }
.en-tiles { display: grid; grid-template-columns: minmax(0, 1fr); gap: 10px; }
.en-tile { display: flex; flex-direction: column; gap: 3px; border: 1px solid var(--border); border-radius: var(--radius-sm); padding: 10px 12px; background: var(--bg-elevated); }
.en-tile-name { font-size: 12px; color: var(--text-muted); font-weight: 700; }
.en-tile-value { font-family: var(--font-display); font-size: 18px; font-weight: 700; font-variant-numeric: tabular-nums; }
.en-tile-sub { font-size: 12px; color: var(--text-muted); }
.en-withheld { margin: 0; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--amber-soft); color: var(--amber); font-weight: 600; font-size: 13.5px; }
.en-assume { margin: 10px 0 0; padding-left: 18px; font-size: 12.5px; color: var(--text-muted); }
.en-fam { display: flex; flex-direction: column; gap: 6px; margin: 8px 0; }
.en-fam-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; font-size: 12.5px; padding: 6px 8px; border-radius: 6px; background: var(--bg-sunken); font-variant-numeric: tabular-nums; }
.en-fam-name { font-weight: 700; }
.en-live { display: flex; flex-direction: column; gap: 6px; }
.en-live-row { display: grid; grid-template-columns: minmax(0, 1fr); gap: 2px; font-size: 12.5px; padding: 6px 8px; border-radius: 6px; background: var(--bg-sunken); }
.en-live-metric { font-weight: 700; }
.en-live-verdict { color: var(--text-muted); font-style: italic; }
.en-table-wrap { overflow-x: auto; }
.en-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }
.en-table th, .en-table td { text-align: left; vertical-align: top; padding: 6px 6px; border-bottom: 1px solid var(--border); }
.en-table thead th { font-size: 11px; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.en-btn { display: inline-flex; align-items: center; min-height: 44px; padding: 0 16px; margin-top: 10px; border-radius: var(--radius-pill); background: var(--accent); color: var(--accent-contrast); font-weight: 700; text-decoration: none; }
.en-dq { margin: 0; padding-left: 18px; font-size: 12.5px; line-height: 1.5; }
.en-dq-n { font-weight: 700; font-variant-numeric: tabular-nums; }
.en-method summary { cursor: pointer; font-family: var(--font-display); font-size: 16px; font-weight: 600; min-height: 44px; display: flex; align-items: center; }
.en-method-body p { font-size: 13.5px; line-height: 1.55; margin: 8px 0; }
.msg-energy-line { flex-basis: 100%; margin: 4px 0 0; font-size: 11.5px; color: var(--text-muted); font-variant-numeric: tabular-nums; line-height: 1.4; }
.resolve-btn { opacity: .85; }

@media (min-width: 900px) {
  .en-duo { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); align-items: start; }
  .en-tiles { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .en-head-facts { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .en-turn-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); }
  .en-head-value { font-size: 36px; }
}

/* Phone rules last (docs: measured at 375 × 812): nothing wider than the
   screen, every hand at least 44 px. */
@media (max-width: 480px) {
  /* The Rooms and Chats edge tabs overlay about 30 px of each side. */
  .en-wrap { padding-left: 34px !important; padding-right: 34px !important; }
  .en-card { padding: 12px 12px !important; }
  .en-head-value { font-size: 24px !important; }
  .en-table th, .en-table td { padding: 5px 4px !important; }
  .en-mono { font-size: 11px !important; }
  /* Clear of the Rooms and Chats edge tabs, which overlay the row's ends. */
  .msg-energy-line { padding: 0 40px 0 46px !important; }
}

/* Energy room QA (26 Sep 2026): per-turn badges stay compact; the evidence
   button and the red status/forecast chips meet WCAG AA on the navy glass. */
.en-turn-grid em .en-badge, .en-head-facts dt .en-badge, .en-rest-dl dt .en-badge { height: 16px; padding: 0 5px; margin-left: 4px; font-size: 8.5px; vertical-align: middle; }
.en-btn { background: var(--accent-soft); color: var(--text); border: 1px solid var(--border-strong); }
.en-btn:hover, .en-btn:focus-visible { border-color: var(--accent); }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .en-status--off, :root:not([data-theme="light"]) .en-badge--forecast { color: #f58f9c; }
}
:root[data-theme="dark"] .en-status--off, :root[data-theme="dark"] .en-badge--forecast { color: #f58f9c; }
/* The Energy room's Print PDF is a 44 px hand at every width (the shared
   button is 36 px above the phone breakpoint). */
#view-energy #print-energy { min-height: 44px; }
/* Above the phone the Chats edge tab (30 px) sits over the cards' right edge;
   keep every card clear of it. */
@media (min-width: 481px) { #energy-root.en-wrap { padding-right: 34px; } }
