:root {
    color-scheme: light;
    --ink: #17231e;
    --muted: #5d6b65;
    --line: #dce3df;
    --surface: #ffffff;
    --surface-soft: #f6f8f7;
    --brand: #225c48;
    --brand-dark: #174535;
    --brand-soft: #e8f1ed;
    --action: #8b4513;
    --action-soft: #fff4e8;
    --supervisor: #315c78;
    --supervisor-soft: #eaf2f7;
    --review: #675084;
    --review-soft: #f1edf6;
    --danger: #8a3030;
    --danger-soft: #faecec;
    --shadow: 0 12px 35px rgba(23, 35, 30, 0.08);
}

* { box-sizing: border-box; }

html { font-size: 16px; }

body {
    margin: 0;
    background: var(--surface-soft);
    color: var(--ink);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

a { color: var(--brand); }

a:hover { color: var(--brand-dark); }

a:focus-visible,
button:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #77a795;
    outline-offset: 3px;
}

.skip-link {
    position: fixed;
    top: 8px;
    left: 8px;
    z-index: 20;
    padding: 10px 14px;
    background: var(--ink);
    color: white;
    transform: translateY(-150%);
}

.skip-link:focus { transform: translateY(0); }

.shell {
    width: min(1180px, calc(100% - 40px));
    margin: 0 auto;
}

.site-header {
    background: var(--surface);
    border-bottom: 1px solid var(--line);
}

.header-inner {
    min-height: 76px;
    display: grid;
    grid-template-columns: auto 1fr auto;
    align-items: center;
    gap: 38px;
}

.wordmark {
    display: flex;
    flex-direction: column;
    color: var(--ink);
    text-decoration: none;
    line-height: 1.08;
}

.wordmark-name {
    font-size: 1.08rem;
    font-weight: 750;
    letter-spacing: -0.015em;
}

.wordmark-product {
    margin-top: 4px;
    color: var(--muted);
    font-size: 0.72rem;
    font-weight: 650;
    letter-spacing: 0.1em;
    text-transform: uppercase;
}

.primary-nav {
    align-self: stretch;
    display: flex;
    align-items: stretch;
    gap: 28px;
}

.primary-nav > a,
.primary-nav > span {
    display: flex;
    align-items: center;
    position: relative;
    color: #43514b;
    font-size: 0.94rem;
    font-weight: 650;
    text-decoration: none;
}

.primary-nav a[aria-current="page"] { color: var(--brand-dark); }

.primary-nav a[aria-current="page"]::after {
    position: absolute;
    right: 0;
    bottom: -1px;
    left: 0;
    height: 3px;
    background: var(--brand);
    content: "";
}

.nav-disabled { gap: 7px; opacity: 0.58; }

.coming-soon {
    padding: 2px 6px;
    border: 1px solid var(--line);
    border-radius: 999px;
    font-size: 0.62rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.account-area {
    min-width: 0;
    display: flex;
    align-items: center;
    gap: 16px;
}

.account-area form { margin: 0; }

.account-identity {
    max-width: 240px;
    overflow: hidden;
    color: var(--muted);
    font-size: 0.82rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.text-button {
    padding: 0;
    border: 0;
    background: transparent;
    color: var(--brand);
    cursor: pointer;
    font: inherit;
    font-size: 0.88rem;
    font-weight: 650;
}

.main-content { padding: 46px 0 72px; }

.page-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 32px;
    margin-bottom: 36px;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--brand);
    font-size: 0.72rem;
    font-weight: 750;
    letter-spacing: 0.11em;
    text-transform: uppercase;
}

h1, h2, h3 { line-height: 1.2; }

h1 {
    margin: 0;
    font-size: clamp(2rem, 4vw, 2.7rem);
    letter-spacing: -0.035em;
}

.date-range {
    margin: 9px 0 0;
    color: var(--muted);
    font-size: 1rem;
}

.page-context {
    margin: 0 0 5px;
    color: var(--muted);
    font-size: 0.9rem;
}

.section-title {
    margin: 0 0 14px;
    font-size: 1rem;
    letter-spacing: -0.01em;
}

.metric-grid {
    display: grid;
    grid-template-columns: 1.2fr repeat(4, 1fr);
    gap: 12px;
}

.metric {
    min-width: 0;
    padding: 20px;
    border: 1px solid var(--line);
    border-top: 3px solid #9bacA4;
    border-radius: 9px;
    background: var(--surface);
}

.metric p {
    min-height: 2.7em;
    margin: 0 0 10px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 650;
}

.metric strong {
    display: block;
    font-size: 1.85rem;
    letter-spacing: -0.035em;
}

.metric span {
    display: block;
    margin-top: 7px;
    color: var(--muted);
    font-size: 0.72rem;
}

.metric-primary { border-top-color: var(--brand); }
.metric-action { border-top-color: var(--action); }
.metric-supervisor { border-top-color: var(--supervisor); }
.metric-review { border-top-color: var(--review); }

.content-section { margin-top: 46px; }

.section-heading {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 24px;
    margin-bottom: 15px;
}

.section-heading h2 { margin: 0; font-size: 1.3rem; }

.section-heading p {
    margin: 5px 0 0;
    color: var(--muted);
    font-size: 0.86rem;
}

.table-key { white-space: nowrap; }

.key-mark {
    display: inline-block;
    width: 8px;
    height: 8px;
    margin-right: 5px;
    border-radius: 50%;
    background: var(--action);
}

.table-wrap {
    overflow-x: auto;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

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

th, td {
    padding: 15px 13px;
    border-bottom: 1px solid #e8ecea;
    text-align: right;
    vertical-align: middle;
    white-space: nowrap;
}

thead th {
    background: #f2f5f3;
    color: #4f5d57;
    font-size: 0.7rem;
    font-weight: 750;
    letter-spacing: 0.035em;
    text-transform: uppercase;
}

th:first-child, td:first-child { text-align: left; }
tbody th { max-width: 280px; white-space: normal; }
tbody tr:last-child th, tbody tr:last-child td { border-bottom: 0; }
tbody tr.needs-action { box-shadow: inset 3px 0 var(--action); }

.clinician-name {
    display: block;
    overflow-wrap: anywhere;
    font-size: 0.9rem;
}

.row-note {
    display: block;
    margin-top: 3px;
    color: var(--review);
    font-size: 0.72rem;
    font-weight: 500;
}

.row-action a { font-size: 0.82rem; font-weight: 700; }

.review-section {
    padding: 24px;
    border: 1px solid #ded5e8;
    border-radius: 10px;
    background: #faf8fc;
}

.status {
    display: inline-block;
    padding: 5px 9px;
    border: 1px solid currentColor;
    border-radius: 999px;
    font-size: 0.7rem;
    font-weight: 750;
    line-height: 1.15;
    white-space: nowrap;
}

.status-missing,
.status-pending { color: var(--action); background: var(--action-soft); }
.status-rejected { color: var(--danger); background: var(--danger-soft); }
.status-awaiting_supervisor { color: var(--supervisor); background: var(--supervisor-soft); }
.status-data_quality { color: var(--review); background: var(--review-soft); }

.session-list { display: grid; gap: 12px; }

.session-card {
    display: grid;
    grid-template-columns: minmax(220px, 1fr) minmax(420px, 1.35fr);
    align-items: center;
    gap: 28px;
    padding: 20px 22px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
}

.session-card h3 { margin: 0; font-size: 1rem; }
.session-card p { margin: 5px 0 0; color: var(--muted); font-size: 0.86rem; }

.session-facts,
.detail-summary {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 18px;
    margin: 0;
}

.session-facts div,
.detail-summary div { min-width: 0; }

.session-facts dt,
.detail-summary dt {
    margin-bottom: 5px;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

.session-facts dd,
.detail-summary dd { margin: 0; font-size: 0.87rem; font-weight: 650; }

.back-link {
    display: inline-block;
    margin-bottom: 22px;
    font-size: 0.87rem;
    font-weight: 650;
    text-decoration: none;
}

.detail-summary {
    min-width: 270px;
    grid-template-columns: repeat(2, 1fr);
    padding: 16px 18px;
    border: 1px solid var(--line);
    border-radius: 9px;
    background: var(--surface);
}

.detail-summary dd { font-size: 1.2rem; }

.empty-state,
.empty-page {
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 10px;
    background: var(--surface);
}

.empty-state h3, .empty-page h1 { margin-top: 0; }
.empty-state p, .empty-page p { margin-bottom: 0; color: var(--muted); }
.empty-page { max-width: 680px; margin: 60px auto; }
.empty-page .button { margin-top: 22px; }
.muted-copy { color: var(--muted); }

.button {
    display: inline-flex;
    min-height: 44px;
    align-items: center;
    justify-content: center;
    padding: 11px 17px;
    border: 1px solid transparent;
    border-radius: 7px;
    font-weight: 700;
    text-decoration: none;
}

.button-primary { background: var(--brand); color: white; }
.button-primary:hover { background: var(--brand-dark); color: white; }
.button-secondary { border-color: var(--line); background: white; color: var(--brand); }

.login-body {
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background: #eef3f0;
}

.login-panel {
    width: min(100%, 420px);
    padding: 42px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-wordmark h1 {
    margin-top: 5px;
    font-size: 1.45rem;
    font-weight: 650;
    letter-spacing: -0.02em;
}

.login-intro { margin: 24px 0; color: var(--muted); }
.button-wide { width: 100%; }
.login-help { margin: 14px 0 0; color: var(--muted); font-size: 0.77rem; text-align: center; }

.notice {
    padding: 11px 13px;
    border: 1px solid #cbd9d3;
    border-radius: 7px;
    background: var(--brand-soft);
    color: var(--brand-dark);
    font-size: 0.86rem;
}

.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

@media (max-width: 980px) {
    .header-inner { gap: 24px; }
    .account-identity { display: none; }
    .metric-grid { grid-template-columns: repeat(3, 1fr); }
    .session-card { grid-template-columns: 1fr; gap: 18px; }
}

@media (max-width: 720px) {
    .shell { width: min(100% - 28px, 1180px); }
    .header-inner {
        grid-template-columns: 1fr auto;
        gap: 12px 20px;
        padding: 14px 0 0;
    }
    .primary-nav {
        grid-column: 1 / -1;
        grid-row: 2;
        min-width: 0;
        min-height: 45px;
        gap: 22px;
        overflow-x: auto;
    }
    .account-area { grid-column: 2; grid-row: 1; }
    .main-content { padding: 32px 0 52px; }
    .page-header { align-items: flex-start; flex-direction: column; gap: 12px; }
    .page-context { margin: 0; }
    .metric-grid { grid-template-columns: repeat(2, 1fr); }
    .metric-primary { grid-column: 1 / -1; }
    .section-heading { align-items: flex-start; flex-direction: column; gap: 8px; }
    .table-key { white-space: normal; }
    .table-wrap { overflow: visible; border: 0; background: transparent; }
    table, thead, tbody, tr, th, td { display: block; }
    thead { display: none; }
    tbody { display: grid; gap: 12px; }
    tbody tr {
        padding: 17px;
        border: 1px solid var(--line);
        border-radius: 9px;
        background: var(--surface);
    }
    tbody th, tbody td {
        display: flex;
        justify-content: space-between;
        gap: 18px;
        max-width: none;
        padding: 8px 0;
        border-bottom: 1px solid #edf0ee;
        text-align: right;
        white-space: normal;
    }
    tbody th { display: block; padding-top: 0; text-align: left; }
    tbody td::before {
        color: var(--muted);
        content: attr(data-label);
        font-size: 0.75rem;
        font-weight: 700;
        text-align: left;
    }
    tbody .row-action { padding: 13px 0 0; border-bottom: 0; }
    tbody .row-action a { min-height: 40px; display: inline-flex; align-items: center; }
    .session-facts { grid-template-columns: 1fr 1fr; }
    .review-section { padding: 20px; }
}

@media (max-width: 460px) {
    .metric-grid { grid-template-columns: 1fr; }
    .metric-primary { grid-column: auto; }
    .metric p { min-height: 0; }
    .session-facts { grid-template-columns: 1fr; }
    .detail-summary { width: 100%; min-width: 0; }
    .login-panel { padding: 30px 24px; }
    .coming-soon { display: none; }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { scroll-behavior: auto !important; }
}
