/* Blyync design system — deep teal, warm neutral backgrounds, restrained
   bright accent. Hand-written, zero external dependencies (no CDN) so the
   app works fully offline. Logical properties are used where practical so
   RTL (dir="rtl") layouts work without a separate stylesheet. */

:root {
  --teal-900: #0b3a3a;
  --teal-800: #0f4747;
  --teal-700: #156060;
  --teal-600: #1a7a7a;
  --teal-500: #229a94;
  --teal-100: #e3f2ef;
  --teal-50: #f2faf8;

  --accent-600: #d9632a;
  --accent-500: #ef7b45;
  --accent-100: #fde9dc;

  --bg: #faf6f0;
  --surface: #ffffff;
  --surface-sunken: #f4efe6;
  --border: #e6ddcc;
  --text: #1d2b28;
  --text-muted: #5c6a66;
  --text-faint: #8a9793;

  --success: #1f7a4d;
  --success-bg: #e5f5ec;
  --danger: #b23b3b;
  --danger-bg: #fbeaea;
  --warning: #a86a11;
  --warning-bg: #fbf1de;

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(11, 58, 58, 0.06), 0 1px 1px rgba(11, 58, 58, 0.04);
  --shadow-md: 0 4px 16px rgba(11, 58, 58, 0.08), 0 2px 4px rgba(11, 58, 58, 0.06);

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;
  --space-7: 48px;
  --space-8: 64px;

  color-scheme: light;
}

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font-family: "Segoe UI", -apple-system, BlinkMacSystemFont, "Helvetica Neue", Arial, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}
img { max-width: 100%; }
a { color: var(--teal-700); }
h1, h2, h3, h4 { margin: 0 0 var(--space-2); line-height: 1.25; color: var(--teal-900); }
h1 { font-size: 1.75rem; }
h2 { font-size: 1.375rem; }
h3 { font-size: 1.125rem; }
p { margin: 0 0 var(--space-3); }
.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); font-size: 0.85em; }

.container { max-width: 1120px; margin-inline: auto; padding-inline: var(--space-5); }
.container-narrow { max-width: 640px; margin-inline: auto; padding-inline: var(--space-5); }

/* --- Top bar / brand --------------------------------------------------- */
.topbar {
  background: var(--teal-900);
  color: #fff;
  padding-block: var(--space-3);
}
.topbar .container { display: flex; align-items: center; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.brand { display: flex; align-items: center; gap: var(--space-2); font-weight: 700; font-size: 1.25rem; color: #fff; text-decoration: none; }
.brand img { height: 28px; display: block; filter: brightness(0) invert(1); }
.topbar nav { display: flex; gap: var(--space-4); align-items: center; flex-wrap: wrap; }
.topbar nav a { color: rgba(255,255,255,0.85); text-decoration: none; font-size: 0.92rem; }
.topbar nav a:hover { color: #fff; }
.topbar .pill { background: rgba(255,255,255,0.12); padding: 6px 12px; border-radius: 999px; font-size: 0.85rem; }

/* --- Buttons ------------------------------------------------------------ */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 10px 18px; border-radius: var(--radius-md); border: 1px solid transparent;
  font-size: 0.92rem; font-weight: 600; cursor: pointer; text-decoration: none;
  min-height: 40px; transition: background 0.15s, border-color 0.15s, transform 0.05s;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--teal-700); color: #fff; }
.btn-primary:hover { background: var(--teal-800); }
.btn-accent { background: var(--accent-500); color: #fff; }
.btn-accent:hover { background: var(--accent-600); }
.btn-secondary { background: var(--surface); color: var(--teal-800); border-color: var(--border); }
.btn-secondary:hover { background: var(--surface-sunken); }
.btn-ghost { background: transparent; color: var(--teal-700); }
.btn-ghost:hover { background: var(--teal-100); }
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 6px 12px; min-height: 32px; font-size: 0.85rem; }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-block { width: 100%; }

/* --- Cards / surfaces ---------------------------------------------------- */
.card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  padding: var(--space-5); box-shadow: var(--shadow-sm);
}
.card + .card { margin-top: var(--space-4); }
.stat-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); padding: var(--space-4); }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--teal-900); }
.stat-card .stat-label { font-size: 0.82rem; color: var(--text-muted); }
.grid { display: grid; gap: var(--space-4); }
.grid-2 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.grid-3 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }
.grid-4 { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }

/* --- Forms ---------------------------------------------------------------- */
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--teal-900); margin-bottom: 4px; }
input, select, textarea {
  width: 100%; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  font-size: 0.95rem; background: var(--surface); color: var(--text); font-family: inherit;
  min-height: 40px;
}
textarea { min-height: 80px; }
input:focus, select:focus, textarea:focus { outline: 2px solid var(--teal-500); outline-offset: 1px; border-color: var(--teal-500); }
.field { margin-bottom: var(--space-4); }
.field-hint { font-size: 0.78rem; color: var(--text-faint); margin-top: 4px; }
.field-error { font-size: 0.78rem; color: var(--danger); margin-top: 4px; }
.checkbox-row { display: flex; align-items: center; gap: 8px; }
.checkbox-row input { width: auto; min-height: auto; }

/* --- Tabs ------------------------------------------------------------------ */
.tabs { display: flex; gap: var(--space-2); border-bottom: 1px solid var(--border); overflow-x: auto; margin-bottom: var(--space-5); }
.tab {
  padding: 10px 4px; margin-inline-end: var(--space-5); background: none; border: none; cursor: pointer;
  font-size: 0.92rem; font-weight: 600; color: var(--text-muted); border-bottom: 2px solid transparent;
  white-space: nowrap;
}
.tab.active { color: var(--teal-800); border-bottom-color: var(--accent-500); }
.tab:focus-visible { outline: 2px solid var(--teal-500); }

/* --- Badges / pills --------------------------------------------------------- */
.badge { display: inline-flex; align-items: center; padding: 3px 10px; border-radius: 999px; font-size: 0.75rem; font-weight: 600; }
.badge-success { background: var(--success-bg); color: var(--success); }
.badge-danger { background: var(--danger-bg); color: var(--danger); }
.badge-warning { background: var(--warning-bg); color: var(--warning); }
.badge-neutral { background: var(--surface-sunken); color: var(--text-muted); }
.badge-teal { background: var(--teal-100); color: var(--teal-800); }
.badge-accent { background: var(--accent-100); color: var(--accent-600); }

/* --- Tables ------------------------------------------------------------------ */
.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
th, td { text-align: start; padding: 10px 12px; border-bottom: 1px solid var(--border); }
th { color: var(--text-muted); font-weight: 600; font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; }
tbody tr:hover { background: var(--surface-sunken); }

/* --- States ------------------------------------------------------------------- */
.state-box { text-align: center; padding: var(--space-7) var(--space-4); color: var(--text-muted); }
.spinner {
  width: 22px; height: 22px; border: 3px solid var(--teal-100); border-top-color: var(--teal-600);
  border-radius: 50%; animation: spin 0.7s linear infinite; display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
.toast {
  position: fixed; inset-block-end: 20px; inset-inline-end: 20px; z-index: 100;
  background: var(--teal-900); color: #fff; padding: 12px 18px; border-radius: var(--radius-md);
  box-shadow: var(--shadow-md); font-size: 0.9rem; max-width: 360px;
}
.toast.error { background: var(--danger); }
.toast.success { background: var(--success); }

/* --- Layout: app shell with side nav ------------------------------------------- */
.app-shell { display: flex; min-height: calc(100vh - 60px); }
.sidenav {
  width: 220px; flex-shrink: 0; background: var(--teal-900); color: #fff; padding: var(--space-5) 0;
}
.sidenav a {
  display: block; padding: 10px var(--space-5); color: rgba(255,255,255,0.78); text-decoration: none; font-size: 0.9rem;
}
.sidenav a.active { color: #fff; background: rgba(255,255,255,0.08); border-inline-start: 3px solid var(--accent-500); }
.main { flex: 1; padding: var(--space-5); min-width: 0; }

@media (max-width: 760px) {
  .app-shell { flex-direction: column; }
  .sidenav { width: 100%; display: flex; overflow-x: auto; padding: var(--space-2) 0; }
  .sidenav a { padding: 8px 14px; white-space: nowrap; }
  .sidenav a.active { border-inline-start: none; border-bottom: 3px solid var(--accent-500); }
  h1 { font-size: 1.4rem; }
}

/* --- Wallet-specific ------------------------------------------------------------ */
.wallet-hero { background: linear-gradient(135deg, var(--teal-800), var(--teal-600)); color: #fff; border-radius: var(--radius-lg); padding: var(--space-6); }
.wallet-hero .amount { font-size: 2.4rem; font-weight: 700; }
.wallet-hero .label { opacity: 0.85; font-size: 0.85rem; }
.reward-row { display: flex; justify-content: space-between; align-items: center; padding: var(--space-3) 0; border-bottom: 1px solid var(--border); gap: var(--space-3); }
.reward-row:last-child { border-bottom: none; }

/* --- Utility ---------------------------------------------------------------------- */
.flex { display: flex; }
.flex-between { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.flex-col { display: flex; flex-direction: column; }
.gap-2 { gap: var(--space-2); }
.gap-3 { gap: var(--space-3); }
.gap-4 { gap: var(--space-4); }
.mt-2 { margin-top: var(--space-2); }
.mt-4 { margin-top: var(--space-4); }
.mt-6 { margin-top: var(--space-6); }
.mb-4 { margin-bottom: var(--space-4); }
.text-center { text-align: center; }
.w-full { width: 100%; }
[hidden] { display: none !important; }

.stepper { display: flex; gap: var(--space-2); margin-bottom: var(--space-6); flex-wrap: wrap; }
.step { display: flex; align-items: center; gap: 6px; font-size: 0.8rem; color: var(--text-faint); }
.step .dot { width: 22px; height: 22px; border-radius: 50%; background: var(--surface-sunken); color: var(--text-muted); display: flex; align-items: center; justify-content: center; font-size: 0.72rem; font-weight: 700; }
.step.active { color: var(--teal-800); font-weight: 600; }
.step.active .dot { background: var(--teal-700); color: #fff; }
.step.done .dot { background: var(--success); color: #fff; }

footer.site-footer { padding: var(--space-6) 0; color: var(--text-faint); font-size: 0.82rem; text-align: center; }
