:root {
    --navy-950: #081722;
    --navy-900: #0d2438;
    --navy-800: #153752;
    --teal-500: #1fc7a6;
    --teal-600: #10a98a;
    --ink: #172b3a;
    --muted: #6d7c88;
    --muted-light: #98a5ae;
    --line: #dfe7ec;
    --canvas: #f2f6f7;
    --surface: #ffffff;
    --danger: #c64343;
}

* {
    box-sizing: border-box;
}

body {
    min-width: 320px;
    min-height: 100vh;
    margin: 0;
    color: var(--ink);
    background:
        radial-gradient(circle at 14% 8%, rgba(31, 199, 166, 0.13), transparent 28%),
        radial-gradient(circle at 88% 92%, rgba(52, 152, 219, 0.12), transparent 32%),
        var(--canvas);
    font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

.checkin-shell {
    min-height: 100vh;
    display: grid;
    place-items: start center;
    padding: 34px 18px 54px;
}

.checkin-card {
    width: min(100%, 660px);
    overflow: hidden;
    padding: 34px;
    border: 1px solid rgba(13, 36, 56, 0.08);
    border-radius: 24px;
    background: rgba(255, 255, 255, 0.98);
    box-shadow: 0 24px 65px rgba(13, 36, 56, 0.12);
}

.checkin-header {
    margin-bottom: 27px;
}

.brand-row {
    display: flex;
    align-items: center;
    gap: 11px;
    margin-bottom: 32px;
}

.brand-symbol {
    width: 43px;
    height: 43px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 13px;
    color: var(--navy-950);
    background: var(--teal-500);
    font-size: 1.25rem;
    font-weight: 900;
    box-shadow: 0 8px 20px rgba(31, 199, 166, 0.25);
}

.brand-copy strong,
.brand-copy small {
    display: block;
}

.brand-copy strong {
    color: var(--navy-900);
    font-size: 0.95rem;
}

.brand-copy small {
    margin-top: 1px;
    color: var(--muted-light);
    font-size: 0.7rem;
}

.eyebrow {
    margin: 0 0 7px;
    color: var(--teal-600);
    font-size: 0.68rem;
    font-weight: 850;
    letter-spacing: 0.13em;
}

h1,
h2,
p {
    margin-top: 0;
}

h1 {
    margin-bottom: 8px;
    color: var(--navy-900);
    font-size: clamp(1.85rem, 6vw, 2.6rem);
    font-weight: 850;
    letter-spacing: -0.05em;
}

.subtitle {
    margin: 0;
    color: var(--muted);
    font-size: 0.92rem;
    line-height: 1.55;
}

.step-block {
    margin-top: 16px;
    padding: 23px;
    border: 1px solid var(--line);
    border-radius: 17px;
    background: var(--surface);
}

.step-heading {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    margin-bottom: 18px;
}

.step-number {
    width: 30px;
    height: 30px;
    display: grid;
    place-items: center;
    flex: 0 0 auto;
    border-radius: 9px;
    color: white;
    background: var(--navy-900);
    font-size: 0.78rem;
    font-weight: 800;
}

.step-heading h2 {
    margin: 0;
    color: var(--navy-900);
    font-size: 1rem;
    font-weight: 800;
}

.step-heading p {
    margin: 3px 0 0;
    color: var(--muted-light);
    font-size: 0.72rem;
}

.phone-row {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    gap: 10px;
}

.phone-input-wrap {
    position: relative;
}

.phone-prefix {
    position: absolute;
    top: 50%;
    left: 15px;
    z-index: 1;
    color: var(--teal-600);
    transform: translateY(-50%);
}

.form-control {
    min-height: 48px;
    border-color: var(--line);
    border-radius: 11px;
    color: var(--ink);
    font-size: 0.9rem;
}

.form-control:focus {
    border-color: var(--teal-500);
    box-shadow: 0 0 0 4px rgba(31, 199, 166, 0.12);
}

.phone-input {
    padding-left: 43px;
    font-size: 1rem;
    font-weight: 650;
    letter-spacing: 0.025em;
}

.form-label {
    color: var(--ink);
    font-size: 0.78rem;
    font-weight: 750;
}

.field-help {
    display: block;
    margin-top: 7px;
    color: var(--muted-light);
    font-size: 0.66rem;
}

.btn-primary {
    border-color: var(--navy-900);
    background: var(--navy-900);
    font-weight: 750;
}

.btn-primary:hover,
.btn-primary:focus {
    border-color: var(--navy-800);
    background: var(--navy-800);
}

.lookup-button {
    min-width: 116px;
    border-radius: 11px;
    font-size: 0.8rem;
}

.lookup-button:disabled,
.submit-button:disabled {
    opacity: 0.65;
}

.lookup-status {
    margin-top: 14px;
    padding: 12px 14px;
    border-radius: 11px;
    font-size: 0.75rem;
    font-weight: 650;
    line-height: 1.45;
}

.lookup-found {
    color: #087861;
    background: #e7faf5;
}

.lookup-new {
    color: #805916;
    background: #fff7e7;
}

.lookup-duplicate {
    color: #9e3737;
    background: #fff0f0;
}

.details-form {
    animation: reveal 0.32s ease;
}

@keyframes reveal {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.origin-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 10px;
    margin: 0;
    padding: 0;
    border: 0;
}

.origin-option {
    position: relative;
    min-height: 78px;
    display: grid;
    grid-template-columns: 34px minmax(0, 1fr) 18px;
    align-items: center;
    gap: 10px;
    padding: 13px;
    border: 1px solid var(--line);
    border-radius: 12px;
    background: white;
    cursor: pointer;
    transition: border-color 0.18s ease, background 0.18s ease, transform 0.18s ease;
}

.origin-option:hover {
    border-color: #a9dace;
    transform: translateY(-1px);
}

.origin-option:has(input:checked) {
    border-color: var(--teal-500);
    background: #effbf8;
    box-shadow: 0 0 0 3px rgba(31, 199, 166, 0.1);
}

.origin-option.is-disabled {
    display: none;
}

.origin-option input {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
}

.origin-icon {
    width: 34px;
    height: 34px;
    display: grid;
    place-items: center;
    border-radius: 10px;
    color: var(--teal-600);
    background: #e8f9f5;
    font-size: 1rem;
    font-weight: 900;
}

.origin-new .origin-icon {
    color: #b87911;
    background: #fff3d9;
}

.origin-option strong,
.origin-option small {
    display: block;
}

.origin-option strong {
    overflow: hidden;
    color: var(--navy-900);
    font-size: 0.78rem;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.origin-option small {
    margin-top: 2px;
    color: var(--muted-light);
    font-size: 0.61rem;
}

.check-dot {
    width: 17px;
    height: 17px;
    display: grid;
    place-items: center;
    border: 1.5px solid #cbd6dc;
    border-radius: 50%;
}

.origin-option:has(input:checked) .check-dot {
    border: 5px solid var(--teal-500);
    background: white;
}

.origin-error {
    margin-top: 9px;
    color: var(--danger);
    font-size: 0.7rem;
}

.submit-button {
    width: 100%;
    min-height: 52px;
    margin-top: 18px;
    border-radius: 12px;
    font-size: 0.88rem;
}

.privacy-note {
    margin: 10px 0 0;
    color: var(--muted-light);
    font-size: 0.64rem;
    text-align: center;
}

.alert {
    border: 0;
    border-radius: 12px;
    font-size: 0.78rem;
}

.success-panel {
    padding: 32px 8px 8px;
    text-align: center;
    animation: reveal 0.35s ease;
}

.success-icon {
    width: 78px;
    height: 78px;
    display: grid;
    place-items: center;
    margin: 0 auto 22px;
    border-radius: 50%;
    color: white;
    background: linear-gradient(145deg, var(--teal-500), var(--teal-600));
    box-shadow: 0 14px 30px rgba(16, 169, 138, 0.28);
    font-size: 2.2rem;
    font-weight: 900;
}

.success-panel h2 {
    margin-bottom: 5px;
    color: var(--navy-900);
    font-size: 1.7rem;
    font-weight: 850;
}

.success-name {
    margin-bottom: 24px;
    color: var(--muted);
    font-size: 1rem;
}

.success-detail {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 13px 0;
    border-top: 1px solid var(--line);
    color: var(--muted);
    font-size: 0.78rem;
    text-align: left;
}

.success-detail strong {
    color: var(--navy-900);
}

.member-qr-card {
    margin-top: 24px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #f8fafc;
}

.member-qr-title {
    margin: 0 0 14px;
    color: var(--navy-900);
    font-weight: 800;
}

.member-qr-code {
    display: flex;
    min-height: 220px;
    align-items: center;
    justify-content: center;
}

.member-qr-code img,
.member-qr-code canvas {
    max-width: 100%;
    height: auto !important;
    padding: 8px;
    border-radius: 10px;
    background: #fff;
}

.member-qr-help {
    margin: 14px 0;
    color: var(--muted);
    font-size: .82rem;
}

.saved-qr-section {
    margin-top: 18px;
}

.saved-qr-promo {
    width: 100%;
    display: grid;
    grid-template-columns: auto minmax(0, 1fr) auto;
    align-items: center;
    gap: 14px;
    padding: 17px 18px;
    border: 1px solid #b9e7dc;
    border-radius: 15px;
    color: var(--navy-900);
    background: #effbf8;
    text-align: left;
    transition: border-color .2s ease, transform .2s ease, box-shadow .2s ease;
}

.saved-qr-promo:hover,
.saved-qr-promo:focus-visible {
    border-color: var(--teal-500);
    box-shadow: 0 10px 25px rgba(16, 169, 138, .12);
    transform: translateY(-1px);
}

.saved-qr-icon {
    width: 45px;
    height: 45px;
    display: grid;
    place-items: center;
    border-radius: 13px;
    color: white;
    background: var(--teal-600);
    font-size: 1.15rem;
}

.saved-qr-copy strong,
.saved-qr-copy small {
    display: block;
}

.saved-qr-copy strong {
    font-size: .88rem;
}

.saved-qr-copy small {
    margin-top: 3px;
    color: var(--muted);
    font-size: .72rem;
}

.saved-qr-arrow {
    color: var(--teal-600);
    font-size: 1.7rem;
}

.qr-lookup-panel {
    margin-top: 12px;
    padding: 20px;
    border: 1px solid var(--line);
    border-radius: 16px;
    background: #fff;
    box-shadow: 0 12px 30px rgba(13, 36, 56, .07);
}

.qr-lookup-heading {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 15px;
}

.qr-lookup-heading h2,
.qr-lookup-result h2 {
    margin: 0;
    color: var(--navy-900);
    font-size: 1.25rem;
    font-weight: 820;
}

.qr-close {
    width: 36px;
    height: 36px;
    border: 0;
    border-radius: 50%;
    color: var(--muted);
    background: #f1f4f6;
    font-size: 1.35rem;
    line-height: 1;
}

.qr-lookup-intro,
.qr-lookup-phone {
    margin: 8px 0 16px;
    color: var(--muted);
    font-size: .8rem;
}

.qr-lookup-result {
    text-align: center;
}

.scan-instruction {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    margin: 16px 0;
    padding: 12px;
    border-radius: 11px;
    color: #067647;
    background: #e8f8f2;
    font-size: .78rem;
}

.scan-instruction span {
    width: 22px;
    height: 22px;
    display: grid;
    flex: 0 0 auto;
    place-items: center;
    border-radius: 50%;
    color: white;
    background: var(--teal-600);
}

.btn-outline-primary {
    min-height: 48px;
    margin-top: 24px;
    border-color: var(--navy-900);
    border-radius: 11px;
    color: var(--navy-900);
    font-size: 0.8rem;
    font-weight: 750;
}

.btn-outline-primary:hover {
    border-color: var(--navy-900);
    background: var(--navy-900);
}

@media (max-width: 600px) {
    .checkin-shell {
        padding: 0;
        background: white;
    }

    .checkin-card {
        min-height: 100vh;
        padding: 25px 18px 38px;
        border: 0;
        border-radius: 0;
        box-shadow: none;
    }

    .brand-row {
        margin-bottom: 27px;
    }

    .phone-row,
    .origin-grid {
        grid-template-columns: 1fr;
    }

    .lookup-button {
        min-height: 47px;
    }

    .step-block {
        padding: 19px 16px;
    }

    .saved-qr-promo {
        padding: 15px;
    }

    .saved-qr-copy small {
        line-height: 1.4;
    }

    .qr-lookup-panel {
        padding: 17px 15px;
    }
}

@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
