:root {
  color-scheme: light;
  --ink: #182230;
  --muted: #475467;
  --subtle: #667085;
  --line: #d0d5dd;
  --line-soft: #e4e7ec;
  --surface: #ffffff;
  --canvas: #f7f9fc;
  --primary: #174ea6;
  --primary-strong: #103f8c;
  --primary-soft: #eef4ff;
  --success: #08783e;
  --success-soft: #ecfdf3;
  --warning: #8a4b00;
  --warning-soft: #fff7e6;
  --danger: #b42318;
  --danger-soft: #fff1f0;
  --shadow: 0 12px 30px rgb(16 24 40 / 8%);
  --radius: 12px;
  --brand: var(--primary);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }
html { min-height: 100%; background: var(--canvas); }
body { min-height: 100vh; margin: 0; color: var(--ink); background: var(--canvas); line-height: 1.55; }
button, input, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
button { cursor: pointer; }
a { color: var(--primary); }
:focus-visible { outline: 3px solid #79a8ff; outline-offset: 2px; }
.skip-link { position: fixed; z-index: 1000; top: 8px; left: 8px; padding: 10px 14px; transform: translateY(-150%); border-radius: 8px; background: #fff; color: #111; box-shadow: var(--shadow); }
.skip-link:focus { transform: none; }
.eyebrow { margin: 0 0 8px; color: var(--primary); font-size: .76rem; font-weight: 800; letter-spacing: .11em; text-transform: uppercase; }
.eyebrow-light { color: #b9d0ff; }
.muted { color: var(--muted); }
.fine-print { margin-top: 24px; color: var(--subtle); font-size: .82rem; }
.brand-link { display: inline-flex; align-items: center; gap: 10px; color: var(--ink); text-decoration: none; font-weight: 800; }
.brand-light { color: #fff; }
.brand-mark { display: inline-grid; width: 42px; height: 42px; place-items: center; border-radius: 11px; background: var(--primary); color: #fff; font-size: .82rem; font-weight: 900; letter-spacing: -.03em; }
.brand-light .brand-mark { background: #fff; color: #123d78; }
.button { display: inline-flex; min-height: 44px; align-items: center; justify-content: center; gap: 8px; border: 1px solid transparent; border-radius: 9px; padding: 10px 16px; font-weight: 750; transition: background .15s ease, border-color .15s ease, transform .15s ease; }
.button:active { transform: translateY(1px); }
.button:disabled { cursor: wait; opacity: .62; }
.button-primary { background: var(--primary); color: #fff; }
.button-primary:hover { background: var(--primary-strong); }
.button-secondary { border-color: var(--line); background: #fff; color: var(--ink); }
.button-secondary:hover { background: #f8fafc; border-color: #98a2b3; }
.button-danger { background: var(--danger); color: #fff; }
.button-small { min-height: 36px; padding: 7px 11px; font-size: .84rem; }
.button-block { width: 100%; }
.link-button { border: 0; padding: 4px; background: none; color: inherit; text-decoration: underline; text-underline-offset: 3px; }
.icon-button { display: grid; width: 40px; height: 40px; place-items: center; border: 0; border-radius: 9px; background: transparent; color: var(--muted); font-size: 1.5rem; }
.icon-button:hover { background: #f2f4f7; }

/* Authentication */
.auth-page { background: #eff3f8; }
.auth-layout { display: grid; min-height: 100vh; grid-template-columns: minmax(380px, .95fr) minmax(440px, 1.05fr); }
.auth-story { display: flex; min-height: 100vh; flex-direction: column; justify-content: space-between; overflow: hidden; padding: clamp(32px, 5vw, 72px); background: #123d78; color: #fff; }
.auth-story h1 { max-width: 760px; margin: 0; font-size: clamp(2.8rem, 5.5vw, 6.6rem); line-height: .98; letter-spacing: -.065em; }
.auth-lead { max-width: 620px; margin: 30px 0 0; color: #dce8ff; font-size: clamp(1rem, 1.4vw, 1.25rem); }
.trust-list { display: flex; flex-wrap: wrap; gap: 10px 24px; margin: 0; padding: 0; color: #dce8ff; list-style: none; }
.trust-list li::before { content: "✓"; margin-right: 8px; color: #86efac; font-weight: 900; }
.auth-card { align-self: center; width: min(100% - 48px, 460px); margin: 48px auto; border: 1px solid var(--line-soft); border-radius: 18px; padding: clamp(28px, 4vw, 48px); background: #fff; box-shadow: var(--shadow); }
.auth-card h2 { margin: 0; font-size: 2rem; letter-spacing: -.04em; }
.auth-card > .muted { margin: 8px 0 28px; }
.auth-card form { display: grid; gap: 10px; }
.auth-card label, .field label { margin-top: 8px; font-size: .9rem; font-weight: 750; }
input, select { width: 100%; min-height: 44px; border: 1px solid var(--line); border-radius: 9px; padding: 10px 12px; background: #fff; color: var(--ink); }
input:hover, select:hover { border-color: #98a2b3; }
input:focus, select:focus { border-color: var(--primary); }
.auth-card .button { margin-top: 14px; }
.form-error { margin-bottom: 18px; border: 1px solid #fda29b; border-radius: 9px; padding: 11px 13px; background: var(--danger-soft); color: #912018; font-size: .9rem; }
.mobile-brand { display: none; align-items: center; gap: 10px; margin-bottom: 28px; }

/* Application shell */
.app-shell { display: grid; min-height: 100vh; grid-template-columns: 248px minmax(0, 1fr); }
.sidebar { position: sticky; top: 0; z-index: 30; display: flex; height: 100vh; flex-direction: column; border-right: 1px solid #23334b; padding: 20px 14px; background: #142033; color: #e9eef6; }
.sidebar-brand { display: flex; align-items: center; gap: 11px; padding: 4px 8px 24px; }
.sidebar-brand .brand-mark { width: 38px; height: 38px; background: #fff; color: #123d78; }
.sidebar-brand div { display: grid; }
.sidebar-brand span:last-child { color: #9fb0c8; font-size: .72rem; }
.nav-list { display: grid; gap: 4px; }
.nav-item { display: flex; min-height: 44px; align-items: center; gap: 11px; border: 0; border-radius: 9px; padding: 9px 12px; background: transparent; color: #ccd6e4; text-align: left; }
.nav-item > span { display: inline-grid; width: 22px; place-items: center; color: #9fb0c8; }
.nav-item:hover { background: #1d2c43; color: #fff; }
.nav-item.is-active { background: #254c85; color: #fff; font-weight: 750; }
.nav-item.is-active > span { color: #fff; }
.nav-section { padding: 24px 12px 6px; color: #7f91aa; font-size: .67rem; font-weight: 800; letter-spacing: .12em; text-transform: uppercase; }
.sidebar-footer { display: grid; gap: 10px; margin-top: auto; border-top: 1px solid #2a3a50; padding: 18px 8px 4px; color: #9fb0c8; font-size: .8rem; }
.system-dot { display: flex; align-items: center; gap: 8px; }
.system-dot span { width: 8px; height: 8px; border-radius: 50%; background: #32d583; box-shadow: 0 0 0 4px rgb(50 213 131 / 12%); }
.main-column { min-width: 0; }
.topbar { position: sticky; top: 0; z-index: 20; display: flex; min-height: 86px; align-items: center; gap: 18px; border-bottom: 1px solid var(--line-soft); padding: 14px clamp(20px, 4vw, 48px); background: rgb(255 255 255 / 94%); backdrop-filter: blur(12px); }
.topbar h1 { margin: 0; font-size: 1.45rem; letter-spacing: -.025em; }
.topbar-kicker { margin: 0 0 1px; color: var(--subtle); font-size: .77rem; }
.topbar-actions { display: flex; align-items: center; gap: 10px; margin-left: auto; }
.avatar-button { display: grid; width: 44px; height: 44px; place-items: center; border: 0; border-radius: 50%; background: #e8eef8; color: #153b70; font-size: .78rem; font-weight: 850; }
.menu-button { display: none; width: 44px; height: 44px; border: 1px solid var(--line); border-radius: 9px; background: #fff; }
.content { width: min(100%, 1480px); margin: 0 auto; padding: clamp(22px, 4vw, 48px); }
.loading-state { display: grid; min-height: 50vh; place-items: center; align-content: center; gap: 10px; color: var(--subtle); }
.spinner { width: 30px; height: 30px; border: 3px solid #dbe5f5; border-top-color: var(--primary); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Dashboard */
.view-head { display: flex; align-items: end; justify-content: space-between; gap: 20px; margin-bottom: 28px; }
.view-head h2 { margin: 0; font-size: clamp(1.6rem, 2.4vw, 2.25rem); letter-spacing: -.045em; }
.view-head p { max-width: 720px; margin: 6px 0 0; color: var(--muted); }
.actions { display: flex; flex-wrap: wrap; gap: 9px; }
.metric-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.metric-card, .panel { border: 1px solid var(--line-soft); border-radius: var(--radius); background: var(--surface); box-shadow: 0 1px 2px rgb(16 24 40 / 3%); }
.metric-card { padding: 20px; }
.metric-card span { color: var(--muted); font-size: .8rem; font-weight: 700; }
.metric-card strong { display: block; margin-top: 12px; font-size: 2rem; line-height: 1; letter-spacing: -.045em; }
.metric-card small { display: block; margin-top: 9px; color: var(--subtle); }
.panel { padding: 22px; }
.panel + .panel { margin-top: 18px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.panel-head h2, .panel-head h3 { margin: 0; font-size: 1.05rem; }
.panel-head p { margin: 3px 0 0; color: var(--subtle); font-size: .84rem; }
.domain-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 14px; }
.domain-card { position: relative; display: grid; gap: 18px; border: 1px solid var(--line-soft); border-radius: 11px; padding: 18px; background: #fff; }
.domain-card:hover { border-color: #a8b9d1; box-shadow: 0 8px 24px rgb(16 24 40 / 6%); }
.domain-card-head { display: flex; align-items: start; justify-content: space-between; gap: 16px; }
.domain-name { display: flex; align-items: center; gap: 11px; }
.domain-icon { display: grid; width: 38px; height: 38px; place-items: center; border-radius: 9px; background: var(--primary-soft); color: var(--primary); font-weight: 900; }
.domain-name h3 { margin: 0; font-size: 1rem; }
.domain-name p { margin: 1px 0 0; color: var(--subtle); font-size: .77rem; }
.score { display: grid; width: 52px; height: 52px; place-items: center; border: 5px solid #dbe7f8; border-radius: 50%; color: var(--ink); font-size: .9rem; font-weight: 850; }
.domain-metrics { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.domain-metrics div { display: grid; gap: 2px; }
.domain-metrics span { color: var(--subtle); font-size: .7rem; }
.domain-metrics strong { font-size: .83rem; }
.status-badge, .severity { display: inline-flex; align-items: center; width: fit-content; border-radius: 999px; padding: 4px 9px; font-size: .71rem; font-weight: 800; }
.status-stable, .severity-info { background: var(--success-soft); color: var(--success); }
.status-attention, .severity-medium, .severity-low { background: var(--warning-soft); color: var(--warning); }
.status-critical, .severity-critical, .severity-high { background: var(--danger-soft); color: var(--danger); }
.status-pending { background: #f2f4f7; color: var(--muted); }
.empty-state { display: grid; min-height: 240px; place-items: center; align-content: center; border: 1px dashed #b8c4d4; border-radius: 12px; padding: 30px; text-align: center; }
.empty-icon { display: grid; width: 54px; height: 54px; place-items: center; border-radius: 13px; background: var(--primary-soft); color: var(--primary); font-size: 1.45rem; }
.empty-state h3 { margin: 16px 0 4px; }
.empty-state p { max-width: 520px; margin: 0 0 18px; color: var(--muted); }
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; }
th, td { border-bottom: 1px solid var(--line-soft); padding: 13px 10px; text-align: left; vertical-align: top; }
th { color: var(--subtle); font-size: .72rem; letter-spacing: .04em; text-transform: uppercase; }
td { font-size: .88rem; }
tr:last-child td { border-bottom: 0; }
.table-action { border: 0; padding: 0; background: none; color: var(--primary); font-weight: 750; }
.detail-hero { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 22px; align-items: center; border: 1px solid var(--line-soft); border-radius: 14px; padding: 26px; background: #fff; }
.detail-hero h2 { margin: 4px 0; font-size: 1.8rem; letter-spacing: -.045em; }
.detail-hero p { margin: 0; color: var(--muted); }
.score-large { display: grid; width: 108px; height: 108px; place-items: center; border: 10px solid #dbe7f8; border-radius: 50%; text-align: center; }
.score-large strong { display: block; font-size: 2rem; line-height: 1; }
.score-large span { color: var(--subtle); font-size: .7rem; }
.detail-layout { display: grid; grid-template-columns: minmax(0, 1.55fr) minmax(270px, .75fr); gap: 18px; margin-top: 18px; }
.task-list { display: grid; gap: 10px; }
.task-card { border-left: 4px solid var(--line); border-radius: 8px; padding: 14px 16px; background: #f9fafb; }
.task-card.sev-critical, .task-card.sev-high { border-left-color: var(--danger); }
.task-card.sev-medium, .task-card.sev-low { border-left-color: #dc7b00; }
.task-card h3 { margin: 7px 0 4px; font-size: .96rem; }
.task-card p { margin: 0; color: var(--muted); font-size: .85rem; }
.task-card .recommendation { margin-top: 9px; color: var(--ink); }
.compact-list { display: grid; gap: 10px; margin: 0; padding: 0; list-style: none; }
.compact-list li { display: flex; justify-content: space-between; gap: 12px; border-bottom: 1px solid var(--line-soft); padding-bottom: 9px; font-size: .84rem; }
.compact-list li:last-child { border: 0; padding-bottom: 0; }
.compact-list span { color: var(--subtle); }
.trend-list { display: grid; gap: 9px; }
.trend-item { display: grid; grid-template-columns: 2.1rem minmax(0, 1fr); align-items: center; gap: 8px; color: var(--subtle); font-size: .72rem; }
.trend-progress { width: 100%; height: 10px; border: 0; border-radius: 999px; overflow: hidden; background: var(--surface-muted); }
.trend-progress::-webkit-progress-bar { border-radius: 999px; background: var(--surface-muted); }
.trend-progress::-webkit-progress-value { border-radius: 999px; background: #6f9fdf; }
.trend-progress::-moz-progress-bar { border-radius: 999px; background: #6f9fdf; }
.verification-box { border: 1px solid #b7cdf1; border-radius: 10px; padding: 14px; background: var(--primary-soft); }
.verification-box code { display: block; overflow-wrap: anywhere; margin-top: 8px; border: 1px solid #c8d9f3; border-radius: 7px; padding: 9px; background: #fff; color: #143765; }

/* Dialogs and forms */
.dialog { width: min(92vw, 620px); max-height: 90vh; border: 0; border-radius: 15px; padding: 0; background: #fff; color: var(--ink); box-shadow: 0 30px 90px rgb(16 24 40 / 30%); }
.dialog::backdrop { background: rgb(8 15 27 / 58%); backdrop-filter: blur(3px); }
.dialog-head { display: flex; align-items: start; justify-content: space-between; border-bottom: 1px solid var(--line-soft); padding: 20px 22px; }
.dialog-head h2 { margin: 0; font-size: 1.35rem; }
.dialog-body { overflow-y: auto; max-height: calc(90vh - 92px); padding: 22px; }
.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 small { color: var(--subtle); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; grid-column: 1 / -1; margin-top: 8px; }
.inline-error { grid-column: 1 / -1; border-radius: 8px; padding: 10px; background: var(--danger-soft); color: var(--danger); }
.toast-region { position: fixed; z-index: 100; right: 18px; bottom: 18px; display: grid; width: min(380px, calc(100vw - 36px)); gap: 8px; }
.toast { border: 1px solid #b7cdf1; border-radius: 10px; padding: 13px 15px; background: #fff; box-shadow: var(--shadow); font-size: .88rem; }
.toast-error { border-color: #fda29b; background: var(--danger-soft); color: #912018; }

/* Reports */
.report-page { background: #eef2f7; }
.report-toolbar { position: sticky; top: 0; z-index: 10; display: flex; align-items: center; justify-content: space-between; border-bottom: 1px solid var(--line); padding: 12px max(18px, calc((100vw - 1040px) / 2)); background: rgb(255 255 255 / 95%); }
.report-toolbar button { min-height: 40px; border: 0; border-radius: 8px; padding: 8px 14px; background: var(--primary); color: #fff; font-weight: 750; }
.report-shell { width: min(100% - 32px, 1040px); margin: 30px auto; border-radius: 16px; padding: clamp(24px, 5vw, 58px); background: #fff; box-shadow: var(--shadow); }
.report-header { display: flex; align-items: start; justify-content: space-between; gap: 30px; border-bottom: 3px solid var(--brand); padding-bottom: 28px; }
.report-header h1 { margin: 0; font-size: clamp(2rem, 4vw, 3.4rem); line-height: 1; letter-spacing: -.055em; }
.report-header p:not(.eyebrow) { margin: 12px 0 0; color: var(--muted); }
.score-orb { display: grid; width: 112px; height: 112px; flex: 0 0 auto; place-items: center; align-content: center; border: 9px solid #d9e5f7; border-radius: 50%; }
.score-orb strong { font-size: 2rem; line-height: 1; }
.score-orb span { color: var(--subtle); font-size: .7rem; }
.report-summary { display: flex; align-items: center; justify-content: space-between; gap: 20px; margin: 28px 0; border-radius: 11px; padding: 16px 18px; background: #f6f8fb; }
.report-summary > div { display: flex; align-items: center; gap: 9px; }
.report-summary p { margin: 0; color: var(--muted); }
.status-dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; }
.status-dot.status-stable { background: var(--success); }
.status-dot.status-attention { background: #dc7b00; }
.status-dot.status-critical { background: var(--danger); }
.report-shell section { margin-top: 34px; }
.report-shell h2 { margin: 0 0 15px; font-size: 1.2rem; }
.report-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; }
.report-finding { break-inside: avoid; border: 1px solid var(--line-soft); border-left: 4px solid var(--line); border-radius: 9px; padding: 15px; }
.report-finding.finding-critical, .report-finding.finding-high { border-left-color: var(--danger); }
.report-finding.finding-medium, .report-finding.finding-low { border-left-color: #dc7b00; }
.finding-heading { display: flex; align-items: center; justify-content: space-between; gap: 12px; color: var(--subtle); font-size: .7rem; }
.report-finding h3 { margin: 10px 0 5px; font-size: .98rem; }
.report-finding p { margin: 5px 0; color: var(--muted); font-size: .82rem; }
.report-finding p strong { color: var(--ink); }
.finding-url { overflow-wrap: anywhere; font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }
.evidence { border-radius: 6px; padding: 7px; background: #f7f8fa; }
.report-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin: 0; }
.report-metrics div { border: 1px solid var(--line-soft); border-radius: 9px; padding: 13px; }
.report-metrics dt { color: var(--subtle); font-size: .7rem; }
.report-metrics dd { margin: 6px 0 0; font-weight: 800; }
.report-footer { margin-top: 46px; border-top: 1px solid var(--line); padding-top: 18px; color: var(--subtle); font-size: .72rem; }
.empty-copy { color: var(--muted); }

@media (max-width: 1050px) {
  .metric-grid { grid-template-columns: repeat(2, 1fr); }
  .detail-layout { grid-template-columns: 1fr; }
  .auth-layout { grid-template-columns: .85fr 1.15fr; }
  .auth-story h1 { font-size: clamp(2.8rem, 6vw, 4.6rem); }
}
@media (max-width: 780px) {
  .auth-layout { display: block; padding: 24px 0; }
  .auth-story { display: none; }
  .auth-card { width: min(100% - 28px, 480px); margin: 30px auto; }
  .mobile-brand { display: flex; }
  .app-shell { display: block; }
  .sidebar { position: fixed; left: 0; transform: translateX(-102%); width: min(82vw, 280px); transition: transform .2s ease; box-shadow: var(--shadow); }
  body.menu-open .sidebar { transform: none; }
  .menu-button { display: block; }
  .topbar { min-height: 74px; padding: 10px 14px; }
  .topbar .button-secondary { display: none; }
  .content { padding: 20px 14px 36px; }
  .view-head { align-items: start; flex-direction: column; }
  .metric-grid, .domain-grid, .report-grid { grid-template-columns: 1fr; }
  .detail-hero { grid-template-columns: 1fr; }
  .score-large { width: 88px; height: 88px; }
  .form-grid { grid-template-columns: 1fr; }
  .report-shell { width: min(100% - 18px, 1040px); margin: 10px auto; border-radius: 10px; padding: 22px 16px; }
  .report-header { align-items: start; flex-direction: column; }
  .report-summary { align-items: start; flex-direction: column; }
  .report-metrics { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 460px) {
  .metric-grid { grid-template-columns: 1fr; }
  .domain-metrics { grid-template-columns: repeat(2, 1fr); }
  .topbar-kicker { display: none; }
  .topbar h1 { font-size: 1.13rem; }
  .report-metrics { grid-template-columns: 1fr; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; }
}
@media print {
  @page { size: A4; margin: 14mm; }
  .no-print { display: none !important; }
  .report-page { background: #fff; }
  .report-shell { width: 100%; margin: 0; border-radius: 0; padding: 0; box-shadow: none; }
  .report-grid { grid-template-columns: 1fr 1fr; }
  .report-finding { break-inside: avoid; }
  .report-footer { break-inside: avoid; }
}

