:root {
  --brand: #4f46e5;
  --brand-dark: #3730a3;
  --brand-light: #eef2ff;
  --ink: #0f172a;
  --muted: #64748b;
  --border: #e9eaf0;
  --bg: #f7f7fb;
  --radius-lg: 20px;
  --radius-md: 14px;
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --font: 'Manrope', system-ui, -apple-system, 'Segoe UI', sans-serif;
}

* { -webkit-tap-highlight-color: transparent; }
html { -webkit-text-size-adjust: 100%; }

body {
  background: var(--bg);
  font-size: 16px;
  font-family: var(--font);
  color: var(--ink);
}

h1, h2, h3, h4, h5, h6 { font-weight: 800; letter-spacing: -.01em; }

a { color: var(--brand); text-decoration: none; }
a:hover { color: var(--brand-dark); }

a, button { touch-action: manipulation; }

/* ---------- Navbar ---------- */
.app-navbar {
  background: rgba(255,255,255,.85);
  backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border);
  padding-top: .7rem;
  padding-bottom: .7rem;
  z-index: 1030;
}

.logo-mark {
  width: 34px;
  height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--brand), #8b5cf6);
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 1rem;
}

.navbar-brand .brand-text {
  color: var(--ink);
  font-size: 1.05rem;
}

/* ---------- Buttons ---------- */
.btn { border-radius: 12px; font-weight: 600; }
.btn-sm { min-height: 38px; }

.btn:not(.btn-sm) {
  min-height: 48px;
  padding-top: .65rem;
  padding-bottom: .65rem;
}

.btn-dark,
.btn-brand {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  border: none;
  color: #fff;
  box-shadow: 0 6px 16px rgba(79,70,229,.25);
}

.btn-dark:hover, .btn-dark:active,
.btn-brand:hover, .btn-brand:active {
  background: linear-gradient(135deg, var(--brand-dark), var(--brand-dark));
  color: #fff;
}

.btn-outline-dark { border-color: var(--border); color: var(--ink); }
.btn-outline-dark:hover { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }

.btn-ghost {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--ink);
}
.btn-ghost:hover { background: var(--brand-light); border-color: var(--brand); color: var(--brand-dark); }

.btn-warning { background: #fbbf24; border: none; color: #1f2937; }

/* ---------- Cards ---------- */
.card {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: 0 1px 2px rgba(15,23,42,.03);
}

.event-card {
  position: relative;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
  transition: box-shadow .18s ease, transform .18s ease;
  background: #fff;
}

.event-card:hover, .event-card:active {
  box-shadow: 0 14px 32px rgba(15,23,42,.1);
  transform: translateY(-3px);
}

.event-card img {
  width: 100%;
  height: 180px;
  object-fit: cover;
  background: var(--brand-light);
}

.day-badge {
  position: absolute;
  top: 12px;
  left: 12px;
  background: #fff;
  border-radius: 12px;
  padding: 6px 10px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(15,23,42,.15);
  line-height: 1.1;
}
.day-badge .day { display: block; font-weight: 800; font-size: 1.05rem; color: var(--ink); }
.day-badge .month { display: block; font-size: .68rem; text-transform: uppercase; color: var(--brand); font-weight: 700; }

.icon { vertical-align: -3px; margin-right: 4px; color: var(--brand); }

.meta-row { color: var(--muted); font-size: .92rem; }

/* ---------- Hero ---------- */
.hero {
  background: linear-gradient(135deg, var(--brand-light), #fdf4ff);
  border-radius: var(--radius-lg);
  padding: 32px 28px;
  margin-bottom: 28px;
}
.hero h1 { font-size: 1.6rem; margin-bottom: 6px; }
.hero p { color: var(--muted); margin-bottom: 0; }

/* ---------- Ticket selection ---------- */
.ticket-row {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 14px 16px;
  margin-bottom: 10px;
  background: #fff;
}

.qty-stepper {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  background: var(--brand-light);
  border-radius: 999px;
  padding: 4px;
}

.qty-stepper .qty-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: none;
  background: #fff;
  color: var(--brand);
  font-size: 1.1rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.08);
}
.qty-stepper .qty-btn:active { transform: scale(0.93); }
.qty-stepper .qty-btn:disabled { opacity: .35; }

.qty-stepper .qty-value {
  min-width: 28px;
  text-align: center;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
}

.sticky-buy-bar {
  position: sticky;
  bottom: 0;
  z-index: 20;
  background: #fff;
  border-top: 1px solid var(--border);
  padding: 12px 16px calc(12px + var(--safe-bottom));
  margin: 16px -16px -16px;
  border-radius: 0 0 var(--radius-lg) var(--radius-lg);
  box-shadow: 0 -8px 20px rgba(0,0,0,.04);
}

/* ---------- Ticket / QR ---------- */
.ticket-qr {
  background: #fff;
  padding: 20px;
  border-radius: 20px;
  display: inline-block;
  box-shadow: 0 12px 32px rgba(79,70,229,.12);
}
.ticket-qr svg { width: 260px; height: 260px; }

.status-badge { font-size: .8rem; padding: .35em .7em; border-radius: 999px; }

.kaspi-box {
  background: #fff7ed;
  border: 1px solid #fed7aa;
  border-radius: var(--radius-md);
  padding: 16px;
}

/* ---------- Forms ---------- */
.form-label { font-weight: 600; font-size: .9rem; color: var(--ink); }
.form-control {
  border-radius: 10px;
  min-height: 46px;
  border-color: var(--border);
}
.form-control:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px var(--brand-light);
}
textarea.form-control { min-height: auto; }

.table { font-size: .93rem; }
.table thead { color: var(--muted); font-weight: 700; font-size: .8rem; text-transform: uppercase; letter-spacing: .02em; }

.badge { border-radius: 999px; font-weight: 600; }

.empty-state {
  text-align: center;
  padding: 48px 16px;
  color: var(--muted);
}

/* ---------- Scanner ---------- */
#scanner video { border-radius: var(--radius-lg); }
#scan-result { border-radius: var(--radius-md); border: 1px solid transparent; }
#scan-result.ok { background:#dcfce7; border-color:#86efac; }
#scan-result.fail { background:#fee2e2; border-color:#fca5a5; }

/* ---------- Mobile tuning ---------- */
@media (max-width: 576px) {
  .container { padding-left: 16px; padding-right: 16px; }
  .ticket-qr svg { width: 220px; height: 220px; }
  h3 { font-size: 1.3rem; }
  h4 { font-size: 1.1rem; }
  .table { font-size: .88rem; }
  .hero { padding: 24px 18px; }
  .hero h1 { font-size: 1.3rem; }
  form > button.btn:not(.btn-sm) { width: 100%; }
}
