body {
    margin: 0;
    font-family: Arial, sans-serif;
    background: linear-gradient(160deg, #eef2ff 0%, #f8fafc 55%, #ecfdf5 100%);
    color: #111827;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

.container {
    max-width: 560px;
    margin: 0 auto;
    padding: 20px 16px 40px;
}

.container.wide-active {
    max-width: 920px;
}

.hero h1 {
    margin: 0;
    font-size: 28px;
}

.hero p {
    margin: 8px 0 0;
    color: #4b5563;
}

.panel {
    background: #fff;
    border-radius: 14px;
    padding: 18px;
    margin-top: 16px;
    box-shadow: 0 8px 24px rgba(15, 23, 42, 0.08);
}

.panel.wide {
    max-width: 100%;
}

.panel h2 {
    margin: 0 0 8px;
    font-size: 20px;
}

.hint {
    color: #6b7280;
    font-size: 14px;
    margin: 0 0 12px;
}

label {
    display: block;
    font-weight: 700;
    margin: 12px 0 6px;
}

.consent-label {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-top: 16px;
    font-weight: 600;
    line-height: 1.4;
}

.consent-label input {
    width: auto;
    margin-top: 4px;
}

input,
textarea {
    width: 100%;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    padding: 12px;
    font-size: 16px;
    box-sizing: border-box;
}

button.primary,
button.secondary {
    width: 100%;
    margin-top: 14px;
    border: 0;
    border-radius: 10px;
    font-weight: 700;
    padding: 14px;
    font-size: 16px;
    cursor: pointer;
}

button.primary {
    background: #1d4ed8;
    color: #fff;
}

button.primary:disabled {
    background: #93c5fd;
    cursor: not-allowed;
}

button.secondary {
    background: #e5e7eb;
    color: #111827;
    width: auto;
    margin-top: 0;
    padding: 10px 14px;
}

.status {
    min-height: 20px;
    margin-top: 10px;
    font-size: 14px;
}

.status.error { color: #b91c1c; }
.status.ok { color: #065f46; }

.hidden { display: none; }

.success-panel {
    border: 1px solid #86efac;
    background: #f0fdf4;
}

#accessCode {
    letter-spacing: 8px;
    text-align: center;
    font-size: 24px;
}

.pdf-toolbar {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

#pdfCanvas {
    width: 100%;
    max-width: 100%;
    height: auto;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    min-height: 200px;
    max-height: 55vh;
    object-fit: contain;
}

.signature-box {
    width: 100%;
    height: 160px;
    max-height: 28vh;
    border: 1px solid #d1d5db;
    border-radius: 10px;
    background: #fff;
    overflow: hidden;
    flex-shrink: 0;
}

#signatureCanvas {
    display: block;
    width: 100%;
    height: 100%;
    touch-action: none;
}

.sign-actions {
    margin-top: 12px;
}

.sign-actions .secondary {
    width: 100%;
    margin-top: 0;
}

.sign-actions .primary {
    margin-top: 10px;
}

.selfie-box {
    width: 100%;
    max-width: 360px;
    margin: 0 auto;
    aspect-ratio: 3 / 4;
    max-height: 42vh;
    border: 1px solid #d1d5db;
    border-radius: 12px;
    background: #0f172a;
    overflow: hidden;
    position: relative;
}

#selfieVideo,
#selfiePreview {
    display: block;
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.selfie-actions {
    margin-top: 12px;
}

.selfie-actions .secondary,
.selfie-actions .primary {
    width: 100%;
}

.selfie-actions .secondary {
    margin-top: 10px;
}

@media (max-width: 720px) {
    .container {
        padding-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
    }

    #stepSign {
        padding-bottom: 8px;
    }

    .signature-box {
        height: 140px;
        max-height: 24vh;
    }

    .sign-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        background: #fff;
        margin: 12px -18px 0;
        padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.06);
    }

    .selfie-actions {
        position: sticky;
        bottom: 0;
        z-index: 5;
        background: #fff;
        margin: 12px -18px 0;
        padding: 12px 18px calc(12px + env(safe-area-inset-bottom, 0px));
        border-top: 1px solid #e5e7eb;
        box-shadow: 0 -6px 16px rgba(15, 23, 42, 0.06);
    }

    .selfie-box {
        max-height: 38vh;
    }
}
