:root {
    --bg: #f1f5f9;
    --card: #ffffff;
    --ink: #0f172a;
    --muted: #64748b;
    --line: #e2e8f0;
    --brand: #0bd992;
    --brand-dark: #06b67a;
    --ok: #16a34a;
    --warn: #b45309;
    --err: #dc2626;
    --radius: 14px;
    --shadow: 0 1px 3px rgba(15, 23, 42, .08), 0 8px 24px rgba(15, 23, 42, .06);
}

* { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
    background: var(--bg);
    color: var(--ink);
    line-height: 1.5;
    font-size: 16px;
}

.wrap { max-width: 980px; margin: 0 auto; padding: 0 16px; }
.narrow { max-width: 1130px; }

/* ---------- header / footer ---------- */
.site-head {
    background: #fff;
    border-bottom: 1px solid var(--line);
    position: sticky;
    top: 0;
    z-index: 5;
}
.site-head .wrap { display: flex; align-items: center; justify-content: space-between; height: 58px; }
.brand { font-weight: 800; font-size: 1.15rem; color: var(--ink); text-decoration: none; }
.site-head nav { display: flex; gap: 16px; }
.site-head nav a { color: var(--muted); text-decoration: none; font-size: .95rem; }
.site-head nav a:hover { color: var(--ink); }

.site-foot { margin-top: 40px; padding: 18px 0 28px; color: var(--muted); font-size: .85rem; }
.site-foot a { color: var(--muted); }

/* ---------- cards ---------- */
.card {
    background: var(--card);
    border: 1px solid var(--line);
    border-radius: var(--radius);
    box-shadow: var(--shadow);
    padding: 22px;
    margin-top: 20px;
}
main { padding-bottom: 10px; }
h1 { font-size: 1.9rem; margin: 6px 0 8px; line-height: 1.15; }
h2 { font-size: 1.25rem; margin: 0 0 12px; }
h3 { margin: 8px 0 4px; font-size: 1.1rem; }
.muted { color: var(--muted); font-size: .92rem; }
.small { font-size: .82rem; }
.center { text-align: center; }
.kicker { text-transform: uppercase; letter-spacing: 2px; font-size: .75rem; color: var(--brand-dark); font-weight: 700; margin: 0; }
.desc { color: var(--muted); }
.mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: .92rem; }

/* ---------- hero ---------- */
.hero { display: grid; grid-template-columns: 1fr; gap: 0; margin-top: 20px; }
.meta { list-style: none; padding: 0; margin: 14px 0 0; display: flex; flex-wrap: wrap; gap: 6px 18px; color: var(--muted); font-size: .92rem; }
.hero-price { border-top: 1px dashed var(--line); padding-top: 16px; margin-top: 8px; }
.price { font-size: 2.2rem; font-weight: 800; }
.per-ticket { color: var(--muted); font-size: .85rem; }
.avail { margin: 12px 0 6px; font-size: .88rem; color: var(--muted); }
.meter { height: 8px; border-radius: 99px; background: var(--line); overflow: hidden; margin-bottom: 16px; }
.meter span { display: block; height: 100%; background: linear-gradient(90deg, var(--brand), var(--brand-dark)); }

@media (min-width: 760px) {
    .hero { grid-template-columns: 2fr 1fr; gap: 24px; }
    .hero-price { border-top: 0; border-left: 1px dashed var(--line); padding-top: 0; padding-left: 24px; margin-top: 0; }
}

/* ---------- layout ---------- */
.grid { display: grid; grid-template-columns: 1fr; gap: 20px; align-items: start; }
@media (min-width: 860px) {
    .grid { grid-template-columns: 1.4fr 1fr; }
}

/* ---------- forms ---------- */
.field { display: block; margin: 14px 0; }
.field span { display: block; font-size: .85rem; font-weight: 600; margin-bottom: 6px; color: var(--ink); }
.field span em { font-style: normal; font-weight: 400; color: var(--muted); }
.field input {
    width: 100%; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px;
    font-size: 1rem; background: #fff; color: var(--ink);
}
.field input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.row { display: grid; grid-template-columns: 1fr 1fr; gap: 0 12px; }

.qty { display: flex; align-items: center; gap: 0; }
.qty input {
    width: 70px; text-align: center; border-radius: 0; -moz-appearance: textfield;
    appearance: textfield;
}
.qty input::-webkit-inner-spin-button, .qty input::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }
.qty button {
    width: 46px; height: 46px; font-size: 1.3rem; border: 1px solid var(--line);
    background: #f8fafc; color: var(--ink); cursor: pointer;
}
.qty button:first-child { border-radius: 10px 0 0 10px; }
.qty button:last-of-type { border-radius: 0 10px 10px 0; }
.qty button:hover { background: #eef2f7; }
.qty-avail { margin-left: 12px; color: var(--muted); font-size: .85rem; }

.btn {
    display: inline-block; border: 0; cursor: pointer; font-size: 1rem; font-weight: 600;
    padding: 12px 18px; border-radius: 10px; background: var(--ink); color: #fff;
    text-decoration: none; text-align: center; transition: transform .05s ease, opacity .15s;
}
.btn:hover { opacity: .92; }
.btn:active { transform: scale(.99); }
.btn-primary { background: var(--brand); color: #052e22; }
.btn-primary:hover { background: var(--brand-dark); color: #fff; opacity: 1; }
.btn-block { width: 100%; }
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--line); margin-top: 10px; }
.btn:disabled { opacity: .55; cursor: not-allowed; }

.secureline { font-size: .78rem; color: var(--muted); text-align: center; margin: 10px 0 0; }
.form-err { margin-top: 10px; padding: 10px 12px; border-radius: 10px; background: #fef2f2; color: var(--err); display: none; font-size: .9rem; }
.demofy { font-size: .82rem; color: var(--warn); background: #fffbeb; border: 1px solid #fde68a; padding: 8px 12px; border-radius: 10px; }

/* ---------- summary ---------- */
.summary { border-top: 1px dashed var(--line); margin-top: 18px; padding-top: 14px; font-size: .95rem; }
.summary > div { display: flex; justify-content: space-between; margin: 4px 0; color: var(--muted); }
.summary .total { font-weight: 800; color: var(--ink); font-size: 1.15rem; }
.btn-pay { margin-top: 16px; padding: 15px; font-size: 1.05rem; }

/* ---------- steps ---------- */
.steps { padding-left: 20px; margin: 0; }
.steps li { margin: 10px 0; color: var(--ink); }

/* ---------- notices ---------- */
.notice { border-radius: 12px; padding: 13px 16px; margin: 20px 0; font-size: .95rem; }
.notice.ok   { background: #f0fdf4; border: 1px solid #bbf7d0; color: #14532d; }
.notice.error{ background: #fef2f2; border: 1px solid #fecaca; color: #7f1d1d; }
.notice.warn { background: #fffbeb; border: 1px solid #fde68a; color: #78350f; }

/* ---------- ticket cards ---------- */
.tickets { display: grid; grid-template-columns: 1fr; gap: 16px; margin-top: 8px; }
@media (min-width: 700px) { .tickets { grid-template-columns: 1fr 1fr; } }
.ticket { display: grid; grid-template-columns: 1fr auto; gap: 14px; align-items: center; overflow: hidden; }
.ticket-ok { text-transform: uppercase; letter-spacing: 1px; font-size: .7rem; font-weight: 800; color: var(--ok); }
.badge { display: inline-block; padding: 3px 10px; border-radius: 99px; font-size: .72rem; font-weight: 800; letter-spacing: .5px; }
.badge-ok { background: #f0fdf4; color: var(--ok); border: 1px solid #bbf7d0; }
.badge-danger { background: #fef2f2; color: var(--err); border: 1px solid #fecaca; }
.code { background: #f8fafc; border: 1px dashed var(--line); border-radius: 8px; padding: 7px 10px; letter-spacing: .5px; font-size: .95rem; display: inline-block; cursor: pointer; }
.qr { width: 130px; height: 130px; background: #fff; border: 1px solid var(--line); border-radius: 10px; display: flex; align-items: center; justify-content: center; overflow: hidden; }
.qr img, .qr canvas { width: 100%; height: 100%; }

/* ---------- tables (order line) ---------- */
.order-line { width: 100%; border-collapse: collapse; margin: 10px 0; font-size: .92rem; }
.order-line td { padding: 7px 4px; border-bottom: 1px solid var(--line); }
.order-line td:first-child { color: var(--muted); width: 40%; vertical-align: top; }
.order-line tr:last-child td { border-bottom: 0; }

/* ---------- verification ---------- */
.verify-form { display: flex; gap: 10px; }
.verify-form input { flex: 1; padding: 11px 12px; border: 1px solid var(--line); border-radius: 10px; font-size: 1rem; }
.verify-form input:focus { outline: 2px solid var(--brand); border-color: transparent; }
.checkin-form { border-top: 1px dashed var(--line); margin-top: 14px; padding-top: 8px; }

#qrScanner { border-radius: 12px; overflow: hidden; }
#qrScanner video { border-radius: 12px; }

@media (prefers-color-scheme: dark) {
    :root {
        --bg: #0b1220; --card: #111a2c; --ink: #e2e8f0; --muted: #94a3b8;
        --line: #1e293b;
    }
    .qty button, .qty input, .field input, .verify-form input {
        background: #0f172a; color: var(--ink); border-color: #1e293b;
    }
    .badge-ok { background: #052e22; color: #4ade80; }
    .qty button:hover, .btn-ghost:hover { background: #1e293b; }
    .code { background: #0b1220; border-color: #1e293b; }
    .notice.ok { background: #052e22; color: #bbf7d0; }
    .notice.warn { background: #451a03; color: #fde68a; }
    .notice.error { background: #4c0519; color: #fecaca; }
    .btn-ghost { color: var(--ink); }
}