:root {
    --bg: #f3f6fb;
    --surface: #ffffff;
    --surface-muted: #f7f9fc;
    --ink: #172033;
    --muted: #65708a;
    --line: #dce3ef;
    --primary: #2463eb;
    --primary-dark: #194bb7;
    --danger: #c73545;
    --warning: #b26a00;
    --success: #1f8453;
    --shadow: 0 10px 28px rgba(29, 45, 80, .08);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
body { margin: 0; color: var(--ink); background: var(--bg); line-height: 1.5; }
a { color: var(--primary-dark); text-decoration: none; }
a:hover { text-decoration: underline; }
button, input, select { font: inherit; }

.shell { min-height: 100vh; display: grid; grid-template-columns: 248px 1fr; }
.sidebar { background: #101a2e; color: #dbe5ff; padding: 24px 16px; }
.brand { display: flex; gap: 10px; align-items: center; font-weight: 750; letter-spacing: .01em; color: #fff; margin: 0 10px 30px; }
.brand-mark { width: 32px; height: 32px; border-radius: 10px; display: grid; place-items: center; background: #3e7bff; box-shadow: 0 7px 18px rgba(62,123,255,.35); }
.nav { display: grid; gap: 6px; }
.nav a { color: #aebcd9; display: flex; gap: 10px; align-items: center; border-radius: 9px; padding: 10px 12px; }
.nav a:hover, .nav a.active { color: #fff; background: rgba(255,255,255,.1); text-decoration: none; }
.sidebar-foot { margin: 30px 10px 0; padding-top: 18px; border-top: 1px solid rgba(255,255,255,.12); color: #91a0bf; font-size: 12px; }
.main { min-width: 0; }
.topbar { min-height: 72px; padding: 16px 32px; background: var(--surface); border-bottom: 1px solid var(--line); display: flex; align-items: center; justify-content: space-between; gap: 20px; }
.topbar h1 { margin: 0; font-size: 20px; }
.topbar-actions { display: flex; align-items: center; gap: 14px; }
.content { padding: 32px; max-width: 1500px; margin: 0 auto; }
.narrow-card { max-width: 640px; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.stack { display: grid; gap: 20px; }
.grid { display: grid; gap: 18px; }
.grid-4 { grid-template-columns: repeat(4, minmax(0, 1fr)); }
.grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.grid-2 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
.card { background: var(--surface); border: 1px solid var(--line); border-radius: 14px; box-shadow: var(--shadow); }
.card-pad { padding: 20px; }
.card h2, .card h3 { margin: 0 0 12px; font-size: 16px; }
.metric { padding: 18px 20px; }
.metric-label { color: var(--muted); font-size: 13px; }
.metric-value { margin-top: 3px; font-size: 30px; line-height: 1.15; font-weight: 760; }
.metric-critical .metric-value { color: var(--danger); }
.metric-high .metric-value { color: #d95716; }
.metric-medium .metric-value { color: var(--warning); }
.metric-low .metric-value { color: var(--success); }
.toolbar { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.toolbar-left, .toolbar-right { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.btn { cursor: pointer; display: inline-flex; align-items: center; justify-content: center; gap: 7px; border-radius: 8px; border: 1px solid transparent; padding: 9px 14px; font-weight: 650; font-size: 13px; }
.btn-primary { color: #fff; background: var(--primary); }
.btn-primary:hover { background: var(--primary-dark); text-decoration: none; }
.btn-secondary { color: var(--ink); background: var(--surface); border-color: var(--line); }
.btn-secondary:hover { background: var(--surface-muted); text-decoration: none; }
.btn-danger { color: #fff; background: var(--danger); }
.btn-ghost { color: var(--muted); background: transparent; border-color: transparent; }
.btn-sm { padding: 6px 9px; font-size: 12px; }
.form-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.field { display: grid; gap: 6px; }
.field.full { grid-column: 1 / -1; }
.field label { font-size: 13px; font-weight: 650; }
.field input, .field select, .field textarea { width: 100%; color: var(--ink); background: #fff; border: 1px solid #cbd5e4; border-radius: 8px; padding: 10px 11px; outline: none; }
.field input:focus, .field select:focus, .field textarea:focus { border-color: var(--primary); box-shadow: 0 0 0 3px rgba(36,99,235,.12); }
.field textarea { min-height: 140px; resize: vertical; }
.table-wrap { overflow: auto; }
table { width: 100%; border-collapse: collapse; min-width: 720px; }
th, td { text-align: left; padding: 13px 16px; border-bottom: 1px solid var(--line); vertical-align: top; }
th { color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; background: var(--surface-muted); }
tr:last-child td { border-bottom: 0; }
.badge { display: inline-flex; align-items: center; border-radius: 999px; padding: 3px 9px; font-size: 12px; font-weight: 700; white-space: nowrap; }
.badge-critical { color: #9b2030; background: #fde8ec; }
.badge-high { color: #a44317; background: #ffede5; }
.badge-medium { color: #875100; background: #fff5da; }
.badge-low { color: #176b43; background: #e4f6ec; }
.badge-muted { color: #56657c; background: #edf1f6; }
.status-ok { color: var(--success); }
.status-error { color: var(--danger); }
.alert { border-radius: 9px; padding: 11px 14px; border: 1px solid; font-size: 13px; }
.alert-error { color: #8f2431; background: #fff0f2; border-color: #f2c3ca; }
.alert-success { color: #17613e; background: #eaf8f0; border-color: #b9e8cd; }
.alert-info { color: #204a7d; background: #edf5ff; border-color: #c6dcfa; }
.alert-warning { color: #7d4c00; background: #fff8e8; border-color: #f1d69a; }
.pagination { display: flex; gap: 7px; justify-content: flex-end; padding: 16px; }
.pagination a, .pagination span { min-width: 34px; text-align: center; padding: 6px 8px; border: 1px solid var(--line); border-radius: 7px; font-size: 13px; }
.pagination .current { color: #fff; background: var(--primary); border-color: var(--primary); }
.detail-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.detail-list { display: grid; grid-template-columns: 170px 1fr; gap: 9px 16px; margin: 0; }
.detail-list dt { color: var(--muted); font-size: 13px; }
.detail-list dd { margin: 0; overflow-wrap: anywhere; }
.code-block { margin: 0; max-height: 480px; overflow: auto; color: #dce6fa; background: #111a2b; border-radius: 9px; padding: 15px; font: 12px/1.55 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; white-space: pre-wrap; word-break: break-word; }
.report-frame { width: 100%; min-height: 780px; border: 1px solid var(--line); border-radius: 10px; background: #fff; }
.login-page { min-height: 100vh; display: grid; place-items: center; padding: 24px; background: radial-gradient(circle at top left, #eaf0ff 0, #f3f6fb 44%, #eef2f8 100%); }
.login-card { width: min(420px, 100%); padding: 30px; background: #fff; border: 1px solid var(--line); border-radius: 16px; box-shadow: 0 20px 55px rgba(40,57,90,.14); }
.login-card .brand { color: var(--ink); margin: 0 0 28px; }
.login-card .brand-mark { color: #fff; }
.login-card h1 { margin: 0 0 7px; font-size: 24px; }
.login-card .muted { margin: 0 0 22px; }
.login-card form { display: grid; gap: 15px; }
.login-card .btn { width: 100%; margin-top: 4px; }
.empty { padding: 40px 20px; text-align: center; color: var(--muted); }

@media (max-width: 1000px) {
    .shell { grid-template-columns: 1fr; }
    .sidebar { padding: 12px 16px; }
    .brand { margin: 0 0 12px; }
    .nav { display: flex; overflow: auto; }
    .sidebar-foot { display: none; }
    .content { padding: 22px 18px; }
    .grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
    .detail-grid { grid-template-columns: 1fr; }
}
@media (max-width: 620px) {
    .topbar { padding: 14px 18px; align-items: flex-start; flex-direction: column; }
    .topbar-actions { width: 100%; justify-content: space-between; }
    .grid-4, .grid-3, .grid-2, .form-grid { grid-template-columns: 1fr; }
    .field.full { grid-column: auto; }
    .detail-list { grid-template-columns: 1fr; gap: 2px; }
    .detail-list dd { margin-bottom: 9px; }
}
