:root {
  --bg: #080a0c;
  --panel: #101419;
  --panel-raised: #151a20;
  --panel-soft: #0c0f13;
  --line: #283039;
  --line-soft: #1c2229;
  --text: #f2f5f7;
  --muted: #8a949f;
  --quiet: #5f6974;
  --lime: #c9f36b;
  --lime-dim: #78983d;
  --cyan: #72d4e8;
  --amber: #f0bd62;
  --red: #ee7c73;
  --mono: "SFMono-Regular", Consolas, "Liberation Mono", monospace;
  --sans: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html { background: var(--bg); color: var(--text); font-family: var(--sans); }
body { margin: 0; min-height: 100vh; background: var(--bg); }
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
button:disabled { cursor: not-allowed; opacity: .45; }
a { color: inherit; }
.grain { position: fixed; inset: 0; z-index: -1; pointer-events: none; opacity: .12; background-image: radial-gradient(circle, rgba(255,255,255,.13) 0 1px, transparent 1.2px); background-size: 6px 6px; }
.eyebrow { margin: 0 0 .55rem; color: var(--lime); font: 700 .66rem/1 var(--mono); letter-spacing: .16em; text-transform: uppercase; }
.mono { font-family: var(--mono); }
.muted { color: var(--muted); }
.quiet { color: var(--quiet); }

.login-shell { min-height: 100vh; display: grid; place-items: center; padding: 2rem; }
.login-card { width: min(100%, 450px); padding: clamp(1.5rem, 5vw, 2.7rem); border: 1px solid var(--line); background: linear-gradient(145deg, #12161b, #0e1115); box-shadow: 18px 18px 0 #040506; }
.brand-mark, .brand > span { display: grid; place-items: center; width: 2.7rem; height: 2.7rem; border: 1px solid var(--lime); color: var(--lime); font: 800 .78rem var(--mono); }
.brand-mark { margin-bottom: 2.5rem; }
.login-card h1 { margin: 0; font-size: clamp(2.5rem, 8vw, 4rem); letter-spacing: -.065em; }
.login-copy { color: var(--muted); line-height: 1.65; margin: 1rem 0 2rem; }
.security-note { margin: 1.5rem 0 0; padding-top: 1rem; border-top: 1px solid var(--line-soft); color: #6f7781; font: .68rem/1.55 var(--mono); text-transform: uppercase; letter-spacing: .04em; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 246px minmax(0, 1fr); }
.rail { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; border-right: 1px solid var(--line); background: #0b0e12; padding: 1.4rem 1rem; }
.brand { display: flex; align-items: center; gap: .8rem; text-decoration: none; margin: 0 .4rem 3.2rem; }
.brand > span { flex: none; width: 2.25rem; height: 2.25rem; }
.brand strong { display: grid; gap: .15rem; letter-spacing: -.03em; }
.brand small { color: var(--quiet); font: .56rem var(--mono); letter-spacing: .09em; text-transform: uppercase; }
nav { display: grid; gap: .25rem; }
.nav-item { display: grid; grid-template-columns: 2rem 1fr; text-align: left; align-items: center; border: 0; border-left: 2px solid transparent; background: transparent; color: var(--muted); padding: .82rem .65rem; }
.nav-item span { font: .61rem var(--mono); color: #4f5863; }
.nav-item:hover, .nav-item.active { color: var(--text); background: var(--panel); border-left-color: var(--lime); }
.rail-foot { margin-top: auto; display: grid; grid-template-columns: auto 1fr; align-items: center; gap: .5rem; color: var(--muted); font: .67rem var(--mono); }
.status-dot { width: .45rem; height: .45rem; background: var(--lime); box-shadow: 0 0 12px var(--lime); }

.workspace { min-width: 0; padding: 0 clamp(1rem, 3vw, 3rem) 4rem; }
.topbar { min-height: 112px; display: grid; grid-template-columns: minmax(0, 1fr) auto auto; align-items: center; gap: 1.5rem; border-bottom: 1px solid var(--line); }
.topbar h1 { margin: 0; font-size: clamp(1.65rem, 4vw, 2.65rem); letter-spacing: -.055em; }
.operator { text-align: right; display: grid; gap: .25rem; min-width: 92px; }
.operator span { color: var(--lime); font: .62rem var(--mono); text-transform: uppercase; }
.operator strong { font-size: .82rem; }
.view-actions { display: flex; gap: .55rem; }
.view { padding-top: 2rem; }

.primary-button, .secondary-button, .danger-button, .row-button, .toolbar button, form button { min-height: 2.55rem; border-radius: 0; padding: .68rem .9rem; font-weight: 800; }
.primary-button, form button { border: 1px solid var(--lime); background: var(--lime); color: #10130b; }
.secondary-button, .row-button, .toolbar button { border: 1px solid var(--line); background: var(--panel-raised); color: var(--text); }
.danger-button { border: 1px solid #7d413e; background: #281616; color: var(--red); }
.compact-button { min-height: 1.9rem; padding: .32rem .52rem; font: 700 .62rem var(--mono); }
.text-button { border: 0; background: transparent; color: var(--muted); padding: .6rem 0 0; text-align: left; font: .68rem var(--mono); }
.rail-foot .text-button { grid-column: 1 / -1; }
.inline-actions { display: flex; flex-wrap: wrap; gap: .45rem; align-items: center; }

label { display: grid; gap: .5rem; color: #c9ced5; font: 700 .69rem var(--mono); letter-spacing: .05em; text-transform: uppercase; }
form { display: grid; gap: 1rem; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.form-grid .span-2 { grid-column: 1 / -1; }
fieldset { display: grid; gap: .65rem; margin: 0; padding: 1rem; border: 1px solid var(--line); }
legend { padding: 0 .4rem; color: var(--muted); font: .67rem var(--mono); text-transform: uppercase; }
.profile-choice { grid-template-columns: auto 1fr; align-items: start; gap: .65rem; text-transform: none; letter-spacing: 0; }
.profile-choice input { width: auto; margin-top: .16rem; }
.profile-choice small { display: block; margin-top: .25rem; color: var(--quiet); line-height: 1.45; }
input, select, textarea { width: 100%; border: 1px solid var(--line); border-radius: 0; background: #0a0d10; color: var(--text); padding: .8rem .85rem; outline: none; }
textarea { min-height: 88px; resize: vertical; }
input:focus, select:focus, textarea:focus { border-color: var(--lime); box-shadow: 0 0 0 1px var(--lime); }
input::placeholder, textarea::placeholder { color: #505963; }
.field-help { margin: -.2rem 0 0; color: var(--quiet); font: .65rem/1.5 var(--mono); text-transform: none; letter-spacing: 0; }
.form-error { min-height: 1rem; margin: 0; color: var(--red); font-size: .78rem; }
details.advanced { border: 1px solid var(--line-soft); padding: .85rem; }
details.advanced summary { color: var(--muted); cursor: pointer; font: .7rem var(--mono); }
details.advanced[open] summary { margin-bottom: 1rem; }

.notice { position: sticky; z-index: 5; top: .6rem; margin-top: 1rem; border: 1px solid var(--amber); background: #17130b; color: var(--amber); padding: .78rem 1rem; font: .73rem var(--mono); box-shadow: 8px 8px 0 #050607; }
.notice.ok { border-color: var(--lime-dim); background: #10150b; color: var(--lime); }
.notice.bad { border-color: #7d413e; background: #1b0e0e; color: var(--red); }

.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 1px; background: var(--line); border: 1px solid var(--line); }
.metric { min-height: 138px; background: var(--panel); padding: 1.2rem; display: flex; flex-direction: column; justify-content: space-between; }
.metric span { color: var(--muted); font: .63rem var(--mono); text-transform: uppercase; letter-spacing: .08em; }
.metric strong { font: 500 clamp(1.85rem, 4vw, 3rem)/1 var(--mono); letter-spacing: -.08em; }
.metric small { color: #5f6873; font: .66rem var(--mono); }

.section { margin-top: 1.6rem; border: 1px solid var(--line); background: var(--panel); }
.section:first-child { margin-top: 0; }
.section-head { min-height: 60px; display: flex; align-items: center; justify-content: space-between; gap: 1rem; padding: .9rem 1rem; border-bottom: 1px solid var(--line); }
.section-head h2 { margin: 0; font-size: .83rem; letter-spacing: .03em; text-transform: uppercase; }
.section-head p { margin: .18rem 0 0; color: var(--muted); font: .65rem/1.4 var(--mono); }
.section-body { padding: 1rem; }
.split-grid { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(280px, .75fr); gap: 1.6rem; }
.card-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.card { border: 1px solid var(--line); background: var(--panel); padding: 1rem; }
.card-head { display: flex; justify-content: space-between; align-items: start; gap: 1rem; margin-bottom: 1rem; }
.card h3 { margin: 0; font-size: .95rem; }
.card p { color: var(--muted); font-size: .78rem; line-height: 1.55; }
.card-meta { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: .75rem; margin: 1rem 0; }
.card-meta div { border-top: 1px solid var(--line-soft); padding-top: .65rem; }
.card-meta span { display: block; color: var(--quiet); font: .58rem var(--mono); text-transform: uppercase; }
.card-meta strong { display: block; margin-top: .3rem; font: .73rem var(--mono); overflow-wrap: anywhere; }

.setup-list { display: grid; }
.setup-step { display: grid; grid-template-columns: 1.7rem 1fr auto; align-items: center; gap: .8rem; min-height: 58px; border-bottom: 1px solid var(--line-soft); }
.setup-step:last-child { border-bottom: 0; }
.step-mark { display: grid; place-items: center; width: 1.45rem; height: 1.45rem; border: 1px solid var(--line); color: var(--quiet); font: .62rem var(--mono); }
.setup-step.done .step-mark { border-color: var(--lime-dim); color: var(--lime); }
.setup-step strong { font-size: .78rem; }
.setup-step p { margin: .25rem 0 0; color: var(--muted); font-size: .7rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: .77rem; }
th { color: #6d7681; font: .6rem var(--mono); text-transform: uppercase; letter-spacing: .07em; }
th, td { padding: .82rem 1rem; text-align: left; border-bottom: 1px solid var(--line-soft); white-space: nowrap; vertical-align: middle; }
tbody tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #15191e; }
.wrap { white-space: normal; min-width: 180px; }
.badge { display: inline-flex; align-items: center; min-height: 1.35rem; padding: .16rem .42rem; border: 1px solid #3a424c; color: #adb5bf; font: .59rem var(--mono); text-transform: uppercase; }
.badge.ok { border-color: #526b37; color: var(--lime); }
.badge.info { border-color: #3d6571; color: var(--cyan); }
.badge.warn { border-color: #735b32; color: var(--amber); }
.badge.bad { border-color: #6e3b39; color: var(--red); }
.tag { display: inline-flex; margin: .15rem .2rem .15rem 0; padding: .18rem .42rem; background: #1c2329; color: #b6c0ca; font: .59rem var(--mono); }
.progress { width: 110px; height: 4px; border: 0; background: #252b31; overflow: hidden; appearance: none; }
.progress::-webkit-progress-bar { background: #252b31; }
.progress::-webkit-progress-value { background: var(--lime); }
.progress::-moz-progress-bar { background: var(--lime); }

.toolbar { display: flex; gap: .7rem; margin-bottom: 1rem; }
.toolbar input { flex: 1; }
.evidence-list { display: grid; gap: .75rem; }
.evidence { border: 1px solid var(--line); background: var(--panel); padding: 1rem; }
.evidence header { display: flex; justify-content: space-between; gap: 1rem; color: var(--muted); font: .63rem var(--mono); }
.evidence p { margin: .8rem 0 0; line-height: 1.55; white-space: pre-wrap; overflow-wrap: anywhere; }
.untrusted { color: var(--amber); }
.empty { padding: 3rem 1rem; text-align: center; color: var(--muted); font: .76rem/1.6 var(--mono); }
.empty strong { display: block; margin-bottom: .35rem; color: var(--text); font-family: var(--sans); font-size: 1rem; }
.empty .primary-button { display: inline-flex; align-items: center; margin-top: 1rem; text-decoration: none; }
.callout { border-left: 2px solid var(--amber); background: #15120d; padding: .9rem 1rem; color: #c8b58e; font-size: .75rem; line-height: 1.55; }
.callout.safe { border-color: var(--lime); background: #10140c; color: #b9ca96; }
.callout.inset { margin: 1rem; }
.detail-list { display: grid; gap: .75rem; }
.detail-list.spaced { margin-top: 1rem; }
.detail-row { display: grid; grid-template-columns: 150px 1fr; gap: 1rem; border-bottom: 1px solid var(--line-soft); padding-bottom: .7rem; }
.detail-row span { color: var(--quiet); font: .63rem var(--mono); text-transform: uppercase; }
.detail-row strong { font-size: .76rem; overflow-wrap: anywhere; }

dialog { width: min(760px, calc(100vw - 2rem)); max-height: calc(100vh - 2rem); margin: 1rem 1rem 1rem auto; border: 1px solid var(--line); border-radius: 0; background: var(--panel); color: var(--text); padding: 0; overflow: auto; box-shadow: -18px 18px 0 #050607; }
dialog::backdrop { background: rgb(0 0 0 / .72); }
.drawer-bar { position: sticky; top: 0; z-index: 2; display: flex; align-items: center; justify-content: space-between; min-height: 54px; padding: .7rem 1rem; border-bottom: 1px solid var(--line); background: var(--panel); }
.drawer-bar span { color: var(--muted); font: .64rem var(--mono); text-transform: uppercase; }
.drawer-close { border: 1px solid var(--line); background: var(--panel-raised); color: var(--text); width: 2rem; height: 2rem; }
#drawer-body { padding: 1.5rem 2rem 2rem; }
.drawer-title { margin: .2rem 0 .7rem; font-size: clamp(1.5rem, 4vw, 2.25rem); letter-spacing: -.045em; overflow-wrap: anywhere; }
.drawer-copy { margin: 0 0 1.5rem; color: var(--muted); line-height: 1.6; }
.drawer-section { margin: 1.5rem 0; padding-top: 1rem; border-top: 1px solid var(--line-soft); }

@media (max-width: 1150px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .card-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .split-grid { grid-template-columns: 1fr; }
}

@media (max-width: 760px) {
  .app-shell { display: block; }
  .rail { position: static; width: 100%; height: auto; padding: .75rem; border-right: 0; border-bottom: 1px solid var(--line); }
  .brand { margin: 0 0 .7rem; }
  nav { display: flex; overflow-x: auto; }
  .nav-item { min-width: max-content; grid-template-columns: 1.5rem 1fr; }
  .rail-foot { display: none; }
  .workspace { padding: 0 1rem 3rem; }
  .topbar { min-height: 96px; grid-template-columns: 1fr auto; }
  .operator { display: none; }
  .view-actions { grid-column: 2; grid-row: 1; }
  .metric-grid, .card-grid, .form-grid { grid-template-columns: 1fr; }
  .form-grid .span-2 { grid-column: auto; }
  .metric { min-height: 112px; }
  th, td { padding: .72rem; }
  dialog { width: 100%; max-height: 94vh; margin: 6vh 0 0; }
  #drawer-body { padding: 1.25rem 1rem 2rem; }
}
