:root {
  color-scheme: dark;
  --bg: #080d14;
  --sidebar: #0b111b;
  --surface: #101824;
  --surface-raised: #151f2d;
  --surface-soft: #0d1520;
  --line: #243245;
  --line-strong: #34465e;
  --text: #eef4fb;
  --muted: #8fa0b5;
  --subtle: #65758a;
  --accent: #55e0b2;
  --accent-strong: #2fc99a;
  --accent-soft: rgba(85, 224, 178, .11);
  --blue: #76a8ff;
  --warning: #f4bd62;
  --danger: #ff7085;
  --critical: #ff5470;
  --radius: 10px;
  --shadow: 0 18px 60px rgba(0, 0, 0, .22);
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body { margin: 0; background: var(--bg); color: var(--text); font: 14px/1.5 Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
button, input, select, textarea { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { color: inherit; }
a { color: inherit; }
h1, h2, h3, p { margin-top: 0; }
h1 { margin-bottom: 6px; font-size: clamp(26px, 3vw, 36px); line-height: 1.15; letter-spacing: -.035em; }
h2 { margin-bottom: 5px; font-size: 17px; letter-spacing: -.012em; }
h3 { margin-bottom: 4px; font-size: 14px; }
.muted, .section-heading p, .field-help { color: var(--muted); }
.eyebrow { margin-bottom: 7px; color: var(--accent); font-size: 10px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.fine-print { color: var(--subtle); font-size: 12px; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; overflow: hidden; clip: rect(0, 0, 0, 0); white-space: nowrap; border: 0; }
.skip-link { position: fixed; left: 12px; top: -50px; z-index: 100; padding: 8px 12px; background: var(--accent); color: #06130f; border-radius: 6px; font-weight: 800; }
.skip-link:focus { top: 12px; }

.app-shell { min-height: 100vh; display: grid; grid-template-columns: 236px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; height: 100vh; display: flex; flex-direction: column; padding: 22px 14px 16px; background: var(--sidebar); border-right: 1px solid #1c2837; }
.product { display: flex; gap: 11px; align-items: center; padding: 0 8px 21px; text-decoration: none; }
.product strong { display: block; font-size: 17px; letter-spacing: -.02em; }
.product small, .sidebar-foot small, .user-menu small { display: block; color: var(--subtle); font-size: 10px; }
.brand-mark { width: 54px; height: 54px; display: grid; place-items: center; flex: 0 0 auto; background: linear-gradient(145deg, var(--accent), #4595d5); color: #061510; border-radius: 15px; font-size: 25px; font-weight: 950; box-shadow: 0 12px 35px rgba(85, 224, 178, .18); }
.brand-mark.small { width: 34px; height: 34px; border-radius: 9px; font-size: 16px; }
.nav-label { margin: 18px 10px 5px; color: #536278; font-size: 9px; font-weight: 800; letter-spacing: .16em; text-transform: uppercase; }
.sidebar nav a { display: flex; gap: 11px; align-items: center; margin: 2px 0; padding: 9px 10px; color: #9cabbe; border: 1px solid transparent; border-radius: 7px; text-decoration: none; transition: .15s ease; }
.sidebar nav a span { width: 17px; color: #65768c; text-align: center; }
.sidebar nav a:hover, .sidebar nav a:focus-visible { background: #111b28; color: var(--text); outline: none; }
.sidebar nav a.active { background: var(--accent-soft); border-color: rgba(85, 224, 178, .18); color: var(--text); }
.sidebar nav a.active span { color: var(--accent); }
.sidebar-foot { display: flex; gap: 10px; align-items: center; margin-top: auto; padding: 13px 9px 2px; border-top: 1px solid #1d2938; }
.status-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px rgba(85, 224, 178, .09); }
.sidebar-foot strong { display: block; font-size: 11px; }

.main-column { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 30; height: 68px; display: flex; gap: 18px; align-items: center; padding: 0 30px; background: rgba(8, 13, 20, .9); border-bottom: 1px solid rgba(36, 50, 69, .75); backdrop-filter: blur(14px); }
.global-search { width: min(520px, 48vw); display: flex; align-items: center; gap: 9px; padding: 0 12px; background: #0d141e; border: 1px solid var(--line); border-radius: 7px; }
.global-search input { width: 100%; padding: 9px 0; background: transparent; border: 0; color: var(--text); outline: 0; }
kbd { padding: 1px 5px; color: var(--subtle); background: #151f2c; border: 1px solid #29384b; border-radius: 4px; font-size: 10px; }
.top-actions { display: flex; gap: 8px; align-items: center; margin-left: auto; }
.icon-button, .run-indicator, .user-menu { border: 1px solid var(--line); background: #0d141e; cursor: pointer; }
.icon-button { width: 36px; height: 36px; display: grid; place-items: center; border-radius: 7px; }
.run-indicator { display: flex; gap: 6px; align-items: center; height: 36px; padding: 0 11px; border-radius: 7px; color: var(--muted); font-size: 11px; }
.run-indicator strong { color: var(--text); }
.pulse { width: 7px; height: 7px; background: var(--accent); border-radius: 50%; box-shadow: 0 0 0 4px var(--accent-soft); }
.user-menu { display: flex; gap: 8px; align-items: center; padding: 4px 8px 4px 4px; border-radius: 8px; text-align: left; }
.avatar { width: 28px; height: 28px; display: grid; place-items: center; background: #233248; color: var(--accent); border-radius: 6px; font-size: 10px; font-weight: 900; }
.user-menu strong { display: block; max-width: 100px; overflow: hidden; font-size: 11px; text-overflow: ellipsis; }
.badge-wrap { position: relative; }
.badge { position: absolute; right: -4px; top: -5px; min-width: 16px; height: 16px; padding: 0 4px; display: grid; place-items: center; background: var(--danger); color: white; border: 2px solid var(--bg); border-radius: 9px; font-size: 8px; font-weight: 800; }
.mobile-menu { display: none; }

main { max-width: 1600px; margin: 0 auto; padding: 32px 34px 70px; }
.page { display: none; }
.page.active { display: block; animation: enter .18s ease-out; }
@keyframes enter { from { opacity: 0; transform: translateY(3px); } }
.page-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-end; margin-bottom: 25px; }
.page-heading p:last-child { margin-bottom: 0; }
.heading-actions, .button-row { display: flex; gap: 8px; }
.panel { margin-bottom: 16px; padding: 18px; background: linear-gradient(145deg, rgba(19, 29, 42, .97), rgba(13, 21, 32, .97)); border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 45px rgba(0, 0, 0, .09); }
.section-heading { display: flex; justify-content: space-between; gap: 20px; align-items: flex-start; margin-bottom: 14px; }
.section-heading p { margin: 0; font-size: 12px; }
.two-column { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 16px; }
.kpi-grid { display: grid; grid-template-columns: repeat(6, minmax(125px, 1fr)); gap: 10px; margin-bottom: 16px; }
.kpi { min-height: 106px; padding: 15px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius); }
.kpi .value { display: block; margin: 8px 0 2px; font-size: 28px; font-weight: 750; letter-spacing: -.04em; }
.kpi .label { color: var(--muted); font-size: 11px; }
.kpi .trend { color: var(--subtle); font-size: 10px; }
.onboarding-banner { display: flex; justify-content: space-between; align-items: center; padding: 28px; background: radial-gradient(circle at 85% 0, rgba(85, 224, 178, .12), transparent 45%), var(--surface); }
.onboarding-banner > div { max-width: 700px; }
.step-number { float: left; margin-right: 18px; color: rgba(85, 224, 178, .2); font-size: 48px; font-weight: 900; line-height: 1; }
.hidden { display: none !important; }

.button { min-height: 36px; padding: 8px 13px; border: 1px solid transparent; border-radius: 7px; cursor: pointer; font-weight: 750; font-size: 12px; }
.button.primary { background: var(--accent); color: #061510; }
.button.primary:hover { background: #6aebc2; }
.button.secondary { background: #172332; color: var(--text); border-color: #314158; }
.button.danger-outline { color: var(--danger); background: transparent; border-color: rgba(255, 112, 133, .45); }
.button.full { width: 100%; margin-top: 10px; }
.button:disabled { cursor: not-allowed; filter: grayscale(.5); opacity: .45; }
.text-button { padding: 3px; border: 0; background: transparent; color: var(--accent); cursor: pointer; font-size: 11px; }

label { display: block; margin: 11px 0 5px; color: #b5c2d1; font-size: 11px; font-weight: 650; }
input, select, textarea { width: 100%; padding: 9px 10px; color: var(--text); background: #0a111b; border: 1px solid #2a3a4f; border-radius: 6px; outline: 0; }
input:focus, select:focus, textarea:focus { border-color: var(--accent-strong); box-shadow: 0 0 0 3px rgba(85, 224, 178, .08); }
textarea { min-height: 90px; resize: vertical; }
.check-row { display: flex; gap: 8px; align-items: center; }
.check-row input { width: auto; accent-color: var(--accent); }
.compact-label { min-width: 190px; margin: 0; }
.inline-form { display: flex; gap: 7px; }
.inline-form input { flex: 1; }
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }
.filters { display: flex; gap: 12px; align-items: end; }
.filters label { min-width: 140px; margin: 0; }
.filters label:first-child { flex: 1; }
.split-form { display: grid; grid-template-columns: 260px minmax(0, 1fr); gap: 25px; }

.table-wrap { width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; white-space: nowrap; }
th { padding: 9px 10px; color: var(--subtle); border-bottom: 1px solid var(--line-strong); font-size: 9px; font-weight: 850; letter-spacing: .09em; text-align: left; text-transform: uppercase; }
td { padding: 11px 10px; border-bottom: 1px solid rgba(36, 50, 69, .67); color: #b9c5d4; font-size: 11px; vertical-align: middle; }
tr:last-child td { border-bottom: 0; }
tbody tr { transition: background .12s; }
tbody tr:hover { background: rgba(118, 168, 255, .035); }
td strong { color: var(--text); font-weight: 700; }
.table-link { padding: 0; color: var(--text); background: transparent; border: 0; cursor: pointer; font-weight: 700; text-align: left; }
.empty-cell { padding: 40px 12px; color: var(--subtle); text-align: center; }
.meter { width: 70px; height: 5px; display: inline-block; margin-right: 7px; overflow: hidden; background: #233043; border-radius: 4px; vertical-align: middle; }
.meter span { height: 100%; display: block; background: var(--accent); border-radius: inherit; }
.coverage-0 { width: 0%; }
.coverage-10 { width: 10%; }
.coverage-20 { width: 20%; }
.coverage-30 { width: 30%; }
.coverage-40 { width: 40%; }
.coverage-50 { width: 50%; }
.coverage-60 { width: 60%; }
.coverage-70 { width: 70%; }
.coverage-80 { width: 80%; }
.coverage-90 { width: 90%; }
.coverage-100 { width: 100%; }
.pill { display: inline-flex; align-items: center; gap: 5px; padding: 3px 7px; color: #aab8c8; background: #1c2939; border: 1px solid #2b3b50; border-radius: 999px; font-size: 9px; font-weight: 750; text-transform: capitalize; }
.pill.good, .pill.validated, .pill.completed { color: var(--accent); background: var(--accent-soft); border-color: rgba(85, 224, 178, .25); }
.pill.warning, .pill.running, .pill.approval_pending { color: var(--warning); background: rgba(244, 189, 98, .08); border-color: rgba(244, 189, 98, .22); }
.pill.danger, .pill.failed, .pill.blocked { color: var(--danger); background: rgba(255, 112, 133, .08); border-color: rgba(255, 112, 133, .2); }
.severity { font-weight: 800; text-transform: capitalize; }
.severity.critical, .severity.high { color: var(--danger); }
.severity.medium { color: var(--warning); }
.severity.low { color: var(--blue); }

.record-list > article, .record-list > div { padding: 12px 0; border-top: 1px solid var(--line); }
.record-list > :first-child { padding-top: 2px; border-top: 0; }
.record-meta { display: flex; gap: 8px; align-items: center; color: var(--subtle); font-size: 10px; }
.record-list p { margin: 5px 0 0; color: var(--muted); font-size: 11px; }
.empty { padding: 22px; color: var(--subtle); border: 1px dashed #2a3a4f; border-radius: 7px; text-align: center; }
.card-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 11px; }
.program-card { padding: 15px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
.program-card .stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 6px; margin-top: 14px; }
.program-card .stats div { padding: 7px; background: #121c29; border-radius: 5px; }
.program-card .stats strong, .program-card .stats small { display: block; }
.program-card .stats small { color: var(--subtle); font-size: 9px; }

.wizard { padding: 0; overflow: hidden; }
.wizard-progress { display: grid; grid-template-columns: repeat(5, 1fr); background: #0c131d; border-bottom: 1px solid var(--line); }
.wizard-progress button { display: flex; gap: 7px; align-items: center; padding: 12px; color: var(--subtle); background: transparent; border: 0; border-right: 1px solid var(--line); cursor: pointer; font-size: 10px; text-align: left; }
.wizard-progress button:last-child { border-right: 0; }
.wizard-progress button.active { color: var(--text); background: var(--accent-soft); }
.wizard-progress button span { width: 20px; height: 20px; display: grid; place-items: center; border: 1px solid #34465e; border-radius: 50%; font-size: 9px; }
.wizard-progress button.active span { color: #061510; background: var(--accent); border-color: var(--accent); }
.wizard-body { max-width: 720px; min-height: 340px; padding: 28px; }
.wizard-step { display: none; }
.wizard-step.active { display: block; }
.scope-tester { margin: 16px 0; padding: 14px; background: #0b131e; border: 1px solid var(--line); border-radius: 7px; }
.scope-tester label { margin-top: 0; }

.run-grid { display: grid; grid-template-columns: repeat(3, minmax(230px, 1fr)); gap: 10px; }
.run-card { padding: 14px; background: var(--surface-soft); border: 1px solid var(--line); border-radius: 8px; }
.run-card header { display: flex; justify-content: space-between; gap: 8px; }
.run-card .target { height: 32px; margin: 7px 0; overflow: hidden; color: var(--muted); font-size: 10px; word-break: break-all; }
.usage { display: grid; grid-template-columns: repeat(3, 1fr); gap: 5px; }
.usage div { padding: 6px; background: #131d2a; border-radius: 5px; }
.usage strong, .usage small { display: block; }
.usage small { color: var(--subtle); font-size: 8px; text-transform: uppercase; }
.run-card footer { display: flex; justify-content: space-between; align-items: center; margin-top: 11px; }
.timeline { position: relative; }
.timeline::before { position: absolute; top: 10px; bottom: 10px; left: 7px; width: 1px; background: #2b3a4e; content: ""; }
.timeline-event { position: relative; margin-left: 25px; padding: 0 0 20px; }
.timeline-event::before { position: absolute; left: -22px; top: 5px; width: 8px; height: 8px; background: var(--blue); border: 3px solid var(--surface); border-radius: 50%; content: ""; }
.timeline-event.meaningful::before { background: var(--warning); }
.diff { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin-top: 8px; }
.diff pre, pre.code { margin: 0; padding: 9px; overflow: auto; color: #aebdd0; background: #091019; border: 1px solid #223145; border-radius: 6px; font: 10px/1.45 ui-monospace, SFMono-Regular, Consolas, monospace; white-space: pre-wrap; }

.lane-grid { display: grid; grid-template-columns: repeat(4, minmax(220px, 1fr)); gap: 10px; align-items: start; overflow-x: auto; }
.lane { min-height: 300px; padding: 12px; background: #0c131d; border: 1px solid var(--line); border-radius: var(--radius); }
.lane-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; }
.lane-head h2 { margin: 0; font-size: 12px; }
.lane-head span { min-width: 21px; height: 21px; display: grid; place-items: center; background: #1a2636; border-radius: 50%; color: var(--muted); font-size: 9px; }
.finding-card { margin-bottom: 8px; padding: 12px; background: var(--surface-raised); border: 1px solid #28374b; border-radius: 7px; }
.finding-card h3 { margin: 7px 0; }
.finding-card .button-row { margin-top: 10px; }
.finding-card .button { min-height: 28px; padding: 5px 8px; font-size: 9px; }

.health-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.health-item { padding: 12px; background: #0b131e; border: 1px solid var(--line); border-radius: 7px; }
.health-item strong, .health-item span { display: block; }
.health-item span { color: var(--muted); font-size: 10px; }
.definition-list > div { display: flex; justify-content: space-between; padding: 9px 0; border-top: 1px solid var(--line); }
.definition-list > div:first-child { border-top: 0; }
.definition-list dt { color: var(--muted); }
.definition-list dd { margin: 0; }
.check-list > div { display: flex; gap: 9px; padding: 10px; border-bottom: 1px solid var(--line); }
.check-list > div::before { color: var(--accent); content: "✓"; }
.check-list > div.failed::before { color: var(--danger); content: "×"; }

.toast-region { position: fixed; right: 22px; top: 78px; z-index: 80; display: grid; gap: 8px; }
.toast { max-width: 360px; padding: 11px 14px; background: #162232; border: 1px solid #354861; border-left: 3px solid var(--accent); border-radius: 7px; box-shadow: var(--shadow); font-size: 11px; }
.toast.error { border-left-color: var(--danger); }
.callout { margin: 14px 0; padding: 10px 12px; border-radius: 6px; }
.callout.danger { color: #ffc3cc; background: rgba(255, 112, 133, .09); border: 1px solid rgba(255, 112, 133, .24); }

dialog { width: min(780px, calc(100vw - 30px)); max-height: calc(100vh - 40px); padding: 0; color: var(--text); background: var(--surface); border: 1px solid var(--line-strong); border-radius: 12px; box-shadow: var(--shadow); }
dialog::backdrop { background: rgba(0, 0, 0, .68); backdrop-filter: blur(3px); }
.dialog-head { position: sticky; top: 0; display: flex; justify-content: space-between; align-items: flex-start; padding: 18px; background: var(--surface); border-bottom: 1px solid var(--line); }
#detail-content { padding: 18px; }

.login-page { min-height: 100vh; display: grid; place-items: center; background: radial-gradient(circle at 24% 20%, rgba(63, 137, 168, .15), transparent 36%), radial-gradient(circle at 78% 74%, rgba(85, 224, 178, .08), transparent 35%), var(--bg); }
.login-shell { width: min(1040px, calc(100vw - 32px)); display: grid; grid-template-columns: 1.4fr .8fr; gap: 90px; align-items: center; padding: 0; }
.login-brand h1 { max-width: 650px; margin-top: 22px; font-size: clamp(36px, 5vw, 64px); }
.login-brand > p:not(.eyebrow) { max-width: 600px; color: var(--muted); font-size: 16px; }
.trust-list { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 28px; }
.trust-list span { padding: 6px 9px; color: #9cb1c5; background: rgba(17, 27, 40, .7); border: 1px solid var(--line); border-radius: 5px; font-size: 10px; }
.login-card { padding: 28px; background: rgba(16, 24, 36, .95); border: 1px solid var(--line); border-radius: 12px; box-shadow: var(--shadow); }
.login-card h2 { font-size: 25px; }
.login-card form { margin: 19px 0; }

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .run-grid, .card-grid { grid-template-columns: repeat(2, 1fr); }
  .lane-grid { grid-template-columns: repeat(4, 260px); }
}
@media (max-width: 860px) {
  .app-shell { grid-template-columns: 1fr; }
  .sidebar { position: fixed; z-index: 60; width: 236px; transform: translateX(-100%); transition: transform .2s; }
  .sidebar.open { transform: translateX(0); box-shadow: var(--shadow); }
  .mobile-menu { display: grid; }
  .topbar { padding: 0 14px; }
  .global-search { width: 100%; }
  .user-menu span:not(.avatar), .run-indicator { display: none; }
  main { padding: 25px 16px 60px; }
  .two-column, .split-form { grid-template-columns: 1fr; }
  .filters { align-items: stretch; flex-direction: column; }
  .filters label { width: 100%; }
  .login-shell { grid-template-columns: 1fr; gap: 28px; padding: 40px 0; }
  .login-brand h1 { font-size: 38px; }
}
@media (max-width: 560px) {
  .page-heading { align-items: flex-start; flex-direction: column; }
  .kpi-grid, .run-grid, .card-grid, .form-grid { grid-template-columns: 1fr; }
  .wizard-progress button { padding: 10px 6px; font-size: 0; }
  .wizard-progress button span { margin: auto; font-size: 9px; }
  .wizard-body { padding: 20px; }
  .onboarding-banner { align-items: flex-start; flex-direction: column; }
}
