:root {
  color-scheme: dark;
  --bg: #050b15;
  --bg-2: #081120;
  --surface: #0e1a2c;
  --surface-2: #142338;
  --surface-3: #1b2e48;
  --well: #071321;
  --line: rgba(148, 180, 222, 0.14);
  --line-strong: rgba(148, 180, 222, 0.28);
  --ink: #eef4fb;
  --ink-2: #c6d3e3;
  --muted: #8ea2b9;
  --accent: #56d4f0;
  --accent-2: #7f9cff;
  --accent-ink: #052330;
  --ok: #4ddba0;
  --info: #5cc6f7;
  --warn: #fbbf4a;
  --danger: #ff6b83;
  --lvl: var(--muted);
  --radius: 16px;
  --radius-sm: 10px;
  --sidebar: 256px;
  --shadow: 0 12px 32px rgba(0, 0, 0, 0.3);
  --sans: "Segoe UI Variable Text", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --display: "Segoe UI Variable Display", "Segoe UI", system-ui, -apple-system, "Helvetica Neue", Arial, sans-serif;
  --mono: "Cascadia Mono", Consolas, "SF Mono", "Courier New", monospace;
}

[data-level="normal"], .level-normal { --lvl: var(--ok); }
[data-level="monitor"], .level-monitor { --lvl: var(--info); }
[data-level="needs_review"], .level-needs_review { --lvl: var(--warn); }
[data-level="urgent_review"], .level-urgent_review { --lvl: var(--danger); }
.presence-online { --lvl: var(--ok); }
.presence-stale { --lvl: var(--warn); }
.presence-offline, .presence-never_seen { --lvl: var(--muted); }

*, *::before, *::after { box-sizing: border-box; }
[hidden] { display: none !important; }
html { color-scheme: dark; -webkit-text-size-adjust: 100%; scroll-padding-top: 5.5rem; }
body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  font-size: 0.97rem;
  line-height: 1.5;
  color: var(--ink);
  background:
    radial-gradient(900px 520px at 85% -8%, rgba(86, 212, 240, 0.09), transparent 62%),
    radial-gradient(700px 480px at -5% 105%, rgba(127, 156, 255, 0.08), transparent 60%),
    var(--bg);
  font-variant-numeric: tabular-nums;
}
* { scrollbar-width: thin; scrollbar-color: rgba(148, 180, 222, 0.4) transparent; }
img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-underline-offset: 0.18em; }
a:hover { color: #8fe6f8; }
button, input, select, textarea { font: inherit; color: inherit; }
h1, h2, h3, h4 { font-family: var(--display); font-weight: 650; letter-spacing: -0.015em; line-height: 1.2; margin: 0; }
h1 { font-size: clamp(1.3rem, 1.1rem + 0.9vw, 1.7rem); }
h2 { font-size: 1.18rem; }
h3 { font-size: 1rem; }
p { margin: 0; }
ul, ol { margin: 0; padding-left: 1.2rem; }
dl, figure { margin: 0; }
li + li { margin-top: 0.3rem; }
code { font-family: var(--mono); font-size: 0.9em; background: rgba(148, 180, 222, 0.12); border-radius: 6px; padding: 0.08em 0.38em; overflow-wrap: anywhere; }
time { white-space: nowrap; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
.skip { position: absolute; left: 1rem; top: -4rem; z-index: 30; background: #fff; color: #000; padding: 0.5rem 0.8rem; border-radius: 8px; }
.skip:focus { top: 0.6rem; }
.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; }
.icon { width: 1.2em; height: 1.2em; flex: none; vertical-align: -0.2em; }
.muted, .form-note, .hint { color: var(--muted); }
.form-note, .hint { font-size: 0.86rem; }
.eyebrow { color: var(--accent); letter-spacing: 0.12em; text-transform: uppercase; font-size: 0.7rem; font-weight: 650; }
.stack { display: grid; gap: 1rem; }
.stack-sm { display: grid; gap: 0.55rem; }
.row { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.row form { margin: 0; }
.spread { justify-content: space-between; }
.grid-2, .grid-3, .split { display: grid; gap: 1rem; align-items: start; }
.grid-2, .split { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stretch { align-items: stretch; }

.shell { display: grid; grid-template-columns: var(--sidebar) minmax(0, 1fr); min-height: 100vh; }
.sidebar {
  position: sticky; top: 0; height: 100vh; height: 100dvh; z-index: 12;
  display: flex; flex-direction: column; gap: 0.6rem;
  padding: 0.9rem 0.7rem;
  background: var(--bg-2);
  border-right: 1px solid var(--line);
}
.brand { display: flex; gap: 0.7rem; align-items: center; text-decoration: none; color: var(--ink); padding: 0.25rem 0.45rem 0.6rem; }
.brand img { width: 38px; height: 38px; border-radius: 11px; box-shadow: 0 0 0 1px var(--line-strong), 0 0 22px rgba(86, 212, 240, 0.25); }
.brand strong { display: block; letter-spacing: 0.24em; font-size: 0.98rem; font-family: var(--display); }
.brand small { color: var(--muted); letter-spacing: 0.06em; text-transform: uppercase; font-size: 0.64rem; }
.sidebar nav { display: flex; flex-direction: column; gap: 0.12rem; min-height: 0; flex: 1; overflow-y: auto; overscroll-behavior: contain; padding-right: 0.1rem; }
.nav-group { margin: 0.75rem 0 0.25rem; padding: 0 0.7rem; color: var(--muted); font-size: 0.66rem; font-weight: 650; letter-spacing: 0.14em; text-transform: uppercase; }
.nav-group:first-child { margin-top: 0; }
.sidebar nav a {
  position: relative;
  display: flex; align-items: center; gap: 0.7rem; min-height: 40px;
  padding: 0.45rem 0.7rem; border-radius: var(--radius-sm);
  color: var(--ink-2); text-decoration: none; font-weight: 500;
  transition: background 0.15s ease, color 0.15s ease;
}
.sidebar nav a .icon { width: 19px; height: 19px; color: var(--muted); transition: color 0.15s ease; }
.sidebar nav a:hover { background: rgba(148, 180, 222, 0.09); color: var(--ink); }
.sidebar nav a.active { background: linear-gradient(90deg, rgba(86, 212, 240, 0.2), rgba(86, 212, 240, 0.05)); color: #fff; font-weight: 600; }
.sidebar nav a.active::before { content: ""; position: absolute; left: -0.7rem; top: 9px; bottom: 9px; width: 4px; border-radius: 0 4px 4px 0; background: var(--accent); }
.sidebar nav a.active .icon, .sidebar nav a:hover .icon { color: var(--accent); }
.sidebar-foot { display: grid; gap: 0.5rem; border-top: 1px solid var(--line); padding-top: 0.7rem; }
.user-card { display: flex; align-items: center; gap: 0.65rem; padding: 0.15rem 0.3rem; min-width: 0; }
.user-copy { min-width: 0; display: grid; line-height: 1.25; }
.user-copy strong { font-size: 0.9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-copy small { color: var(--muted); font-size: 0.76rem; }
.avatar {
  flex: none; display: inline-grid; place-items: center;
  width: 36px; height: 36px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-2), var(--accent)); color: #06182a;
  font-weight: 700; font-size: 0.82rem; letter-spacing: 0.02em;
}
.avatar-lg { width: 48px; height: 48px; font-size: 1rem; }
.sidebar-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.4rem; }
.sidebar-actions form { margin: 0; }
.sidebar-actions button { width: 100%; padding-inline: 0.4rem; font-size: 0.84rem; }

.workspace { min-width: 0; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 8;
  display: flex; align-items: center; gap: 0.9rem;
  padding: 0.7rem clamp(1rem, 2.4vw, 2rem);
  background: #081120;
  border-bottom: 1px solid var(--line);
}
.topbar-title { min-width: 0; flex: 1; }
.topbar-title h1 { overflow-wrap: anywhere; }
.topbar .eyebrow { font-size: 0.64rem; color: var(--muted); }
.top-tools { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: 0.4rem; align-items: center; }
.menu-button, .sidebar-close { display: none; }
.sidebar-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 0.5rem; }
.context-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 0.45rem; padding: 0.65rem clamp(1rem, 2.4vw, 2rem) 0; }
.context-chip { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.28rem 0.7rem; border-radius: 999px; background: rgba(148, 180, 222, 0.08); border: 1px solid var(--line); color: var(--ink-2); font-size: 0.84rem; }
.context-chip .icon { color: var(--accent); width: 15px; height: 15px; }
.crew-switch { margin: 0 0 0 auto; display: flex; align-items: center; gap: 0.45rem; }
.crew-switch label { color: var(--muted); font-size: 0.84rem; }
.crew-switch select { width: auto; min-width: 8.5rem; padding-block: 0.36rem; }
main { width: 100%; max-width: 1500px; margin-inline: auto; padding: 1.1rem clamp(1rem, 2.4vw, 2rem) 2rem; display: grid; gap: 1.15rem; align-content: start; flex: 1; }
main > * { min-width: 0; }
.page-foot { margin-top: 0.6rem; padding-top: 1rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.8rem; display: flex; gap: 0.45rem; align-items: center; }
.scrim { display: none; }
body.is-loading { cursor: progress; }
body.is-loading::before {
  content: ""; position: fixed; left: 0; top: 0; z-index: 40; height: 3px; width: 35%;
  background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 0 3px 3px 0;
  animation: loadbar 0.8s ease infinite;
}
@keyframes loadbar { 50% { width: 75%; } }

button, .button {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.45rem;
  min-height: 40px; padding: 0.5rem 1rem;
  border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  background: var(--surface-3); color: var(--ink);
  font-weight: 600; font-size: 0.92rem; line-height: 1.2; text-decoration: none; text-align: center;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease, box-shadow 0.15s ease;
}
button:hover, .button:hover { background: #233a5a; border-color: rgba(148, 180, 222, 0.5); color: var(--ink); }
button:active, .button:active { transform: translateY(1px); }
button.primary, .button.primary {
  background: linear-gradient(180deg, #7be3f8, #43c4e6); border-color: transparent; color: var(--accent-ink);
  box-shadow: 0 6px 18px rgba(67, 196, 230, 0.22);
}
button.primary:hover, .button.primary:hover { background: linear-gradient(180deg, #9bebfb, #5fd2ef); color: var(--accent-ink); }
button.ghost, .button.ghost { background: transparent; border-color: var(--line); color: var(--ink-2); }
button.ghost:hover, .button.ghost:hover { background: rgba(148, 180, 222, 0.1); color: var(--ink); }
button.danger, .button.danger { background: rgba(255, 107, 131, 0.1); border-color: rgba(255, 107, 131, 0.4); color: #ffb3c0; }
button.danger:hover, .button.danger:hover { background: rgba(255, 107, 131, 0.2); }
button.small, .button.small { min-height: 32px; padding: 0.3rem 0.7rem; font-size: 0.84rem; }
button.block, .button.block { width: 100%; }
button:disabled { opacity: 0.6; cursor: default; transform: none; box-shadow: none; }
.icon-button { width: 40px; padding: 0; flex: none; }

input, select, textarea {
  width: 100%; min-height: 42px;
  background: #0a1626; border: 1px solid var(--line-strong); border-radius: var(--radius-sm);
  padding: 0.55rem 0.75rem;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
input::placeholder, textarea::placeholder { color: #6f839b; }
input:hover, select:hover, textarea:hover { border-color: rgba(148, 180, 222, 0.45); }
input:focus-visible, select:focus-visible, textarea:focus-visible { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px rgba(86, 212, 240, 0.2); }
textarea { resize: vertical; min-height: 6.5rem; }
select {
  appearance: none; -webkit-appearance: none; padding-right: 2.2rem;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238ea2b9' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 0.65rem center; background-size: 1rem;
}
select option { background: #0e1a2c; color: var(--ink); }
input[type="checkbox"], input[type="radio"] { width: 1.1rem; height: 1.1rem; min-height: 0; padding: 0; flex: none; accent-color: var(--accent); }
input[type="date"] { min-width: 10rem; }
label { font-size: 0.86rem; font-weight: 600; color: var(--ink-2); }
.form, .form-grid { display: grid; gap: 0.85rem; }
.form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.field { display: grid; gap: 0.32rem; min-width: 0; align-content: start; }
.field .hint { font-size: 0.8rem; }
.form-grid > .wide, .form-grid > button, .form-grid > .form-note, .form-grid > .check, .form-grid > .form-actions, .form-grid > fieldset { grid-column: 1 / -1; }
.form-grid > button { justify-self: start; }
.form-actions { display: flex; flex-wrap: wrap; gap: 0.6rem; align-items: center; }
.check { display: flex; align-items: flex-start; gap: 0.55rem; font-weight: 500; color: var(--ink-2); cursor: pointer; }
.check input { margin-top: 0.15rem; }
fieldset { margin: 0; padding: 0.9rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); display: grid; gap: 0.85rem; grid-template-columns: repeat(2, minmax(0, 1fr)); min-width: 0; }
fieldset > .wide, fieldset > .form-note { grid-column: 1 / -1; }
legend { padding: 0 0.4rem; color: var(--muted); font-size: 0.8rem; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; }
.search-field { position: relative; }
.search-field .icon { position: absolute; left: 0.8rem; top: 50%; transform: translateY(-50%); color: var(--muted); pointer-events: none; }
.search-field input { padding-left: 2.5rem; }
.segmented { display: inline-flex; flex-wrap: wrap; gap: 2px; padding: 3px; border-radius: 12px; background: #0a1626; border: 1px solid var(--line); }
.segmented button { min-height: 32px; padding: 0.25rem 0.8rem; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 0.84rem; }
.segmented button:hover { color: var(--ink); background: rgba(148, 180, 222, 0.1); }
.segmented button.is-on { background: var(--surface-3); color: var(--ink); box-shadow: 0 0 0 1px var(--line-strong); }
progress { -webkit-appearance: none; appearance: none; width: 100%; height: 8px; border: 0; border-radius: 99px; background: rgba(148, 180, 222, 0.16); overflow: hidden; color: var(--accent); }
progress::-webkit-progress-bar { background: rgba(148, 180, 222, 0.16); border-radius: 99px; }
progress::-webkit-progress-value { background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; }
progress::-moz-progress-bar { background: linear-gradient(90deg, var(--accent-2), var(--accent)); border-radius: 99px; }
progress.done::-webkit-progress-value { background: var(--ok); }
progress.done::-moz-progress-bar { background: var(--ok); }

.card {
  background: linear-gradient(180deg, rgba(20, 35, 56, 0.92), rgba(14, 26, 44, 0.92));
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 1.1rem 1.2rem; min-width: 0;
  box-shadow: 0 1px 0 rgba(255, 255, 255, 0.03) inset;
}
.card > * + * { margin-top: 0.75rem; }
.card-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-start; gap: 0.6rem 1rem; }
.card-head > div:first-child { min-width: 0; flex: 1 1 16rem; display: grid; gap: 0.25rem; }
.card-title { display: flex; align-items: center; gap: 0.55rem; }
.card-title .icon { color: var(--accent); }
.section-head { display: flex; flex-wrap: wrap; justify-content: space-between; align-items: flex-end; gap: 0.5rem 1rem; }
.section-head > div { display: grid; gap: 0.2rem; }
.group-title { display: flex; align-items: center; gap: 0.6rem; margin: 0.4rem 0 -0.35rem; color: var(--muted); font-size: 0.74rem; font-weight: 650; letter-spacing: 0.12em; text-transform: uppercase; }
.group-title::after { content: ""; flex: 1; height: 1px; background: var(--line); }
.icon-tile { flex: none; display: inline-grid; place-items: center; width: 38px; height: 38px; border-radius: 11px; background: rgba(86, 212, 240, 0.12); color: var(--accent); }
.icon-tile .icon { width: 20px; height: 20px; }
.icon-tile.lg { width: 48px; height: 48px; border-radius: 14px; }
.card-lead { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.8rem; align-items: center; }
.card-lead > div { display: grid; gap: 0.15rem; }
.icon-tile.lg .icon { width: 24px; height: 24px; }
.table-wrap { overflow-x: auto; }
.card.table-wrap, .card .table-wrap { scrollbar-gutter: stable; }
table { width: 100%; border-collapse: collapse; font-size: 0.92rem; }
th, td { text-align: left; padding: 0.62rem 0.7rem; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-weight: 650; font-size: 0.7rem; letter-spacing: 0.09em; text-transform: uppercase; white-space: nowrap; background: rgba(148, 180, 222, 0.05); }
thead th:first-child { border-radius: 8px 0 0 8px; }
thead th:last-child { border-radius: 0 8px 8px 0; }
thead th { border-bottom: 0; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: rgba(148, 180, 222, 0.05); }
td.num, th.num { text-align: right; }
td strong { font-weight: 650; }
td form { margin: 0; }
.inline-form { display: flex; gap: 0.4rem; align-items: center; }
.inline-form select { min-width: 9.5rem; min-height: 36px; padding-block: 0.3rem; }
.empty { display: flex; align-items: center; gap: 0.8rem; padding: 1rem; border: 1px dashed var(--line-strong); border-radius: var(--radius-sm); color: var(--muted); }
.empty .icon { width: 22px; height: 22px; color: var(--accent); }
.callout { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.8rem 0.95rem; border-radius: var(--radius-sm); background: rgba(86, 212, 240, 0.08); border: 1px solid rgba(86, 212, 240, 0.22); color: var(--ink-2); }
.callout .icon { color: var(--accent); margin-top: 0.12rem; }
.callout > div { display: grid; gap: 0.3rem; min-width: 0; }
.callout.ok { background: rgba(77, 219, 160, 0.09); border-color: rgba(77, 219, 160, 0.34); }
.callout.ok .icon { color: var(--ok); }
.callout.warn { background: rgba(251, 191, 74, 0.09); border-color: rgba(251, 191, 74, 0.34); }
.callout.warn .icon { color: var(--warn); }
.kv { display: grid; gap: 0; }
.kv > div { display: flex; justify-content: space-between; gap: 1rem; padding: 0.5rem 0; border-bottom: 1px solid var(--line); }
.kv > div:last-child { border-bottom: 0; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; text-align: right; font-weight: 600; }
details > summary { cursor: pointer; list-style: none; }
details > summary::-webkit-details-marker { display: none; }
.chevron { transition: transform 0.18s ease; color: var(--muted); }
details[open] > summary .chevron { transform: rotate(180deg); }
.disclosure { border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(8, 17, 32, 0.45); }
.disclosure + .disclosure { margin-top: 0.5rem; }
.disclosure > summary { display: flex; align-items: center; gap: 0.6rem; padding: 0.7rem 0.9rem; font-weight: 600; }
.disclosure > summary > span:first-of-type { flex: 1; }
.disclosure > summary:hover { background: rgba(148, 180, 222, 0.06); border-radius: var(--radius-sm); }
.disclosure-body { padding: 0 0.9rem 0.9rem; display: grid; gap: 0.55rem; color: var(--ink-2); }

.level, .presence, .badge, .live-state, .clock {
  display: inline-flex; align-items: center; gap: 0.4rem;
  margin: 0; padding: 0.2rem 0.65rem; border-radius: 999px;
  font-size: 0.76rem; font-weight: 650; line-height: 1.35; white-space: nowrap;
  justify-self: start;
  border: 1px solid var(--line-strong); color: var(--ink-2); background: rgba(148, 180, 222, 0.07);
}
.level, .presence { color: var(--lvl); border-color: color-mix(in srgb, var(--lvl) 42%, transparent); background: color-mix(in srgb, var(--lvl) 13%, transparent); }
.level::before, .presence::before, .live-state::before { content: ""; width: 0.5rem; height: 0.5rem; border-radius: 50%; background: currentColor; flex: none; }
.level-normal { color: var(--ink-2); border-color: var(--line-strong); background: rgba(148, 180, 222, 0.07); }
.level-normal::before { background: var(--ok); }
.presence-online::before, .live-state[data-on="1"]::before { box-shadow: 0 0 0 0 currentColor; animation: pulse 1.8s ease-out infinite; }
.live-state { color: var(--muted); }
.live-state[data-on="1"] { color: var(--ok); border-color: rgba(77, 219, 160, 0.4); background: rgba(77, 219, 160, 0.1); }
.live-state[data-on="0"] { color: var(--warn); border-color: rgba(251, 191, 74, 0.4); }
.clock { color: var(--muted); font-weight: 500; }
.clock .icon { width: 14px; height: 14px; }
.badge.accent { color: var(--accent); border-color: rgba(86, 212, 240, 0.4); background: rgba(86, 212, 240, 0.1); }
.badge.ok { color: var(--ok); border-color: rgba(77, 219, 160, 0.4); background: rgba(77, 219, 160, 0.1); }
.badge.warn { color: var(--warn); border-color: rgba(251, 191, 74, 0.4); background: rgba(251, 191, 74, 0.1); }
.badge.danger { color: #ffb3c0; border-color: rgba(255, 107, 131, 0.4); background: rgba(255, 107, 131, 0.1); }
.badge .icon { width: 13px; height: 13px; }
@keyframes pulse { 70% { box-shadow: 0 0 0 7px transparent; } 100% { box-shadow: 0 0 0 0 transparent; } }

.flash { display: flex; align-items: flex-start; gap: 0.7rem; padding: 0.8rem 1rem; border-radius: var(--radius-sm); border: 1px solid var(--line-strong); background: var(--surface-2); }
.flash > .icon { margin-top: 0.12rem; }
.flash > div { display: grid; gap: 0.35rem; min-width: 0; }
.flash-ok { background: rgba(77, 219, 160, 0.1); border-color: rgba(77, 219, 160, 0.4); }
.flash-ok > .icon { color: var(--ok); }
.flash-error { background: rgba(255, 107, 131, 0.1); border-color: rgba(255, 107, 131, 0.45); }
.flash-error > .icon { color: var(--danger); }
.toasts { position: fixed; right: 1rem; bottom: 1rem; display: grid; gap: 0.5rem; z-index: 20; }
.toast { background: var(--surface-3); border: 1px solid var(--line-strong); border-left: 4px solid var(--accent); border-radius: var(--radius-sm); padding: 0.75rem 0.95rem; max-width: min(360px, calc(100vw - 2rem)); box-shadow: var(--shadow); animation: rise 0.2s ease; }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
.banner {
  position: fixed; left: 50%; top: 0.7rem; transform: translateX(-50%); z-index: 30;
  width: max-content; max-width: min(720px, calc(100vw - 1.5rem));
  padding: 0.6rem 1rem; border-radius: 12px;
  background: #3a2f12; border: 1px solid rgba(251, 191, 74, 0.5); color: #fbe5b0; box-shadow: var(--shadow);
  font-size: 0.9rem;
}

.page-hero, .status-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1fr) minmax(200px, 32%);
  border: 1px solid var(--line); border-radius: 20px;
  background: linear-gradient(120deg, #13264a 0%, #0d1b33 55%, #0a1526 100%);
  min-height: 176px;
}
.hero-copy { position: relative; z-index: 1; padding: 1.35rem 1.5rem; display: grid; gap: 0.55rem; align-content: center; }
.hero-copy h2 { font-size: clamp(1.25rem, 1rem + 1vw, 1.65rem); }
.hero-copy p { color: var(--ink-2); max-width: 68ch; }
.hero-copy .eyebrow { color: var(--accent); }
.hero-copy ul { color: var(--ink-2); }
.hero-art { position: relative; margin: 0; min-height: 176px; }
.hero-art img {
  position: absolute; left: 0; top: 0; width: 100%; height: 138%; max-width: none;
  object-fit: cover; object-position: 30% top;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 55%); mask-image: linear-gradient(90deg, transparent 0%, #000 55%);
  opacity: 0.9;
}
.hero-art.crop-right img { width: 142%; object-position: left top; }
.hero-art figcaption { position: absolute; right: 0.7rem; bottom: 0.6rem; padding: 0.16rem 0.55rem; border-radius: 999px; background: rgba(5, 11, 21, 0.72); color: var(--muted); font-size: 0.68rem; letter-spacing: 0.04em; }
.hero-facts { display: flex; flex-wrap: wrap; gap: 0.4rem 0.5rem; }
.fact { display: inline-flex; align-items: center; gap: 0.4rem; padding: 0.25rem 0.65rem; border-radius: 999px; background: rgba(5, 11, 21, 0.4); border: 1px solid var(--line); color: var(--ink-2); font-size: 0.84rem; }
.fact .icon { width: 15px; height: 15px; color: var(--accent); }

.status-hero { border-color: color-mix(in srgb, var(--lvl) 45%, transparent); background: linear-gradient(120deg, color-mix(in srgb, var(--lvl) 20%, #0d1b33) 0%, #0d1b33 48%, #0a1526 100%); }
.status-hero .hero-copy { display: flex; align-items: center; gap: 1.2rem; }
.status-text { display: grid; gap: 0.55rem; min-width: 0; justify-items: start; }
.status-orb {
  flex: none;
  display: grid; place-items: center; width: 84px; height: 84px; border-radius: 50%;
  color: var(--lvl);
  background: radial-gradient(circle, color-mix(in srgb, var(--lvl) 26%, transparent), color-mix(in srgb, var(--lvl) 6%, transparent));
  box-shadow: 0 0 0 1px color-mix(in srgb, var(--lvl) 55%, transparent), 0 0 0 9px color-mix(in srgb, var(--lvl) 9%, transparent);
}
.status-orb .icon { width: 38px; height: 38px; }
.status-hero h2 .level-word { color: var(--lvl); }

.level-summary { display: flex; flex-wrap: wrap; gap: 0.5rem; }
.level-count {
  display: inline-flex; align-items: center; gap: 0.5rem; min-height: 0;
  padding: 0.4rem 0.8rem; border-radius: 12px; font-size: 0.86rem; font-weight: 600;
  border: 1px solid color-mix(in srgb, var(--lvl) 40%, transparent); background: color-mix(in srgb, var(--lvl) 10%, transparent); color: var(--ink-2);
}
.level-count strong { font-family: var(--display); font-size: 1.15rem; color: var(--lvl); }
button.level-count:hover { background: color-mix(in srgb, var(--lvl) 20%, transparent); border-color: var(--lvl); }
button.level-count.is-on { box-shadow: 0 0 0 2px var(--lvl); }
button.level-count[data-filter-level="all"] { --lvl: var(--accent); }
.alert-list { list-style: none; padding: 0; display: grid; gap: 0.5rem; }
.more-notes > summary { color: var(--ink-2); }
.more-notes .disclosure-body { padding-top: 0.2rem; }
.alert-list li + li { margin-top: 0; }
.alert-item { border: 1px solid var(--line); border-left: 4px solid var(--lvl); border-radius: var(--radius-sm); background: rgba(8, 17, 32, 0.5); }
.alert-item summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.3rem 0.7rem; padding: 0.65rem 0.8rem; }
.alert-item summary:hover { background: rgba(148, 180, 222, 0.06); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }
.alert-glyph { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 9px; color: var(--lvl); background: color-mix(in srgb, var(--lvl) 14%, transparent); }
.alert-glyph .icon { width: 18px; height: 18px; }
.alert-title { font-weight: 600; min-width: 0; }
.alert-meta { display: flex; flex-wrap: wrap; align-items: center; justify-content: flex-end; gap: 0.4rem; }
.alert-body { display: grid; gap: 0.6rem; padding: 0.1rem 0.9rem 0.9rem 3.35rem; color: var(--ink-2); }
.tagged { display: grid; gap: 0.12rem; }
.tag { color: var(--muted); font-size: 0.68rem; font-weight: 650; letter-spacing: 0.1em; text-transform: uppercase; }
.verdict { display: flex; gap: 0.7rem; align-items: flex-start; padding: 0.85rem 1rem; border-radius: var(--radius-sm); border: 1px solid rgba(77, 219, 160, 0.4); background: rgba(77, 219, 160, 0.08); color: var(--ink-2); }
.verdict .icon { color: var(--ok); margin-top: 0.12rem; }

.alert-detail { border-left: 4px solid var(--lvl); display: grid; gap: 0.9rem; }
.alert-detail > * + * { margin-top: 0; }
.alert-detail > header, .alert-detail summary { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.5rem 0.8rem; align-items: center; }
.alert-detail summary { margin: -0.4rem; padding: 0.4rem; border-radius: var(--radius-sm); }
.alert-detail summary:hover { background: rgba(148, 180, 222, 0.06); }
.alert-detail-body { display: grid; gap: 0.9rem; margin-top: 1.1rem; }
.explain-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.7rem; }
.explain { padding: 0.75rem 0.9rem; border-radius: var(--radius-sm); background: rgba(8, 17, 32, 0.5); border: 1px solid var(--line); display: grid; gap: 0.25rem; align-content: start; color: var(--ink-2); }
.explain.next { grid-column: 1 / -1; border-color: color-mix(in srgb, var(--lvl) 40%, transparent); background: color-mix(in srgb, var(--lvl) 8%, transparent); }
.explain.wide { grid-column: 1 / -1; }
.reading-list { list-style: none; padding: 0; display: grid; gap: 0.3rem; font-size: 0.9rem; }
.reading-list li { display: flex; flex-wrap: wrap; gap: 0.2rem 0.7rem; justify-content: space-between; padding: 0.3rem 0; border-bottom: 1px dashed var(--line); margin: 0; }
.reading-list li:last-child { border-bottom: 0; }
.reading-list .muted { font-size: 0.82rem; }

.metric-grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
.metric { position: relative; overflow: hidden; padding: 0.95rem 1rem; display: grid; gap: 0.45rem; align-content: start; content-visibility: auto; contain-intrinsic-size: auto 180px; }
.metric > * + * { margin-top: 0; }
.metric::before { content: ""; position: absolute; inset: 0 auto 0 0; width: 4px; background: transparent; }
.metric[data-level="monitor"]::before, .metric[data-level="needs_review"]::before, .metric[data-level="urgent_review"]::before { background: var(--lvl); }
.metric[data-level="needs_review"], .metric[data-level="urgent_review"] { border-color: color-mix(in srgb, var(--lvl) 38%, transparent); }
.metric > header { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.2rem 0.65rem; align-items: center; }
.metric > header h3 { font-size: 0.92rem; font-weight: 600; color: var(--ink-2); }
.metric > header .level { grid-column: 2; justify-self: start; font-size: 0.7rem; padding: 0.08rem 0.5rem; }
.metric > header .icon-tile { grid-row: 1 / span 2; }
.metric[data-level="monitor"] .icon-tile, .metric[data-level="needs_review"] .icon-tile, .metric[data-level="urgent_review"] .icon-tile { color: var(--lvl); background: color-mix(in srgb, var(--lvl) 14%, transparent); }
.metric-value { font-family: var(--display); font-size: 2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.metric-value.is-empty { color: var(--muted); }
.metric-unit, .metric-value [data-field="unit"] { font-family: var(--sans); font-size: 0.86rem; font-weight: 500; color: var(--muted); letter-spacing: 0; }
.metric-base { display: flex; flex-wrap: wrap; align-items: center; gap: 0.3rem 0.5rem; color: var(--muted); font-size: 0.84rem; }
.delta { display: inline-flex; align-items: center; gap: 0.2rem; padding: 0.08rem 0.45rem; border-radius: 7px; background: rgba(148, 180, 222, 0.1); color: var(--ink-2); font-weight: 650; }
.delta .icon { width: 13px; height: 13px; }
.metric[data-level="monitor"] .delta, .metric[data-level="needs_review"] .delta, .metric[data-level="urgent_review"] .delta { color: var(--lvl); background: color-mix(in srgb, var(--lvl) 13%, transparent); }
.metric-foot { display: grid; gap: 0.1rem; padding-top: 0.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: 0.78rem; }
.metric-source { color: var(--ink-2); }
.stat-row { display: grid; gap: 0.7rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); list-style: none; padding: 0; }
.stat-row li + li { margin-top: 0; }
.stat { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.1rem 0.6rem; align-items: center; padding: 0.7rem 0.8rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(8, 17, 32, 0.5); margin: 0; list-style: none; }
.stat .icon-tile { grid-row: 1 / span 2; width: 34px; height: 34px; }
.stat-label { color: var(--muted); font-size: 0.78rem; }
.stat-value { font-family: var(--display); font-weight: 700; font-size: 1.05rem; }
.stat-value small { font-family: var(--sans); font-weight: 500; color: var(--muted); font-size: 0.78rem; }
.big-value { font-family: var(--display); font-size: 2.2rem; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; }
.big-value.is-empty { font-size: 1.05rem; font-weight: 600; color: var(--muted); letter-spacing: 0; }

.chart-grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.chart-card { min-width: 0; }
.chart-grid .chart-card { padding: 0.85rem 0.95rem; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(8, 17, 32, 0.5); display: grid; gap: 0.5rem; align-content: start; }
.chart-grid .chart-wide { grid-column: 1 / -1; }
.chart-card h3 { display: flex; align-items: center; gap: 0.5rem; }
.chart-card h3 .icon { width: 17px; height: 17px; }
.chart-box { position: relative; height: 210px; }
.chart-wide .chart-box { height: 240px; }
.chart-box canvas { position: absolute; inset: 0; }
.chart-empty { position: absolute; inset: 0; display: grid; place-items: center; color: var(--muted); font-size: 0.88rem; text-align: center; pointer-events: none; }
.swatch { width: 10px; height: 10px; border-radius: 3px; flex: none; background: var(--accent); }
.swatch.c-heart { background: #ff8fa3; }
.swatch.c-sleep { background: #8ea8ff; }
.swatch.c-mood { background: #fbbf4a; }
.swatch.c-activity { background: #4ddba0; }
.swatch.c-stress { background: #c79bff; }
.swatch.c-temp { background: #56d4f0; }

.checklist { list-style: none; padding: 0; display: grid; gap: 0.35rem; }
.checklist li { display: flex; align-items: center; gap: 0.6rem; padding: 0.45rem 0.6rem; border-radius: 9px; background: rgba(8, 17, 32, 0.45); margin: 0; }
.checklist .icon { color: var(--muted); width: 18px; height: 18px; }
.checklist .is-done .icon { color: var(--ok); }
.checklist .is-done span { color: var(--ink-2); }
.checklist small { margin-left: auto; color: var(--muted); font-size: 0.76rem; }
.check-row { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; align-items: center; gap: 0.8rem; padding: 0.7rem 0.8rem; margin: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); background: rgba(8, 17, 32, 0.45); }
.check-row + .check-row { margin-top: 0.5rem; }
.check-row .check-mark { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; border: 2px solid var(--line-strong); color: transparent; }
.check-row.is-done { border-color: rgba(77, 219, 160, 0.3); }
.check-row.is-done .check-mark { background: var(--ok); border-color: var(--ok); color: #05281a; }
.check-row .check-mark .icon { width: 16px; height: 16px; }
.check-row strong { display: block; }
.progress-line { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 0.7rem; align-items: center; color: var(--muted); font-size: 0.84rem; }
.timeline { list-style: none; padding: 0 0 0 1.1rem; margin: 0 0 0 0.35rem; border-left: 2px solid var(--line); display: grid; gap: 0.85rem; }
.timeline > li { position: relative; margin: 0; }
.timeline > li::before { content: ""; position: absolute; left: calc(-1.1rem - 6px); top: 0.3rem; width: 10px; height: 10px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--accent); }
.timeline time { display: block; font-weight: 650; font-size: 0.86rem; }
.timeline-items { list-style: none; padding: 0; margin: 0.25rem 0 0; display: grid; gap: 0.25rem; font-size: 0.88rem; color: var(--ink-2); }
.timeline-items li { display: flex; gap: 0.5rem; align-items: baseline; margin: 0; }
.timeline-items li::before { content: ""; flex: none; width: 7px; height: 7px; border-radius: 50%; background: var(--muted); transform: translateY(-1px); }
.timeline-items li[data-level]::before { background: var(--lvl); }
.scroll-area { max-height: 440px; overflow-y: auto; padding-right: 0.4rem; }
.scroll-area thead th { position: sticky; top: 0; z-index: 1; background: var(--surface-2); }
.split.wide-left { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); }
.cell-time { white-space: nowrap; color: var(--ink-2); font-size: 0.86rem; }
.day-bars { list-style: none; padding: 0; display: grid; gap: 0.45rem; }
.day-bars li { display: grid; grid-template-columns: 6.5rem minmax(0, 1fr) 7rem; gap: 0.8rem; align-items: center; margin: 0; font-size: 0.88rem; }
.day-bars span:last-child { color: var(--muted); text-align: right; }
.action-grid { display: grid; gap: 0.5rem; }
.action-link { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.75rem; align-items: center; padding: 0.6rem 0.75rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: rgba(8, 17, 32, 0.45); color: var(--ink); text-decoration: none; transition: background 0.15s ease, border-color 0.15s ease; }
.action-link:hover { background: rgba(86, 212, 240, 0.09); border-color: rgba(86, 212, 240, 0.4); color: var(--ink); }
.action-link strong { display: block; font-size: 0.92rem; }
.action-link small { color: var(--muted); font-size: 0.8rem; }
.action-link > .icon { color: var(--muted); }
.chip-list { display: flex; flex-wrap: wrap; gap: 0.4rem; list-style: none; padding: 0; }
.chip-list li { margin: 0; }
.chip { display: inline-flex; align-items: center; gap: 0.35rem; padding: 0.18rem 0.6rem; border-radius: 999px; border: 1px solid var(--line); background: rgba(148, 180, 222, 0.07); color: var(--ink-2); font-size: 0.78rem; }
code.chip { font-size: 0.72rem; }

.overview-row { display: grid; gap: 1rem; grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: stretch; }
.overview-row > .card { display: grid; gap: 0.7rem; align-content: start; }
.overview-row > .card > * + * { margin-top: 0; }
.device-id { font-family: var(--mono); font-size: 1.02rem; font-weight: 600; letter-spacing: 0; overflow-wrap: anywhere; }

.person-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
.person-card { border-top: 4px solid var(--lvl); display: grid; gap: 0.9rem; }
.person-card > * + * { margin-top: 0; }
.person-head { display: grid; grid-template-columns: auto minmax(0, 1fr) auto; gap: 0.85rem; align-items: center; }
.person-head h2 { font-size: 1.25rem; }
.mini-table { font-size: 0.88rem; }
.mini-table th, .mini-table td { padding: 0.42rem 0.55rem; }
.mini-table td:first-child { color: var(--ink-2); }
.mini-table td .icon { width: 15px; height: 15px; color: var(--muted); margin-right: 0.35rem; }

.public-body { min-height: 100vh; }
.public-wrap { width: min(1160px, calc(100% - 2rem)); margin: 0 auto; padding: 1.4rem 0 3rem; display: grid; gap: 1.25rem; }
.public-wrap > * { min-width: 0; }
.public-nav { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 0.6rem 1rem; }
.public-nav .brand { padding: 0; flex: none; }
.public-nav .brand small { white-space: nowrap; }
.landing-hero {
  position: relative; overflow: hidden;
  display: grid; grid-template-columns: minmax(0, 1.15fr) minmax(0, 0.85fr); gap: 1.5rem; align-items: center;
  padding: clamp(1.4rem, 3vw, 2.4rem); border-radius: 24px; border: 1px solid var(--line);
  background: linear-gradient(120deg, #142a52 0%, #0d1b33 55%, #0a1526 100%);
}
.landing-hero::after { content: ""; position: absolute; inset: 0; background: url("/img/login.jpg") right center / cover no-repeat; opacity: 0.22; -webkit-mask-image: linear-gradient(90deg, transparent 20%, #000 100%); mask-image: linear-gradient(90deg, transparent 20%, #000 100%); pointer-events: none; }
.landing-hero > * { position: relative; z-index: 1; }
.landing-copy { display: grid; gap: 0.9rem; }
.landing-copy h1 { font-size: clamp(2.2rem, 1.4rem + 3.4vw, 3.6rem); letter-spacing: 0.16em; line-height: 1; }
.landing-copy .lead { font-size: 1.12rem; color: var(--ink-2); max-width: 46ch; }
.entry-cards { display: grid; gap: 0.8rem; }
.entry-card { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.3rem 0.9rem; align-items: center; margin: 0; padding: 1rem; border-radius: var(--radius); border: 1px solid var(--line-strong); background: rgba(8, 17, 32, 0.92); }
.entry-card .icon-tile { grid-row: 1 / span 2; }
.entry-card p { color: var(--muted); font-size: 0.88rem; }
.entry-card button { grid-column: 1 / -1; margin-top: 0.5rem; width: 100%; min-height: 46px; font-size: 1rem; }
.credentials { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; color: var(--muted); font-size: 0.84rem; }
.steps { display: grid; gap: 0.85rem; grid-template-columns: repeat(4, minmax(0, 1fr)); list-style: none; padding: 0; margin: 0; counter-reset: step; }
.steps li { position: relative; margin: 0; padding: 1rem 1rem 1rem; border-radius: var(--radius); border: 1px solid var(--line); background: rgba(14, 26, 44, 0.8); display: grid; gap: 0.5rem; align-content: start; color: var(--ink-2); font-size: 0.92rem; counter-increment: step; }
.steps li::before { content: counter(step); display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: rgba(86, 212, 240, 0.14); color: var(--accent); font-weight: 700; font-family: var(--display); }

.body-layout { display: grid; grid-template-columns: minmax(280px, 0.9fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.body-stage { display: grid; gap: 0.75rem; }
.body-stage > * + * { margin-top: 0; }
.body-viewer { position: relative; height: min(64vh, 600px); min-height: 420px; border-radius: 14px; overflow: hidden; background: var(--well); border: 1px solid var(--line); touch-action: none; }
.body-viewer canvas { width: 100%; height: 100%; display: block; cursor: grab; }
.body-viewer canvas:active { cursor: grabbing; }
.body-viewer-note { position: absolute; left: 0.7rem; bottom: 0.6rem; right: 5.5rem; color: var(--muted); font-size: 0.78rem; pointer-events: none; }
.zoom-bar { position: absolute; right: 0.6rem; bottom: 0.6rem; z-index: 2; display: flex; gap: 0.35rem; }
.zoom-bar button { width: 38px; min-height: 38px; padding: 0; background: rgba(20, 35, 56, 0.9); }
.region-list { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.region-button { min-height: 36px; padding: 0.3rem 0.85rem; border-radius: 999px; background: rgba(148, 180, 222, 0.07); border-color: var(--line-strong); font-weight: 600; }
.region-button.active { background: rgba(86, 212, 240, 0.16); border-color: var(--accent); color: #fff; box-shadow: 0 0 0 1px var(--accent) inset; }
#region-panel { display: grid; gap: 0.8rem; align-content: start; }
#region-panel > * + * { margin-top: 0; }
.panel-section { display: grid; gap: 0.5rem; }
.reading-tile { display: grid; gap: 0.15rem; padding: 0.65rem 0.8rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: rgba(8, 17, 32, 0.5); }
.reading-tile strong { font-family: var(--display); font-size: 1.15rem; }
.reading-tile.is-empty strong { font-family: var(--sans); font-size: 0.92rem; font-weight: 500; color: var(--muted); }
.reading-tile small { color: var(--muted); font-size: 0.8rem; }
.reading-tiles { display: grid; gap: 0.55rem; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); }
.source-list { list-style: none; padding: 0; display: grid; gap: 0.45rem; }
.source-list li { margin: 0; padding: 0.6rem 0.8rem; border-left: 3px solid var(--accent-2); background: rgba(127, 156, 255, 0.07); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; color: var(--ink-2); }

.copilot-layout { display: grid; grid-template-columns: minmax(0, 0.9fr) minmax(0, 1.1fr); gap: 1rem; align-items: start; }
.prompt-row { display: flex; flex-wrap: wrap; gap: 0.4rem; }
.prompt { min-height: 34px; padding: 0.3rem 0.8rem; border-radius: 999px; font-size: 0.84rem; font-weight: 500; background: rgba(148, 180, 222, 0.07); text-align: left; }
#copilot-answer { min-height: 220px; display: grid; gap: 0.7rem; align-content: start; }
#copilot-answer > * + * { margin-top: 0; }
#copilot-answer p { white-space: pre-wrap; overflow-wrap: anywhere; }
.answer-text { padding: 0.9rem 1rem; border-radius: 4px 14px 14px 14px; background: rgba(86, 212, 240, 0.08); border: 1px solid rgba(86, 212, 240, 0.22); line-height: 1.6; }
#copilot-answer[aria-busy="true"] { background-image: linear-gradient(90deg, transparent, rgba(86, 212, 240, 0.1), transparent); background-size: 200% 100%; animation: shimmer 1.1s linear infinite; }
@keyframes shimmer { to { background-position: -200% 0; } }

.scenario-grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.scenario-form { display: grid; gap: 0.55rem; align-content: start; grid-template-rows: auto 1fr auto auto; margin: 0; padding: 1rem; border: 1px solid var(--line); border-radius: var(--radius); background: rgba(8, 17, 32, 0.5); transition: border-color 0.15s ease; }
.scenario-form:hover { border-color: rgba(86, 212, 240, 0.4); }
.scenario-form h3 { display: flex; align-items: center; gap: 0.55rem; }
.scenario-form p { color: var(--ink-2); font-size: 0.9rem; }
.scenario-form button { width: 100%; }
#analysis-panel { display: grid; gap: 0.7rem; }
#analysis-panel > * + * { margin-top: 0; }
#analysis-panel article { padding: 0.75rem 0.9rem; border-radius: var(--radius-sm); border: 1px solid var(--line); border-left: 4px solid var(--warn); background: rgba(8, 17, 32, 0.5); display: grid; gap: 0.3rem; color: var(--ink-2); }
#analysis-panel article[data-level] { border-left-color: var(--lvl); }
#analysis-panel article h3 { color: var(--ink); }

.fact-grid { display: grid; gap: 0.7rem; grid-template-columns: repeat(2, minmax(0, 1fr)); list-style: none; padding: 0; }
.fact-grid li { margin: 0; display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 0.2rem 0.7rem; padding: 0.75rem 0.85rem; border-radius: var(--radius-sm); background: rgba(5, 11, 21, 0.4); border: 1px solid var(--line); font-size: 0.9rem; color: var(--ink-2); }
.fact-grid .icon-tile { grid-row: 1 / span 2; width: 34px; height: 34px; }
.fact-grid strong { color: var(--ink); }
.source-grid { display: grid; gap: 0.85rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.source-card { display: grid; gap: 0.5rem; align-content: start; }
.source-card > * + * { margin-top: 0; }
.source-card h2 { font-size: 1.05rem; }
.source-card h2 a { text-decoration: none; color: var(--ink); display: inline-flex; gap: 0.4rem; align-items: baseline; }
.source-card h2 a:hover { color: var(--accent); }
.source-card h2 .icon { width: 15px; height: 15px; color: var(--muted); }
.source-card p { color: var(--ink-2); font-size: 0.92rem; }
.hazard-list { display: grid; gap: 0.6rem; }
.hazard { padding: 0.8rem 0.95rem; border-radius: var(--radius-sm); border: 1px solid var(--line); background: rgba(8, 17, 32, 0.5); display: grid; gap: 0.3rem; color: var(--ink-2); }
.hazard h3 { color: var(--ink); }

.report-grid { display: grid; gap: 1rem; grid-template-columns: repeat(2, minmax(0, 1fr)); }
.report-option { display: grid; gap: 0.8rem; align-content: start; margin: 0; }
.report-option > * + * { margin-top: 0; }
.report-option header { display: flex; gap: 0.8rem; align-items: center; }
.report-sheet header.row { align-items: flex-start; }
.crumb { color: var(--muted); font-size: 0.86rem; display: flex; gap: 0.4rem; align-items: center; text-transform: capitalize; }
.token-box { display: block; padding: 0.6rem 0.8rem; border-radius: var(--radius-sm); background: #050b15; border: 1px dashed var(--line-strong); font-size: 0.9rem; user-select: all; }

.auth-body { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 1rem; }
.auth-frame { width: min(520px, 100%); margin: 0; padding: 2rem; border-radius: 20px; border: 1px solid var(--line); background: linear-gradient(180deg, rgba(20, 35, 56, 0.92), rgba(14, 26, 44, 0.92)); display: grid; gap: 0.8rem; justify-items: start; }
.auth-frame .status-code { font-family: var(--display); font-size: 3.2rem; font-weight: 700; line-height: 1; color: var(--accent); }
.auth-frame p { color: var(--ink-2); }
.auth-stage { display: grid; grid-template-columns: minmax(0, 1fr) min(440px, 92vw); min-height: 100vh; }
.auth-visual { position: relative; overflow: hidden; }
.auth-visual img { position: absolute; inset: 0; width: 100%; height: 100%; max-width: none; object-fit: cover; object-position: left center; }
.auth-panel { display: flex; flex-direction: column; justify-content: center; gap: 1rem; padding: 2rem 1.4rem; }
.auth-stack { display: grid; gap: 1rem; }
.auth-brandline { display: flex; align-items: center; gap: 0.75rem; }
.auth-mark { width: 44px; height: 44px; border-radius: 13px; }
.auth-copy { display: grid; gap: 0.6rem; }
.auth-copy h1 { letter-spacing: 0.18em; }
.auth-copy p:last-child, .auth-kicker { color: var(--muted); }
.demo-box { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0.8rem 0.9rem; background: rgba(8, 17, 32, 0.5); color: var(--muted); font-size: 0.86rem; display: grid; gap: 0.4rem; }

@media (min-width: 901px) {
  body.sidebar-collapsed { --sidebar: 76px; }
  body.sidebar-collapsed .brand-copy,
  body.sidebar-collapsed .nav-label,
  body.sidebar-collapsed .logout-label,
  body.sidebar-collapsed .collapse-label,
  body.sidebar-collapsed .user-copy { display: none; }
  body.sidebar-collapsed .nav-group { height: 1px; margin: 0.55rem 0.5rem; padding: 0; overflow: hidden; background: var(--line); color: transparent; }
  body.sidebar-collapsed .nav-group:first-child { display: none; }
  body.sidebar-collapsed .sidebar nav a,
  body.sidebar-collapsed .brand,
  body.sidebar-collapsed .user-card { justify-content: center; padding-inline: 0; }
  body.sidebar-collapsed .sidebar-actions { grid-template-columns: 1fr; }
  body.sidebar-collapsed .sidebar-top { justify-content: center; }
  body.sidebar-collapsed .collapse-button .icon { transform: rotate(180deg); }
}
@media (max-width: 1180px) {
  .overview-row { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .overview-row > .card:last-child { grid-column: 1 / -1; }
  .overview-row > .card:last-child .action-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .steps { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}
@media (max-width: 1020px) {
  .body-layout, .copilot-layout { grid-template-columns: minmax(0, 1fr); }
  .body-viewer { height: 52vh; }
}
@media (max-width: 900px) {
  .shell { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: fixed; left: 0; top: 0; width: min(290px, 86vw); transform: translateX(-105%); visibility: hidden; transition: transform 0.22s ease, visibility 0s linear 0.22s; box-shadow: var(--shadow); }
  body.sidebar-open .sidebar { transform: none; visibility: visible; transition-delay: 0s; }
  .sidebar-close { display: inline-flex; }
  body.sidebar-open .scrim { display: block; position: fixed; inset: 0; z-index: 11; min-height: 0; padding: 0; border: 0; border-radius: 0; background: rgba(2, 6, 12, 0.62); cursor: pointer; }
  .menu-button { display: inline-flex; }
  .collapse-button { display: none; }
  .sidebar-actions { grid-template-columns: 1fr; }
  .landing-hero { grid-template-columns: minmax(0, 1fr); }
  .person-grid, .source-grid, .report-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 760px) {
  .grid-2, .grid-3, .split, .split.wide-left, .chart-grid, .explain-grid, .overview-row, .fact-grid { grid-template-columns: minmax(0, 1fr); }
  .overview-row > .card:last-child .action-grid { grid-template-columns: minmax(0, 1fr); }
  .page-hero, .status-hero { grid-template-columns: minmax(0, 1fr); min-height: 0; }
  .hero-art { display: none; }
  .hero-copy { padding: 1.1rem 1.1rem; }
  .status-hero .hero-copy { align-items: flex-start; gap: 0.85rem; }
  .status-orb { width: 56px; height: 56px; }
  .status-orb .icon { width: 26px; height: 26px; }
  .topbar .eyebrow { display: none; }
  .top-tools .clock { display: none; }
  .crew-switch { margin-left: 0; width: 100%; }
  .crew-switch select { flex: 1; }
  .alert-item summary { grid-template-columns: auto minmax(0, 1fr); }
  .alert-meta { grid-column: 1 / -1; justify-content: flex-start; padding-left: 2.7rem; }
  .alert-body { padding-left: 0.9rem; }
  .alert-detail > header, .alert-detail summary { grid-template-columns: auto minmax(0, 1fr); }
  .alert-detail > header .alert-meta, .alert-detail summary .alert-meta { padding-left: 0; }
  .day-bars li { grid-template-columns: 5.6rem minmax(0, 1fr); }
  .day-bars span:last-child { grid-column: 1 / -1; text-align: left; margin-top: -0.3rem; }
  .auth-stage { display: block; }
  .auth-visual { height: 30vh; min-height: 200px; }
}
@media (max-width: 560px) {
  .form-grid, fieldset, .steps { grid-template-columns: minmax(0, 1fr); }
  .metric-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.6rem; }
  .metric { padding: 0.8rem 0.8rem; }
  .metric-value { font-size: 1.6rem; }
  .metric > header .icon-tile { width: 32px; height: 32px; grid-row: auto; }
  .metric > header .level { grid-column: 1 / -1; }
  .card { padding: 0.95rem 0.95rem; }
  .top-tools { display: none; }
  .topbar-title h1 { overflow-wrap: break-word; }
  .check-row { grid-template-columns: auto minmax(0, 1fr); }
  .check-row button { grid-column: 1 / -1; }
  .person-head { grid-template-columns: auto minmax(0, 1fr); }
  .person-head .level { grid-column: 1 / -1; justify-self: start; }
  th, td { padding: 0.5rem 0.5rem; }
  .toasts { left: 1rem; }
  .toast { max-width: none; }
}
@media (max-width: 380px) {
  .metric-grid { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  html { scroll-behavior: auto; }
}
@media print {
  .sidebar, .topbar, .context-bar, .menu-button, .toasts, .auth-visual, .hero-art, .scrim, .page-foot, .banner, button, .button { display: none !important; }
  .shell, .auth-stage { display: block; }
  .scroll-area { max-height: none; overflow: visible; }
  .scroll-area thead th { position: static; }
  body { background: #fff; color: #000; }
  main { padding: 0; max-width: none; }
  .card, .page-hero, .status-hero { background: #fff; border-color: #bbb; box-shadow: none; break-inside: avoid; }
  .muted, .form-note, .hint, th, .eyebrow, .tag, .crumb { color: #333; }
  .hero-copy p { color: #000; }
  a { color: #000; }
}
