:root {
    color-scheme: light;
    --primary: #3457d5;
    --primary-dark: #263fa5;
    --primary-soft: #eef1ff;
    --background: #f5f7fc;
    --surface: #ffffff;
    --text: #17213a;
    --muted: #5e687a;
    --border: #dbe2ec;
    --success: #18794e;
    --danger: #b42318;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    min-height: 100vh;
    background:
        radial-gradient(circle at top left, rgba(52, 87, 213, 0.11), transparent 34rem),
        var(--background);
    color: var(--text);
    font: 16px/1.5 Arial, sans-serif;
}

.container {
    width: min(960px, calc(100% - 32px));
    margin: 32px auto;
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 24px;
}

.topbar h1,
.card h2,
.card h3 {
    margin-top: 0;
}

.card {
    margin-bottom: 20px;
    padding: 24px;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(23, 32, 51, 0.06);
}

.intro {
    color: var(--muted);
}

.field {
    margin-bottom: 20px;
}

.field:last-child {
    margin-bottom: 0;
}

label,
legend {
    font-weight: 700;
}

input[type="text"],
input[type="password"],
textarea {
    display: block;
    width: 100%;
    margin-top: 8px;
    padding: 12px;
    border: 1px solid #b8c3d3;
    border-radius: 8px;
    background: #fff;
    color: var(--text);
    font: inherit;
}

input[type="text"]:focus,
input[type="password"]:focus,
textarea:focus {
    border-color: var(--primary);
    outline: 3px solid rgba(52, 87, 213, 0.14);
}

textarea {
    min-height: 100px;
    resize: vertical;
}

fieldset {
    margin: 0 0 18px;
    padding: 0;
    border: 0;
}

.choices {
    display: flex;
    flex-wrap: wrap;
    gap: 10px 20px;
    margin-top: 8px;
}

.choice {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    min-height: 42px;
    padding: 8px 12px;
    border: 1px solid var(--border);
    border-radius: 10px;
    background: #fafbfe;
    font-weight: 400;
    cursor: pointer;
    transition: border-color 0.2s, background 0.2s;
}

.choice:hover {
    border-color: #aebbed;
    background: var(--primary-soft);
}

.choice input {
    width: 18px;
    height: 18px;
    margin: 0;
    accent-color: var(--primary);
}

.question-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 16px 24px;
}

.question {
    padding-bottom: 14px;
    border-bottom: 1px solid var(--border);
}

.question p {
    margin: 0;
    font-weight: 700;
}

.actions {
    display: flex;
    flex-wrap: wrap;
    gap: 12px;
}

.button {
    display: inline-block;
    min-height: 44px;
    padding: 11px 18px;
    border: 0;
    border-radius: 8px;
    background: var(--primary);
    color: #fff;
    font: 700 15px Arial, sans-serif;
    text-decoration: none;
    cursor: pointer;
    transition: background 0.2s, transform 0.2s;
}

.button:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.button.secondary {
    background: #e7edf5;
    color: var(--text);
}

.alert {
    margin-bottom: 20px;
    padding: 14px 18px;
    border-radius: 8px;
}

.alert.success {
    border: 1px solid #86d4af;
    background: #eaf8f1;
    color: var(--success);
}

.alert.error {
    border: 1px solid #f1a7a0;
    background: #fff0ee;
    color: var(--danger);
}

.tip-alert {
    border: 1px solid #f0d58a;
    background: #fff8e6;
    color: #6b5310;
}

.result-alert {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 14px;
}

.response-meta {
    display: flex;
    flex-wrap: wrap;
    justify-content: space-between;
    gap: 8px 20px;
    color: var(--muted);
}

.answer-list {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px 24px;
    padding: 0;
    list-style: none;
}

.answer-list li {
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
}

.yes {
    color: var(--success);
    font-weight: 700;
}

.no {
    color: var(--muted);
    font-weight: 700;
}

.skip {
    color: #8a6d1d;
    font-weight: 700;
}

.empty {
    padding: 48px 24px;
    text-align: center;
    color: var(--muted);
}

.button-full {
    width: 100%;
}

.header-actions {
    align-items: center;
    justify-content: flex-end;
}

.header-actions form {
    margin: 0;
}

.user-badge,
.pdf-badge,
.eyebrow {
    display: inline-flex;
    align-items: center;
    border-radius: 999px;
}

.user-badge {
    min-height: 40px;
    padding: 7px 13px;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 14px;
}

.welcome-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    overflow: hidden;
    background: linear-gradient(125deg, #fff 55%, #edf1ff);
}

.welcome-card h2 {
    margin: 5px 0;
}

.eyebrow {
    color: var(--primary);
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.09em;
    text-transform: uppercase;
}

.pdf-badge {
    justify-content: center;
    width: 76px;
    height: 76px;
    background: var(--primary);
    color: #fff;
    font-size: 18px;
    font-weight: 800;
    box-shadow: 0 12px 26px rgba(52, 87, 213, 0.25);
}

.modal-backdrop {
    position: fixed;
    z-index: 1000;
    inset: 0;
    display: grid;
    place-items: center;
    overflow-y: auto;
    padding: 20px;
    background: rgba(12, 20, 42, 0.72);
    backdrop-filter: blur(7px);
}

.access-modal {
    width: min(440px, 100%);
    padding: 32px;
    border: 1px solid rgba(255, 255, 255, 0.55);
    border-radius: 20px;
    background: #fff;
    box-shadow: 0 30px 80px rgba(5, 12, 31, 0.35);
    animation: modal-entry 0.25s ease-out;
}

.access-modal h1 {
    margin: 14px 0 6px;
    font-size: 28px;
}

.access-modal > p {
    margin: 0 0 24px;
    color: var(--muted);
}

.modal-icon {
    display: grid;
    width: 50px;
    height: 50px;
    place-items: center;
    border-radius: 14px;
    background: var(--primary);
    color: #fff;
    font-size: 25px;
    font-weight: 800;
}

.page-locked {
    filter: blur(3px);
    pointer-events: none;
    user-select: none;
}

@keyframes modal-entry {
    from {
        opacity: 0;
        transform: translateY(12px) scale(0.98);
    }
}

.documents-page {
    background: #edf1f7;
}

.document-container {
    width: min(1080px, calc(100% - 32px));
    margin: 28px auto 48px;
}

.documents-header,
.document-cover {
    display: flex;
    align-items: center;
    gap: 18px;
    background: #192f72;
    color: #fff;
}

.documents-header {
    padding: 28px 32px;
    border-radius: 16px 16px 0 0;
    box-shadow: 0 12px 36px rgba(14, 28, 67, 0.16);
}

.documents-header .actions form,
.document-toolbar .actions form {
    margin: 0;
}

.documents-header > div:nth-child(2) {
    flex: 1;
}

.documents-header span,
.document-cover span {
    color: #c7d5ff;
    font-size: 12px;
    font-weight: 800;
    letter-spacing: 0.1em;
}

.documents-header h1,
.document-cover h1 {
    margin: 2px 0;
    text-transform: uppercase;
}

.documents-header p {
    margin: 4px 0 0;
    color: #dce4ff;
}

.document-mark {
    display: grid;
    flex: 0 0 48px;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 10px;
    background: #406add;
    color: #fff;
    font-size: 22px;
    font-weight: 800;
}

.json-list {
    overflow: hidden;
    border: 1px solid #d4dbe8;
    border-top: 0;
    border-radius: 0 0 16px 16px;
    background: #fff;
    box-shadow: 0 12px 36px rgba(14, 28, 67, 0.09);
}

.json-document {
    display: grid;
    grid-template-columns: 54px minmax(220px, 1fr) auto auto;
    gap: 18px;
    align-items: center;
    min-height: 88px;
    padding: 16px 24px;
    border-bottom: 1px solid #e2e6ee;
    color: var(--text);
    text-decoration: none;
    transition: background 0.2s;
}

.json-document:last-child {
    border-bottom: 0;
}

.json-document:hover {
    background: #f3f6ff;
}

.json-icon {
    display: grid;
    width: 48px;
    height: 48px;
    place-items: center;
    border-radius: 10px;
    background: #e9efff;
    color: #294ba7;
    font-weight: 800;
}

.json-info {
    display: flex;
    min-width: 0;
    flex-direction: column;
}

.json-info strong {
    font-size: 17px;
}

.json-info span,
.json-document time {
    overflow: hidden;
    color: var(--muted);
    font-size: 13px;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.json-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    justify-content: flex-end;
}

.json-actions .button {
    min-height: 40px;
    padding: 8px 14px;
    font-size: 14px;
}

.open-document {
    color: var(--primary);
    font-size: 14px;
    font-weight: 700;
}

.document-toolbar,
.document-pagination {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    margin-bottom: 18px;
}

.completion-message {
    display: flex;
    flex-direction: column;
}

.completion-message strong {
    color: #192f72;
    font-size: 18px;
}

.completion-message span {
    color: var(--muted);
    font-size: 14px;
}

.completion-actions form {
    margin: 0;
}

.exit-button {
    background: #a83232;
}

.exit-button:hover {
    background: #822626;
}

.back-link {
    color: #253b77;
    font-weight: 700;
    text-decoration: none;
}

.requirements-document {
    overflow: hidden;
    border-radius: 4px;
    background: #fff;
    box-shadow: 0 14px 50px rgba(14, 28, 67, 0.13);
}

.document-cover {
    padding: 24px 36px;
}

.document-meta {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 24px;
    padding: 18px 36px;
    border-bottom: 1px solid #d5dbe6;
    background: #f8f9fc;
}

.document-meta div {
    min-width: 0;
}

.document-meta span,
.document-meta strong {
    display: block;
}

.document-meta span {
    color: var(--muted);
    font-size: 12px;
    font-weight: 700;
    text-transform: uppercase;
}

.document-meta strong {
    overflow: hidden;
    margin-top: 3px;
    text-overflow: ellipsis;
}

.document-content {
    padding: 30px 36px 12px;
}

.requirement-section {
    margin-bottom: 28px;
}

.requirement-section h2 {
    margin: 0 0 8px;
    padding: 10px 14px;
    background: #e9efff;
    color: #192f72;
    font-size: 16px;
}

.requirements-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.requirements-table th {
    padding: 10px 12px;
    border: 1px solid #29488e;
    background: #29488e;
    color: #fff;
    font-size: 12px;
    letter-spacing: 0.06em;
    text-align: left;
    text-transform: uppercase;
}

.requirements-table th:first-child,
.requirements-table td:first-child {
    width: 43%;
}

.requirements-table td {
    padding: 12px;
    border: 1px solid #d5dbe6;
    vertical-align: top;
    overflow-wrap: anywhere;
}

.requirements-table td:first-child {
    font-weight: 700;
}

.requirements-table tr:nth-child(even) td {
    background: #f8f9fc;
}

.document-footer {
    margin: 0 36px;
    padding: 16px 0 22px;
    border-top: 1px solid #d5dbe6;
    color: var(--muted);
    font-size: 12px;
}

.document-empty {
    padding: 60px 24px;
    border-radius: 0 0 16px 16px;
    background: #fff;
    text-align: center;
}

.document-pagination {
    justify-content: center;
    margin-top: 18px;
}

@media (max-width: 680px) {
    .container {
        width: min(100% - 20px, 960px);
        margin: 18px auto;
    }

    .topbar,
    .question-grid,
    .answer-list,
    .welcome-card {
        display: block;
    }

    .topbar .button {
        margin-top: 10px;
    }

    .header-actions {
        display: flex;
        justify-content: flex-start;
        margin-top: 14px;
    }

    .card {
        padding: 19px;
        border-radius: 14px;
    }

    .question {
        margin-bottom: 16px;
    }

    .choices {
        gap: 8px;
    }

    .choice {
        flex: 1 1 auto;
        justify-content: center;
    }

    .pdf-badge {
        width: auto;
        height: 38px;
        margin-top: 14px;
        padding: 0 16px;
    }

    .access-modal {
        padding: 24px 20px;
    }

    .actions .button {
        flex: 1 1 auto;
        text-align: center;
    }

    .result-alert {
        align-items: stretch;
        flex-direction: column;
    }

    .document-container {
        width: min(100% - 16px, 1080px);
        margin: 8px auto 28px;
    }

    .documents-header {
        align-items: flex-start;
        flex-wrap: wrap;
        padding: 22px 18px;
    }

    .documents-header h1,
    .document-cover h1 {
        font-size: 21px;
    }

    .documents-header .actions {
        width: 100%;
    }

    .json-document {
        grid-template-columns: 48px minmax(0, 1fr);
        gap: 10px 14px;
        padding: 15px;
    }

    .json-document time,
    .json-actions {
        grid-column: 2;
    }

    .json-actions {
        justify-content: flex-start;
    }

    .json-actions .button {
        flex: 1 1 auto;
        text-align: center;
    }

    .document-toolbar {
        align-items: stretch;
        flex-direction: column;
        padding: 8px 4px 0;
    }

    .completion-actions form,
    .completion-actions form .button {
        width: 100%;
    }

    .document-cover {
        align-items: flex-start;
        padding: 22px 18px;
    }

    .document-meta {
        grid-template-columns: 1fr;
        gap: 14px;
        padding: 18px;
    }

    .document-content {
        padding: 22px 14px 8px;
    }

    .requirements-table,
    .requirements-table tbody,
    .requirements-table tr,
    .requirements-table td {
        display: block;
        width: 100% !important;
    }

    .requirements-table thead {
        display: none;
    }

    .requirements-table tr {
        margin-bottom: 12px;
        border: 1px solid #d5dbe6;
    }

    .requirements-table td {
        border: 0;
        border-bottom: 1px solid #e2e6ee;
    }

    .requirements-table td::before {
        display: block;
        margin-bottom: 4px;
        color: #29488e;
        content: attr(data-label);
        font-size: 11px;
        font-weight: 800;
        letter-spacing: 0.06em;
        text-transform: uppercase;
    }

    .requirements-table td:last-child {
        border-bottom: 0;
    }

    .document-footer {
        margin: 0 18px;
    }
}
