* { box-sizing: border-box; }
:root { font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif; color: #172033; background: #f5f7fb; }
html, body { min-height: 100%; }
html { background: #f5f7fb; }
body { margin: 0; min-height: 100vh; display: flex; flex-direction: column; line-height: 1.5; }
a { color: #2457c5; text-decoration: none; }
a:hover { text-decoration: underline; }
.container { width: min(1440px, calc(100% - 48px)); margin: 0 auto; }
.site-header { background: #111827; color: #fff; }
.nav-wrap { min-height: 72px; display: flex; align-items: center; justify-content: space-between; gap: 24px; }
.brand { display: inline-flex; align-items: center; flex: 0 0 auto; text-decoration: none; }
.brand:hover { text-decoration: none; }
.brand-logo { display: block; width: auto; height: 52px; filter: brightness(0) invert(1); }
.site-header nav { display: flex; align-items: center; gap: 18px; }
.site-header nav a, .site-header .link-button { color: #dbe5ff; }
.nav-user { color: #fff; font-weight: 650; padding-left: 18px; border-left: 1px solid rgba(255,255,255,.22); white-space: nowrap; }
.page { flex: 1 0 auto; padding: 36px 0 64px; }
.page-header, .section-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin-bottom: 24px; }
h1 { margin: 0 0 6px; font-size: 2rem; }
h2 { margin: 0; }
.muted, .help { color: #687386; }
.help { font-size: .9rem; margin-top: 6px; }
.btn { display: inline-flex; align-items: center; justify-content: center; border: 1px solid #cfd6e4; background: #fff; color: #1f2937; padding: 9px 14px; border-radius: 8px; cursor: pointer; font: inherit; text-decoration: none; }
.btn:hover { text-decoration: none; background: #f3f4f6; }
.btn.primary { background: #2457c5; border-color: #2457c5; color: #fff; }
.btn.danger { background: #b42318; border-color: #b42318; color: #fff; }
.btn.ghost { background: transparent; }
.button-row { display: flex; gap: 10px; flex-wrap: wrap; }
.search-row { display: flex; gap: 10px; margin-bottom: 18px; }
.search-row .form-control { flex: 1; }
.form-control { width: 100%; border: 1px solid #cfd6e4; background: #fff; border-radius: 8px; padding: 10px 12px; font: inherit; color: inherit; }
.form-control:focus { outline: 2px solid #aac2ff; border-color: #2457c5; }
select.form-control[multiple] { min-height: 310px; }
.form-card, .auth-card { width: min(620px, 100%); margin: 0 auto; background: #fff; border: 1px solid #e1e5ed; border-radius: 12px; padding: 28px; box-shadow: 0 6px 20px rgba(17,24,39,.05); }
.form-card.wide { width: min(820px, 100%); }
.form-group { margin: 20px 0; }
.form-group label { display: block; font-weight: 650; margin-bottom: 7px; }
.field-error { color: #b42318; margin-top: 6px; font-size: .92rem; }
.table-card { overflow-x: auto; background: #fff; border: 1px solid #e1e5ed; border-radius: 12px; }
table { width: 100%; border-collapse: collapse; }
th, td { padding: 14px 16px; text-align: left; border-bottom: 1px solid #edf0f4; vertical-align: top; }
th { font-size: .83rem; text-transform: uppercase; letter-spacing: .04em; color: #687386; background: #fafbfc; }
tbody tr:last-child td { border-bottom: 0; }
.number { text-align: right; }
.actions { display: flex; gap: 12px; flex-wrap: wrap; }
.empty { text-align: center; color: #687386; padding: 36px; }
.inline-form { display: inline; margin: 0; }
.link-button { background: none; border: 0; padding: 0; font: inherit; cursor: pointer; }
.danger-link { color: #b42318 !important; }
.alert { padding: 12px 14px; border-radius: 8px; margin-bottom: 18px; background: #eaf2ff; border: 1px solid #bad1ff; }
.alert.error { background: #fff0ee; border-color: #ffcbc4; color: #8f1d13; }
.alert.success { background: #edf9f0; border-color: #c7ebcf; color: #176b2c; }
.stats { display: inline-flex; align-items: baseline; gap: 8px; background: #fff; border: 1px solid #e1e5ed; border-radius: 10px; padding: 12px 16px; margin-bottom: 28px; }
.stats strong { font-size: 1.4rem; }
.back-link { display: inline-block; margin-bottom: 8px; }
.pagination { display: flex; justify-content: center; align-items: center; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.pagination-pages { display: flex; align-items: center; justify-content: center; gap: 6px; flex-wrap: wrap; }
.pagination-page { min-width: 42px; padding-left: 10px; padding-right: 10px; }
.pagination-page.active { background: #2457c5; border-color: #2457c5; color: #fff; cursor: default; }
.pagination-ellipsis { min-width: 26px; text-align: center; color: #687386; }
.pagination-summary { flex-basis: 100%; text-align: center; color: #687386; font-size: .88rem; }
@media (max-width: 720px) { .container { width: calc(100% - 24px); } .page-header, .section-header, .nav-wrap { align-items: flex-start; flex-direction: column; } .nav-wrap { padding-top: 12px; padding-bottom: 12px; } .brand-logo { height: 46px; } .site-header nav { flex-wrap: wrap; padding-bottom: 4px; } .nav-user { padding-left: 0; border-left: 0; flex-basis: 100%; } .search-row { flex-wrap: wrap; } .actions { min-width: 180px; } }
.alert.warning { background: #fff8e6; border-color: #f2d58a; color: #72510d; }
.full-width { width: 100%; }
.separator { display: flex; align-items: center; gap: 12px; color: #687386; margin: 22px 0; }
.separator::before, .separator::after { content: ""; flex: 1; height: 1px; background: #e1e5ed; }
.code-sample { background: #111827; color: #e5e7eb; border-radius: 8px; padding: 12px 14px; overflow-x: auto; }
.code-sample pre { margin: 0; }
.checkbox-row { display: flex !important; align-items: center; gap: 9px; }
.checkbox-row input { width: auto; }

.help-page h2 { margin-top: 28px; }
.help-page h2:first-child { margin-top: 0; }
.hotline { padding: 14px 16px; border: 1px solid #bad1ff; background: #eaf2ff; border-radius: 8px; }
.help-page p { max-width: 78ch; }

/* Security Advisory Service */
.sas-header { margin-bottom: 18px; }
.sas-stats-grid { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 12px; margin-bottom: 20px; }
.sas-stat-card { background: #fff; border: 1px solid #e1e5ed; border-radius: 12px; padding: 16px 18px; box-shadow: 0 4px 14px rgba(17,24,39,.035); }
.sas-stat-card span { display: block; color: #687386; font-size: .83rem; text-transform: uppercase; letter-spacing: .04em; }
.sas-stat-card strong { display: block; font-size: 1.65rem; margin-top: 4px; }
.sas-filter-card { background: #fff; border: 1px solid #e1e5ed; border-radius: 12px; padding: 18px; margin-bottom: 20px; }
.sas-filter-grid { display: grid; grid-template-columns: minmax(220px, 2fr) repeat(4, minmax(130px, 1fr)); gap: 14px; align-items: end; }
.sas-filter-grid label { display: block; font-weight: 650; font-size: .9rem; margin-bottom: 6px; }
.sas-check-row { display: flex; flex-wrap: wrap; align-items: center; gap: 12px 18px; margin-top: 16px; }
.sas-check-row label { display: inline-flex; align-items: center; gap: 7px; font-size: .92rem; }
.sas-table-card { width: 100%; }
.sas-table { min-width: 1060px; }
.sas-reference-cell span, .sas-title-cell span, .sas-secondary { display: block; margin-top: 4px; color: #687386; font-size: .82rem; }
.sas-reference { font-weight: 750; white-space: nowrap; }
.sas-title-cell { min-width: 300px; }
.sas-title-cell > a { color: #172033; font-weight: 700; }
.sas-state { font-size: .72rem !important; text-transform: uppercase; letter-spacing: .04em; }
.risk-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 72px; padding: 4px 8px; border-radius: 999px; font-size: .75rem; font-weight: 800; letter-spacing: .03em; background: #eef1f6; color: #43506a; }
.risk-critical { background: #fee4e2; color: #9d1c17; }
.risk-high { background: #ffead5; color: #9a3412; }
.risk-medium { background: #fff4cc; color: #755300; }
.risk-low { background: #e9f7ec; color: #176b2c; }
.risk-large { font-size: .9rem; padding: 8px 13px; }
.sas-signals { display: flex; flex-wrap: wrap; gap: 5px; min-width: 115px; }
.signal { display: inline-flex; padding: 3px 6px; border-radius: 6px; background: #eaf2ff; color: #2457c5; font-size: .68rem; font-weight: 800; letter-spacing: .03em; }
.signal-danger { background: #fee4e2; color: #9d1c17; }
.signal-ok { background: #e9f7ec; color: #176b2c; }
.signal-muted { background: #eef1f6; color: #687386; }
.sas-detail-kicker { color: #687386; font-size: .82rem; text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.sas-detail-section { margin-top: 30px; }
.sas-detail-section > h2 { margin-bottom: 12px; }
.sas-detail-section > p { max-width: 88ch; }
.sas-detail-columns { display: grid; grid-template-columns: 1fr 1fr; gap: 28px; }
.sas-info-item { background: #fff; border: 1px solid #e1e5ed; border-radius: 10px; padding: 14px 16px; margin-bottom: 10px; }
.sas-info-item p { margin: 7px 0; }
.sas-info-item span, .sas-info-item a { display: block; color: #687386; font-size: .88rem; margin-top: 4px; }
.sas-reference-list { display: grid; gap: 8px; }
.sas-reference-list > a { display: block; background: #fff; border: 1px solid #e1e5ed; border-radius: 8px; padding: 10px 12px; }
.sas-reference-list span { display: block; color: #687386; font-size: .82rem; margin-top: 3px; }
@media (max-width: 980px) { .sas-stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); } .sas-filter-grid { grid-template-columns: 1fr 1fr; } .sas-filter-wide { grid-column: 1 / -1; } }
@media (max-width: 720px) { .sas-stats-grid, .sas-filter-grid, .sas-detail-columns { grid-template-columns: 1fr; } }

/* Theme switch */
html { color-scheme: light; }
html[data-theme="dark"] { color-scheme: dark; }
body { background: #f5f7fb; color: #172033; transition: background-color .18s ease, color .18s ease; }
.theme-toggle {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 9px;
    background: rgba(255,255,255,.06);
    color: #f8fafc;
    cursor: pointer;
    padding: 0;
}
.theme-toggle:hover { background: rgba(255,255,255,.13); }
.theme-toggle:focus-visible { outline: 2px solid #aac2ff; outline-offset: 2px; }
.theme-icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
html[data-theme="light"] .theme-icon-sun { display: none; }
html[data-theme="dark"] .theme-icon-moon { display: none; }
.nav-utilities { margin-left: auto; }

/* Help / glossary */
.help-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 18px; align-items: start; }
.help-section { background: #fff; border: 1px solid #e1e5ed; border-radius: 12px; padding: 22px; box-shadow: 0 4px 14px rgba(17,24,39,.035); }
.help-support { margin-bottom: 18px; }
.help-section h2 { margin: 0 0 14px; font-size: 1.18rem; }
.help-section > p:last-child { margin-bottom: 0; }
.help-definitions { margin: 0; display: grid; gap: 0; }
.help-definitions > div { display: grid; grid-template-columns: minmax(190px, .9fr) minmax(0, 2.1fr); gap: 18px; padding: 11px 0; border-top: 1px solid #edf0f4; }
.help-definitions > div:first-child { border-top: 0; padding-top: 0; }
.help-definitions > div:last-child { padding-bottom: 0; }
.help-definitions dt { font-weight: 750; min-width: 0; overflow-wrap: anywhere; word-break: normal; }
.help-definitions dd { margin: 0; min-width: 0; color: #536078; overflow-wrap: anywhere; }
.help-definitions.compact dt { display: flex; align-items: flex-start; }
.help-note { margin-top: 16px; padding: 12px 14px; border-left: 3px solid #2457c5; background: #f4f7ff; border-radius: 0 8px 8px 0; color: #43506a; }

/* Dark theme */
html[data-theme="dark"] { background: #0b1120; }
html[data-theme="dark"] body { background: #0b1120; color: #e5e7eb; }
html[data-theme="dark"] a { color: #8fb3ff; }
html[data-theme="dark"] .site-header { background: #080d18; border-bottom: 1px solid #1f2937; }
html[data-theme="dark"] .muted,
html[data-theme="dark"] .help,
html[data-theme="dark"] .empty,
html[data-theme="dark"] .separator,
html[data-theme="dark"] .sas-reference-cell span,
html[data-theme="dark"] .sas-title-cell span,
html[data-theme="dark"] .sas-secondary,
html[data-theme="dark"] .sas-detail-kicker,
html[data-theme="dark"] .sas-info-item span,
html[data-theme="dark"] .sas-info-item a,
html[data-theme="dark"] .sas-reference-list span { color: #9aa7b9; }
html[data-theme="dark"] .btn { background: #172033; border-color: #344056; color: #e5e7eb; }
html[data-theme="dark"] .btn:hover { background: #202b3e; }
html[data-theme="dark"] .btn.primary { background: #376fdc; border-color: #376fdc; color: #fff; }
html[data-theme="dark"] .btn.danger { background: #b42318; border-color: #b42318; color: #fff; }
html[data-theme="dark"] .btn.ghost { background: transparent; }
html[data-theme="dark"] .form-control { background: #0f172a; border-color: #3a465a; color: #e5e7eb; }
html[data-theme="dark"] .form-control::placeholder { color: #778499; }
html[data-theme="dark"] .form-control:focus { outline-color: #5f86de; border-color: #5f86de; }
html[data-theme="dark"] .form-card,
html[data-theme="dark"] .auth-card,
html[data-theme="dark"] .table-card,
html[data-theme="dark"] .stats,
html[data-theme="dark"] .sas-stat-card,
html[data-theme="dark"] .sas-filter-card,
html[data-theme="dark"] .sas-info-item,
html[data-theme="dark"] .sas-reference-list > a,
html[data-theme="dark"] .help-section { background: #111827; border-color: #2a3547; box-shadow: none; }
html[data-theme="dark"] th { color: #aab5c5; background: #151e2e; }
html[data-theme="dark"] th,
html[data-theme="dark"] td { border-bottom-color: #273244; }
html[data-theme="dark"] .sas-title-cell > a { color: #e8edf5; }
html[data-theme="dark"] .sas-stat-card span { color: #9aa7b9; }
html[data-theme="dark"] .separator::before,
html[data-theme="dark"] .separator::after { background: #2a3547; }
html[data-theme="dark"] .alert { background: #162744; border-color: #31538a; color: #d9e7ff; }
html[data-theme="dark"] .alert.error { background: #3a1717; border-color: #71312e; color: #ffcbc4; }
html[data-theme="dark"] .alert.success { background: #112b1b; border-color: #285b38; color: #bfe8ca; }
html[data-theme="dark"] .alert.warning { background: #332813; border-color: #665126; color: #f0dca9; }
html[data-theme="dark"] .hotline { background: #162744; border-color: #31538a; color: #d9e7ff; }
html[data-theme="dark"] .help-definitions > div { border-top-color: #273244; }
html[data-theme="dark"] .help-definitions dd { color: #aeb8c7; }
html[data-theme="dark"] .help-note { background: #131f36; border-left-color: #5f86de; color: #b7c4d8; }
html[data-theme="dark"] .risk-badge { background: #273244; color: #cbd5e1; }
html[data-theme="dark"] .risk-critical { background: #4a171b; color: #ffb4ae; }
html[data-theme="dark"] .risk-high { background: #482714; color: #ffc28f; }
html[data-theme="dark"] .risk-medium { background: #3d3211; color: #f9dd7a; }
html[data-theme="dark"] .risk-low { background: #15351e; color: #9ee0ae; }
html[data-theme="dark"] .signal { background: #172d52; color: #9fc0ff; }
html[data-theme="dark"] .signal-danger { background: #4a171b; color: #ffb4ae; }
html[data-theme="dark"] .signal-ok { background: #15351e; color: #9ee0ae; }
html[data-theme="dark"] .signal-muted { background: #273244; color: #aab5c5; }
html[data-theme="dark"] .field-error,
html[data-theme="dark"] .danger-link { color: #ff8d86 !important; }
html[data-theme="dark"] .code-sample { background: #050914; color: #e5e7eb; }

@media (max-width: 1240px) {
    .help-grid { grid-template-columns: 1fr; }
}
@media (max-width: 720px) {
    .help-definitions > div { grid-template-columns: 1fr; gap: 5px; }
    .theme-toggle { width: 34px; height: 34px; }
}

/* Header authentication controls */
.logout-button {
    width: 36px;
    height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: 0 0 auto;
    border: 1px solid rgba(255,255,255,.22);
    border-radius: 9px;
    background: rgba(255,255,255,.06);
    color: #f8fafc;
    cursor: pointer;
    padding: 0;
}
.logout-button:hover { background: rgba(255,255,255,.13); }
.logout-button:focus-visible { outline: 2px solid #aac2ff; outline-offset: 2px; }
.logout-icon { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.header-login-button {
    min-height: 34px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 5px 12px;
    border: 1px solid rgba(255,255,255,.28);
    border-radius: 8px;
    background: rgba(255,255,255,.08);
    color: #fff !important;
    font-size: .9rem;
    font-weight: 700;
    line-height: 1;
    text-decoration: none;
}
.header-login-button:hover { background: rgba(255,255,255,.16); text-decoration: none; }
.header-login-button:focus-visible { outline: 2px solid #aac2ff; outline-offset: 2px; }
.auth-card-sas { width: min(720px, 100%); }
.auth-card-sas h1 { margin-bottom: 16px; }
.auth-lead { margin: 0 0 12px; font-size: 1.08rem; font-weight: 650; line-height: 1.6; }
.auth-description { margin: 0; color: #536078; line-height: 1.7; }
.auth-login-hint { margin: 22px 0 0; padding: 12px 14px; border-radius: 8px; background: #f4f7ff; border: 1px solid #d8e4ff; color: #43506a; }
html[data-theme="dark"] .auth-description { color: #aeb8c7; }
html[data-theme="dark"] .auth-login-hint { background: #131f36; border-color: #2c4673; color: #b7c4d8; }

@media (max-width: 720px) {
    .site-header nav { gap: 10px; }
    .nav-wrap { gap: 14px; }
    .header-login-button { min-height: 34px; padding: 5px 10px; }
    .logout-button { width: 34px; height: 34px; }
}

/* SAS v12.0.7: separate operational risk from technical severity. */
.sas-risk-stack { display: flex; gap: 12px; align-items: flex-start; flex-wrap: wrap; justify-content: flex-end; }
.sas-risk-stack > div { display: grid; gap: 5px; justify-items: end; }
.sas-risk-label { color: #687386; font-size: .72rem; text-transform: uppercase; letter-spacing: .05em; font-weight: 700; }
html[data-theme="dark"] .sas-risk-label { color: #9aa7b9; }
.sas-table { min-width: 1220px; }
.sas-secondary { overflow-wrap: anywhere; }
