/* ═══════════════════════════════════════════════════
   Streat Loyalty — Premium Design System
   ═══════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

/* ── Design Tokens ── */
:root {
  /* Brand — deep forest green */
  --brand: #166534;
  --brand-light: #16a34a;
  --brand-bright: #22c55e;
  --brand-pale: #dcfce7;
  --brand-dark: #14532d;
  --brand-deep: #0b2d18;

  /* Accent — warm amber gold */
  --accent: #d97706;
  --accent-light: #fef3c7;
  --accent-warm: #f59e0b;
  --accent-pale: #fffbeb;

  /* Warm neutrals — not cold blue-gray */
  --bg: #fafaf8;
  --bg-alt: #f3f3ef;
  --bg-warm: #f9f5ef;
  --card: #ffffff;
  --border: #e4e4de;
  --border-light: #ededea;

  /* Text — warm dark */
  --text: #0f0f0c;
  --text-2: #2a2a22;
  --text-3: #6b6b5d;
  --text-4: #9b9b8a;

  /* Semantic */
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --info: #2563eb;

  /* Shadows — layered and warm */
  --shadow-xs: 0 1px 2px rgba(0,0,0,.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,.05), 0 1px 2px rgba(0,0,0,.04);
  --shadow: 0 4px 8px rgba(0,0,0,.04), 0 8px 24px rgba(0,0,0,.06);
  --shadow-lg: 0 12px 32px rgba(0,0,0,.08), 0 4px 12px rgba(0,0,0,.06);
  --shadow-xl: 0 24px 48px rgba(0,0,0,.10), 0 8px 16px rgba(0,0,0,.07);
  --shadow-brand: 0 8px 28px rgba(22,101,52,.35);
  --shadow-brand-lg: 0 16px 48px rgba(22,101,52,.40);
  --shadow-gold: 0 4px 16px rgba(217,119,6,.30);

  /* Layout */
  --nav-h: 64px;
  --bottom-nav-h: 80px;

  /* Radius */
  --radius-xs: 6px;
  --radius-sm: 8px;
  --radius: 12px;
  --radius-lg: 16px;
  --radius-xl: 20px;
  --radius-2xl: 24px;
  --radius-full: 9999px;

  /* Transitions */
  --ease-spring: cubic-bezier(.34,1.56,.64,1);
  --ease-out: cubic-bezier(.16,1,.3,1);
}

/* ── Reset & Base ── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { -webkit-text-size-adjust: 100%; }

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  font-feature-settings: 'cv02','cv03','cv04','cv11';
}

a { color: inherit; text-decoration: none; }
img { max-width: 100%; }

/* ── App Shell ── */
.app-shell {
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  min-height: 100dvh;
}

/* ── Top Bar ── */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  height: var(--nav-h);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(250,250,248,.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border-light);
}

.topbar-logo {
  display: flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: var(--text);
}

.logo-mark {
  width: 34px; height: 34px;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-weight: 800;
  font-size: .88rem;
  box-shadow: 0 2px 8px rgba(22,101,52,.3);
}

.topbar-actions { display: flex; align-items: center; gap: 8px; }

/* ── Main Content ── */
.main {
  flex: 1;
  padding: 20px 20px calc(var(--bottom-nav-h) + 16px);
  max-width: 480px;
  width: 100%;
  margin: 0 auto;
}

/* ── Card ── */
.card {
  background: var(--card);
  border-radius: var(--radius-xl);
  border: 1px solid var(--border-light);
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.04);
  padding: 20px;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-light);
}

.card-title {
  font-size: .82rem;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: .06em;
}

/* ── Bottom Nav — Floating Glass ── */
.bottom-nav {
  position: fixed;
  bottom: 12px;
  left: 12px;
  right: 12px;
  height: 64px;
  background: rgba(255,255,255,.88);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border-radius: var(--radius-xl);
  border: 1px solid rgba(255,255,255,.9);
  box-shadow: 0 8px 32px rgba(0,0,0,.12), 0 2px 8px rgba(0,0,0,.06), inset 0 1px 0 rgba(255,255,255,.8);
  display: flex;
  align-items: center;
  padding: 0 4px;
  z-index: 100;
}

.bottom-nav a {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  font-size: .64rem;
  font-weight: 600;
  color: var(--text-4);
  letter-spacing: .01em;
  transition: color .15s, transform .1s ease;
  padding: 0 2px;
  height: 100%;
  border-radius: var(--radius-lg);
}

/* Gentle tap press feedback */
.bottom-nav a:active { transform: scale(0.93); }
.bottom-nav a:hover { color: var(--text-3); }

.nav-icon {
  width: 38px; height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius);
  transition: background .2s ease, box-shadow .2s ease;
}

/* Smooth icon enter — no overshoot */
@keyframes navIconEnter {
  from { transform: scale(0.82); opacity: 0; }
  to   { transform: scale(1);    opacity: 1; }
}

.bottom-nav a.active {
  color: var(--brand);
  font-weight: 800;
}


.bottom-nav a.active .nav-icon {
  background: var(--brand-pale);
  color: var(--brand);
  box-shadow: 0 2px 8px rgba(22,101,52,.15);
  animation: navIconEnter .22s ease-out both;
}

/* Center scan button */
.bottom-nav a[href="/receipts/new"] {
  flex: 1.2;
}

.bottom-nav a[href="/receipts/new"] .nav-icon {
  width: 48px; height: 48px;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  border-radius: 50%;
  color: white;
  margin-top: -18px;
  box-shadow: var(--shadow-brand);
  transition: transform .2s var(--ease-spring), box-shadow .2s;
}

.bottom-nav a[href="/receipts/new"]:active .nav-icon {
  transform: scale(.92);
}

.bottom-nav a[href="/receipts/new"].active .nav-icon {
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  box-shadow: var(--shadow-brand-lg);
  transform: scale(1.04);
}

/* ── Hero Loyalty Card ── */
.loyalty-hero {
  background: linear-gradient(160deg, #051410 0%, #0a2016 30%, #122e1c 60%, #1a3f26 100%);
  border-radius: var(--radius-2xl);
  padding: 26px 22px 22px;
  color: white;
  box-shadow: 0 8px 40px rgba(0,0,0,.35), 0 0 0 1px rgba(255,255,255,.06), 0 1px 0 rgba(255,255,255,.1) inset;
  position: relative;
  overflow: hidden;
  border: none;
}

/* Grain texture overlay */
.loyalty-hero::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 256 256' xmlns='http://www.w3.org/2000/svg'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='4' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='100%25' height='100%25' filter='url(%23n)' opacity='0.04'/%3E%3C/svg%3E");
  pointer-events: none;
  border-radius: inherit;
}

/* Dual glow orbs — gold top-right, green bottom-left */
.loyalty-hero::after {
  content: '';
  position: absolute;
  top: -70px; right: -70px;
  width: 280px; height: 280px;
  background: radial-gradient(circle, rgba(251,191,36,.14) 0%, rgba(34,197,94,.06) 50%, transparent 70%);
  pointer-events: none;
}
.loyalty-hero .hero-glow-bl {
  position: absolute;
  bottom: -50px; left: -50px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(34,197,94,.1) 0%, transparent 70%);
  pointer-events: none;
  border-radius: 50%;
}

/* Subtle stripe accent */
.loyalty-hero .hero-stripe {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  height: 3px;
  background: linear-gradient(90deg, transparent, rgba(251,191,36,.6), rgba(34,197,94,.4), transparent);
}

.loyalty-hero .welcome {
  font-size: .7rem;
  font-weight: 600;
  letter-spacing: .12em;
  text-transform: uppercase;
  opacity: .45;
  margin-bottom: 2px;
}

.loyalty-hero .name {
  font-size: 1.65rem;
  font-weight: 900;
  letter-spacing: -.03em;
  margin-bottom: 20px;
  line-height: 1.15;
}

/* ── Stamps ── */
.stamps-display {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 10px;
  margin-bottom: 14px;
  justify-items: center;
}

.stamp {
  width: 44px; height: 44px;
  border-radius: 50%;
  border: 1.5px solid rgba(255,255,255,.12);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .3s var(--ease-spring);
  background: rgba(255,255,255,.035);
}

.stamp svg { width: 18px; height: 18px; opacity: .2; color: rgba(255,255,255,.6); }

.stamp.filled {
  background: linear-gradient(145deg, #fcd34d 0%, #f59e0b 55%, #d97706 100%);
  border-color: rgba(251,191,36,.7);
  box-shadow: 0 0 16px rgba(251,191,36,.5), 0 3px 8px rgba(0,0,0,.25), 0 1px 0 rgba(255,255,255,.3) inset;
  transform: scale(1.05);
}

.stamp.filled svg { opacity: 1; color: rgba(100,45,0,.85); width: 20px; height: 20px; }

/* Last earned stamp — subtle pulse */
.stamp.filled:last-of-type {
  animation: stampPop .4s var(--ease-spring) both;
}

@keyframes stampPop {
  0% { transform: scale(.6); opacity: .5; }
  100% { transform: scale(1.06); opacity: 1; }
}

.stamps-info {
  font-size: .82rem;
  opacity: .85;
  line-height: 1.4;
}

.loyalty-hero .ref-tag {
  position: absolute;
  bottom: 18px; right: 18px;
  font-size: .65rem;
  font-weight: 700;
  letter-spacing: .12em;
  opacity: .4;
  font-variant-numeric: tabular-nums;
}

/* ── Progress Ring ── */
.progress-ring-wrap {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.progress-ring-wrap .ring-label {
  position: absolute;
  text-align: center;
}

.progress-ring-wrap .ring-label .val {
  font-size: 1.3rem;
  font-weight: 800;
  color: white;
  line-height: 1;
}

.progress-ring-wrap .ring-label .sub {
  font-size: .65rem;
  opacity: .7;
}

/* ── Progress Bar ── */
.progress-bar {
  height: 4px;
  background: rgba(255,255,255,.12);
  border-radius: var(--radius-full);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #f59e0b, #fbbf24);
  border-radius: var(--radius-full);
  transition: width .7s var(--ease-out);
}

/* ── Stats Grid ── */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.stat-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 14px 16px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.03);
  transition: box-shadow .18s, transform .18s var(--ease-spring);
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 13px;
  text-decoration: none;
}

.stat-card:active { transform: scale(.96); box-shadow: none; }

.stat-card .stat-icon {
  width: 42px; height: 42px;
  border-radius: 13px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  background: var(--brand-pale);
  color: var(--brand);
}

.stat-card .stat-body { flex: 1; min-width: 0; }

.stat-card .stat-val {
  font-size: 1.25rem;
  font-weight: 800;
  color: var(--text);
  line-height: 1.15;
  letter-spacing: -.025em;
}

.stat-card .stat-label {
  font-size: .66rem;
  color: var(--text-4);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .055em;
  margin-top: 1px;
}

.stat-card .stat-arrow {
  color: var(--text-4);
  flex-shrink: 0;
  opacity: .4;
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 11px 20px;
  border-radius: var(--radius);
  font-weight: 600;
  font-size: .9rem;
  border: none;
  transition: all .15s;
  white-space: nowrap;
  cursor: pointer;
  letter-spacing: -.01em;
}

.btn-primary {
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  color: white;
  box-shadow: 0 2px 8px rgba(22,101,52,.25), 0 1px 2px rgba(0,0,0,.1);
}

.btn-primary:hover {
  background: linear-gradient(135deg, var(--brand), var(--brand-dark));
  box-shadow: var(--shadow-brand);
  transform: translateY(-1px);
}

.btn-primary:active { transform: scale(.97); box-shadow: none; }

.btn-secondary {
  background: var(--bg-alt);
  color: var(--text-2);
  border: 1px solid var(--border);
}

.btn-secondary:hover { background: var(--border); transform: translateY(-1px); }
.btn-secondary:active { transform: scale(.97); }

.btn-accent {
  background: linear-gradient(135deg, var(--accent-warm), var(--accent));
  color: white;
  box-shadow: var(--shadow-gold);
}

.btn-accent:hover { filter: brightness(1.05); transform: translateY(-1px); }

.btn-danger {
  background: #fef2f2;
  color: var(--danger);
  border: 1px solid #fecaca;
}

.btn-danger:hover { background: #fee2e2; }

.btn-ghost {
  background: transparent;
  color: var(--text-3);
}

.btn-ghost:hover { background: var(--bg-alt); color: var(--text); }

.btn-lg { padding: 15px 28px; font-size: 1rem; border-radius: var(--radius-lg); }
.btn-sm { padding: 7px 14px; font-size: .8rem; border-radius: var(--radius-sm); }
.btn-full { width: 100%; }

.btn-icon {
  width: 40px; height: 40px;
  padding: 0;
  border-radius: var(--radius);
  background: var(--bg-alt);
  border: 1px solid var(--border);
  color: var(--text-2);
}

.btn-icon:hover { background: var(--border); }

/* ── Forms ── */
.form-group { margin-bottom: 16px; }

.form-label {
  display: block;
  font-size: .82rem;
  font-weight: 600;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: -.01em;
}

.form-label .required { color: var(--danger); margin-left: 2px; }

.form-input {
  width: 100%;
  padding: 12px 14px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  font-size: .95rem;
  background: var(--card);
  color: var(--text);
  transition: border-color .15s, box-shadow .15s;
  outline: none;
  font-family: inherit;
}

.form-input:focus {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22,101,52,.1);
}

.form-input::placeholder { color: var(--text-4); }

.form-hint {
  font-size: .75rem;
  color: var(--text-3);
  margin-top: 4px;
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

/* ── Badges ── */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: var(--radius-full);
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .02em;
}

.badge-green { background: #dcfce7; color: #15803d; }
.badge-yellow { background: #fef9c3; color: #a16207; }
.badge-red { background: #fee2e2; color: #b91c1c; }
.badge-gray { background: var(--bg-alt); color: var(--text-3); border: 1px solid var(--border); }
.badge-blue { background: #eff6ff; color: #1d4ed8; }
.badge-purple { background: #f5f3ff; color: #7c3aed; }

/* ── Receipts List ── */
.receipt-item {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 13px 0;
  border-bottom: 1px solid var(--border-light);
  transition: background .12s;
}

.receipt-item:last-child { border-bottom: none; }

.receipt-icon {
  width: 44px; height: 44px;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.receipt-icon.pending  { background: #fffbeb; color: #b45309; }
.receipt-icon.approved { background: #f0fdf4; color: #16a34a; }
.receipt-icon.rejected { background: #fef2f2; color: #dc2626; }
.receipt-icon.processing { background: #eef2ff; color: #4f46e5; }

.receipt-body { flex: 1; min-width: 0; }
.receipt-body .r-title { font-weight: 700; font-size: .9rem; letter-spacing: -.015em; color: var(--text); }
.receipt-body .r-date { font-size: .75rem; color: var(--text-4); margin-top: 2px; }

.receipt-right { text-align: right; flex-shrink: 0; }
.receipt-right .r-amount { font-weight: 800; font-size: .95rem; letter-spacing: -.025em; color: var(--text); }
.receipt-right .r-stamps { font-size: .72rem; color: var(--brand); font-weight: 700; margin-top: 2px; }

/* ── Voucher Card — Premium Ticket ── */
.voucher-card {
  background: linear-gradient(135deg, #fffdf5 0%, #fef9eb 50%, #fef3c7 100%);
  border: 1.5px solid #fde68a;
  border-radius: var(--radius-xl);
  padding: 0;
  position: relative;
  overflow: hidden;
  box-shadow: 0 4px 16px rgba(217,119,6,.12), var(--shadow-sm);
}

.voucher-card .voucher-inner {
  padding: 22px 22px 18px;
}

/* Perforation line */
.voucher-card .voucher-perf {
  height: 1px;
  background-image: repeating-linear-gradient(90deg, #fcd34d 0, #fcd34d 7px, transparent 7px, transparent 13px);
  margin: 0 0;
}

.voucher-card .voucher-footer {
  padding: 14px 22px 18px;
}

/* Gold shimmer overlay */
.voucher-card::before {
  content: '';
  position: absolute;
  top: -50%; right: -20px;
  width: 60px; height: 200%;
  background: linear-gradient(105deg, transparent, rgba(251,191,36,.1), transparent);
  transform: skewX(-15deg);
  pointer-events: none;
}

.voucher-amount {
  font-size: 2.6rem;
  font-weight: 900;
  color: var(--brand);
  line-height: 1;
  letter-spacing: -.04em;
}

.voucher-label {
  font-size: .8rem;
  color: var(--text-3);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .05em;
  margin-top: 4px;
}

.voucher-code {
  font-family: 'Courier New', monospace;
  font-size: .88rem;
  font-weight: 700;
  letter-spacing: .14em;
  color: var(--text-2);
  background: rgba(255,255,255,.75);
  padding: 5px 10px;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(253,211,77,.5);
  display: inline-block;
}

/* ── QR Card ── */
.qr-card {
  background: linear-gradient(145deg, #0a1f12 0%, #0f2d1a 40%, #1a4a2a 100%);
  border-radius: var(--radius-2xl);
  padding: 28px 24px;
  color: white;
  text-align: center;
  box-shadow: var(--shadow-brand-lg);
  border: 1px solid rgba(255,255,255,.07);
  position: relative;
  overflow: hidden;
}

.qr-card::after {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 220px; height: 220px;
  background: radial-gradient(circle, rgba(34,197,94,.1) 0%, transparent 70%);
  pointer-events: none;
}

.qr-container {
  background: white;
  border-radius: var(--radius-lg);
  padding: 14px;
  display: inline-block;
  margin: 18px auto;
  box-shadow: 0 4px 16px rgba(0,0,0,.3);
}

.qr-container img { border-radius: var(--radius-sm); display: block; }

.customer-id {
  font-family: 'Courier New', monospace;
  font-size: 1rem;
  font-weight: 700;
  letter-spacing: .18em;
  background: rgba(255,255,255,.12);
  padding: 8px 20px;
  border-radius: var(--radius-full);
  display: inline-block;
  border: 1px solid rgba(255,255,255,.15);
}

/* ── Auth Pages ── */
.auth-page {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 24px 20px;
  background: var(--bg);
  position: relative;
}

/* Gradient blob background */
.auth-page::before {
  content: '';
  position: fixed;
  top: -120px; left: 50%;
  transform: translateX(-50%);
  width: 600px; height: 500px;
  background: radial-gradient(ellipse, rgba(22,101,52,.08) 0%, transparent 70%);
  pointer-events: none;
}

.auth-card {
  width: 100%;
  max-width: 400px;
  background: var(--card);
  border-radius: var(--radius-2xl);
  padding: 36px 28px;
  box-shadow: var(--shadow-xl);
  border: 1px solid var(--border-light);
  position: relative;
  z-index: 1;
}

.auth-logo {
  text-align: center;
  margin-bottom: 28px;
}

.auth-logo .mark {
  width: 68px; height: 68px;
  background: linear-gradient(135deg, var(--brand-light), var(--brand));
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  font-size: 1.8rem;
  font-weight: 800;
  color: white;
  box-shadow: var(--shadow-brand);
}

.auth-logo h1 {
  font-size: 1.35rem;
  font-weight: 800;
  color: var(--text);
  letter-spacing: -.02em;
}

.auth-logo p {
  font-size: .84rem;
  color: var(--text-3);
  margin-top: 5px;
}

.otp-input-group {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin: 20px 0;
}

.otp-digit {
  width: 52px; height: 60px;
  text-align: center;
  font-size: 1.6rem;
  font-weight: 800;
  border: 2px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--bg-alt);
  outline: none;
  transition: border-color .15s, box-shadow .15s, background .15s;
  letter-spacing: -.02em;
}

.otp-digit:focus {
  border-color: var(--brand);
  background: white;
  box-shadow: 0 0 0 4px rgba(22,101,52,.1);
}

/* ── Tables ── */
.table-wrap { overflow-x: auto; }

table { width: 100%; border-collapse: collapse; font-size: .88rem; }

th {
  text-align: left;
  padding: 10px 12px;
  font-size: .73rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .06em;
  color: var(--text-3);
  border-bottom: 2px solid var(--border);
}

td {
  padding: 12px;
  border-bottom: 1px solid var(--border-light);
  vertical-align: middle;
}

tr:last-child td { border-bottom: none; }
tr:hover td { background: var(--bg); }

/* ── Search Bar ── */
.search-bar {
  display: flex;
  align-items: center;
  background: var(--card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: border-color .15s, box-shadow .15s;
}

.search-bar:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(22,101,52,.1);
}

.search-bar svg { margin: 0 12px; color: var(--text-4); flex-shrink: 0; }

.search-bar input {
  flex: 1;
  border: none;
  outline: none;
  padding: 12px 0;
  font-size: .95rem;
  background: transparent;
  color: var(--text);
  font-family: inherit;
}

.search-bar input::placeholder { color: var(--text-4); }

.search-bar button {
  padding: 12px 16px;
  background: var(--brand);
  color: white;
  border: none;
  font-weight: 600;
  font-size: .85rem;
  cursor: pointer;
}

/* ── Charts (simple bar) ── */
.bar-chart { display: flex; align-items: flex-end; gap: 4px; height: 80px; }

.bar-col { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; }

.bar {
  width: 100%;
  background: var(--brand-pale);
  border-radius: 4px 4px 0 0;
  min-height: 4px;
  transition: height .4s var(--ease-out);
  position: relative;
}

.bar:hover { background: var(--brand-bright); }
.bar.accent { background: var(--accent-light); }
.bar.accent:hover { background: var(--accent-warm); }

.bar-label { font-size: .6rem; color: var(--text-4); text-align: center; white-space: nowrap; overflow: hidden; }

/* ── Alert/Toast ── */
.alert {
  padding: 12px 16px;
  border-radius: var(--radius);
  font-size: .88rem;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.alert-error { background: #fef2f2; color: #b91c1c; border: 1px solid #fecaca; }
.alert-success { background: var(--brand-pale); color: var(--brand-dark); border: 1px solid #86efac; }
.alert-warning { background: var(--accent-light); color: #92400e; border: 1px solid #fde68a; }
.alert-info { background: #eff6ff; color: #1d4ed8; border: 1px solid #bfdbfe; }

/* ── Upload Drop Zone ── */
.upload-zone {
  border: 2px dashed var(--border);
  border-radius: var(--radius-xl);
  padding: 44px 20px;
  text-align: center;
  cursor: pointer;
  transition: all .2s;
  background: var(--bg-alt);
  position: relative;
}

.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--brand);
  background: var(--brand-pale);
}

.upload-zone .upload-icon {
  width: 60px; height: 60px;
  background: white;
  border-radius: var(--radius-lg);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: var(--brand);
  box-shadow: var(--shadow);
}

.upload-zone h3 { font-size: 1rem; font-weight: 700; margin-bottom: 6px; letter-spacing: -.01em; }
.upload-zone p { font-size: .83rem; color: var(--text-3); }

/* ── Page Header ── */
.page-header { margin-bottom: 20px; }

.page-header h1 {
  font-size: 1.45rem;
  font-weight: 800;
  letter-spacing: -.03em;
  color: var(--text);
}

.page-header p {
  font-size: .84rem;
  color: var(--text-3);
  margin-top: 4px;
}

/* ── Section ── */
.section { margin-top: 24px; }

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
  padding: 0 2px;
}

.section-title {
  font-size: .69rem;
  font-weight: 700;
  color: var(--text-4);
  text-transform: uppercase;
  letter-spacing: .09em;
}

/* ── Empty State ── */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--text-3);
}

.empty-state .empty-icon {
  width: 68px; height: 68px;
  background: var(--bg-alt);
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  font-size: 1.9rem;
  border: 1px solid var(--border-light);
}

.empty-state h3 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-2);
  margin-bottom: 6px;
  letter-spacing: -.01em;
}

.empty-state p { font-size: .85rem; }

/* ── Divider ── */
.divider { border: none; border-top: 1px solid var(--border); margin: 20px 0; }

/* ── List Item ── */
.list-item {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border-light);
}

.list-item:last-child { border-bottom: none; }

.list-item .item-avatar {
  width: 42px; height: 42px;
  border-radius: 50%;
  background: var(--brand-pale);
  color: var(--brand);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: .95rem;
  flex-shrink: 0;
}

.list-item .item-body { flex: 1; min-width: 0; }
.list-item .item-title { font-weight: 600; font-size: .9rem; letter-spacing: -.01em; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.list-item .item-sub { font-size: .78rem; color: var(--text-3); margin-top: 2px; }
.list-item .item-right { text-align: right; flex-shrink: 0; }
.list-item .item-right .item-val { font-weight: 700; }
.list-item .item-right .item-sub { font-size: .75rem; color: var(--text-3); }

/* ── Tabs ── */
.tabs {
  display: flex;
  gap: 4px;
  background: var(--bg-alt);
  border-radius: var(--radius-lg);
  padding: 4px;
  margin-bottom: 16px;
  border: 1px solid var(--border-light);
}

.tab {
  flex: 1;
  text-align: center;
  padding: 8px;
  border-radius: var(--radius);
  font-size: .8rem;
  font-weight: 600;
  color: var(--text-3);
  cursor: pointer;
  transition: all .15s;
  border: none;
  background: none;
  letter-spacing: -.01em;
}

.tab.active {
  background: white;
  color: var(--brand);
  box-shadow: var(--shadow-sm);
}

/* ── Staff-specific ── */
.scanner-area {
  background: var(--text);
  border-radius: var(--radius-xl);
  aspect-ratio: 1;
  max-width: 320px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}

.scanner-area video { width: 100%; height: 100%; object-fit: cover; }

.scanner-frame {
  position: absolute;
  width: 60%; height: 60%;
  border: 3px solid var(--accent);
  border-radius: 12px;
  pointer-events: none;
}

.scanner-frame::before, .scanner-frame::after {
  content: '';
  position: absolute;
  width: 20px; height: 20px;
}

/* ── KPI Grid ── */
.kpi-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 20px;
}

.kpi-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 16px 18px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.03);
  transition: box-shadow .18s, transform .18s var(--ease-spring);
  text-align: center;
}

.kpi-card:hover { box-shadow: 0 4px 8px rgba(0,0,0,.07), 0 8px 24px rgba(0,0,0,.06); transform: translateY(-1px); }
.kpi-card:active { transform: scale(.97); }
.kpi-grid > a { display: block; height: 100%; }
.kpi-grid > a > .kpi-card { height: 100%; box-sizing: border-box; }

.kpi-card .kpi-label {
  font-size: .67rem;
  color: var(--text-4);
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .09em;
  margin-bottom: 6px;
}

.kpi-card .kpi-val {
  font-size: 1.65rem;
  font-weight: 900;
  color: var(--text);
  letter-spacing: -.03em;
  line-height: 1;
}

.kpi-card .kpi-sub {
  font-size: .72rem;
  color: var(--text-4);
  margin-top: 5px;
  font-weight: 500;
}

.kpi-card.highlight {
  background: linear-gradient(145deg, var(--brand-light), var(--brand));
  border-color: var(--brand);
  box-shadow: 0 6px 24px rgba(22,101,52,.25);
}

.kpi-card.highlight .kpi-label { color: rgba(255,255,255,.6); }
.kpi-card.highlight .kpi-val { color: white; }
.kpi-card.highlight .kpi-sub { color: rgba(255,255,255,.6); }

/* ── Quick Action Cards ── */
.action-card {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-xl);
  padding: 22px 16px 18px;
  text-align: center;
  cursor: pointer;
  transition: all .18s var(--ease-spring);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.03);
}

.action-card:active { transform: scale(.95); box-shadow: none; }

.action-card .action-icon {
  width: 56px; height: 56px;
  border-radius: var(--radius-xl);
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 4px;
}

.action-card .action-label {
  font-weight: 700;
  font-size: .85rem;
  color: var(--text);
  letter-spacing: -.015em;
}

.action-card .action-sub {
  font-size: .7rem;
  color: var(--text-4);
  font-weight: 500;
}

/* ── Animations ── */
@keyframes fadeIn { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: none; } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-12px); } to { opacity: 1; transform: none; } }
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.04); } }
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.fade-in { animation: fadeIn .3s var(--ease-out) both; }
.slide-up { animation: slideUp .4s var(--ease-out) both; }

.card, .stat-card, .kpi-card { animation: fadeIn .35s var(--ease-out) both; }

/* Stagger children */
.fade-children > * { animation: fadeIn .35s var(--ease-out) both; }
.fade-children > *:nth-child(1) { animation-delay: .04s; }
.fade-children > *:nth-child(2) { animation-delay: .08s; }
.fade-children > *:nth-child(3) { animation-delay: .12s; }
.fade-children > *:nth-child(4) { animation-delay: .16s; }
.fade-children > *:nth-child(5) { animation-delay: .20s; }
.fade-children > *:nth-child(6) { animation-delay: .24s; }

/* ── Responsive / Desktop ── */
@media (min-width: 640px) {
  .main { padding: 28px 28px calc(var(--bottom-nav-h) + 16px); }
  .stats-grid { grid-template-columns: repeat(4, 1fr); }
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (min-width: 768px) {
  .bottom-nav { display: none; }

  .app-shell {
    padding-bottom: 0;
    flex-direction: row;
  }

  .topbar { display: none; }

  .sidebar {
    width: 248px;
    flex-shrink: 0;
    background: var(--card);
    border-right: 1px solid var(--border);
    height: 100vh;
    position: sticky;
    top: 0;
    display: flex;
    flex-direction: column;
    padding: 28px 16px;
  }

  .sidebar-logo {
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 700;
    color: var(--brand);
    font-size: 1rem;
    padding: 0 8px 24px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 16px;
    letter-spacing: -.01em;
  }

  .sidebar-logo .mark {
    width: 36px; height: 36px;
    background: linear-gradient(135deg, var(--brand-light), var(--brand));
    border-radius: var(--radius-sm);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-weight: 800;
    font-size: .88rem;
    box-shadow: 0 2px 8px rgba(22,101,52,.3);
  }

  .sidebar nav { flex: 1; }

  .sidebar nav a {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: var(--radius);
    font-size: .88rem;
    font-weight: 500;
    color: var(--text-3);
    margin-bottom: 2px;
    transition: all .15s;
    letter-spacing: -.01em;
  }

  .sidebar nav a:hover { background: var(--bg-alt); color: var(--text); }

  .sidebar nav a.active {
    background: var(--brand-pale);
    color: var(--brand);
    font-weight: 600;
  }

  .sidebar nav a svg { flex-shrink: 0; }
  .sidebar-footer { padding-top: 16px; border-top: 1px solid var(--border); }
  .main { padding: 36px 36px; max-width: none; }
  .rev-chart { height: 180px !important; }
  .kpi-card:hover { transform: translateY(-2px); }
}

/* ── Utilities ── */
.text-center { text-align: center; }
.text-right { text-align: right; }
.mt-4  { margin-top: 4px; }
.mt-8  { margin-top: 8px; }
.mt-12 { margin-top: 12px; }
.mt-16 { margin-top: 16px; }
.mt-20 { margin-top: 20px; }
.mt-24 { margin-top: 24px; }
.mb-4  { margin-bottom: 4px; }
.mb-8  { margin-bottom: 8px; }
.mb-12 { margin-bottom: 12px; }
.mb-16 { margin-bottom: 16px; }
.mb-20 { margin-bottom: 20px; }
.flex { display: flex; }
.flex-col { flex-direction: column; }
.items-center { align-items: center; }
.justify-between { justify-content: space-between; }
.gap-8  { gap: 8px; }
.gap-12 { gap: 12px; }
.gap-16 { gap: 16px; }
.flex-1 { flex: 1; }
.truncate { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.hidden { display: none; }
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0,0,0,0); border: 0; }
.font-mono { font-family: 'Courier New', monospace; }
.bold { font-weight: 700; }
.muted { color: var(--text-3); }
.small { font-size: .82rem; }

/* ── Vertical Stat Card (compact 3-column, value + icon+label row) ── */
.stat-card-v {
  background: var(--card);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 12px 8px 10px;
  text-align: center;
  box-shadow: 0 1px 2px rgba(0,0,0,.04), 0 4px 16px rgba(0,0,0,.03);
  transition: transform .18s var(--ease-spring), box-shadow .18s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 5px;
}
.stat-card-v:active { transform: scale(.95); box-shadow: none; }
.stat-card-v .sv-val {
  font-size: 1.2rem; font-weight: 800; color: var(--text);
  letter-spacing: -.03em; line-height: 1;
}
.stat-card-v .sv-foot {
  display: flex; align-items: center; justify-content: center; gap: 3px;
  font-size: .61rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .05em;
}

/* ── Receipt item hover ── */
.receipt-item { cursor: pointer; }
.receipt-item:active { background: var(--bg-alt); margin: 0 -20px; padding-left: 20px; padding-right: 20px; border-radius: var(--radius); }

/* ── Section title accent bar ── */
.section-header .section-title {
  position: relative;
  padding-left: 10px;
}
.section-header .section-title::before {
  content: '';
  position: absolute;
  left: 0; top: 50%;
  transform: translateY(-50%);
  width: 3px; height: 12px;
  background: linear-gradient(180deg, var(--brand-light), var(--brand));
  border-radius: 2px;
}

/* ── Scroll-reveal animation ── */
@keyframes revealUp {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}
.reveal { animation: revealUp .45s var(--ease-out) both; }
.reveal-1 { animation-delay: .05s; }
.reveal-2 { animation-delay: .12s; }
.reveal-3 { animation-delay: .19s; }
.reveal-4 { animation-delay: .26s; }
.reveal-5 { animation-delay: .33s; }
