:root {
    color-scheme: light;
    --bg: #f5f4f1;
    --surface: #ffffff;
    --surface-soft: #efede8;
    --text: #171717;
    --muted: #6f746f;
    --line: rgba(30, 53, 94, 0.18);
    --accent: #1e355e;
    --accent-dark: #0f172a;
    --gold: #b8872e;
    --danger-bg: #fff1f0;
    --danger-text: #8b2c2c;
    --shadow: 0 18px 55px rgba(15, 23, 42, 0.09);
}

* {
    box-sizing: border-box;
}

body {
    min-height: 100vh;
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Georgia, "Times New Roman", serif;
    line-height: 1.5;
}

a {
    color: inherit;
}

.login-page {
    display: grid;
    place-items: center;
    padding: 32px 18px;
}

.login-shell {
    width: min(100%, 430px);
}

.login-card {
    width: 100%;
    padding: 34px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: var(--shadow);
}

.portal-brand {
    display: flex;
    align-items: center;
    gap: 14px;
}

.portal-brand--login {
    display: grid;
    justify-items: start;
    gap: 8px;
}

.portal-logo {
    display: block;
    width: 58px;
    height: auto;
}

.portal-logo--large {
    width: 98px;
    margin-bottom: 8px;
}

h1 {
    margin: 0 0 22px;
    color: var(--accent);
    font-family: Georgia, "Times New Roman", serif;
    font-size: 30px;
    font-weight: 700;
    letter-spacing: 0.04em;
    line-height: 1.15;
    text-transform: uppercase;
}

.login-form {
    display: grid;
    gap: 10px;
}

label {
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

input {
    width: 100%;
    min-height: 46px;
    padding: 10px 12px;
    border: 1px solid var(--line);
    border-radius: 6px;
    background: #ffffff;
    color: var(--text);
    font: inherit;
}

input:focus {
    border-color: var(--accent);
    outline: 3px solid rgba(30, 53, 94, 0.16);
}

button,
.download-link,
.logout-link {
    display: inline-flex;
    min-height: 42px;
    align-items: center;
    justify-content: center;
    border: 0;
    border-radius: 6px;
    cursor: pointer;
    font: inherit;
    font-weight: 700;
    text-decoration: none;
}

button {
    margin-top: 10px;
    padding: 0 18px;
    background: var(--accent);
    color: #ffffff;
}

button:hover,
.download-link:hover {
    background: var(--accent-dark);
}

.alert {
    margin: 0 0 18px;
    padding: 12px 14px;
    border: 1px solid #f1bbb7;
    border-radius: 6px;
    background: var(--danger-bg);
    color: var(--danger-text);
}

.topbar {
    display: flex;
    min-height: 74px;
    align-items: center;
    justify-content: space-between;
    gap: 18px;
    padding: 14px clamp(18px, 4vw, 48px);
    border-bottom: 1px solid var(--line);
    background: var(--surface);
}

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

.client-summary {
    text-align: right;
}

.eyebrow {
    display: block;
    margin-bottom: 2px;
    color: var(--gold);
    font-size: 12px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
}

.logout-link {
    min-height: 38px;
    padding: 0 14px;
    border: 1px solid var(--line);
    background: #ffffff;
    color: var(--text);
}

.logout-link:hover {
    border-color: var(--accent);
    color: var(--accent-dark);
}

.content {
    width: min(1120px, calc(100% - 36px));
    margin: 36px auto;
}

.documents-panel {
    padding: 28px;
    border: 1px solid var(--line);
    border-radius: 8px;
    background: var(--surface);
    box-shadow: 0 10px 34px rgba(34, 47, 62, 0.08);
}

.section-heading {
    display: flex;
    align-items: start;
    justify-content: space-between;
    gap: 18px;
    margin-bottom: 22px;
}

.section-heading h1 {
    margin: 0;
}

.count-badge {
    display: inline-flex;
    min-height: 32px;
    align-items: center;
    border-radius: 999px;
    padding: 0 12px;
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 14px;
    font-weight: 700;
}

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

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

th,
td {
    padding: 14px 16px;
    border-bottom: 1px solid var(--line);
    text-align: left;
    vertical-align: middle;
}

th {
    background: var(--surface-soft);
    color: var(--muted);
    font-size: 13px;
    font-weight: 700;
}

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

.action-cell {
    width: 1%;
    white-space: nowrap;
}

.download-link {
    min-height: 36px;
    padding: 0 12px;
    background: var(--accent);
    color: #ffffff;
}

.empty-state {
    margin: 0;
    padding: 22px;
    border: 1px dashed var(--line);
    border-radius: 8px;
    color: var(--muted);
}

.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
}

@media (max-width: 700px) {
    .login-card,
    .documents-panel {
        padding: 22px;
    }

    .topbar {
        align-items: flex-start;
        flex-direction: column;
    }

    .topbar-actions {
        align-items: flex-start;
        flex-direction: column;
        gap: 12px;
    }

    .client-summary {
        text-align: left;
    }

    .section-heading {
        align-items: flex-start;
        flex-direction: column;
    }

    table,
    thead,
    tbody,
    tr,
    th,
    td {
        display: block;
    }

    thead {
        display: none;
    }

    tr {
        padding: 14px 0;
        border-bottom: 1px solid var(--line);
    }

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

    td {
        display: grid;
        grid-template-columns: 110px minmax(0, 1fr);
        gap: 10px;
        padding: 8px 14px;
        border-bottom: 0;
    }

    td::before {
        content: attr(data-label);
        color: var(--muted);
        font-size: 13px;
        font-weight: 700;
    }

    .action-cell {
        width: auto;
        white-space: normal;
    }

    .action-cell::before {
        content: "";
    }
}
