:root {
    color-scheme: light;
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    --ink: #17323d;
    --muted: #61717a;
    --brand: #176b73;
    --brand-dark: #114d54;
    --brand-soft: #e6f4f3;
    --surface: #ffffff;
    --line: #dbe4e7;
    --background: #f2f6f6;
    --success: #217a52;
    --success-soft: #e9f7ef;
    --warning: #986300;
    --warning-soft: #fff5dc;
    --error: #aa3030;
    --error-soft: #fff0f0;
}

* {
    box-sizing: border-box;
}

html {
    min-height: 100%;
    background: var(--background);
}

body {
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 15% 0%, rgba(23, 107, 115, .12), transparent 32rem),
        linear-gradient(180deg, #f8fbfb 0%, var(--background) 100%);
}

button,
input {
    font: inherit;
}

.page-shell {
    width: min(100% - 2rem, 740px);
    margin: 0 auto;
    padding: max(1.25rem, env(safe-area-inset-top)) 0 max(2rem, env(safe-area-inset-bottom));
}

.brand {
    display: flex;
    align-items: center;
    gap: .85rem;
    margin: .5rem 0 1.25rem;
}

.brand-mark {
    display: grid;
    width: 2.75rem;
    height: 2.75rem;
    place-items: center;
    border-radius: .85rem;
    color: #fff;
    background: var(--brand);
    font-size: 1.3rem;
    font-weight: 800;
    box-shadow: 0 9px 24px rgba(17, 77, 84, .18);
}

.brand strong {
    display: block;
    font-size: 1.05rem;
}

.eyebrow {
    display: block;
    margin-bottom: .2rem;
    color: var(--brand);
    font-size: .72rem;
    font-weight: 800;
    letter-spacing: .09em;
    text-transform: uppercase;
}

.card {
    overflow: hidden;
    border: 1px solid rgba(186, 204, 209, .82);
    border-radius: 1.25rem;
    background: rgba(255, 255, 255, .96);
    box-shadow: 0 22px 70px rgba(36, 64, 73, .09);
}

.document-card {
    padding: clamp(1.25rem, 4vw, 2.25rem);
}

.document-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 1rem;
}

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

h1 {
    margin-bottom: .35rem;
    font-size: clamp(1.55rem, 5vw, 2.2rem);
    line-height: 1.12;
}

h2 {
    margin-bottom: .45rem;
    font-size: 1.15rem;
}

.status-pill {
    flex: 0 0 auto;
    padding: .42rem .68rem;
    border-radius: 999px;
    font-size: .74rem;
    font-weight: 800;
}

.status-pill.open {
    color: var(--success);
    background: var(--success-soft);
}

.status-pill.locked {
    color: #55636a;
    background: #edf1f2;
}

.document-facts {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: .8rem;
    margin: 1.4rem 0;
}

.document-facts div {
    padding: .85rem;
    border: 1px solid var(--line);
    border-radius: .85rem;
    background: #fbfdfd;
}

.document-facts dt {
    margin-bottom: .2rem;
    color: var(--muted);
    font-size: .72rem;
    font-weight: 700;
    text-transform: uppercase;
}

.document-facts dd {
    margin: 0;
    font-weight: 750;
}

.upload-intro {
    padding-top: 1.4rem;
    border-top: 1px solid var(--line);
}

.upload-intro p,
.hint {
    color: var(--muted);
    line-height: 1.55;
}

.picker-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: .8rem;
    margin: 1.1rem 0;
}

.file-picker {
    position: relative;
    display: flex;
    min-height: 9rem;
    padding: 1rem;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    gap: .35rem;
    border: 1.5px dashed #9db6bc;
    border-radius: 1rem;
    text-align: center;
    cursor: pointer;
    transition: transform .16s ease, border-color .16s ease, background .16s ease;
}

.file-picker:hover {
    border-color: var(--brand);
    background: var(--brand-soft);
    transform: translateY(-1px);
}

.file-picker.disabled {
    opacity: .45;
    cursor: not-allowed;
    transform: none;
}

.file-picker input {
    position: absolute;
    width: 1px;
    height: 1px;
    overflow: hidden;
    opacity: 0;
}

.file-picker small,
.file-description small,
.selection-summary span {
    color: var(--muted);
}

.picker-icon {
    display: grid;
    width: 2.55rem;
    height: 2.55rem;
    place-items: center;
    border-radius: .8rem;
    color: #fff;
    background: var(--brand);
    font-size: 1.5rem;
    font-weight: 500;
}

.pdf-icon {
    color: var(--error);
    background: var(--error-soft);
    font-size: .68rem;
    font-weight: 900;
}

.selection-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.4rem;
}

.selection-summary strong,
.selection-summary span {
    display: block;
}

.selection-summary span {
    margin-top: .2rem;
    font-size: .82rem;
}

.text-button,
.remove-button {
    border: 0;
    color: var(--brand);
    background: transparent;
    cursor: pointer;
}

.text-button {
    padding: .5rem;
    font-weight: 750;
}

.file-list {
    display: grid;
    gap: .5rem;
    margin: .75rem 0 1rem;
    padding: 0;
    list-style: none;
}

.file-list li {
    display: flex;
    align-items: center;
    gap: .75rem;
    min-width: 0;
    padding: .7rem;
    border: 1px solid var(--line);
    border-radius: .8rem;
}

.file-number {
    display: grid;
    flex: 0 0 auto;
    width: 2rem;
    height: 2rem;
    place-items: center;
    border-radius: .65rem;
    color: var(--brand-dark);
    background: var(--brand-soft);
    font-size: .8rem;
    font-weight: 800;
}

.file-description {
    min-width: 0;
    flex: 1;
}

.file-description strong,
.file-description small {
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.file-description strong {
    font-size: .9rem;
}

.file-description small {
    margin-top: .15rem;
    font-size: .75rem;
}

.remove-button {
    padding: .35rem .55rem;
    color: var(--muted);
    font-size: 1.35rem;
}

.finalize-note {
    margin: 1rem 0;
    padding: .8rem 1rem;
    border-left: 3px solid var(--warning);
    color: #715114;
    background: var(--warning-soft);
    font-size: .86rem;
    line-height: 1.45;
}

.notice {
    display: flex;
    margin: 1rem 0;
    padding: .9rem 1rem;
    flex-direction: column;
    gap: .2rem;
    border-radius: .8rem;
    line-height: 1.45;
}

.notice.success {
    color: var(--success);
    background: var(--success-soft);
}

.notice.warning {
    color: var(--warning);
    background: var(--warning-soft);
}

.notice.error {
    color: var(--error);
    background: var(--error-soft);
}

.notice.neutral {
    color: #52636b;
    background: #edf2f3;
}

.submit-button {
    display: flex;
    width: 100%;
    min-height: 3.25rem;
    margin-top: 1rem;
    align-items: center;
    justify-content: center;
    gap: .6rem;
    border: 0;
    border-radius: .85rem;
    color: #fff;
    background: var(--brand);
    font-weight: 800;
    cursor: pointer;
    box-shadow: 0 10px 24px rgba(23, 107, 115, .2);
}

.submit-button:hover:not(:disabled) {
    background: var(--brand-dark);
}

.submit-button:disabled {
    color: #8c999e;
    background: #e3e9eb;
    box-shadow: none;
    cursor: not-allowed;
}

.state-card {
    display: flex;
    min-height: 20rem;
    padding: 2rem;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    text-align: center;
}

.state-card p {
    margin-bottom: 0;
}

.state-icon {
    display: grid;
    width: 3rem;
    height: 3rem;
    margin-bottom: 1rem;
    place-items: center;
    border-radius: 50%;
    color: var(--error);
    background: var(--error-soft);
    font-size: 1.5rem;
    font-weight: 900;
}

.spinner,
.button-spinner {
    border-radius: 50%;
    border: 3px solid rgba(23, 107, 115, .2);
    border-top-color: var(--brand);
    animation: spin .8s linear infinite;
}

.spinner {
    width: 2.7rem;
    height: 2.7rem;
    margin-bottom: 1.2rem;
}

.button-spinner {
    width: 1.1rem;
    height: 1.1rem;
    border-color: rgba(255, 255, 255, .35);
    border-top-color: #fff;
}

footer {
    padding: 1.2rem .5rem 0;
    color: var(--muted);
    font-size: .76rem;
    line-height: 1.4;
    text-align: center;
}

.startup-loader {
    display: grid;
    min-height: 100vh;
    place-items: center;
    color: var(--brand-dark);
    font-weight: 700;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    inset: auto 0 0;
    z-index: 1000;
    padding: .8rem 1rem;
    color: #fff;
    background: var(--error);
    text-align: center;
}

#blazor-error-ui .reload {
    margin-left: .4rem;
    color: #fff;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

@media (max-width: 560px) {
    .page-shell {
        width: min(100% - 1rem, 740px);
    }

    .brand {
        margin-left: .45rem;
    }

    .document-card {
        border-radius: 1rem;
    }

    .document-heading {
        flex-direction: column;
    }

    .document-facts,
    .picker-grid {
        grid-template-columns: 1fr;
    }

    .file-picker {
        min-height: 7.5rem;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        scroll-behavior: auto !important;
        animation-duration: .01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: .01ms !important;
    }
}
