:root {
    color-scheme: light;
    font-family:
        Inter,
        ui-sans-serif,
        system-ui,
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;

    --navy: #13233f;
    --navy-soft: #1d3154;
    --blue: #2563eb;
    --blue-light: #eff6ff;
    --text: #172033;
    --muted: #687386;
    --border: #e4e9f1;
    --surface: #ffffff;
    --background: #f5f7fb;
    --success: #15803d;
    --success-light: #ecfdf3;
    --warning: #b45309;
    --warning-light: #fff7ed;
    --danger: #b42318;
    --danger-light: #fef3f2;
    --shadow: 0 10px 30px rgba(20, 35, 63, 0.06);
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-width: 320px;
    background: var(--background);
    color: var(--text);
}

button,
input,
select {
    font: inherit;
}

.app-shell {
    min-height: 100vh;
    display: grid;
    grid-template-columns: 248px minmax(0, 1fr);
}

.sidebar {
    position: sticky;
    top: 0;
    height: 100vh;
    padding: 28px 20px;
    background: var(--navy);
    color: #ffffff;
    display: flex;
    flex-direction: column;
}

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0 8px 28px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
}

.brand-mark {
    width: 43px;
    height: 43px;
    border-radius: 12px;
    background: #ffffff;
    color: var(--navy);
    display: grid;
    place-items: center;
    font-size: 14px;
    font-weight: 800;
    letter-spacing: -0.02em;
}

.brand-name {
    font-size: 16px;
    font-weight: 750;
}

.brand-subtitle {
    margin-top: 2px;
    font-size: 11px;
    color: rgba(255, 255, 255, 0.62);
    text-transform: uppercase;
    letter-spacing: 0.1em;
}

.navigation {
    display: grid;
    gap: 7px;
    margin-top: 28px;
}

.nav-item {
    min-height: 44px;
    padding: 0 13px;
    border-radius: 9px;
    display: flex;
    align-items: center;
    gap: 12px;
    color: rgba(255, 255, 255, 0.7);
    text-decoration: none;
    font-size: 14px;
    font-weight: 550;
}

.nav-item.active {
    color: #ffffff;
    background: rgba(255, 255, 255, 0.12);
}

.nav-item.disabled {
    cursor: default;
}

.nav-icon {
    width: 20px;
    text-align: center;
    opacity: 0.9;
}

.sidebar-footer {
    margin-top: auto;
    padding: 15px 8px 0;
    border-top: 1px solid rgba(255, 255, 255, 0.12);
    display: flex;
    align-items: center;
    gap: 9px;
    color: rgba(255, 255, 255, 0.7);
    font-size: 12px;
}

.status-dot {
    width: 8px;
    height: 8px;
    border-radius: 999px;
    display: inline-block;
    background: #22c55e;
    box-shadow: 0 0 0 4px rgba(34, 197, 94, 0.14);
}

.main-content {
    min-width: 0;
    padding: 34px 38px 48px;
}

.topbar {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 24px;
}

.eyebrow,
.panel-kicker {
    margin: 0 0 6px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.12em;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 6px;
    font-size: clamp(26px, 3vw, 34px);
    line-height: 1.15;
    letter-spacing: -0.035em;
}

h2 {
    margin-bottom: 0;
    font-size: 18px;
    letter-spacing: -0.02em;
}

.page-description {
    margin-bottom: 0;
    color: var(--muted);
    font-size: 14px;
}

.topbar-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.environment-badge,
.source-badge {
    border: 1px solid var(--border);
    background: var(--surface);
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    gap: 9px;
    white-space: nowrap;
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.environment-badge {
    min-height: 40px;
    padding: 0 14px;
}

.source-badge {
    padding: 7px 11px;
    background: var(--blue-light);
    border-color: #dbeafe;
    color: #1d4ed8;
}

.refresh-button {
    min-height: 40px;
    padding: 0 15px;
    border: 0;
    border-radius: 9px;
    background: var(--navy);
    color: #ffffff;
    cursor: pointer;
    font-size: 13px;
    font-weight: 650;
}

.refresh-button:hover {
    background: var(--navy-soft);
}

.refresh-button:disabled {
    cursor: wait;
    opacity: 0.6;
}

.notice {
    margin-top: 26px;
    padding: 13px 16px;
    border: 1px solid #dbeafe;
    border-radius: 10px;
    background: var(--blue-light);
    color: #334155;
    font-size: 12px;
    line-height: 1.55;
}

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

.metric-card,
.panel {
    border: 1px solid var(--border);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.metric-card {
    min-height: 142px;
    padding: 21px;
    border-radius: 13px;
    display: flex;
    flex-direction: column;
}

.metric-label {
    color: var(--muted);
    font-size: 12px;
    font-weight: 650;
}

.metric-value {
    margin-top: 15px;
    font-size: 33px;
    line-height: 1;
    letter-spacing: -0.04em;
}

.metric-caption {
    margin-top: auto;
    padding-top: 16px;
    color: var(--muted);
    font-size: 11px;
}

.content-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.7fr);
    gap: 18px;
    align-items: start;
}

.panel {
    border-radius: 13px;
    overflow: hidden;
}

.panel-header {
    min-height: 78px;
    padding: 19px 21px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.table-wrapper {
    overflow-x: auto;
}

table {
    width: 100%;
    border-collapse: collapse;
}

th,
td {
    padding: 15px 18px;
    border-bottom: 1px solid var(--border);
    text-align: left;
    white-space: nowrap;
}

th {
    background: #fafbfc;
    color: var(--muted);
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

td {
    color: #344054;
    font-size: 13px;
}

tbody tr:last-child td {
    border-bottom: 0;
}

.worker-name {
    color: var(--text);
    font-weight: 700;
}

.worker-id {
    margin-top: 3px;
    color: var(--muted);
    font-size: 11px;
}

.scenario-label {
    border-radius: 999px;
    padding: 6px 9px;
    display: inline-flex;
    background: #f2f4f7;
    color: #475467;
    font-size: 11px;
    font-weight: 650;
}

.table-status {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    color: var(--success);
    font-size: 11px;
    font-weight: 700;
    text-transform: capitalize;
}

.table-status::before {
    content: "";
    width: 6px;
    height: 6px;
    border-radius: 999px;
    background: currentColor;
}

.loading-cell {
    height: 130px;
    text-align: center;
    color: var(--muted);
}

.system-list {
    padding: 4px 21px;
}

.system-row {
    min-height: 72px;
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
}

.system-row:last-child {
    border-bottom: 0;
}

.system-row strong,
.system-row span {
    display: block;
}

.system-row strong {
    font-size: 13px;
}

.system-row div > span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 11px;
}

.system-state {
    border-radius: 999px;
    padding: 6px 9px;
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.system-state.healthy {
    background: var(--success-light);
    color: var(--success);
}

.system-state.pending {
    background: var(--warning-light);
    color: var(--warning);
}

.system-state.failed {
    background: var(--danger-light);
    color: var(--danger);
}

.update-time {
    padding: 15px 21px;
    border-top: 1px solid var(--border);
    background: #fafbfc;
    color: var(--muted);
    font-size: 11px;
}

.update-time strong {
    color: var(--text);
}

.error-banner {
    margin-top: 18px;
    padding: 13px 15px;
    border: 1px solid #fecdca;
    border-radius: 9px;
    background: var(--danger-light);
    color: var(--danger);
    font-size: 13px;
}

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

    .content-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .app-shell {
        grid-template-columns: 1fr;
    }

    .sidebar {
        position: static;
        width: auto;
        height: auto;
        padding: 18px;
    }

    .navigation {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        margin-top: 18px;
    }

    .sidebar-footer {
        margin-top: 18px;
    }

    .main-content {
        padding: 24px 18px 36px;
    }

    .topbar {
        flex-direction: column;
    }

    .topbar-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

@media (max-width: 520px) {
    .metric-grid,
    .navigation {
        grid-template-columns: 1fr;
    }

    .environment-badge,
    .refresh-button {
        flex: 1;
        justify-content: center;
    }
}

/* Executive RPP dashboard */

.metric-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.metric-icon {
    min-width: 31px;
    height: 31px;
    padding: 0 8px;
    border-radius: 9px;
    display: inline-grid;
    place-items: center;
    background: var(--blue-light);
    color: var(--blue);
    font-size: 10px;
    font-weight: 800;
}

.metric-icon.warning {
    background: var(--warning-light);
    color: var(--warning);
}

.executive-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: minmax(0, 1.55fr) minmax(300px, 0.65fr);
    gap: 18px;
    align-items: stretch;
}

.rpp-panel,
.attention-panel {
    min-height: 348px;
}

.rpp-layout {
    min-height: 267px;
    padding: 26px 28px;
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 32px;
    align-items: center;
}

.score-gauge {
    --gauge-score: 0deg;

    position: relative;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background:
        conic-gradient(
            var(--blue) 0deg,
            var(--blue) var(--gauge-score),
            #e8edf5 var(--gauge-score),
            #e8edf5 360deg
        );
}

.score-gauge::before {
    content: "";
    position: absolute;
    width: 148px;
    height: 148px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border);
}

.score-gauge-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.score-gauge-inner strong {
    display: block;
    font-size: 39px;
    line-height: 1;
    letter-spacing: -0.05em;
}

.score-gauge-inner span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
}

.rpp-summary-label {
    margin-bottom: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

.rpp-summary h3 {
    margin: 0;
    font-size: 21px;
    letter-spacing: -0.025em;
}

.rpp-summary > p:last-of-type {
    max-width: 560px;
    margin: 10px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.state-distribution {
    margin-top: 27px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 10px;
}

.state-item {
    min-height: 67px;
    padding: 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    align-items: center;
    gap: 10px;
}

.state-item strong,
.state-item span {
    display: block;
}

.state-item strong {
    font-size: 18px;
}

.state-item div > span {
    margin-top: 2px;
    color: var(--muted);
    font-size: 10px;
}

.state-dot {
    width: 9px;
    height: 9px;
    flex: 0 0 auto;
    border-radius: 999px;
}

.state-dot.optimal {
    background: var(--success);
}

.state-dot.watch {
    background: #d97706;
}

.state-dot.retest {
    background: var(--danger);
}

.attention-list {
    padding: 3px 21px;
}

.attention-row {
    min-height: 77px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: 38px minmax(0, 1fr) auto;
    gap: 12px;
    align-items: center;
}

.attention-row:last-child {
    border-bottom: 0;
}

.attention-row strong,
.attention-row span {
    display: block;
}

.attention-row strong {
    font-size: 12px;
}

.attention-row span {
    margin-top: 4px;
    color: var(--muted);
    font-size: 10px;
    line-height: 1.4;
}

.attention-row b {
    font-size: 20px;
}

.attention-icon {
    width: 34px;
    height: 34px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    font-size: 13px;
    font-weight: 800;
}

.attention-icon.watch {
    background: var(--warning-light);
    color: var(--warning);
}

.attention-icon.retest {
    background: var(--danger-light);
    color: var(--danger);
}

.attention-icon.review {
    background: var(--blue-light);
    color: var(--blue);
}

.system-health {
    margin: 0 21px 20px;
    padding: 14px;
    border: 1px solid #d1fadf;
    border-radius: 10px;
    background: var(--success-light);
    display: flex;
    align-items: center;
    gap: 12px;
}

.system-health strong,
.system-health span {
    display: block;
}

.system-health strong {
    color: var(--success);
    font-size: 12px;
}

.system-health div > span {
    margin-top: 3px;
    color: #417654;
    font-size: 10px;
}

.workforce-panel {
    margin-top: 18px;
}

.worker-score {
    font-size: 15px;
    color: var(--text);
}

.state-badge {
    border-radius: 999px;
    padding: 6px 9px;
    display: inline-flex;
    font-size: 10px;
    font-weight: 750;
    text-transform: uppercase;
    letter-spacing: 0.03em;
}

.state-badge.positive {
    background: var(--success-light);
    color: var(--success);
}

.state-badge.watch {
    background: var(--warning-light);
    color: var(--warning);
}

.state-badge.review {
    background: #fff1f3;
    color: #c01048;
}

.state-badge.retest {
    background: var(--danger-light);
    color: var(--danger);
}

.confidence-cell {
    min-width: 100px;
}

.confidence-cell > span {
    color: var(--text);
    font-size: 11px;
    font-weight: 700;
}

.confidence-track {
    width: 82px;
    height: 5px;
    margin-top: 7px;
    border-radius: 999px;
    overflow: hidden;
    background: #e8edf5;
}

.confidence-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--blue);
}

.action-cell {
    min-width: 260px;
    max-width: 350px;
    white-space: normal;
    color: var(--muted);
    line-height: 1.45;
}

.infrastructure-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(4, minmax(0, 1fr));
    gap: 13px;
}

.infrastructure-card {
    min-height: 76px;
    padding: 15px 17px;
    border: 1px solid var(--border);
    border-radius: 11px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.infrastructure-card span,
.infrastructure-card strong {
    display: block;
}

.infrastructure-card span {
    color: var(--muted);
    font-size: 10px;
    font-weight: 650;
}

.infrastructure-card strong {
    margin-top: 8px;
    font-size: 15px;
}

@media (max-width: 1120px) {
    .executive-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 820px) {
    .rpp-layout {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

    .state-distribution {
        text-align: left;
    }

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

@media (max-width: 520px) {
    .state-distribution,
    .infrastructure-grid {
        grid-template-columns: 1fr;
    }
}

/* Worker RPP detail page */

.worker-link {
    color: var(--text);
    text-decoration: none;
}

.worker-link:hover {
    color: var(--blue);
    text-decoration: underline;
}

.worker-topbar {
    align-items: flex-start;
}

.back-link {
    display: inline-flex;
    margin-bottom: 17px;
    color: var(--blue);
    font-size: 11px;
    font-weight: 750;
    text-decoration: none;
}

.back-link:hover {
    text-decoration: underline;
}

.worker-hero-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: minmax(0, 1.45fr) minmax(310px, 0.55fr);
    gap: 18px;
}

.worker-score-panel,
.worker-context-panel {
    min-height: 350px;
}

.worker-score-layout {
    min-height: 268px;
    padding: 26px 30px;
    display: grid;
    grid-template-columns: 210px minmax(0, 1fr);
    gap: 34px;
    align-items: center;
}

.detail-score-gauge {
    --detail-gauge-score: 0deg;

    position: relative;
    width: 190px;
    height: 190px;
    border-radius: 50%;
    display: grid;
    place-items: center;
    background:
        conic-gradient(
            var(--blue) 0deg,
            var(--blue) var(--detail-gauge-score),
            #e8edf5 var(--detail-gauge-score),
            #e8edf5 360deg
        );
}

.detail-score-gauge::before {
    content: "";
    position: absolute;
    width: 148px;
    height: 148px;
    border-radius: 50%;
    background: var(--surface);
    box-shadow: inset 0 0 0 1px var(--border);
}

.detail-score-inner {
    position: relative;
    z-index: 1;
    text-align: center;
}

.detail-score-inner strong {
    display: block;
    max-width: 130px;
    font-size: 34px;
    line-height: 1;
    letter-spacing: -0.045em;
}

.detail-score-inner span {
    display: block;
    margin-top: 8px;
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
}

.worker-score-summary h3 {
    margin: 0;
    font-size: 25px;
    letter-spacing: -0.035em;
}

.profile-confidence {
    margin-top: 20px;
    padding: 14px 16px;
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    justify-content: space-between;
    gap: 20px;
    align-items: center;
}

.profile-confidence span {
    color: var(--muted);
    font-size: 11px;
    font-weight: 650;
}

.profile-confidence strong {
    font-size: 18px;
}

.recommended-action {
    margin: 18px 0 0;
    color: var(--muted);
    font-size: 13px;
    line-height: 1.55;
}

.review-indicator {
    margin-top: 17px;
    padding: 11px 13px;
    border-radius: 9px;
    font-size: 11px;
    font-weight: 700;
}

.review-indicator.review-clear {
    background: var(--success-light);
    color: var(--success);
}

.review-indicator.review-required {
    background: var(--danger-light);
    color: var(--danger);
}

.context-list,
.provenance-list {
    margin: 0;
    padding: 9px 22px 22px;
}

.context-list > div,
.provenance-list > div {
    min-height: 48px;
    border-bottom: 1px solid var(--border);
    display: grid;
    grid-template-columns: minmax(110px, 0.7fr) minmax(0, 1.3fr);
    gap: 18px;
    align-items: center;
}

.context-list > div:last-child,
.provenance-list > div:last-child {
    border-bottom: 0;
}

.context-list dt,
.provenance-list dt {
    color: var(--muted);
    font-size: 10px;
    font-weight: 700;
}

.context-list dd,
.provenance-list dd {
    margin: 0;
    color: var(--text);
    font-size: 11px;
    font-weight: 650;
    text-align: right;
}

.worker-detail-grid {
    margin-top: 18px;
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 18px;
    align-items: stretch;
}

.component-list {
    padding: 19px 24px 25px;
}

.component-row {
    margin-bottom: 17px;
}

.component-row:last-child {
    margin-bottom: 0;
}

.component-row-header {
    display: flex;
    justify-content: space-between;
    gap: 18px;
    align-items: center;
}

.component-row-header strong {
    font-size: 11px;
}

.component-row-header span {
    color: var(--text);
    font-size: 11px;
    font-weight: 800;
}

.component-track {
    height: 7px;
    margin-top: 8px;
    overflow: hidden;
    border-radius: 999px;
    background: #e8edf5;
}

.component-bar {
    height: 100%;
    border-radius: 999px;
    background: var(--blue);
}

.component-row small {
    display: block;
    margin-top: 6px;
    color: var(--muted);
    font-size: 9px;
}

.signal-metric-grid {
    padding: 18px 22px;
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 11px;
}

.signal-metric-grid > div {
    min-height: 73px;
    padding: 13px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcfe;
}

.signal-metric-grid span,
.signal-metric-grid strong {
    display: block;
}

.signal-metric-grid span {
    color: var(--muted);
    font-size: 9px;
    font-weight: 650;
}

.signal-metric-grid strong {
    margin-top: 9px;
    font-size: 14px;
}

.explanation-box {
    margin: 0 22px 22px;
    padding: 14px 15px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fbfcfe;
}

.explanation-box > strong {
    display: block;
    margin-bottom: 8px;
    font-size: 11px;
}

.explanation-box div {
    color: var(--muted);
    font-size: 10px;
    line-height: 1.5;
}

.explanation-box ul {
    margin: 0;
    padding-left: 17px;
}

.quality-clear {
    color: var(--success);
    font-weight: 650;
}

.provenance-grid {
    margin-bottom: 20px;
}

.hash-value {
    overflow-wrap: anywhere;
    font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
    font-size: 9px !important;
}

@media (max-width: 1120px) {
    .worker-hero-grid,
    .worker-detail-grid {
        grid-template-columns: 1fr;
    }
}

@media (max-width: 760px) {
    .worker-score-layout {
        grid-template-columns: 1fr;
        justify-items: center;
        text-align: center;
    }

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

@media (max-width: 520px) {
    .signal-metric-grid {
        grid-template-columns: 1fr;
    }

    .context-list > div,
    .provenance-list > div {
        grid-template-columns: 1fr;
        gap: 4px;
        padding: 10px 0;
    }

    .context-list dd,
    .provenance-list dd {
        text-align: left;
    }
}

/* Link-button normalization */
.refresh-button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}

.refresh-button:hover,
.refresh-button:focus {
    text-decoration: none;
}
