:root {
  --ink: #111827;
  --muted: #64748b;
  --line: #dbe2ea;
  --surface: #ffffff;
  --canvas: #f3f6f8;
  --brand: #065f46;
  --brand-dark: #064e3b;
  --good: #047857;
  --warn: #a16207;
  --bad: #b91c1c;
  --info: #075985;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
body { margin: 0; min-width: 320px; background: var(--canvas); }
button, input, select { font: inherit; }
a { color: inherit; }
.skip-link { position: fixed; left: 12px; top: -60px; z-index: 20; background: #fff; padding: 10px; }
.skip-link:focus { top: 12px; }
.topbar { position: sticky; top: 0; z-index: 10; display: flex; justify-content: space-between; align-items: center; gap: 20px; min-height: 68px; padding: 10px max(24px, calc((100vw - 1480px) / 2)); background: #fff; border-bottom: 1px solid var(--line); }
.topbar nav { display: flex; align-items: center; gap: 10px; }
.brand { display: inline-flex; align-items: center; gap: 10px; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 38px; height: 38px; background: var(--brand); color: #fff; font-size: 25px; font-weight: 800; }
.brand strong, .brand small { display: block; }
.brand small { color: var(--muted); font-size: 11px; letter-spacing: .08em; text-transform: uppercase; }
.identity { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--muted); font-size: 14px; }
.shell { width: min(1480px, calc(100% - 40px)); margin: 0 auto; padding: 34px 0 80px; }
.hero { display: flex; align-items: end; justify-content: space-between; gap: 32px; padding: 10px 0 28px; }
.hero h1 { margin: 3px 0 8px; max-width: 800px; font-size: clamp(32px, 5vw, 60px); line-height: .98; letter-spacing: -.04em; }
.hero p:not(.eyebrow) { max-width: 720px; margin: 0; color: var(--muted); font-size: 17px; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: 12px; font-weight: 800; letter-spacing: .13em; text-transform: uppercase; }
.scope-controls { display: grid; grid-template-columns: minmax(180px, 1fr) minmax(180px, 1fr) auto; align-items: end; gap: 10px; min-width: min(100%, 560px); }
label { display: grid; gap: 6px; color: #334155; font-size: 13px; font-weight: 700; }
input, select { width: 100%; min-height: 42px; border: 1px solid #b8c3d0; border-radius: 3px; background: #fff; color: var(--ink); padding: 8px 10px; }
input:focus, select:focus, button:focus-visible, a:focus-visible { outline: 3px solid rgba(5, 150, 105, .25); outline-offset: 2px; }
.button { display: inline-flex; align-items: center; justify-content: center; min-height: 42px; padding: 8px 15px; border: 1px solid var(--brand); border-radius: 3px; background: var(--brand); color: #fff; font-weight: 750; text-decoration: none; cursor: pointer; }
.button:hover { background: var(--brand-dark); }
.button.secondary { border-color: #b8c3d0; background: #fff; color: var(--ink); }
.button.danger { border-color: var(--bad); background: var(--bad); }
.button:disabled { opacity: .45; cursor: not-allowed; }
.button.small { min-height: 32px; padding: 4px 9px; font-size: 12px; }
.notice { margin-bottom: 28px; padding: 14px 16px; border-left: 4px solid var(--info); background: #eaf5fb; color: #0c4a6e; }
.notice.error { border-color: var(--bad); background: #fff1f2; color: #881337; }
.notice.success { border-color: var(--good); background: #ecfdf5; color: #065f46; }
.section-heading { display: flex; justify-content: space-between; align-items: end; gap: 16px; margin: 0 0 15px; }
.section-heading.compact { align-items: center; }
h2 { margin: 0; font-size: 22px; letter-spacing: -.02em; }
h3 { margin: 0; font-size: 16px; }
.muted { color: var(--muted); font-size: 13px; }
.metric-grid { display: grid; grid-template-columns: repeat(6, minmax(130px, 1fr)); gap: 1px; border: 1px solid var(--line); background: var(--line); }
.metric { min-height: 120px; padding: 17px; background: #fff; }
.metric strong { display: block; margin: 12px 0 3px; font-size: 30px; line-height: 1; }
.metric span { color: var(--muted); font-size: 13px; }
.metric.critical strong { color: var(--bad); }
.split-grid { display: grid; grid-template-columns: minmax(0, .8fr) minmax(0, 1.2fr); gap: 18px; margin-top: 18px; }
.panel { margin-top: 18px; padding: 22px; border: 1px solid var(--line); background: var(--surface); }
.score { color: var(--brand); font-size: 24px; font-weight: 800; }
.badge { min-width: 30px; padding: 3px 8px; border: 1px solid var(--line); text-align: center; font-size: 12px; font-weight: 800; }
.check-list, .alert-list { display: grid; gap: 1px; background: var(--line); }
.check, .alert { display: grid; grid-template-columns: 18px 1fr; gap: 10px; padding: 11px 12px; background: #fff; }
.check-icon { color: var(--bad); font-weight: 900; }
.check.passed .check-icon { color: var(--good); }
.alert { grid-template-columns: 75px 1fr; }
.severity { font-size: 10px; font-weight: 900; letter-spacing: .08em; text-transform: uppercase; }
.alert.critical .severity { color: var(--bad); }
.alert.warning .severity { color: var(--warn); }
.alert.info .severity { color: var(--info); }
.alert strong, .alert span { display: block; }
.alert span { margin-top: 2px; color: var(--muted); font-size: 12px; }
.empty { padding: 22px; color: var(--muted); text-align: center; background: #fff; }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
th { padding: 9px 10px; border-bottom: 2px solid #cbd5e1; color: #475569; text-align: left; white-space: nowrap; }
td { padding: 12px 10px; border-bottom: 1px solid #e5eaf0; vertical-align: top; }
td strong, td small { display: block; }
td small { margin-top: 3px; color: var(--muted); }
.status { display: inline-block; padding: 3px 7px; border: 1px solid #cbd5e1; background: #f8fafc; font-size: 11px; font-weight: 800; text-transform: uppercase; }
.status.good { border-color: #6ee7b7; background: #ecfdf5; color: #065f46; }
.status.warning { border-color: #fde68a; background: #fffbeb; color: #854d0e; }
.status.bad { border-color: #fca5a5; background: #fff1f2; color: #991b1b; }
.actions { display: flex; flex-wrap: wrap; gap: 6px; }
.gate { margin-bottom: 14px; padding: 10px 12px; border-left: 4px solid var(--bad); background: #fff1f2; color: #881337; }
.gate.enabled { border-color: var(--good); background: #ecfdf5; color: #065f46; }
.form-grid { display: grid; grid-template-columns: repeat(4, minmax(210px, 1fr)); gap: 1px; background: var(--line); }
.admin-form { display: flex; flex-direction: column; gap: 11px; padding: 18px; background: #f8fafc; }
.admin-form .button { margin-top: auto; }
.boundary { border-color: #cbd5e1; background: #eef2f5; }
.gate-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 1px; margin-top: 16px; background: #cbd5e1; }
.gate-card { padding: 15px; background: #fff; }
.gate-card strong, .gate-card span { display: block; }
.gate-card span { margin-top: 5px; color: var(--muted); font-size: 12px; }
dialog { width: min(680px, calc(100% - 32px)); padding: 0; border: 0; background: transparent; }
dialog::backdrop { background: rgba(15, 23, 42, .72); }
.dialog-card { padding: 24px; background: #fff; }
.icon-button { border: 0; background: transparent; font-size: 28px; cursor: pointer; }
.warning-copy { padding: 12px; border-left: 4px solid var(--warn); background: #fffbeb; color: #713f12; font-size: 13px; }
.confirmation { display: flex; grid-template-columns: 20px 1fr; align-items: start; font-size: 14px; }
.confirmation input { width: 18px; min-height: 18px; }
.dialog-actions { display: flex; justify-content: end; gap: 8px; margin-top: 20px; }
.preview-command { margin: 8px 0; padding: 10px; border: 1px solid var(--line); font-size: 12px; }

@media (max-width: 1100px) {
  .metric-grid { grid-template-columns: repeat(3, 1fr); }
  .form-grid { grid-template-columns: repeat(2, 1fr); }
  .gate-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 760px) {
  .topbar { align-items: flex-start; }
  .topbar nav { flex-wrap: wrap; justify-content: end; }
  .identity { width: 100%; text-align: right; }
  .shell { width: min(100% - 24px, 1480px); padding-top: 20px; }
  .hero { display: block; }
  .scope-controls { grid-template-columns: 1fr; margin-top: 22px; min-width: 0; }
  .metric-grid, .split-grid, .form-grid, .gate-grid { grid-template-columns: 1fr; }
  .panel { padding: 15px; }
  .section-heading { align-items: start; flex-direction: column; }
}
