:root {
    --bg: #f4f7f4;
    --surface: rgba(255, 255, 255, 0.88);
    --surface-strong: #ffffff;
    --text: #153537;
    --muted: #577476;
    --line: rgba(21, 53, 55, 0.12);
    --primary: #9c47df;
    --primary-dark: #6f22af;
    --accent: #ffd166;
    --danger: #c63d2f;
    --success: #1a7f4b;
    --shadow: 0 24px 60px rgba(14, 35, 37, 0.12);
    --radius-xl: 32px;
    --radius-lg: 22px;
    --radius-md: 16px;
}

* {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

body {
    margin: 0;
    font-family: "Outfit", sans-serif;
    color: var(--text);
    background:
        radial-gradient(circle at top left, rgba(255, 209, 102, 0.3), transparent 28%),
        linear-gradient(180deg, #eff7f4 0%, #f4f7f4 45%, #edf4f1 100%);
}

img {
    display: block;
    max-width: 100%;
}

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

.hero {
    position: relative;
    overflow: hidden;
    min-height: 320px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: linear-gradient(180deg, #f8f9fb 0%, #eef1f7 100%);
}

.hero__banner {
    width: 100%;
    min-height: 320px;
    max-height: 420px;
    object-fit: contain;
    object-position: center top;
}

.layout {
    width: min(1120px, calc(100% - 2rem));
    margin: -3.4rem auto 0;
    position: relative;
    z-index: 2;
    display: block;
    padding-top: 1rem;
}

.form-card {
    width: 100%;
    max-width: 100%;
    min-width: 0;
    margin: 0 auto;
    border-radius: var(--radius-xl);
    padding: clamp(1.2rem, 2.4vw, 2rem);
    background: var(--surface);
    border: 1px solid rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(20px);
    box-shadow: var(--shadow);
}

.alert {
    display: flex;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem 1.1rem;
    border-radius: var(--radius-md);
    margin-bottom: 1.2rem;
    font-size: 0.96rem;
}

.alert--success {
    background: rgba(26, 127, 75, 0.12);
    color: var(--success);
}

.alert--error {
    background: rgba(198, 61, 47, 0.1);
    color: var(--danger);
}

.success-modal {
    position: fixed;
    inset: 0;
    z-index: 1000;
    display: grid;
    place-items: center;
    padding: 1.25rem;
}

.success-modal:not(.is-visible) {
    display: none;
}

.success-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(8, 30, 33, 0.45);
    backdrop-filter: blur(8px);
}

.success-modal__dialog {
    position: relative;
    width: min(520px, 100%);
    border-radius: 30px;
    padding: 2rem 1.6rem 1.5rem;
    background:
        radial-gradient(circle at top, rgba(255, 209, 102, 0.32), transparent 30%),
        linear-gradient(180deg, rgba(255, 255, 255, 0.98) 0%, rgba(246, 251, 249, 0.98) 100%);
    box-shadow: 0 30px 80px rgba(8, 30, 33, 0.28);
    text-align: center;
    animation: modal-pop 0.32s ease;
}

.success-modal__close {
    position: absolute;
    top: 0.9rem;
    right: 0.9rem;
    width: 42px;
    height: 42px;
    border: 0;
    border-radius: 999px;
    background: rgba(21, 53, 55, 0.08);
    color: var(--text);
    font-size: 1.6rem;
    cursor: pointer;
}

.success-modal__icon {
    width: 88px;
    height: 88px;
    margin: 0 auto 1rem;
    border-radius: 999px;
    display: grid;
    place-items: center;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 16px 34px rgba(0, 121, 107, 0.3);
}

.success-modal__icon span {
    width: 24px;
    height: 42px;
    border-right: 5px solid #fff;
    border-bottom: 5px solid #fff;
    transform: rotate(45deg) translate(-4px, -2px);
    display: block;
}

.success-modal__eyebrow {
    margin: 0;
    font-size: 0.84rem;
    font-weight: 700;
    letter-spacing: 0.12em;
    text-transform: uppercase;
    color: var(--primary);
}

.success-modal__title {
    margin: 0.6rem 0 0.7rem;
    font-size: clamp(1.6rem, 4vw, 2.2rem);
    line-height: 1.05;
}

.success-modal__text {
    margin: 0 auto 1.15rem;
    max-width: 34ch;
    color: var(--muted);
    line-height: 1.6;
}

.success-modal__code {
    margin: 0 auto 1.35rem;
    width: fit-content;
    max-width: 100%;
    padding: 0.95rem 1.25rem;
    border-radius: 18px;
    background: rgba(0, 121, 107, 0.08);
    color: var(--primary-dark);
    font-size: 1.05rem;
    font-weight: 800;
    letter-spacing: 0.06em;
}


.success-modal__button {
    border: 0;
    border-radius: 999px;
    padding: 0.95rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    color: #fff;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 16px 28px rgba(0, 121, 107, 0.28);
}

@keyframes modal-pop {
    from {
        opacity: 0;
        transform: translateY(18px) scale(0.96);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

.citizen-form {
    display: grid;
    gap: 1rem;
}

.section-title {
    display: flex;
    gap: 1rem;
    align-items: center;
    margin-top: 0.4rem;
    padding-top: 0.8rem;
}

.section-title span {
    width: 54px;
    height: 54px;
    border-radius: 18px;
    background: linear-gradient(145deg, var(--primary), var(--primary-dark));
    color: #fff;
    display: grid;
    place-items: center;
    font-weight: 700;
    box-shadow: 0 12px 24px rgba(0, 121, 107, 0.25);
}

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

.section-title p {
    margin: 0.2rem 0 0;
    color: var(--muted);
}

.grid {
    display: grid;
    gap: 1rem;
}

.grid--2 {
    grid-template-columns: repeat(2, minmax(0, 1fr));
}

.grid--3 {
    grid-template-columns: repeat(3, minmax(0, 1fr));
}

.lookup-panel {
    margin-bottom: 0.35rem;
    width: min(300px, 100%);
    margin-inline: auto;
}

.field--full {
    width: 100%;
}

.lookup-panel .field > span {
    text-align: center;
    font-size: 0.82rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    color: var(--muted);
}

.form-divider {
    position: relative;
    margin: 0.55rem 0 0.15rem;
    text-align: center;
}

.form-divider::before {
    content: "";
    position: absolute;
    top: 50%;
    left: 0;
    right: 0;
    border-top: 1px solid rgba(21, 53, 55, 0.12);
}

.form-divider span {
    position: relative;
    display: inline-block;
    padding: 0 0.9rem;
    background: rgba(255, 255, 255, 0.9);
    color: var(--primary-dark);
    font-size: 0.85rem;
    font-weight: 700;
    letter-spacing: 0.03em;
    border-radius: 999px;
}

.field {
    display: grid;
    gap: 0.55rem;
}

.field span,
.check-field span {
    font-size: 0.94rem;
    font-weight: 500;
}

.field b,
.check-field b {
    color: var(--danger);
}

.field input,
.field select,
.field textarea {
    width: 100%;
    border: 1px solid var(--line);
    background: var(--surface-strong);
    border-radius: 18px;
    padding: 0.95rem 1rem;
    font: inherit;
    color: var(--text);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.field input[readonly] {
    background: rgba(156, 71, 223, 0.08);
    color: #5d3a77;
    cursor: not-allowed;
}

.field input:focus,
.field select:focus,
.field textarea:focus {
    outline: none;
    border-color: rgba(0, 121, 107, 0.5);
    box-shadow: 0 0 0 4px rgba(0, 121, 107, 0.12);
    transform: translateY(-1px);
}

.field textarea {
    resize: vertical;
    min-height: 160px;
}

.field small,
.check-error {
    color: var(--danger);
    font-size: 0.84rem;
    margin: 0;
}

.check-field {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    margin-top: 0.25rem;
}

.check-field input {
    margin-top: 0.2rem;
    width: 18px;
    height: 18px;
    accent-color: var(--primary);
}

.actions {
    display: flex;
    justify-content: flex-end;
    gap: 0.85rem;
    padding-top: 0.4rem;
}

.btn {
    border: 0;
    border-radius: 999px;
    padding: 0.95rem 1.4rem;
    font: inherit;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.18s ease, box-shadow 0.18s ease, opacity 0.18s ease;
}

.btn:hover {
    transform: translateY(-2px);
}

.btn--primary {
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 16px 28px rgba(0, 121, 107, 0.28);
}

.btn--ghost {
    color: var(--text);
    background: rgba(21, 53, 55, 0.06);
}

.btn--lookup {
    flex: 0 0 auto;
    color: #fff;
    background: linear-gradient(135deg, var(--primary), var(--primary-dark));
    box-shadow: 0 12px 24px rgba(156, 71, 223, 0.22);
    padding-inline: 1.15rem;
}

.inline-field {
    display: flex;
    gap: 0.75rem;
    align-items: center;
    justify-content: center;
}

.inline-field input {
    flex: 1 1 auto;
}

.field-stack {
    display: grid;
    gap: 0.45rem;
}

.field-hint {
    margin: 0;
    color: var(--muted);
    font-size: 0.84rem;
    line-height: 1.45;
}

.field-hint.is-error {
    color: var(--danger);
}

.field-hint.is-success {
    color: var(--success);
}

.footer-art {
    width: min(1180px, calc(100% - 2rem));
    margin: 2rem auto 0;
}

.footer-art img {
    width: 100%;
    object-fit: cover;
}

.is-invalid {
    border-color: rgba(198, 61, 47, 0.45) !important;
    box-shadow: 0 0 0 4px rgba(198, 61, 47, 0.08);
}

@media (max-width: 980px) {
    .layout {
        margin-top: -1.75rem;
    }

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

@media (max-width: 780px) {
    .hero {
        min-height: 460px;
    }

    .hero__banner {
        min-height: 460px;
        max-height: 560px;
    }

    .grid--2,
    .grid--3 {
        grid-template-columns: 1fr;
    }

    .alert,
    .actions,
    .inline-field {
        flex-direction: column;
    }

    .success-modal__dialog {
        padding: 1.7rem 1.15rem 1.25rem;
    }

    .btn {
        width: 100%;
    }
}
