:root {
    --bg: #0b0d10;
    --bg-elev: #14181d;
    --bg-soft: #1a1f26;
    --fg: #f2f4f7;
    --fg-muted: #98a1ad;
    --fg-dim: #6b7480;
    --accent: #00b8d9;
    --accent-fg: #001216;
    --accent-soft: rgba(0, 184, 217, 0.15);
    --border: #1e242c;
    --border-strong: #2a323c;
    --danger: #e5484d;
    --danger-soft: rgba(229, 72, 77, 0.12);
    --warn: #f5a524;
    --ok: #22c55e;
    --nav-h: calc(64px + env(safe-area-inset-bottom));
    --top-safe: env(safe-area-inset-top);
}

* { box-sizing: border-box; -webkit-tap-highlight-color: transparent; }

html, body {
    margin: 0;
    padding: 0;
    background: var(--bg);
    color: var(--fg);
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
    font-size: 16px;
    line-height: 1.4;
    overscroll-behavior-y: none;
    -webkit-font-smoothing: antialiased;
}

body { min-height: 100vh; min-height: 100dvh; }

#app { display: flex; flex-direction: column; min-height: 100vh; min-height: 100dvh; }

.screen {
    flex: 1;
    padding: calc(var(--top-safe) + 16px) 16px calc(var(--nav-h) + 16px);
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
}

a { color: var(--accent); text-decoration: none; }
a:active { opacity: 0.6; }

.loading,
.placeholder {
    padding: 32px 0;
    text-align: center;
    color: var(--fg-muted);
}
.loading {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 40vh;
}

/* ---------- Bottom nav ---------- */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--nav-h);
    padding-bottom: env(safe-area-inset-bottom);
    background: var(--bg-elev);
    border-top: 1px solid var(--border);
    display: flex;
    align-items: stretch;
    justify-content: space-around;
    z-index: 100;
}
.nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    color: var(--fg-muted);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    position: relative;
    transition: color 0.15s ease;
}
.nav-item.active { color: var(--accent); }
.nav-item:active { background: rgba(255,255,255,0.04); }
.nav-icon { font-size: 22px; line-height: 1; }
.nav-label { letter-spacing: 0.2px; }
.nav-badge {
    position: absolute;
    top: 6px;
    right: calc(50% - 22px);
    background: var(--accent);
    color: var(--accent-fg);
    font-size: 10px;
    font-weight: 700;
    min-width: 16px;
    height: 16px;
    border-radius: 8px;
    padding: 0 4px;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* ---------- Headings ---------- */
h1, h2, h3 { margin: 0 0 12px; font-weight: 600; letter-spacing: -0.01em; }
h1 { font-size: 24px; }
h2 { font-size: 18px; }
h3 { font-size: 16px; }
.screen-sub { color: var(--fg-muted); margin: -6px 0 16px; }
.section { margin-top: 24px; }

/* ---------- Buttons ---------- */
button, .btn {
    appearance: none;
    background: var(--accent);
    color: var(--accent-fg);
    border: none;
    border-radius: 12px;
    padding: 14px 20px;
    font-size: 16px;
    font-weight: 600;
    min-height: 48px;
    width: 100%;
    cursor: pointer;
    transition: transform 0.08s ease, opacity 0.15s ease;
    font-family: inherit;
}
button:active, .btn:active { transform: scale(0.98); }
button:disabled { opacity: 0.45; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-fg); }
.btn-secondary { background: var(--bg-elev); color: var(--fg); border: 1px solid var(--border-strong); }
.btn-ghost { background: transparent; color: var(--fg-muted); border: 1px solid var(--border); margin-top: 8px; }
.btn.inline { display: inline-block; width: auto; padding: 10px 18px; min-height: auto; }

.link-btn {
    background: transparent;
    color: var(--accent);
    padding: 6px 8px;
    min-height: auto;
    width: auto;
    font-size: 14px;
    font-weight: 500;
}
.link-btn.danger { color: var(--danger); }

.back {
    display: inline-block;
    background: transparent;
    color: var(--fg-muted);
    padding: 4px 0;
    margin-bottom: 8px;
    width: auto;
    min-height: auto;
    font-size: 14px;
    font-weight: 500;
}

/* ---------- Header / tabs ---------- */
.screen-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    gap: 12px;
    margin-bottom: 12px;
}
.screen-header h1 { margin: 0; }
.tabs {
    display: flex;
    gap: 4px;
    background: var(--bg-elev);
    border-radius: 10px;
    padding: 3px;
    border: 1px solid var(--border);
}
.tab {
    padding: 6px 12px;
    border-radius: 8px;
    color: var(--fg-muted);
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
}
.tab.active { background: var(--accent-soft); color: var(--accent); }

/* ---------- Filters ---------- */
.filters {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-bottom: 16px;
}
.month-input,
input[type="date"],
input[type="month"] {
    background: var(--bg-elev);
    color: var(--fg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 10px 12px;
    font-size: 15px;
    width: 100%;
    font-family: inherit;
}
.chip-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    padding-bottom: 2px;
}
.chip-row::-webkit-scrollbar { display: none; }
.chip {
    flex: 0 0 auto;
    background: var(--bg-elev);
    color: var(--fg-muted);
    border: 1px solid var(--border-strong);
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 500;
    min-height: auto;
    width: auto;
}
.chip.active {
    background: var(--accent-soft);
    color: var(--accent);
    border-color: var(--accent);
}
.chip.seats { padding: 3px 8px; font-size: 11px; }
.chip.seats.low { background: rgba(245,165,36,0.15); color: var(--warn); border-color: rgba(245,165,36,0.4); }
.chip.seats.soldout { background: var(--danger-soft); color: var(--danger); border-color: rgba(229,72,77,0.4); }
.chip.side { padding: 3px 8px; font-size: 11px; background: rgba(0,184,217,0.08); color: var(--accent); border-color: rgba(0,184,217,0.3); }
.chip.span { padding: 3px 8px; font-size: 11px; background: rgba(34,197,94,0.1); color: var(--ok); border-color: rgba(34,197,94,0.3); }

/* ---------- Event banner ---------- */
.event-banner {
    background: var(--accent-soft);
    color: var(--accent);
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 13px;
    margin-bottom: 12px;
}

/* ---------- Day groups + session rows ---------- */
.day-group { margin-bottom: 20px; }
.day-header {
    color: var(--fg-muted);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 0 0 8px;
    font-weight: 600;
}
.day-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.session-row {
    display: grid;
    grid-template-columns: 70px 1fr auto;
    align-items: center;
    gap: 12px;
    padding: 14px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    color: inherit;
    text-decoration: none;
}
.session-row:active { background: var(--bg-soft); }
.session-time { color: var(--fg); font-size: 13px; }
.session-time .t-start { font-weight: 600; font-size: 15px; }
.session-time .t-end { color: var(--fg-dim); font-size: 12px; }
.session-label { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.session-sub { display: flex; gap: 4px; flex-wrap: wrap; }
.session-price { text-align: right; font-weight: 600; font-size: 15px; }

.price-was { color: var(--fg-dim); text-decoration: line-through; font-size: 12px; margin-right: 4px; }
.price-now { color: var(--fg); }

/* ---------- Detail page ---------- */
.detail-meta {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 12px 16px;
    margin: 12px 0 20px;
}
.detail-row {
    display: flex;
    justify-content: space-between;
    align-items: baseline;
    padding: 10px 0;
    border-bottom: 1px solid var(--border);
    gap: 12px;
}
.detail-row:last-child { border-bottom: none; }
.detail-row .k { color: var(--fg-muted); font-size: 13px; }
.detail-row .v { font-weight: 500; text-align: right; }

/* ---------- Forms ---------- */
.form,
.add-form {
    display: flex;
    flex-direction: column;
    gap: 14px;
    margin-top: 8px;
}
.field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.field.inline {
    flex-direction: row;
    align-items: center;
    gap: 12px;
}
.field > span {
    color: var(--fg-muted);
    font-size: 13px;
    font-weight: 500;
}
.field input,
.field select {
    background: var(--bg-elev);
    color: var(--fg);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 12px 14px;
    font-size: 16px;
    font-family: inherit;
    width: 100%;
}
.field select { appearance: none; padding-right: 36px; background-image: linear-gradient(45deg, transparent 50%, var(--fg-muted) 50%), linear-gradient(135deg, var(--fg-muted) 50%, transparent 50%); background-position: calc(100% - 18px) 50%, calc(100% - 13px) 50%; background-size: 5px 5px, 5px 5px; background-repeat: no-repeat; }
.checkbox { display: flex; gap: 8px; align-items: center; color: var(--fg-muted); font-size: 14px; }
.checkbox input { width: 18px; height: 18px; accent-color: var(--accent); }

.form-msg {
    background: var(--danger-soft);
    color: var(--danger);
    border-radius: 8px;
    padding: 10px 12px;
    font-size: 14px;
}
.form-links {
    margin-top: 16px;
    display: flex;
    justify-content: space-between;
    font-size: 14px;
}

/* ---------- Card lists ---------- */
.card-list {
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.card {
    display: block;
    width: 100%;
    text-align: left;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px;
    color: var(--fg);
    min-height: auto;
    font-weight: 500;
}
.card:active { background: var(--bg-soft); }
.card-title { font-weight: 600; font-size: 15px; margin-bottom: 4px; }
.card-sub { color: var(--fg-muted); font-size: 13px; margin-bottom: 4px; }
.card-desc { color: var(--fg-muted); font-size: 13px; margin-top: 6px; line-height: 1.45; }
.link-card { text-decoration: none; }

.rental-card {
    display: flex;
    gap: 12px;
    align-items: center;
}
.rental-card .card-body { flex: 1; }
.card-action {
    width: auto;
    min-width: 56px;
    padding: 10px 14px;
    border-radius: 10px;
    font-size: 14px;
    min-height: 40px;
}

/* ---------- Spa slots ---------- */
.slot-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 8px;
    margin-top: 12px;
}
.slot-tile {
    display: flex;
    flex-direction: column;
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: 12px;
    padding: 14px 8px;
    text-align: center;
    color: var(--fg);
    min-height: 64px;
}
.slot-tile.disabled { opacity: 0.4; }
.slot-time { font-weight: 600; font-size: 15px; }
.slot-meta { color: var(--fg-muted); font-size: 11px; margin-top: 2px; }

/* ---------- Cart ---------- */
.cart-timer {
    background: var(--bg-elev);
    border: 1px solid var(--border-strong);
    border-radius: 10px;
    padding: 10px 14px;
    text-align: center;
    color: var(--fg-muted);
    font-size: 13px;
    margin-bottom: 12px;
}
.cart-timer.warn { background: rgba(245,165,36,0.1); color: var(--warn); border-color: rgba(245,165,36,0.4); }
.cart-timer.expired { background: var(--danger-soft); color: var(--danger); border-color: rgba(229,72,77,0.4); }

.notif-stack { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.notif {
    background: rgba(245,165,36,0.1);
    border: 1px solid rgba(245,165,36,0.35);
    border-radius: 10px;
    padding: 10px 14px;
    color: var(--warn);
    display: flex;
    gap: 12px;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
}
.cart-list { display: flex; flex-direction: column; gap: 10px; }
.cart-item {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}
.cart-item-title { font-weight: 600; font-size: 15px; }
.cart-item-sub { color: var(--fg-muted); font-size: 13px; }
.cart-item-price { color: var(--fg-muted); font-size: 13px; }
.cart-item-actions {
    display: flex;
    gap: 6px;
    align-items: center;
    justify-content: flex-end;
    flex-wrap: wrap;
}
.qty-btn {
    width: 36px;
    height: 36px;
    min-height: 36px;
    padding: 0;
    background: var(--bg-soft);
    color: var(--fg);
    border: 1px solid var(--border-strong);
    border-radius: 8px;
    font-size: 18px;
    line-height: 1;
}
.qty { min-width: 24px; text-align: center; font-weight: 600; }
.cart-totals { margin: 20px 0 12px; padding: 14px 0; border-top: 1px solid var(--border); }
.cart-line { display: flex; justify-content: space-between; font-size: 16px; font-weight: 500; padding: 4px 0; }

/* ---------- Profile / orders ---------- */
.profile-summary {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 18px;
    margin-bottom: 16px;
}
.profile-name { font-size: 20px; font-weight: 700; margin-bottom: 4px; }
.profile-sub { color: var(--fg-muted); font-size: 14px; }
.profile-credit { margin-top: 10px; color: var(--ok); font-weight: 600; }

.order-list { display: flex; flex-direction: column; gap: 8px; }
.order-row {
    display: grid;
    grid-template-columns: auto 1fr auto;
    gap: 12px;
    align-items: center;
    padding: 12px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    text-decoration: none;
    color: inherit;
}
.order-when { font-size: 13px; color: var(--fg-muted); }
.order-id { font-weight: 600; font-size: 14px; }
.order-status { color: var(--fg-muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; }
.order-total { font-weight: 600; }

/* ---------- Events ---------- */
.event-list { display: flex; flex-direction: column; gap: 10px; }
.event-card {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 16px;
}
.event-when { color: var(--accent); font-weight: 600; margin-bottom: 8px; font-size: 13px; }
.event-when .event-time { color: var(--fg-muted); font-weight: 500; font-size: 12px; margin-top: 2px; }
.event-title { margin: 0 0 4px; font-size: 17px; }
.event-loc { color: var(--fg-muted); font-size: 13px; margin-bottom: 6px; }
.event-desc { margin: 6px 0 0; color: var(--fg-muted); font-size: 14px; line-height: 1.45; }

.muted { color: var(--fg-dim); }

/* ---------- Checkout ---------- */
.form-row {
    display: grid;
    gap: 10px;
    align-items: end;
}
.form-row.two { grid-template-columns: 1fr 1fr; }
.form-row.three { grid-template-columns: 2fr 1fr 1fr; }
.form-row.three .field input[id="cu-state"] { text-transform: uppercase; }
.form .form-row:not(.two):not(.three) {
    grid-template-columns: 1fr auto;
}
.form .form-row input { width: 100%; padding: 12px 14px; border-radius: 10px; border: 1px solid var(--border-strong); background: var(--bg-elev); color: var(--fg); font-size: 15px; }
.btn.apply { width: auto; min-height: 48px; padding: 10px 20px; }

.mini-cart {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
    display: flex;
    flex-direction: column;
    gap: 6px;
}
.mini-row { display: flex; justify-content: space-between; align-items: center; font-size: 14px; gap: 12px; }
.mini-row.discount { color: var(--ok); }
.mini-row.total { font-weight: 700; font-size: 17px; padding-top: 4px; }
.mini-row.muted { color: var(--fg-muted); font-size: 12px; }
.mini-name { color: var(--fg); }
.mini-price { color: var(--fg-muted); }
.mini-row.total .mini-price, .mini-row.total span:last-child { color: var(--fg); }
.mini-divider { height: 1px; background: var(--border); margin: 4px 0; }

.code-list { display: flex; flex-direction: column; gap: 6px; margin-top: 10px; }
.code-row {
    display: grid;
    grid-template-columns: 1fr auto auto;
    gap: 10px;
    align-items: center;
    padding: 10px 12px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 13px;
}
.code-type { color: var(--fg-muted); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em; margin-right: 6px; }
.code-val { font-family: ui-monospace, "SF Mono", monospace; font-size: 13px; }
.code-meta { color: var(--ok); font-weight: 600; }

.saved-cards { display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; }
.saved-card {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
    cursor: pointer;
}
.saved-card input[type="radio"] { width: 18px; height: 18px; accent-color: var(--accent); }
.card-info { flex: 1; }
.card-brand { font-weight: 600; }
.card-exp { color: var(--fg-muted); font-size: 13px; }

.card-form { display: flex; flex-direction: column; gap: 12px; }

/* ---------- Modal ---------- */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    z-index: 200;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
    overscroll-behavior: contain;
}
.modal-card {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    padding: 20px;
    width: 100%;
    max-width: 560px;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.modal-card h2 { margin: 0; }
.waiver-body {
    overflow-y: auto;
    flex: 1;
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 12px 14px;
    background: var(--bg-elev);
    font-size: 14px;
    line-height: 1.55;
    max-height: 50vh;
}
.sig-input {
    font-family: "Snell Roundhand", "Brush Script MT", cursive !important;
    font-size: 22px !important;
}
.modal-actions { display: flex; gap: 10px; }
.modal-actions .btn { flex: 1; margin: 0; }

/* ---------- Receipt ---------- */
.receipt-summary { display: flex; flex-direction: column; gap: 8px; }
.receipt-statuses { display: flex; gap: 6px; margin-top: 6px; }
.receipt-list { display: flex; flex-direction: column; gap: 8px; }
.receipt-item {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 12px;
}
.receipt-item-title { font-weight: 600; }
.receipt-item-sub { color: var(--fg-muted); font-size: 13px; }
.receipt-item-qty { color: var(--fg-muted); font-size: 14px; }
.receipt-item-price { font-weight: 600; }
.receipt-totals {
    background: var(--bg-elev);
    border: 1px solid var(--border);
    border-radius: 14px;
    padding: 14px;
}
.receipt-totals .cart-line.discount { color: var(--ok); }
.receipt-totals .cart-line.total { font-weight: 700; font-size: 18px; border-top: 1px solid var(--border); padding-top: 12px; margin-top: 4px; }
.receipt-card { margin-top: 10px; color: var(--fg-muted); font-size: 14px; text-align: right; }
