/* ============================================================
   Reset & Base — Rubrik-inspired Dark Theme (Polished)
   ============================================================ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg-deep: #080c18;
    --bg: #0d1220;
    --bg-card: #151d32;
    --bg-card-hover: #1b2542;
    --bg-elevated: #1e2a48;
    --surface: #263352;
    --border: rgba(255,255,255,0.07);
    --border-hover: rgba(0,212,170,0.3);
    --teal: #00d4aa;
    --teal-dim: #00b894;
    --teal-bright: #00f5c8;
    --teal-glow: rgba(0,212,170,0.15);
    --teal-glow-strong: rgba(0,212,170,0.3);
    --cyan: #22d3ee;
    --purple: #a78bfa;
    --blue: #60a5fa;
    --orange: #fbbf24;
    --red: #f87171;
    --green: #4ade80;
    --text: #f1f5f9;
    --text-secondary: #94a3b8;
    --text-muted: #64748b;
    --radius: 16px;
    --radius-lg: 20px;
    --radius-xl: 28px;
    --shadow: 0 1px 3px rgba(0,0,0,0.4), 0 1px 2px rgba(0,0,0,0.3);
    --shadow-md: 0 4px 16px rgba(0,0,0,0.35), 0 1px 4px rgba(0,0,0,0.25);
    --shadow-lg: 0 12px 40px rgba(0,0,0,0.45), 0 4px 12px rgba(0,0,0,0.3);
    --shadow-xl: 0 24px 64px rgba(0,0,0,0.55), 0 8px 24px rgba(0,0,0,0.35);
    --shadow-teal: 0 0 24px rgba(0,212,170,0.12);
    --tab-height: 68px;
    --sidebar-width: 260px;
    --header-height: 64px;
    --glass-bg: rgba(13,18,32,0.75);
    --glass-border: rgba(255,255,255,0.06);
    --glass-shadow: 0 8px 32px rgba(0,0,0,0.3);
    --speed-fast: 0.15s;
    --speed: 0.25s;
    --speed-slow: 0.4s;
    --ease: cubic-bezier(0.4, 0, 0.2, 1);
}

/* Light theme overrides */
[data-theme="light"] {
    --bg-deep: #d6e8fa;
    --bg: #EAF4FF;
    --bg-card: #ffffff;
    --bg-card-hover: #e8f0fc;
    --bg-elevated: #dce8f8;
    --surface: #c8d8ec;
    --border: rgba(0,50,120,0.1);
    --border-hover: rgba(0,166,132,0.35);
    --teal: #009e7e;
    --teal-dim: #008a6e;
    --teal-bright: #00c49a;
    --teal-glow: rgba(0,140,110,0.12);
    --teal-glow-strong: rgba(0,140,110,0.22);
    --cyan: #0891b2;
    --purple: #7c3aed;
    --blue: #2563eb;
    --orange: #d97706;
    --red: #dc2626;
    --green: #16a34a;
    --text: #0f172a;
    --text-secondary: #334155;
    --text-muted: #64748b;
    --shadow: 0 1px 3px rgba(0,30,80,0.08), 0 1px 2px rgba(0,30,80,0.05);
    --shadow-md: 0 4px 16px rgba(0,30,80,0.08), 0 1px 4px rgba(0,30,80,0.05);
    --shadow-lg: 0 12px 40px rgba(0,30,80,0.1), 0 4px 12px rgba(0,30,80,0.06);
    --shadow-xl: 0 24px 64px rgba(0,30,80,0.12), 0 8px 24px rgba(0,30,80,0.08);
    --shadow-teal: 0 0 24px rgba(0,140,110,0.1);
    --glass-bg: rgba(255,255,255,0.88);
    --glass-border: rgba(0,50,120,0.08);
    --glass-shadow: 0 8px 32px rgba(0,30,80,0.08);
}

[data-theme="light"] ::selection { background: rgba(0,140,110,0.2); color: var(--text); }
[data-theme="light"] ::-webkit-scrollbar-thumb { background: rgba(0,30,80,0.15); }
[data-theme="light"] ::-webkit-scrollbar-thumb:hover { background: rgba(0,30,80,0.25); }

/* Profile dropdown */
[data-theme="light"] .profile-dropdown {
    background: #fff;
    border-color: rgba(0,50,120,0.12);
    box-shadow: 0 20px 60px rgba(0,30,80,0.14), 0 0 1px rgba(0,0,0,0.08);
}
[data-theme="light"] .profile-menu-item { color: var(--text-secondary); }
[data-theme="light"] .profile-menu-item:hover { background: #e8f0fc; color: var(--text); }
[data-theme="light"] .profile-menu-item svg { color: var(--text-muted); }
[data-theme="light"] .profile-field input,
[data-theme="light"] .profile-field select {
    background: #f0f5ff;
    border-color: rgba(0,50,120,0.12);
    color: var(--text);
}
[data-theme="light"] .profile-field select option { background: #fff; color: var(--text); }

/* Sidebar */
[data-theme="light"] .sidebar { background: #fff; border-color: rgba(0,50,120,0.08); }
[data-theme="light"] .sidebar-tab { color: var(--text-secondary); }
[data-theme="light"] .sidebar-tab svg { color: var(--text-muted); }
[data-theme="light"] .sidebar-tab:hover { background: #e8f0fc; color: var(--text); }
[data-theme="light"] .sidebar-tab.active {
    color: #0f172a !important;
    background: linear-gradient(135deg, rgba(0,140,110,0.12), rgba(8,145,178,0.08)) !important;
    border-color: rgba(0,140,110,0.2) !important;
}
[data-theme="light"] .sidebar-tab.active svg { color: var(--teal); }

/* Header + bottom tabs */
[data-theme="light"] .app-header { background: rgba(255,255,255,0.92); border-color: rgba(0,50,120,0.08); }
[data-theme="light"] .user-name { color: var(--text) !important; }
[data-theme="light"] .bottom-tabs { background: rgba(255,255,255,0.96); border-color: rgba(0,50,120,0.08); }
[data-theme="light"] .tab-btn { color: var(--text-muted); }
[data-theme="light"] .tab-btn.active { color: var(--teal); }

/* Cards */
[data-theme="light"] .card, [data-theme="light"] .stat-card,
[data-theme="light"] .insight-card, [data-theme="light"] .feature-card {
    background: #fff;
    border-color: rgba(0,50,120,0.08);
    box-shadow: 0 1px 4px rgba(0,30,80,0.06);
}
[data-theme="light"] .stat-card:hover, [data-theme="light"] .feature-card:hover {
    background: #f0f5ff;
    border-color: rgba(0,50,120,0.14);
}

/* Log food card */
[data-theme="light"] .logfood-card {
    background: #fff;
    border: 1px solid rgba(0,50,120,0.12);
    box-shadow: 0 2px 8px rgba(0,30,80,0.06);
}
[data-theme="light"] .logfood-card:hover {
    border-color: var(--teal);
    box-shadow: 0 8px 24px rgba(0,30,80,0.1);
}

/* Form inputs */
[data-theme="light"] input, [data-theme="light"] textarea, [data-theme="light"] select {
    background: #f0f5ff;
    border-color: rgba(0,50,120,0.12);
    color: var(--text);
}
[data-theme="light"] input:focus, [data-theme="light"] textarea:focus, [data-theme="light"] select:focus {
    border-color: var(--teal);
    background: #fff;
}
[data-theme="light"] input::placeholder, [data-theme="light"] textarea::placeholder {
    color: var(--text-muted);
}

/* More drawer + modal */
[data-theme="light"] .more-drawer { background: #fff; border-color: rgba(0,50,120,0.1); }
[data-theme="light"] .more-drawer-item { color: var(--text-secondary); }
[data-theme="light"] .more-drawer-item:hover { background: #e8f0fc; color: var(--text); }
[data-theme="light"] .modal-overlay { background: rgba(0,20,60,0.3); }

/* Coach panel */
[data-theme="light"] .coach-panel { background: #fff; border-color: rgba(0,50,120,0.1); }
[data-theme="light"] .coach-messages { background: #f0f5ff; }
[data-theme="light"] .coach-msg.assistant .coach-msg-bubble { background: #fff; border: 1px solid rgba(0,50,120,0.08); color: var(--text); }
[data-theme="light"] .coach-msg.user .coach-msg-bubble { background: var(--teal); color: #fff; }
[data-theme="light"] .coach-input-area { background: #fff; border-color: rgba(0,50,120,0.1); }
[data-theme="light"] .coach-input { background: #f0f5ff; color: var(--text); }

/* SVG ring tracks */
[data-theme="light"] .ring-track { stroke: rgba(0,50,120,0.08); }
[data-theme="light"] .ring-cal .ring-track  { stroke: rgba(0,180,148,0.1); }
[data-theme="light"] .ring-prot .ring-track { stroke: rgba(37,99,235,0.1); }
[data-theme="light"] .ring-fat .ring-track  { stroke: rgba(217,119,6,0.1); }
[data-theme="light"] .ring-carbs .ring-track{ stroke: rgba(124,58,237,0.1); }
[data-theme="light"] .ring-water .ring-track{ stroke: rgba(8,145,178,0.1); }
[data-theme="light"] .mini-ring-svg { filter: drop-shadow(0 0 6px var(--ring-glow, rgba(0,50,120,0.08))); }

/* Progress bars + nutrient labels */
[data-theme="light"] .progress-bar { background: #dce8f8; }
[data-theme="light"] .nutrient-name { color: var(--text); }
[data-theme="light"] .nutrient-value { color: var(--text-secondary); }

/* Misc */
[data-theme="light"] .barcode-overlay { background: rgba(255,255,255,0.96); }
[data-theme="light"] .section-title, [data-theme="light"] h2, [data-theme="light"] h3 { color: var(--text); }
[data-theme="light"] .meal-section-title { color: var(--text); }
[data-theme="light"] .food-entry { background: #fff; border-color: rgba(0,50,120,0.06); }
[data-theme="light"] .food-entry:hover { background: #f0f5ff; }
[data-theme="light"] .empty-state { color: var(--text-muted); }
[data-theme="light"] .btn-outline { border-color: rgba(0,50,120,0.15); color: var(--text-secondary); }
[data-theme="light"] .btn-outline:hover { background: #e8f0fc; color: var(--text); }

/* Footer */
[data-theme="light"] .app-footer { background: rgba(255,255,255,0.9); border-color: rgba(0,50,120,0.08); }
[data-theme="light"] .app-footer-links a { color: var(--text-muted); }
[data-theme="light"] .app-footer-copy { color: var(--text-muted); }
[data-theme="light"] .landing-footer { background: #dce8f8; }
[data-theme="light"] .landing-footer .footer-brand span { color: var(--text); }
[data-theme="light"] .footer-bottom { border-color: rgba(0,50,120,0.08); }

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 100px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.14); }

/* Selection */
::selection { background: rgba(0,212,170,0.25); color: var(--text); }
::-moz-selection { background: rgba(0,212,170,0.25); color: var(--text); }

/* Focus-visible accessibility ring */
:focus-visible {
    outline: 2px solid var(--teal);
    outline-offset: 2px;
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: var(--bg);
    color: var(--text);
    line-height: 1.6;
    min-height: 100vh;
    overflow-x: hidden;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.hidden { display: none !important; }

/* ============================================================
   Animations
   ============================================================ */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(20px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

@keyframes slideInLeft {
    from { opacity: 0; transform: translateX(-16px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
    from { opacity: 0; transform: scale(0.95); }
    to { opacity: 1; transform: scale(1); }
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes pulseGlow {
    0%, 100% { box-shadow: 0 0 15px rgba(0,212,170,0.1); }
    50% { box-shadow: 0 0 30px rgba(0,212,170,0.25); }
}

@keyframes float {
    0%, 100% { transform: translateY(0); }
    50% { transform: translateY(-8px); }
}

@keyframes glowPulse {
    0%, 100% { opacity: 0.4; }
    50% { opacity: 0.8; }
}

@keyframes viewEnter {
    from { opacity: 0; transform: translateY(12px); }
    to { opacity: 1; transform: translateY(0); }
}

@keyframes orbFloat1 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(30px, -20px) scale(1.05); }
    66% { transform: translate(-15px, 15px) scale(0.95); }
}
@keyframes orbFloat2 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    33% { transform: translate(-25px, 20px) scale(0.95); }
    66% { transform: translate(20px, -10px) scale(1.05); }
}
@keyframes orbFloat3 {
    0%, 100% { transform: translate(0, 0) scale(1); }
    50% { transform: translate(-20px, -15px) scale(1.08); }
}

@keyframes barShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

@keyframes btnRipple {
    to { transform: scale(4); opacity: 0; }
}

/* ringGlow removed — using static drop-shadow with hover transition */

@keyframes skeletonShimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

.animate-fade-in-up {
    animation: fadeInUp 0.5s ease-out both;
}

.animate-stagger-1 { animation-delay: 0.05s; }
.animate-stagger-2 { animation-delay: 0.1s; }
.animate-stagger-3 { animation-delay: 0.15s; }
.animate-stagger-4 { animation-delay: 0.2s; }
.animate-stagger-5 { animation-delay: 0.25s; }
.animate-stagger-6 { animation-delay: 0.3s; }
.animate-stagger-7 { animation-delay: 0.35s; }
.animate-stagger-8 { animation-delay: 0.4s; }

/* ============================================================
   Landing Page — Navbar
   ============================================================ */
.landing-nav {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 100;
    background: rgba(8,12,24,0.82);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border-bottom: 1px solid var(--border);
}

.landing-nav-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.5rem;
}

.landing-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.brand-icon { flex-shrink: 0; line-height: 0; }

.brand-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}

.btn-signin {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1.25rem;
    background: rgba(255,255,255,0.04);
    color: var(--text);
    border: 1px solid var(--border);
    border-radius: 100px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
    font-family: inherit;
}
.btn-signin:hover {
    background: rgba(0,212,170,0.1);
    border-color: var(--border-hover);
    box-shadow: var(--shadow-teal);
}
.btn-signin:active {
    transform: scale(0.97);
}

/* ============================================================
   Hero Section
   ============================================================ */
.hero {
    padding: 7rem 1.5rem 3rem;
    background:
        radial-gradient(ellipse at 20% 40%, rgba(0,212,170,0.08) 0%, transparent 60%),
        radial-gradient(ellipse at 80% 20%, rgba(59,130,246,0.06) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 90%, rgba(139,92,246,0.05) 0%, transparent 50%),
        linear-gradient(180deg, var(--bg-deep) 0%, var(--bg) 100%);
    overflow: hidden;
    position: relative;
}

.hero-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3rem;
}

.hero-text {
    text-align: center;
    max-width: 600px;
    animation: fadeInUp 0.7s ease-out;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.35rem 1rem;
    background: rgba(0,212,170,0.1);
    color: var(--teal);
    border-radius: 100px;
    font-size: 0.8rem;
    font-weight: 600;
    margin-bottom: 1.5rem;
    border: 1px solid rgba(0,212,170,0.2);
    animation: fadeInUp 0.5s ease-out;
}

.hero-text h1 {
    font-size: 2.75rem;
    font-weight: 800;
    line-height: 1.15;
    color: var(--text);
    letter-spacing: -0.03em;
    margin-bottom: 1.25rem;
}

.text-gradient {
    background: linear-gradient(135deg, #00d4aa, #06b6d4, #3b82f6, #00d4aa);
    background-size: 300% auto;
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    animation: shimmer 5s linear infinite;
}

.hero-desc {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.7;
    margin-bottom: 2rem;
}

.btn-hero {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.875rem 2rem;
    background: linear-gradient(135deg, #00d4aa, #00b894);
    color: #080c14;
    border: none;
    border-radius: 100px;
    font-size: 1.05rem;
    font-weight: 700;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
    box-shadow: 0 4px 24px rgba(0,212,170,0.35);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}
.btn-hero::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
    transition: left 0.5s;
}
.btn-hero:hover::before {
    left: 100%;
}
.btn-hero:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 32px rgba(0,212,170,0.45);
}
.btn-hero:active {
    transform: translateY(0) scale(0.97);
}

/* Hero animated gradient orbs */
.hero-orbs {
    position: absolute;
    inset: 0;
    overflow: hidden;
    pointer-events: none;
    z-index: 0;
}
.hero-orb {
    position: absolute;
    border-radius: 50%;
    filter: blur(80px);
    opacity: 0.5;
}
.hero-orb-1 {
    width: 320px;
    height: 320px;
    background: radial-gradient(circle, rgba(0,212,170,0.18) 0%, transparent 70%);
    top: 10%;
    left: 10%;
    animation: orbFloat1 8s ease-in-out infinite;
}
.hero-orb-2 {
    width: 260px;
    height: 260px;
    background: radial-gradient(circle, rgba(59,130,246,0.15) 0%, transparent 70%);
    top: 50%;
    right: 15%;
    animation: orbFloat2 10s ease-in-out infinite;
}
.hero-orb-3 {
    width: 200px;
    height: 200px;
    background: radial-gradient(circle, rgba(139,92,246,0.12) 0%, transparent 70%);
    bottom: 15%;
    left: 40%;
    animation: orbFloat3 12s ease-in-out infinite;
}

.hero-visual {
    width: 100%;
    max-width: 520px;
    animation: fadeInUp 0.9s ease-out 0.2s both;
}

.hero-mockup {
    position: relative;
}

.mockup-svg {
    width: 100%;
    height: auto;
    filter: drop-shadow(0 24px 48px rgba(0,0,0,0.4));
    transition: filter var(--speed-slow);
}
.mockup-svg:hover {
    filter: drop-shadow(0 28px 56px rgba(0,212,170,0.15));
}

@media (min-width: 900px) {
    .hero {
        padding: 8rem 2rem 5rem;
    }
    .hero-inner {
        flex-direction: row;
        align-items: center;
        gap: 4rem;
    }
    .hero-text {
        text-align: left;
        flex: 1;
    }
    .hero-text h1 {
        font-size: 3.5rem;
    }
    .hero-visual {
        flex: 1;
        max-width: 540px;
    }
}

/* ============================================================
   Features Section
   ============================================================ */
.features-section {
    padding: 4rem 1.5rem;
    background: var(--bg-deep);
    position: relative;
}

.features-inner {
    max-width: 1000px;
    margin: 0 auto;
}

.features-title {
    font-size: 1.75rem;
    font-weight: 700;
    text-align: center;
    margin-bottom: 2.5rem;
    letter-spacing: -0.02em;
    color: var(--text);
}

.features-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

.feature-card {
    padding: 1.75rem;
    border-radius: var(--radius-lg);
    border: 1px solid var(--border);
    background: var(--bg-card);
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.04);
    transition: all var(--speed-slow) var(--ease);
    position: relative;
    overflow: hidden;
}
.feature-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--teal), var(--cyan));
    opacity: 0;
    transition: opacity var(--speed-slow);
}
.feature-card:hover::before {
    opacity: 1;
}
.feature-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 16px 48px rgba(0,212,170,0.08), inset 0 1px 0 rgba(255,255,255,0.04);
    transform: translateY(-4px);
}

.feature-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1rem;
    transition: transform var(--speed);
}
.feature-card:hover .feature-icon {
    transform: scale(1.08);
}
.fi-green { background: rgba(0,212,170,0.1); color: var(--teal); }
.fi-orange { background: rgba(245,158,11,0.1); color: var(--orange); }
.fi-blue { background: rgba(59,130,246,0.1); color: var(--blue); }

.feature-card h3 {
    font-size: 1.05rem;
    font-weight: 700;
    margin-bottom: 0.5rem;
    color: var(--text);
}

.feature-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
}

@media (min-width: 640px) {
    .features-grid {
        grid-template-columns: 1fr 1fr;
    }
}

/* ============================================================
   Landing Footer
   ============================================================ */
.landing-footer {
    background: var(--bg-deep);
    color: var(--text-muted);
    padding: 3rem 1.5rem 0;
    border-top: 1px solid var(--border);
}

.footer-grid {
    max-width: 1000px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr;
    gap: 2rem;
    padding-bottom: 2.5rem;
}

.footer-brand {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}
.footer-brand span {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
}
.footer-tagline {
    font-size: 0.85rem;
    line-height: 1.6;
    color: var(--text-muted);
    max-width: 280px;
}

.footer-links-col h4 {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.75rem;
}
.footer-links-col ul {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.footer-links-col li {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.footer-links-col a {
    color: var(--text-muted);
    text-decoration: none;
    transition: color var(--speed-fast);
}
.footer-links-col a:hover {
    color: var(--teal);
}

.footer-bottom {
    border-top: 1px solid var(--border);
    padding: 1.25rem 0;
    text-align: center;
    font-size: 0.8rem;
    color: var(--text-muted);
}

@media (min-width: 640px) {
    .footer-grid {
        grid-template-columns: 2fr 1fr 1fr 1fr;
        gap: 2.5rem;
    }
}

/* ============================================================
   Buttons (App)
   ============================================================ */
.btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: none;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
    font-family: inherit;
    position: relative;
    overflow: hidden;
}
.btn:disabled { opacity: 0.35; cursor: not-allowed; pointer-events: none; }

.btn-primary {
    background: linear-gradient(135deg, #00d4aa 0%, #00b894 100%);
    color: #080c14;
    box-shadow: 0 2px 12px rgba(0,212,170,0.3);
}
.btn-primary::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
    transition: left var(--speed-slow);
}
.btn-primary:hover::before:not(:disabled) {
    left: 100%;
}
.btn-primary:hover:not(:disabled) {
    box-shadow: 0 6px 24px rgba(0,212,170,0.4);
    transform: translateY(-1px);
}
.btn-primary:active:not(:disabled) {
    transform: translateY(0) scale(0.97);
}
.btn-primary:focus-visible {
    outline: 2px solid var(--teal-bright);
    outline-offset: 2px;
}

.btn-secondary {
    background: transparent;
    color: var(--teal);
    border: 1.5px solid rgba(0,212,170,0.3);
}
.btn-secondary:hover {
    background: rgba(0,212,170,0.08);
    border-color: var(--teal);
    transform: translateY(-1px);
}
.btn-secondary:active {
    transform: translateY(0) scale(0.97);
}

.btn-large {
    width: 100%;
    justify-content: center;
    padding: 1rem;
    font-size: 1.05rem;
    border-radius: var(--radius);
}

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-secondary);
    padding: 0.4rem;
    border-radius: 10px;
    transition: all var(--speed-fast);
}
.btn-icon:hover { color: var(--text); background: rgba(255,255,255,0.06); }

.btn-delete {
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 1.5rem;
    line-height: 1;
    padding: 0.25rem 0.5rem;
    border-radius: 10px;
    transition: all var(--speed-fast);
}
.btn-delete:hover { color: var(--red); background: rgba(239,68,68,0.1); }

/* ============================================================
   App Header
   ============================================================ */
.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 1.25rem;
    height: var(--header-height);
    background: rgba(8,12,24,0.88);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.app-header h2 {
    font-size: 1.15rem;
    color: var(--text);
    font-weight: 700;
    letter-spacing: -0.02em;
}
.user-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    position: relative;
}
.user-name {
    font-size: 0.875rem;
    font-weight: 500;
    color: var(--text-secondary);
    display: none;
}
.avatar {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(0,212,170,0.3);
    box-shadow: 0 0 12px rgba(0,212,170,0.15);
    transition: transform var(--speed), box-shadow var(--speed);
}
.avatar-wrapper {
    cursor: pointer;
    position: relative;
}
.avatar:hover {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(0,212,170,0.3);
}
.avatar-initial {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 2px solid rgba(0,212,170,0.3);
    box-shadow: 0 0 12px rgba(0,212,170,0.15);
    background: linear-gradient(135deg, var(--teal), var(--cyan));
    color: #080c14;
    font-size: 0.95rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: transform var(--speed), box-shadow var(--speed);
}
.avatar-initial:hover {
    transform: scale(1.08);
    box-shadow: 0 0 20px rgba(0,212,170,0.3);
}

/* Profile Dropdown */
.profile-dropdown {
    position: absolute;
    top: calc(100% + 0.5rem);
    right: 0;
    width: 280px;
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-lg);
    box-shadow: 0 20px 60px rgba(0,0,0,0.55), 0 0 1px rgba(255,255,255,0.05);
    z-index: 200;
    animation: scaleIn 0.2s ease-out;
    overflow: hidden;
    padding: 0.35rem 0;
}
/* Profile menu items */
.profile-menu-item {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    width: 100%;
    padding: 0.7rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all var(--speed-fast);
}
.profile-menu-item:hover {
    background: rgba(0,212,170,0.06);
    color: var(--text);
}
.profile-menu-item svg { flex-shrink: 0; color: var(--text-muted); transition: color var(--speed-fast); }
.profile-menu-item:hover svg { color: var(--teal); }
.profile-menu-logout:hover { color: var(--red); }
.profile-menu-logout:hover svg { color: var(--red); }
.profile-menu-divider {
    height: 1px;
    background: var(--border);
    margin: 0.25rem 0;
}
.profile-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}
.profile-field input,
.profile-field select {
    padding: 0.6rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.9rem;
    font-family: inherit;
    background: rgba(255,255,255,0.03);
    color: var(--text);
    transition: all var(--speed) var(--ease);
}
.profile-field input:focus,
.profile-field select:focus {
    outline: none;
    border-color: var(--teal);
    background: rgba(0,212,170,0.03);
    box-shadow: 0 0 0 4px rgba(0,212,170,0.1);
}
.profile-field select option {
    background: var(--bg-card);
    color: var(--text);
}
.btn-save-profile {
    margin-top: 0.25rem;
    padding: 0.6rem 1.5rem;
    font-size: 0.9rem;
    align-self: flex-start;
}
.profile-dropdown-overlay {
    position: fixed;
    inset: 0;
    z-index: 199;
}

/* ============================================================
   Onboarding Modal
   ============================================================ */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    z-index: 500;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    animation: fadeIn 0.3s ease-out;
}
.modal-overlay.hidden { display: none !important; }
.modal-card {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    padding: 2.5rem 2rem;
    max-width: 400px;
    width: 100%;
    box-shadow: 0 32px 80px rgba(0,0,0,0.65), 0 0 1px rgba(255,255,255,0.06), inset 0 1px 0 rgba(255,255,255,0.05);
    animation: scaleIn 0.3s ease-out;
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
}
.modal-icon { margin-bottom: 1.25rem; }
.modal-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.5rem;
    letter-spacing: -0.02em;
}
.modal-desc {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: 1.5rem;
}
.modal-fields {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1.25rem;
    text-align: left;
}

/* Analysis empty state */
.analysis-no-food {
    text-align: center;
    padding: 3rem 1.5rem;
    animation: fadeInUp 0.5s ease-out;
}
.no-food-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    opacity: 0.6;
}
.no-food-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.5rem;
}
.no-food-desc {
    font-size: 0.9rem;
    color: var(--text-muted);
    max-width: 320px;
    margin: 0 auto;
    line-height: 1.6;
}

/* Analysis profile hint */
.analysis-profile-hint {
    background: rgba(245,158,11,0.08);
    border-left: 3px solid var(--orange);
    padding: 0.75rem 1rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: var(--orange);
}

@media (min-width: 768px) {
    .app-header {
        padding: 0 1.5rem;
    }
    .user-name {
        display: inline;
    }
}

/* ============================================================
   App Layout — Sidebar + Content
   ============================================================ */
.app-layout {
    display: flex;
    min-height: calc(100vh - var(--header-height));
    background:
        radial-gradient(ellipse at 10% 20%, rgba(0,212,170,0.03) 0%, transparent 50%),
        radial-gradient(ellipse at 90% 80%, rgba(59,130,246,0.03) 0%, transparent 50%),
        var(--bg);
}

.sidebar {
    display: none;
}

.main-content {
    flex: 1;
    min-width: 0;
}

@media (min-width: 768px) {
    .sidebar {
        display: flex;
        flex-direction: column;
        width: var(--sidebar-width);
        background: rgba(8,12,24,0.65);
        backdrop-filter: blur(16px);
        -webkit-backdrop-filter: blur(16px);
        border-right: 1px solid var(--border);
        padding: 1.25rem 0.75rem;
        position: sticky;
        top: var(--header-height);
        height: calc(100vh - var(--header-height));
        flex-shrink: 0;
        gap: 0.25rem;
    }

    .sidebar-tab {
        display: flex;
        align-items: center;
        gap: 0.75rem;
        padding: 0.75rem 1rem;
        background: none;
        border: none;
        cursor: pointer;
        color: var(--text-secondary);
        font-size: 0.9rem;
        font-weight: 500;
        text-align: left;
        transition: all var(--speed) var(--ease);
        border-radius: 12px;
        font-family: inherit;
        position: relative;
    }
    .sidebar-tab:hover {
        background: rgba(0,212,170,0.06);
        color: var(--text);
    }
    .sidebar-tab.active {
        color: #fff;
        background: linear-gradient(135deg, rgba(0,212,170,0.18), rgba(6,182,212,0.12));
        font-weight: 600;
        border: 1px solid rgba(0,212,170,0.15);
        box-shadow: 0 2px 12px rgba(0,212,170,0.1), inset 0 1px 0 rgba(255,255,255,0.05);
    }
    .sidebar-tab.active::before {
        content: '';
        position: absolute;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        width: 3px;
        height: 24px;
        background: linear-gradient(180deg, var(--teal), var(--cyan));
        border-radius: 0 3px 3px 0;
    }
    .sidebar-tab svg { stroke: currentColor; flex-shrink: 0; }

    .tab-bar {
        display: none !important;
    }
}

/* ============================================================
   Views & Content
   ============================================================ */
.view { display: none; }
.view.active { display: block; animation: viewEnter 0.35s ease-out; }

#login-view.active { display: flex; flex-direction: column; }

.view-content {
    padding: 1.5rem 1rem calc(var(--tab-height) + 1.5rem);
    max-width: 1200px;
    margin: 0 auto;
}

.view-content h3 {
    font-size: 1.4rem;
    font-weight: 700;
    margin-bottom: 1.25rem;
    letter-spacing: -0.025em;
    color: var(--text);
    animation: fadeInUp 0.4s ease-out;
}
.view-content h4 {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 1.5rem 0 0.75rem;
    font-weight: 600;
}

.card-section-title {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin: 0 0 0.75rem;
    font-weight: 600;
}

@media (min-width: 768px) {
    .view-content {
        padding: 2rem 2rem 2rem;
    }
}

/* ============================================================
   Macro Rings (Calories, Protein, Fat)
   ============================================================ */
.macro-rings {
    display: flex;
    justify-content: center;
    gap: 2rem;
    flex-wrap: wrap;
    margin-bottom: 1.75rem;
    padding: 1.25rem 0;
    animation: fadeInUp 0.5s ease-out;
}

.macro-ring-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
}
.macro-ring-item:hover .mini-ring-container {
    transform: scale(1.06);
}
.macro-ring-item:hover .mini-ring-svg {
    filter: drop-shadow(0 0 16px var(--ring-glow, rgba(255,255,255,0.15)));
}

.mini-ring-container {
    position: relative;
    width: 130px;
    height: 130px;
    transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mini-ring-svg {
    width: 100%;
    height: 100%;
    filter: drop-shadow(0 0 8px var(--ring-glow, rgba(255,255,255,0.08)));
    transition: filter 0.35s ease;
}
.mini-ring-svg circle {
    stroke-width: 10;
    transition: stroke-dashoffset 1.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Ring color definitions — glow + tinted track */
.ring-cal  { --ring-glow: rgba(0,245,200,0.3);   --ring-track: rgba(0,245,200,0.07); }
.ring-prot { --ring-glow: rgba(96,165,250,0.3);   --ring-track: rgba(96,165,250,0.07); }
.ring-fat  { --ring-glow: rgba(251,191,36,0.3);   --ring-track: rgba(251,191,36,0.07); }
.ring-carbs{ --ring-glow: rgba(192,132,252,0.3);   --ring-track: rgba(192,132,252,0.07); }
.ring-water{ --ring-glow: rgba(34,211,238,0.3);    --ring-track: rgba(34,211,238,0.07); }

/* Color-tinted track per ring */
.ring-cal .ring-track,
.ring-prot .ring-track,
.ring-fat .ring-track,
.ring-carbs .ring-track,
.ring-water .ring-track {
    stroke: var(--ring-track);
}

.mini-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px;
    line-height: 1.15;
}
.mini-ring-value {
    font-size: 1.5rem;
    font-weight: 700;
    letter-spacing: -0.02em;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.mini-ring-target {
    font-size: 0.68rem;
    font-weight: 500;
    color: var(--text-muted);
    font-variant-numeric: tabular-nums;
    opacity: 0.7;
}

.macro-ring-label {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

/* ============================================================
   Dashboard Grid
   ============================================================ */
.dashboard-content {
    max-width: none;
    position: relative;
}

/* Empty-state overlay for dashboard */
.dashboard-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 2.5rem 1.5rem 1.5rem;
    margin-bottom: 0.5rem;
}

.dashboard-empty-icon {
    color: var(--text-muted);
    margin-bottom: 1rem;
    opacity: 0.6;
}

.dashboard-empty-title {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.4rem;
}

.dashboard-empty-desc {
    font-size: 0.85rem;
    color: var(--text-muted);
    max-width: 320px;
    line-height: 1.5;
    margin-bottom: 1.25rem;
}

.dashboard-empty-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.65rem 1.5rem;
    font-size: 0.9rem;
    font-weight: 600;
}

/* Gray out widgets when no data */
.dashboard-no-data .macro-rings,
.dashboard-no-data .dashboard-quick-stats,
.dashboard-no-data .dashboard-grid {
    opacity: 0.3;
    pointer-events: none;
    filter: grayscale(1);
}

.dashboard-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}

@media (min-width: 768px) {
    .dashboard-grid {
        grid-template-columns: 1fr 1fr;
    }
}

.dashboard-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.04);
    transition: all var(--speed-slow) var(--ease);
    animation: fadeInUp 0.5s ease-out both;
}
.dashboard-card:nth-child(1) { animation-delay: 0.1s; }
.dashboard-card:nth-child(2) { animation-delay: 0.2s; }

.dashboard-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 16px 48px rgba(0,0,0,0.35), 0 0 24px rgba(0,212,170,0.08), inset 0 1px 0 rgba(255,255,255,0.04);
    transform: translateY(-3px);
}

.card-vitamins .card-section-title,
.card-minerals .card-section-title {
    margin-top: 0;
}

/* ============================================================
   Nutrient Progress Bars
   ============================================================ */
.nutrient-section { display: flex; flex-direction: column; gap: 0.75rem; }
.nutrient-bar-item {
    animation: fadeInUp 0.4s ease-out both;
}
.nutrient-bar-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.35rem;
}
.nutrient-name { font-weight: 500; font-size: 0.875rem; color: var(--text-secondary); }
.nutrient-value { font-size: 0.8rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(255,255,255,0.06);
    border-radius: 100px;
    overflow: hidden;
    position: relative;
}
.progress-fill {
    height: 100%;
    border-radius: 100px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1), background-color var(--speed);
    min-width: 0;
    position: relative;
    box-shadow: 0 0 8px rgba(0,212,170,0.2);
}

/* Exceeded portion of the bar */
.progress-bar-wrap {
    position: relative;
    width: 100%;
}
.progress-bar-wrap .progress-bar {
    overflow: visible;
}
.progress-fill-base {
    height: 100%;
    border-radius: 100px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 0;
    position: absolute;
    top: 0;
    left: 0;
    box-shadow: 0 0 8px rgba(0,212,170,0.2);
}
.progress-fill-over {
    height: 100%;
    border-radius: 100px;
    transition: width 0.8s cubic-bezier(0.4, 0, 0.2, 1) 0.3s, opacity var(--speed-slow) ease 0.6s;
    min-width: 0;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    box-shadow: 0 0 10px rgba(245,158,11,0.25);
}
.progress-fill-over.show {
    opacity: 1;
}
.progress-target-mark {
    position: absolute;
    top: -4px;
    width: 2px;
    height: 16px;
    background: rgba(255,255,255,0.3);
    border-radius: 1px;
    transition: left 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 2;
}
.nutrient-pct {
    font-size: 0.75rem;
    font-weight: 600;
    font-variant-numeric: tabular-nums;
    margin-left: 0.25rem;
}
.nutrient-pct-over {
    color: var(--orange);
}
.nutrient-pct-met {
    color: var(--teal);
}
.nutrient-pct-low {
    color: var(--text-muted);
}

/* ============================================================
   Log Food
   ============================================================ */
.logfood-grid {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}
.logfood-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.04);
    transition: all var(--speed-slow) var(--ease);
    animation: fadeInUp 0.5s ease-out both;
}
.logfood-card:nth-child(1) { animation-delay: 0.1s; }
.logfood-card:nth-child(2) { animation-delay: 0.2s; }

.logfood-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 16px 48px rgba(0,0,0,0.35), 0 0 24px rgba(0,212,170,0.08), inset 0 1px 0 rgba(255,255,255,0.04);
    transform: translateY(-2px);
}

@media (min-width: 768px) {
    .logfood-grid {
        flex-direction: row;
    }
    .logfood-card { flex: 1; }
}

.input-group {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.input-group textarea {
    width: 100%;
    padding: 0.875rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-family: inherit;
    resize: vertical;
    transition: all var(--speed) var(--ease);
    background: rgba(255,255,255,0.03);
    color: var(--text);
}
.input-group textarea:focus {
    outline: none;
    border-color: var(--teal);
    background: rgba(0,212,170,0.03);
    box-shadow: 0 0 0 4px rgba(0,212,170,0.1);
}

.logfood-input-group {
    gap: 0.75rem;
}
.logfood-actions {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}
.btn-icon-circle {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: rgba(255,255,255,0.03);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    transition: all var(--speed) var(--ease);
    flex-shrink: 0;
}
.btn-icon-circle:hover {
    border-color: var(--teal);
    color: var(--teal);
    background: rgba(0,212,170,0.08);
}
.upload-group {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.upload-label { cursor: pointer; }
.file-name { font-size: 0.85rem; color: var(--text-muted); }

/* ============================================================
   Barcode Scanner
   ============================================================ */
.barcode-scanner-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.82);
    backdrop-filter: blur(16px) saturate(120%);
    -webkit-backdrop-filter: blur(16px) saturate(120%);
    z-index: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    animation: fadeIn 0.25s ease-out;
}
.barcode-scanner-overlay.hidden { display: none !important; }

.barcode-scanner-modal {
    background: var(--bg-card);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius-xl);
    width: 100%;
    max-width: 440px;
    box-shadow: 0 32px 80px rgba(0,0,0,0.65), 0 0 1px rgba(255,255,255,0.06);
    animation: scaleIn 0.25s ease-out;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.barcode-scanner-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
}

.barcode-scanner-region {
    width: 100%;
    min-height: 280px;
    background: #000;
    position: relative;
}
.barcode-scanner-region video {
    width: 100% !important;
    border-radius: 0 !important;
}
/* Override html5-qrcode internal styles for dark theme */
.barcode-scanner-region #qr-shaded-region {
    border-color: var(--teal) !important;
}

.barcode-scanner-status {
    padding: 0.75rem 1.25rem;
    text-align: center;
    font-size: 0.875rem;
    color: var(--text-secondary);
    border-top: 1px solid var(--border);
}
.barcode-scanner-status .barcode-error {
    color: var(--red);
}
.barcode-scanner-status .barcode-success {
    color: var(--teal);
    font-weight: 600;
}

.barcode-lookup-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.75rem;
}
.spinner-sm {
    width: 18px;
    height: 18px;
    border: 2px solid rgba(255,255,255,0.1);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}
@keyframes spin {
    to { transform: rotate(360deg); }
}

/* Barcode result card */
.barcode-result {
    padding: 1rem 1.25rem 1.25rem;
    border-top: 1px solid var(--border);
    animation: fadeInUp 0.3s ease-out;
}
.barcode-result.hidden { display: none !important; }

.barcode-result-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
}
.barcode-result-emoji {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0,212,170,0.1), rgba(6,182,212,0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.5rem;
    flex-shrink: 0;
}
.barcode-result-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    min-width: 0;
}
.barcode-result-name {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.barcode-result-brand {
    font-size: 0.8rem;
    color: var(--text-muted);
}

.barcode-result-nutrition {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1rem;
}
.barcode-nutr-item {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 0.6rem 0.4rem;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.barcode-nutr-val {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.barcode-nutr-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.barcode-result-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
}

/* ============================================================
   Entry Cards
   ============================================================ */
.entries-list { display: flex; flex-direction: column; gap: 0.5rem; }

.entry-card {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--speed) var(--ease);
    animation: fadeInUp 0.4s ease-out both;
}
.entry-card:hover {
    border-color: var(--border-hover);
    box-shadow: 0 6px 20px rgba(0,0,0,0.25);
    transform: translateY(-2px);
}
.entry-thumb {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(0,212,170,0.1), rgba(6,182,212,0.08));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.6rem;
    flex-shrink: 0;
    border: 1px solid rgba(0,212,170,0.1);
}
.entry-info { display: flex; flex-direction: column; gap: 0.15rem; flex: 1; min-width: 0; }
.entry-name { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.entry-meta { font-size: 0.8rem; color: var(--text-secondary); font-variant-numeric: tabular-nums; }
.entry-source { font-size: 0.75rem; color: var(--text-muted); }

.empty-state {
    text-align: center;
    color: var(--text-muted);
    padding: 2.5rem 1rem;
    font-size: 0.95rem;
    animation: fadeIn 0.4s ease-out;
}

/* ============================================================
   Analysis
   ============================================================ */
.profile-inputs { margin-bottom: 1rem; }
.input-row {
    display: flex;
    gap: 0.75rem;
}
.input-row label {
    flex: 1;
    display: flex;
    flex-direction: column;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
}
.input-row input,
.input-row select {
    margin-top: 0.25rem;
    padding: 0.65rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 12px;
    font-size: 0.95rem;
    font-family: inherit;
    background: rgba(255,255,255,0.03);
    color: var(--text);
    transition: all var(--speed) var(--ease);
}
.input-row input:focus,
.input-row select:focus {
    outline: none;
    border-color: var(--teal);
    background: rgba(0,212,170,0.03);
    box-shadow: 0 0 0 4px rgba(0,212,170,0.1);
}
.input-row select option {
    background: var(--bg-card);
    color: var(--text);
}

.analysis-summary-card {
    background: rgba(0,212,170,0.06);
    border-left: 3px solid var(--teal);
    padding: 1.25rem 1.25rem;
    border-radius: 0 var(--radius) var(--radius) 0;
    margin-bottom: 1rem;
    font-size: 0.95rem;
    line-height: 1.7;
    color: var(--text-secondary);
    animation: slideInLeft 0.5s ease-out;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}

.table-wrapper { overflow-x: auto; }
.gaps-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.85rem;
}
.gaps-table th {
    text-align: left;
    padding: 0.7rem 0.6rem;
    border-bottom: 1px solid rgba(255,255,255,0.1);
    color: var(--text-muted);
    font-weight: 600;
    font-size: 0.75rem;
}
.gaps-table td {
    padding: 0.7rem 0.6rem;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}
.gaps-table tr {
    transition: background-color var(--speed-fast);
}
.gaps-table tbody tr:nth-child(even) {
    background-color: rgba(255,255,255,0.015);
}
.gaps-table tbody tr:hover {
    background-color: rgba(0,212,170,0.04);
}

.badge {
    display: inline-block;
    padding: 0.25rem 0.75rem;
    border-radius: 100px;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge-high { background: rgba(239,68,68,0.15); color: #f87171; }
.badge-medium { background: rgba(245,158,11,0.15); color: #fbbf24; }
.badge-low { background: rgba(0,212,170,0.15); color: var(--teal); }
.badge-none { background: rgba(255,255,255,0.06); color: var(--text-muted); }

.severity-high td:first-child { border-left: 3px solid var(--red); }
.severity-medium td:first-child { border-left: 3px solid var(--orange); }
.severity-low td:first-child { border-left: 3px solid var(--teal); }

.suggestions-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.suggestions-list li {
    background: var(--bg-card);
    border: 1px solid var(--border);
    padding: 0.875rem 1rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    line-height: 1.6;
    color: var(--text-secondary);
    transition: all var(--speed) var(--ease);
    animation: fadeInUp 0.4s ease-out both;
    box-shadow: inset 0 1px 0 rgba(255,255,255,0.03);
}
.suggestions-list li:hover {
    border-color: var(--border-hover);
    box-shadow: 0 4px 16px rgba(0,0,0,0.2);
    transform: translateX(4px);
}

/* ============================================================
   History
   ============================================================ */
.history-list { display: flex; flex-direction: column; gap: 0.75rem; }

.history-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-left: 3px solid rgba(0,212,170,0.3);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.04);
    transition: all var(--speed-slow) var(--ease);
    animation: fadeInUp 0.4s ease-out both;
}
.history-card:hover {
    border-color: var(--border-hover);
    border-left-color: var(--teal);
    box-shadow: 0 16px 48px rgba(0,0,0,0.35), 0 0 24px rgba(0,212,170,0.08), inset 0 1px 0 rgba(255,255,255,0.04);
    transform: translateY(-2px);
}
.history-date {
    font-weight: 700;
    font-size: 0.95rem;
    margin-bottom: 0.75rem;
    color: var(--text);
    letter-spacing: -0.01em;
}
.history-stats {
    display: flex;
    gap: 2rem;
}
.history-stat { display: flex; flex-direction: column; }
.stat-value {
    font-size: 1.35rem;
    font-weight: 800;
    letter-spacing: -0.02em;
    color: var(--teal);
    font-variant-numeric: tabular-nums;
}
.stat-label { font-size: 0.7rem; color: var(--text-muted); font-weight: 500; }

/* ============================================================
   Loading & Toast
   ============================================================ */
.loading {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 1rem;
    color: var(--text-secondary);
    animation: fadeIn 0.3s ease-out;
}
.spinner {
    width: 22px;
    height: 22px;
    border: 2.5px solid rgba(0,212,170,0.15);
    border-top-color: var(--teal);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.toast {
    position: fixed;
    bottom: calc(var(--tab-height) + 1.25rem);
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: var(--bg-elevated);
    color: var(--text);
    padding: 0.85rem 1.5rem 0.85rem 1.25rem;
    border-radius: var(--radius);
    font-size: 0.9rem;
    font-weight: 500;
    opacity: 0;
    transition: opacity var(--speed) var(--ease), transform var(--speed) var(--ease);
    z-index: 1000;
    max-width: calc(100% - 2rem);
    text-align: center;
    box-shadow: 0 12px 40px rgba(0,0,0,0.45);
    border: 1px solid rgba(255,255,255,0.08);
    overflow: hidden;
}
.toast::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    background: var(--teal);
    border-radius: 4px 0 0 4px;
}
.toast.show { opacity: 1; transform: translateX(-50%) translateY(0); }

/* Toast types */
.toast-success::before { background: var(--teal); }
.toast-error::before { background: var(--red); }

@media (min-width: 768px) {
    .toast {
        bottom: 2rem;
    }
}

/* ============================================================
   Bottom Tab Bar (mobile only)
   ============================================================ */
.tab-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: var(--tab-height);
    background: rgba(8,12,24,0.92);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border-top: 1px solid rgba(0,212,170,0.15);
    box-shadow: 0 -1px 12px rgba(0,212,170,0.06);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 200;
    padding-bottom: env(safe-area-inset-bottom, 0);
}

.tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.25rem;
    background: none;
    border: none;
    cursor: pointer;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 0.6rem 0.75rem;
    transition: all var(--speed) var(--ease);
    -webkit-tap-highlight-color: transparent;
    position: relative;
    min-width: 64px;
}
.tab.active {
    color: var(--teal);
    font-weight: 600;
}
.tab.active svg {
    filter: drop-shadow(0 0 6px rgba(0,212,170,0.4));
}
.tab.active::after {
    content: '';
    position: absolute;
    bottom: 2px;
    left: 50%;
    transform: translateX(-50%);
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--teal);
    box-shadow: 0 0 6px rgba(0,212,170,0.5);
}
.tab:hover { color: var(--teal); }
.tab svg { stroke: currentColor; transition: filter var(--speed); }

/* ============================================================
   App Footer
   ============================================================ */
.app-footer {
    background: rgba(8,12,24,0.85);
    backdrop-filter: blur(12px);
    border-top: 1px solid var(--border);
    padding: 1rem 1.5rem;
    margin-bottom: var(--tab-height);
}
.app-footer-inner {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.6rem;
}
.app-footer-links {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex-wrap: wrap;
    justify-content: center;
}
.app-footer-links a {
    font-size: 0.8rem;
    color: var(--text-muted);
    text-decoration: none;
    font-weight: 500;
    transition: color var(--speed-fast);
    padding: 0.2rem 0.4rem;
}
.app-footer-links a:hover {
    color: var(--teal);
}
.footer-sep {
    color: var(--text-muted);
    opacity: 0.4;
    font-size: 0.7rem;
    user-select: none;
}
.app-footer-copy {
    font-size: 0.75rem;
    color: var(--text-muted);
}

@media (min-width: 768px) {
    .app-footer {
        margin-left: var(--sidebar-width);
        margin-bottom: 0;
    }
}

/* ============================================================
   Info Page (Privacy, Help, Terms, About)
   ============================================================ */
.info-page {
    position: fixed;
    inset: 0;
    z-index: 400;
    background: var(--bg);
    display: flex;
    flex-direction: column;
    animation: fadeIn 0.2s ease-out;
}
.info-page.hidden { display: none !important; }

.info-page-header {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0 1.5rem;
    height: var(--header-height);
    background: rgba(8,12,24,0.88);
    backdrop-filter: blur(24px) saturate(160%);
    -webkit-backdrop-filter: blur(24px) saturate(160%);
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.info-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    background: none;
    border: none;
    color: var(--teal);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    padding: 0.4rem 0.5rem;
    border-radius: 8px;
    transition: background var(--speed-fast);
}
.info-back-btn:hover {
    background: rgba(0,212,170,0.08);
}
.info-page-title {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: -0.02em;
}
.info-page-body {
    flex: 1;
    overflow-y: auto;
    padding: 2rem 1.5rem 3rem;
}
.info-page-content {
    max-width: 680px;
    margin: 0 auto;
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.8;
}
.info-page-content h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin: 1.75rem 0 0.6rem;
}
.info-page-content h3:first-child {
    margin-top: 0;
}
.info-page-content p {
    margin: 0 0 0.85rem;
}
.info-page-content ul {
    margin: 0 0 0.85rem 1.25rem;
    padding: 0;
}
.info-page-content li {
    margin-bottom: 0.4rem;
}
.info-page-content a {
    color: var(--teal);
    text-decoration: none;
}
.info-page-content a:hover {
    text-decoration: underline;
}

/* ============================================================
   Responsive — Small screens
   ============================================================ */
@media (max-width: 480px) {
    .hero-text h1 { font-size: 2rem; }
    .hero-desc { font-size: 1rem; }
    .input-row { flex-direction: column; }
    .history-stats { gap: 1rem; }
    .stat-value { font-size: 1.1rem; }
    .features-title { font-size: 1.4rem; }
}

/* ============================================================
   Button variants
   ============================================================ */
.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
    border-radius: 10px;
}

.btn-danger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 1.5rem;
    border: 1.5px solid rgba(239,68,68,0.3);
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 600;
    cursor: pointer;
    color: var(--red);
    background: transparent;
    font-family: inherit;
    transition: all var(--speed) var(--ease);
}
.btn-danger:hover {
    background: rgba(239,68,68,0.08);
    border-color: var(--red);
}

/* ============================================================
   Dashboard Quick Stats
   ============================================================ */
.dashboard-quick-stats {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.5s ease-out 0.1s both;
}
.quick-stat-card {
    flex: 1;
    min-width: 120px;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: all var(--speed) var(--ease);
    cursor: pointer;
}
.quick-stat-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}

.dashboard-date-subtitle {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: -0.25rem;
    margin-bottom: 1rem;
}
.quick-stat-icon {
    width: 36px;
    height: 36px;
    border-radius: 10px;
    background: rgba(255,255,255,0.04);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.quick-stat-info {
    display: flex;
    flex-direction: column;
}
.quick-stat-value {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
    line-height: 1.3;
}
.quick-stat-value-sm {
    font-size: 0.82rem;
}
.quick-stat-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

/* Dashboard AI Insight */
.dash-insight-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    background: rgba(0,212,170,0.06);
    border: 1px solid rgba(0,212,170,0.15);
    border-radius: var(--radius);
    padding: 1rem 1.25rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.5s ease-out 0.2s both;
}
.dash-insight-icon { flex-shrink: 0; margin-top: 2px; }
.dash-insight-card p {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* ============================================================
   Food Diary
   ============================================================ */
.diary-date-nav {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}
.diary-date-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
}

/* ============================================================
   Food Search
   ============================================================ */
.search-bar-wrap {
    margin-bottom: 1.5rem;
}
.search-bar {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.5rem 0.75rem 0.5rem 1rem;
    transition: border-color var(--speed) var(--ease);
}
.search-bar:focus-within {
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(0,212,170,0.1);
}
.search-bar svg { flex-shrink: 0; color: var(--text-muted); }
.search-bar input {
    flex: 1;
    border: none;
    background: none;
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    outline: none;
}
.search-bar input::placeholder { color: var(--text-muted); }

.search-toggle {
    display: flex;
    gap: 0.5rem;
    margin-top: 0.75rem;
}
.toggle-btn {
    padding: 0.4rem 1rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: none;
    color: var(--text-muted);
    font-size: 0.8rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--speed) var(--ease);
}
.toggle-btn.active {
    background: rgba(0,212,170,0.1);
    color: var(--teal);
    border-color: rgba(0,212,170,0.3);
}
.toggle-btn:hover:not(.active) {
    color: var(--text-secondary);
    border-color: rgba(255,255,255,0.15);
}

.search-results-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.search-result-card {
    display: flex;
    flex-direction: column;
    gap: 0;
    padding: 0;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: all var(--speed) var(--ease);
    overflow: hidden;
}
.search-result-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}
.search-result-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 1rem;
    cursor: pointer;
}
.search-result-info { display: flex; flex-direction: column; gap: 0.2rem; }
.search-result-name { font-weight: 600; font-size: 0.95rem; color: var(--text); }
.search-result-meta { font-size: 0.8rem; color: var(--text-secondary); }
.search-result-score {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--teal);
    white-space: nowrap;
}
.search-result-recipe {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0 1rem;
    border-top: 1px solid transparent;
}
.search-result-card.expanded .search-result-recipe {
    max-height: 300px;
    padding: 1rem;
    border-top-color: var(--border);
}
.search-result-recipe h5 {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--teal);
    margin: 0 0 0.5rem 0;
}
.search-result-recipe p {
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0;
}

/* ============================================================
   AI Coach — Floating Panel
   ============================================================ */
.coach-fab {
    position: fixed;
    bottom: 100px;
    right: 24px;
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), #06b6d4);
    color: #fff;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 4px 20px rgba(0,212,170,0.35);
    z-index: 1000;
    transition: all 0.3s var(--ease);
}
.coach-fab:hover {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,212,170,0.45);
}
.coach-fab.active {
    background: var(--bg-card);
    border: 1px solid var(--border);
    box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}
.coach-fab.active svg { stroke: var(--text-secondary); }

.coach-panel {
    position: fixed;
    bottom: 170px;
    right: 24px;
    width: 400px;
    max-height: 520px;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 16px;
    box-shadow: 0 12px 48px rgba(0,0,0,0.5);
    z-index: 1001;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    animation: coachSlideUp 0.25s ease-out;
}
.coach-panel.hidden { display: none; }

@keyframes coachSlideUp {
    from { opacity: 0; transform: translateY(16px); }
    to { opacity: 1; transform: translateY(0); }
}

.coach-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.875rem 1rem;
    border-bottom: 1px solid var(--border);
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text);
}

.coach-panel .coach-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.75rem 1rem;
    min-height: 200px;
    max-height: 300px;
}

.coach-panel .coach-suggestions {
    padding: 0.5rem 1rem;
}

.coach-panel .coach-input-bar {
    padding: 0.75rem 1rem;
}

@media (max-width: 600px) {
    .coach-fab { bottom: 80px; right: 16px; width: 50px; height: 50px; }
    .coach-panel {
        bottom: 144px;
        right: 12px;
        left: 12px;
        width: auto;
        max-height: 60vh;
    }
}

.coach-messages {
    flex: 1;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    padding: 0.5rem 0;
    min-height: 0;
}

.coach-bubble {
    display: flex;
    gap: 0.75rem;
    max-width: 85%;
    animation: fadeInUp 0.3s ease-out;
}
.coach-bubble.user {
    align-self: flex-end;
    flex-direction: row-reverse;
}
.coach-bubble-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: rgba(0,212,170,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.coach-bubble.user .coach-bubble-avatar { display: none; }

.coach-bubble-content {
    padding: 0.875rem 1.125rem;
    border-radius: var(--radius-lg);
    font-size: 0.9rem;
    line-height: 1.6;
}
.coach-bubble.assistant .coach-bubble-content {
    background: rgba(30,42,72,0.6);
    border: 1px solid var(--border);
    border-left: 3px solid var(--teal);
    color: var(--text-secondary);
    border-radius: 4px var(--radius-lg) var(--radius-lg) 4px;
}
.coach-bubble.user .coach-bubble-content {
    background: linear-gradient(135deg, rgba(0,212,170,0.15), rgba(6,182,212,0.1));
    border: 1px solid rgba(0,212,170,0.2);
    color: var(--text);
}

/* Markdown content inside assistant bubbles */
.coach-bubble.assistant .coach-bubble-content strong {
    color: var(--text);
    font-weight: 600;
}
.coach-bubble.assistant .coach-bubble-content em {
    font-style: italic;
}
.coach-bubble.assistant .coach-bubble-content ul,
.coach-bubble.assistant .coach-bubble-content ol {
    margin: 0.5rem 0;
    padding-left: 1.25rem;
}
.coach-bubble.assistant .coach-bubble-content li {
    margin-bottom: 0.25rem;
}

/* Typing indicator dots */
.coach-typing-dots {
    display: inline-flex;
    gap: 4px;
    align-items: center;
    padding: 4px 0;
}
.coach-typing-dots span {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--teal);
    opacity: 0.4;
    animation: coachTypingBounce 1.2s infinite ease-in-out;
}
.coach-typing-dots span:nth-child(2) { animation-delay: 0.2s; }
.coach-typing-dots span:nth-child(3) { animation-delay: 0.4s; }

@keyframes coachTypingBounce {
    0%, 60%, 100% { opacity: 0.3; transform: translateY(0); }
    30% { opacity: 1; transform: translateY(-4px); }
}

.coach-suggestions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.5rem 0;
    flex-shrink: 0;
}
.coach-suggestion-chip {
    padding: 0.4rem 0.875rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: none;
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--speed) var(--ease);
}
.coach-suggestion-chip:hover {
    border-color: var(--border-hover);
    color: var(--teal);
    background: rgba(0,212,170,0.06);
}

.coach-input-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.75rem 0;
    border-top: 1px solid var(--border);
    flex-shrink: 0;
}
.coach-input-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
    transition: all var(--speed) var(--ease);
}
.coach-input-bar input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(0,212,170,0.1);
}

/* ============================================================
   Weight & Water Tracker
   ============================================================ */
.tracker-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 768px) {
    .tracker-grid {
        grid-template-columns: 1fr 1fr;
    }
}
.tracker-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.04);
    animation: fadeInUp 0.5s ease-out both;
}
.tracker-card:nth-child(2) { animation-delay: 0.1s; }

.tracker-card .input-group {
    margin-bottom: 1rem;
}
.tracker-card .input-group input {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 0.95rem;
    font-family: inherit;
    transition: all var(--speed) var(--ease);
}
.tracker-card .input-group input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(0,212,170,0.1);
}

.weight-chart-area {
    margin-top: 1rem;
}
.weight-sparkline {
    display: flex;
    align-items: flex-end;
    gap: 0.25rem;
    height: 240px;
    padding: 1rem 0 0;
}
.sparkline-bar {
    flex: 1;
    background: linear-gradient(to top, var(--teal), var(--cyan));
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    position: relative;
    transition: height 0.5s var(--ease);
}
.sparkline-label {
    position: absolute;
    top: -20px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

/* Log Weight toggle */
.log-weight-toggle {
    margin-bottom: 1rem;
}
.log-weight-toggle .btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.85rem;
}
.log-weight-form {
    margin-top: 0.75rem;
    animation: fadeInUp 0.3s ease-out;
}
.log-weight-form .input-group {
    display: inline-flex;
    gap: 0.5rem;
}
.log-weight-form .input-group input {
    width: 180px;
    padding: 0.6rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: var(--radius);
    background: rgba(255,255,255,0.03);
    color: var(--text);
    font-size: 0.9rem;
    font-family: inherit;
}
.log-weight-form .input-group input:focus {
    outline: none;
    border-color: var(--teal);
    box-shadow: 0 0 0 4px rgba(0,212,170,0.1);
}

/* Side-by-side trends charts */
.trends-charts-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1rem;
    margin-bottom: 1rem;
}
.trends-chart-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.25rem;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.04);
    animation: fadeInUp 0.5s ease-out both;
}
.trends-chart-card:nth-child(2) {
    animation-delay: 0.1s;
}
.trends-chart-card .card-section-title {
    margin-top: 0;
    font-size: 0.85rem;
}
.weekly-bar.weight-bar {
    background: linear-gradient(to top, #3B82F6, #60A5FA);
}
.trends-chart-card .weekly-chart {
    height: 240px;
}
@media (max-width: 768px) {
    .trends-charts-row {
        grid-template-columns: 1fr;
    }
}

.water-tracker {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}
.water-ring-wrap {
    position: relative;
    width: 120px;
    height: 120px;
}
.water-ring-svg {
    width: 100%;
    height: 100%;
}
.ring-track { stroke: rgba(255,255,255,0.05); }
.water-ring-svg circle {
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
}
.water-ring-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    width: 70px;
    line-height: 1.2;
}
.water-ring-text span:first-child {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}
.water-ring-unit {
    font-size: 0.55rem;
    color: var(--text-muted);
    white-space: nowrap;
}
.water-quick-btns {
    display: flex;
    gap: 0.5rem;
}

/* ============================================================
   Fasting Timer
   ============================================================ */
.fasting-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 1.25rem;
}
@media (min-width: 768px) {
    .fasting-layout {
        grid-template-columns: 1.5fr 1fr;
    }
}

.fasting-timer-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 2rem;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.5rem;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease-out both;
}

.protocol-picker {
    display: flex;
    gap: 0.5rem;
}
.protocol-btn {
    padding: 0.5rem 1.125rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: none;
    color: var(--text-muted);
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--speed) var(--ease);
}
.protocol-btn.active {
    background: rgba(0,212,170,0.1);
    color: var(--teal);
    border-color: rgba(0,212,170,0.3);
}
.protocol-btn:hover:not(.active) {
    color: var(--text-secondary);
    border-color: rgba(255,255,255,0.15);
}

.fasting-countdown-wrap {
    position: relative;
    width: 200px;
    height: 200px;
}
.fasting-countdown-svg {
    width: 100%;
    height: 100%;
}
.fasting-countdown-svg circle {
    transition: stroke-dashoffset 1s cubic-bezier(0.4, 0, 0.2, 1);
}
.fasting-countdown-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
}
.fasting-time {
    font-size: 1.4rem;
    font-weight: 400;
    color: var(--text);
    letter-spacing: -0.02em;
    font-variant-numeric: tabular-nums;
}
.fasting-status-label {
    font-size: 0.8rem;
    color: var(--text-muted);
    font-weight: 500;
}

.fasting-stats-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease-out 0.1s both;
}
.fasting-stat-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.875rem 0;
    border-bottom: 1px solid var(--border);
    font-size: 0.9rem;
    color: var(--text-secondary);
}
.fasting-stat-row:last-child { border-bottom: none; }
.fasting-stat-val {
    font-weight: 700;
    color: var(--teal);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Analytics
   ============================================================ */
.analytics-streaks {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
    animation: fadeInUp 0.5s ease-out both;
}
.streak-badge-card {
    flex: 1;
    min-width: 100px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem 1rem;
    transition: all var(--speed) var(--ease);
}
.streak-badge-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-2px);
}
.streak-badge-num {
    font-size: 2rem;
    font-weight: 800;
    color: var(--teal);
    font-variant-numeric: tabular-nums;
    line-height: 1;
}
.streak-badge-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.analytics-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease-out both;
}
.analytics-section .card-section-title {
    margin-top: 0;
}

.weekly-chart {
    display: flex;
    align-items: flex-end;
    gap: 0.25rem;
    height: 320px;
    padding: 1rem 0 0;
}
.weekly-bar-col {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.35rem;
    height: 100%;
}
.weekly-bar-wrap {
    flex: 1;
    width: 100%;
    display: flex;
    align-items: flex-end;
}
.weekly-bar {
    width: 80%;
    background: linear-gradient(to top, var(--teal), var(--cyan));
    border-radius: 6px 6px 0 0;
    min-height: 4px;
    transition: height 0.5s var(--ease);
}
.weekly-bar-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}
.weekly-bar-value {
    font-size: 0.65rem;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
}

.insights-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
.insight-card {
    display: flex;
    align-items: flex-start;
    gap: 0.75rem;
    padding: 0.875rem 1rem;
    background: rgba(0,212,170,0.04);
    border: 1px solid rgba(0,212,170,0.1);
    border-radius: var(--radius);
    font-size: 0.875rem;
    color: var(--text-secondary);
    line-height: 1.6;
    transition: all var(--speed) var(--ease);
}
.insight-card:hover {
    border-color: rgba(0,212,170,0.25);
    background: rgba(0,212,170,0.06);
}
.insight-card svg { flex-shrink: 0; margin-top: 2px; }

/* ============================================================
   Settings — horizontal label-input rows
   ============================================================ */
.settings-section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease-out both;
}
.settings-section:nth-child(2) { animation-delay: 0.1s; }
.settings-section .card-section-title { margin-top: 0; }

.settings-form {
    display: flex;
    flex-direction: column;
}

.settings-row {
    display: flex;
    align-items: center;
    padding: 0.7rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    gap: 1rem;
}
.settings-row:last-child { border-bottom: none; }

.settings-label {
    font-size: 0.9rem;
    font-weight: 500;
    color: var(--text);
    min-width: 80px;
    flex-shrink: 0;
}

.settings-input {
    padding: 0.5rem 0.75rem;
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.9rem;
    font-family: inherit;
    background: rgba(255,255,255,0.03);
    color: var(--text);
    transition: all var(--speed) var(--ease);
}
.settings-input:focus {
    outline: none;
    border-color: var(--teal);
    background: rgba(0,212,170,0.03);
    box-shadow: 0 0 0 3px rgba(0,212,170,0.08);
}
.settings-input option {
    background: var(--bg-card);
    color: var(--text);
}

/* Narrow inputs for numbers (age, height, weight) */
.settings-input-sm {
    width: 5.5rem;
    text-align: center;
}

/* Dropdowns: fit to content */
.settings-input-fit {
    width: auto;
}

/* Input with unit suffix (e.g. "170 cm") */
.settings-input-with-unit {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}
.settings-unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* Action row (save button, export/delete) */
.settings-row-action {
    border-bottom: none;
    padding-top: 1rem;
    gap: 0.75rem;
}
.settings-row-action .btn-save-profile {
    margin-top: 0;
}

/* Toggle Switch */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}
.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}
.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: background 0.25s ease;
}
.toggle-slider::before {
    content: "";
    position: absolute;
    left: 3px;
    top: 3px;
    width: 18px;
    height: 18px;
    background: var(--text-secondary);
    border-radius: 50%;
    transition: transform 0.25s ease, background 0.25s ease;
}
.toggle-switch input:checked + .toggle-slider {
    background: var(--teal);
}
.toggle-switch input:checked + .toggle-slider::before {
    transform: translateX(20px);
    background: #fff;
}

/* ============================================================
   More Drawer (Mobile)
   ============================================================ */
.more-drawer-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.5);
    z-index: 299;
    animation: fadeIn 0.2s ease-out;
}
.more-drawer {
    position: fixed;
    bottom: var(--tab-height);
    left: 0;
    right: 0;
    background: var(--bg-card);
    border-top: 1px solid var(--border);
    border-radius: var(--radius-lg) var(--radius-lg) 0 0;
    z-index: 300;
    padding: 0.5rem 0;
    box-shadow: 0 -8px 32px rgba(0,0,0,0.4);
    animation: slideUp 0.25s ease-out;
}
@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}
.more-drawer-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.75rem 1.25rem 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
}
.more-drawer-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 0.875rem 1.25rem;
    background: none;
    border: none;
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all var(--speed-fast);
}
.more-drawer-item:hover {
    background: rgba(0,212,170,0.06);
    color: var(--teal);
}
.more-drawer-item svg { flex-shrink: 0; }

@media (min-width: 768px) {
    .more-drawer-overlay,
    .more-drawer { display: none !important; }
}

/* ============================================================
   Quick Add Buttons (Dashboard)
   ============================================================ */
.quick-add-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1.5rem;
    animation: fadeInUp 0.5s ease-out 0.15s both;
}
.quick-add-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.875rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--speed) var(--ease);
}
.quick-add-btn:hover {
    border-color: var(--border-hover);
    color: var(--teal);
    background: rgba(0,212,170,0.06);
    transform: translateY(-2px);
}
.quick-add-btn svg { flex-shrink: 0; }

/* ============================================================
   Diary Meal Sections
   ============================================================ */
.diary-meal-section {
    margin-bottom: 1.25rem;
}
.diary-meal-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.6rem 0;
    margin-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}
.diary-meal-icon {
    font-size: 1.1rem;
}
.diary-meal-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text);
    flex: 1;
}
.diary-meal-cals {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--teal);
    font-variant-numeric: tabular-nums;
}

/* Macro rings responsive — 4 rings wrap nicely */
@media (max-width: 640px) {
    .macro-rings {
        gap: 1rem;
    }
    .mini-ring-container {
        width: 105px;
        height: 105px;
    }
    .mini-ring-value {
        font-size: 1.2rem;
    }
    .mini-ring-target {
        font-size: 0.6rem;
    }
    .macro-ring-label {
        font-size: 0.7rem;
    }
}

/* ============================================================
   Dashboard Water Section (inline)
   ============================================================ */
.log-water-tracker {
    display: flex;
    align-items: center;
    gap: 2rem;
    flex-wrap: wrap;
    justify-content: center;
}
.log-water-tracker .mini-ring-container {
    flex-shrink: 0;
}
.log-water-actions {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}
.log-water-actions .water-quick-btns {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

/* ============================================================
   Profile View
   ============================================================ */
.profile-user-card {
    display: flex;
    align-items: center;
    gap: 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md), inset 0 1px 0 rgba(255,255,255,0.04);
    animation: fadeInUp 0.5s ease-out both;
}
.profile-user-avatar { flex-shrink: 0; }
.profile-avatar-img {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    border: 2px solid rgba(0,212,170,0.3);
}
.profile-avatar-initial {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--teal), var(--cyan));
    color: #080c14;
    font-size: 1.4rem;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
}
.profile-user-info {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.profile-name {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text);
}
.profile-email {
    font-size: 0.85rem;
    color: var(--text-muted);
}
.profile-goal-badge {
    display: inline-block;
    margin-top: 0.25rem;
    padding: 0.2rem 0.75rem;
    background: rgba(0,212,170,0.1);
    color: var(--teal);
    border-radius: 100px;
    font-size: 0.75rem;
    font-weight: 600;
    width: fit-content;
}

.profile-targets-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 1.5rem;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease-out 0.05s both;
}
.profile-targets-grid {
    display: flex;
    justify-content: space-around;
    gap: 1rem;
}
.profile-target-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.2rem;
}
.profile-target-val {
    font-size: 1.25rem;
    font-weight: 800;
    color: var(--teal);
    font-variant-numeric: tabular-nums;
}
.profile-target-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 600;
}

.profile-nav-list {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.25rem;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease-out 0.1s both;
}
.profile-nav-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all var(--speed-fast);
}
.profile-nav-item:last-child { border-bottom: none; }
.profile-nav-item:hover {
    background: rgba(0,212,170,0.06);
    color: var(--text);
}
.profile-nav-item svg { flex-shrink: 0; color: var(--text-muted); transition: color var(--speed-fast); }
.profile-nav-item:hover svg { color: var(--teal); }
.profile-nav-item span { flex: 1; }
.nav-arrow { color: var(--text-muted) !important; }

.profile-footer-actions {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    overflow: hidden;
    box-shadow: var(--shadow-md);
    animation: fadeInUp 0.5s ease-out 0.15s both;
}
.profile-action-item {
    display: flex;
    align-items: center;
    gap: 0.875rem;
    width: 100%;
    padding: 1rem 1.25rem;
    background: none;
    border: none;
    border-bottom: 1px solid var(--border);
    color: var(--text-secondary);
    font-size: 0.9rem;
    font-weight: 500;
    cursor: pointer;
    font-family: inherit;
    text-align: left;
    transition: all var(--speed-fast);
}
.profile-action-item:last-child { border-bottom: none; }
.profile-action-item:hover {
    background: rgba(255,255,255,0.03);
    color: var(--text);
}
.profile-action-item svg { flex-shrink: 0; }
.profile-signout { color: var(--text-secondary); }
.profile-signout:hover { color: var(--orange); }
.profile-signout:hover svg { color: var(--orange); }
.profile-delete { color: var(--red); }
.profile-delete:hover { background: rgba(239,68,68,0.06); }

/* ============================================================
   Tab Center Button (elevated Log)
   ============================================================ */
.tab-center .tab-center-circle {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d4aa, #00b894);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -20px;
    box-shadow: 0 4px 20px rgba(0,212,170,0.4);
    transition: all var(--speed) var(--ease);
}
.tab-center .tab-center-circle svg { stroke: #080c14; }
.tab-center:hover .tab-center-circle {
    transform: scale(1.08);
    box-shadow: 0 6px 28px rgba(0,212,170,0.5);
}
.tab-center.active .tab-center-circle {
    box-shadow: 0 4px 24px rgba(0,212,170,0.5);
}
.tab-center.active::after { display: none; }

/* ============================================================
   Recipe Browser — Filters
   ============================================================ */
.recipe-filters {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.filter-group {
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.filter-label {
    font-size: 0.7rem;
    font-weight: 600;
    color: var(--text-muted);
}

.filter-chips {
    display: flex;
    gap: 0.4rem;
    overflow-x: auto;
    padding-bottom: 0.25rem;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
}
.filter-chips::-webkit-scrollbar { display: none; }

.filter-chip {
    flex-shrink: 0;
    padding: 0.3rem 0.85rem;
    border: 1px solid var(--border);
    border-radius: 100px;
    background: none;
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    transition: all var(--speed) var(--ease);
    white-space: nowrap;
}
.filter-chip:hover:not(.active) {
    color: var(--text-secondary);
    border-color: rgba(255,255,255,0.15);
}
.filter-chip.active {
    background: rgba(0,212,170,0.1);
    color: var(--teal);
    border-color: rgba(0,212,170,0.3);
}

.recipe-count {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
}

/* ============================================================
   Recipe Browser — Grid
   ============================================================ */
.recipe-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
    gap: 1.5rem;
}
.recipe-pagination {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1rem;
    margin-top: 1.5rem;
    padding: 1rem 0;
}
.pagination-info {
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.recipe-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    cursor: pointer;
    transition: all var(--speed) var(--ease);
}
.recipe-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3);
}

.recipe-card-img-wrap {
    aspect-ratio: 4 / 3;
    overflow: hidden;
    background: var(--bg-elevated);
    position: relative;
}
.recipe-card-img-wrap::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 50%;
    background: linear-gradient(to top, rgba(8,12,24,0.7) 0%, transparent 100%);
    pointer-events: none;
    z-index: 1;
}
.recipe-card-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform var(--speed-slow) var(--ease);
}
.recipe-card:hover .recipe-card-img {
    transform: scale(1.05);
}
.recipe-card:hover {
    border-color: var(--border-hover);
    transform: translateY(-4px);
    box-shadow: 0 12px 32px rgba(0,0,0,0.3), 0 0 20px rgba(0,212,170,0.08);
}
.recipe-card-img-placeholder {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
    font-size: 0.85rem;
}

.recipe-card-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}

.recipe-card-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text);
    line-height: 1.3;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    margin: 0;
}

.recipe-card-badges {
    display: flex;
    gap: 0.35rem;
    flex-wrap: wrap;
}

.recipe-badge {
    font-size: 0.68rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    white-space: nowrap;
}
.recipe-badge-area {
    background: rgba(59,130,246,0.12);
    color: var(--blue);
}
.recipe-badge-cat {
    background: rgba(139,92,246,0.12);
    color: var(--purple);
}

.recipe-card-meta {
    display: flex;
    gap: 0.75rem;
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ============================================================
   Recipe Detail Page
   ============================================================ */
.btn-back {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: none;
    border: none;
    color: var(--teal);
    font-size: 0.9rem;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
    padding: 0.5rem 0;
    margin-bottom: 1rem;
    transition: color var(--speed-fast);
}
.btn-back:hover {
    color: var(--teal-bright);
}

.recipe-detail-hero {
    border-radius: var(--radius-lg);
    overflow: hidden;
    margin-bottom: 1.5rem;
    max-height: 360px;
}
.recipe-detail-hero img {
    width: 100%;
    height: auto;
    display: block;
    object-fit: cover;
}

.recipe-detail-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
    letter-spacing: -0.02em;
}

.recipe-detail-badges {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.recipe-detail-tag {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.15rem 0.5rem;
    border-radius: 100px;
    background: rgba(0,212,170,0.1);
    color: var(--teal);
}

.recipe-detail-meta-row {
    display: flex;
    gap: 1rem;
    margin-bottom: 1.5rem;
    flex-wrap: wrap;
}
.recipe-meta-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    padding: 0.75rem 1rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    min-width: 80px;
}
.recipe-meta-val {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--teal);
}
.recipe-meta-label {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.recipe-detail-section {
    margin-bottom: 1.5rem;
}
.recipe-detail-section h3 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text);
    margin-bottom: 0.75rem;
}

.recipe-ingredients-list {
    list-style: none;
    display: flex;
    flex-direction: column;
    gap: 0.4rem;
}
.recipe-ingredients-list li {
    padding: 0.5rem 0.75rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-size: 0.88rem;
    color: var(--text-secondary);
}
.ing-measure {
    font-weight: 600;
    color: var(--text);
    margin-right: 0.35rem;
}

.recipe-directions-list {
    padding-left: 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}
.recipe-directions-list li {
    font-size: 0.88rem;
    color: var(--text-secondary);
    line-height: 1.6;
    padding-left: 0.25rem;
}
.recipe-directions-list li::marker {
    color: var(--teal);
    font-weight: 700;
}

.recipe-detail-links {
    display: flex;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.recipe-link-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.6rem 1.25rem;
    background: rgba(0,212,170,0.08);
    border: 1px solid rgba(0,212,170,0.2);
    border-radius: 100px;
    color: var(--teal);
    font-size: 0.85rem;
    font-weight: 600;
    text-decoration: none;
    transition: all var(--speed) var(--ease);
}
.recipe-link-btn:hover {
    background: rgba(0,212,170,0.15);
    border-color: var(--teal);
}

@media (min-width: 640px) {
    .recipe-grid {
        grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    }
}
@media (min-width: 1024px) {
    .recipe-grid {
        grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    }
    .recipe-detail-hero {
        max-height: 420px;
    }
}

/* Recipe detail max-width for readability */
#recipe-detail-content {
    max-width: 800px;
}

/* ============================================================
   Recipe Nutrition Table
   ============================================================ */
.nutrition-serving-note {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.nutrition-table {
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    background: var(--bg-card);
}

.nutrition-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.65rem 1rem;
    border-bottom: 1px solid var(--border);
    transition: background var(--speed-fast);
}
.nutrition-row:last-child {
    border-bottom: none;
}
.nutrition-row:hover {
    background: rgba(255,255,255,0.02);
}

.nutrition-row-highlight {
    background: rgba(0,212,170,0.06);
}
.nutrition-row-highlight .nutrition-label {
    font-weight: 700;
    color: var(--text);
}
.nutrition-row-highlight .nutrition-value {
    font-weight: 700;
    color: var(--teal);
}

.nutrition-row-indent .nutrition-label {
    padding-left: 1rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}
.nutrition-row-indent .nutrition-value {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.nutrition-label {
    font-size: 0.88rem;
    font-weight: 500;
    color: var(--text-secondary);
}

.nutrition-value {
    font-size: 0.88rem;
    font-weight: 600;
    color: var(--text);
    font-variant-numeric: tabular-nums;
}

/* ============================================================
   Nutrient Bar Shimmer on First Load (Item 9)
   ============================================================ */
.progress-fill.shimmer-once {
    background-size: 200% 100%;
    animation: barShimmer 1.5s ease-out 1;
}
.progress-fill-base.shimmer-once {
    background-size: 200% 100%;
    animation: barShimmer 1.5s ease-out 1;
}

/* ============================================================
   Button Ripple Micro-Interaction (Item 10)
   ============================================================ */
.btn-primary .ripple,
.btn-hero .ripple {
    position: absolute;
    border-radius: 50%;
    background: rgba(255,255,255,0.35);
    width: 10px;
    height: 10px;
    animation: btnRipple 0.6s ease-out forwards;
    pointer-events: none;
}

/* ============================================================
   Recipe Detail Sticky Header (Item 11)
   ============================================================ */
.recipe-detail-sticky-header {
    position: sticky;
    top: var(--header-height);
    z-index: 50;
    background: rgba(8,12,24,0.85);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    padding: 0.75rem 1rem;
    margin: -1.5rem -1rem 1rem;
    opacity: 0;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
    pointer-events: none;
}
.recipe-detail-sticky-header.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}
.recipe-detail-sticky-header h4 {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text);
    margin: 0;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ============================================================
   Empty State SVG Illustrations (Item 12)
   ============================================================ */
.empty-state-illustrated {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    padding: 3rem 1.5rem;
    animation: fadeInUp 0.5s ease-out;
}
.empty-state-icon {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(0,212,170,0.08), rgba(6,182,212,0.06));
    border: 1px solid rgba(0,212,170,0.1);
    display: flex;
    align-items: center;
    justify-content: center;
    margin-bottom: 1.25rem;
}
.empty-state-icon svg {
    width: 36px;
    height: 36px;
    stroke: var(--teal);
    stroke-width: 1.5;
    fill: none;
    opacity: 0.7;
}
.empty-state-illustrated .empty-state-title {
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--text);
    margin-bottom: 0.4rem;
}
.empty-state-illustrated .empty-state-desc {
    font-size: 0.88rem;
    color: var(--text-muted);
    max-width: 280px;
    line-height: 1.6;
}

/* ============================================================
   Today at a Glance Bar (Item 13)
   ============================================================ */
/* ============================================================
   Loading Skeletons (Item 15)
   ============================================================ */
.skeleton {
    background: linear-gradient(90deg, var(--bg-card) 25%, rgba(30,42,72,0.5) 50%, var(--bg-card) 75%);
    background-size: 200% 100%;
    animation: skeletonShimmer 1.5s ease-in-out infinite;
    border-radius: var(--radius);
    border: 1px solid var(--border);
}
.skeleton-ring {
    width: 154px;
    height: 154px;
    border-radius: 50%;
}
.skeleton-bar {
    height: 8px;
    border-radius: 100px;
}
.skeleton-card {
    padding: 1.5rem;
    min-height: 120px;
}
.skeleton-text {
    height: 14px;
    border-radius: 6px;
    margin-bottom: 0.5rem;
}
.skeleton-text-sm {
    height: 10px;
    border-radius: 4px;
    width: 60%;
}
.skeleton-recipe-card {
    border-radius: var(--radius);
    overflow: hidden;
}
.skeleton-recipe-img {
    aspect-ratio: 4 / 3;
    border-radius: 0;
}
.skeleton-recipe-body {
    padding: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}
@media (max-width: 640px) {
    .skeleton-ring {
        width: 120px;
        height: 120px;
    }
}

