:root {
    color-scheme: light;
    --blue-950: #071b3b;
    --blue-800: #0d3a73;
    --blue-650: #1261b5;
    --blue-100: #eaf4ff;
    --ink: #172033;
    --muted: #64748b;
    --line: #dce5f0;
    --surface: #ffffff;
    --canvas: #f4f7fb;
    --critical: #b42318;
    --risk: #b54708;
    --attention: #9a6700;
    --good: #087443;
}

* { box-sizing: border-box; }
body { margin: 0; background: var(--canvas); color: var(--ink); font: 15px/1.55 system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; }
a { color: var(--blue-650); text-decoration-thickness: .08em; text-underline-offset: .16em; }
.topbar { min-height: 76px; display: flex; align-items: center; justify-content: space-between; gap: 24px; padding: 14px clamp(18px, 4vw, 54px); color: #fff; background: linear-gradient(115deg, var(--blue-950), var(--blue-800)); box-shadow: 0 8px 25px rgba(7,27,59,.18); }
.brand { display: flex; gap: 12px; align-items: center; color: #fff; text-decoration: none; }
.brand-mark { display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; background: #fff; color: var(--blue-800); font-weight: 800; letter-spacing: .03em; }
.brand strong, .brand small { display: block; }
.brand small { color: #cfe4ff; font-size: 12px; }
nav { display: flex; align-items: center; gap: 18px; flex-wrap: wrap; }
nav a, .link { border: 0; padding: 6px 0; background: transparent; color: #e8f3ff; font: inherit; text-decoration: none; cursor: pointer; }
nav a:hover, .link:hover { color: #fff; text-decoration: underline; }
main { width: min(1440px, calc(100% - 36px)); margin: 0 auto; padding: 30px 0 60px; }
.page-heading { display: flex; align-items: center; min-height: 54px; margin-bottom: 16px; }
h1 { margin: 0; font-size: clamp(26px, 4vw, 38px); letter-spacing: -.025em; }
h2 { margin: 0 0 18px; font-size: 20px; }
h3 { margin: 24px 0 12px; font-size: 16px; }
.panel, .metric, .summary > div, .auth-card { border: 1px solid var(--line); border-radius: 12px; background: var(--surface); box-shadow: 0 3px 14px rgba(30,58,95,.05); }
.panel { padding: clamp(18px, 3vw, 26px); margin-bottom: 20px; }
.metrics { display: grid; grid-template-columns: repeat(auto-fit, minmax(155px, 1fr)); gap: 14px; margin-bottom: 20px; }
.metric { padding: 18px; }
.metric span, .summary span, small { display: block; color: var(--muted); font-size: 12px; }
.metric strong { display: block; margin-top: 6px; font-size: 30px; color: var(--blue-800); }
.grid { display: grid; gap: 20px; align-items: start; }
.grid > * { min-width: 0; }
.grid.two { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.grid.aside { grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); }
.summary { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 14px; margin-bottom: 20px; }
.summary > div { padding: 16px 18px; }
.summary strong { display: block; margin-top: 5px; }
.table-wrap { width: 100%; max-width: 100%; overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 12px 10px; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
tbody tr:last-child td { border-bottom: 0; }
form { display: grid; gap: 14px; }
form.inline { display: inline; }
label { display: grid; gap: 6px; color: #334155; font-weight: 650; }
input, select, textarea { width: 100%; min-height: 42px; padding: 9px 11px; border: 1px solid #b9c7d8; border-radius: 8px; background: #fff; color: var(--ink); font: inherit; }
textarea { resize: vertical; }
input:focus, select:focus, textarea:focus, button:focus-visible, a:focus-visible { outline: 3px solid #8bc4ff; outline-offset: 2px; }
button { min-height: 40px; border: 0; border-radius: 8px; padding: 9px 15px; background: var(--blue-650); color: #fff; font: inherit; font-weight: 700; cursor: pointer; }
button:hover { background: var(--blue-800); }
button.danger { background: var(--critical); }
.filters { grid-template-columns: repeat(4, minmax(130px, 1fr)); align-items: end; }
.status, .severity { display: inline-flex; align-items: center; min-height: 26px; border-radius: 999px; padding: 3px 10px; background: #edf2f7; color: #475569; font-size: 12px; font-weight: 750; white-space: nowrap; }
.status-good, .status-active, .status-processed, .severity-low, .severity-informational { background: #e9f8f0; color: var(--good); }
.status-attention, .severity-medium { background: #fff7d6; color: var(--attention); }
.status-risk, .status-at-risk, .status-waiting, .status-paused, .severity-high { background: #fff0dd; color: var(--risk); }
.status-critical, .severity-critical, .status-revoked { background: #ffebe9; color: var(--critical); }
.status-open, .status-in-progress, .status-pending, .status-monitoring, .status-identified, .status-discussed, .status-planned { background: var(--blue-100); color: var(--blue-800); }
.status-completed, .status-accepted, .status-mitigated, .status-closed, .status-won { background: #e9f8f0; color: var(--good); }
.tabs { position: sticky; top: 0; z-index: 3; display: flex; gap: 8px; margin-bottom: 20px; padding: 10px; border: 1px solid var(--line); border-radius: 10px; background: rgba(255,255,255,.96); overflow-x: auto; flex-wrap: nowrap; }
.tabs a { white-space: nowrap; padding: 7px 10px; border-radius: 7px; color: var(--blue-800); text-decoration: none; }
.tabs a:hover { background: var(--blue-100); color: var(--blue-950); }
.anchor { scroll-margin-top: 80px; }
.form-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); align-items: end; }
.form-grid textarea, .form-grid .check { grid-column: span 2; }
.check { display: flex; align-items: center; align-self: center; }
.check input { width: auto; min-height: auto; }
.inline-form { display: flex; align-items: center; gap: 8px; min-width: 240px; }
.inline-form select { min-height: 38px; }
.create-box { margin-top: 20px; border-top: 1px solid var(--line); padding-top: 16px; }
.create-box summary { cursor: pointer; color: var(--blue-650); font-weight: 750; margin-bottom: 14px; }
.next-action { font-size: 20px; font-weight: 750; color: var(--blue-800); }
dl { display: grid; grid-template-columns: max-content 1fr; gap: 5px 12px; }
dt { color: var(--muted); font-weight: 700; }
dd { margin: 0; }
.signal-list { padding-left: 20px; }
.timeline { list-style: none; padding: 0; margin: 0; }
.timeline li { position: relative; display: grid; grid-template-columns: 135px minmax(0,1fr); gap: 4px 16px; padding: 12px 0 12px 22px; border-bottom: 1px solid var(--line); }
.timeline li::before { content: ""; position: absolute; left: 2px; top: 19px; width: 9px; height: 9px; border-radius: 50%; background: var(--blue-650); }
.timeline time { grid-row: span 2; color: var(--muted); font-size: 12px; }
.timeline span { color: var(--muted); font-size: 12px; }
.notice.success { margin-bottom: 16px; padding: 12px; border-radius: 8px; background: #e9f8f0; color: var(--good); }
.danger-zone { border-color: #f3b5af; }
.inventory-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(105px, 1fr)); gap: 10px; }
.inventory-cards > div { padding: 12px; border-radius: 9px; background: var(--blue-100); }
.inventory-cards span, .inventory-cards strong { display: block; }
.coverage { list-style: none; padding: 0; }
.coverage li { display: flex; justify-content: space-between; gap: 15px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.component-list { list-style: none; margin: 0; padding: 0; }
.component-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto auto; gap: 10px; align-items: center; padding: 9px 0; border-bottom: 1px solid var(--line); }
.component-list span { color: var(--risk); font-size: 12px; font-weight: 700; }
.code-box { padding: 16px; border: 1px solid #9fc9f5; border-radius: 10px; background: var(--blue-100); }
.code-box code { display: block; margin: 12px 0; font-size: 20px; font-weight: 800; letter-spacing: .08em; word-break: break-all; }
.auth-card { width: min(460px, 100%); margin: 30px auto; padding: 28px; }
.notice.error { margin-bottom: 16px; padding: 12px; border-radius: 8px; background: #ffebe9; color: var(--critical); }
.empty { color: var(--muted); }
.empty-state { padding-block: clamp(28px, 5vw, 46px); text-align: center; }
.empty-state .button-link { margin-top: 8px; }
.hierarchy-list { display: grid; gap: 16px; }
.hierarchy-card { min-width: 0; padding: 18px; border: 1px solid var(--line); border-radius: 10px; background: #f9fbfe; }
.hierarchy-card > header { display: flex; align-items: flex-start; justify-content: space-between; gap: 18px; margin-bottom: 14px; }
.hierarchy-card h3 { margin: 0; color: var(--blue-800); font-size: 18px; }
.hierarchy-card header p { margin: 2px 0 0; color: var(--muted); overflow-wrap: anywhere; }
footer { padding: 24px; color: var(--muted); text-align: center; font-size: 12px; }

.setup-body { min-width: 0; background: linear-gradient(180deg, #eff7ff 0, #f7f9fc 42%, #f7f9fc 100%); }
.setup-header { display: flex; justify-content: center; padding: 26px 18px 10px; }
.setup-header .brand { width: min(760px, 100%); color: var(--ink); }
.setup-header .brand small { color: var(--muted); }
.setup-shell { width: min(760px, calc(100% - 28px)); padding-top: 14px; }
.setup-card { padding: clamp(20px, 5vw, 38px); overflow: hidden; }
.setup-card h1 { margin-top: 4px; }
.eyebrow { margin: 0; color: var(--blue-650); font-size: 12px; font-weight: 800; letter-spacing: .08em; text-transform: uppercase; }
.lead { color: var(--muted); font-size: 17px; line-height: 1.55; }
.setup-progress { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 6px; margin: 0 0 16px; padding: 0; list-style: none; }
.setup-progress li { min-width: 0; color: var(--muted); font-size: 11px; font-weight: 700; text-align: center; }
.setup-progress li span { display: block; height: 5px; margin-bottom: 7px; border-radius: 999px; background: #cfdae7; }
.setup-progress li.active { color: var(--blue-800); }
.setup-progress li.active span, .setup-progress li.done span { background: var(--blue-650); }
.setup-checks { margin: 22px 0; padding: 0; list-style: none; border-top: 1px solid var(--line); }
.setup-check { display: flex; align-items: center; justify-content: space-between; gap: 14px; padding: 13px 0; border-bottom: 1px solid var(--line); }
.setup-check div { min-width: 0; }
.setup-check strong, .setup-check small { display: block; overflow-wrap: anywhere; }
.setup-check small { margin-top: 3px; color: var(--muted); font-weight: 400; }
.setup-check > span { flex: 0 0 auto; border-radius: 999px; padding: 4px 9px; font-size: 11px; font-weight: 800; }
.setup-check.pass > span { background: #e9f8f0; color: var(--good); }
.setup-check.warning > span { background: #fff7d6; color: var(--attention); }
.setup-check.blocking > span { background: #ffebe9; color: var(--critical); }
.form-help { margin: -4px 0 4px; color: var(--muted); font-size: 13px; }
.setup-summary { grid-template-columns: minmax(110px, max-content) minmax(0, 1fr); margin: 22px 0; padding: 16px; border: 1px solid var(--line); border-radius: 10px; background: #f8fbff; }
.setup-summary dd { overflow-wrap: anywhere; }
.button-link { display: inline-flex; align-items: center; min-height: 42px; border-radius: 8px; padding: 9px 15px; background: var(--blue-650); color: #fff; font-weight: 700; text-decoration: none; }
.button-link:hover { background: var(--blue-800); color: #fff; }
.button-link.secondary { min-height: 36px; padding: 7px 11px; background: var(--blue-100); color: var(--blue-800); white-space: nowrap; }
.button-link.secondary:hover { background: #d7eaff; color: var(--blue-950); }

@media (max-width: 820px) {
    .topbar { align-items: flex-start; flex-direction: column; }
    .grid.two, .grid.aside { grid-template-columns: 1fr; }
    .filters { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .form-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 520px) {
    main { width: min(100% - 22px, 1440px); padding-top: 18px; }
    nav { gap: 12px; }
    .filters { grid-template-columns: 1fr; }
    .form-grid { grid-template-columns: 1fr; }
    .form-grid textarea, .form-grid .check { grid-column: auto; }
    .timeline li { grid-template-columns: 1fr; }
    .timeline time { grid-row: auto; }
    .panel { padding: 16px; }
    .setup-shell { width: min(100% - 20px, 760px); }
    .setup-progress li { font-size: 0; }
    .setup-card { padding: 18px; }
    .setup-check { align-items: flex-start; }
    .setup-summary { grid-template-columns: 1fr; }
    .setup-summary dd { margin-bottom: 8px; }
    .hierarchy-card { padding: 14px; }
    .hierarchy-card > header { align-items: flex-start; flex-direction: column; gap: 8px; }
}
