:root {
    --color-primary: #5949a7;
    --color-primary-dark: #351f65;
    --color-accent: #00b5e2;
    --color-text: #4d4d4d;
    --color-muted: #555555;
    --color-border: #cfcfcf;
    --color-surface: #ffffff;
    --color-page: #ffffff;
    --color-error: #d5345f;
    --footer-height: 48px;
    --focus-ring: 0 0 0 3px rgba(0, 181, 226, 0.22);
}

* {
    box-sizing: border-box;
}

html,
body {
    min-width: 320px;
    min-height: 100%;
}

body {
    margin: 0;
    min-height: 100vh;
    min-height: 100dvh;
    display: grid;
    grid-template-rows: minmax(0, 1fr) var(--footer-height);
    font-family: "Roboto", Arial, sans-serif;
    color: var(--color-text);
    background: var(--color-page);
    overflow-x: hidden;
}

button,
input,
a {
    font: inherit;
}

a {
    color: var(--color-primary-dark);
}

.page-shell {
    min-height: 0;
    height: 100%;
    display: grid;
    grid-template-columns: minmax(460px, 46.5vw) minmax(0, 1fr);
    position: relative;
    overflow: hidden;
    background: #ffffff;
}

.secure-panel {
    min-height: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    padding: clamp(44px, 8.4vh, 80px) clamp(72px, 8.9vw, 130px) clamp(44px, 8.8vh, 84px);
    position: relative;
    z-index: 2;
    background: #ffffff;
}

.brand-header {
    margin-bottom: clamp(34px, 6vh, 58px);
}

.brand-logo {
    width: 190px;
    height: auto;
    display: block;
}

.state-view {
    display: none;
}

.state-view.is-active {
    display: block;
}

.content-stack {
    width: 100%;
    max-width: 430px;
}

.page-title {
    margin: 0 0 18px;
    color: var(--color-primary-dark);
    font-size: 28px;
    line-height: 1.18;
    font-weight: 700;
}

#validationState .page-title {
    width: 1px;
    height: 1px;
    position: absolute;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

.intro-text {
    margin: 0 0 clamp(28px, 5vh, 48px);
    color: var(--color-text);
    font-size: 16px;
    line-height: 1.28;
}

#validationIntro {
    max-width: 430px;
}

.birthdate-form {
    display: grid;
    grid-template-columns: minmax(0, 270px) 68px;
    gap: 10px;
    align-items: start;
}

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

.date-input {
    width: 100%;
    height: 32px;
    padding: 0 12px;
    border: 1px solid var(--color-border);
    border-radius: 3px;
    color: var(--color-text);
    background: #ffffff;
    font-size: 14px;
    text-align: left;
    letter-spacing: 0;
    outline: none;
}

.date-input::placeholder {
    color: #b9b9b9;
}

.date-input:focus {
    border-color: var(--color-primary);
    box-shadow: var(--focus-ring);
}

.field-error {
    grid-column: 1 / -1;
    grid-row: 2;
    min-height: 18px;
    margin: 0;
    color: var(--color-error);
    font-size: 13px;
    font-weight: 500;
}

.primary-action,
.secondary-action {
    min-height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    border-radius: 3px;
    border: 0;
    padding: 0 14px;
    font-size: 12px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
}

.primary-action {
    color: #ffffff;
    background: var(--color-primary);
}

.birthdate-form .primary-action {
    width: 68px;
    grid-column: 2;
    grid-row: 1;
}

.primary-action:hover:not(:disabled),
.primary-action:focus-visible:not(:disabled) {
    background: var(--color-primary-dark);
}

.primary-action:disabled {
    color: #ffffff;
    background: #b8b8b8;
    cursor: not-allowed;
}

.primary-action--outline,
.secondary-action {
    width: auto;
    color: var(--color-primary);
    background: #ffffff;
    border: 1px solid var(--color-primary);
}

.primary-action:focus-visible,
.secondary-action:focus-visible {
    outline: none;
    box-shadow: var(--focus-ring);
}

.status-title {
    margin: 0;
    color: var(--color-primary-dark);
    font-size: 22px;
    line-height: 1.35;
    font-weight: 700;
}

.support-text {
    margin: 14px 0 28px;
    max-width: 420px;
    color: var(--color-muted);
    line-height: 1.5;
}

.status-mark {
    width: 48px;
    height: 48px;
    margin: 0 0 22px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    font-size: 24px;
    font-weight: 700;
}

.status-mark--loading {
    border: 5px solid rgba(89, 73, 167, 0.16);
    border-top-color: var(--color-accent);
    animation: spin 0.9s linear infinite;
}

.status-mark--error {
    color: #ffffff;
    background: var(--color-error);
}

.sac-copy {
    margin: 58px 0 0;
    max-width: 470px;
    color: var(--color-text);
    font-size: 15px;
    line-height: 1.16;
}

.sac-copy a {
    color: var(--color-text);
    font-weight: 700;
    text-decoration: none;
}

.visual-panel {
    min-height: 0;
    position: relative;
    overflow: hidden;
    background: #d7dce0;
}

.visual-panel img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: cover;
    object-position: center;
    transition: transform 360ms ease, object-position 360ms ease;
}

.decor {
    position: absolute;
    z-index: 3;
    pointer-events: none;
}

.decor img {
    width: 100%;
    height: 100%;
    display: block;
    object-fit: contain;
}

.decor--top {
    width: clamp(172px, 12.3vw, 236px);
    height: auto;
    aspect-ratio: 236 / 92;
    top: clamp(22px, 4.8vh, 46px);
    left: calc(46.5vw - clamp(172px, 12.3vw, 236px));
}

.decor--bottom {
    width: clamp(174px, 12.6vw, 241px);
    height: auto;
    aspect-ratio: 241 / 94;
    left: 0;
    bottom: var(--footer-height);
}

.page-footer {
    height: var(--footer-height);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--color-primary);
    line-height: 1;
}

.page-footer img {
    width: 66px;
    height: auto;
    display: block;
}

.documents-list {
    display: grid;
    gap: 22px;
}

.document-item {
    min-width: 0;
}

.document-name {
    width: 100%;
    margin: 0 0 60px;
    padding-bottom: 10px;
    color: var(--color-primary);
    border-bottom: 1px solid #cfcfcf;
    font-size: 13px;
    line-height: 1.2;
    text-align: center;
    font-weight: 700;
}

.pdf-frame-wrap {
    width: 100%;
    min-height: 262px;
    display: flex;
    flex-direction: column;
    align-items: center;
    border: 1px solid var(--color-primary);
    overflow: hidden;
    padding: 22px 22px 34px;
    background: #ffffff;
}

.pdf-preview {
    margin: auto 0;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    color: var(--color-primary);
    text-decoration: none;
}

.pdf-preview strong {
    font-size: 24px;
    line-height: 1.2;
    font-weight: 500;
}

.pdf-preview span {
    margin-top: 8px;
    font-size: 13px;
    line-height: 1.22;
    text-align: center;
    font-weight: 700;
}

.document-actions {
    margin-top: 30px;
}

.download-action {
    width: 100%;
    min-height: 30px;
    font-size: 12px;
}

.document-message {
    min-height: 18px;
    margin: 10px 0 0;
    color: var(--color-error);
    font-size: 13px;
}

.pdf-viewer {
    position: fixed;
    inset: 0;
    z-index: 30;
    display: grid;
    place-items: center;
    padding: 28px;
    background: rgba(0, 0, 0, 0.25);
    overflow-x: hidden;
}

.pdf-viewer[hidden] {
    display: none;
}

.pdf-viewer__dialog {
    width: min(760px, calc(100vw - 44px));
    min-height: min(714px, calc(100dvh - 230px));
    max-height: calc(100dvh - 230px);
    display: grid;
    grid-template-rows: auto minmax(260px, 1fr);
    position: relative;
    padding: 44px 50px;
    color: var(--color-primary-dark);
    border: 1px solid rgba(89, 73, 167, 0.72);
    background: #ffffff;
    overflow: visible;
}

.pdf-viewer__close {
    width: 34px;
    height: 34px;
    position: absolute;
    top: 8px;
    right: 8px;
    border: 0;
    color: var(--color-primary-dark);
    background: transparent;
    font-size: 20px;
    font-weight: 700;
    line-height: 1;
    cursor: pointer;
}

.pdf-viewer__title {
    margin: 0 0 28px;
    padding-bottom: 26px;
    border-bottom: 1px solid #cfcfcf;
    color: var(--color-primary-dark);
    font-size: 25px;
    line-height: 1.2;
    text-align: center;
    font-weight: 400;
}

.pdf-viewer__content {
    min-height: 0;
    display: grid;
    place-items: center;
    overflow: hidden;
    background: #ffffff;
}

.pdf-viewer__frame {
    width: 100%;
    height: 100%;
    max-width: 100%;
    min-height: 340px;
    border: 0;
    background: #ffffff;
    display: block;
    overflow: hidden;
}

.pdf-viewer__fallback {
    color: var(--color-primary);
    font-size: 52px;
    line-height: 1;
    font-weight: 400;
}

.pdf-viewer__download {
    width: min(220px, 100%);
    min-height: 35px;
    position: absolute;
    left: 50%;
    bottom: -56px;
    transform: translateX(-50%);
}

.pdf-viewer__message {
    width: 100%;
    position: absolute;
    left: 0;
    bottom: -84px;
    text-align: center;
}

.documents-panel {
    display: none;
    grid-column: 2;
    grid-row: 2;
    align-self: start;
    padding: clamp(88px, 13vh, 136px) clamp(38px, 5.5vw, 82px) 80px 0;
    background: #ffffff;
}

.documents-panel.is-active {
    display: block;
}

.validated-birthdate {
    display: grid;
    grid-template-columns: minmax(0, 288px) 72px;
    gap: 12px;
    align-items: center;
}

.validated-birthdate__value {
    height: 35px;
    display: flex;
    align-items: center;
    padding: 0 14px;
    color: var(--color-text);
    border: 1px solid var(--color-border);
    border-radius: 3px;
    font-size: 16px;
}

.validated-birthdate__button {
    height: 35px;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #ffffff;
    background: var(--color-primary);
    border-radius: 3px;
    font-size: 12px;
    font-weight: 500;
}

body.is-documents-mode .page-shell {
    grid-template-columns: minmax(460px, 46.5vw) minmax(0, 1fr);
    grid-template-rows: clamp(164px, 22vh, 250px) minmax(0, 1fr);
    overflow: visible;
}

body:not(.is-documents-mode) {
    overflow: hidden;
}

body.is-viewer-open {
    overflow: hidden;
}

body.is-documents-mode .secure-panel {
    grid-column: 1;
    grid-row: 1 / 3;
}

body.is-documents-mode .visual-panel {
    min-height: 0;
    grid-column: 2;
    grid-row: 1;
    animation: imageLift 360ms ease both;
}

body.is-documents-mode .visual-panel img {
    object-position: center 45%;
}

body.is-documents-mode .decor--top {
    left: calc(46.5vw - clamp(172px, 12.3vw, 236px));
}

body.is-documents-mode .documents-list {
    grid-template-columns: repeat(4, minmax(150px, 1fr));
    gap: 30px;
}

body.is-documents-mode #documentsInfoState .page-title {
    width: 1px;
    height: 1px;
    position: absolute;
    overflow: hidden;
    clip: rect(0 0 0 0);
    white-space: nowrap;
}

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

@keyframes imageLift {
    from {
        transform: translateY(80px);
        opacity: 0.88;
    }

    to {
        transform: translateY(0);
        opacity: 1;
    }
}

@media (min-width: 1441px) {
    .secure-panel {
        padding-left: max(130px, calc((46.5vw - 430px) / 2));
    }
}

@media (max-width: 980px) {
    :root {
        --footer-height: 42px;
    }

    .page-shell {
        grid-template-columns: 1fr;
    }

    .secure-panel {
        min-height: 0;
        padding: clamp(54px, 8vh, 72px) 34px clamp(74px, 10vh, 96px);
        justify-content: center;
    }

    .visual-panel {
        display: none;
    }

    body.is-documents-mode .page-shell {
        grid-template-columns: 1fr;
        grid-template-rows: auto auto;
    }

    body.is-documents-mode .secure-panel {
        grid-column: 1;
        grid-row: 1;
        min-height: auto;
        padding-bottom: 40px;
    }

    body.is-documents-mode .documents-panel {
        grid-column: 1;
        grid-row: 2;
        padding: 0 34px 88px;
    }

    body.is-documents-mode .documents-list {
        max-width: 760px;
        margin: 0 auto;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 22px;
    }

    .brand-header {
        margin-bottom: clamp(34px, 6vh, 52px);
    }

    .brand-logo {
        width: clamp(158px, 45vw, 176px);
    }

    .content-stack {
        max-width: 430px;
        margin: 0 auto;
    }

    .decor--top {
        top: 18px;
        right: 0;
        left: auto;
        width: clamp(142px, 42vw, 180px);
        height: auto;
    }

    body.is-documents-mode .decor--top {
        right: 0;
        left: auto;
    }

    .decor--top img {
        object-fit: contain;
    }

    .decor--bottom {
        width: clamp(150px, 46vw, 182px);
        height: auto;
    }
}

@media (max-width: 560px) {
    :root {
        --footer-height: 40px;
    }

    .secure-panel {
        padding: clamp(52px, 7vh, 62px) 26px clamp(70px, 9vh, 86px);
    }

    .decor--top {
        top: 20px;
        right: -24px;
        left: auto;
        width: min(42vw, 154px);
        height: auto;
    }

    body.is-documents-mode .decor--top {
        right: -24px;
        left: auto;
    }

    .brand-header {
        margin-bottom: clamp(30px, 5vh, 48px);
    }

    .intro-text {
        margin-bottom: clamp(26px, 4.8vh, 44px);
        font-size: clamp(14px, 3.8vw, 15px);
    }

    .birthdate-form {
        grid-template-columns: minmax(0, 1fr) 68px;
        gap: 10px;
    }

    .birthdate-form .primary-action {
        width: 68px;
    }

    .date-input,
    .primary-action,
    .secondary-action {
        min-height: 42px;
        font-size: 14px;
    }

    .sac-copy {
        margin-top: 48px;
        font-size: 14px;
        line-height: 1.24;
    }

    .decor--bottom {
        width: min(48vw, 170px);
    }

    .document-actions {
        grid-template-columns: 1fr;
    }

    body.is-documents-mode .documents-list {
        grid-template-columns: 1fr;
    }

    .pdf-frame-wrap {
        min-height: 250px;
    }

    .pdf-viewer {
        padding: 18px;
    }

    .pdf-viewer__dialog {
        width: calc(100vw - 28px);
        min-height: min(620px, calc(100dvh - 124px));
        max-height: calc(100dvh - 124px);
        padding: 42px 18px 0;
    }

    .pdf-viewer__title {
        margin-bottom: 20px;
        padding-bottom: 20px;
        font-size: 22px;
    }

    .pdf-viewer__frame {
        min-height: 300px;
    }
}
