:root {
    color-scheme: light;
    --bg: #f4f7fb;
    --surface: #ffffff;
    --surface-muted: #f8fafc;
    --text: #172033;
    --muted: #657089;
    --border: #dce3ee;
    --primary: #155eef;
    --primary-dark: #0f49bd;
    --primary-soft: #eaf0ff;
    --success: #087443;
    --success-bg: #e9f8f0;
    --danger: #c3352b;
    --danger-bg: #fff0ee;
    --shadow: 0 16px 45px rgba(27, 39, 68, 0.1);
    --radius: 18px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    background: var(--bg);
    color: var(--text);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
    line-height: 1.5;
}

button,
input,
select,
textarea {
    font: inherit;
}

.skip-link {
    position: absolute;
    top: -100px;
    left: 1rem;
    z-index: 100;
    padding: 0.7rem 1rem;
    border-radius: 0.6rem;
    background: var(--text);
    color: #fff;
}

.skip-link:focus {
    top: 1rem;
}

.site-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 2rem;
    max-width: 1180px;
    margin: 0 auto;
    padding: 4rem 1.25rem 2rem;
}

.eyebrow {
    margin: 0 0 0.5rem;
    color: var(--primary);
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.14em;
    text-transform: uppercase;
}

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

h1 {
    margin-bottom: 0.6rem;
    font-size: clamp(2rem, 5vw, 4rem);
    letter-spacing: -0.045em;
    line-height: 1;
}

.intro {
    max-width: 720px;
    margin-bottom: 0;
    color: var(--muted);
    font-size: 1.05rem;
}

.header-card {
    min-width: 190px;
    padding: 1.25rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.header-card strong {
    display: block;
    font-size: 2.25rem;
    line-height: 1;
}

.header-card span {
    display: block;
    margin-top: 0.4rem;
    color: var(--muted);
    font-size: 0.9rem;
}

.section-nav {
    position: sticky;
    top: 0;
    z-index: 20;
    display: flex;
    gap: 0.4rem;
    max-width: 1180px;
    margin: 0 auto;
    padding: 0.75rem 1.25rem;
    overflow-x: auto;
    background: rgba(244, 247, 251, 0.92);
    backdrop-filter: blur(12px);
    scrollbar-width: thin;
}

.section-nav a {
    flex: 0 0 auto;
    padding: 0.45rem 0.75rem;
    border: 1px solid transparent;
    border-radius: 999px;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
    text-decoration: none;
    white-space: nowrap;
}

.section-nav a:hover,
.section-nav a.is-active {
    border-color: #c9d7ff;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.container {
    max-width: 1180px;
    margin: 0 auto;
    padding: 1rem 1.25rem 5rem;
}

.notice {
    margin-bottom: 1.25rem;
    padding: 1rem 1.15rem;
    border: 1px solid;
    border-radius: 14px;
}

.notice--success {
    border-color: #a6dfbf;
    background: var(--success-bg);
    color: var(--success);
}

.notice--error {
    border-color: #f0aaa4;
    background: var(--danger-bg);
    color: var(--danger);
}

.notice p {
    margin: 0.35rem 0 0;
}

.form-section {
    margin-bottom: 1.25rem;
    padding: clamp(1.25rem, 3vw, 2rem);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: 0 8px 28px rgba(27, 39, 68, 0.06);
    scroll-margin-top: 5rem;
}

.section-heading {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    padding-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
}

.section-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.35rem;
    height: 2.35rem;
    flex: 0 0 auto;
    border-radius: 50%;
    background: var(--primary-soft);
    color: var(--primary-dark);
    font-size: 0.85rem;
    font-weight: 800;
}

.section-heading h2 {
    margin-bottom: 0.25rem;
    font-size: clamp(1.25rem, 2vw, 1.6rem);
    letter-spacing: -0.02em;
}

.section-heading p {
    margin-bottom: 0;
    color: var(--muted);
}

.optional-badge {
    display: inline-block;
    margin-left: 0.5rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: #eef2f7;
    color: var(--muted);
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    vertical-align: middle;
}

.field-grid {
    display: grid;
    grid-template-columns: repeat(6, minmax(0, 1fr));
    gap: 1rem;
}

.field {
    min-width: 0;
}

.field--third {
    grid-column: span 2;
}

.field--half {
    grid-column: span 3;
}

.field--full {
    grid-column: 1 / -1;
}

.field.is-hidden {
    display: none;
}

label {
    display: inline-block;
    margin-bottom: 0.4rem;
    font-size: 0.9rem;
    font-weight: 750;
}

.required {
    color: var(--danger);
}

input,
select,
textarea {
    width: 100%;
    border: 1px solid #cbd4e2;
    border-radius: 10px;
    background: #fff;
    color: var(--text);
    outline: none;
    transition: border-color 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

input,
select {
    min-height: 2.85rem;
    padding: 0.65rem 0.8rem;
}

textarea {
    min-height: 6rem;
    padding: 0.75rem 0.8rem;
    resize: vertical;
}

select {
    cursor: pointer;
}

input:hover,
select:hover,
textarea:hover {
    border-color: #aab8cf;
}

input:focus,
select:focus,
textarea:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px rgba(21, 94, 239, 0.14);
}

input:disabled,
select:disabled,
textarea:disabled {
    background: var(--surface-muted);
    color: #8a94a8;
    cursor: not-allowed;
}

.field--invalid input,
.field--invalid select,
.field--invalid textarea,
input.invalid,
select.invalid,
textarea.invalid {
    border-color: var(--danger);
    background: #fffafa;
}

.help,
.error {
    display: block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
}

.help {
    color: var(--muted);
}

.error {
    color: var(--danger);
    font-weight: 700;
}

.honeypot {
    position: absolute;
    left: -10000px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

.form-footer {
    position: static;
    z-index: 15;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 16px;
    background: rgba(255, 255, 255, 0.94);
    box-shadow: var(--shadow);
    backdrop-filter: blur(14px);
}

.progress-wrap {
    min-width: min(420px, 50%);
}

.progress-label {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 0.45rem;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 700;
}

.progress-label strong {
    color: var(--text);
}

.progress-bar {
    height: 0.55rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e6ebf4;
}

.progress-bar span {
    display: block;
    width: 0;
    height: 100%;
    border-radius: inherit;
    background: linear-gradient(90deg, var(--primary), #6d9bff);
    transition: width 200ms ease;
}

.actions {
    display: flex;
    gap: 0.7rem;
}

.button {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-height: 2.9rem;
    padding: 0.7rem 1.2rem;
    border: 1px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    font-weight: 800;
    text-decoration: none;
    transition: transform 160ms ease, box-shadow 160ms ease, background 160ms ease;
}

.button:hover {
    transform: translateY(-1px);
}

.button:disabled {
    cursor: wait;
    opacity: 0.7;
    transform: none;
}

.button--primary {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 8px 20px rgba(21, 94, 239, 0.24);
}

.button--primary:hover {
    background: var(--primary-dark);
}

.button--secondary {
    border-color: var(--border);
    background: var(--surface);
    color: var(--text);
}

.button--secondary:hover {
    background: var(--surface-muted);
}

@media (max-width: 860px) {
    .site-header {
        align-items: stretch;
        flex-direction: column;
        padding-top: 2.5rem;
    }

    .header-card {
        width: 100%;
    }

    .field--third,
    .field--half {
        grid-column: span 3;
    }
}

@media (max-width: 640px) {
    .container {
        padding-bottom: 8rem;
    }

    .field-grid {
        gap: 0.85rem;
    }

    .field--third,
    .field--half {
        grid-column: 1 / -1;
    }

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

    .form-footer {
        align-items: stretch;
        flex-direction: column;
    }

    .progress-wrap {
        width: 100%;
        min-width: 0;
    }

    .actions,
    .button {
        width: 100%;
    }
}

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

.page-footer {
    max-width: 1180px;
    margin: 0 auto;
    padding: 0 1.25rem 2.5rem;
    text-align: center;
}

.page-footer a {
    color: var(--muted);
    font-size: 0.85rem;
    font-weight: 700;
    text-decoration: none;
}

.page-footer a:hover {
    color: var(--primary);
    text-decoration: underline;
}

.admin-page {
    min-height: 100vh;
}

.admin-container {
    max-width: 980px;
    margin: 0 auto;
    padding: 3rem 1.25rem;
}

.admin-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.admin-header h1 {
    margin-bottom: 0.4rem;
}

.login-card,
.admin-panel {
    padding: clamp(1.25rem, 4vw, 2rem);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: var(--surface);
    box-shadow: var(--shadow);
}

.login-card {
    max-width: 480px;
    margin: 0 auto;
}

.login-card h2,
.admin-panel h2 {
    margin-bottom: 0.35rem;
}

.login-card p,
.muted {
    color: var(--muted);
}

.login-card form {
    display: grid;
    gap: 1rem;
    margin-top: 1.25rem;
}

.stats-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.stat-card {
    padding: 1rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    background: var(--surface-muted);
}

.stat-card span {
    display: block;
    color: var(--muted);
    font-size: 0.82rem;
    font-weight: 800;
    text-transform: uppercase;
}

.stat-card strong {
    display: block;
    margin-top: 0.25rem;
    font-size: 2rem;
}

.admin-actions {
    display: flex;
    flex-wrap: wrap;
    gap: 0.7rem;
    margin-bottom: 2rem;
}

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

.admin-table {
    width: 100%;
    min-width: 720px;
    border-collapse: collapse;
    font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
    padding: 0.75rem;
    border-bottom: 1px solid var(--border);
    text-align: left;
    vertical-align: top;
}

.admin-table th {
    background: var(--surface-muted);
    color: var(--muted);
    font-size: 0.75rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

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

@media (max-width: 640px) {
    input,
    select,
    textarea {
        font-size: 1rem;
    }

    input,
    select {
        min-height: 3.1rem;
    }

    .section-nav {
        padding: 0.55rem 0.75rem;
    }

    .form-section {
        padding: 1rem;
        scroll-margin-top: 4.2rem;
    }

    .section-heading {
        gap: 0.75rem;
    }

    .section-number {
        width: 2rem;
        height: 2rem;
        font-size: 0.75rem;
    }

    .admin-container {
        padding-top: 2rem;
    }

    .admin-header {
        align-items: stretch;
        flex-direction: column;
    }

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

    .admin-actions,
    .admin-actions .button {
        width: 100%;
    }
}

.step-summary {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1rem;
    padding: 0.85rem 1rem;
    border: 1px solid #c9d7ff;
    border-radius: 12px;
    background: var(--primary-soft);
    color: var(--primary-dark);
}

.step-summary[hidden],
.button[hidden],
.submit-hint[hidden] {
    display: none;
}

.submit-hint {
    display: block;
    margin-top: 0.45rem;
    color: var(--danger);
    font-size: 0.78rem;
    font-weight: 800;
}

.step-summary span {
    flex: 0 0 auto;
    font-size: 0.8rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    text-transform: uppercase;
}

.step-summary strong {
    min-width: 0;
    overflow: hidden;
    font-size: 0.95rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wizard-enabled .form-section {
    display: none;
}

.wizard-enabled .form-section.is-active-step {
    display: block;
}

@media (max-width: 640px) {
    .section-nav {
        display: none;
    }

    .container {
        padding-bottom: 12rem;
    }

    .site-header {
        padding-bottom: 1rem;
    }

    .header-card {
        display: none;
    }

    .step-summary {
        align-items: flex-start;
        flex-direction: column;
        gap: 0.15rem;
    }

    .step-summary strong {
        white-space: normal;
    }

    .form-footer {
        bottom: 0.5rem;
    }

    .actions {
        align-items: stretch;
        flex-direction: column;
    }

    .actions .button {
        width: 100%;
    }

    #next-step,
    #find-missing,
    #submit-button {
        order: -1;
    }
}

.app-loader {
    position: fixed;
    inset: 0;
    z-index: 999;
    display: grid;
    place-items: center;
    padding: 1rem;
    background: #eef3f9;
    opacity: 1;
    visibility: visible;
    transition: opacity 260ms ease, visibility 260ms ease;
}

.app-loader.is-hidden {
    opacity: 0;
    visibility: hidden;
}

.loader-card {
    display: grid;
    justify-items: center;
    width: min(280px, 100%);
    padding: 1.5rem;
    border: 1px solid rgba(220, 227, 238, 0.9);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.96);
    box-shadow: 0 18px 50px rgba(27, 39, 68, 0.14);
}

.loader-logo {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 3.2rem;
    height: 3.2rem;
    margin-bottom: 0.8rem;
    border-radius: 18px;
    background: linear-gradient(145deg, var(--primary), #6d9bff);
    color: #fff;
    font-weight: 900;
    letter-spacing: -0.04em;
}

.loader-card strong {
    font-size: 1.05rem;
}

.loader-card small {
    margin-top: 0.65rem;
    color: var(--muted);
    font-weight: 700;
}

.loader-track {
    width: 100%;
    height: 0.35rem;
    margin-top: 1rem;
    overflow: hidden;
    border-radius: 999px;
    background: #e5ebf5;
}

.loader-track span {
    display: block;
    width: 42%;
    height: 100%;
    border-radius: inherit;
    background: var(--primary);
    animation: loader-slide 900ms ease-in-out infinite alternate;
}

@keyframes loader-slide {
    from { transform: translateX(0); }
    to { transform: translateX(140%); }
}

@media (max-width: 640px) {
    body {
        background: #eef3f9;
    }

    .container {
        max-width: 620px;
        padding: 0 0.75rem 2rem;
    }

    .step-summary {
        position: sticky;
        top: 0;
        z-index: 30;
        margin: 0 -0.75rem 0.85rem;
        padding: 0.72rem 1rem;
        border: 0;
        border-radius: 0 0 18px 18px;
        background: rgba(255, 255, 255, 0.96);
        box-shadow: 0 8px 24px rgba(27, 39, 68, 0.08);
        color: var(--text);
        backdrop-filter: blur(12px);
    }

    .step-summary span {
        color: var(--primary-dark);
        font-size: 0.78rem;
    }

    .step-summary strong {
        display: none;
    }

    .form-section {
        padding: 1rem;
        border-color: #e4eaf3;
        border-radius: 22px;
        box-shadow: 0 10px 30px rgba(27, 39, 68, 0.08);
        scroll-margin-top: 4rem;
    }

    .section-heading {
        margin-bottom: 1rem;
        padding-bottom: 0.9rem;
    }

    .section-heading h2 {
        font-size: 1.18rem;
    }

    .section-heading p {
        font-size: 0.88rem;
    }

    .field-grid {
        gap: 0.9rem;
    }

    label {
        font-size: 0.86rem;
    }

    input,
    select,
    textarea {
        border-radius: 13px;
        background: #f8fafc;
    }

    input,
    select {
        min-height: 3.25rem;
    }

    textarea {
        min-height: 6.5rem;
    }

    .form-footer {
        position: static;
        display: block;
        margin-top: 1rem;
        padding: 0.85rem;
        border-radius: 20px;
        box-shadow: 0 10px 30px rgba(27, 39, 68, 0.08);
    }

    .progress-wrap {
        width: 100%;
        min-width: 0;
    }

    .progress-label {
        margin-bottom: 0.35rem;
    }

    .actions {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 0.65rem;
        margin-top: 0.8rem;
    }

    .actions .button {
        width: 100%;
        min-height: 3.15rem;
        padding: 0.7rem 0.9rem;
        border-radius: 13px;
    }

    #next-step,
    #find-missing,
    #submit-button {
        grid-column: 1 / -1;
        order: -1;
    }

    #prev-step {
        grid-column: 1;
    }

    .actions button[type="reset"] {
        grid-column: 2;
    }

    .notice {
        border-radius: 14px;
    }

    .page-footer {
        padding-bottom: 1.5rem;
    }
}
