:root {
  color-scheme: dark;
  --bg: #050b14;
  --bg-raised: #081321;
  --panel: rgba(13, 27, 45, .9);
  --panel-solid: #0d1b2d;
  --panel-soft: #10243a;
  --line: rgba(154, 180, 209, .16);
  --line-strong: rgba(154, 180, 209, .3);
  --text: #eef6ff;
  --muted: #93a9c1;
  --faint: #6f849c;
  --cyan: #43d8e6;
  --cyan-strong: #10b8cc;
  --blue: #5a8cff;
  --green: #44d39a;
  --amber: #f1b85b;
  --red: #f2778e;
  --shadow: 0 24px 70px rgba(0, 0, 0, .34);
  --radius: 20px;
  --radius-small: 12px;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

:root.light {
  color-scheme: light;
  --bg: #edf3f8;
  --bg-raised: #f7fafc;
  --panel: rgba(255, 255, 255, .92);
  --panel-solid: #fff;
  --panel-soft: #f0f5f8;
  --line: rgba(21, 56, 78, .13);
  --line-strong: rgba(21, 56, 78, .25);
  --text: #102437;
  --muted: #526b80;
  --faint: #718697;
  --shadow: 0 22px 60px rgba(32, 65, 91, .16);
}

* { box-sizing: border-box; }
html { min-width: 320px; background: var(--bg); scroll-behavior: smooth; }
body { margin: 0; min-height: 100vh; background: radial-gradient(circle at 75% -15%, rgba(43, 172, 207, .16), transparent 37%), var(--bg); color: var(--text); }
button, input, textarea { font: inherit; }
button { color: inherit; }
button, a, input, textarea { outline-offset: 3px; }
:focus-visible { outline: 2px solid var(--cyan); }
[hidden] { display: none !important; }

.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; }
.skip-link { position: fixed; z-index: 100; top: 8px; left: 8px; transform: translateY(-150%); padding: .7rem 1rem; border-radius: 9px; background: var(--cyan); color: #031014; font-weight: 800; }
.skip-link:focus { transform: translateY(0); }
.eyebrow { margin: 0 0 .55rem; color: var(--cyan); font-size: .72rem; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }

.boot { min-height: 100vh; display: grid; place-content: center; justify-items: center; gap: 1rem; color: var(--muted); }
.boot__mark, .brand-mark { display: grid; place-items: center; width: 78px; height: 78px; border: 1px solid rgba(67,216,230,.42); border-radius: 24px 9px 24px 9px; background: linear-gradient(145deg, rgba(67,216,230,.2), rgba(90,140,255,.12)); color: var(--text); font-weight: 900; letter-spacing: .1em; box-shadow: inset 0 0 28px rgba(67,216,230,.09), 0 14px 40px rgba(0,0,0,.2); }
.brand-mark--small { width: 46px; height: 46px; border-radius: 15px 6px 15px 6px; font-size: .72rem; }

.login { min-height: 100vh; display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(390px, .75fr); }
.login__brand { min-height: 100vh; padding: clamp(2.2rem, 7vw, 7.5rem); display: flex; flex-direction: column; justify-content: center; background: linear-gradient(120deg, rgba(4,12,22,.52), rgba(4,12,22,.08)); }
.login__brand h1 { max-width: 760px; margin: .5rem 0 1rem; font-size: clamp(2.7rem, 6vw, 6.2rem); line-height: .94; letter-spacing: -.055em; }
.login__lead { max-width: 650px; color: var(--muted); font-size: clamp(1rem, 1.5vw, 1.25rem); line-height: 1.7; }
.assurance-list { display: grid; gap: .8rem; max-width: 620px; margin: 3rem 0 0; padding: 0; list-style: none; }
.assurance-list li { display: flex; align-items: center; gap: .9rem; color: var(--muted); }
.assurance-list span { display: grid; place-items: center; width: 34px; height: 34px; border: 1px solid var(--line-strong); border-radius: 50%; color: var(--cyan); font-size: .68rem; font-weight: 800; }
.login__panel { align-self: center; margin: 2rem clamp(2rem, 5vw, 5rem) 2rem 0; padding: clamp(1.8rem, 4vw, 3rem); border: 1px solid var(--line); border-radius: 28px; background: var(--panel); box-shadow: var(--shadow); backdrop-filter: blur(20px); }
.login__panel h2 { margin: 0; font-size: clamp(1.7rem, 3vw, 2.5rem); letter-spacing: -.035em; }
.login__panel > div > p:not(.eyebrow) { color: var(--muted); line-height: 1.6; }
.login__panel form { display: grid; gap: 1rem; margin: 2rem 0; }
label { display: grid; gap: .48rem; color: var(--muted); font-size: .82rem; font-weight: 700; }
input, textarea { width: 100%; border: 1px solid var(--line-strong); border-radius: 11px; background: rgba(3,10,18,.38); color: var(--text); padding: .78rem .9rem; }
:root.light input, :root.light textarea { background: rgba(255,255,255,.72); }
input:focus, textarea:focus { border-color: var(--cyan); box-shadow: 0 0 0 3px rgba(67,216,230,.11); }
.form-error { margin: 0; color: var(--red); font-size: .85rem; }

.button, .icon-button, .user-chip, .nav-item, .capability-row { border: 0; cursor: pointer; }
.button { min-height: 44px; padding: .72rem 1rem; border-radius: 11px; font-weight: 800; }
.button--primary { background: linear-gradient(135deg, var(--cyan-strong), var(--blue)); color: #fff; box-shadow: 0 10px 24px rgba(16,184,204,.2); }
.button--primary:hover { filter: brightness(1.08); transform: translateY(-1px); }
.button--primary:disabled { cursor: not-allowed; filter: grayscale(.7); opacity: .48; transform: none; }
.button--quiet { background: var(--panel-soft); color: var(--text); }
.icon-button { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 11px; background: transparent; font-size: 1.15rem; }
.icon-button:hover { background: var(--panel-soft); }

.shell { min-height: 100vh; display: grid; grid-template-columns: 292px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: grid; grid-template-rows: auto auto minmax(0,1fr) auto; border-right: 1px solid var(--line); background: rgba(5,13,24,.93); backdrop-filter: blur(20px); z-index: 30; }
:root.light .sidebar { background: rgba(247,250,252,.94); }
.sidebar__brand { display: flex; align-items: center; gap: .85rem; padding: 1.2rem; }
.sidebar__brand > span:nth-child(2) { display: grid; gap: .05rem; }
.sidebar__brand strong { letter-spacing: .05em; }
.sidebar__brand small, .sidebar__status small { color: var(--faint); }
.sidebar__close { display: none; margin-left: auto; }
.nav-search { padding: 0 1rem 1rem; }
.nav-search input { min-height: 41px; background: var(--panel-soft); }
.navigation { overflow: auto; padding: 0 .75rem 1rem; scrollbar-color: var(--line-strong) transparent; }
.nav-group { margin: 0 0 1.15rem; }
.nav-group__title { margin: 0 0 .42rem; padding: 0 .65rem; color: var(--faint); font-size: .66rem; letter-spacing: .13em; text-transform: uppercase; }
.nav-item { width: 100%; display: grid; grid-template-columns: 32px minmax(0,1fr); align-items: center; gap: .62rem; padding: .66rem; border-radius: 10px; background: transparent; text-align: left; }
.nav-item:hover { background: rgba(67,216,230,.07); }
.nav-item[aria-current="page"] { background: linear-gradient(110deg, rgba(67,216,230,.15), rgba(90,140,255,.08)); box-shadow: inset 3px 0 0 var(--cyan); }
.nav-item__icon { display: grid; place-items: center; width: 31px; height: 31px; border: 1px solid var(--line); border-radius: 9px; color: var(--cyan); font-size: .72rem; font-weight: 900; }
.nav-item__copy { min-width: 0; display: grid; gap: .12rem; }
.nav-item__copy strong { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: .84rem; }
.nav-item__copy small { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--faint); font-size: .68rem; }
.sidebar__status { display: flex; align-items: center; gap: .7rem; margin: .8rem; padding: .85rem; border: 1px solid var(--line); border-radius: 12px; background: var(--panel-soft); }
.sidebar__status > span:last-child { display: grid; }
.status-dot { width: 9px; height: 9px; border-radius: 50%; background: var(--green); box-shadow: 0 0 0 5px rgba(68,211,154,.1); }

.workspace { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .8rem clamp(1rem,3vw,2.2rem); border-bottom: 1px solid var(--line); background: rgba(5,11,20,.78); backdrop-filter: blur(18px); }
:root.light .topbar { background: rgba(237,243,248,.83); }
.topbar__menu { display: none; }
.topbar__context { display: grid; }
.topbar__context .eyebrow { margin: 0; font-size: .62rem; }
.topbar__context strong { font-size: .96rem; }
.topbar__actions { position: relative; display: flex; align-items: center; gap: .45rem; }
.user-chip { display: flex; align-items: center; gap: .65rem; min-height: 46px; padding: .35rem .6rem .35rem .35rem; border-radius: 13px; background: var(--panel-soft); text-align: left; }
.user-chip > span:first-child { display: grid; place-items: center; width: 35px; height: 35px; border-radius: 10px; background: linear-gradient(135deg,var(--cyan-strong),var(--blue)); color: #fff; font-size: .72rem; font-weight: 900; }
.user-chip > span:last-child { display: grid; }
.user-chip small { color: var(--faint); font-size: .66rem; }
.user-popover { position: absolute; right: 0; top: 54px; width: min(310px, 80vw); padding: 1rem; border: 1px solid var(--line); border-radius: 14px; background: var(--panel-solid); box-shadow: var(--shadow); }
.user-popover p { overflow-wrap: anywhere; color: var(--muted); font-size: .78rem; line-height: 1.5; }
.user-popover .button { width: 100%; }

.content { padding: clamp(1.2rem,3vw,2.5rem); }
.screen-hero { display: flex; align-items: flex-start; justify-content: space-between; gap: 2rem; margin-bottom: 1.5rem; }
.screen-hero h1 { margin: 0; font-size: clamp(2rem,4vw,3.9rem); line-height: 1; letter-spacing: -.05em; }
.screen-hero__description { max-width: 700px; margin: .9rem 0 0; color: var(--muted); line-height: 1.65; }
.badge-row { display: flex; flex-wrap: wrap; justify-content: flex-end; gap: .5rem; }
.badge { display: inline-flex; align-items: center; min-height: 28px; padding: .3rem .62rem; border: 1px solid var(--line); border-radius: 999px; background: var(--panel-soft); color: var(--muted); font-size: .67rem; font-weight: 800; letter-spacing: .025em; }
.badge--success { border-color: rgba(68,211,154,.28); background: rgba(68,211,154,.1); color: var(--green); }
.badge--accent { border-color: rgba(67,216,230,.3); background: rgba(67,216,230,.1); color: var(--cyan); }
.badge--warning { border-color: rgba(241,184,91,.28); background: rgba(241,184,91,.1); color: var(--amber); }
.badge--info { border-color: rgba(90,140,255,.28); background: rgba(90,140,255,.1); color: #8dabff; }

.metric-grid { display: grid; grid-template-columns: repeat(4,minmax(0,1fr)); gap: .85rem; margin-bottom: .85rem; }
.metric-card { min-width: 0; display: grid; gap: .35rem; padding: 1.15rem; border: 1px solid var(--line); border-radius: var(--radius-small); background: linear-gradient(145deg, rgba(16,36,58,.84), rgba(10,24,41,.84)); }
:root.light .metric-card { background: linear-gradient(145deg,#fff,#f4f8fb); }
.metric-card span { color: var(--muted); font-size: .72rem; font-weight: 700; }
.metric-card strong { font-size: clamp(1.45rem,3vw,2.2rem); letter-spacing: -.04em; }
.metric-card small { overflow: hidden; text-overflow: ellipsis; color: var(--faint); white-space: nowrap; }
.screen-grid { display: grid; grid-template-columns: minmax(0,1.8fr) minmax(280px,.7fr); gap: .85rem; }
.panel { border: 1px solid var(--line); border-radius: var(--radius); background: var(--panel); box-shadow: 0 12px 36px rgba(0,0,0,.11); overflow: hidden; }
.panel__header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: 1.15rem 1.25rem; border-bottom: 1px solid var(--line); }
.panel h2 { margin: 0; font-size: 1.1rem; letter-spacing: -.02em; }
.panel .eyebrow { margin-bottom: .2rem; }
.compact-search input { width: min(230px,28vw); min-height: 38px; padding: .55rem .7rem; background: var(--panel-soft); }
.capability-list { max-height: 600px; overflow: auto; }
.capability-row { width: 100%; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1.25rem; border-bottom: 1px solid var(--line); background: transparent; text-align: left; }
.capability-row:last-child { border-bottom: 0; }
.capability-row:hover { background: rgba(67,216,230,.055); }
.capability-row__copy { min-width: 0; display: grid; gap: .22rem; }
.capability-row__copy strong { overflow: hidden; text-overflow: ellipsis; color: var(--text); font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: .78rem; white-space: nowrap; }
.capability-row__copy small { color: var(--faint); }
.evidence { padding: 1.25rem; }
.evidence dl { display: grid; grid-template-columns: auto minmax(0,1fr); gap: .7rem .9rem; margin: 1.2rem 0; }
.evidence dt { color: var(--faint); font-size: .72rem; }
.evidence dd { margin: 0; overflow-wrap: anywhere; color: var(--muted); font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: .72rem; text-align: right; }
.truth-note, .empty-state { margin: 1rem; padding: .85rem; border: 1px solid rgba(241,184,91,.22); border-radius: 11px; background: rgba(241,184,91,.07); color: var(--muted); font-size: .76rem; line-height: 1.55; }
.evidence .truth-note { margin: 1rem 0 0; }

.process-dialog { width: min(760px,calc(100vw - 2rem)); max-height: calc(100vh - 2rem); padding: 0; border: 1px solid var(--line-strong); border-radius: 22px; background: var(--panel-solid); color: var(--text); box-shadow: var(--shadow); }
.process-dialog::backdrop { background: rgba(0,5,11,.76); backdrop-filter: blur(7px); }
.dialog__frame { display: grid; gap: 1rem; padding: 1.25rem; }
.dialog__header { display: flex; align-items: center; justify-content: space-between; gap: 1rem; }
.dialog__header h2 { max-width: 600px; margin: 0; overflow-wrap: anywhere; font-size: 1.25rem; }
.dialog__message { margin: 0; color: var(--muted); font-size: .8rem; }
details { border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
summary { cursor: pointer; padding: .7rem .8rem; color: var(--muted); font-weight: 700; }
pre { max-height: 260px; margin: 0; padding: .9rem; overflow: auto; background: rgba(3,9,16,.38); color: #b9d9ec; font-family: ui-monospace,SFMono-Regular,Menlo,monospace; font-size: .72rem; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
:root.light pre { background: #edf3f7; color: #25445b; }
.dialog__actions { display: flex; justify-content: flex-end; gap: .65rem; }
.nav-scrim { position: fixed; inset: 0; z-index: 25; background: rgba(0,5,11,.66); }
.screen-loading { padding: 1rem; color: var(--muted); }

@media (max-width: 1120px) {
  .shell { grid-template-columns: 252px minmax(0,1fr); }
  .metric-grid { grid-template-columns: repeat(2,minmax(0,1fr)); }
  .screen-grid { grid-template-columns: 1fr; }
}

@media (max-width: 820px) {
  .login { grid-template-columns: 1fr; }
  .login__brand { min-height: auto; padding: 2rem 1.2rem 1rem; }
  .login__brand h1 { font-size: clamp(2.5rem,13vw,4.8rem); }
  .assurance-list { display: none; }
  .login__panel { margin: 1rem; }
  .shell { display: block; }
  .sidebar { position: fixed; left: 0; top: 0; width: min(310px,88vw); transform: translateX(-105%); transition: transform .2s ease; box-shadow: var(--shadow); }
  .sidebar--open { transform: translateX(0); }
  .sidebar__close, .topbar__menu { display: grid; }
  .topbar { padding: .7rem .9rem; }
  .user-chip > span:last-child { display: none; }
  .content { padding: 1rem; }
  .screen-hero { display: grid; gap: 1rem; }
  .screen-hero .badge-row { justify-content: flex-start; }
}

@media (max-width: 520px) {
  .metric-grid { grid-template-columns: 1fr 1fr; }
  .metric-card { padding: .9rem; }
  .panel__header { align-items: stretch; flex-direction: column; }
  .compact-search input { width: 100%; }
  .capability-row { align-items: flex-start; flex-direction: column; }
  .evidence dl { grid-template-columns: 1fr; }
  .evidence dd { text-align: left; }
  .dialog__actions { flex-direction: column-reverse; }
  .dialog__actions .button { width: 100%; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; transition-duration: .001ms !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; }
}
