/* ══════════════════════════════════════════════════════════════
   ATHLON — Calorie Bank
   Design System: ui-ux-pro-max / Sports+Fitness / Fintech Dark
   Fonts: Barlow Condensed (headings) + Barlow (body)
   Palette: Deep Navy + Electric Green + Gold
   Mobile-first PWA | Dark default | 48px+ touch targets
   ══════════════════════════════════════════════════════════════ */

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

/* ── Design Tokens ─────────────────────────────────────────── */
:root {
  /* Core palette — fintech dark */
  --bg:           #0A0F1C;
  --bg-2:         #0D1428;
  --surface:      #111827;
  --surface-2:    #1A2235;
  --surface-3:    #243048;

  /* Brand accents */
  --accent:       #00FF87;
  --accent-dim:   rgba(0, 255, 135, 0.12);
  --accent-glow:  0 0 40px rgba(0, 255, 135, 0.3);
  --gold:         #F59E0B;
  --gold-dim:     rgba(245, 158, 11, 0.12);
  --gold-glow:    0 0 32px rgba(245, 158, 11, 0.25);

  /* Text */
  --text:         #F8FAFC;
  --text-2:       #94A3B8;
  --text-3:       #4B5A72;

  /* Status */
  --danger:       #FF4757;
  --danger-dim:   rgba(255, 71, 87, 0.12);
  --info:         #60A5FA;

  /* Borders & shadows */
  --border:       rgba(255, 255, 255, 0.07);
  --border-strong:rgba(255, 255, 255, 0.14);
  --shadow-sm:    0 2px 12px rgba(0, 0, 0, 0.35);
  --shadow:       0 8px 40px rgba(0, 0, 0, 0.5);
  --shadow-lg:    0 24px 80px rgba(0, 0, 0, 0.65);

  /* Radii */
  --radius-xs:  8px;
  --radius-sm:  12px;
  --radius:     18px;
  --radius-lg:  24px;
  --radius-xl:  32px;

  /* Typography */
  --font-heading: 'Barlow Condensed', sans-serif;
  --font-body:    'Barlow', sans-serif;

  /* Layout */
  --header-h:   64px;
  --nav-h:      80px;
  --safe-top:   env(safe-area-inset-top, 0px);
  --safe-bottom:env(safe-area-inset-bottom, 0px);

  /* Motion (200-300ms per skill) */
  --ease:       cubic-bezier(0.4, 0, 0.2, 1);
  --transition: all 0.25s var(--ease);
  --transition-fast: all 0.15s var(--ease);

  /* Spacing scale — generous mobile spacing */
  --space-xs:   8px;
  --space-sm:   12px;
  --space-md:   20px;
  --space-lg:   32px;
  --space-xl:   48px;
  --space-2xl:  64px;

  /* Touch targets — min 48px per UX guidelines */
  --touch-min:  48px;
}

/* Light mode overrides */
[data-theme="light"] {
  --bg:           #F0F4FF;
  --bg-2:         #E4EAFB;
  --surface:      #FFFFFF;
  --surface-2:    #F5F8FF;
  --surface-3:    #EBF0FC;
  --text:         #0A0F1C;
  --text-2:       #475569;
  --text-3:       #94A3B8;
  --border:       rgba(0, 0, 0, 0.08);
  --border-strong:rgba(0, 0, 0, 0.14);
  --shadow-sm:    0 2px 12px rgba(0, 0, 0, 0.07);
  --shadow:       0 8px 40px rgba(0, 0, 0, 0.1);
  --shadow-lg:    0 24px 80px rgba(0, 0, 0, 0.14);
}

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

html {
  font-size: 16px;
  -webkit-text-size-adjust: 100%;
  scroll-behavior: smooth;
  height: 100%;
}

body {
  font-family: var(--font-body);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  min-height: 100dvh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  line-height: 1.6;
}

h1, h2, h3, h4, h5 {
  font-family: var(--font-heading);
  font-weight: 700;
  letter-spacing: 0.01em;
  line-height: 1.15;
}

button {
  border: none;
  outline: none;
  background: none;
  cursor: pointer;
  font-family: var(--font-body);
  transition: var(--transition);
  -webkit-tap-highlight-color: transparent;
}

input, textarea, select {
  font-family: var(--font-body);
  outline: none;
  border: none;
}

img { max-width: 100%; height: auto; display: block; }
a { color: var(--accent); text-decoration: none; }

/* ── Utilities ──────────────────────────────────────────────── */
.hidden { display: none !important; }
.flex-1 { flex: 1; }
.text-accent  { color: var(--accent); }
.text-danger  { color: var(--danger); }
.text-gold    { color: var(--gold); }
.text-muted   { color: var(--text-2); }
.fw-bold      { font-weight: 700; }
.fw-heading   { font-family: var(--font-heading); }

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; transition-duration: 0.01ms !important; }
}

/* ── Screen System ──────────────────────────────────────────── */
.screen {
  position: fixed;
  inset: 0;
  z-index: 50;
  background: var(--bg);
  overflow-y: auto;
  overscroll-behavior: contain;
}

/* ── Icon Sizes ─────────────────────────────────────────────── */
.icon-xs { width: 14px; height: 14px; stroke-width: 2.5; flex-shrink: 0; }
.icon-sm { width: 20px; height: 20px; stroke-width: 2;   flex-shrink: 0; }
.icon-md { width: 24px; height: 24px; stroke-width: 2;   flex-shrink: 0; }
.icon-lg { width: 32px; height: 32px; stroke-width: 1.75;flex-shrink: 0; }
.icon-xl { width: 44px; height: 44px; stroke-width: 1.5; flex-shrink: 0; }

/* ══════════════════════════════════════════════════════════════
   BUTTONS — Large, bold, energetic (48px min touch target)
   ══════════════════════════════════════════════════════════════ */

.btn-primary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--touch-min);
  padding: 14px 28px;
  background: var(--accent);
  color: #0A0F1C;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 17px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  border-radius: var(--radius);
  cursor: pointer;
  transition: var(--transition);
}
.btn-primary:hover {
  filter: brightness(1.1);
  box-shadow: var(--accent-glow);
  transform: translateY(-2px);
}
.btn-primary:active  { transform: translateY(0); filter: brightness(0.95); }
.btn-primary:disabled { opacity: 0.45; cursor: not-allowed; transform: none; box-shadow: none; }

.btn-secondary {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  min-height: var(--touch-min);
  padding: 14px 28px;
  background: var(--surface-2);
  color: var(--text);
  font-family: var(--font-heading);
  font-weight: 600;
  font-size: 16px;
  letter-spacing: 0.03em;
  border-radius: var(--radius);
  border: 1px solid var(--border-strong);
  cursor: pointer;
  transition: var(--transition);
}
.btn-secondary:hover { background: var(--surface-3); border-color: var(--accent); }
.btn-secondary:active { transform: scale(0.99); }

.btn-ghost {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 44px;
  padding: 10px 18px;
  background: transparent;
  color: var(--text-2);
  font-size: 15px;
  font-weight: 500;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: var(--transition);
}
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-danger { color: var(--danger) !important; }
.btn-danger:hover { background: var(--danger-dim) !important; }

.btn-sm {
  min-height: 40px !important;
  padding: 8px 18px !important;
  font-size: 14px !important;
}
.btn-full { width: 100%; }

.icon-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: var(--touch-min);
  height: var(--touch-min);
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-2);
  cursor: pointer;
  transition: var(--transition);
  flex-shrink: 0;
}
.icon-btn:hover { background: var(--surface-3); color: var(--text); }

/* ══════════════════════════════════════════════════════════════
   LOADING SCREEN
   ══════════════════════════════════════════════════════════════ */
.loading-screen {
  position: fixed;
  inset: 0;
  z-index: 1000;
  background: var(--bg);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 32px;
  transition: opacity 0.4s ease;
}

.loading-logo {
  font-family: var(--font-heading);
  font-size: clamp(48px, 12vw, 72px);
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
}
.loading-logo span { color: var(--accent); }

.loading-bar-wrap {
  width: min(240px, 60vw);
  height: 3px;
  background: var(--surface-2);
  border-radius: 99px;
  overflow: hidden;
}
.loading-bar {
  height: 100%;
  background: var(--accent);
  border-radius: 99px;
  animation: loadbar 1.2s var(--ease) forwards;
}
@keyframes loadbar {
  from { width: 0; }
  to   { width: 100%; }
}

.loading-tagline {
  font-size: 14px;
  color: var(--text-3);
  letter-spacing: 0.1em;
  text-transform: uppercase;
}

/* ══════════════════════════════════════════════════════════════
   APP HEADER
   ══════════════════════════════════════════════════════════════ */
.app-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 90;
  box-sizing: content-box;
  height: var(--header-h);
  padding-top: var(--safe-top);
  background: rgba(10, 15, 28, 0.85);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  padding-inline: 20px;
  gap: 16px;
}

.app-logo {
  font-family: var(--font-heading);
  font-size: 28px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--text);
  flex: 1;
}
.app-logo span { color: var(--accent); }

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

/* ══════════════════════════════════════════════════════════════
   BOTTOM NAVIGATION — 80px, min 48px touch targets
   ══════════════════════════════════════════════════════════════ */
.bottom-nav {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  z-index: 90;
  box-sizing: content-box;
  height: var(--nav-h);
  padding-bottom: var(--safe-bottom);
  background: rgba(10, 15, 28, 0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: stretch;
  padding-top: 8px;
}

.nav-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: var(--touch-min);
  color: var(--text-3);
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  cursor: pointer;
  transition: var(--transition);
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  position: relative;
}
.nav-item:hover { color: var(--text-2); }
.nav-item.active { color: var(--accent); }
.nav-item.active::before {
  content: '';
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 32px;
  height: 2px;
  background: var(--accent);
  border-radius: 0 0 4px 4px;
}

/* ══════════════════════════════════════════════════════════════
   MAIN APP CONTENT AREA
   ══════════════════════════════════════════════════════════════ */
#main-app {
  padding-top: var(--header-h);
  padding-bottom: var(--nav-h);
  min-height: 100dvh;
}
#main-app::before { content: ""; display: block; height: var(--safe-top); }
#main-app::after { content: ""; display: block; height: var(--safe-bottom);
}

#tab-content {
  transition: opacity 0.2s ease, transform 0.2s ease;
  min-height: calc(100dvh - var(--header-h) - var(--nav-h));
}

/* ══════════════════════════════════════════════════════════════
   MODAL OVERLAY
   ══════════════════════════════════════════════════════════════ */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 800;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  animation: overlay-in 0.2s ease;
}
@keyframes overlay-in {
  from { opacity: 0; }
  to   { opacity: 1; }
}

.modal-sheet {
  width: 100%;
  max-width: 500px;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 28px 24px;
  padding-bottom: calc(28px + var(--safe-bottom));
  box-shadow: var(--shadow-lg);
  animation: sheet-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 85dvh;
  overflow-y: auto;
}
@keyframes sheet-up {
  from { transform: translateY(100%); }
  to   { transform: translateY(0); }
}

.modal-handle {
  width: 40px;
  height: 4px;
  border-radius: 2px;
  background: var(--surface-3);
  margin: 0 auto 24px;
}

.modal-title {
  font-family: var(--font-heading);
  font-size: 26px;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin-bottom: 8px;
}
.modal-form  { display: flex; flex-direction: column; gap: 16px; margin-top: 12px; }
.modal-actions { display: flex; flex-direction: column; gap: 12px; margin-top: 16px; }

/* ══════════════════════════════════════════════════════════════
   TOAST NOTIFICATIONS
   ══════════════════════════════════════════════════════════════ */
.toast-container {
  position: fixed;
  top: calc(var(--header-h) + 12px);
  left: 16px;
  right: 16px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 10px;
  pointer-events: none;
}

.toast {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--surface-2);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  font-size: 15px;
  font-weight: 500;
  animation: toast-in 0.3s var(--ease);
  pointer-events: all;
}
.toast.success { border-color: var(--accent); }
.toast.error   { border-color: var(--danger); }
.toast.warning { border-color: var(--gold); }
.toast.info    { border-color: var(--info); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(-12px) scale(0.96); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ══════════════════════════════════════════════════════════════
   SHARED PAGE LAYOUT
   ══════════════════════════════════════════════════════════════ */
.log-page, .earn-page, .history-page, .profile-page {
  padding: var(--space-lg) 20px;
  padding-bottom: 40px;
  display: flex;
  flex-direction: column;
  gap: var(--space-lg);
}

.page-header { margin-bottom: 4px; }
.page-title {
  font-family: var(--font-heading);
  font-size: clamp(32px, 8vw, 42px);
  font-weight: 800;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  line-height: 1.05;
}
.page-subtitle {
  font-size: 15px;
  color: var(--text-2);
  margin-top: 6px;
  font-weight: 400;
}
.page-header-row {
  display: flex;
  align-items: center;
  gap: 16px;
}
.page-header-row .page-title { font-size: clamp(26px, 6vw, 34px); }

/* ══════════════════════════════════════════════════════════════
   HOME PAGE
   ══════════════════════════════════════════════════════════════ */
.home-page {
  padding: var(--space-lg) 20px 40px;
  display: flex;
  flex-direction: column;
  gap: var(--space-xl);
}

/* Balance Hero Card */
.balance-hero {
  background: linear-gradient(145deg, var(--surface) 0%, var(--surface-2) 100%);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg);
  border: 1px solid var(--border-strong);
  box-shadow: var(--shadow);
  position: relative;
  overflow: hidden;
}
.balance-hero::before {
  content: '';
  position: absolute;
  top: -60px; right: -60px;
  width: 200px; height: 200px;
  background: radial-gradient(circle, rgba(0,255,135,0.07) 0%, transparent 70%);
  pointer-events: none;
}

.balance-label {
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--text-3);
  margin-bottom: 12px;
}
.balance-amount {
  font-family: var(--font-heading);
  font-size: clamp(52px, 16vw, 80px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
}
.balance-amount.positive { color: var(--accent); }
.balance-amount.negative { color: var(--danger); }
.balance-currency { font-size: 0.45em; vertical-align: super; opacity: 0.7; }
.balance-kcal {
  font-size: 14px;
  color: var(--text-3);
  margin-top: 8px;
  font-weight: 500;
}

.balance-progress-wrap {
  margin-top: var(--space-md);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.balance-progress-bar {
  width: 100%;
  height: 6px;
  background: var(--surface-3);
  border-radius: 99px;
  overflow: hidden;
}
.balance-progress-fill {
  height: 100%;
  border-radius: 99px;
  background: var(--accent);
  transition: width 0.6s var(--ease);
}
.balance-progress-fill.danger { background: var(--danger); }

.balance-stats-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 12px;
  margin-top: var(--space-md);
  padding-top: var(--space-md);
  border-top: 1px solid var(--border);
}
.balance-stat { text-align: center; }
.bs-value {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  display: block;
}
.bs-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 2px;
}

/* Section Header */
.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.section-title {
  font-family: var(--font-heading);
  font-size: 22px;
  font-weight: 700;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

/* Item Cards */
.item-icon-wrap {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-2);
  flex-shrink: 0;
}
.item-icon-wrap.workout {
  background: var(--gold-dim);
  color: var(--gold);
}

.item-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
  background: var(--surface);
  border-radius: var(--radius);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
}
.item-card:hover { border-color: var(--border-strong); background: var(--surface-2); }
.item-body { flex: 1; min-width: 0; }
.item-name {
  font-size: 15px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.item-meta {
  font-size: 13px;
  color: var(--text-3);
  margin-top: 3px;
}
.item-amount {
  font-family: var(--font-heading);
  font-size: 18px;
  font-weight: 700;
  white-space: nowrap;
  flex-shrink: 0;
}
.item-amount.negative { color: var(--danger); }
.item-amount.earned   { color: var(--gold); }
.item-amount.positive { color: var(--accent); }

/* Today sections */
.today-section { display: flex; flex-direction: column; gap: 10px; }
.today-items   { display: flex; flex-direction: column; gap: 8px; }

/* Carryover banner */
.carryover-banner {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px 18px;
  border-radius: var(--radius);
  background: var(--danger-dim);
  border: 1px solid rgba(255,71,87,0.25);
}
.carryover-icon { color: var(--danger); flex-shrink: 0; }
.carryover-text { font-size: 14px; color: var(--text-2); line-height: 1.5; }
.carryover-text strong { color: var(--danger); font-weight: 700; }

/* Empty state */
.empty-state {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 16px;
  padding: var(--space-2xl) var(--space-lg);
  text-align: center;
  min-height: 240px;
}
.empty-icon { color: var(--text-3); }
.empty-title {
  font-family: var(--font-heading);
  font-size: 24px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}
.empty-desc { font-size: 15px; color: var(--text-2); max-width: 260px; line-height: 1.6; }

/* Skeleton */
.skeleton {
  background: linear-gradient(90deg, var(--surface) 25%, var(--surface-2) 50%, var(--surface) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.6s ease-in-out infinite;
  border-radius: var(--radius);
}
.skeleton-card {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 16px;
}
.skeleton-avatar {
  width: 44px; height: 44px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  background: var(--surface-2);
  animation: shimmer 1.6s ease-in-out infinite;
}
.skeleton-lines { flex: 1; display: flex; flex-direction: column; gap: 8px; }
.skeleton-line { height: 14px; border-radius: 6px; }
.skeleton-line.medium { width: 60%; }
.skeleton-line.short  { width: 35%; }
@keyframes shimmer {
  from { background-position: 200% 0; }
  to   { background-position: -200% 0; }
}

/* ══════════════════════════════════════════════════════════════
   INPUTS & FORMS
   ══════════════════════════════════════════════════════════════ */
.input, .textarea, .select {
  width: 100%;
  min-height: var(--touch-min);
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 14px 18px;
  color: var(--text);
  font-size: 16px;
  font-family: var(--font-body);
  transition: var(--transition);
  border: 1.5px solid var(--border);
  display: block;
}
.input:focus, .textarea:focus, .select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-dim);
}
.input::placeholder, .textarea::placeholder { color: var(--text-3); }
.textarea { resize: none; min-height: 100px; }
.select   { appearance: none; -webkit-appearance: none; cursor: pointer; }

.input-group { position: relative; display: flex; align-items: center; }
.input-group .input-icon { position: absolute; left: 16px; color: var(--text-3); pointer-events: none; }
.input-icon-left { padding-left: 48px; }
.input-unit { position: absolute; right: 16px; font-size: 13px; color: var(--text-3); pointer-events: none; }
.input-row { display: flex; gap: 12px; }

/* ══════════════════════════════════════════════════════════════
   LOG PAGE
   ══════════════════════════════════════════════════════════════ */
.mode-tabs {
  display: flex;
  gap: 6px;
  background: var(--surface);
  border-radius: var(--radius);
  padding: 6px;
  border: 1px solid var(--border);
}
.mode-tab {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  border-radius: var(--radius-sm);
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-3);
  cursor: pointer;
  transition: var(--transition);
}
.mode-tab.active { background: var(--surface-2); color: var(--text); }
.log-mode { display: flex; flex-direction: column; gap: var(--space-md); }
.log-mode.hidden { display: none; }

/* Image upload */
.image-upload-area {
  background: var(--surface);
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 12px;
}
.image-upload-area:hover { border-color: var(--accent); background: var(--accent-dim); }
.image-upload-area.compact { padding: var(--space-md); flex-direction: row; justify-content: center; }
.upload-icon { color: var(--text-3); }
.upload-text { font-size: 16px; color: var(--text-2); font-weight: 500; }
.upload-sub  { font-size: 13px; color: var(--text-3); }
.meal-image-preview, .proof-image-preview {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  border-radius: var(--radius);
}

/* Ingredient Grid */
.ingredient-instructions {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 14px;
  color: var(--text-3);
  padding: 14px 18px;
  background: var(--surface);
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
}
.ingredient-grid { display: flex; flex-direction: column; gap: var(--space-lg); }
.category-label {
  font-family: var(--font-heading);
  font-size: 13px;
  font-weight: 700;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.1em;
  margin-bottom: 12px;
}
.ingredient-chips { display: flex; flex-wrap: wrap; gap: 10px; position: relative; }
.ingredient-chip {
  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 10px 18px;
  border-radius: 99px;
  font-size: 14px;
  font-weight: 500;
  background: var(--surface);
  color: var(--text-2);
  border: 1.5px solid var(--border);
  cursor: pointer;
  transition: var(--transition);
  user-select: none;
  min-height: 44px;
}
.ingredient-chip:hover { border-color: var(--border-strong); color: var(--text); }
.ingredient-chip.selected {
  background: var(--accent-dim);
  border-color: var(--accent);
  color: var(--accent);
}
.chip-name  { font-weight: 600; }
.chip-amount { font-size: 12px; opacity: 0.75; }

/* Amount Editor */
.amount-editor-popup {
  position: absolute;
  top: calc(100% + 8px);
  left: 0;
  z-index: 200;
  background: var(--surface-2);
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 20px;
  min-width: 260px;
  box-shadow: var(--shadow);
}
.amount-editor-name { font-weight: 700; font-size: 15px; margin-bottom: 16px; }
.amount-slider-wrap { display: flex; align-items: center; gap: 14px; margin-bottom: 12px; }
.amount-slider { flex: 1; accent-color: var(--accent); height: 4px; cursor: pointer; }
.amount-display { font-family: var(--font-heading); font-weight: 700; font-size: 18px; white-space: nowrap; }
.amount-presets { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 14px; }
.preset-btn {
  padding: 6px 14px;
  border-radius: 99px;
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--text-2);
  cursor: pointer;
  min-height: 36px;
  transition: var(--transition);
}
.preset-btn:hover { background: var(--accent-dim); color: var(--accent); }
.amount-editor-actions { display: flex; gap: 10px; }

/* Confirm Screen */
.confirm-summary-card {
  background: var(--surface);
  border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg);
  text-align: center;
  border: 1px solid var(--border);
}
.confirm-meal-name { font-size: 15px; color: var(--text-2); margin-bottom: 12px; text-transform: uppercase; letter-spacing: 0.06em; }
.confirm-calories {
  font-family: var(--font-heading);
  font-size: clamp(64px, 18vw, 96px);
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.01em;
}
.confirm-kcal-label { font-size: 14px; color: var(--text-3); margin-top: 8px; text-transform: uppercase; letter-spacing: 0.1em; }
.confirm-macros { display: flex; justify-content: center; gap: 16px; margin-top: 20px; flex-wrap: wrap; }
.macro-pill {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 16px; border-radius: 99px;
  background: var(--surface-2);
  font-size: 14px; font-weight: 600; min-height: 40px;
}
.macro-pill span {
  width: 22px; height: 22px; border-radius: 50%;
  background: var(--accent-dim); color: var(--accent);
  display: flex; align-items: center; justify-content: center;
  font-size: 11px; font-weight: 800;
}

.ai-verdict-banner {
  display: flex; gap: 14px; align-items: flex-start;
  padding: 16px 20px; background: var(--surface);
  border-radius: var(--radius); border-left: 3px solid var(--accent);
}
.verdict-title { font-size: 13px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 6px; }
.verdict-text { font-size: 14px; color: var(--text-2); line-height: 1.6; }
.verdict-warning { font-size: 13px; color: var(--gold); margin-top: 8px; }

.confirm-ingredient-list { background: var(--surface); border-radius: var(--radius); overflow: hidden; border: 1px solid var(--border); }
.confirm-ingredient-row {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 18px; border-bottom: 1px solid var(--border);
}
.confirm-ingredient-row:last-child { border-bottom: none; }
.ci-name { flex: 1; font-size: 15px; }
.ci-amount { font-size: 13px; color: var(--text-3); min-width: 40px; }
.ci-cals { font-size: 15px; font-weight: 700; white-space: nowrap; }
.ci-cals.unverified { color: var(--gold); }

.log-action-bar {
  position: sticky;
  bottom: calc(var(--nav-h) + 12px);
  background: var(--bg);
  padding: 14px 0 0;
  z-index: 10;
}

/* Manual form */
.manual-form { display: flex; flex-direction: column; gap: 14px; }

/* ══════════════════════════════════════════════════════════════
   EARN PAGE
   ══════════════════════════════════════════════════════════════ */
.earn-info-card {
  display: flex; align-items: flex-start; gap: 14px;
  background: var(--gold-dim);
  border: 1px solid rgba(245,158,11,0.25);
  border-radius: var(--radius); padding: 18px;
  font-size: 15px; color: var(--text-2); line-height: 1.6;
}

.activity-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.activity-chip {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 18px 8px; border-radius: var(--radius);
  background: var(--surface); color: var(--text-2);
  font-size: 13px; font-weight: 600;
  transition: var(--transition); border: 1.5px solid var(--border);
  cursor: pointer; min-height: 88px; justify-content: center;
}
.activity-chip:hover { border-color: var(--border-strong); color: var(--text); }
.activity-chip.selected { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.section-title-sm {
  font-family: var(--font-heading);
  font-size: 16px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.07em;
  color: var(--text-2); margin-bottom: 10px;
}

.duration-control {
  display: flex; align-items: center; gap: var(--space-lg);
  justify-content: center; padding: var(--space-lg);
  background: var(--surface); border-radius: var(--radius);
  border: 1px solid var(--border);
}
.dur-btn {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--surface-2); display: flex; align-items: center;
  justify-content: center; color: var(--text-2); cursor: pointer;
  transition: var(--transition);
}
.dur-btn:hover { background: var(--accent-dim); color: var(--accent); }
.dur-display { text-align: center; }
.dur-display span { font-family: var(--font-heading); font-size: 52px; font-weight: 800; line-height: 1; }
.dur-unit { font-size: 14px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.08em; margin-top: 4px; }
.duration-slider { width: 100%; accent-color: var(--accent); cursor: pointer; }

.intensity-row { display: flex; gap: 10px; }
.intensity-btn {
  flex: 1; min-height: var(--touch-min); padding: 12px 8px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  background: var(--surface); color: var(--text-2);
  border: 1.5px solid var(--border); cursor: pointer;
  transition: var(--transition); text-transform: capitalize;
}
.intensity-btn.selected { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.earn-result-card {
  background: var(--surface); border-radius: var(--radius-xl);
  padding: var(--space-xl) var(--space-lg); text-align: center;
  border: 1px solid var(--border);
}
.earn-icon { margin-bottom: 16px; }
.earn-cals {
  font-family: var(--font-heading); font-size: clamp(64px, 18vw, 96px);
  font-weight: 800; color: var(--gold); line-height: 1;
}
.earn-cals-label { font-size: 14px; color: var(--text-3); margin-top: 8px; margin-bottom: var(--space-lg); text-transform: uppercase; letter-spacing: 0.1em; }
.earn-meta-row { display: flex; justify-content: center; gap: var(--space-lg); margin-bottom: 20px; flex-wrap: wrap; }
.earn-meta-item { text-align: center; }
.em-label { display: block; font-size: 12px; color: var(--text-3); text-transform: uppercase; letter-spacing: 0.1em; margin-bottom: 4px; }
.em-value { font-family: var(--font-heading); font-size: 20px; font-weight: 700; text-transform: capitalize; }
.earn-disclaimer { display: flex; align-items: center; justify-content: center; gap: 8px; font-size: 13px; color: var(--text-3); margin-top: 16px; }
.earn-actions { display: flex; flex-direction: column; gap: 12px; }

/* ══════════════════════════════════════════════════════════════
   HISTORY PAGE
   ══════════════════════════════════════════════════════════════ */
.balance-chart-card {
  background: var(--surface); border-radius: var(--radius-lg);
  padding: 24px; border: 1px solid var(--border);
}
.chart-header {
  display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px;
}
.chart-title { font-family: var(--font-heading); font-size: 18px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.chart-legend { font-size: 12px; color: var(--text-2); display: flex; gap: 12px; align-items: center; }
.mini-chart {
  display: flex; align-items: flex-end; gap: 4px;
  height: 72px; padding: 0 2px;
}
.chart-bar-wrap {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 4px; height: 100%; justify-content: flex-end;
}
.chart-bar { width: 100%; border-radius: 4px 4px 0 0; min-height: 4px; transition: height 0.5s ease; }
.chart-bar-label { font-size: 9px; color: var(--text-3); }

.history-list { display: flex; flex-direction: column; gap: var(--space-lg); }
.history-day-group {
  background: var(--surface); border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--border);
}
.history-day-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 18px 20px 14px; border-bottom: 1px solid var(--border);
}
.history-day-date { font-family: var(--font-heading); font-weight: 700; font-size: 18px; text-transform: uppercase; letter-spacing: 0.04em; }
.history-day-balance { font-family: var(--font-heading); font-size: 18px; font-weight: 700; }
.history-day-balance.positive { color: var(--accent); }
.history-day-balance.negative { color: var(--danger); }

.history-day-stats {
  display: flex; gap: 20px; padding: 12px 20px;
  border-bottom: 1px solid var(--border); flex-wrap: wrap;
}
.hds-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-2); }

.history-item {
  display: flex; align-items: center; gap: 14px;
  padding: 14px 20px; border-bottom: 1px solid var(--border); cursor: pointer;
  transition: var(--transition);
}
.history-item:last-child { border-bottom: none; }
.history-item:hover { background: var(--surface-2); }

.item-menu-btn { margin-left: auto; color: var(--text-3); padding: 8px; border-radius: 50%; min-height: 40px; min-width: 40px; display: flex; align-items: center; justify-content: center; transition: var(--transition); }
.item-menu-btn:hover { background: var(--surface-2); color: var(--text); }

/* ══════════════════════════════════════════════════════════════
   PROFILE PAGE
   ══════════════════════════════════════════════════════════════ */
.profile-header-card {
  display: flex; align-items: center; gap: 18px;
  background: var(--surface); border-radius: var(--radius-xl);
  padding: 24px; border: 1px solid var(--border);
}
.profile-avatar {
  width: 68px; height: 68px; border-radius: 50%;
  background: linear-gradient(135deg, var(--accent-dim), var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 28px; font-weight: 800;
  color: var(--bg); flex-shrink: 0;
}
.profile-info { flex: 1; min-width: 0; }
.profile-name { font-family: var(--font-heading); font-weight: 700; font-size: 22px; text-transform: uppercase; letter-spacing: 0.02em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.profile-email { font-size: 14px; color: var(--text-2); margin-top: 3px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.settings-card {
  background: var(--surface); border-radius: var(--radius-lg);
  overflow: hidden; border: 1px solid var(--border);
}
.settings-card-title {
  font-family: var(--font-heading); font-size: 14px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.1em;
  color: var(--text-3); padding: 16px 20px 10px;
}

.stats-grid-2 { padding: 0 0 8px; }
.stat-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border);
}
.stat-row:last-child { border-bottom: none; }
.sr-label { font-size: 15px; color: var(--text-2); }
.sr-value { font-family: var(--font-heading); font-size: 17px; font-weight: 700; }

.settings-row {
  display: flex; align-items: center; gap: 16px;
  padding: 16px 20px; border-bottom: 1px solid var(--border); min-height: var(--touch-min);
}
.settings-row:last-child { border-bottom: none; }
.settings-row-info { flex: 1; }
.settings-row-label { display: block; font-size: 16px; font-weight: 500; }
.settings-row-desc { font-size: 13px; color: var(--text-3); margin-top: 3px; }

/* Toggle */
.toggle-switch { position: relative; display: inline-block; width: 52px; height: 30px; flex-shrink: 0; }
.toggle-switch input { opacity: 0; width: 0; height: 0; }
.toggle-slider {
  position: absolute; inset: 0; background: var(--surface-3);
  border-radius: 30px; cursor: pointer; transition: var(--transition);
}
.toggle-slider::before {
  content: ''; position: absolute;
  width: 22px; height: 22px; left: 4px; top: 4px;
  border-radius: 50%; background: var(--text-3); transition: var(--transition);
}
.toggle-switch input:checked + .toggle-slider { background: var(--accent-dim); }
.toggle-switch input:checked + .toggle-slider::before { transform: translateX(22px); background: var(--accent); }

.notif-times-label { font-size: 13px; color: var(--text-3); padding: 10px 20px 4px; text-transform: uppercase; letter-spacing: 0.07em; }
.notif-time-row {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 20px; border-bottom: 1px solid var(--border); min-height: var(--touch-min);
}
.notif-time-label { font-size: 15px; font-weight: 500; }
.time-input {
  background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 8px 14px; color: var(--text); font-size: 15px;
  border: 1.5px solid var(--border); cursor: pointer;
  min-height: 44px; font-family: var(--font-body);
}
#notif-times-section { padding: 0 0 16px; }
#notif-times-section .btn { margin: 10px 20px 0; width: calc(100% - 40px); }

.theme-btns { display: flex; gap: 10px; }
.theme-option-btn {
  display: flex; align-items: center; gap: 8px; min-height: 44px;
  padding: 10px 16px; border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2);
  border: 1.5px solid var(--border); cursor: pointer; transition: var(--transition);
}
.theme-option-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.unit-selector { display: flex; gap: 10px; padding: 12px 20px 20px; }
.unit-btn {
  flex: 1; min-height: var(--touch-min); padding: 12px;
  border-radius: var(--radius-sm); font-size: 14px; font-weight: 600;
  background: var(--surface-2); color: var(--text-2);
  border: 1.5px solid var(--border); cursor: pointer; transition: var(--transition);
}
.unit-btn.active { background: var(--accent-dim); border-color: var(--accent); color: var(--accent); }

.danger-zone { border-color: rgba(255,71,87,0.2); }

/* ══════════════════════════════════════════════════════════════
   PT COACH DRAWER
   ══════════════════════════════════════════════════════════════ */
.pt-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.6);
  z-index: 900; opacity: 0; backdrop-filter: blur(6px);
  transition: opacity 0.28s ease;
}
.pt-overlay-show { opacity: 1; }

.pt-drawer {
  position: fixed; bottom: 0; left: 0; right: 0; z-index: 901;
  max-height: 88dvh; background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  display: flex; flex-direction: column; box-shadow: var(--shadow-lg);
  transform: translateY(100%);
  transition: transform 0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
}
.pt-drawer-show { transform: translateY(0); }

.drawer-handle {
  width: 44px; height: 5px; border-radius: 3px;
  background: var(--surface-3); margin: 14px auto 0; flex-shrink: 0;
}
.drawer-header {
  display: flex; align-items: center; gap: 14px;
  padding: 18px 20px 16px; border-bottom: 1px solid var(--border); flex-shrink: 0;
}
.pt-avatar-wrap { position: relative; }
.pt-avatar-lg {
  width: 52px; height: 52px; border-radius: 50%;
  background: linear-gradient(135deg, #0a2a1a, var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-weight: 800; font-size: 22px; color: var(--bg);
}
.pt-status-dot {
  position: absolute; bottom: 2px; right: 2px; width: 12px; height: 12px;
  border-radius: 50%; background: var(--accent); border: 2.5px solid var(--surface);
}
.pt-info { flex: 1; }
.pt-info h3 { font-family: var(--font-heading); font-size: 20px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; }
.pt-info p  { font-size: 13px; color: var(--text-2); margin-top: 2px; }

.chat-messages {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 14px;
  overscroll-behavior: contain;
}

.chat-message {
  display: flex; gap: 12px;
  opacity: 0; transform: translateY(10px);
  transition: opacity 0.2s ease, transform 0.2s ease;
}
.chat-message.message-in { opacity: 1; transform: translateY(0); }
.user-message { flex-direction: row-reverse; }

.bot-avatar-sm {
  width: 32px; height: 32px; border-radius: 50%;
  background: linear-gradient(135deg, #0a2a1a, var(--accent));
  display: flex; align-items: center; justify-content: center;
  font-family: var(--font-heading); font-size: 13px; font-weight: 800; color: var(--bg);
  flex-shrink: 0; align-self: flex-end;
}

.chat-bubble {
  max-width: 78%; padding: 12px 16px;
  border-radius: 18px; font-size: 15px; line-height: 1.55;
}
.bot-bubble  { background: var(--surface-2); color: var(--text); border-radius: 4px 18px 18px 18px; }
.user-bubble { background: var(--accent); color: var(--bg); font-weight: 500; border-radius: 18px 4px 18px 18px; }

/* Typing indicator */
.typing-indicator { display: flex; align-items: center; gap: 5px; padding: 14px 18px; }
.typing-indicator span {
  width: 7px; height: 7px; border-radius: 50%; background: var(--text-3);
  animation: typing-bounce 1.2s ease-in-out infinite;
}
.typing-indicator span:nth-child(2) { animation-delay: 0.2s; }
.typing-indicator span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-7px); opacity: 1; }
}

.chat-input-row {
  display: flex; align-items: flex-end; gap: 12px;
  padding: 16px 20px;
  margin-bottom: var(--safe-bottom);
  border-top: 1px solid var(--border); flex-shrink: 0;
}
#pt-input {
  flex: 1; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 22px; padding: 12px 18px; color: var(--text);
  font-size: 16px; resize: none; max-height: 120px;
  overflow-y: auto; transition: var(--transition); font-family: var(--font-body);
}
#pt-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); }

.send-btn {
  width: 48px; height: 48px; border-radius: 50%;
  background: var(--accent); color: var(--bg);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; cursor: pointer; transition: var(--transition);
}
.send-btn:hover { background: #00e07a; transform: scale(1.08); }
.send-btn:disabled { opacity: 0.45; cursor: not-allowed; transform: none; }

/* PT Coach FAB */
.pt-coach-fab {
  position: fixed; bottom: calc(var(--nav-h) + 16px); right: 20px;
  z-index: 100; display: flex; align-items: center; gap: 10px;
  padding: 12px 20px 12px 14px; border-radius: 100px;
  background: linear-gradient(135deg, #0a2a1a, #003d1a);
  box-shadow: var(--accent-glow), var(--shadow);
  border: 1px solid rgba(0, 255, 135, 0.3);
  cursor: pointer;
  animation: fab-breathe 3s ease-in-out infinite;
  transition: var(--transition);
}
.pt-coach-fab:hover { transform: translateY(-3px) scale(1.04); }
.fab-avatar {
  width: 32px; height: 32px; border-radius: 50%; background: var(--accent);
  color: var(--bg); font-family: var(--font-heading); font-size: 16px; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
}
.fab-label { font-family: var(--font-heading); font-size: 16px; font-weight: 700; color: var(--accent); letter-spacing: 0.04em; }
@keyframes fab-breathe {
  0%, 100% { box-shadow: var(--accent-glow), var(--shadow); }
  50%       { box-shadow: 0 0 60px rgba(0,255,135,0.45), var(--shadow); }
}

/* ══════════════════════════════════════════════════════════════
   AUTH PAGE
   ══════════════════════════════════════════════════════════════ */
.auth-page {
  display: flex; flex-direction: column; align-items: center;
  justify-content: center; min-height: 100dvh;
  padding: var(--space-xl) 24px var(--space-2xl); background: var(--bg);
}

.auth-logo {
  font-family: var(--font-heading); font-size: clamp(52px, 16vw, 72px);
  font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text); margin-bottom: 8px;
}
.auth-logo span { color: var(--accent); }

.auth-tagline {
  font-size: 16px; color: var(--text-2); margin-bottom: var(--space-xl);
  text-align: center; line-height: 1.6;
}

.auth-card {
  width: 100%; max-width: 420px;
  background: var(--surface); border-radius: var(--radius-xl);
  padding: var(--space-lg) 24px; box-shadow: var(--shadow);
  border: 1px solid var(--border);
}

.auth-tabs {
  display: flex; background: var(--surface-2); border-radius: var(--radius-sm);
  padding: 5px; margin-bottom: var(--space-lg); gap: 5px;
  border: 1px solid var(--border);
}
.auth-tab {
  flex: 1; text-align: center; padding: 12px;
  border-radius: var(--radius-xs); font-family: var(--font-heading);
  font-size: 16px; font-weight: 700; letter-spacing: 0.05em;
  text-transform: uppercase; color: var(--text-3); cursor: pointer;
  transition: var(--transition); user-select: none; min-height: 44px;
  display: flex; align-items: center; justify-content: center;
}
.auth-tab.active { background: var(--surface-3); color: var(--text); }

.auth-error {
  display: none; padding: 14px 18px;
  background: var(--danger-dim); border: 1px solid rgba(255,71,87,0.3);
  border-radius: var(--radius-sm); font-size: 15px; color: var(--danger);
  margin-bottom: var(--space-md); line-height: 1.5;
}
.auth-error.visible { display: block; }

.auth-form { display: flex; flex-direction: column; gap: var(--space-md); }

.form-group { display: flex; flex-direction: column; gap: 8px; }
.form-label {
  font-family: var(--font-heading); font-size: 14px; font-weight: 700;
  color: var(--text-2); letter-spacing: 0.07em; text-transform: uppercase;
}
.form-input {
  width: 100%; min-height: var(--touch-min);
  background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); padding: 14px 18px;
  color: var(--text); font-size: 16px; font-family: var(--font-body);
  transition: var(--transition);
}
.form-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); outline: none; }
.form-input::placeholder { color: var(--text-3); }

.password-input-wrap { position: relative; display: flex; align-items: center; }
.password-input-wrap .form-input { padding-right: 54px; }
.password-toggle {
  position: absolute; right: 16px; color: var(--text-3); cursor: pointer;
  display: flex; align-items: center; padding: 6px; transition: var(--transition);
  min-width: 40px; min-height: 40px; justify-content: center;
}
.password-toggle:hover { color: var(--text-2); }

.spinner {
  width: 22px; height: 22px; border-radius: 50%;
  border: 2.5px solid rgba(10,15,28,0.2);
  border-top-color: #0A0F1C;
  animation: spin 0.7s linear infinite; margin: 0 auto;
}

.auth-divider {
  display: flex; align-items: center; gap: 14px;
  font-size: 13px; color: var(--text-3); margin: var(--space-md) 0;
  text-transform: uppercase; letter-spacing: 0.07em;
}
.auth-divider::before, .auth-divider::after {
  content: ''; flex: 1; height: 1px; background: var(--border);
}

/* ══════════════════════════════════════════════════════════════
   ONBOARDING PAGE
   ══════════════════════════════════════════════════════════════ */
.onboarding-page {
  display: flex; flex-direction: column; min-height: 100dvh; background: var(--bg);
}

.onboarding-header {
  display: flex; align-items: center; gap: 4px;
  padding: 24px 24px 0;
  font-family: var(--font-heading); font-size: 32px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.06em;
}
.logo-a { color: var(--accent); }

.onboarding-intro {
  padding: 20px 24px 20px;
  border-bottom: 1px solid var(--border);
}
.onboarding-intro h2 {
  font-family: var(--font-heading); font-size: 26px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 8px;
}
.onboarding-intro p { font-size: 15px; color: var(--text-2); line-height: 1.6; }

.chat-container {
  flex: 1; overflow-y: auto; padding: 24px 20px;
  display: flex; flex-direction: column; gap: 18px; overscroll-behavior: contain;
}

.chat-bubble {
  display: flex; align-items: flex-start; gap: 14px;
  max-width: 90%; animation: bubble-in 0.22s ease forwards;
}
.chat-bubble.user { flex-direction: row-reverse; align-self: flex-end; max-width: 82%; }
@keyframes bubble-in {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.bubble-avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: linear-gradient(135deg, #0a2a1a, var(--accent));
  color: var(--bg); font-family: var(--font-heading); font-size: 16px; font-weight: 800;
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
}
.bubble-avatar.user-av { background: linear-gradient(135deg, var(--surface-3), var(--surface-2)); color: var(--text-2); }

.bubble-content {
  background: var(--surface); border-radius: 4px 18px 18px 18px;
  padding: 14px 18px; font-size: 16px; line-height: 1.6; color: var(--text);
  max-width: 100%; word-break: break-word;
}
.chat-bubble.user .bubble-content {
  background: var(--accent); color: var(--bg); font-weight: 500;
  border-radius: 18px 4px 18px 18px;
}

.typing-dot {
  display: inline-block; width: 7px; height: 7px; border-radius: 50%;
  background: var(--text-3); animation: typing-bounce 1.2s ease-in-out infinite;
  margin: 10px 3px;
}
.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

.onboarding-input-row {
  display: flex; align-items: flex-end; gap: 12px; padding: 16px 20px;
  padding-bottom: calc(16px + var(--safe-bottom));
  border-top: 1px solid var(--border); background: var(--surface); flex-shrink: 0;
}
#ob-input {
  flex: 1; background: var(--surface-2); border: 1.5px solid var(--border);
  border-radius: 22px; padding: 12px 18px; color: var(--text);
  font-size: 16px; resize: none; overflow-y: auto;
  transition: var(--transition); font-family: var(--font-body);
}
#ob-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-dim); outline: none; }

/* ══════════════════════════════════════════════════════════════
   ANIMATIONS & UTILITIES
   ══════════════════════════════════════════════════════════════ */
.spin { animation: spin 1s linear infinite; }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

/* Error state */
.error-state { padding: var(--space-xl); text-align: center; color: var(--danger); font-size: 15px; }
.divider { height: 1px; background: var(--border); }
