:root {
    --navy: #00305e;
    --blue: #0067b1;
    --blue-50: #e5f0f9;
    --blue-100: #cce2f3;
    --red: #e2001a;
    --red-50: #fdecea;
    --gray-50: #f7f8fa;
    --gray-100: #eef1f5;
    --gray-200: #d9dfe8;
    --gray-400: #8e9bb0;
    --gray-600: #4e5b72;
    --gray-800: #1e2a3a;
    --white: #ffffff;
    --border: #d1d9e6;
    --header-h: 60px;
    --font: "Source Sans 3", "Segoe UI", Arial, sans-serif;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html,
body {
    min-height: 100%;
}

body {
    margin: 0;
    font-family: var(--font);
    font-size: 14px;
    line-height: 1.45;
    color: var(--gray-800);
    background: #e7e8ea;
}

button,
input,
select {
    font: inherit;
}

.topbar {
    position: fixed;
    top: 0;
    right: 0;
    left: 0;
    z-index: 20;
    height: var(--header-h);
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 0 24px;
    color: var(--white);
    background: var(--navy);
    border-bottom: 3px solid var(--blue);
}

.brand {
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 190px;
}

.brand-logo {
    width: 78px;
    height: 34px;
    display: block;
    flex: 0 0 auto;
}

.brand-title {
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.topbar-divider {
    width: 1px;
    height: 24px;
    background: rgb(255 255 255 / 22%);
}

.topbar-title {
    color: rgb(255 255 255 / 76%);
    font-size: 13px;
}

.topbar-meta {
    margin-left: auto;
    color: rgb(255 255 255 / 62%);
    font-size: 12px;
    white-space: nowrap;
}

.topbar-form {
    margin: 0;
}

.ghost-button {
    min-height: 36px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    color: var(--navy);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    font-weight: 800;
    cursor: pointer;
}

.ghost-button:hover:not(:disabled) {
    border-color: var(--blue);
    color: var(--blue);
}

.ghost-button:disabled,
.icon-button:disabled {
    cursor: not-allowed;
    opacity: 0.48;
}

.ghost-button-light {
    min-height: 32px;
    color: var(--white);
    background: transparent;
    border-color: rgb(255 255 255 / 32%);
}

.app-shell {
    min-height: 100vh;
    padding-top: var(--header-h);
    display: grid;
    grid-template-columns: 260px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: var(--header-h);
    height: calc(100vh - var(--header-h));
    overflow: auto;
    background: var(--white);
    border-right: 1px solid var(--border);
}

.sidebar-section {
    padding: 18px 14px;
}

.sidebar-section-tight {
    padding: 0;
}

.sidebar-section-bordered {
    border-top: 1px solid var(--border);
}

.sidebar-heading,
.panel-title,
.eyebrow {
    color: var(--navy);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.sidebar-empty {
    color: var(--gray-600);
    font-size: 13px;
}

.app-footer {
    width: 100%;
    justify-self: stretch;
    display: flex;
    justify-content: flex-end;
    padding: 16px 0 0;
    color: var(--gray-400);
    border-top: 1px solid var(--border);
    font-size: 12px;
    font-weight: 800;
    text-align: right;
}

.app-footer-credit {
    margin-left: auto;
}

.app-footer-brand {
    margin-left: 3px;
    color: var(--gray-600);
    letter-spacing: 0.04em;
}

.app-footer-brand-o {
    font-weight: 900;
}

.app-footer-brand-o-black {
    color: #111111;
}

.app-footer-brand-o-pink {
    color: #f238d6;
}

.report-link,
.filter-link {
    display: grid;
    gap: 4px;
    margin-top: 8px;
    padding: 10px 12px;
    color: var(--gray-800);
    text-decoration: none;
    border-left: 3px solid transparent;
    border-radius: 4px;
}

.nav-item {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 7px 17px 7px 20px;
    color: var(--gray-600);
    background: transparent;
    border: 0;
    text-decoration: none;
    border-left: 3px solid transparent;
    border-radius: 0;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.nav-item:hover {
    color: var(--navy);
    background: var(--gray-50);
}

.nav-item.active {
    color: var(--blue);
    background: var(--blue-50);
    border-left-color: var(--blue);
    font-weight: 800;
}

.nav-item span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.nav-badge {
    min-width: 28px;
    padding: 1px 7px;
    color: var(--gray-600);
    background: var(--gray-100);
    border-radius: 999px;
    font-size: 10px;
    font-weight: 900;
    text-align: center;
}

.nav-badge.danger {
    color: var(--red);
    background: var(--red-50);
}

.nav-badge.info {
    color: var(--blue);
    background: var(--blue-50);
}

.nav-badge.warning {
    color: #b45309;
    background: #fff3cd;
}

.nav-overview {
    width: calc(100% + 28px);
    display: block;
    margin: -18px -14px;
    padding: 14px 20px;
    color: var(--blue);
    background: transparent;
    border: 0;
    text-decoration: none;
    border-left: 3px solid transparent;
    border-radius: 0;
    font: inherit;
    cursor: pointer;
    text-align: left;
}

.nav-overview.active,
.nav-overview:hover {
    background: var(--blue-50);
    border-left-color: var(--blue);
    font-weight: 800;
}

.nav-group {
    border-top: 1px solid var(--border);
}

.nav-group:first-child {
    border-top: 0;
}

.nav-group summary {
    min-height: 40px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 11px 17px;
    color: var(--navy);
    cursor: pointer;
    list-style: none;
    font-size: 10px;
    font-weight: 900;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

.nav-group summary::-webkit-details-marker {
    display: none;
}

.nav-group summary b {
    color: var(--gray-400);
    font-size: 11px;
}

.report-link:hover,
.filter-link:hover,
.report-link.is-active,
.filter-link.is-active {
    background: var(--blue-50);
    border-left-color: var(--blue);
}

.report-link-main {
    color: var(--navy);
    font-weight: 900;
}

.report-link-sub {
    color: var(--gray-600);
    font-size: 12px;
}

.dashboard-main {
    min-width: 0;
    padding: 32px;
}

.dashboard-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 18px;
    padding-bottom: 18px;
    border-bottom: 2px solid var(--navy);
}

.dashboard-head h1,
.section-head h2,
.empty-state h1 {
    margin: 0;
    color: var(--navy);
    font-weight: 900;
    letter-spacing: 0;
}

.dashboard-head h1 {
    font-size: 30px;
}

.section-head h2 {
    font-size: 18px;
}

.head-actions {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: flex-end;
}

.muted-link,
.url-cell {
    color: var(--blue);
    text-decoration: none;
}

.muted-link:hover,
.url-cell:hover,
.simple-list a:hover,
.source-list a:hover {
    text-decoration: underline;
}

.metric-grid {
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 22px;
}

.metric {
    min-height: 86px;
    padding: 14px;
    background: var(--white);
    border: 1px solid var(--border);
    border-top: 3px solid var(--navy);
    border-radius: 6px;
}

.metric-danger {
    border-top-color: var(--red);
}

.metric-warning {
    border-top-color: #f59e0b;
}

.metric-info {
    border-top-color: var(--blue);
}

.metric-label {
    display: block;
    color: var(--gray-600);
    font-size: 12px;
    font-weight: 800;
    text-transform: uppercase;
}

.metric strong {
    display: block;
    margin-top: 8px;
    color: var(--navy);
    font-size: 30px;
    line-height: 1;
}

.metric-danger strong {
    color: var(--red);
}

.metric-warning strong {
    color: #b45309;
}

.metric-info strong {
    color: var(--blue);
}

.split-layout {
    display: grid;
    grid-template-columns: 220px minmax(0, 1fr);
    gap: 18px;
    align-items: start;
}

.filter-panel,
.panel,
.toolbar,
.empty-state {
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.filter-panel {
    position: sticky;
    top: calc(var(--header-h) + 16px);
    padding: 14px;
}

.filter-link {
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
}

.filter-link span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.filter-link b {
    color: var(--blue);
    font-size: 12px;
}

.content-stack {
    display: grid;
    gap: 18px;
    min-width: 0;
}

.toolbar {
    padding: 14px;
}

.filter-form {
    display: grid;
    grid-template-columns: 160px 140px 140px minmax(220px, 1fr) auto;
    gap: 12px;
    align-items: end;
}

.filter-form label {
    display: grid;
    gap: 5px;
}

.filter-form span {
    color: var(--navy);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.filter-form select,
.filter-form input {
    width: 100%;
    min-height: 38px;
    padding: 8px 10px;
    color: var(--gray-800);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
}

.compact-button {
    width: auto;
    min-height: 38px;
}

.panel {
    padding: 16px;
}

.section-head {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 14px;
}

.section-count {
    color: var(--gray-600);
    font-size: 12px;
    font-weight: 800;
    white-space: nowrap;
}

.status-pill,
.severity {
    display: inline-flex;
    align-items: center;
    min-height: 22px;
    padding: 2px 8px;
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    text-transform: capitalize;
}

.status-open,
.status-running {
    color: #9b0012;
    background: var(--red-50);
}

.status-paused {
    color: #835500;
    background: #fff3cd;
}

.status-complete,
.status-resolved {
    color: #006b3f;
    background: #dff5ea;
}

.severity-high {
    color: #9b0012;
    background: var(--red-50);
}

.severity-medium {
    color: #835500;
    background: #fff3cd;
}

.severity-low {
    color: var(--blue);
    background: var(--blue-50);
}

.link-group-list {
    display: grid;
    gap: 8px;
}

.link-group {
    border: 1px solid var(--border);
    border-radius: 6px;
}

.link-group summary {
    min-height: 46px;
    display: grid;
    grid-template-columns: 44px minmax(0, 1fr) auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    cursor: pointer;
}

.link-group-count {
    color: var(--white);
    background: var(--red);
    border-radius: 999px;
    text-align: center;
    font-weight: 900;
}

.link-group-url,
.url-cell,
.simple-list span {
    overflow-wrap: anywhere;
}

.link-group-body {
    padding: 0 12px 12px;
    border-top: 1px solid var(--gray-100);
}

.source-list,
.simple-list {
    display: grid;
    gap: 8px;
}

.source-list a,
.simple-list a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
    color: var(--blue);
    text-decoration: none;
}

.source-list a span {
    color: var(--gray-600);
    font-size: 12px;
}

.table-wrap {
    overflow: auto;
    border: 1px solid var(--border);
    border-radius: 6px;
}

.issue-table {
    width: 100%;
    min-width: 1180px;
    border-collapse: collapse;
    background: var(--white);
}

.issue-table th,
.issue-table td {
    padding: 12px;
    text-align: left;
    vertical-align: top;
    border-bottom: 1px solid var(--gray-100);
}

.issue-table th {
    color: var(--gray-400);
    background: #fbfcfe;
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.issue-table td:first-child {
    width: 120px;
}

.issue-table td:nth-child(2),
.issue-table td:nth-child(3) {
    width: 230px;
}

.issue-title {
    color: var(--navy);
    font-weight: 900;
}

.issue-fix {
    margin-top: 5px;
    color: var(--gray-800);
}

.issue-meta,
.muted,
.empty-table {
    color: var(--gray-600);
    font-size: 12px;
}

.evidence {
    margin-top: 8px;
}

.evidence summary {
    color: var(--blue);
    cursor: pointer;
    font-weight: 800;
}

.evidence pre {
    max-height: 180px;
    overflow: auto;
    margin: 8px 0 0;
    padding: 10px;
    color: var(--gray-800);
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: 4px;
    font-size: 12px;
    white-space: pre-wrap;
}

.icon-button {
    width: 32px;
    height: 32px;
    color: var(--blue);
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    border-radius: 4px;
    font-weight: 900;
}

.two-column {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
}

.empty-state {
    padding: 32px;
}

.empty-state p {
    color: var(--gray-600);
}

.auth-page {
    min-height: 100vh;
    padding: calc(var(--header-h) + 54px) 24px 48px;
}

.auth-shell {
    width: min(100%, 420px);
    margin: 0 auto;
}

.auth-kicker {
    margin: 0 0 8px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 800;
    letter-spacing: 0.12em;
    text-transform: uppercase;
}

.auth-title {
    margin: 0;
    color: var(--navy);
    font-size: 30px;
    font-weight: 800;
    letter-spacing: 0;
}

.auth-subtitle {
    margin: 8px 0 22px;
    color: var(--gray-600);
}

.auth-panel {
    padding: 24px;
    background: var(--white);
    border: 1px solid var(--border);
    border-top: 4px solid var(--blue);
    border-radius: 6px;
    box-shadow: 0 14px 34px rgb(0 48 94 / 8%);
}

.alert {
    margin: 0 0 18px;
    padding: 10px 12px;
    color: #9b0012;
    background: var(--red-50);
    border: 1px solid #f5b8bf;
    border-radius: 6px;
    font-weight: 700;
}

.field {
    display: grid;
    gap: 7px;
    margin-bottom: 16px;
}

.field-label {
    color: var(--navy);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.field input {
    width: 100%;
    min-height: 42px;
    padding: 10px 12px;
    color: var(--gray-800);
    background: var(--white);
    border: 1px solid var(--border);
    border-radius: 4px;
    outline: none;
}

.field input:focus {
    border-color: var(--blue);
    box-shadow: 0 0 0 3px var(--blue-100);
}

.primary-button {
    width: 100%;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 10px 16px;
    color: var(--white);
    background: var(--blue);
    border: 1px solid var(--blue);
    border-radius: 4px;
    font-weight: 800;
    cursor: pointer;
}

.primary-button:hover {
    background: #005da0;
}

.head-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 16px;
    margin-top: 10px;
    color: var(--gray-600);
    font-size: 12px;
}

.metric-grid-wide {
    grid-template-columns: repeat(6, minmax(0, 1fr));
}

.insight-grid {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 12px;
    margin-bottom: 18px;
}

.insight {
    min-height: 170px;
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 8px 14px;
    padding: 15px;
    background: var(--white);
    border: 1px solid var(--border);
    border-top: 3px solid var(--blue);
    border-radius: 6px;
}

.insight h2 {
    margin: 3px 0 0;
    color: var(--navy);
    font-size: 17px;
    line-height: 1.2;
}

.insight strong {
    color: var(--navy);
    font-size: 30px;
    line-height: 1;
}

.insight p {
    grid-column: 1 / -1;
    margin: 0;
    color: var(--gray-600);
}

.insight-action {
    color: var(--gray-800) !important;
    font-weight: 800;
}

.insight-high {
    border-top-color: var(--red);
}

.insight-high strong {
    color: var(--red);
}

.insight-medium,
.insight-warning {
    border-top-color: #f59e0b;
}

.insight-medium strong,
.insight-warning strong {
    color: #b45309;
}

.filter-form-wide {
    grid-template-columns: 145px 130px 130px 130px minmax(240px, 1fr) auto;
}

.panel-note {
    margin: -4px 0 12px;
    color: var(--gray-600);
    font-size: 13px;
}

.grouped-table {
    min-width: 1080px;
}

.raw-table {
    min-width: 1180px;
}

.grouped-table td:nth-child(1) {
    width: 132px;
}

.grouped-table td:nth-child(2) {
    width: 34%;
}

.grouped-table td:nth-child(3) {
    width: 160px;
}

.grouped-table td:nth-child(4) {
    width: 130px;
}

.scope-label {
    color: var(--navy);
    font-weight: 900;
}

.template-flag {
    display: inline-flex;
    margin-top: 7px;
    padding: 3px 7px;
    color: #835500;
    background: #fff3cd;
    border-radius: 999px;
    font-size: 11px;
    font-weight: 900;
}

.tag-list {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-top: 8px;
}

.tag-list span {
    max-width: 100%;
    padding: 3px 7px;
    color: var(--gray-600);
    background: var(--gray-100);
    border-radius: 999px;
    font-size: 11px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.help-tip {
    position: relative;
    display: inline-flex;
    align-items: center;
    min-height: 28px;
    padding: 5px 9px;
    color: var(--blue);
    background: var(--blue-50);
    border: 1px solid var(--blue-100);
    border-radius: 999px;
    font-size: 12px;
    font-weight: 900;
    cursor: help;
    outline: none;
}

.help-tip:focus {
    box-shadow: 0 0 0 3px var(--blue-100);
}

.help-popover {
    position: absolute;
    right: 0;
    top: calc(100% + 8px);
    z-index: 12;
    width: min(360px, 80vw);
    display: none;
    padding: 12px;
    color: var(--gray-800);
    background: var(--white);
    border: 1px solid var(--border);
    border-top: 3px solid var(--blue);
    border-radius: 6px;
    box-shadow: 0 18px 35px rgb(0 48 94 / 15%);
    font-size: 13px;
    font-weight: 400;
    line-height: 1.45;
}

.help-popover b {
    display: block;
    margin: 0 0 3px;
    color: var(--navy);
    font-size: 11px;
    font-weight: 900;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.help-popover b:not(:first-child) {
    margin-top: 10px;
}

.help-tip:hover .help-popover,
.help-tip:focus .help-popover,
.help-tip:focus-within .help-popover {
    display: block;
}

.sample-pages {
    margin-top: 9px;
}

.sample-pages summary {
    color: var(--blue);
    cursor: pointer;
    font-weight: 800;
}

.sample-pages .source-list {
    margin-top: 8px;
    padding: 10px;
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: 6px;
}

.page-list {
    display: grid;
    gap: 8px;
}

.page-list a {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 14px;
    padding: 10px 12px;
    color: var(--gray-800);
    background: var(--gray-50);
    border: 1px solid var(--gray-100);
    border-radius: 6px;
    text-decoration: none;
}

.page-list a:hover {
    border-color: var(--blue-100);
    background: var(--blue-50);
}

.page-list span {
    min-width: 0;
}

.page-list b,
.page-list small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.page-list b {
    color: var(--navy);
}

.page-list small {
    margin-top: 3px;
    color: var(--blue);
}

.page-list strong {
    min-width: 38px;
    align-self: center;
    padding: 3px 8px;
    color: var(--white);
    background: var(--blue);
    border-radius: 999px;
    text-align: center;
}

.auth-footnote {
    margin: 16px 0 0;
    color: var(--gray-600);
    font-size: 12px;
    text-align: center;
}

@media (max-width: 1180px) {
    .metric-grid-wide,
    .insight-grid {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filter-form-wide {
        grid-template-columns: repeat(3, minmax(0, 1fr));
    }

    .filter-search {
        grid-column: span 2;
    }
}

@media (max-width: 900px) {
    .metric-grid-wide,
    .insight-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 640px) {
    .topbar {
        padding: 0 14px;
    }

    .brand {
        min-width: 0;
    }

    .topbar-title,
    .topbar-meta {
        display: none;
    }

    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        height: auto;
        border-right: 0;
        border-bottom: 1px solid var(--border);
    }

    .dashboard-main {
        padding: 20px 14px;
    }

    .dashboard-head,
    .split-layout,
    .two-column {
        grid-template-columns: 1fr;
    }

    .dashboard-head {
        display: grid;
    }

    .metric-grid,
    .metric-grid-wide,
    .insight-grid {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }

    .filter-panel {
        position: static;
    }

    .filter-form,
    .filter-form-wide {
        grid-template-columns: 1fr;
    }

    .link-group summary {
        grid-template-columns: 38px minmax(0, 1fr);
    }

    .link-group summary .severity {
        grid-column: 2;
        justify-self: start;
    }

    .auth-page {
        padding-right: 16px;
        padding-left: 16px;
    }
}
