:root {
    --bg: #f4f6f8;
    --card: #ffffff;
    --text: #1f2937;
    --muted: #6b7280;
    --border: #e5e7eb;
}

* {
    box-sizing: border-box;
}

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

.page {
    max-width: 980px;
    margin: 0 auto;
    padding: 16px;
}

.header {
    background: var(--card);
    border-radius: 18px;
    padding: 16px;
    margin-bottom: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
    display: flex;
    align-items: center;
    gap: 16px;
}

.logo {
    max-height: 56px;
    max-width: 160px;
    object-fit: contain;
}

.header-text h1 {
    margin: 0;
    color: var(--primary);
    font-size: 24px;
}

.header-text p {
    margin: 4px 0 0;
    color: var(--muted);
    font-size: 14px;
}

.card {
    background: var(--card);
    border-radius: 18px;
    padding: 18px;
    margin-bottom: 14px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.06);
}

.compact-info-card {
    padding: 14px 16px;
}

.compact-info-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 12px;
}

.compact-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--text);
}

.compact-badge {
    background: color-mix(in srgb, var(--primary) 12%, white);
    color: var(--primary);
    border-radius: 999px;
    padding: 6px 10px;
    font-size: 13px;
    font-weight: 600;
    white-space: nowrap;
}

.compact-info-row {
    margin-top: 8px;
    color: var(--muted);
    font-size: 14px;
    line-height: 1.4;
}

.compact-separator {
    margin: 0 6px;
}

.label {
    font-size: 13px;
    color: var(--muted);
    margin-bottom: 4px;
}

h2 {
    margin-top: 0;
    color: var(--primary);
    font-size: 18px;
}

input,
textarea {
    width: 100%;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    font-size: 16px;
}

input:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}



.pallet-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid var(--border);

    gap: 16px;

    padding: 10px 0;
}

.pallet-row:last-child {
    border-bottom: none;
}

.signature-box {
    border: 2px dashed var(--border);
    border-radius: 14px;
    background: #fff;
    overflow: hidden;
}

canvas {
    width: 100%;
    height: 200px;
    display: block;
}

.buttons {
    position: sticky;
    bottom: 0;
    background: white;
    padding-top: 12px;
    display: flex;
    gap: 12px;
    margin-top: 16px;
}

button {
    border: none;
    border-radius: 12px;
    padding: 14px 18px;
    font-size: 16px;
    cursor: pointer;
}

.btn-secondary {
    background: #e5e7eb;
    color: #111827;
}

.btn-primary {
    background: var(--primary);
    color: white;
    flex: 1;
    font-weight: 600;
}

.error {
    background: #fee2e2;
    color: #991b1b;
    padding: 12px 14px;
    border-radius: 12px;
    margin-bottom: 14px;
}


.collapsible-card {
    padding: 0;
    overflow: hidden;
}

.collapsible-summary {
    list-style: none;
    cursor: pointer;
    padding: 18px;
    color: var(--primary);
    font-size: 18px;
    font-weight: 700;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.collapsible-summary::-webkit-details-marker {
    display: none;
}

.collapsible-summary::after {
    content: "＋";
    font-size: 20px;
}

.collapsible-card[open] .collapsible-summary::after {
    content: "−";
}

.summary-hint {
    color: var(--muted);
    font-size: 13px;
    font-weight: 500;
    margin-left: auto;
    margin-right: 12px;
}

.collapsible-content {
    padding: 0 18px 18px;
}

.section-title {
    margin-top: 0;
    margin-bottom: 14px;
    font-size: 18px;
}

.section-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    color: var(--primary);
    text-decoration: none;
    font-weight: 700;
}

.section-link:hover {
    opacity: 0.8;
}

.section-link-icon {
    font-size: 15px;
}


.success-card {
    text-align: center;
}

.success-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;

    border-radius: 999px;

    background: color-mix(in srgb, var(--primary) 12%, white);
    color: var(--primary);

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 34px;
    font-weight: 700;
}

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

.btn-link-primary {
    display: inline-flex;
    margin-top: 18px;
    padding: 12px 16px;

    border-radius: 12px;

    background: var(--primary);
    color: white;

    text-decoration: none;
    font-weight: 600;
}


.already-signed-icon {
    width: 64px;
    height: 64px;
    margin: 0 auto 16px;

    border-radius: 999px;

    background: #fef3c7;
    color: #b45309;

    display: flex;
    align-items: center;
    justify-content: center;

    font-size: 34px;
    font-weight: 700;
}

.support-card h2 {
    text-align: center;
}

.support-card .info-grid {
    margin-top: 14px;
}

.support-card .info-item {
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 2px;
    padding-bottom: 8px;
}

.support-card .label {
    font-size: 13px;
    color: var(--muted);
    margin: 0;
}

.support-card .value {
    color: var(--primary);
    font-weight: 600;
    line-height: 1.4;
}

.support-card .contact-link {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;

    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
}

.support-card .contact-link:hover {
    text-decoration: underline;
}

.support-card .full-width {
    grid-column: 1 / -1;
}

.support-card .compact-address {
    line-height: 1.5;
    text-align: center;
}

.home-icon-image {
    width: 38px;
    height: 38px;
    object-fit: contain;
}

.file-expiry-info {
    margin-top: 12px;
    color: var(--muted);
    font-size: 14px;
}

.pdf-preview-image {
    display: block;
    margin: 0 auto;

    width: 100%;
    max-width: 100%;

    height: auto;
    max-height: min(40vh, 520px);

    object-fit: contain;

    border-radius: 16px;

    background: white;

    border: 1px solid rgba(0,0,0,0.08);

    box-shadow:
        0 4px 12px rgba(0,0,0,0.06),
        0 12px 28px rgba(0,0,0,0.04);

    transition:
        transform 0.18s ease,
        box-shadow 0.18s ease;
}

.quantity-stepper {
    display: flex;
    align-items: center;
    gap: 10px;
}

.qty-btn {
    flex-shrink: 0;

    width: 34px;
    height: 34px;

    border: none;
    border-radius: 10px;

    background: var(--primary);

    color: white;

    font-size: 20px;
    font-weight: 700;

    display: flex;
    align-items: center;
    justify-content: center;

    padding: 0;
    margin: 0;

    cursor: pointer;

    transition:
        transform 0.12s ease,
        opacity 0.12s ease;
}

.qty-btn:hover {
    opacity: 0.92;
}

.qty-btn:active {
    transform: scale(0.94);
}

.qty-input {
    width: 56px !important;
    min-width: 56px;

    text-align: center;

    margin: 0 !important;

    font-weight: 700;
}

@media (max-width: 700px) {
    .page {
        padding: 10px;
    }

    .header {
        padding: 14px;
    }

    .logo {
        max-height: 46px;
        max-width: 140px;
    }

    .header-text h1 {
        font-size: 21px;
    }

    .compact-info-header {
        align-items: flex-start;
        flex-direction: column;
        gap: 8px;
    }

    .compact-badge {
        font-size: 12px;
    }

    .pdf-preview-image {
        width: 100%;
        height: clamp(180px, 28vh, 320px);
        object-fit: contain;
    }

    .pallet-row {
        grid-template-columns: 1fr 90px;
    }

    canvas {
        height: 180px;
    }
}

.form-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 16px;
}

.form-field {
    display: flex;
    flex-direction: column;
    gap: 7px;
}

.form-field label {
    color: var(--text);
    font-size: 14px;
    font-weight: 600;
}

.form-field input {
    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease,
        background-color 0.15s ease;
}

.form-field input::placeholder {
    color: #9ca3af;
}

.form-field input:focus {
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.field-hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.35;
}

.form-grid {
    grid-template-columns: 1fr;
    gap: 14px;
}

.field-hint {
    font-size: 12px;
}

.email-chip-field {
    width: 100%;
    min-height: 48px;
    padding: 7px 10px;

    border: 1px solid var(--border);
    border-radius: 12px;
    background: white;

    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;

    transition:
        border-color 0.15s ease,
        box-shadow 0.15s ease;
}

.email-chip-field:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 4px color-mix(in srgb, var(--primary) 14%, transparent);
}

.email-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.email-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;

    padding: 6px 9px;
    border-radius: 999px;

    background: color-mix(in srgb, var(--primary) 12%, white);
    color: var(--primary);

    font-size: 14px;
    font-weight: 600;
}

.email-chip-remove {
    border: none;
    background: transparent;
    color: inherit;

    padding: 0;
    margin: 0;

    font-size: 16px;
    line-height: 1;
    cursor: pointer;
}

#email-chip-input {
    width: auto;
    min-width: 220px;
    flex: 1;

    border: none;
    padding: 6px 2px;
    border-radius: 0;

    box-shadow: none;
}

#email-chip-input:focus {
    outline: none;
    border-color: transparent;
    box-shadow: none;
}

@media (max-width: 700px) {
    #email-chip-input {
        min-width: 140px;
    }

    .email-chip {
        max-width: 100%;
        overflow-wrap: anywhere;
    }
}