:root {
  color-scheme: dark;
  font-family: "Segoe UI", system-ui, sans-serif;
  line-height: 1.5;
  color: #eff3ff;
  background: #0a0d17;
  --surface: #111626;
  --raised: #171d30;
  --line: #2a334b;
  --muted: #a4aec6;
  --accent: #9c8bff;
  --ink: #eff3ff;
}
* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-height: 100vh; }
header {
  position: sticky; top: 0; z-index: 2;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  min-height: 66px; padding: 10px clamp(16px, 4vw, 48px);
  background: #0e1220; border-bottom: 1px solid var(--line);
}
.brand, .header-controls { display: flex; align-items: center; gap: 12px; }
.brand { font-weight: 750; white-space: nowrap; letter-spacing: -.02em; }
.mark {
  display: grid; place-items: center; width: 35px; height: 35px; border-radius: 11px;
  background: linear-gradient(140deg, #b5a8ff, #7458ec); color: #110e24;
  box-shadow: 0 0 24px #8b74ff50;
}
.header-controls { flex-wrap: wrap; justify-content: flex-end; }
.header-controls select { width: auto; }
main { max-width: 1536px; margin: auto; padding: 24px clamp(14px, 3vw, 42px) 64px; }
#dashboard { display: grid; grid-template-columns: 180px minmax(0, 1fr); gap: 24px; }
.dashboard-main { min-width: 0; }
.sidebar { position: sticky; top: 90px; align-self: start; }
nav { display: grid; gap: 6px; }
nav button {
  width: 100%; text-align: left; color: var(--muted); background: transparent;
  padding: 11px 13px; border: 1px solid transparent;
}
nav button:hover { background: var(--raised); color: var(--ink); }
nav button[aria-pressed=true] {
  background: #221d42; border-color: #544787; color: #e6dfff;
  box-shadow: inset 2px 0 var(--accent);
}
.overview {
  position: relative; overflow: hidden; padding: clamp(18px, 3vw, 36px);
  border: 1px solid #39345e; border-radius: 22px;
  background: radial-gradient(ellipse at 95% 0%, #433183 0%, transparent 60%), #17162b;
}
.overview::before {
  content: ""; position: absolute; inset: 0; pointer-events: none;
  background-image: linear-gradient(#a394f61a 1px, transparent 1px), linear-gradient(90deg, #a394f61a 1px, transparent 1px);
  background-size: 32px 32px;
  mask-image: linear-gradient(115deg, transparent 30%, #000 100%);
}
.overview > * { position: relative; }
#organization-name { color: #c9bfff; font-weight: 600; }
#organization-name:empty { display: none; }
#license-info { color: var(--muted); font-size: .85rem; }
.overview-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin: 16px 0 0; }
.overview-metrics > div { min-width: 0; padding: 12px; border: 1px solid #69618c80; border-radius: 12px; background: #111426b5; }
.overview-metrics dt { color: #c7c1dd; font-size: .82rem; overflow-wrap: anywhere; }
.overview-metrics dd { margin: 2px 0 0; font-weight: 750; font-variant-numeric: tabular-nums; font-size: 1.65rem; }
h1, h2, h3, p { margin: 0 0 12px; overflow-wrap: anywhere; }
h1 { margin-bottom: 0; font-size: clamp(1.65rem, 4vw, 2.75rem); line-height: 1.12; letter-spacing: -.05em; }
h2 { font-size: 1.16rem; letter-spacing: -.025em; }
h3 { font-size: 1rem; }
.heading, .item-head, .actions { display: flex; align-items: start; justify-content: space-between; gap: 8px; }
.actions { justify-content: start; flex-wrap: wrap; }
.panel { display: grid; grid-template-columns: minmax(240px, .85fr) minmax(0, 1.15fr); gap: 18px; align-items: start; }
.panel > * { min-width: 0; }
.card, .item { min-width: 0; border: 1px solid var(--line); border-radius: 15px; background: var(--surface); padding: 19px; }
.item:hover { border-color: #424f6c; }
#guardian-controls { margin-bottom: 20px; }
#guardian-controls .actions { gap: 8px; }
#emergency-stop { color: #ffc0c8; border-color: #663746; }
#dispatch-notice { margin-bottom: 14px; background: #35232d; color: #ffd6dd; }
.login { max-width: 440px; margin: clamp(36px, 12vh, 120px) auto; padding: clamp(22px, 5vw, 36px); box-shadow: 0 0 90px #775ded28; }
.login h1 { margin-bottom: 22px; }
.list { display: grid; gap: 10px; }
label, form { display: grid; gap: 8px; }
form { gap: 14px; }
label { font-size: .88rem; font-weight: 650; }
button, input, select, textarea { font: inherit; border-radius: 8px; }
input, select, textarea {
  border: 1px solid #39445e; padding: 9px 11px; background: #0c1120;
  color: var(--ink); min-width: 0; width: 100%;
}
textarea { min-height: 100px; resize: vertical; }
button {
  width: fit-content; background: var(--accent); border: 1px solid transparent; color: #160f31;
  padding: 8px 13px; font-weight: 700; cursor: pointer; transition: background-color .16s, border-color .16s;
}
button:hover { background: #b1a3ff; }
button:disabled { opacity: .57; cursor: default; }
.heading button, header button, .secondary { background: var(--raised); color: var(--ink); border: 1px solid var(--line); }
.heading button:hover, header button:hover, .secondary:hover { background: #232d47; border-color: #5a6787; }
:where(button, input, textarea, select, a, summary):focus-visible { outline: 2px solid #c2b7ff; outline-offset: 3px; }
a { color: #c0b3ff; }
.pair { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.check { display: flex; align-items: flex-start; gap: 8px; }
.check input { width: auto; margin-top: 4px; accent-color: var(--accent); }
.workspace-card { margin-top: 16px; }
.tag { background: #262143; color: #dfd5ff; border-radius: 99px; padding: 3px 9px; font-size: .8rem; }
small, .muted { color: var(--muted); }
details { margin-top: 10px; }
summary { cursor: pointer; }
pre { white-space: pre-wrap; overflow-wrap: anywhere; background: #0b101e; padding: 12px; border: 1px solid var(--line); border-radius: 8px; }
#login-error, #message { color: #f1b5c4; }
#login-error:empty, #message:empty { margin-bottom: 0; }
#message { min-height: 1.45em; margin-top: 6px; }
#audit-filter { margin-top: 14px; align-items: center; }
#audit-actor { width: min(100%, 280px); }
#guardian-audit { overflow-wrap: anywhere; }
#organization-budget form { margin-top: 8px; }
@media (max-width: 1040px) {
  #dashboard { grid-template-columns: 142px minmax(0, 1fr); gap: 14px; }
}
@media (max-width: 820px) {
  #dashboard { grid-template-columns: minmax(0, 1fr); }
  .sidebar { position: static; }
  nav { display: flex; flex-wrap: wrap; }
  nav button { width: auto; padding: 8px 10px; }
}
@media (max-width: 650px) {
  .panel { grid-template-columns: minmax(0, 1fr); }
  .overview-metrics { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  header { position: static; gap: 8px; }
  .header-controls { gap: 6px; }
}
@media (max-width: 360px) {
  .pair { grid-template-columns: minmax(0, 1fr); }
}
@media (prefers-reduced-motion: reduce) {
  button { transition: none; }
}
