/* LetLoyal — design system
   Warm gold + deep navy. Mobile-first. Zero frameworks. */

:root {
  --navy-900: #0b1220;
  --navy-800: #0f172a;
  --navy-700: #1e293b;
  --navy-500: #475569;
  --navy-400: #64748b;
  --navy-300: #94a3b8;
  --navy-200: #cbd5e1;
  --navy-100: #e2e8f0;
  --navy-50:  #f1f5f9;

  --gold-600: #d97706;
  --gold-500: #f59e0b;
  --gold-400: #fbbf24;
  --gold-100: #fef3c7;
  --gold-50:  #fffbeb;

  --green-500: #10b981;
  --green-50:  #d1fae5;
  --red-500:   #ef4444;
  --red-50:    #fee2e2;

  --white: #ffffff;
  --bg:    #f8fafc;

  --radius-sm: 8px;
  --radius:    12px;
  --radius-lg: 18px;

  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow:    0 4px 14px rgba(15,23,42,.08);
  --shadow-lg: 0 12px 32px rgba(15,23,42,.12);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--navy-800);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--gold-600); text-decoration: none; }
a:hover { text-decoration: underline; }

.container { max-width: 1120px; margin: 0 auto; padding: 0 20px; }
.container-sm { max-width: 560px; margin: 0 auto; padding: 0 20px; }

/* ----- Header ----- */
.site-header {
  background: var(--white);
  border-bottom: 1px solid var(--navy-100);
  position: sticky; top: 0; z-index: 40;
}
.site-header .container {
  display: flex; justify-content: space-between; align-items: center;
  padding: 14px 20px;
}
.brand {
  display: flex; align-items: center; gap: 10px;
  font-weight: 700; font-size: 18px; color: var(--navy-800);
}
.brand-logo {
  width: 32px; height: 32px; border-radius: 8px;
  background: linear-gradient(135deg, var(--gold-500), var(--gold-600));
  display: grid; place-items: center;
  color: white; font-weight: 800; font-size: 16px;
  box-shadow: var(--shadow-sm);
}
.nav { display: flex; gap: 22px; align-items: center; }
.nav a { color: var(--navy-500); font-size: 14px; font-weight: 500; }
.nav a:hover { color: var(--navy-800); text-decoration: none; }

/* ----- Hero ----- */
.hero {
  padding: 72px 0 56px;
  background:
    radial-gradient(1200px 500px at 80% -10%, rgba(245,158,11,.12), transparent 60%),
    radial-gradient(800px 400px at 0% 100%, rgba(15,23,42,.04), transparent 60%),
    var(--bg);
}
.hero h1 {
  font-size: clamp(32px, 5vw, 52px);
  line-height: 1.1; margin: 0 0 16px;
  letter-spacing: -0.02em; color: var(--navy-900);
}
.hero h1 .accent { color: var(--gold-600); }
.hero p.lead {
  font-size: 18px; color: var(--navy-500);
  max-width: 640px; margin: 0 0 28px;
}
.hero-ctas { display: flex; gap: 12px; flex-wrap: wrap; }

/* ----- Buttons ----- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 12px 20px; border-radius: var(--radius);
  font-weight: 600; font-size: 15px; border: 1px solid transparent;
  cursor: pointer; transition: transform .08s ease, box-shadow .15s ease, background .15s;
  font-family: inherit;
}
.btn:hover { text-decoration: none; }
.btn:active { transform: translateY(1px); }

.btn-primary {
  background: var(--navy-800); color: var(--white);
}
.btn-primary:hover { background: var(--navy-900); box-shadow: var(--shadow); }

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

.btn-ghost {
  background: transparent; color: var(--navy-800); border-color: var(--navy-200);
}
.btn-ghost:hover { background: var(--navy-50); }

.btn-danger {
  background: var(--red-50); color: var(--red-500); border-color: var(--red-50);
}
.btn-danger:hover { background: #fecaca; }

.btn-sm { padding: 8px 14px; font-size: 13px; }
.btn-block { width: 100%; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

/* ----- Cards ----- */
.card {
  background: var(--white); border: 1px solid var(--navy-100);
  border-radius: var(--radius-lg); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.card h2 { margin: 0 0 4px; font-size: 20px; letter-spacing: -0.01em; }
.card h3 { margin: 0 0 12px; font-size: 16px; font-weight: 600; }
.card p.muted { color: var(--navy-400); margin: 0; font-size: 14px; }

.grid { display: grid; gap: 20px; }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }

/* ----- Forms ----- */
label { display: block; font-size: 13px; font-weight: 500; margin-bottom: 6px; color: var(--navy-700); }
.input, select, textarea {
  width: 100%; padding: 11px 14px;
  border: 1px solid var(--navy-200); border-radius: var(--radius);
  font-size: 15px; font-family: inherit; background: var(--white);
  color: var(--navy-800); transition: border-color .15s, box-shadow .15s;
}
.input:focus, select:focus, textarea:focus {
  outline: none; border-color: var(--gold-500);
  box-shadow: 0 0 0 3px rgba(245,158,11,.15);
}
.field { margin-bottom: 16px; }
.field-row { display: flex; gap: 12px; }
.field-row > * { flex: 1; }

/* role toggle */
.role-toggle {
  display: flex; border: 1px solid var(--navy-200);
  border-radius: var(--radius); overflow: hidden; margin-bottom: 16px;
}
.role-toggle label {
  flex: 1; margin: 0; text-align: center; padding: 11px;
  cursor: pointer; font-weight: 600; color: var(--navy-500);
  transition: background .15s, color .15s;
}
.role-toggle input { display: none; }
.role-toggle input:checked + span {
  background: var(--navy-800); color: white; display: block;
  margin: -11px; padding: 11px;
}

/* ----- Coin pill + stats ----- */
.coin-pill {
  display: inline-flex; align-items: center; gap: 6px;
  background: var(--gold-50); color: var(--gold-600);
  padding: 4px 10px; border-radius: 999px;
  font-weight: 700; font-size: 13px;
}
.coin-icon {
  width: 14px; height: 14px; border-radius: 50%;
  background: linear-gradient(135deg, var(--gold-400), var(--gold-600));
  display: inline-block;
}

.stat {
  background: var(--white); border: 1px solid var(--navy-100);
  border-radius: var(--radius); padding: 18px;
}
.stat-label { font-size: 12px; color: var(--navy-400); font-weight: 600; text-transform: uppercase; letter-spacing: .04em; }
.stat-value { font-size: 28px; font-weight: 700; color: var(--navy-900); margin-top: 4px; letter-spacing: -0.01em; }

/* ----- Table ----- */
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th, .table td { padding: 12px 14px; text-align: left; border-bottom: 1px solid var(--navy-100); }
.table th { font-weight: 600; color: var(--navy-500); font-size: 12px; text-transform: uppercase; letter-spacing: .04em; }
.table tr:last-child td { border-bottom: none; }
.table td.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; font-size: 13px; }
.badge { display: inline-block; padding: 3px 8px; border-radius: 999px; font-size: 12px; font-weight: 600; }
.badge-earn { background: var(--green-50); color: var(--green-500); }
.badge-redeem { background: var(--gold-50); color: var(--gold-600); }

/* ----- Tabs ----- */
.tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--navy-100); margin-bottom: 24px; }
.tab {
  padding: 10px 18px; cursor: pointer; border: none; background: transparent;
  font-size: 14px; font-weight: 600; color: var(--navy-400); font-family: inherit;
  border-bottom: 2px solid transparent; margin-bottom: -1px;
}
.tab.active { color: var(--navy-800); border-bottom-color: var(--gold-500); }

/* ----- Features (landing) ----- */
.features { padding: 56px 0; }
.feature h3 { font-size: 17px; margin: 12px 0 8px; }
.feature p  { color: var(--navy-500); margin: 0; font-size: 14px; }
.feature-icon {
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--gold-50); color: var(--gold-600);
  display: grid; place-items: center; font-size: 22px;
}

/* ----- How it works ----- */
.how { padding: 56px 0; background: var(--white); border-top: 1px solid var(--navy-100); border-bottom: 1px solid var(--navy-100); }
.how-step { text-align: center; padding: 12px; }
.step-num {
  width: 40px; height: 40px; border-radius: 50%;
  background: var(--navy-800); color: var(--gold-500);
  display: grid; place-items: center; font-weight: 700; margin: 0 auto 12px;
}

/* ----- Footer ----- */
.footer {
  padding: 32px 0; text-align: center;
  color: var(--navy-400); font-size: 13px;
  border-top: 1px solid var(--navy-100); background: var(--white);
}
.footer a { color: var(--navy-500); margin: 0 10px; }

/* ----- Cookie banner ----- */
.cookie-banner {
  position: fixed; bottom: 16px; left: 16px; right: 16px;
  max-width: 680px; margin: 0 auto;
  background: var(--navy-800); color: white;
  padding: 16px 20px; border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  display: none; gap: 16px; align-items: center; flex-wrap: wrap;
  z-index: 1000;
}
.cookie-banner.show { display: flex; }
.cookie-banner p { margin: 0; font-size: 13px; flex: 1 1 300px; color: var(--navy-200); }
.cookie-banner .btn-ghost { border-color: var(--navy-700); color: white; background: transparent; }
.cookie-banner .btn-ghost:hover { background: var(--navy-700); }

.cookie-settings { display: none; flex-direction: column; gap: 8px; width: 100%; margin-top: 8px; padding-top: 12px; border-top: 1px solid var(--navy-700); }
.cookie-banner.expanded .cookie-settings { display: flex; }
.cookie-row { display: flex; justify-content: space-between; align-items: center; font-size: 13px; }
.cookie-row span.desc { color: var(--navy-300); font-size: 12px; }
.switch {
  position: relative; width: 38px; height: 22px; display: inline-block;
}
.switch input { display: none; }
.switch .track {
  position: absolute; inset: 0; background: var(--navy-500);
  border-radius: 22px; transition: background .15s;
}
.switch .track::after {
  content: ''; position: absolute; top: 3px; left: 3px;
  width: 16px; height: 16px; background: white; border-radius: 50%;
  transition: transform .15s;
}
.switch input:checked + .track { background: var(--gold-500); }
.switch input:checked + .track::after { transform: translateX(16px); }
.switch input:disabled + .track { opacity: .6; }

/* ----- Toast / alerts ----- */
.alert { padding: 12px 16px; border-radius: var(--radius); font-size: 14px; margin-bottom: 16px; }
.alert-success { background: var(--green-50); color: #065f46; }
.alert-error   { background: var(--red-50); color: #991b1b; }
.alert-info    { background: var(--navy-50); color: var(--navy-700); }

.toast-container {
  position: fixed; bottom: 20px; right: 20px; z-index: 2000;
  display: flex; flex-direction: column; gap: 8px;
}
.toast {
  background: var(--navy-800); color: white;
  padding: 12px 18px; border-radius: var(--radius);
  box-shadow: var(--shadow-lg); font-size: 14px;
  animation: slide-in .2s ease;
}
.toast.success { background: var(--green-500); }
.toast.error   { background: var(--red-500); }
@keyframes slide-in { from { transform: translateX(20px); opacity: 0 } to { transform: none; opacity: 1 } }

/* ----- Utility ----- */
.flex { display: flex; }
.flex-between { display: flex; justify-content: space-between; align-items: center; }
.gap-8 { gap: 8px; } .gap-12 { gap: 12px; } .gap-16 { gap: 16px; }
.mt-8 { margin-top: 8px; } .mt-16 { margin-top: 16px; } .mt-24 { margin-top: 24px; } .mt-32 { margin-top: 32px; }
.mb-8 { margin-bottom: 8px; } .mb-16 { margin-bottom: 16px; } .mb-24 { margin-bottom: 24px; }
.muted { color: var(--navy-400); }
.center { text-align: center; }
.hidden { display: none !important; }
.small { font-size: 13px; }
.mono { font-family: ui-monospace, SFMono-Regular, Consolas, monospace; }

/* ----- Page wrapper ----- */
.page { padding: 32px 0 80px; }
.page-title { font-size: 28px; margin: 0 0 6px; letter-spacing: -0.01em; }
.page-sub   { color: var(--navy-500); margin: 0 0 28px; font-size: 15px; }

/* QR-specific */
.qr-card { text-align: center; }
.qr-card img { width: 100%; max-width: 320px; height: auto; border-radius: var(--radius); }
.scan-preview {
  width: 100%; max-width: 400px; aspect-ratio: 1;
  background: var(--navy-100); border-radius: var(--radius);
  display: grid; place-items: center; color: var(--navy-400);
  font-size: 14px; margin: 0 auto;
}
#reader { width: 100%; max-width: 400px; margin: 0 auto; border-radius: var(--radius); overflow: hidden; }
#reader__scan_region { background: var(--navy-800) !important; }

/* Responsive */
@media (max-width: 640px) {
  .hero { padding: 48px 0 32px; }
  .page { padding: 24px 0 60px; }
  .page-title { font-size: 22px; }
  .card { padding: 18px; }
  .field-row { flex-direction: column; }
  .site-header .container { padding: 12px 16px; }
  .nav { gap: 14px; }
  .nav a { font-size: 13px; }
}
