/* Fika — premium dark theme, phone first.
   Ink #12101F (background) · Panel #221E3D (cards) · Gold #E8B84B (price & action)
   Violet #7C6CF0 (highlights) · M-PESA green #43B02A (payment only) · Paper #F5F2EA (ticket face)
   Headings: serif display. Body/UI: clean sans. One gold button per screen. */
:root {
  --ink: #12101f;
  --ink-2: #1a1730;
  --panel: #221e3d;
  --panel-2: #2b2650;
  --gold: #e8b84b;
  --gold-deep: #c99a2e;
  --violet: #7c6cf0;
  --green: #43b02a;
  --paper: #f5f2ea;
  --text: #f2eefc;
  --muted: #a9a3c7;
  --line: rgba(255, 255, 255, 0.09);
  --radius: 12px;
  --shadow: 0 8px 28px rgba(0, 0, 0, 0.45);
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--ink);
  color: var(--text);
  font-family: -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  font-size: 16px;
  line-height: 1.55;
  min-height: 100vh;
}
h1, h2, h3, .serif { font-family: Georgia, "Times New Roman", serif; letter-spacing: 0.01em; }
h1 { font-size: 30px; line-height: 1.2; margin: 0 0 8px; }
h2 { font-size: 23px; margin: 0 0 8px; }
h3 { font-size: 19px; margin: 0 0 6px; }
p { margin: 0 0 12px; }
a { color: var(--gold); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.price { color: var(--gold); font-weight: 800; font-variant-numeric: tabular-nums; white-space: nowrap; }
.num { font-variant-numeric: tabular-nums; }

/* Header */
.topbar {
  position: sticky; top: 0; z-index: 40;
  background: rgba(18, 16, 31, 0.92);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line);
}
.topbar-inner {
  max-width: 1060px; margin: 0 auto; padding: 10px 16px;
  display: flex; align-items: center; gap: 14px;
}
.brand { display: flex; align-items: center; gap: 10px; color: var(--text); font-family: Georgia, serif; font-size: 22px; font-weight: 700; }
.brand:hover { text-decoration: none; }
.brand img { height: 34px; width: auto; border-radius: 8px; }
.brand .dot { color: var(--gold); }
.topnav { margin-left: auto; display: flex; align-items: center; gap: 4px; font-size: 15px; }
.topnav a { color: var(--text); padding: 8px 10px; border-radius: 8px; }
.topnav a:hover { background: var(--panel); text-decoration: none; }
.topnav a.cta { background: var(--gold); color: #1a1405; font-weight: 700; }
.topnav a.cta:hover { background: var(--gold-deep); }

/* Layout */
.wrap { max-width: 1060px; margin: 0 auto; padding: 20px 16px 64px; }
.wrap-narrow { max-width: 620px; margin: 0 auto; padding: 20px 16px 64px; }
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 18px;
  margin-bottom: 16px;
}
.card h2, .card h3 { margin-top: 0; }
.grid { display: grid; gap: 16px; }
@media (min-width: 640px) { .grid-2 { grid-template-columns: 1fr 1fr; } .grid-3 { grid-template-columns: repeat(3, 1fr); } }

/* Event cards */
.event-card { overflow: hidden; padding: 0; cursor: pointer; transition: transform 0.15s ease, border-color 0.15s ease; }
.event-card:hover { transform: translateY(-2px); border-color: rgba(232, 184, 75, 0.5); }
.event-card .photo { aspect-ratio: 16/9; background: var(--panel-2); position: relative; overflow: hidden; }
.event-card .photo img { width: 100%; height: 100%; object-fit: cover; }
.event-card .photo .badge {
  position: absolute; top: 10px; left: 10px;
  background: rgba(18, 16, 31, 0.85); color: var(--gold);
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  padding: 4px 10px; border-radius: 999px;
}
.event-card .photo .soldout {
  position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  background: rgba(18, 16, 31, 0.65); color: #fff; font-family: Georgia, serif;
  font-size: 24px; letter-spacing: 0.08em; text-transform: uppercase;
}
.event-card .body { padding: 14px 16px 16px; }
.event-card .meta { color: var(--muted); font-size: 14px; margin: 4px 0 8px; }
.event-card .from { font-size: 15px; }

/* Buttons — one gold action per screen */
.btn {
  display: inline-block; border: 0; cursor: pointer;
  background: var(--gold); color: #1a1405; font-weight: 800; font-size: 16px;
  padding: 13px 22px; border-radius: 999px; text-align: center; line-height: 1.2;
}
.btn:hover { background: var(--gold-deep); text-decoration: none; }
.btn:disabled { opacity: 0.5; cursor: not-allowed; }
.btn-block { display: block; width: 100%; }
.btn-ghost { background: transparent; color: var(--text); border: 1px solid var(--line); font-weight: 600; }
.btn-ghost:hover { background: var(--panel-2); }
.btn-green { background: var(--green); color: #fff; }
.btn-green:hover { filter: brightness(1.1); }
.btn-danger { background: #b3261e; color: #fff; }

/* Forms */
label { display: block; font-size: 14px; font-weight: 600; margin: 14px 0 6px; }
input, select, textarea {
  width: 100%; padding: 12px 14px; font-size: 16px; color: var(--text);
  background: var(--ink-2); border: 1px solid var(--line); border-radius: 10px;
  font-family: inherit;
}
input:focus, select:focus, textarea:focus { outline: 2px solid var(--gold); outline-offset: 1px; border-color: var(--gold); }
input[type="date"], input[type="datetime-local"] { color-scheme: dark; }
.field-row { display: grid; gap: 12px; }
@media (min-width: 560px) { .field-row { grid-template-columns: 1fr 1fr; } }
.hint { font-size: 13px; color: var(--muted); margin-top: 6px; }
.error { background: rgba(179, 38, 30, 0.18); border: 1px solid rgba(179, 38, 30, 0.6); color: #ffb4ab; padding: 12px 14px; border-radius: 10px; margin: 12px 0; }
.ok { background: rgba(67, 176, 42, 0.15); border: 1px solid rgba(67, 176, 42, 0.55); color: #b9f0a8; padding: 12px 14px; border-radius: 10px; margin: 12px 0; }

/* Ticket tiers */
.tier {
  display: flex; align-items: center; gap: 14px;
  background: var(--ink-2); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 14px 16px; margin-bottom: 10px;
}
.tier .info { flex: 1; min-width: 0; }
.tier .name { font-family: Georgia, serif; font-size: 18px; }
.tier .desc { color: var(--muted); font-size: 14px; }
.tier .left { font-size: 13px; color: var(--gold); font-weight: 700; }
.tier .left.soldout { color: #ff8a80; }
.qty { display: flex; align-items: center; gap: 10px; }
.qty button {
  width: 38px; height: 38px; border-radius: 50%; border: 1px solid var(--line);
  background: var(--panel); color: var(--text); font-size: 20px; cursor: pointer; line-height: 1;
}
.qty button:disabled { opacity: 0.35; cursor: not-allowed; }
.qty .n { min-width: 22px; text-align: center; font-weight: 800; font-size: 18px; }

/* Ticket face — white paper, maximum readability at the gate */
.ticket {
  background: var(--paper); color: #191423; border-radius: 14px;
  overflow: hidden; box-shadow: var(--shadow); max-width: 420px; margin: 0 auto;
}
.ticket .thead { background: var(--ink); color: var(--text); padding: 16px 18px; }
.ticket .thead h2 { margin: 0; font-size: 21px; }
.ticket .thead .meta { color: var(--muted); font-size: 14px; }
.ticket .tbody { padding: 18px; text-align: center; }
.ticket .qr { display: inline-block; background: #fff; padding: 12px; border-radius: 10px; }
.ticket .qr img, .ticket .qr canvas { display: block; }
.ticket .short { font-size: 22px; font-weight: 800; letter-spacing: 0.14em; margin: 12px 0 4px; font-variant-numeric: tabular-nums; }
.ticket .trow { display: flex; justify-content: space-between; gap: 12px; text-align: left; padding: 8px 0; border-top: 1px dashed #c9c2b2; font-size: 15px; }
.ticket .trow b { font-variant-numeric: tabular-nums; }

/* Scanner verdicts — full-screen green / red */
.verdict { min-height: 60vh; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; border-radius: 16px; padding: 28px 18px; }
.verdict.valid { background: var(--green); color: #fff; }
.verdict.used, .verdict.invalid, .verdict.void { background: #b3261e; color: #fff; }
.verdict h2 { font-size: 34px; margin: 0 0 8px; }
.verdict .big { font-size: 20px; font-weight: 700; }

/* Tables */
table { width: 100%; border-collapse: collapse; font-size: 15px; }
th, td { text-align: left; padding: 9px 8px; border-bottom: 1px solid var(--line); font-variant-numeric: tabular-nums; }
th { color: var(--muted); font-size: 13px; text-transform: uppercase; letter-spacing: 0.05em; }
.stat-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 640px) { .stat-grid { grid-template-columns: repeat(4, 1fr); } }
.stat { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius); padding: 14px; }
.stat .label { font-size: 12px; color: var(--muted); text-transform: uppercase; letter-spacing: 0.06em; }
.stat .value { font-size: 26px; font-weight: 800; font-variant-numeric: tabular-nums; margin-top: 2px; }
.stat .value.gold { color: var(--gold); }

/* M-PESA waiting pulse */
.pulse { display: inline-block; width: 12px; height: 12px; border-radius: 50%; background: var(--green); animation: pulse 1.2s ease-in-out infinite; vertical-align: middle; margin-right: 8px; }
@keyframes pulse { 0%, 100% { opacity: 1; transform: scale(1); } 50% { opacity: 0.45; transform: scale(0.8); } }
.spinner { width: 22px; height: 22px; border: 3px solid var(--line); border-top-color: var(--gold); border-radius: 50%; animation: spin 0.8s linear infinite; display: inline-block; vertical-align: middle; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Footer */
.footer { max-width: 1060px; margin: 0 auto; padding: 28px 16px 40px; color: var(--muted); font-size: 14px; border-top: 1px solid var(--line); }
.footer a { color: var(--muted); }

/* Pills / status */
.pill { display: inline-block; font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; padding: 3px 10px; border-radius: 999px; background: var(--panel-2); color: var(--text); }
.pill.gold { background: rgba(232, 184, 75, 0.2); color: var(--gold); }
.pill.green { background: rgba(67, 176, 42, 0.2); color: #b9f0a8; }
.pill.red { background: rgba(179, 38, 30, 0.25); color: #ffb4ab; }
.pill.violet { background: rgba(124, 108, 240, 0.25); color: #cfc6ff; }

/* Tabs (studio / admin) */
.tabs { display: flex; gap: 6px; overflow-x: auto; margin-bottom: 16px; }
.tabs a { padding: 9px 14px; border-radius: 999px; color: var(--text); background: var(--panel); white-space: nowrap; font-size: 15px; }
.tabs a.active { background: var(--gold); color: #1a1405; font-weight: 700; }
.tabs a:hover { text-decoration: none; }
