* {
    box-sizing: border-box;
}

:root {
    color-scheme: light;
    font-family:
        -apple-system,
        BlinkMacSystemFont,
        "Segoe UI",
        sans-serif;
}

body {
    margin: 0;
    min-height: 100vh;
    background: #f2f2f7;
    color: #111111;
}

button,
input {
    font: inherit;
}

.site-header {
    position: sticky;
    top: 0;
    z-index: 10;
    background: rgba(255, 255, 255, 0.96);
    border-bottom: 1px solid #d8d8dc;
    backdrop-filter: blur(18px);
}

.header-content {
    width: min(100%, 960px);
    margin: 0 auto;
    padding: 16px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
}

.header-content h1 {
    margin: 0;
    font-size: 25px;
}

.header-content p {
    margin: 4px 0 0;
    color: #66666d;
    font-size: 15px;
}

.status-badge {
    flex-shrink: 0;
    padding: 6px 11px;
    border-radius: 999px;
    background: #fff2cc;
    color: #7a5600;
    font-size: 13px;
    font-weight: 700;
}

.page-container {
    width: min(100%, 960px);
    margin: 0 auto;
    padding: 20px;
}

.card {
    margin-bottom: 20px;
    padding: 20px;
    background: #ffffff;
    border: 1px solid rgba(0, 0, 0, 0.06);
    border-radius: 18px;
    box-shadow:
        0 7px 25px
        rgba(0, 0, 0, 0.07);
}

.section-heading {
    margin-bottom: 16px;
}

.section-heading h2,
.card h2 {
    margin: 0;
    font-size: 21px;
}

.section-heading p,
.card p {
    margin: 6px 0 0;
    color: #66666d;
    line-height: 1.45;
}

iframe {
    display: block;
    width: 100%;
    height: 72vh;
    min-height: 520px;
    border: 1px solid #d8d8dc;
    border-radius: 12px;
    background: #ffffff;
}

.loading-card {
    min-height: 180px;
    display: grid;
    place-items: center;
    align-content: center;
    gap: 14px;
    text-align: center;
}

.spinner {
    width: 34px;
    height: 34px;
    border: 4px solid #d8d8dc;
    border-top-color: #0a84ff;
    border-radius: 50%;
    animation: spin 0.85s linear infinite;
}

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

.signature-wrapper {
    position: relative;
    width: 100%;
    height: 230px;
    overflow: hidden;
    background: #ffffff;
    border: 2px solid #c7c7cc;
    border-radius: 14px;

    touch-action: none;
    overscroll-behavior: contain;
}

#signatureCanvas {
    display: block;
    width: 100%;
    height: 100%;
    cursor: crosshair;

    touch-action: none;
    -webkit-user-select: none;
    user-select: none;
}

.signature-line {
    position: absolute;
    left: 26px;
    right: 26px;
    bottom: 45px;
    height: 1px;
    background: #88888f;
    pointer-events: none;
}

.signature-hint {
    position: absolute;
    left: 26px;
    bottom: 18px;
    color: #88888f;
    font-size: 13px;
    pointer-events: none;
}

.signature-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 12px;
}

.primary-button,
.secondary-button {
    min-height: 48px;
    padding: 12px 18px;
    border-radius: 12px;
    font-weight: 700;
    cursor: pointer;
}

.primary-button {
    width: 100%;
    margin-top: 18px;
    border: 0;
    background: #0a84ff;
    color: #ffffff;
}

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

.secondary-button {
    border: 1px solid #c7c7cc;
    background: #ffffff;
    color: #0a84ff;
}

.consent-row {
    display: flex;
    align-items: flex-start;
    gap: 11px;
    margin-top: 22px;
    color: #333338;
    line-height: 1.45;
}

.consent-row input {
    width: 20px;
    height: 20px;
    margin-top: 1px;
    flex-shrink: 0;
}

.form-message {
    min-height: 22px;
    color: #d70015;
    font-size: 14px;
}

#signaturePreview {
    display: block;
    width: min(100%, 520px);
    max-height: 180px;
    margin-top: 16px;
    padding: 12px;
    object-fit: contain;
    background: #ffffff;
    border: 1px solid #d8d8dc;
    border-radius: 12px;
}

.hidden {
    display: none !important;
}

@media (max-width: 640px) {
    .header-content {
        padding: 14px 16px;
    }

    .page-container {
        padding: 14px;
    }

    .card {
        padding: 15px;
        border-radius: 15px;
    }

    iframe {
        height: 65vh;
        min-height: 430px;
    }

    .signature-wrapper {
        height: 210px;
    }
}


.signature-wrapper-accepted {
    border-color: #34c759;
    background: #f4fff6;
}

.canvas-locked {
    opacity: 0.72;
    pointer-events: none;
}

.signature-locked-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: rgba(244, 255, 246, 0.88);
    color: #167c2e;
    pointer-events: none;
}

.accepted-checkmark {
    width: 42px;
    height: 42px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #34c759;
    color: #ffffff;
    font-size: 25px;
    font-weight: 800;
}

.status-badge-success {
    background: #dff8e4;
    color: #167c2e;
}

.consent-locked {
    opacity: 0.65;
}

.completion-heading {
    display: flex;
    align-items: flex-start;
    gap: 14px;
}

.completion-heading h2 {
    margin: 0;
}

.completion-heading p {
    margin-top: 5px;
}

.completion-icon {
    width: 42px;
    height: 42px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #34c759;
    color: #ffffff;
    font-size: 24px;
    font-weight: 800;
}

.review-list {
    margin-top: 22px;
    overflow: hidden;
    border: 1px solid #d8d8dc;
    border-radius: 13px;
}

.review-row {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 14px;
    border-bottom: 1px solid #e5e5ea;
}

.review-row:last-child {
    border-bottom: 0;
}

.review-checkmark {
    width: 23px;
    height: 23px;
    flex-shrink: 0;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #dff8e4;
    color: #167c2e;
    font-size: 14px;
    font-weight: 800;
}

.success-card {
    text-align: center;
    padding-top: 34px;
    padding-bottom: 34px;
}

.large-success-icon {
    width: 68px;
    height: 68px;
    margin: 0 auto 16px;
    display: grid;
    place-items: center;
    border-radius: 50%;
    background: #34c759;
    color: #ffffff;
    font-size: 38px;
    font-weight: 800;
}

.small-note {
    font-size: 14px;
}