/* ================================================================
   AI KETO TRACKER — MASTER STYLESHEET
   Themes: light (default) · dark · keto · purple · ocean · sunset
================================================================ */

/* ----------------------------------------------------------------
   1. CSS CUSTOM PROPERTIES — LIGHT THEME (default)
---------------------------------------------------------------- */
:root,
[data-theme="light"] {
  /* Background layers */
  --bg-base:         #f5f7fa;
  --bg-surface:      #ffffff;
  --bg-elevated:     #ffffff;
  --bg-card:         #ffffff;
  --bg-input:        #f0f2f5;
  --bg-nav:          #ffffff;
  --bg-overlay:      rgba(0,0,0,0.45);

  /* Text */
  --text-primary:    #1a1f2e;
  --text-secondary:  #5a6272;
  --text-muted:      #9aa0ae;
  --text-inverse:    #ffffff;

  /* Borders */
  --border:          #e5e9f0;
  --border-focus:    #00c49a;

  /* Brand / accent */
  --accent:          #00c49a;
  --accent-light:    #e6faf5;
  --accent-text:     #007a61;
  --accent2:         #ff6b35;
  --accent2-light:   #fff2ed;

  /* Macros */
  --fat-color:       #f59e0b;
  --protein-color:   #3b82f6;
  --carb-color:      #10b981;

  /* Status */
  --success:         #10b981;
  --success-light:   #d1fae5;
  --danger:          #ef4444;
  --danger-light:    #fee2e2;
  --warning:         #f59e0b;
  --warning-light:   #fef3c7;

  /* Shadows */
  --shadow-sm:       0 1px 3px rgba(0,0,0,0.08);
  --shadow-md:       0 4px 16px rgba(0,0,0,0.10);
  --shadow-lg:       0 8px 30px rgba(0,0,0,0.12);

  /* Selection mode tint */
  --selected-tint:   rgba(0,196,154,0.12);

  /* Bottom sheet */
  --sheet-bg:        #ffffff;

  /* Keto banner */
  --keto-banner-bg:  linear-gradient(135deg, #e6faf5 0%, #d1fae5 100%);
  --keto-banner-border: #a7f3d0;
  --keto-banner-text: #065f46;

  /* Welcome gradient */
  --welcome-bg:      linear-gradient(160deg, #f0fff8 0%, #e8f4fd 100%);
  --welcome-glow:    rgba(0,196,154,0.20);

  /* Nav active */
  --nav-active:      #00c49a;
  --nav-inactive:    #9aa0ae;
}

/* ----------------------------------------------------------------
   2. DARK THEME
---------------------------------------------------------------- */
[data-theme="dark"] {
  --bg-base:         #0a0a0f;
  --bg-surface:      #141420;
  --bg-elevated:     #1e1e2e;
  --bg-card:         #1e1e2e;
  --bg-input:        #252535;
  --bg-nav:          #141420;
  --bg-overlay:      rgba(0,0,0,0.70);

  --text-primary:    #f0f0f8;
  --text-secondary:  #9090b0;
  --text-muted:      #606080;
  --text-inverse:    #0a0a0f;

  --border:          #2a2a3e;
  --border-focus:    #00d4aa;

  --accent:          #00d4aa;
  --accent-light:    rgba(0,212,170,0.12);
  --accent-text:     #00d4aa;
  --accent2:         #ff6b35;
  --accent2-light:   rgba(255,107,53,0.12);

  --shadow-sm:       0 1px 4px rgba(0,0,0,0.4);
  --shadow-md:       0 4px 20px rgba(0,0,0,0.5);
  --shadow-lg:       0 8px 40px rgba(0,0,0,0.6);

  --selected-tint:   rgba(0,212,170,0.15);
  --sheet-bg:        #1e1e2e;

  --keto-banner-bg:  linear-gradient(135deg, rgba(0,212,170,0.12) 0%, rgba(0,212,170,0.06) 100%);
  --keto-banner-border: rgba(0,212,170,0.25);
  --keto-banner-text: #00d4aa;

  --welcome-bg:      linear-gradient(160deg, #0a0a1a 0%, #0a1a2a 100%);
  --welcome-glow:    rgba(0,212,170,0.18);

  --nav-active:      #00d4aa;
  --nav-inactive:    #606080;
}

/* ----------------------------------------------------------------
   3. KETO GREEN THEME
---------------------------------------------------------------- */
[data-theme="keto"] {
  --bg-base:         #0d1f12;
  --bg-surface:      #132a18;
  --bg-elevated:     #1a3520;
  --bg-card:         #1a3520;
  --bg-input:        #1f3d25;
  --bg-nav:          #0d1f12;
  --bg-overlay:      rgba(0,0,0,0.70);

  --text-primary:    #e8f5e9;
  --text-secondary:  #81c784;
  --text-muted:      #4a7a50;
  --text-inverse:    #0d1f12;

  --border:          #264d2c;
  --border-focus:    #4caf50;

  --accent:          #4caf50;
  --accent-light:    rgba(76,175,80,0.15);
  --accent-text:     #81c784;
  --accent2:         #cddc39;
  --accent2-light:   rgba(205,220,57,0.12);

  --shadow-sm:       0 1px 4px rgba(0,0,0,0.5);
  --shadow-md:       0 4px 20px rgba(0,0,0,0.6);
  --shadow-lg:       0 8px 40px rgba(0,0,0,0.7);

  --selected-tint:   rgba(76,175,80,0.20);
  --sheet-bg:        #1a3520;

  --keto-banner-bg:  linear-gradient(135deg, rgba(76,175,80,0.20) 0%, rgba(76,175,80,0.10) 100%);
  --keto-banner-border: rgba(76,175,80,0.40);
  --keto-banner-text: #a5d6a7;

  --welcome-bg:      linear-gradient(160deg, #0a1a0d 0%, #0d1f12 100%);
  --welcome-glow:    rgba(76,175,80,0.25);

  --nav-active:      #4caf50;
  --nav-inactive:    #4a7a50;

  --fat-color:       #ffca28;
  --protein-color:   #42a5f5;
  --carb-color:      #66bb6a;
  --success:         #66bb6a;
  --success-light:   rgba(102,187,106,0.15);
  --danger:          #ef5350;
  --danger-light:    rgba(239,83,80,0.15);
}

/* ----------------------------------------------------------------
   4. PURPLE THEME
---------------------------------------------------------------- */
[data-theme="purple"] {
  --bg-base:         #f8f5ff;
  --bg-surface:      #ffffff;
  --bg-elevated:     #ffffff;
  --bg-card:         #ffffff;
  --bg-input:        #f0ecff;
  --bg-nav:          #ffffff;
  --bg-overlay:      rgba(0,0,0,0.45);

  --text-primary:    #1a1040;
  --text-secondary:  #6b5b95;
  --text-muted:      #9f8fcf;
  --text-inverse:    #ffffff;

  --border:          #e0d8f5;
  --border-focus:    #7c3aed;

  --accent:          #7c3aed;
  --accent-light:    #ede9fe;
  --accent-text:     #5b21b6;
  --accent2:         #ec4899;
  --accent2-light:   #fce7f3;

  --shadow-sm:       0 1px 3px rgba(124,58,237,0.08);
  --shadow-md:       0 4px 16px rgba(124,58,237,0.10);
  --shadow-lg:       0 8px 30px rgba(124,58,237,0.15);

  --selected-tint:   rgba(124,58,237,0.10);
  --sheet-bg:        #ffffff;

  --keto-banner-bg:  linear-gradient(135deg, #ede9fe 0%, #fce7f3 100%);
  --keto-banner-border: #c4b5fd;
  --keto-banner-text: #5b21b6;

  --welcome-bg:      linear-gradient(160deg, #f5f0ff 0%, #fce7f3 100%);
  --welcome-glow:    rgba(124,58,237,0.20);

  --nav-active:      #7c3aed;
  --nav-inactive:    #9f8fcf;

  --fat-color:       #f59e0b;
  --protein-color:   #7c3aed;
  --carb-color:      #ec4899;
}

/* ----------------------------------------------------------------
   5. OCEAN THEME
---------------------------------------------------------------- */
[data-theme="ocean"] {
  --bg-base:         #f0f8ff;
  --bg-surface:      #ffffff;
  --bg-elevated:     #ffffff;
  --bg-card:         #ffffff;
  --bg-input:        #e8f4ff;
  --bg-nav:          #ffffff;
  --bg-overlay:      rgba(0,0,0,0.45);

  --text-primary:    #0a2540;
  --text-secondary:  #1e5f8c;
  --text-muted:      #5b8db8;
  --text-inverse:    #ffffff;

  --border:          #c8e4f8;
  --border-focus:    #0284c7;

  --accent:          #0284c7;
  --accent-light:    #e0f2fe;
  --accent-text:     #0369a1;
  --accent2:         #06b6d4;
  --accent2-light:   #cffafe;

  --shadow-sm:       0 1px 3px rgba(2,132,199,0.08);
  --shadow-md:       0 4px 16px rgba(2,132,199,0.10);
  --shadow-lg:       0 8px 30px rgba(2,132,199,0.15);

  --selected-tint:   rgba(2,132,199,0.10);
  --sheet-bg:        #ffffff;

  --keto-banner-bg:  linear-gradient(135deg, #e0f2fe 0%, #cffafe 100%);
  --keto-banner-border: #7dd3fc;
  --keto-banner-text: #0369a1;

  --welcome-bg:      linear-gradient(160deg, #e0f2fe 0%, #cffafe 100%);
  --welcome-glow:    rgba(2,132,199,0.20);

  --nav-active:      #0284c7;
  --nav-inactive:    #5b8db8;

  --fat-color:       #f59e0b;
  --protein-color:   #0284c7;
  --carb-color:      #06b6d4;
}

/* ----------------------------------------------------------------
   6. SUNSET THEME
---------------------------------------------------------------- */
[data-theme="sunset"] {
  --bg-base:         #fff8f0;
  --bg-surface:      #ffffff;
  --bg-elevated:     #ffffff;
  --bg-card:         #ffffff;
  --bg-input:        #fff0e6;
  --bg-nav:          #ffffff;
  --bg-overlay:      rgba(0,0,0,0.45);

  --text-primary:    #2d1206;
  --text-secondary:  #92400e;
  --text-muted:      #c4773c;
  --text-inverse:    #ffffff;

  --border:          #fde8d0;
  --border-focus:    #ea580c;

  --accent:          #ea580c;
  --accent-light:    #ffedd5;
  --accent-text:     #c2410c;
  --accent2:         #f59e0b;
  --accent2-light:   #fef3c7;

  --shadow-sm:       0 1px 3px rgba(234,88,12,0.08);
  --shadow-md:       0 4px 16px rgba(234,88,12,0.10);
  --shadow-lg:       0 8px 30px rgba(234,88,12,0.15);

  --selected-tint:   rgba(234,88,12,0.10);
  --sheet-bg:        #ffffff;

  --keto-banner-bg:  linear-gradient(135deg, #ffedd5 0%, #fef3c7 100%);
  --keto-banner-border: #fdba74;
  --keto-banner-text: #c2410c;

  --welcome-bg:      linear-gradient(160deg, #fff8f0 0%, #fef3c7 100%);
  --welcome-glow:    rgba(234,88,12,0.20);

  --nav-active:      #ea580c;
  --nav-inactive:    #c4773c;

  --fat-color:       #f59e0b;
  --protein-color:   #ea580c;
  --carb-color:      #10b981;
}

/* ----------------------------------------------------------------
   7. BASE RESET & GLOBAL
---------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html, body {
  height: 100%;
  background: #c8cdd8;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  -webkit-font-smoothing: antialiased;
  color: var(--text-primary);
}

button { cursor: pointer; font-family: inherit; border: none; outline: none; background: none; }
input  { font-family: inherit; outline: none; border: none; background: none; }
a      { color: var(--accent); text-decoration: none; }

/* ----------------------------------------------------------------
   8. PHONE FRAME
---------------------------------------------------------------- */
.phone-frame {
  position: relative;
  width: 100%;
  max-width: 430px;
  min-height: 100dvh;
  margin: 0 auto;
  background: var(--bg-base);
  overflow: hidden;
  transition: background 0.3s ease;
}

@media (min-width: 500px) {
  body { display: flex; align-items: flex-start; justify-content: center; min-height: 100vh; padding: 24px 0; background: #b8bdc8; }
  .phone-frame {
    min-height: auto;
    height: calc(100dvh - 48px);
    max-height: 900px;
    border-radius: 44px;
    box-shadow: 0 20px 80px rgba(0,0,0,0.35), 0 0 0 1px rgba(255,255,255,0.1) inset;
  }
}

/* ----------------------------------------------------------------
   9. SCREENS
---------------------------------------------------------------- */
.screen {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  background: var(--bg-base);
  transition: background 0.3s ease;
  overflow: hidden;
}
.screen.active { display: flex; }

.screen-scroll {
  flex: 1;
  overflow-y: auto;
  padding: 0 16px;
  -webkit-overflow-scrolling: touch;
}
.screen-scroll::-webkit-scrollbar { display: none; }

/* ----------------------------------------------------------------
   10. TOP BAR
---------------------------------------------------------------- */
.top-bar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 16px 12px;
  padding-top: calc(16px + env(safe-area-inset-top));
  background: var(--bg-surface);
  border-bottom: 1px solid var(--border);
  z-index: 10;
  flex-shrink: 0;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.top-bar-title { font-size: 17px; font-weight: 700; flex: 1; color: var(--text-primary); }
.top-bar-left  { display: flex; align-items: center; gap: 10px; flex: 1; }
.top-bar-right { display: flex; align-items: center; gap: 6px; }

.avatar {
  width: 38px; height: 38px; border-radius: 50%;
  background: var(--accent-light);
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 16px;
}
.greeting { font-size: 11px; color: var(--text-muted); }
.user-name { font-size: 14px; font-weight: 700; color: var(--text-primary); }

.btn-back {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 16px; flex-shrink: 0;
  background: var(--accent-light);
  transition: background 0.2s;
}
.btn-back:hover { filter: brightness(0.95); }

.icon-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--text-secondary); font-size: 16px;
  background: var(--bg-input);
  transition: background 0.2s, color 0.2s;
}
.icon-btn:hover { background: var(--accent-light); color: var(--accent); }

/* Theme toggle button in top bar */
.theme-toggle-btn {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  color: var(--accent); font-size: 16px;
  background: var(--accent-light);
  transition: background 0.2s, transform 0.2s;
}
.theme-toggle-btn:hover { transform: scale(1.1); }

/* ----------------------------------------------------------------
   11. BOTTOM NAV
---------------------------------------------------------------- */
.bottom-nav {
  display: flex;
  align-items: center;
  background: var(--bg-nav);
  border-top: 1px solid var(--border);
  padding-bottom: env(safe-area-inset-bottom);
  flex-shrink: 0;
  z-index: 10;
  transition: background 0.3s ease, border-color 0.3s ease;
}
.nav-item {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; gap: 3px;
  padding: 10px 4px;
  font-size: 10px; font-weight: 500;
  color: var(--nav-inactive);
  transition: color 0.2s;
}
.nav-item i { font-size: 20px; }
.nav-item.active { color: var(--nav-active); }
.nav-item--center {
  width: 52px; height: 52px; border-radius: 26px;
  background: var(--accent); color: #fff !important;
  font-size: 20px !important;
  margin-top: -12px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.2);
  flex: none;
}

/* ----------------------------------------------------------------
   12. BUTTONS
---------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center;
  gap: 6px; padding: 12px 24px; border-radius: 14px;
  font-size: 15px; font-weight: 600;
  transition: all 0.2s; width: 100%;
}
.btn-primary {
  background: var(--accent); color: #fff;
  box-shadow: 0 4px 14px rgba(0,0,0,0.15);
}
.btn-primary:hover { filter: brightness(1.05); transform: translateY(-1px); }
.btn-primary:active { transform: translateY(0); }
.btn-outline {
  background: transparent; border: 2px solid var(--accent);
  color: var(--accent);
}
.btn-danger { background: var(--danger); color: #fff; }
.btn-sm { padding: 8px 16px; font-size: 13px; border-radius: 10px; width: auto; }
.btn-link { background: none; color: var(--accent); font-size: 13px; font-weight: 600; width: auto; padding: 4px 8px; }
.btn-xl { padding: 16px 32px; font-size: 16px; border-radius: 16px; }

/* ----------------------------------------------------------------
   13. WELCOME SCREEN
---------------------------------------------------------------- */
#screenWelcome {
  background: var(--welcome-bg);
  justify-content: center;
}
.welcome-bg { position: absolute; inset: 0; overflow: hidden; pointer-events: none; }
.welcome-glow {
  position: absolute; width: 300px; height: 300px; border-radius: 50%;
  background: var(--welcome-glow);
  top: -60px; left: -60px;
  animation: glow-pulse 4s ease-in-out infinite;
}
.welcome-glow--2 { width: 200px; height: 200px; bottom: 100px; right: -40px; top: auto; animation-delay: 2s; }
@keyframes glow-pulse { 0%,100%{opacity:0.6;transform:scale(1)} 50%{opacity:1;transform:scale(1.15)} }

.welcome-content {
  position: relative; z-index: 1;
  display: flex; flex-direction: column; align-items: center;
  padding: 40px 32px; gap: 20px; text-align: center;
}
.brand-logo { display: flex; flex-direction: column; align-items: center; gap: 12px; }
.brand-icon {
  width: 80px; height: 80px; border-radius: 28px;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 36px;
  box-shadow: 0 8px 30px rgba(0,0,0,0.15);
}
.brand-name { font-size: 32px; font-weight: 800; color: var(--text-primary); line-height: 1.1; }
.brand-name span { color: var(--accent); }
.brand-tagline { font-size: 15px; color: var(--text-secondary); line-height: 1.5; }

.welcome-features { display: flex; gap: 8px; flex-wrap: wrap; justify-content: center; }
.feat-pill {
  background: var(--bg-surface); color: var(--text-secondary);
  border: 1px solid var(--border);
  padding: 6px 12px; border-radius: 20px; font-size: 12px; font-weight: 500;
  display: flex; align-items: center; gap: 5px;
  transition: background 0.3s;
}
.feat-pill i { color: var(--accent); }
.welcome-sign-in { font-size: 13px; color: var(--text-muted); }
.welcome-sign-in a { color: var(--accent); font-weight: 600; }

/* ----------------------------------------------------------------
   14. ONBOARDING
---------------------------------------------------------------- */
.onboard-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  flex-shrink: 0;
}
.progress-bar {
  flex: 1; height: 4px; background: var(--border);
  border-radius: 2px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--accent);
  border-radius: 2px; transition: width 0.4s ease;
}
.progress-label { font-size: 12px; font-weight: 600; color: var(--text-muted); flex-shrink: 0; }

.onboard-body {
  flex: 1; overflow-y: auto; padding: 16px 20px 30px;
}
.onboard-emoji { font-size: 48px; margin-bottom: 12px; }
.onboard-body h2 { font-size: 22px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.onboard-sub { font-size: 14px; color: var(--text-secondary); margin-bottom: 24px; line-height: 1.5; }

/* Option cards */
.option-cards { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.option-card {
  display: flex; align-items: center; gap: 14px;
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: 16px; padding: 16px;
  text-align: left; position: relative;
  transition: all 0.2s;
}
.option-card:hover { border-color: var(--accent); background: var(--accent-light); }
.option-card.selected { border-color: var(--accent); background: var(--accent-light); }
.option-icon { font-size: 28px; flex-shrink: 0; }
.option-text { display: flex; flex-direction: column; gap: 2px; }
.option-text strong { font-size: 15px; color: var(--text-primary); }
.option-text span { font-size: 12px; color: var(--text-secondary); }
.option-badge {
  position: absolute; top: -8px; right: 12px;
  background: var(--accent); color: #fff;
  font-size: 10px; font-weight: 700; padding: 2px 8px; border-radius: 10px;
}

/* Form */
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 12px; font-weight: 700; color: var(--text-secondary); margin-bottom: 6px; text-transform: uppercase; letter-spacing: 0.5px; }
.form-input {
  width: 100%; background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 12px 14px; font-size: 15px; color: var(--text-primary);
  transition: border-color 0.2s;
}
.form-input:focus { border-color: var(--border-focus); background: var(--bg-elevated); }
.form-row { display: flex; gap: 12px; }
.form-row .form-group { flex: 1; }

.toggle-row { display: flex; gap: 8px; }
.toggle-btn {
  flex: 1; padding: 10px; border-radius: 10px; font-size: 13px; font-weight: 600;
  background: var(--bg-input); color: var(--text-secondary); border: 1.5px solid var(--border);
  transition: all 0.2s;
}
.toggle-btn.active { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Diet list */
.diet-list { display: flex; flex-direction: column; gap: 8px; }
.diet-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 12px 14px;
  font-size: 14px; font-weight: 500; color: var(--text-primary);
  transition: all 0.2s;
}
.diet-item:hover { border-color: var(--accent); background: var(--accent-light); }
.diet-item.selected { border-color: var(--accent); background: var(--accent-light); color: var(--accent-text); }

/* Meal frequency */
.meal-freq-row { display: flex; gap: 12px; }
.freq-card {
  flex: 1; display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg-card); border: 2px solid var(--border);
  border-radius: 16px; padding: 20px 10px;
  transition: all 0.2s;
}
.freq-card:hover { border-color: var(--accent); }
.freq-card.selected { border-color: var(--accent); background: var(--accent-light); }
.freq-num { font-size: 28px; font-weight: 800; color: var(--accent); }
.freq-label { font-size: 12px; color: var(--text-secondary); text-align: center; }

/* ----------------------------------------------------------------
   15. DASHBOARD
---------------------------------------------------------------- */
.keto-banner {
  display: flex; align-items: center; justify-content: space-between;
  background: var(--keto-banner-bg);
  border: 1px solid var(--keto-banner-border);
  border-radius: 14px; padding: 12px 16px; margin: 14px 0;
  transition: background 0.3s, border-color 0.3s;
}
.keto-banner-left { display: flex; align-items: center; gap: 10px; }
.keto-banner-left i { font-size: 20px; color: var(--keto-banner-text); }
.keto-banner-left strong { display: block; font-size: 14px; color: var(--keto-banner-text); }
.keto-banner-left span { display: block; font-size: 12px; color: var(--text-secondary); }
.keto-status-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 0 3px var(--success-light);
  animation: pulse-dot 2s ease-in-out infinite;
}
@keyframes pulse-dot { 0%,100%{box-shadow:0 0 0 3px var(--success-light)} 50%{box-shadow:0 0 0 6px var(--success-light)} }

.macro-card {
  background: var(--bg-card); border-radius: 18px;
  padding: 20px; display: flex; align-items: center; gap: 20px;
  margin-bottom: 14px; border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
  transition: background 0.3s, border-color 0.3s;
}
.macro-ring-wrap { position: relative; flex-shrink: 0; }
.macro-ring-center {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.macro-kcal { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.macro-kcal-label { font-size: 10px; color: var(--text-muted); font-weight: 600; }

.macro-legend { display: flex; flex-direction: column; gap: 10px; flex: 1; }
.macro-legend-item { display: flex; align-items: center; gap: 8px; }
.dot { width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0; }
.dot--fat { background: var(--fat-color); }
.dot--protein { background: var(--protein-color); }
.dot--carbs { background: var(--carb-color); }
.macro-legend-item strong { font-size: 13px; color: var(--text-primary); display: block; }
.macro-legend-item span { font-size: 11px; color: var(--text-muted); }

.section-header { display: flex; align-items: center; justify-content: space-between; margin: 6px 0 10px; }
.section-header h3 { font-size: 16px; font-weight: 700; color: var(--text-primary); }
.section-sub { font-size: 13px; color: var(--text-secondary); padding: 8px 0 12px; }
.section-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); margin: 12px 0 8px; }

/* Meal cards */
.meal-card {
  background: var(--bg-card); border-radius: 16px;
  border: 1px solid var(--border); margin-bottom: 10px;
  overflow: hidden; box-shadow: var(--shadow-sm);
  transition: all 0.2s, background 0.3s, border-color 0.3s;
}
.meal-card:active { transform: scale(0.99); }
.meal-card-header {
  display: flex; align-items: center; gap: 12px;
  padding: 14px 16px; cursor: pointer;
}
.meal-card-icon {
  width: 40px; height: 40px; border-radius: 12px;
  background: var(--accent-light); color: var(--accent);
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  flex-shrink: 0;
}
.meal-card-info { flex: 1; }
.meal-card-info strong { font-size: 14px; color: var(--text-primary); display: block; }
.meal-card-info span { font-size: 12px; color: var(--text-secondary); }
.meal-card-meta { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.meal-kcal { font-size: 14px; font-weight: 700; color: var(--text-primary); }
.meal-keto-tag {
  font-size: 10px; font-weight: 700; color: var(--success);
  background: var(--success-light); padding: 2px 7px; border-radius: 10px;
}
.meal-chevron { color: var(--text-muted); font-size: 12px; margin-left: 4px; }

/* Quick actions */
.quick-actions { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; }
.quick-card {
  background: var(--bg-card); border-radius: 14px; border: 1px solid var(--border);
  padding: 14px 8px; display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  box-shadow: var(--shadow-sm); transition: all 0.2s, background 0.3s;
}
.quick-card i { font-size: 22px; color: var(--accent); }
.quick-card:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent-text); }

/* ----------------------------------------------------------------
   16. MEAL DETAIL
---------------------------------------------------------------- */
.meal-macro-bar {
  display: flex; gap: 8px; padding: 14px 0 8px;
  flex-wrap: wrap;
}
.macro-pill {
  background: var(--bg-input); border-radius: 10px;
  padding: 6px 12px; font-size: 12px; font-weight: 600;
  color: var(--text-secondary); border: 1px solid var(--border);
  display: flex; align-items: center; gap: 5px;
}
.macro-pill i { font-size: 10px; }
.macro-pill--fat i { color: var(--fat-color); }
.macro-pill--protein i { color: var(--protein-color); }
.macro-pill--carbs i { color: var(--carb-color); }
.macro-pill--kcal i { color: var(--accent2); }

.meal-keto-badge {
  background: var(--success-light); color: var(--success);
  border-radius: 10px; padding: 8px 12px;
  font-size: 12px; font-weight: 600;
  display: flex; align-items: center; gap: 6px;
  margin-bottom: 14px;
}

.ingredients-label-row {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px;
}
.ingredients-label-row span { font-size: 13px; font-weight: 700; color: var(--text-primary); }
.ingredients-hint { font-size: 11px; color: var(--text-muted); display: flex; align-items: center; gap: 4px; }

/* Ingredient rows */
.ingredient-list { display: flex; flex-direction: column; gap: 4px; }
.ingredient-row {
  display: flex; align-items: center; gap: 10px;
  background: var(--bg-card); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 11px 13px;
  cursor: pointer; transition: all 0.15s, background 0.3s, border-color 0.3s;
  user-select: none; -webkit-user-select: none;
}
.ingredient-row:active { transform: scale(0.99); }
.ingredient-row.long-press-active { background: var(--selected-tint) !important; border-color: var(--accent); }
.ingredient-row.selected {
  background: var(--selected-tint); border-color: var(--accent);
}
.ingredient-row.selection-mode:not(.selected) { opacity: 0.7; }

.ing-emoji { font-size: 20px; flex-shrink: 0; }
.ing-info { flex: 1; min-width: 0; }
.ing-name { font-size: 13px; font-weight: 600; color: var(--text-primary); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ing-macros { font-size: 11px; color: var(--text-muted); margin-top: 1px; }
.ing-qty { font-size: 12px; font-weight: 600; color: var(--text-secondary); flex-shrink: 0; }
.ing-check { width: 22px; height: 22px; border-radius: 50%; border: 2px solid var(--border); flex-shrink: 0; display: flex; align-items: center; justify-content: center; transition: all 0.2s; }
.ingredient-row.selected .ing-check { background: var(--accent); border-color: var(--accent); color: #fff; }
.ingredient-row.selected .ing-check::after { content: '✓'; font-size: 12px; font-weight: 700; }

.btn-add-ingredient {
  width: 100%; margin-top: 10px;
  padding: 12px; border-radius: 12px;
  background: var(--accent-light); color: var(--accent);
  font-size: 14px; font-weight: 600;
  border: 1.5px dashed var(--accent);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.2s;
}
.btn-add-ingredient:hover { background: var(--accent); color: #fff; }

.btn-modify-ai {
  width: 100%; margin-top: 8px;
  padding: 12px; border-radius: 12px;
  background: var(--bg-input); color: var(--text-secondary);
  font-size: 14px; font-weight: 600;
  border: 1.5px solid var(--border);
  display: flex; align-items: center; justify-content: center; gap: 6px;
  transition: all 0.2s;
}
.btn-modify-ai:hover { background: var(--accent); color: #fff; border-color: var(--accent); }

/* Preparation */
.prep-section { margin-top: 18px; }
.prep-section h4 { font-size: 14px; font-weight: 700; color: var(--text-primary); margin-bottom: 10px; }
.prep-step { display: flex; gap: 10px; margin-bottom: 10px; }
.prep-num {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.prep-text { font-size: 13px; color: var(--text-secondary); line-height: 1.5; padding-top: 3px; }

.save-prompt {
  display: flex; align-items: center; gap: 12px;
  background: var(--accent-light); border: 1px solid var(--accent);
  border-radius: 14px; padding: 14px 16px; margin-top: 16px;
}
.save-prompt i { font-size: 22px; color: var(--warning); }
.save-prompt div { flex: 1; }
.save-prompt strong { display: block; font-size: 13px; color: var(--text-primary); }
.save-prompt span { font-size: 12px; color: var(--text-secondary); }

/* ----------------------------------------------------------------
   17. SELECTION ACTION BAR
---------------------------------------------------------------- */
.selection-action-bar {
  position: absolute; bottom: -100px; left: 0; right: 0;
  background: var(--bg-elevated);
  border-top: 1px solid var(--border);
  padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
  display: flex; align-items: center; justify-content: space-between;
  transition: bottom 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s, border-color 0.3s;
  z-index: 20;
}
.selection-action-bar.visible { bottom: 0; }
.selection-count { font-size: 14px; font-weight: 600; color: var(--text-primary); }
.selection-actions { display: flex; gap: 8px; align-items: center; }

.sel-btn {
  display: flex; align-items: center; gap: 5px;
  padding: 9px 16px; border-radius: 10px;
  font-size: 13px; font-weight: 600; transition: all 0.2s;
}
.sel-btn--delete { background: var(--danger-light); color: var(--danger); }
.sel-btn--replace { background: var(--accent-light); color: var(--accent); }
.sel-btn--cancel {
  background: var(--bg-input); color: var(--text-secondary);
  padding: 9px 12px;
}
.sel-btn:disabled { opacity: 0.4; cursor: not-allowed; }

/* ----------------------------------------------------------------
   18. BOTTOM SHEETS
---------------------------------------------------------------- */
.bottom-sheet {
  position: absolute; bottom: -100%; left: 0; right: 0;
  background: var(--sheet-bg); border-radius: 24px 24px 0 0;
  padding: 0 20px 24px; padding-bottom: calc(24px + env(safe-area-inset-bottom));
  z-index: 200; max-height: 90%;
  overflow-y: auto;
  transition: bottom 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
  box-shadow: 0 -4px 30px rgba(0,0,0,0.15);
}
.bottom-sheet.open { bottom: 0; }
.bottom-sheet::-webkit-scrollbar { display: none; }

.sheet-handle {
  width: 36px; height: 4px; border-radius: 2px;
  background: var(--border); margin: 12px auto 16px;
}
.sheet-title { font-size: 18px; font-weight: 800; color: var(--text-primary); margin-bottom: 6px; }
.sheet-sub { font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; }
.sheet-actions { display: flex; gap: 10px; margin: 12px 0; }
.sheet-actions .btn { flex: 1; }

/* ----------------------------------------------------------------
   19. THEME PANEL GRID
---------------------------------------------------------------- */
.theme-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.theme-option {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  background: var(--bg-input); border: 2px solid var(--border);
  border-radius: 14px; padding: 10px 6px 10px;
  font-size: 11px; font-weight: 600; color: var(--text-secondary);
  transition: all 0.2s; position: relative; cursor: pointer;
}
.theme-option.active { border-color: var(--accent); color: var(--accent); }
.theme-check {
  position: absolute; top: 6px; right: 6px;
  font-size: 12px; color: var(--accent); opacity: 0;
  transition: opacity 0.2s;
}
.theme-option.active .theme-check { opacity: 1; }

/* Theme preview thumbnails */
.theme-preview {
  width: 70px; height: 52px; border-radius: 8px;
  overflow: hidden; display: flex; flex-direction: column;
  gap: 4px; padding: 6px;
}
.tp-header { height: 10px; border-radius: 4px; background: rgba(255,255,255,0.6); }
.tp-card { height: 12px; border-radius: 4px; background: rgba(255,255,255,0.8); }
.tp-card--sm { height: 8px; width: 60%; background: rgba(255,255,255,0.5); }

.theme-preview--light  { background: linear-gradient(135deg, #f5f7fa, #e8edf5); }
.theme-preview--dark   { background: linear-gradient(135deg, #141420, #0a0a0f); }
.theme-preview--keto   { background: linear-gradient(135deg, #1a3520, #0d1f12); }
.theme-preview--purple { background: linear-gradient(135deg, #ede9fe, #fce7f3); }
.theme-preview--ocean  { background: linear-gradient(135deg, #e0f2fe, #cffafe); }
.theme-preview--sunset { background: linear-gradient(135deg, #ffedd5, #fef3c7); }

.theme-preview--light  .tp-header { background: #00c49a; }
.theme-preview--dark   .tp-header { background: #00d4aa; }
.theme-preview--keto   .tp-header { background: #4caf50; }
.theme-preview--purple .tp-header { background: #7c3aed; }
.theme-preview--ocean  .tp-header { background: #0284c7; }
.theme-preview--sunset .tp-header { background: #ea580c; }

/* ----------------------------------------------------------------
   20. QUANTITY CONTROL
---------------------------------------------------------------- */
.qty-row {
  display: flex; align-items: center; justify-content: center; gap: 16px;
  margin: 16px 0;
}
.qty-btn {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--bg-input); color: var(--accent);
  font-size: 18px; display: flex; align-items: center; justify-content: center;
  transition: all 0.2s;
}
.qty-btn:hover { background: var(--accent); color: #fff; }
.qty-display {
  display: flex; align-items: baseline; gap: 4px;
  background: var(--bg-input); border-radius: 14px; padding: 10px 20px;
}
.qty-display span:first-child { font-size: 28px; font-weight: 800; color: var(--text-primary); }
.qty-display span:last-child  { font-size: 14px; font-weight: 600; color: var(--text-muted); }

.edit-ing-macros {
  background: var(--bg-input); border-radius: 12px;
  padding: 10px 14px; margin-bottom: 12px;
  font-size: 12px; color: var(--text-secondary);
  display: flex; gap: 12px; flex-wrap: wrap;
}
.edit-ing-macros span strong { color: var(--text-primary); }

/* ----------------------------------------------------------------
   21. REPLACE SHEET
---------------------------------------------------------------- */
.replace-from {
  background: var(--warning-light); border-radius: 10px;
  padding: 8px 12px; font-size: 13px; color: var(--warning);
  margin-bottom: 12px;
}
.search-wrap {
  display: flex; align-items: center; gap: 8px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: 12px; padding: 10px 14px; margin-bottom: 6px;
}
.search-wrap i { color: var(--text-muted); }
.search-input {
  flex: 1; font-size: 14px; color: var(--text-primary);
  background: none;
}
.search-input::placeholder { color: var(--text-muted); }

.replace-list { display: flex; flex-direction: column; gap: 6px; max-height: 220px; overflow-y: auto; }
.replace-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  cursor: pointer; transition: all 0.2s;
  font-size: 13px; color: var(--text-primary);
}
.replace-item:hover { border-color: var(--accent); background: var(--accent-light); }
.replace-item.selected { border-color: var(--accent); background: var(--accent-light); }
.replace-item-name { flex: 1; font-weight: 500; }
.replace-item-macros { font-size: 11px; color: var(--text-muted); }
.replace-keto-badge { font-size: 10px; background: var(--success-light); color: var(--success); padding: 2px 6px; border-radius: 6px; }

.replace-compare {
  margin-top: 14px; border-top: 1px solid var(--border); padding-top: 14px;
}
.compare-row { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.compare-col { flex: 1; background: var(--bg-input); border-radius: 10px; padding: 10px; }
.compare-col--old { border: 1.5px solid var(--danger-light); }
.compare-col--new { border: 1.5px solid var(--success-light); }
.compare-col strong { display: block; font-size: 13px; color: var(--text-primary); margin-bottom: 4px; }
.compare-col span { font-size: 11px; color: var(--text-muted); display: block; }
.compare-arrow { color: var(--text-muted); font-size: 16px; }

/* ----------------------------------------------------------------
   22. ADD INGREDIENT LIST
---------------------------------------------------------------- */
.add-ing-list { display: flex; flex-direction: column; gap: 6px; max-height: 300px; overflow-y: auto; }
.add-ing-item {
  display: flex; align-items: center; gap: 10px;
  padding: 10px 12px; border-radius: 10px;
  background: var(--bg-input); border: 1.5px solid var(--border);
  cursor: pointer; transition: all 0.2s;
}
.add-ing-item:hover { border-color: var(--accent); background: var(--accent-light); }
.add-ing-item .ing-emoji { font-size: 20px; }
.add-ing-item .ing-info { flex: 1; }
.add-ing-item .ing-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.add-ing-item .ing-macros { font-size: 11px; color: var(--text-muted); }
.add-ing-item .add-plus {
  color: var(--accent); font-size: 18px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-light);
}

/* ----------------------------------------------------------------
   23. FAVOURITES SCREEN
---------------------------------------------------------------- */
.fav-card {
  background: var(--bg-card); border-radius: 16px;
  border: 1px solid var(--border); padding: 14px 16px;
  margin-bottom: 10px; display: flex; align-items: center; gap: 12px;
  cursor: pointer; box-shadow: var(--shadow-sm);
  transition: all 0.2s, background 0.3s, border-color 0.3s;
}
.fav-card:hover { border-color: var(--accent); }
.fav-icon { width: 44px; height: 44px; border-radius: 12px; background: var(--warning-light); color: var(--warning); display: flex; align-items: center; justify-content: center; font-size: 20px; }
.fav-info { flex: 1; }
.fav-info strong { display: block; font-size: 14px; color: var(--text-primary); }
.fav-info span { font-size: 12px; color: var(--text-secondary); }
.fav-remove { color: var(--danger); font-size: 18px; padding: 4px; }

/* ----------------------------------------------------------------
   24. PROFILE SCREEN
---------------------------------------------------------------- */
.profile-hero {
  text-align: center; padding: 20px 16px 14px;
}
.profile-avatar {
  width: 72px; height: 72px; border-radius: 36px; margin: 0 auto 10px;
  background: linear-gradient(135deg, var(--accent), var(--accent2));
  color: #fff; display: flex; align-items: center; justify-content: center;
  font-size: 30px;
}
.profile-hero h3 { font-size: 20px; font-weight: 800; color: var(--text-primary); }
.profile-hero p  { font-size: 13px; color: var(--text-secondary); margin-top: 4px; }

.profile-stats {
  display: flex; gap: 1px; background: var(--border);
  border-radius: 16px; overflow: hidden; margin: 0 0 16px;
  border: 1px solid var(--border);
}
.pstat {
  flex: 1; background: var(--bg-card); padding: 12px 8px; text-align: center;
  transition: background 0.3s;
}
.pstat strong { display: block; font-size: 16px; font-weight: 800; color: var(--accent); }
.pstat span { font-size: 11px; color: var(--text-muted); }

.profile-section { background: var(--bg-card); border-radius: 16px; border: 1px solid var(--border); margin-bottom: 12px; overflow: hidden; transition: background 0.3s; }
.profile-section h4 { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.5px; color: var(--text-muted); padding: 12px 16px 8px; }
.profile-row {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border-top: 1px solid var(--border); font-size: 14px; color: var(--text-primary);
}
.profile-row i { color: var(--accent); width: 16px; text-align: center; }
.profile-row span:first-of-type { flex: 1; }
.text-muted { color: var(--text-muted); font-size: 13px; }
.badge { padding: 3px 8px; border-radius: 8px; font-size: 11px; font-weight: 700; }
.badge--green { background: var(--success-light); color: var(--success); }

/* ----------------------------------------------------------------
   25. AI COACH PANEL
---------------------------------------------------------------- */
.ai-panel {
  position: absolute; inset: 0;
  background: var(--bg-surface);
  display: flex; flex-direction: column;
  z-index: 300; transform: translateY(100%);
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
}
.ai-panel.open { transform: translateY(0); }

.ai-panel-header {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px;
  padding-top: calc(14px + env(safe-area-inset-top));
  border-bottom: 1px solid var(--border); flex-shrink: 0;
  transition: border-color 0.3s;
}
.ai-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 18px;
  flex-shrink: 0;
}
.ai-panel-header div { flex: 1; }
.ai-panel-header strong { display: block; font-size: 15px; color: var(--text-primary); }
.ai-panel-header span { font-size: 12px; color: var(--success); }
.btn-close { color: var(--text-muted); font-size: 18px; padding: 4px; }

.ai-messages {
  flex: 1; overflow-y: auto; padding: 16px;
  display: flex; flex-direction: column; gap: 12px;
}
.ai-messages::-webkit-scrollbar { display: none; }

.ai-msg { display: flex; }
.ai-msg--bot .ai-msg-bubble {
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
}
.ai-msg--user .ai-msg-bubble {
  background: var(--accent); color: #fff;
  border-radius: 16px 16px 4px 16px; margin-left: auto;
}
.ai-msg-bubble {
  max-width: 82%; padding: 12px 14px;
  font-size: 14px; line-height: 1.5; color: var(--text-primary);
  transition: background 0.3s;
}
.ai-msg--user .ai-msg-bubble { color: #fff; }

.ai-typing { display: none; }
.ai-typing.visible { display: flex; }
.ai-typing-dots {
  display: flex; gap: 4px; align-items: center; padding: 14px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 16px 16px 16px 4px;
}
.ai-typing-dots span {
  width: 6px; height: 6px; border-radius: 50%; background: var(--text-muted);
  animation: typing-bounce 1.4s ease-in-out infinite;
}
.ai-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.ai-typing-dots span:nth-child(3) { animation-delay: 0.4s; }
@keyframes typing-bounce { 0%,60%,100%{transform:translateY(0)} 30%{transform:translateY(-6px)} }

.ai-suggestions {
  display: flex; gap: 8px; padding: 8px 16px;
  overflow-x: auto; flex-shrink: 0;
}
.ai-suggestions::-webkit-scrollbar { display: none; }
.ai-chip {
  flex-shrink: 0; background: var(--bg-input); border: 1px solid var(--border);
  border-radius: 20px; padding: 7px 14px;
  font-size: 12px; font-weight: 600; color: var(--text-secondary);
  white-space: nowrap; transition: all 0.2s;
}
.ai-chip:hover { background: var(--accent-light); border-color: var(--accent); color: var(--accent); }

.ai-input-row {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px; padding-bottom: calc(12px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border); flex-shrink: 0;
  transition: border-color 0.3s;
}
.ai-input {
  flex: 1; background: var(--bg-input); border: 1.5px solid var(--border);
  border-radius: 24px; padding: 10px 16px;
  font-size: 14px; color: var(--text-primary); transition: border-color 0.2s;
}
.ai-input:focus { border-color: var(--border-focus); }
.ai-input::placeholder { color: var(--text-muted); }
.ai-send {
  width: 42px; height: 42px; border-radius: 50%;
  background: var(--accent); color: #fff;
  display: flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0; transition: transform 0.2s;
}
.ai-send:hover { transform: scale(1.1); }

/* ----------------------------------------------------------------
   26. CONTEXT MENU
---------------------------------------------------------------- */
.context-menu {
  position: absolute; top: 70px; right: 16px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  border-radius: 14px; padding: 6px; z-index: 250;
  box-shadow: var(--shadow-lg); min-width: 200px;
  transform-origin: top right; transform: scale(0.9);
  opacity: 0; pointer-events: none;
  transition: all 0.18s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.3s;
}
.context-menu.open { transform: scale(1); opacity: 1; pointer-events: all; }
.context-item {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 14px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--text-primary);
  width: 100%; transition: background 0.15s;
}
.context-item i { width: 16px; color: var(--accent); }
.context-item:hover { background: var(--bg-input); }
.context-item--danger { color: var(--danger) !important; }
.context-item--danger i { color: var(--danger) !important; }

/* ----------------------------------------------------------------
   27. OVERLAYS & BACKDROP
---------------------------------------------------------------- */
.overlay-backdrop {
  position: absolute; inset: 0;
  background: var(--bg-overlay); z-index: 190;
  opacity: 0; pointer-events: none;
  transition: opacity 0.2s;
}
.overlay-backdrop.visible { opacity: 1; pointer-events: all; }

/* ----------------------------------------------------------------
   28. TOAST
---------------------------------------------------------------- */
.toast {
  position: absolute; bottom: 90px; left: 50%; transform: translateX(-50%) translateY(20px);
  background: var(--text-primary); color: var(--bg-base);
  padding: 10px 20px; border-radius: 24px;
  font-size: 13px; font-weight: 600;
  z-index: 400; white-space: nowrap;
  opacity: 0; transition: all 0.3s;
  pointer-events: none;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* ----------------------------------------------------------------
   29. CONFIRM DIALOG
---------------------------------------------------------------- */
.confirm-dialog {
  position: absolute; top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(0.9);
  background: var(--sheet-bg); border-radius: 20px;
  padding: 24px; width: calc(100% - 64px);
  z-index: 310; box-shadow: var(--shadow-lg);
  opacity: 0; pointer-events: none;
  transition: all 0.2s, background 0.3s;
  text-align: center;
}
.confirm-dialog.open { opacity: 1; pointer-events: all; transform: translate(-50%, -50%) scale(1); }
.confirm-dialog h4 { font-size: 18px; font-weight: 800; color: var(--text-primary); margin-bottom: 8px; }
.confirm-dialog p  { font-size: 14px; color: var(--text-secondary); margin-bottom: 20px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; }
.confirm-actions .btn { flex: 1; }
