:root {
  --ink: #17252f;
  --muted: #5b6972;
  --line: #d8e0e4;
  --paper: #ffffff;
  --canvas: #f4f7f8;
  --brand: #075985;
  --brand-dark: #0c4a6e;
  --accent: #0f766e;
  --danger: #b42318;
  --warning: #a15c00;
  --success: #147a4b;
  --radius: 0.55rem;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: var(--canvas);
  line-height: 1.5;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); }
a { color: var(--brand); text-underline-offset: 0.15em; }
a:hover { color: var(--brand-dark); }
a:focus-visible, button:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible,
summary:focus-visible { outline: 3px solid #f6bf26; outline-offset: 2px; }

.skip-link { position: absolute; left: -9999px; top: 0; }
.skip-link:focus { left: 0.75rem; top: 0.75rem; z-index: 30; background: white; padding: 0.75rem; }
.topbar { background: #0b3448; color: white; border-bottom: 4px solid #2ca6a4; }
.topbar-inner { max-width: 1500px; margin: auto; padding: 0.75rem 1rem; display: flex; gap: 1rem; align-items: center; }
.brand { color: white; font-weight: 750; text-decoration: none; white-space: nowrap; }
.primary-nav { display: flex; flex-wrap: wrap; gap: 0.35rem; align-items: center; }
.primary-nav a, .link-button, .account-link { color: white; padding: 0.42rem 0.65rem; text-decoration: none; border-radius: 0.35rem; }
.primary-nav a:hover, .link-button:hover, .account-link:hover { background: rgba(255,255,255,.13); color: white; }
.account { margin-left: auto; display: flex; flex-wrap: wrap; align-items: center; gap: 0.5rem; font-size: 0.9rem; }
.inline-form { display: inline; margin: 0; }
.link-button { font: inherit; border: 0; background: transparent; cursor: pointer; }

main { max-width: 1500px; margin: 0 auto; padding: 1rem; }
h1 { font-size: clamp(1.55rem, 3vw, 2.15rem); line-height: 1.15; margin: 0 0 0.35rem; }
h2 { font-size: 1.25rem; margin: 0 0 0.65rem; }
h3 { font-size: 1.05rem; }
.lede, .muted, .helptext { color: var(--muted); }
.lede { margin-top: 0; max-width: 75ch; }
.page-header { display: flex; gap: 1rem; align-items: flex-start; justify-content: space-between; margin-bottom: 1rem; }
.actions { display: flex; flex-wrap: wrap; gap: 0.45rem; }

.button, button[type="submit"], input[type="submit"] {
  display: inline-flex; align-items: center; justify-content: center; gap: .35rem;
  min-height: 2.65rem; padding: .58rem .85rem; border-radius: .4rem;
  border: 1px solid var(--brand); background: var(--brand); color: white;
  font: inherit; font-weight: 650; text-decoration: none; cursor: pointer;
}
.button:hover, button[type="submit"]:hover { background: var(--brand-dark); color: white; }
.button.secondary { background: white; color: var(--brand); }
.button.danger { background: var(--danger); border-color: var(--danger); }
.button.small { min-height: 2.1rem; padding: .35rem .55rem; font-size: .88rem; }

.messages { list-style: none; padding: 0; margin: 0 0 1rem; }
.message { padding: .75rem 1rem; border-left: 5px solid var(--brand); background: white; margin-bottom: .4rem; }
.message.success { border-color: var(--success); }
.message.error { border-color: var(--danger); }
.message.warning { border-color: var(--warning); }

.cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(175px, 1fr)); gap: .75rem; margin: 1rem 0; }
.card, .panel, details {
  background: var(--paper); border: 1px solid var(--line); border-radius: var(--radius);
  box-shadow: 0 1px 2px rgba(20, 40, 50, .05);
}
.card { padding: .85rem; }
.card .metric { display: block; font-size: 1.75rem; line-height: 1.1; font-weight: 800; }
.card .label { display: block; color: var(--muted); margin-top: .25rem; }
.panel { padding: 1rem; margin-bottom: 1rem; min-width: 0; max-width: 100%; }
.panel-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1rem; }
.panel-grid > *, .cards > * { min-width: 0; }
.wide { grid-column: 1 / -1; }

.badge { display: inline-block; border-radius: 999px; padding: .15rem .48rem; font-size: .78rem; font-weight: 700; background: #e8eef1; color: #31434d; }
.badge.high, .badge.critical, .badge.danger { background: #fee4e2; color: #912018; }
.badge.medium, .badge.warning { background: #fff1cf; color: #7a4700; }
.badge.low, .badge.success { background: #dff5e8; color: #12613c; }
.score { display: inline-grid; place-items: center; min-width: 3.35rem; min-height: 3.35rem; border-radius: 50%; color: white; background: var(--accent); font-size: 1.15rem; font-weight: 800; }
.score.low { background: #9a3412; }

.table-wrap { min-width: 0; max-width: 100%; overflow-x: auto; border: 1px solid var(--line); border-radius: var(--radius); background: white; }
table { width: 100%; border-collapse: collapse; font-size: .92rem; }
th, td { text-align: left; vertical-align: top; padding: .62rem .68rem; border-bottom: 1px solid var(--line); }
th { background: #edf3f5; color: #263b47; font-size: .82rem; text-transform: uppercase; letter-spacing: .025em; }
tr:last-child td { border-bottom: 0; }
tbody tr:hover { background: #f8fbfc; }
.wrap { white-space: normal; min-width: 15rem; }
.compact-list { margin: .25rem 0; padding-left: 1.2rem; }
.compact-list li { margin-bottom: .35rem; }
.empty { color: var(--muted); padding: 1rem; border: 1px dashed #b7c4ca; border-radius: var(--radius); }

.filter-form { background: white; border: 1px solid var(--line); border-radius: var(--radius); padding: .8rem; margin-bottom: 1rem; }
.filter-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: .65rem; align-items: end; }
label { display: block; font-weight: 650; margin-bottom: .2rem; }
input, select, textarea {
  width: 100%; min-height: 2.55rem; padding: .52rem .6rem; border: 1px solid #aab8bf;
  border-radius: .35rem; background: white; color: var(--ink); font: inherit;
}
textarea { min-height: 5rem; resize: vertical; }
input[type="checkbox"] { width: 1.2rem; min-height: 1.2rem; vertical-align: middle; }
.form-row { margin-bottom: .75rem; }
form p { margin: 0 0 .75rem; }
.errorlist { color: var(--danger); margin: .25rem 0; }

details { margin-bottom: .8rem; }
summary { cursor: pointer; padding: .85rem 1rem; font-weight: 760; background: #f8fafb; border-radius: var(--radius); }
details[open] summary { border-bottom: 1px solid var(--line); border-radius: var(--radius) var(--radius) 0 0; }
.details-body { padding: 1rem; }
.workspace-nav { display: flex; flex-wrap: wrap; gap: .35rem; margin: .75rem 0 1rem; position: sticky; top: .25rem; z-index: 10; background: rgba(244,247,248,.96); padding: .5rem; border-radius: .45rem; }
.workspace-nav a { background: white; border: 1px solid var(--line); padding: .4rem .6rem; border-radius: .35rem; text-decoration: none; }
.definition-grid { display: grid; grid-template-columns: repeat(2, minmax(0,1fr)); gap: .5rem 1rem; }
.definition-grid dt { color: var(--muted); font-size: .82rem; font-weight: 700; }
.definition-grid dd { margin: .1rem 0 .7rem; white-space: pre-line; }
.stack > * + * { margin-top: .65rem; }
.item { border-left: 4px solid #a4b5bd; padding: .6rem .75rem; background: #f8fafb; }
.item.critical { border-color: var(--danger); }
.question-card { border: 1px solid var(--line); border-radius: var(--radius); margin: 0 0 .8rem; padding: .85rem; background: white; }
.question-number { color: var(--brand); font-weight: 800; }
.progress { height: .75rem; background: #dce5e9; border-radius: 999px; overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); }
.progress-meter { width: 100%; height: 1rem; accent-color: var(--accent); }
.narrow { max-width: 50rem; margin: 1rem auto; }
.login-panel { max-width: 30rem; margin: 3rem auto; }
.pre-line { white-space: pre-line; }
.url-list { overflow-wrap: anywhere; }
.footer { max-width: 1500px; margin: 1rem auto; padding: 1rem; color: var(--muted); font-size: .85rem; }

.help-search-row { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: .65rem; align-items: end; }
.help-search-row button { white-space: nowrap; }
.help-toc { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: .55rem; margin: 1rem 0; }
.help-toc a { display: block; padding: .7rem .8rem; border: 1px solid var(--line); border-radius: .4rem; background: white; text-decoration: none; font-weight: 700; }
.help-toc a:hover { border-color: var(--brand); }
.help-flow { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: .65rem; margin: 1rem 0; padding: 0; list-style: none; counter-reset: help-step; }
.help-flow > li { position: relative; padding: .85rem; border: 1px solid var(--line); border-radius: .45rem; background: #f8fbfc; counter-increment: help-step; }
.help-flow > li::before { content: counter(help-step); display: grid; place-items: center; width: 1.8rem; height: 1.8rem; margin-bottom: .45rem; border-radius: 50%; background: var(--brand); color: white; font-weight: 800; }
.help-flow strong { display: block; margin-bottom: .25rem; }
.help-section { scroll-margin-top: 1rem; }
.help-section[hidden], .help-toc a[hidden] { display: none; }
.help-callout { padding: .8rem 1rem; border-left: 5px solid var(--accent); background: #edf9f7; margin: .8rem 0; }
.help-callout.warning { border-color: var(--warning); background: #fff8e8; }
.help-example-links { display: flex; flex-wrap: wrap; gap: .5rem; margin: .75rem 0; }
.help-back { display: inline-block; margin-top: .6rem; font-size: .9rem; }
.help-role { display: inline-block; padding: .25rem .55rem; border-radius: 999px; background: #e8eef1; font-weight: 700; }
.insight-prompt { padding: .75rem; margin: .65rem 0; border-left: 5px solid var(--warning); background: #fff8e8; }
.insight-prompt p { margin: .25rem 0 0; }
.review-group { overflow: hidden; }
.review-actions { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 2fr); gap: .75rem; margin: .9rem 0; }
.candidate-checks { display: grid; gap: .45rem; }
.candidate-check { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: .55rem; align-items: start; padding: .5rem; border: 1px solid var(--line); border-radius: .35rem; }
.candidate-check input { margin-top: .2rem; }

@media (max-width: 800px) {
  .topbar-inner, .page-header { flex-direction: column; align-items: stretch; }
  .brand { white-space: normal; }
  .account { margin-left: 0; }
  .panel-grid, .definition-grid { grid-template-columns: 1fr; }
  main { padding: .75rem; }
  th, td { padding: .5rem; }
  .hide-mobile { display: none; }
  .workspace-nav { position: static; }
  .help-search-row { grid-template-columns: 1fr; }
  .review-actions { grid-template-columns: 1fr; }
  .review-group .actions > * { width: 100%; }
}

@media print {
  .topbar, .workspace-nav, .messages, .no-print, form { display: none !important; }
  body, :root { background: white; }
  main { max-width: none; }
  details { display: block; break-inside: avoid; }
  details > * { display: block !important; }
}
