:root {
    --color-bg: #faf8f5;
    --color-surface: #ffffff;
    --color-text: #201c1a;
    --color-text-muted: #857f79;
    --color-primary: #df2c1f;
    --color-primary-dark: #b8231a;
    --color-navy: #17325a;
    --color-gold: #f2b134;
    --color-border: #ece7e1;
    --shadow-sm: 0 1px 2px rgba(32, 28, 26, 0.05);
    --shadow-md: 0 12px 32px rgba(32, 28, 26, 0.08);
    --radius: 14px;
    --font-sans: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
}

* { box-sizing: border-box; }

.icon { width: 16px; height: 16px; flex-shrink: 0; }
.icon-lg { width: 20px; height: 20px; }

body {
    margin: 0;
    font-family: var(--font-sans);
    background: var(--color-bg);
    color: var(--color-text);
    -webkit-font-smoothing: antialiased;
}

/* Header */
.site-header {
    background: var(--color-surface);
    border-bottom: 1px solid var(--color-border);
    padding: 0 32px;
}
.site-header__inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 18px 0;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}
.site-header__logo img { height: 48px; width: auto; display: block; }
.btn-outline {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    border: 1.5px solid var(--color-navy);
    color: var(--color-navy);
    background: transparent;
    padding: 9px 18px;
    border-radius: 999px;
    font-weight: 700;
    font-size: 0.82rem;
    text-decoration: none;
    white-space: nowrap;
    transition: background 0.15s ease, color 0.15s ease;
}
.btn-outline:hover { background: var(--color-navy); color: #fff; }

/* Checkout layout (two columns: step cards + order summary sidebar) */
.checkout-layout {
    max-width: 1100px;
    margin: 0 auto;
    padding: 40px 32px 64px;
    display: grid;
    grid-template-columns: 1fr 340px;
    gap: 28px;
    align-items: start;
}
.checkout-main { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
.checkout-sidebar { position: sticky; top: 24px; }

.step-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    box-shadow: var(--shadow-sm);
}
.step-card__header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 20px 24px;
}
.step-card__num {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: 800;
    font-size: 0.85rem;
    background: var(--color-border);
    color: var(--color-text-muted);
    flex-shrink: 0;
}
.step-card.is-active .step-card__num { background: var(--color-primary); color: #fff; }
.step-card.is-done .step-card__num { background: var(--color-navy); color: #fff; }
.step-card__title { font-size: 1.05rem; font-weight: 800; margin: 0; flex: 1; color: var(--color-text); }
.step-card.is-done .step-card__title { color: var(--color-text-muted); font-weight: 700; }
.step-card.is-upcoming .step-card__title { color: var(--color-text-muted); }
.step-card__edit { font-size: 0.82rem; font-weight: 700; color: var(--color-navy); text-decoration: none; }
.step-card__edit:hover { text-decoration: underline; }
.step-card__body { padding: 4px 24px 28px; border-top: 1px solid var(--color-border); padding-top: 20px; }
.step-card__summary {
    padding: 0 24px 22px 66px;
    margin-top: -8px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    font-size: 0.88rem;
}
.step-card__summary strong { color: var(--color-text); }
.step-card__summary span { color: var(--color-text-muted); }

.summary-card {
    background: var(--color-surface);
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: var(--shadow-sm);
}
.summary-card__event {
    display: block;
    font-size: 0.7rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    color: var(--color-primary);
    margin-bottom: 6px;
}
.summary-card__title { font-size: 1.05rem; font-weight: 800; margin: 0 0 18px; color: var(--color-text); }
.summary-card__row {
    display: flex;
    justify-content: space-between;
    gap: 12px;
    font-size: 0.88rem;
    color: var(--color-text);
    padding-bottom: 14px;
    margin-bottom: 14px;
    border-bottom: 1px dashed var(--color-border);
}
.summary-card__total { display: flex; justify-content: space-between; align-items: baseline; font-weight: 800; }
.summary-card__total span:first-child { font-size: 0.9rem; color: var(--color-text); }
.summary-card__total span:last-child { font-size: 1.35rem; color: var(--color-navy); }
.summary-card__secure {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 12px 4px 0;
    font-size: 0.76rem;
    color: var(--color-text-muted);
    line-height: 1.4;
    text-align: center;
}
.summary-card__secure .icon { flex-shrink: 0; width: 14px; height: 14px; }

@media (max-width: 760px) {
    .checkout-layout { grid-template-columns: 1fr; padding: 24px 20px 48px; }
    .checkout-sidebar { position: static; }
}

/* Main card */
.site-main {
    max-width: 560px;
    margin: 48px auto;
    background: var(--color-surface);
    padding: 40px 44px;
    border-radius: 20px;
    box-shadow: var(--shadow-md);
    border: 1px solid var(--color-border);
}
.site-main--wide {
    max-width: 1100px;
    padding: 36px 40px;
}
h1 {
    font-size: 1.55rem;
    font-weight: 800;
    letter-spacing: -0.01em;
    color: var(--color-text);
    margin: 0 0 24px;
}

/* Form */
label { display: block; margin-bottom: 18px; font-weight: 700; font-size: 0.84rem; color: var(--color-text); }
input, textarea, select {
    width: 100%;
    padding: 12px 14px;
    margin-top: 8px;
    border: 1.5px solid var(--color-border);
    border-radius: 10px;
    font-size: 0.95rem;
    font-family: inherit;
    background: #fdfcfb;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
select {
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20' fill='%23857f79'%3E%3Cpath fill-rule='evenodd' d='M5.23 7.21a.75.75 0 011.06.02L10 11.168l3.71-3.938a.75.75 0 111.08 1.04l-4.25 4.5a.75.75 0 01-1.08 0l-4.25-4.5a.75.75 0 01.02-1.06z' clip-rule='evenodd'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 14px center;
    background-size: 16px;
    padding-right: 40px;
    cursor: pointer;
}
select:invalid { color: var(--color-text-muted); }
input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: var(--color-primary);
    box-shadow: 0 0 0 3px rgba(223, 44, 31, 0.12);
    background: #fff;
}

.checkbox-field {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-weight: 500;
    font-size: 0.78rem;
    line-height: 1.4;
    color: var(--color-text-muted);
    margin: 4px 0 22px;
}
.checkbox-field input[type="checkbox"] {
    width: 16px;
    height: 16px;
    margin-top: 2px;
    flex-shrink: 0;
    accent-color: var(--color-primary);
    cursor: pointer;
}
button[type="submit"] {
    width: 100%;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 14px 24px;
    border-radius: 10px;
    font-size: 0.95rem;
    font-weight: 800;
    cursor: pointer;
    margin-top: 8px;
    transition: background 0.15s ease, transform 0.08s ease;
}
button[type="submit"]:hover { background: var(--color-primary-dark); }
button[type="submit"]:active { transform: scale(0.98); }

.form-errors {
    color: var(--color-primary-dark);
    background: #fdf1f0;
    border: 1px solid #f6cfcc;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    list-style: none;
    margin: 0 0 20px;
}
.form-success {
    color: #166534;
    background: #f0fdf4;
    border: 1px solid #bbf7d0;
    padding: 12px 16px;
    border-radius: 10px;
    font-size: 0.85rem;
    margin: 0 0 20px;
}

/* Demo mode notice */
.demo-notice {
    margin-top: 20px;
    padding: 16px 18px;
    border: 1.5px dashed #d99a1f;
    background: #fffaf0;
    border-radius: 12px;
    text-align: left;
}
.demo-notice p {
    margin: 0 0 12px;
    font-size: 0.82rem;
    color: #7a5211;
    font-weight: 500;
}
.btn-demo {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: #d99a1f;
    color: #fff;
    padding: 10px 18px;
    border-radius: 999px;
    font-weight: 800;
    font-size: 0.82rem;
    text-decoration: none;
    transition: background 0.15s ease;
}
.btn-demo:hover { background: #b87f14; }

/* Status pill + payment card */
.status-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 6px 14px;
    border-radius: 999px;
    font-size: 0.8rem;
    font-weight: 700;
    background: #fff7e0;
    color: #92660b;
    margin-bottom: 24px;
}
.status-pill.is-paid { background: #f0fdf4; color: #166534; }
.payment-card {
    border: 1.5px solid var(--color-border);
    border-radius: 14px;
    padding: 24px;
    text-align: center;
    background: #fdfcfb;
}
.payment-card img { max-width: 220px; border-radius: 8px; margin-bottom: 8px; }
.payment-card p { font-size: 0.85rem; font-weight: 700; color: var(--color-text-muted); margin: 16px 0 6px; }
.credential-code {
    display: inline-block;
    margin-top: 4px;
    padding: 8px 16px;
    background: #fff;
    border: 1.5px dashed var(--color-border);
    border-radius: 8px;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-size: 1rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--color-navy);
}

.site-footer {
    text-align: center;
    padding: 32px 16px;
    color: var(--color-text-muted);
    font-size: 0.8rem;
}
.site-footer__rules {
    list-style: none;
    max-width: 640px;
    margin: 0 auto 16px;
    padding: 0;
    font-size: 0.72rem;
    line-height: 1.6;
    color: var(--color-text-muted);
    opacity: 0.85;
}
.site-footer__rules li { margin-bottom: 2px; }

/* Admin */
.admin-header {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 20px;
}
.admin-header h1 { margin: 0; }
.admin-header__actions { display: flex; flex-wrap: wrap; gap: 10px; }
.btn-admin-action {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1.5px solid var(--color-border);
    background: #fff;
    color: var(--color-navy);
    font-weight: 700;
    font-size: 0.85rem;
    text-decoration: none;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.btn-admin-action:hover { background: #f7f6f4; border-color: var(--color-navy); }
.btn-admin-action.is-primary {
    background: var(--color-navy);
    border-color: var(--color-navy);
    color: #fff;
}
.btn-admin-action.is-primary:hover { background: #0f2038; }

.admin-search {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 8px;
    margin-bottom: 16px;
}
.admin-search input {
    flex: 1 1 220px;
    max-width: 320px;
    height: 44px;
    margin-top: 0;
    padding: 0 14px;
    font-size: 0.88rem;
}
.admin-search button {
    width: auto;
    flex-shrink: 0;
    height: 44px;
    margin: 0;
    background: transparent;
    color: var(--color-navy);
    border: 1.5px solid var(--color-border);
    padding: 0 18px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.admin-search button:hover { background: #f7f6f4; border-color: var(--color-navy); }
.admin-search__clear {
    color: var(--color-text-muted);
    font-size: 0.82rem;
    text-decoration: none;
    font-weight: 600;
}
.admin-search__clear:hover { text-decoration: underline; }

.admin-toolbar {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 6px 4px;
    margin: 0 0 24px;
    font-size: 0.85rem;
}
.admin-toolbar a {
    color: var(--color-navy);
    text-decoration: none;
    font-weight: 700;
    padding: 5px 12px;
    border-radius: 999px;
    border: 1.5px solid transparent;
    transition: background 0.15s ease, border-color 0.15s ease;
}
.admin-toolbar a:hover { background: #f2f1ee; }
.admin-toolbar a.is-active { border-color: var(--color-navy); }
.admin-toolbar span.sep { color: var(--color-border); }
.admin-toolbar a.admin-toolbar__logout { color: var(--color-primary-dark); margin-left: auto; }

.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
thead th {
    text-align: left;
    padding: 10px 12px;
    font-size: 0.72rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    color: var(--color-text-muted);
    border-bottom: 2px solid var(--color-border);
    white-space: nowrap;
}
tbody td {
    text-align: left;
    padding: 12px;
    border-bottom: 1px solid var(--color-border);
    vertical-align: middle;
}
tbody tr:hover { background: #fbfaf8; }
td.nowrap, th.nowrap { white-space: nowrap; }
.status-tag {
    display: inline-block;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.72rem;
    font-weight: 700;
    background: #fff7e0;
    color: #92660b;
}
.status-tag.is-paid { background: #f0fdf4; color: #166534; }
table a { color: var(--color-navy); font-weight: 700; text-decoration: none; font-size: 0.85rem; }
table a:hover { text-decoration: underline; }
.link-action {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    color: var(--color-navy);
    font-weight: 700;
    font-size: 0.85rem;
    font-family: inherit;
}
.link-action:hover { text-decoration: underline; }
.table-code {
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--color-navy);
}
.table-empty {
    text-align: center;
    padding: 40px 12px;
    color: var(--color-text-muted);
    font-size: 0.9rem;
}
.table-actions { display: flex; gap: 14px; white-space: nowrap; }

/* Registration detail card */
.detail-card {
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 16px;
    padding: 8px 24px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}
.detail-card__row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    padding: 14px 0;
    border-bottom: 1px solid var(--color-border);
}
.detail-card__row:last-of-type { border-bottom: none; }
.detail-card__label { color: var(--color-text-muted); font-size: 0.85rem; font-weight: 600; }
.detail-card__qr { display: flex; justify-content: center; padding: 20px 0 8px; }
.detail-card__qr img { border-radius: 8px; border: 1px solid var(--color-border); }
.detail-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 3px 10px;
    border-radius: 999px;
    font-size: 0.78rem;
    font-weight: 700;
    background: #f7f6f4;
    color: var(--color-text-muted);
}
.detail-pill.is-set { background: #f0fdf4; color: #166534; }

/* Registration detail modal */
body.modal-open { overflow: hidden; }
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(23, 50, 90, 0.45);
    z-index: 100;
    padding: 24px;
    overflow-y: auto;
}
.modal-overlay.is-open { display: flex; align-items: flex-start; justify-content: center; }
.modal-card {
    position: relative;
    background: var(--color-bg);
    border-radius: 20px;
    padding: 28px;
    max-width: 680px;
    width: 100%;
    margin: 40px 0;
    box-shadow: 0 20px 60px rgba(23, 50, 90, 0.25);
}
.modal-card__close {
    position: absolute;
    top: 18px;
    right: 18px;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--color-text-muted);
    padding: 6px;
    line-height: 0;
}
.modal-card__close:hover { color: var(--color-text); }
.modal-card__title { margin: 0 40px 16px 0; font-size: 1.3rem; }
.modal-card__resend { margin-bottom: 16px; }
.modal-card__body { display: flex; gap: 20px; align-items: stretch; }
.modal-card__body .detail-card { flex: 1; min-width: 0; }
.detail-card__qr-col {
    flex: 0 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 14px;
}
.detail-card__qr-col .detail-card__qr {
    padding: 20px;
    background: #fff;
    border: 1px solid var(--color-border);
    border-radius: 16px;
}
.detail-card__qr-col .modal-card__resend { margin-bottom: 0; width: 100%; justify-content: center; }
.detail-side-meta {
    display: flex;
    flex-direction: column;
    gap: 12px;
    width: 100%;
    padding-top: 14px;
    border-top: 1px solid var(--color-border);
}
.detail-side-meta__item { display: flex; flex-direction: column; gap: 6px; }
.detail-side-meta__item .detail-card__label { font-size: 0.78rem; }
.detail-side-meta__item .detail-pill { align-self: flex-start; }
@media (max-width: 640px) {
    .modal-card__body { flex-direction: column; }
    .detail-card__qr-col { align-self: center; width: 100%; }
}

/* Check-in validation */
.checkin-hint { color: var(--color-text-muted); font-size: 0.88rem; margin: -8px 0 20px; }
.checkin-form { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.checkin-form input {
    flex: 1;
    min-width: 0;
    height: 52px;
    margin-top: 0;
    padding: 0 14px;
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: 0.06em;
    text-align: center;
    font-family: 'SFMono-Regular', Consolas, 'Liberation Mono', Menlo, monospace;
}
.checkin-form button[type="submit"] {
    width: auto;
    flex-shrink: 0;
    height: 52px;
    margin: 0;
    background: var(--color-primary);
    color: #fff;
    border: none;
    padding: 0 22px;
    border-radius: 10px;
    font-weight: 700;
    font-size: 0.85rem;
    line-height: 1;
    cursor: pointer;
}
.checkin-form button[type="submit"]:hover { background: var(--color-primary-dark); }
.checkin-scan-link {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    margin: 0 0 24px;
    color: var(--color-navy);
    font-weight: 600;
    font-size: 0.85rem;
    text-decoration: underline;
    cursor: pointer;
}
.checkin-scan-link:hover { color: var(--color-primary-dark); }
.checkin-scanner {
    display: none;
    margin-bottom: 24px;
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    position: relative;
}
.checkin-scanner.is-active { display: block; }
.checkin-scanner video { width: 100%; display: block; max-height: 320px; object-fit: cover; }
.checkin-scanner__hint {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 10px;
    text-align: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    font-size: 0.8rem;
    font-weight: 600;
}
.checkin-scanner__close {
    position: absolute;
    top: 10px;
    right: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: rgba(0, 0, 0, 0.55);
    color: #fff;
    border: none;
    border-radius: 999px;
    width: 32px;
    height: 32px;
    cursor: pointer;
}
.checkin-camera-error {
    display: none;
    margin-bottom: 20px;
    padding: 12px 16px;
    border-radius: 10px;
    background: #fdf1f0;
    color: var(--color-primary-dark);
    font-size: 0.85rem;
}
.checkin-camera-error.is-visible { display: block; }
.checkin-result {
    padding: 20px 24px;
    border-radius: 14px;
    margin-bottom: 20px;
    opacity: 1;
    transform: translateY(0);
    transition: opacity 0.4s ease, transform 0.4s ease;
}
.checkin-result.is-fading { opacity: 0; transform: translateY(-6px); }
.checkin-result strong { display: flex; align-items: center; gap: 8px; font-size: 1.1rem; margin-bottom: 8px; }
.checkin-result p { margin: 4px 0; }
.checkin-result__meta { color: inherit; opacity: 0.8; font-size: 0.85rem; }
.checkin-result.is-ok { background: #f0fdf4; color: #166534; border: 1.5px solid #bbf7d0; }
.checkin-result.is-warning { background: #fffaf0; color: #92660b; border: 1.5px solid #fbd38d; }
.checkin-result.is-error { background: #fdf1f0; color: var(--color-primary-dark); border: 1.5px solid #f6cfcc; }
.checkin-back { margin-top: 24px; }
.checkin-back a { color: var(--color-navy); font-weight: 700; text-decoration: none; font-size: 0.88rem; }
.checkin-back a:hover { text-decoration: underline; }
