/* ===================================================================
   MACRO GAUGE 
   Modern Cyber/Matrix Theme - Production Ready
   =================================================================== */

/* ===== CSS VARIABLES ===== */
:root {
    /* Colors - Primary Palette */
    --primary: #667eea;
    --primary-dark: #5568d3;
    --primary-light: #7c8ff5;
    --secondary: #764ba2;
    --accent: #f093fb;

    /* Status Colors */
    --success: #4ade80;
    --danger: #f87171;
    --warning: #fbbf24;
    --info: #60a5fa;

    /* Background Colors */
    --bg-primary: #0f172a;
    --bg-secondary: #1e293b;
    --bg-tertiary: #334155;
    --bg-card: #1e293b;
    --bg-hover: #2d3748;

    /* Text Colors */
    --text-primary: #f1f5f9;
    --text-secondary: #cbd5e1;
    --text-muted: #94a3b8;

    /* Border & Shadows */
    --border: #334155;
    --border-primary: #475569;
    --shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
    --shadow-lg: 0 20px 60px rgba(0, 0, 0, 0.4);
    --shadow-glow: 0 0 20px rgba(102, 126, 234, 0.3);

    /* Border Radius */
    --radius: 12px;
    --radius-lg: 16px;
    --radius-sm: 8px;

    /* Spacing */
    --space-xs: 0.25rem;
    --space-sm: 0.5rem;
    --space-md: 1rem;
    --space-lg: 1.5rem;
    --space-xl: 2rem;

    /* Layout */
    --sidebar-width: 260px;

    /* Transitions */
    --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    --transition-fast: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ===== RESET & BASE ===== */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html {
    font-size: 16px;
    scroll-behavior: smooth;
}

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%);
    background-attachment: fixed;
    color: var(--text-primary);
    line-height: 1.6;
    overflow-x: hidden;
    min-height: 100vh;
    position: relative;
}

/* Mobile background fix - iOS Safari doesn't support fixed attachment well */
@supports (-webkit-touch-callout: none) {
    body {
        background-attachment: scroll;
        background-size: 100% 100%;
        background-repeat: no-repeat;
    }
}

body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-image:
        radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.08) 0%, transparent 50%),
        radial-gradient(circle at 50% 10%, rgba(240, 147, 251, 0.05) 0%, transparent 50%);
    pointer-events: none;
    z-index: 0;
}

/* Mobile background overlay fix */
@supports (-webkit-touch-callout: none) {
    body::before {
        position: absolute;
        min-height: 100%;
    }
}

/* ===== NEW APP LAYOUT WITH SIDEBAR ===== */
.app-sidebar {
    position: fixed;
    left: 0;
    top: 0;
    width: var(--sidebar-width);
    min-width: var(--sidebar-width);
    max-width: var(--sidebar-width);
    height: 100vh;
    background: rgba(15, 23, 42, 0.95);
    border-right: 1px solid rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(20px) saturate(180%);
    -webkit-backdrop-filter: blur(20px) saturate(180%);
    display: flex;
    flex-direction: column;
    z-index: 2000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
    overflow: hidden;
}

.sidebar-header {
    padding: var(--space-xl);
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.sidebar-logo {
    width: 36px;
    height: 36px;
}

.sidebar-title {
    font-size: 1.25rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.sidebar-nav {
    flex: 1;
    padding: var(--space-md);
    overflow-y: auto;
}

.sidebar-link {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    padding: var(--space-md);
    margin-bottom: var(--space-xs);
    border-radius: var(--radius);
    color: var(--text-secondary);
    text-decoration: none;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.sidebar-link::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    height: 100%;
    width: 3px;
    background: var(--primary);
    transform: scaleY(0);
    transition: transform 0.3s ease;
}

.sidebar-link:hover {
    background: rgba(102, 126, 234, 0.1);
    color: var(--text-primary);
}

.sidebar-link.active {
    background: rgba(102, 126, 234, 0.2);
    color: white;
}

.sidebar-link.active::before {
    transform: scaleY(1);
}

.sidebar-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
    flex-shrink: 0;
}

.sidebar-footer {
    padding: var(--space-lg);
    border-top: 1px solid rgba(102, 126, 234, 0.15);
}

.user-profile {
    display: flex;
    gap: var(--space-md);
}

.user-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.25rem;
}

.user-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 1px;
    overflow: hidden;
}

.user-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.logout-link {
    font-size: 0.8rem;
    color: var(--text-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    transition: color 0.3s;
}

.logout-link:hover {
    color: var(--danger);
}

/* Mobile sidebar toggle */
.mobile-sidebar-toggle {
    position: fixed;
    top: var(--space-lg);
    left: var(--space-lg);
    z-index: 2001;
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(102, 126, 234, 0.3);
    backdrop-filter: blur(10px);
    color: var(--text-primary);
    cursor: pointer;
    display: none;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.mobile-sidebar-toggle svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.mobile-sidebar-toggle:hover {
    background: rgba(102, 126, 234, 0.3);
    transform: scale(1.05);
}

/* App main content adjusted for sidebar */
.app-main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    width: calc(100% - var(--sidebar-width));
    transition: margin-left 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

/* App pages */
.app-page {
    display: none;
    animation: fadeIn 0.4s ease;
}

.app-page.active {
    display: block;
}

/* Page header bar */
.page-header-bar {
    margin-bottom: var(--space-xl);
    padding-bottom: var(--space-lg);
    border-bottom: 1px solid rgba(102, 126, 234, 0.15);
}

.page-header-bar .page-title {
    font-size: 2rem;
    font-weight: 800;
    margin-bottom: var(--space-xs);
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.page-header-bar .page-subtitle {
    color: var(--text-muted);
    font-size: 0.95rem;
}

/* Quick stats cards */
.quick-stats-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.quick-stat-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    align-items: center;
    gap: var(--space-md);
    transition: all 0.3s ease;
    backdrop-filter: blur(10px);
}

.quick-stat-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 30px rgba(102, 126, 234, 0.25);
    border-color: var(--primary);
}

.stat-icon {
    font-size: 2rem;
    width: 56px;
    height: 56px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: var(--radius);
    background: rgba(102, 126, 234, 0.1);
}

.stat-content {
    flex: 1;
}

.quick-stat-card .stat-value {
    font-size: 1.5rem;
    font-weight: 800;
    color: var(--primary);
    display: block;
}

.quick-stat-card .stat-label {
    font-size: 0.85rem;
    color: var(--text-muted);
    display: block;
    margin-top: 0.25rem;
}

/* Suggestions section */
.suggestions-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-md);
}

.suggestion-card {
    background: rgba(51, 65, 85, 0.4);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius);
    padding: var(--space-lg);
    display: flex;
    gap: var(--space-md);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.suggestion-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.suggestion-icon {
    font-size: 2rem;
}

.suggestion-content h3 {
    font-size: 1rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
    color: var(--text-primary);
}

.suggestion-content p {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin: 0;
}

.suggestion-card.warning {
    border-color: rgba(239, 68, 68, 0.4);
    background: rgba(239, 68, 68, 0.1);
}

.suggestion-card.success {
    border-color: rgba(34, 197, 94, 0.4);
    background: rgba(34, 197, 94, 0.1);
}

/* Weekly Tracker Grid */
.weekly-tracker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
}

.weekly-stat-card {
    background: rgba(51, 65, 85, 0.4);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all 0.3s ease;
    backdrop-filter: blur(5px);
}

.weekly-stat-card:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(102, 126, 234, 0.2);
}

.weekly-stat-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.weekly-icon {
    font-size: 1.5rem;
}

.weekly-label {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.weekly-progress-bar {
    width: 100%;
    height: 8px;
    background: rgba(30, 41, 59, 0.6);
    border-radius: 999px;
    overflow: hidden;
    margin-bottom: var(--space-md);
}

.weekly-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 999px;
    transition: width 0.5s cubic-bezier(0.4, 0, 0.2, 1);
}

.weekly-progress-fill--fat   { background: linear-gradient(90deg, #f97316, #fb923c); }
.weekly-progress-fill--carbs { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

.weekly-stat-values {
    display: flex;
    align-items: baseline;
    gap: 0.25rem;
    font-size: 1.25rem;
}

.weekly-stat-values .current-value {
    font-weight: 800;
    color: var(--primary);
}

.weekly-stat-values .separator {
    color: var(--text-muted);
    font-weight: 400;
}

.weekly-stat-values .goal-value {
    font-weight: 600;
    color: var(--text-secondary);
}

.weekly-stat-values .unit {
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-left: 0.25rem;
}

/* Responsive sidebar */
@media (max-width: 1024px) {
    .app-sidebar {
        transform: translateX(-100%);
        height: 100vh; /* full visual height, covers behind browser chrome */
    }

    .app-sidebar.active {
        transform: translateX(0);
    }

    /* Header and footer never shrink */
    .sidebar-header {
        flex-shrink: 0;
        padding: 1rem;
    }

    /* Nav scrolls in remaining space between header and footer */
    .sidebar-nav {
        flex: 1;
        min-height: 0;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        /* bottom padding so last item isn't flush against footer */
        padding-bottom: 0.5rem;
    }

    .mobile-sidebar-toggle {
        display: flex;
    }

    .quick-stats-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    .quiz-text-input {
        min-width: 340px !important;
    }
    #wk-muscle-filter-btn{
        max-width: 200px;
    }
}

@media (max-width: 640px) {
    .quick-stats-grid {
        grid-template-columns: 1fr;
    }

    .suggestions-grid {
        grid-template-columns: 1fr;
    }
    .sidebar-footer {
        flex-shrink: 0;
        /* push content above iOS browser toolbar */
        padding-bottom: calc(var(--space-lg) + env(safe-area-inset-bottom, 26px));
    }
    .sidebar-nav {
	max-height: 550px;
    }
}

/* ===== SETTINGS PAGE ===== */
/* ── Settings Page ─────────────────────────────────────────────── */
.settings-container {
    max-width: 760px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 1.25rem;
}

.settings-panel {
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid rgba(102, 126, 234, 0.18);
    border-radius: var(--radius-lg);
    overflow: hidden;
    backdrop-filter: blur(12px);
}

.settings-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.9rem 1.25rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.12);
    background: rgba(102, 126, 234, 0.06);
}

.settings-panel-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--primary);
    letter-spacing: 0.03em;
    text-transform: uppercase;
}

.settings-panel-subtitle {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 400;
}

.settings-rows {
    display: flex;
    flex-direction: column;
}

.settings-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    padding: 0.85rem 1.25rem;
    border-bottom: 1px solid rgba(102, 126, 234, 0.08);
    transition: background 0.15s ease;
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row:hover {
    background: rgba(102, 126, 234, 0.04);
}

.settings-row-label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
    flex: 1;
    min-width: 0;
}

.settings-row-name {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-primary);
}

.settings-row-desc {
    font-size: 0.78rem;
    color: var(--text-secondary);
}

.settings-row-control {
    flex-shrink: 0;
    display: flex;
    align-items: center;
}

.settings-input-wrap {
    display: flex;
    align-items: center;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid rgba(102, 126, 234, 0.22);
    border-radius: var(--radius);
    padding: 0.35rem 0.65rem;
    gap: 0.4rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-width: 130px;
}

.settings-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.settings-input-wrap.select {
    min-width: 190px;
    padding: 0;
    overflow: hidden;
}

.settings-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    width: 80px;
    text-align: right;
}
input[type="text"].settings-input {
    width: 100%;
    text-align: left;
}

.settings-input-wrap.select .settings-input {
    width: 100%;
    text-align: left;
    padding: 0.4rem 0.65rem;
    cursor: pointer;
}

.settings-input-wrap.select .settings-input option {
    background: #1a2236;
    color: var(--text-primary);
}

.settings-input-unit {
    font-size: 0.78rem;
    color: var(--text-secondary);
    font-weight: 500;
    white-space: nowrap;
}

.settings-unit-notice {
    display: flex;
    align-items: flex-start;
    gap: 0.5rem;
    margin: 0 1.25rem 0.75rem;
    padding: 0.55rem 0.75rem;
    border-radius: 8px;
    background: rgba(234, 179, 8, 0.08);
    border: 1px solid rgba(234, 179, 8, 0.25);
    color: var(--text-secondary);
    font-size: 0.78rem;
    line-height: 1.4;
}
.settings-unit-notice svg {
    flex-shrink: 0;
    color: #ca8a04;
    margin-top: 1px;
}
.settings-unit-notice strong {
    color: var(--text-primary);
}

.settings-panel-footer {
    padding: 0.8rem 1.25rem;
    border-top: 1px solid rgba(102, 126, 234, 0.1);
    background: rgba(102, 126, 234, 0.03);
    display: flex;
    justify-content: flex-end;
}

.settings-save-btn {
    font-size: 0.82rem !important;
    padding: 0.45rem 1rem !important;
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.settings-save-btn.danger-outline {
    background: transparent !important;
    border-color: rgba(239, 68, 68, 0.4) !important;
    color: #f87171 !important;
}

.settings-save-btn.danger-outline:hover {
    background: rgba(239, 68, 68, 0.1) !important;
    border-color: #ef4444 !important;
}

.settings-account-user {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.settings-avatar {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, rgba(102,126,234,0.3), rgba(139,92,246,0.3));
    border: 1px solid rgba(102,126,234,0.3);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    color: var(--primary);
}

/* keep these for any remaining references in other modules */
.setting-help { color: var(--text-secondary); font-size: 0.875rem; margin: 0; }
.goal-input-group { display: flex; align-items: center; gap: 0.5rem; }
.goal-input { background: transparent; border: none; flex: 1; }

/* Responsive Settings */
@media (max-width: 768px) {
    .settings-row {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.65rem;
    }
    .settings-row-control {
        width: 100%;
    }
    .settings-input-wrap,
    .settings-input-wrap.select {
        width: 100%;
        min-width: unset;
    }
    .settings-input {
        width: 100%;
        text-align: left;
    }
    .cart-btn {
        right: -100px;
        top: 15px;
    }
    .cart-preview {
        right: -100px !important;
    }
    .logo {
        margin-right: -70px;
        margin-bottom: -35px;
    }
    #hide-results {
        max-width: 100px;
    }
    #logout-button {
        align-self: center;
    }
    .settings-unit-notice {
	flex-direction: column;
    }
}

/* ===== BACKGROUND EFFECTS ===== */
#particles-canvas {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: -1;
    opacity: 0.15;
    pointer-events: none;
}

/* Mobile fix for particles canvas */
@media (max-width: 768px) {
    #particles-canvas {
        position: fixed;
        min-height: 100vh;
        opacity: 0.1;
        pointer-events: none; /* must stay fixed + none so it never blocks taps on iOS */
    }
}

/* ===== LOADING OVERLAY ===== */
.loading-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: var(--bg-primary);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    transition: opacity 0.5s, visibility 0.5s;
}

.loading-overlay.fade-out {
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
}

.loading-spinner {
    width: 60px;
    height: 60px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

.loading-text {
    margin-top: var(--space-lg);
    color: var(--text-secondary);
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

/* ===== HEADER (Enhanced Glassmorphism) ===== */
.cyber-header {
    position: sticky;
    top: 0;
    background: rgba(30, 41, 59, 0.85);
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
    backdrop-filter: blur(25px) saturate(180%);
    -webkit-backdrop-filter: blur(25px) saturate(180%);
    z-index: 1000;
    box-shadow: 0 8px 32px 0 rgba(31, 38, 135, 0.37);
}

.header-content {
    max-width: 1400px;
    margin: 0 auto;
    padding: var(--space-md) var(--space-lg);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-lg);
}

.logo-section {
    flex-shrink: 0;
}

.logo {
    height: 50px;
    width: auto;
}

/* ===== SEARCH ===== */
.search-matrix {
    flex: 1;
    max-width: 600px;
}

.search-wrapper {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-sm) var(--space-md);
    transition: var(--transition);
}

.search-wrapper:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

.cyber-search {
    flex: 1;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    outline: none;
}

.cyber-search::placeholder {
    color: var(--text-muted);
}

.cyber-search.small {
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    width: 100%;
}

.search-btn {
    background: var(--primary);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
}

.search-btn:hover {
    background: var(--primary-dark);
    transform: translateY(-1px);
}

.search-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ===== CART NAVIGATION ===== */
.cart-matrix {
    position: relative;
}

.cart-container {
    position: relative;
}

.cart-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 48px;
    height: 48px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
}

.cart-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.cart-icon {
    width: 22px;
    height: 22px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.cart-count {
    position: absolute;
    top: -6px;
    right: -6px;
    background: var(--danger);
    color: white;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 5px;
}

.cart-preview {
    display: none;
    position: absolute;
    top: calc(100% + 10px);
    right: 0;
    width: 320px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    z-index: 1001;
}

.preview-header {
    padding: var(--space-md);
    border-bottom: 1px solid var(--border);
}

.preview-header h3 {
    font-size: 1rem;
    font-weight: 600;
}

.preview-content {
    padding: var(--space-md);
}

.preview-items {
    list-style: none;
    max-height: 200px;
    overflow-y: auto;
    margin-bottom: var(--space-md);
}

.preview-items li {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-sm) 0;
    font-size: 0.9rem;
    gap: 0.5rem;
}

.preview-items li span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.remove-btn {
    background: var(--danger);
    color: white;
    border: none;
    width: 24px;
    height: 24px;
    min-width: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    flex-shrink: 0;
    transition: var(--transition);
}

.remove-btn:hover {
    background: #dc2626;
    transform: scale(1.1);
}

/* ===== MAIN CONTENT ===== */
.cyber-main {
    padding: var(--space-xl) var(--space-lg);
    min-height: calc(100vh - 200px);
    position: relative;
    z-index: 1;
    padding-left: 100px;
    padding-right: 100px;
}

/* ===== DASHBOARD LAYOUT (NEW) ===== */
.dashboard-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: var(--space-xl);
    margin-bottom: var(--space-xl);
}

.dashboard-column {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.dashboard-card {
    margin-bottom: 0 !important;
    animation: fadeInUp 0.6s ease-out;
}

@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(30px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.dashboard-left .dashboard-card:nth-child(1) {
    animation-delay: 0.1s;
}

.dashboard-left .dashboard-card:nth-child(2) {
    animation-delay: 0.2s;
}

.dashboard-right .dashboard-card:nth-child(1) {
    animation-delay: 0.15s;
}

.dashboard-right .dashboard-card:nth-child(2) {
    animation-delay: 0.25s;
}

@media (max-width: 1024px) {
    .dashboard-layout {
        grid-template-columns: 1fr;
    }
}

/* ===== SECTIONS (Enhanced Glassmorphism) ===== */
.cyber-section {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    margin-bottom: var(--space-xl);
    box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.35);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.cyber-section:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 40px 0 rgba(102, 126, 234, 0.2);
}

.section-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: var(--space-xl);
}

.section-title {
    font-size: 1.5rem;
    font-weight: 700;
}

.title-glow {
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

/* ===== DAILY TRACKER (Enhanced with Glow) ===== */
.tracker-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
    gap: 2rem;
    padding: var(--space-md);
}

.tracker-ring-container {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    transition: all 0.3s ease;
}

.tracker-ring-container:hover {
    transform: translateY(-5px);
}

.tracker-ring-container:hover .progress-ring {
    filter: drop-shadow(0 8px 16px rgba(102, 126, 234, 0.4));
}

.progress-ring {
    width: 160px;
    height: 160px;
    transform: rotate(-90deg);
    overflow: visible;
}

.ring-background {
    fill: none;
    stroke: rgba(51, 65, 85, 0.3);
    stroke-width: 12;
}

.ring-progress {
    fill: none;
    stroke-width: 12;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1);
    filter: drop-shadow(0 0 6px rgba(102, 126, 234, 0.5));
}

.ring-content {
    position: absolute;
    top: 40%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 2px;
}

.ring-percentage {
    font-size: 2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
    text-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
}

.ring-label {
    font-size: 0.75rem;
    color: var(--text-secondary);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px;
}

.ring-stats {
    display: flex;
    align-items: baseline;
    gap: 4px;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.stat-value {
    font-weight: 600;
    color: var(--text-primary);
}

.stat-separator {
    color: var(--text-tertiary);
}

.stat-goal {
    color: var(--text-secondary);
}

.stat-unit {
    color: var(--text-tertiary);
    font-size: 0.75rem;
    margin-left: 1px;
}

.ring-burn-label {
    margin-top: 4px;
    font-size: 0.7rem;
    font-weight: 700;
    color: #f59e0b;
    letter-spacing: 0.02em;
    text-align: center;
}

@media (max-width: 768px) {
    .tracker-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.5rem;
    }

    .progress-ring {
        width: 140px;
        height: 140px;
    }

    .ring-percentage {
        font-size: 1.75rem;
    }
}

@media (max-width: 480px) {
    .tracker-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }

    .progress-ring {
        width: 130px;
        height: 130px;
    }

    .ring-percentage {
        font-size: 1.5rem;
    }

    .ring-label {
        font-size: 0.65rem;
    }

    .ring-stats {
        font-size: 0.75rem;
    }
}

/* ===== PAGE SYSTEM ===== */
.page {
    display: none;
}

.page.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.page-header {
    display: flex;
    align-items: center;
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.page-title {
    font-size: 1.75rem;
    font-weight: 700;
}

.back-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    cursor: pointer;
    transition: var(--transition);
}

.back-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.back-btn svg {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ===== BUTTONS (Enhanced with Ripple) ===== */
.cyber-btn {
    padding: var(--space-sm) var(--space-lg);
    border: none;
    border-radius: var(--radius);
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: inline-flex;
    align-items: center;
    gap: var(--space-sm);
    text-decoration: none;
    position: relative;
    overflow: hidden;
}

.cyber-btn::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.6s, height 0.6s;
}

.cyber-btn:hover::before {
    width: 300px;
    height: 300px;
}

.cyber-btn.primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.cyber-btn.primary:hover {
    transform: translateY(-3px);
    box-shadow: 0 12px 35px rgba(102, 126, 234, 0.45);
}

.cyber-btn.primary:active {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.35);
}

.cyber-btn.secondary {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

.cyber-btn.secondary:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.cyber-btn.danger {
    background: var(--danger);
    color: white;
}

.cyber-btn.danger:hover {
    background: #dc2626;
    transform: translateY(-2px);
}

.cyber-btn.large {
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
}

.cyber-btn.small {
    padding: 0.375rem var(--space-md);
    font-size: 0.85rem;
}

.add-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.add-btn:hover {
    background: var(--primary-dark);
    transform: scale(1.1);
}

.add-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

/* ===== INPUTS ===== */
.cyber-input,
.cyber-date {
    width: 100%;
    /* max-width: 350px; -> breaks settings */
    padding: var(--space-sm) var(--space-md);
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    color: var(--text-primary);
    font-size: 0.95rem;
    transition: var(--transition);
}

.cyber-input:focus,
.cyber-date:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.1);
}

/* Select dropdown options styling */
.cyber-input option {
    background: var(--bg-secondary);
    color: var(--text-primary);
    padding: var(--space-sm);
}

.cyber-input option:hover {
    background: var(--bg-hover);
}

.cyber-label {
    display: block;
    margin-bottom: var(--space-sm);
    font-size: 0.9rem;
    color: var(--text-secondary);
    font-weight: 600;
}

.date-not-today-hint {
    display: inline-block;
    margin-top: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    color: #f59e0b;
    letter-spacing: 0.01em;
}

.input-group {
    margin-bottom: var(--space-lg);
}

/* ===== SEARCH RESULTS ===== */
#search-results {
    padding: 1.5rem 2rem 2rem;
}

#search-results .section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1.4rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid rgba(102,126,234,0.12);
}

#search-results .section-title {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 0;
}

#search-results .title-glow {
    background: linear-gradient(135deg, #818cf8, #6366f1);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

#hide-results {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    background: rgba(239,68,68,0.08);
    border: 1px solid rgba(239,68,68,0.25);
    color: #f87171;
    padding: 0.45rem 0.9rem;
    border-radius: 9px;
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
}
#hide-results:hover {
    background: rgba(239,68,68,0.18);
    border-color: #f87171;
}

.results-container {
    margin-top: 0;
}

.results-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
    gap: 0.75rem;
    padding: 0;
    margin: 0;
}

/* ── Food card ── */
.food-item {
    background: rgba(22, 32, 52, 0.7);
    border: 1px solid rgba(102,126,234,0.15);
    border-radius: 14px;
    padding: 0;
    cursor: pointer;
    transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.food-item::after {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(102,126,234,0.06) 0%, transparent 60%);
    opacity: 0;
    transition: opacity 0.25s;
    pointer-events: none;
}

.food-item:hover {
    border-color: rgba(102,126,234,0.45);
    transform: translateY(-3px);
    box-shadow: 0 10px 32px rgba(99,102,241,0.2);
}
.food-item:hover::after { opacity: 1; }

/* Image area — only visible when food has image */
.food-img-wrap {
    width: 100%;
    height: 110px;
    overflow: hidden;
    border-radius: 14px 14px 0 0;
    background: rgba(15,23,42,0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    cursor: zoom-in;
    position: relative;
}
.food-img-wrap::after {
    content: '🔍';
    position: absolute;
    bottom: 6px;
    right: 8px;
    font-size: 0.75rem;
    opacity: 0;
    transition: opacity 0.2s;
    pointer-events: none;
}
.food-img-wrap:hover::after { opacity: 1; }

.food-thumb {
    width: 100%;
    height: 100%;
    object-fit: contain;
    padding: 6px;
    transition: transform 0.3s;
    border-radius: 0;
    background: transparent;
    border: none;
}
.food-img-wrap:hover .food-thumb { transform: scale(1.06); }

/* Card body */
.food-body {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    padding: 0.85rem 0.95rem 0.75rem;
    flex: 1;
}

.food-info {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.food-name {
    display: block;
    font-weight: 700;
    font-size: 0.88rem;
    color: var(--text-primary);
    line-height: 1.3;
    overflow: hidden;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
}

.food-meta-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.food-calories {
    font-size: 0.78rem;
    font-weight: 700;
    color: #fbbf24;
    background: rgba(251,191,36,0.1);
    border-radius: 5px;
    padding: 1px 6px;
}

.food-macro-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 5px;
    padding: 1px 5px;
}
.food-macro-badge b { color: var(--text-secondary); }

/* Card footer — actions */
.food-actions {
    display: flex;
    gap: 0.4rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(102,126,234,0.08);
}

.star-btn,
.add-btn-small {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    height: 32px;
    border-radius: 8px;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid;
}

.star-btn {
    background: rgba(251,191,36,0.06);
    border-color: rgba(251,191,36,0.2);
    color: #fbbf24;
}
.star-btn:hover {
    background: rgba(251,191,36,0.18);
    border-color: #fbbf24;
}

.add-btn-small {
    background: rgba(99,102,241,0.1);
    border-color: rgba(99,102,241,0.3);
    color: #818cf8;
}
.add-btn-small:hover {
    background: rgba(99,102,241,0.25);
    border-color: #818cf8;
    color: #fff;
}

.no-results {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
    grid-column: 1 / -1;
}

/* ===== PAGINATION ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.4rem;
    margin-top: 1.5rem;
    grid-column: 1 / -1;
    flex-wrap: wrap;
}

.page-button {
    background: rgba(22,32,52,0.7);
    border: 1px solid rgba(102,126,234,0.2);
    color: var(--text-secondary);
    padding: 0.4rem 0.75rem;
    border-radius: 8px;
    cursor: pointer;
    transition: var(--transition);
    min-width: 36px;
    font-size: 0.85rem;
    font-weight: 600;
}
.page-button:hover {
    background: rgba(99,102,241,0.12);
    border-color: var(--primary);
    color: var(--text-primary);
}
.page-button.active {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    border-color: transparent;
    color: white;
    box-shadow: 0 2px 10px rgba(99,102,241,0.4);
}

/* ===== RESPONSIVE — SEARCH ===== */
@media (max-width: 768px) {
    #search-results { padding: 1rem; }
    .results-grid { grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 0.55rem; }
    .food-img-wrap { height: 80px; }
    .food-body { padding: 0.65rem 0.7rem 0.6rem; gap: 0.35rem; }
    .food-name { font-size: 0.8rem; }
    .food-macro-badge { display: none; }
}
@media (max-width: 480px) {
    .results-grid { grid-template-columns: repeat(2, 1fr); }
}

/* ===== MANUAL ENTRY ===== */
.entries-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-lg);
}

/* ===== MANUAL ENTRY — legendary redesign ===== */
.manual-entry-form {
    background: transparent;
    border: none;
    padding: 0;
}

/* Two-column layout: fields (left) + preview (right) */
.me-layout {
    display: grid;
    grid-template-columns: 1fr 320px;
    gap: 24px;
    align-items: start;
}

/* ---- Left: fields ---- */
.me-fields {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

/* Top row: name + grams side-by-side */
.me-name-row {
    display: grid;
    grid-template-columns: 1fr 160px;
    gap: 12px;
}

/* Individual field wrapper */
.me-field-wrap {
    display: flex;
    align-items: center;
    gap: 12px;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.18);
    border-radius: 12px;
    padding: 12px 14px;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.me-field-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.12);
}

/* Colored icon box */
.me-field-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    flex-shrink: 0;
}

/* Inner label + input */
.me-field-inner {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-width: 0;
}

.me-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 3px;
    display: flex;
    align-items: center;
    gap: 4px;
}

.me-unit {
    opacity: 0.6;
    font-weight: 500;
    text-transform: none;
    letter-spacing: 0;
}

.me-input {
    background: transparent;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 0.95rem;
    font-weight: 600;
    width: 100%;
    padding: 0;
    font-family: inherit;
}

.me-input::placeholder {
    color: rgba(148, 163, 184, 0.35);
    font-weight: 400;
}

.me-input::-webkit-inner-spin-button,
.me-input::-webkit-outer-spin-button {
    opacity: 0.4;
}

/* Hint text */
.me-hint {
    font-size: 0.78rem;
    color: var(--text-muted);
    margin: -4px 0 0;
    padding: 8px 12px;
    background: rgba(102, 126, 234, 0.06);
    border-radius: 8px;
    border-left: 3px solid rgba(102, 126, 234, 0.4);
}

/* 2×2 macro grid */
.me-macro-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

/* Action buttons row */
.me-actions {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    padding-top: 4px;
}

.me-actions .cyber-btn {
    flex: 1;
    min-width: 140px;
    justify-content: center;
    gap: 7px;
}

.me-clear-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 9px 16px;
    border-radius: 10px;
    border: 1px solid rgba(148, 163, 184, 0.2);
    background: transparent;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 600;
    cursor: pointer;
    transition: border-color 0.2s, color 0.2s, background 0.2s;
    font-family: inherit;
    white-space: nowrap;
}

.me-clear-btn:hover {
    border-color: #f87171;
    color: #f87171;
    background: rgba(248, 113, 113, 0.08);
}

/* ---- Right: live preview panel ---- */
.me-preview-panel {
    background: rgba(10, 15, 30, 0.7);
    border: 1px solid rgba(102, 126, 234, 0.22);
    border-radius: 16px;
    padding: 24px 20px 20px;
    backdrop-filter: blur(12px);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.me-preview-panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
    border-radius: 16px 16px 0 0;
}

/* subtle radial glow */
.me-preview-panel::after {
    content: '';
    position: absolute;
    top: -60px; right: -60px;
    width: 180px; height: 180px;
    background: radial-gradient(circle, rgba(102,126,234,0.12) 0%, transparent 70%);
    pointer-events: none;
}

.me-preview-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.me-preview-label {
    font-size: 0.7rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--text-muted);
}

.me-preview-grams-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(102,126,234,0.1);
    border: 1px solid rgba(102,126,234,0.2);
    border-radius: 20px;
    padding: 2px 10px;
}

.me-preview-grams {
    font-weight: 700;
    color: var(--primary-light);
}

/* Big calorie number */
.me-preview-kcal {
    font-size: 3rem;
    font-weight: 900;
    line-height: 1;
    letter-spacing: -0.04em;
    background: linear-gradient(135deg, var(--primary-light), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-top: 4px;
}

.me-preview-kcal-unit {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    margin-bottom: 16px;
}

/* Macro bar rows */
.me-preview-macros {
    display: flex;
    flex-direction: column;
    gap: 10px;
    margin-top: auto;
}

.me-preview-macro {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.me-preview-macro-bar-wrap {
    height: 5px;
    background: rgba(255,255,255,0.07);
    border-radius: 99px;
    overflow: hidden;
}

.me-preview-macro-bar {
    height: 100%;
    border-radius: 99px;
    transition: width 0.35s cubic-bezier(0.4,0,0.2,1);
}

.me-bar--protein { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.me-bar--carbs   { background: linear-gradient(90deg, #10b981, #06b6d4); }
.me-bar--fat     { background: linear-gradient(90deg, #8b5cf6, #6366f1); }

.me-preview-macro-vals {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.me-preview-macro-name {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.me-preview-macro-num {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ===== RESPONSIVE — manual entry ===== */
@media (max-width: 900px) {
    .me-layout {
        grid-template-columns: 1fr;
    }

    .me-preview-panel {
        /* Horizontal compact layout on tablet */
        display: grid;
        grid-template-columns: auto 1fr;
        grid-template-rows: auto auto;
        gap: 0 20px;
        align-items: center;
    }

    .me-preview-panel::before { border-radius: 16px 16px 0 0; }

    .me-preview-header { grid-column: 1 / -1; }

    .me-preview-kcal { font-size: 2.2rem; }

    .me-preview-kcal-unit { margin-bottom: 0; }

    .me-preview-macros { margin-top: 0; }
}

@media (max-width: 600px) {
    .me-name-row {
        grid-template-columns: 1fr;
    }

    .me-macro-grid {
        grid-template-columns: 1fr;
    }

    .me-actions {
        flex-direction: column;
    }

    .me-actions .cyber-btn {
        min-width: 0;
    }

    .me-preview-panel {
        display: flex;
        flex-direction: column;
    }

    .me-preview-kcal { font-size: 2.4rem; }
}

/* ===== FAVORITES ===== */
.search-bar {
    margin-bottom: var(--space-lg);
}

/* ── Favorites Grid ─────────────────────────────────────── */
.favorites-grid {
    list-style: none;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(270px, 1fr));
    gap: 1rem;
}

/* ── Favorite Card ──────────────────────────────────────── */
.favorite-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}

.favorite-card:hover {
    transform: translateY(-3px);
    border-color: var(--primary);
    box-shadow: 0 8px 24px rgba(102,126,234,0.2);
}

/* top accent stripe — unified gradient for all cards */
.fav-card-accent-bar {
    height: 3px;
    width: 100%;
    flex-shrink: 0;
    border-radius: var(--radius) var(--radius) 0 0;
    background: linear-gradient(90deg, var(--primary), var(--secondary));
}

/* card body */
.fav-card-body {
    padding: 0.9rem 1rem 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
    flex: 1;
}

/* top row: icon + title + actions */
.fav-card-top {
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
}

.fav-card-title-wrap {
    flex: 1;
    min-width: 0;
}

.fav-card-name {
    font-weight: 700;
    font-size: 0.95rem;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.25;
    margin: 0;
}

.fav-card-meta {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* action buttons */
.fav-card-actions {
    display: flex;
    gap: 0.35rem;
    flex-shrink: 0;
    margin-left: auto;
}

.fav-action-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-muted);
    width: 30px;
    height: 30px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.fav-action-btn.quick-add:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.fav-action-btn.delete:hover {
    background: var(--danger);
    border-color: var(--danger);
    color: #fff;
}

/* calorie display */
.fav-card-kcal {
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -0.03em;
    line-height: 1;
    color: var(--primary-light);
}

.fav-card-kcal-unit {
    font-size: 0.8rem;
    font-weight: 500;
    opacity: 0.7;
    letter-spacing: 0;
}

/* macro bar rows */
.fav-card-macro-bars {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
}

.fav-macro-bar-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.fav-macro-lbl {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    width: 10px;
    flex-shrink: 0;
}

.fav-macro-track {
    flex: 1;
    height: 5px;
    background: var(--bg-tertiary);
    border-radius: 3px;
    overflow: hidden;
}

.fav-macro-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
    min-width: 2px;
}

.fav-macro--protein { background: linear-gradient(90deg,#06b6d4,#3b82f6); }
.fav-macro--carbs   { background: linear-gradient(90deg,#10b981,#06b6d4); }
.fav-macro--fat     { background: linear-gradient(90deg,#8b5cf6,#6366f1); }

.fav-macro-val {
    font-size: 0.7rem;
    color: var(--text-secondary);
    width: 36px;
    text-align: right;
    flex-shrink: 0;
}

.empty-state {
    text-align: center;
    padding: var(--space-xl);
    color: var(--text-muted);
}

.empty-state svg {
    width: 48px;
    height: 48px;
    margin-bottom: var(--space-md);
    stroke: var(--text-muted);
    stroke-width: 2;
    fill: none;
}

/* ===== WATER INTAKE ===== */
.hydration-interface {
    display: flex;
    gap: var(--space-xl);
    align-items: flex-start;
    flex-wrap: wrap;
}

.water-tank-system {
    display: flex;
    align-items: center;
    gap: var(--space-md);
}

.cyber-tank {
    width: 100px;
    height: 200px;
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: 0 0 50px 50px;
    position: relative;
    overflow: hidden;
}

.tank-fluid {
    position: absolute;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 0%;
    background: linear-gradient(to top, var(--primary), var(--accent));
    transition: height 0.5s ease;
    border-radius: 0 0 48px 48px;
}

.tank-grid {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

.grid-line {
    position: absolute;
    width: 100%;
    height: 1px;
    background: rgba(255, 255, 255, 0.1);
}

.tank-labels {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    height: 200px;
    font-size: 0.75rem;
    color: var(--text-muted);
}

.hydration-controls {
    flex: 1;
    min-width: 300px;
}

.intake-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
    gap: var(--space-sm);
    margin-bottom: var(--space-lg);
}

.intake-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    padding: var(--space-md);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-xs);
}

.intake-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: white;
}

.intake-btn.reset {
    border-color: var(--danger);
    color: var(--danger);
}

.intake-btn.reset:hover {
    background: var(--danger);
    color: white;
}

.water-icon,
.reset-icon {
    width: 20px;
    height: 20px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.date-selector {
    margin-bottom: var(--space-lg);
}

.consume-btn {
    width: 100%;
}

.hydration-summary {
    flex: 1;
    min-width: 200px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    text-align: center;
}

.summary-display {
    font-size: 1.1rem;
    font-weight: 600;
}

.amount-glow {
    color: var(--primary);
    font-size: 1.5rem;
    font-weight: 800;
}

/* ===== COLLECTION MATRIX (CART) ===== */
.cm-page {
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid rgba(102, 126, 234, 0.18);
    border-radius: 20px;
    padding: 2rem;
    margin-bottom: var(--space-xl);
    box-shadow: 0 12px 48px rgba(0,0,0,0.45);
    display: flex;
    flex-direction: column;
    gap: 1.5rem;
}

/* Header */
.cm-header {
    display: flex;
    align-items: center;
    gap: 1rem;
}

.cm-back-btn {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(30,41,59,0.8);
    border: 1px solid rgba(102,126,234,0.25);
    color: var(--text-secondary);
    padding: 0.5rem 0.9rem;
    border-radius: 10px;
    cursor: pointer;
    font-size: 0.85rem;
    font-weight: 500;
    transition: var(--transition);
    white-space: nowrap;
}
.cm-back-btn:hover {
    background: rgba(102,126,234,0.15);
    border-color: var(--primary);
    color: var(--text-primary);
}

.cm-title-block {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    flex: 1;
    justify-content: center;
}
.cm-title-block svg { stroke: var(--primary); }
.cm-title-block h2 {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
}
.cm-header-spacer {
    width: 80px; /* mirrors back btn width to keep title centered */
}

/* Macro summary strip */
.cm-macro-strip {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
    margin-top: 20px;
    margin-bottom: 20px;
}

.cm-macro-pill {
    display: flex;
    align-items: center;
    gap: 0.7rem;
    background: rgba(30,41,59,0.7);
    border: 1px solid rgba(102,126,234,0.15);
    border-radius: 14px;
    padding: 0.85rem 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}
.cm-macro-pill::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    border-radius: 14px 14px 0 0;
}
.cm-macro-pill svg { flex-shrink: 0; opacity: 0.9; }

.cm-macro--cal::before { background: linear-gradient(90deg, #f59e0b, #fbbf24); }
.cm-macro--cal svg { stroke: #f59e0b; }
.cm-macro--pro::before { background: linear-gradient(90deg, #6366f1, #818cf8); }
.cm-macro--pro svg { stroke: #818cf8; }
.cm-macro--fat::before { background: linear-gradient(90deg, #f97316, #fb923c); }
.cm-macro--fat svg { stroke: #fb923c; }
.cm-macro--carbs::before { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.cm-macro--carbs svg { stroke: #a78bfa; }

.cm-macro-val {
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.1;
}
.cm-macro-lbl {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 1px;
}

/* Items section */
.cm-items-section {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    margin-bottom: 35px;
}

.cm-items-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.25rem;
}
.cm-items-title {
    font-size: 0.78rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.cm-items-list {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
    max-height: 340px;
    overflow-y: auto;
    padding-right: 4px;
}
.cm-items-list::-webkit-scrollbar { width: 4px; }
.cm-items-list::-webkit-scrollbar-track { background: transparent; }
.cm-items-list::-webkit-scrollbar-thumb { background: rgba(102,126,234,0.3); border-radius: 4px; }

/* Individual cart item card */
.cm-item-card {
    display: grid;
    grid-template-columns: 1fr auto auto;
    align-items: center;
    gap: 0.75rem;
    background: rgba(30,41,59,0.55);
    border: 1px solid rgba(102,126,234,0.12);
    border-radius: 12px;
    padding: 0.8rem 1rem;
    transition: var(--transition);
}
.cm-item-card:hover {
    background: rgba(30,41,59,0.8);
    border-color: rgba(102,126,234,0.28);
}

.cm-item-info {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 0;
}
.cm-item-name {
    font-size: 0.92rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.cm-item-macros {
    display: flex;
    gap: 0.6rem;
    flex-wrap: wrap;
}
.cm-item-macro-badge {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.05);
    border-radius: 5px;
    padding: 1px 6px;
}
.cm-item-macro-badge span { color: var(--text-secondary); font-weight: 600; }

.cm-grams-wrap {
    display: flex;
    align-items: center;
    gap: 0.35rem;
}
.cm-grams-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}
.cm-grams-input {
    width: 68px;
    background: rgba(15,23,42,0.7);
    border: 1px solid rgba(102,126,234,0.2);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.88rem;
    font-weight: 600;
    padding: 0.35rem 0.5rem;
    text-align: center;
    transition: var(--transition);
    -moz-appearance: textfield;
    appearance: textfield;
}
.cm-grams-input::-webkit-outer-spin-button,
.cm-grams-input::-webkit-inner-spin-button { -webkit-appearance: none; }
.cm-grams-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(102,126,234,0.08);
}

.cm-remove-btn {
    width: 30px;
    height: 30px;
    border-radius: 8px;
    border: 1px solid rgba(239,68,68,0.25);
    background: rgba(239,68,68,0.08);
    color: #f87171;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: var(--transition);
    flex-shrink: 0;
}
.cm-remove-btn:hover {
    background: rgba(239,68,68,0.2);
    border-color: #f87171;
}
.cm-remove-btn svg { pointer-events: none; }

/* Empty state */
.cm-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 0.6rem;
    padding: 2.5rem 1rem;
    color: var(--text-muted);
}
.cm-empty-state svg { opacity: 0.3; }
.cm-empty-state p { font-size: 0.9rem; margin: 0; }

/* Log panel */
.cm-log-panel {
    background: rgba(30,41,59,0.5);
    border: 1px solid rgba(102,126,234,0.15);
    border-radius: 14px;
    padding: 1.2rem 1.4rem;
    display: flex;
    align-items: flex-end;
    gap: 1.5rem;
    flex-wrap: wrap;
}

.cm-log-fields {
    display: flex;
    gap: 1rem;
    flex: 1;
    flex-wrap: wrap;
}

.cm-field-group {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    min-width: 160px;
}

.cm-field-label {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.75rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}
.cm-field-label svg { stroke: var(--primary); opacity: 0.7; }

.cm-field-input {
    background: rgba(15,23,42,0.7);
    border: 1px solid rgba(102,126,234,0.2);
    border-radius: 10px;
    color: var(--text-primary);
    font-size: 0.88rem;
    padding: 0.55rem 0.8rem;
    transition: var(--transition);
    width: 100%;
    box-sizing: border-box;
}
.cm-field-input:focus {
    outline: none;
    border-color: var(--primary);
    background: rgba(102,126,234,0.07);
}
.cm-field-select {
    cursor: pointer;
    color-scheme: dark;
    background-color: rgba(15,23,42,0.85);
    color: var(--text-primary);
}
.cm-field-select option {
    background: #1e293b;
    color: var(--text-primary);
}

.cm-date-hint {
    font-size: 0.72rem;
    color: #fbbf24;
    display: flex;
    align-items: center;
    gap: 0.2rem;
}

.cm-log-actions {
    display: flex;
    gap: 0.6rem;
    flex-shrink: 0;
}

.cm-btn {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.6rem 1.2rem;
    border-radius: 10px;
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: var(--transition);
    white-space: nowrap;
}
.cm-btn--secondary {
    background: rgba(30,41,59,0.9);
    border: 1px solid rgba(102,126,234,0.3);
    color: var(--text-secondary);
}
.cm-btn--secondary:hover {
    background: rgba(102,126,234,0.12);
    border-color: var(--primary);
    color: var(--text-primary);
}
.cm-btn--primary {
    background: linear-gradient(135deg, #6366f1, #818cf8);
    color: #fff;
    box-shadow: 0 4px 16px rgba(99,102,241,0.35);
}
.cm-btn--primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 6px 22px rgba(99,102,241,0.5);
}

/* Legacy aliases so JS still works with old class names */
.collection-interface { display: none; }
.data-table { display: none; }
.action-matrix { display: none; }
.action-buttons { display: none; }
.empty-message { display: none; }
.cart-grams-input { width: 68px; }

/* ===== RESPONSIVE — CART ===== */
@media (max-width: 768px) {
    .cm-page { padding: 1.2rem 1rem; gap: 1.1rem; }
    .cm-macro-strip { grid-template-columns: repeat(2, 1fr); }
    .cm-header-spacer { display: none; }
    .cm-title-block { justify-content: flex-start; }
    .cm-log-panel { flex-direction: column; align-items: stretch; gap: 0.9rem; }
    .cm-log-fields { flex-direction: row; gap: 0.7rem; }
    .cm-field-group { min-width: 0; flex: 1; }
    .cm-log-actions { flex-direction: row; justify-content: stretch; }
    .cm-btn {
        flex: 1;
        justify-content: center;
        font-size: 0.78rem;
        padding: 0.5rem 0.6rem;
        gap: 0.3rem;
    }
    .cm-btn svg { width: 13px; height: 13px; }
    /* Item card: keep 3-col grid but pad name for X button */
    .cm-item-card { position: relative; padding-right: 0.8rem; }
    .cm-item-info { padding-right: 2.2rem; }
    .cm-grams-wrap { justify-content: flex-start; }
}

@media (max-width: 480px) {
    .cm-macro-strip { grid-template-columns: repeat(2, 1fr); gap: 0.5rem; }
    .cm-macro-pill { padding: 0.65rem 0.75rem; }
    .cm-macro-val { font-size: 0.95rem; }
}

/* ===== CALENDAR ===== */
.calendar-interface {
    padding: var(--space-lg);
}

.calendar-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-xl);
}

.calendar-month-label {
    margin-left: 20px;
}

.month-display {
    font-size: 1.2rem;
    font-weight: 700;
}

.nav-btn {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    color: var(--text-primary);
    width: 40px;
    height: 40px;
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
}

.nav-btn:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
}

.calendar-matrix,
.calendar-heatmap {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.calendar-weekdays {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-sm);
    text-align: center;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    margin-bottom: var(--space-sm);
}

.calendar-days-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: var(--space-sm);
}

.calendar-day {
    aspect-ratio: 1;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-sm);
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: var(--transition);
    position: relative;
    min-height: 80px;
}

.calendar-day:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.calendar-day.today {
    border-color: var(--primary);
    border-width: 2px;
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.3);
}

.calendar-day.has-data {
    border-color: var(--success);
}

.calendar-day.empty {
    background: transparent;
    border: none;
    cursor: default;
}

.day-number {
    font-size: 0.9rem;
    font-weight: 600;
    margin-bottom: var(--space-xs);
}

.day-calories {
    font-size: 0.75rem;
    color: var(--text-secondary);
}

.water-indicator {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    color: var(--info);
    margin-top: auto;
}

/* ===== ANALYTICS ===== */
.analytics-header {
    margin-bottom: var(--space-xl);
}

.analytics-grid {
    display: flex;
    flex-direction: column;
    gap: var(--space-xl);
}

.stats-row {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: var(--space-md);
}

.stat-card {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    text-align: center;
}

.stat-label {
    display: block;
    font-size: 0.85rem;
    color: var(--text-muted);
    margin-bottom: var(--space-sm);
}

.stat-value {
    display: block;
    font-size: 1.75rem;
    font-weight: 800;
    color: var(--primary);
}

.chart-container {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-lg);
}

/* ===== FLOATING CONTROLS ===== */
.floating-controls {
    position: fixed;
    bottom: var(--space-xl);
    right: var(--space-xl);
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
    z-index: 900;
}

.control-btn {
    background: var(--primary);
    color: white;
    border: none;
    width: 26px;
    height: 26px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    box-shadow: var(--shadow-glow);
    margin-left: 20px;
}

.control-btn:hover {
    transform: scale(1.1);
    box-shadow: 0 0 30px rgba(102, 126, 234, 0.5);
}

.control-btn svg {
    width: 24px;
    height: 24px;
    stroke: currentColor;
    stroke-width: 2;
    fill: none;
}

.control-btn--today {
    width: auto;
    height: 26px;
    border-radius: 13px;
    padding: 0 0.75rem;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    background: var(--bg-tertiary);
    color: var(--primary-light);
    border: 1px solid rgba(102,126,234,0.35);
    box-shadow: none;
}
.control-btn--today:hover {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
}

/* ===== MODALS (Enhanced Glassmorphism) ===== */
.cyber-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 2002;
    align-items: center;
    justify-content: center;
    backdrop-filter: blur(10px) saturate(180%);
    -webkit-backdrop-filter: blur(10px) saturate(180%);
}

.cyber-modal.active {
    display: flex;
    animation: fadeIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.cyber-modal.hidden {
    display: none;
}

.modal-content {
    background: rgba(30, 41, 59, 0.95);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: var(--radius-lg);
    width: 95%;
    max-width: 500px;
    max-height: 80vh;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 20px 60px 0 rgba(102, 126, 234, 0.4), 0 0 100px rgba(0, 0, 0, 0.8);
    animation: slideUp 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
}

.modal-content.large {
    max-width: 700px;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: var(--space-lg);
    border-bottom: 1px solid var(--border);
}

.modal-header h3 {
    font-size: 1.25rem;
}

.close-modal {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1.5rem;
    cursor: pointer;
    transition: var(--transition);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.close-modal:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
    border-radius: 50%;
}

.modal-body {
    padding: var(--space-lg);
}

.preview-list {
    list-style: none;
    margin-bottom: var(--space-lg);
}

.preview-list li {
    padding: var(--space-sm) 0;
    border-bottom: 1px solid var(--border);
}

.favorite-items {
    list-style: none;
    margin-bottom: var(--space-lg);
}

.favorite-items li {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-md);
    margin-bottom: var(--space-sm);
}

.favorite-item-detail {
    display: flex;
    justify-content: space-between;
    margin-bottom: var(--space-xs);
}

.item-macros {
    display: flex;
    gap: var(--space-md);
    font-size: 0.85rem;
    color: var(--text-secondary);
}

.button-row {
    display: flex;
    gap: var(--space-md);
    justify-content: flex-end;
}

/* ===== SETTINGS ===== */
.settings-grid {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

.setting-group {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.calorie-target-settings {
    display: flex;
    align-items: end;
    gap: var(--space-md);
}

.calorie-target-settings .cyber-input {
    flex: 1;
}

.setting-info {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-style: italic;
}

.account-section h4,
.account-section h5 {
    margin-bottom: var(--space-md);
    color: var(--text-secondary);
}

.user-info {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 10px;
    margin-bottom: var(--space-lg);
}

.password-section {
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.password-form {
    display: flex;
    flex-direction: column;
    gap: var(--space-md);
}

.danger-section {
    background: rgba(248, 113, 113, 0.1);
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    padding: var(--space-lg);
}

.error-message {
    color: var(--danger);
    font-size: 0.85rem;
    margin-top: var(--space-sm);
}

/* ===== LOADING SPINNER (in content) ===== */
.matrix-loader {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: var(--space-xl);
}

.loader-ring {
    width: 40px;
    height: 40px;
    border: 3px solid var(--border);
    border-top-color: var(--primary);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}

/* ===== FOOTER ===== */
.cyber-footer {
    background: var(--bg-secondary);
    border-top: 1px solid var(--border);
    padding: var(--space-xl) var(--space-lg);
    margin-top: var(--space-xl);
}

.footer-content {
    max-width: 800px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: var(--space-md);
}

.footer-section {
    display: flex;
    gap: var(--space-md);
}

.footer-link {
    color: var(--text-secondary);
    text-decoration: none;
    transition: var(--transition);
}

.footer-link:hover {
    color: var(--primary);
}

.footer-link-cyber {
    color: var(--primary);
    text-decoration: none;
    font-weight: 600;
}

.footer-link-cyber:hover {
    color: var(--accent);
}

.footer-center p {
    color: var(--text-muted);
    font-size: 0.9rem;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
    width: 10px;
}

::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
    background: var(--bg-tertiary);
    border-radius: 5px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--primary);
}

/* ===== RESPONSIVE ===== */
@media (max-width: 1024px) {
    .header-content {
        align-items: center;
        margin-left: 80px;
    }

    .search-matrix {
        order: 3;
        flex-basis: 100%;
    }

    .search-wrapper {
        max-width: 450px;
    }
}

@media (max-width: 768px) {
    .results-grid,
    .favorites-grid {
        grid-template-columns: 1fr;
    }

    .calendar-days-grid {
        gap: 0.25rem;
    }

    .calendar-day {
        padding: 0.25rem;
        min-height: 60px;
    }

    .floating-controls {
        bottom: var(--space-md);
        right: var(--space-md);
    }

    .control-btn {
        width: 26px;
        height: 26px;
        margin-left: 15px;
    }

    /* Calendar header: stack title above controls on mobile */
    #calendar-page .section-header {
        flex-direction: column;
        gap: 0.75rem;
    }

    .calendar-controls {
        width: 100%;
        justify-content: center;
        margin-bottom: 0;
        gap: 0.5rem;
    }

    .calendar-controls .control-btn {
        margin-left: 0;
    }

    #calendar-month {
        margin-left: 0;
        font-size: 1rem;
        font-weight: 700;
        min-width: 120px;
        text-align: center;
    }

    .control-btn--today {
        margin-left: 0.5rem;
    }

    #go-to-today-btn {
        width: 48px;
    }

    .action-buttons {
        flex-direction: column;
    }

    .cyber-btn {
        width: 100%;
        justify-content: center;
    }

    /* Mobile background fix - force background rendering */
    html {
        background: #0f172a !important;
        min-height: 100vh;
    }

    body {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) !important;
        background-attachment: scroll !important;
        background-size: 100% 100% !important;
        background-repeat: no-repeat !important;
        background-color: #0f172a !important; /* Fallback solid color */
        min-height: 100vh;
    }

    body::before {
        position: absolute !important;
        min-height: 100vh;
        height: 100%;
        background-image:
            radial-gradient(circle at 20% 50%, rgba(102, 126, 234, 0.08) 0%, transparent 50%),
            radial-gradient(circle at 80% 80%, rgba(118, 75, 162, 0.08) 0%, transparent 50%),
            radial-gradient(circle at 50% 10%, rgba(240, 147, 251, 0.05) 0%, transparent 50%) !important;
    }

    /* Ensure all main containers have transparent backgrounds */
    .app-main-content,
    .app-page,
    .cyber-main {
        background: transparent !important;
    }
}
@media (max-width: 1024px) {
    .cyber-main {
        margin: 0 auto;
        width: 100%;
        padding-left: 20px;
        padding-right: 20px;
    }
}

@media (max-width: 480px) {
    .header-content {
        padding: var(--space-sm);
	flex-wrap: wrap;
	margin: 0;
    }

    .cyber-main {
        padding: var(--space-md);
        padding-left: var(--space-md);
        padding-right: var(--space-md);
        width: 100%;
    }

    .cyber-section {
        padding: var(--space-md);
    }

    .page-title {
        font-size: 1.25rem;
    }

    .section-title {
        font-size: 1.25rem;
    }
}

/* ===== ACCESSIBILITY ===== */
.sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* Focus visible for better accessibility */
*:focus-visible {
    outline: 2px solid var(--primary);
    outline-offset: 2px;
}

/* ===== NOTIFICATION SYSTEM ===== */
#notification-container {
    position: fixed;
    top: 20px;
    right: 20px;
    z-index: 10000;
    pointer-events: none;
}

.toast-notification {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-radius: 12px;
    padding: 16px;
    margin-bottom: 12px;
    min-width: 320px;
    max-width: 420px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4), 0 0 0 1px rgba(255, 255, 255, 0.05);
    pointer-events: auto;
    position: relative;
    overflow: hidden;
    animation: slideInRight 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.toast-notification.removing {
    animation: slideOutRight 0.4s ease-out forwards;
}

@keyframes slideInRight {
    from {
        transform: translateX(450px);
        opacity: 0;
    }
    to {
        transform: translateX(0);
        opacity: 1;
    }
}

@keyframes slideOutRight {
    from {
        transform: translateX(0);
        opacity: 1;
    }
    to {
        transform: translateX(450px);
        opacity: 0;
    }
}

/* Responsive notifications */
@media (max-width: 640px) {
    #notification-container {
        top: 10px;
        right: 10px;
        left: 10px;
    }

    .toast-notification {
        min-width: auto;
        max-width: none;
        width: 100%;
    }

    @keyframes slideInRight {
        from {
            transform: translateY(-100px);
            opacity: 0;
        }
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }

    @keyframes slideOutRight {
        from {
            transform: translateY(0);
            opacity: 1;
        }
        to {
            transform: translateY(-100px);
            opacity: 0;
        }
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .cyber-header,
    .floating-controls,
    .cyber-footer,
    .cyber-modal {
        display: none;
    }

    body {
        background: white;
        color: black;
    }

    .cyber-section {
        border: 1px solid black;
        box-shadow: none;
    }
}


/* ===== COMPACT GOALS SECTION ===== */
.settings-section .setting-card {
    padding: var(--space-lg);
}

.settings-section .setting-card-header {
    margin-bottom: var(--space-md);
}

.settings-section .setting-card-header h3 {
    font-size: 1rem;
}

.settings-section .setting-card-body {
    gap: var(--space-sm);
}

.settings-section .setting-help {
    margin: 0;
    font-size: 0.8125rem;
}

.settings-section .goal-input-group {
    padding: var(--space-xs) var(--space-sm);
}

.settings-section .goal-input {
    font-size: 1.125rem;
}

.settings-section .cyber-btn {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}


/* ===== TRACKER RINGS 2-ROW LAYOUT ===== */
.ring-content {
    position: absolute;
    top: 30%;
    left: 50%;
    transform: translate(-50%, -50%);
    display: flex;
    flex-wrap: wrap;
    justify-content: center;
    align-items: center;
    text-align: center;
    width: 80%;
    gap: 2px;
}

.ring-value,
.ring-separator {
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.2;
}

.ring-separator {
    margin: 0 1px;
}

.ring-goal,
.ring-unit,
.ring-label {
    font-size: 0.7rem;
    color: var(--text-secondary);
    line-height: 1.2;
}

/* Force label to take full width (new row) */
.ring-label {
    flex-basis: 100%;
    margin-top: 2px;
    font-weight: 500;
}

.ring-unit {
    margin-left: 1px;
}

/* Mobile: Keep 2 per row */
@media (max-width: 480px) {
    .tracker-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}


/* ===== MOBILE SIDEBAR CLOSE BUTTON ===== */
.sidebar-close {
    display: none;
    position: absolute;
    top: 1rem;
    right: 1rem;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-radius: var(--radius);
    width: 36px;
    height: 36px;
    padding: 0;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 1000;
}

.sidebar-close svg {
    width: 20px;
    height: 20px;
    color: #ef4444;
}

.sidebar-close:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: #ef4444;
    transform: rotate(90deg);
}

/* Show close button on mobile when sidebar is active */
@media (max-width: 1024px) {
    .sidebar-close {
        display: block;
    }
    
    /* Hide hamburger when sidebar is active */
    .app-sidebar.active ~ .mobile-sidebar-toggle {
        opacity: 0;
        pointer-events: none;
    }
}


/* ===== CALENDAR MOBILE FIX ===== */
@media (max-width: 768px) {
    .calendar-container {
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    
    .calendar-days-grid {
        min-width: 100%;
        gap: 0.2rem;
    }
    
    .calendar-day {
        padding: 0.2rem;
        min-height: 50px;
        font-size: 0.75rem;
    }
    
    .calendar-day-number {
        font-size: 0.875rem;
    }
    
    .calendar-day-cal {
        font-size: 0.625rem;
    }
}

@media (max-width: 480px) {
    .calendar-days-grid {
        gap: 0.15rem;
    }
    
    .calendar-day {
        padding: 0.15rem;
        min-height: 45px;
        font-size: 0.7rem;
    }
    
    .calendar-day-number {
        font-size: 0.75rem;
    }
    
    .calendar-day-cal {
        font-size: 0.5rem;
    }
}

/* ===================================================================
   MEAL PLANNER STYLES
   =================================================================== */

/* Cooldown Warning */
.cooldown-warning {
    display: none;
    align-items: center;
    gap: var(--space-sm);
    padding: var(--space-md);
    background: linear-gradient(135deg, rgba(251, 191, 36, 0.1), rgba(245, 158, 11, 0.1));
    border: 1px solid var(--warning);
    border-radius: var(--radius);
    margin-bottom: var(--space-lg);
    color: var(--warning);
    font-size: 0.95rem;
}

.cooldown-warning svg {
    flex-shrink: 0;
}

.cooldown-warning strong {
    color: var(--warning);
    font-weight: 600;
}

/* Quiz Container */
.quiz-container {
    position: relative;
    min-height: 500px;
}

/* Quiz Progress Bar */
.quiz-progress-bar {
    width: 100%;
    height: 8px;
    background: var(--bg-tertiary);
    border-radius: 100px;
    overflow: hidden;
    margin-bottom: var(--space-xl);
    box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.3);
}

.quiz-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--primary-light));
    transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    animation: pulse-glow 2s ease-in-out infinite;
}

@keyframes pulse-glow {
    0%, 100% {
        box-shadow: 0 0 10px rgba(102, 126, 234, 0.5);
    }
    50% {
        box-shadow: 0 0 20px rgba(102, 126, 234, 0.8);
    }
}

/* Quiz Start Screen */
.quiz-start-screen {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 500px;
}

.quiz-hero {
    text-align: center;
    max-width: 600px;
    padding: var(--space-xl);
}

.quiz-hero svg {
    color: var(--primary);
    margin-bottom: var(--space-lg);
    filter: drop-shadow(0 4px 8px rgba(102, 126, 234, 0.3));
}

.quiz-hero h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.quiz-hero p {
    font-size: 1.1rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-xl);
}

.cyber-btn.large {
    padding: var(--space-md) var(--space-xl);
    font-size: 1.1rem;
    gap: var(--space-sm);
}

/* Quiz Question Screen */
.quiz-question-screen {
    animation: fadeIn 0.3s ease-in-out;
}

.quiz-question-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: var(--space-xl);
    box-shadow: var(--shadow);
}

.question-header {
    margin-bottom: var(--space-xl);
}

.question-number {
    display: inline-block;
    padding: var(--space-xs) var(--space-md);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    color: white;
    border-radius: 100px;
    font-size: 0.85rem;
    font-weight: 600;
    margin-bottom: var(--space-md);
}

.question-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.question-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

/* Question Options */
.question-options {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
    gap: var(--space-md);
    margin-bottom: var(--space-xl);
}

.quiz-option {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: var(--space-sm);
    padding: var(--space-lg);
    background: var(--bg-tertiary);
    border: 2px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    min-height: 120px;
}

.quiz-option:hover {
    background: var(--bg-hover);
    border-color: var(--primary);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.2);
}

.quiz-option.selected {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.15), rgba(118, 75, 162, 0.15));
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.2);
}

.option-icon {
    font-size: 2.5rem;
}

.option-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    text-align: center;
}

.option-check {
    position: absolute;
    top: 8px;
    right: 8px;
    width: 24px;
    height: 24px;
    background: var(--primary);
    border-radius: 50%;
    display: none;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: bold;
}

.quiz-option.selected .option-check {
    display: flex;
}

/* Quiz Input Group */
.quiz-input-group {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-xl);
}

.quiz-number-input {
    flex: 1;
    font-size: 1.2rem;
    text-align: center;
    padding: var(--space-md);
}

.quiz-text-input {
    width: 100%;
    min-height: 100px;
    resize: both;
    max-width:1450px;
    max-height: 380px;
}

/* Question Actions */
.question-actions {
    display: flex;
    justify-content: space-between;
    gap: var(--space-md);
}

/* Quiz Loading Screen */
.quiz-loading-screen {
    display: none;
    align-items: center;
    justify-content: center;
    min-height: 500px;
    animation: fadeIn 0.3s ease-in-out;
}

.loading-animation {
    text-align: center;
}

.loading-spinner {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-xl);
    border: 4px solid var(--bg-tertiary);
    border-top: 4px solid var(--primary);
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

.loading-animation h3 {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    color: var(--text-primary);
}

.loading-animation p {
    font-size: 1rem;
    color: var(--text-secondary);
    margin-bottom: var(--space-lg);
}

.loading-dots {
    display: flex;
    gap: 8px;
    justify-content: center;
}

.loading-dots span {
    width: 8px;
    height: 8px;
    background: var(--primary);
    border-radius: 50%;
    animation: bounce 1.4s infinite ease-in-out both;
}

.loading-dots span:nth-child(1) {
    animation-delay: -0.32s;
}

.loading-dots span:nth-child(2) {
    animation-delay: -0.16s;
}

@keyframes bounce {
    0%, 80%, 100% {
        transform: scale(0);
    }
    40% {
        transform: scale(1);
    }
}

/* Loading tips */
.mp-tip-box {
    margin-top: 2rem;
    max-width: 480px;
    margin-left: auto;
    margin-right: auto;
    background: rgba(102, 126, 234, 0.08);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: var(--radius-md);
    padding: 1rem 1.25rem;
    text-align: left;
    animation: fadeIn 0.5s ease;
}

.mp-tip-label {
    font-size: 0.72rem;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--primary-light);
    text-transform: uppercase;
    margin-bottom: 0.4rem;
}

.mp-tip-text {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.55;
    min-height: 2.5em;
    transition: opacity 0.4s ease;
}

.mp-tip-text.mp-tip-fade {
    opacity: 0;
}

/* Meal Plan Results */
.meal-plan-results {
    display: none;
    animation: fadeIn 0.5s ease-in-out;
}

.results-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: var(--space-lg);
    margin-bottom: var(--space-xl);
    flex-wrap: wrap;
}

.results-title-section h2 {
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: var(--space-sm);
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.results-subtitle {
    font-size: 1rem;
    color: var(--text-secondary);
}

.results-actions {
    display: flex;
    gap: var(--space-md);
    flex-wrap: wrap;
    align-items: flex-start;
}

/* ═══════════════════════════════════════════════════════
   MEAL PLAN RESULTS — card layout redesign
   ═══════════════════════════════════════════════════════ */

/* ── Desktop: horizontal scroll of day columns ── */
.mp-desktop {
    display: flex;
    gap: 0.75rem;
    overflow-x: auto;
    padding-bottom: 0.5rem;
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.mp-desktop::-webkit-scrollbar { height: 5px; }
.mp-desktop::-webkit-scrollbar-track { background: transparent; }
.mp-desktop::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }

.mp-day-col {
    flex: 0 0 220px;
    min-width: 220px;
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

/* Day header pill */
.mp-day-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.15rem;
    background: linear-gradient(135deg, rgba(102,126,234,0.15), rgba(118,75,162,0.10));
    border: 1px solid rgba(102,126,234,0.25);
    border-radius: 12px;
    padding: 0.65rem 0.8rem;
    text-align: center;
    position: sticky;
    top: 0;
    z-index: 1;
}

.mp-day-label {
    font-size: 0.85rem;
    font-weight: 800;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.mp-day-total {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

.mp-day-meals {
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── Meal card (shared desktop + mobile) ── */
.mp-meal-card {
    background: rgba(255,255,255,0.04);
    border: 1px solid rgba(255,255,255,0.09);
    border-radius: 10px;
    padding: 0.75rem 0.85rem;
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    transition: border-color 0.2s, box-shadow 0.2s;
    min-height: 140px;
}

.mp-meal-card:hover {
    border-color: rgba(255,255,255,0.16);
    box-shadow: 0 4px 16px rgba(0,0,0,0.25);
}

.mp-meal-type-tag {
    font-size: 0.6rem;
    font-weight: 800;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--mc-text, var(--primary-light));
    opacity: 0.85;
}

.mp-meal-name {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1.3;
}

.mp-meal-macros {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 0.3rem 0.5rem;
}

.mp-macro-kcal {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--mc-text, var(--primary-light));
    white-space: nowrap;
}

.mp-macro-dots {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
}

.mp-macro-dots span {
    font-size: 0.72rem;
    color: var(--text-muted);
    white-space: nowrap;
}

.mp-macro-dots span strong {
    color: var(--text-secondary);
    font-weight: 700;
}

/* ── Expandable recipe section ── */
.mp-recipe-details {
    margin-top: 0.2rem;
}

.mp-recipe-toggle {
    display: flex;
    align-items: center;
    gap: 0.3rem;
    font-size: 0.68rem;
    font-weight: 700;
    color: var(--mc-text, var(--primary-light));
    cursor: pointer;
    list-style: none;
    user-select: none;
    opacity: 0.8;
    transition: opacity 0.15s;
}

.mp-recipe-toggle::-webkit-details-marker { display: none; }
.mp-recipe-toggle::marker { display: none; }
.mp-recipe-toggle:hover { opacity: 1; }

/* Rotate chevron when open */
.mp-recipe-details[open] .mp-recipe-toggle svg {
    transform: rotate(90deg);
}

.mp-recipe-toggle svg {
    transition: transform 0.2s;
    flex-shrink: 0;
}

.mp-recipe-body {
    margin-top: 0.5rem;
    padding-top: 0.5rem;
    border-top: 1px solid rgba(255,255,255,0.06);
}

.mp-ingredients-list {
    list-style: disc;
    padding-left: 1rem;
    margin: 0 0 0.4rem;
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}

.mp-ingredients-list li {
    font-size: 0.75rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.mp-instructions {
    font-size: 0.73rem;
    color: var(--text-muted);
    font-style: italic;
    line-height: 1.5;
    margin: 0.4rem 0 0;
}

/* ── Mobile: hidden on desktop ── */
.mp-mobile { display: none; }

/* ── Mobile accordion ── */
.mp-day-accordion {
    background: rgba(15,23,42,0.55);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
    transition: border-color 0.2s;
}

.mp-day-accordion[open] {
    border-color: rgba(102,126,234,0.35);
}

.mp-day-accordion-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.85rem 1.1rem;
    cursor: pointer;
    list-style: none;
    user-select: none;
    background: rgba(102,126,234,0.07);
    gap: 0.5rem;
}

.mp-day-accordion-header::-webkit-details-marker { display: none; }
.mp-day-accordion-header::marker { display: none; }

.mp-day-accordion-left {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.mp-day-accordion-label {
    font-size: 0.9rem;
    font-weight: 800;
    color: var(--primary-light);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.mp-day-accordion-count {
    font-size: 0.72rem;
    color: var(--text-muted);
    background: rgba(255,255,255,0.06);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 0.1rem 0.5rem;
}

.mp-day-accordion-right {
    display: flex;
    align-items: center;
    gap: 0.55rem;
    flex-shrink: 0;
}

.mp-day-accordion-kcal {
    font-size: 0.8rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.mp-accordion-chevron {
    color: var(--text-muted);
    transition: transform 0.25s;
    flex-shrink: 0;
}

.mp-day-accordion[open] .mp-accordion-chevron {
    transform: rotate(180deg);
}

.mp-day-accordion-body {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
    padding: 0.85rem 1rem;
}

/* ── Responsive breakpoints ── */
@media (max-width: 768px) {
    .mp-desktop { display: none; }
    .mp-mobile  { display: flex; flex-direction: column; gap: 0.6rem; }
    .mp-meal-card { border-radius: 8px; }
}

@media (min-width: 769px) {
    .mp-mobile { display: none; }
}

/* Inline delete-day confirm (inside calendar popup) */
.delete-confirm-label {
    display: block;
    font-size: 0.85rem;
    color: var(--danger, #ff4d6d);
    margin-bottom: 0.5rem;
}

.delete-confirm-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}

/* Inline redo confirm (meal planner) */
.redo-confirm-panel {
    margin-top: 0.75rem;
    padding: 0.75rem 1rem;
    border: 1px solid var(--danger, #ff4d6d);
    border-radius: var(--radius, 8px);
    background: rgba(255, 77, 109, 0.08);
    text-align: center;
    animation: fadeIn 0.15s ease;
}

.redo-confirm-panel p {
    margin: 0 0 0.6rem;
    font-size: 0.85rem;
    color: var(--text-secondary);
    line-height: 1.4;
}

.redo-confirm-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
    flex-wrap: wrap;
}


@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

#redo-meal-plan-btn svg{
    max-width: 20px;
    }
#export-meal-plan-btn svg{
    max-width: 20px;
    }
#start-quiz-btn svg{
    position: relative;
    top: 11px;
    width: 20px;
}
#quiz-next-btn svg{
    width: 20px;
}
#quiz-back-btn svg{
    width: 20px;
}
#save-db-settings svg{
    width: 20px;
}

/* ── AI Smart Search Info Card ─────────────────────────────────────── */
.ai-info-card {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    background: rgba(99, 102, 241, 0.08);
    border: 1px solid rgba(99, 102, 241, 0.28);
    border-radius: 12px;
    padding: 16px 18px;
    margin: 4px 0 2px;
}

.ai-info-icon {
    flex-shrink: 0;
    width: 36px;
    height: 36px;
    border-radius: 9px;
    background: rgba(99, 102, 241, 0.18);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #818cf8;
    margin-top: 1px;
}

.ai-info-body {
    flex: 1;
    min-width: 0;
}

.ai-info-title {
    font-size: 0.82rem;
    font-weight: 700;
    color: #a5b4fc;
    letter-spacing: 0.02em;
    margin: 0 0 5px;
    text-transform: uppercase;
}

.ai-info-text {
    font-size: 0.82rem;
    color: rgba(255, 255, 255, 0.65);
    line-height: 1.55;
    margin: 0 0 12px;
}

.ai-info-text strong {
    color: rgba(255, 255, 255, 0.88);
    font-weight: 600;
}

.ai-quota-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ai-quota-label {
    font-size: 0.78rem;
    color: rgba(255, 255, 255, 0.5);
    letter-spacing: 0.01em;
}

.ai-quota-badge {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(99, 102, 241, 0.22);
    border: 1px solid rgba(99, 102, 241, 0.4);
    border-radius: 20px;
    padding: 2px 10px;
    font-size: 0.85rem;
    font-weight: 700;
    color: #a5b4fc;
    font-variant-numeric: tabular-nums;
}

.ai-quota-badge.quota-low {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: #fca5a5;
}

.ai-quota-badge.quota-empty {
    background: rgba(239, 68, 68, 0.22);
    border-color: rgba(239, 68, 68, 0.55);
    color: #f87171;
}

.ai-quota-sep {
    opacity: 0.5;
    font-weight: 400;
    margin: 0 1px;
}
/* ── end AI Smart Search Info Card ─────────────────────────────────── */
.results-actions button{
    min-width: 170px;
}

/* Disabled Button Styles */
button:disabled,
button[disabled] {
    opacity: 0.5;
    cursor: not-allowed !important;
    pointer-events: none;
    filter: grayscale(0.5);
}

button:disabled:hover,
button[disabled]:hover {
    transform: none !important;
    box-shadow: none !important;
}

/* ===== NUCLEAR OPTION: FORCE MOBILE BACKGROUND ===== */
/* This must be at the end to override everything else */
@media only screen and (max-width: 768px) {
    html {
        background: #0f172a !important;
        background-color: #0f172a !important;
    }

    body {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) !important;
        background-color: #0f172a !important;
        background-attachment: scroll !important;
        background-size: cover !important;
        background-repeat: no-repeat !important;
        background-position: center !important;
    }

    /* Force transparent on all wrappers - CRITICAL */
    #main-content,
    .app-main-content,
    .cyber-main,
    .app-page,
    .app-wrapper,
    main,
    .cyber-section,
    .dashboard-layout,
    .cyber-header {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) !important;
    }
}

@media only screen and (max-width: 480px) {
    html {
        background: #0f172a !important;
        background-color: #0f172a !important;
    }

    body {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) !important;
        background-color: #0f172a !important;
        background-attachment: scroll !important;
        background-size: cover !important;
        background-repeat: no-repeat !important;
        background-position: center !important;
    }

    /* Force transparent on all wrappers - CRITICAL */
    #main-content,
    .app-main-content,
    .cyber-main,
    .app-page,
    .app-wrapper,
    main,
    .cyber-section,
    .dashboard-layout,
    .cyber-header {
        background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) !important;
        background-color: transparent !important;
    }
}

/* iOS Safari specific - use webkit detection */
@supports (-webkit-touch-callout: none) {
    @media only screen and (max-width: 768px) {
        html {
            background: #0f172a !important;
            background-color: #0f172a !important;
        }

        body {
            background: linear-gradient(135deg, #0f172a 0%, #1e293b 50%, #0f172a 100%) !important;
            background-color: #0f172a !important;
            background-attachment: scroll !important;
            background-size: cover !important;
            background-repeat: no-repeat !important;
            background-position: center !important;
            -webkit-background-size: cover !important;
        }

        /* Force transparent on all wrappers - iOS CRITICAL */
        #main-content,
        .app-main-content,
        .cyber-main,
        .app-page,
        .app-wrapper,
        main,
        .cyber-section,
        .dashboard-layout,
        .cyber-header {
            background: transparent !important;
            background-color: transparent !important;
        }
    }
}

/* ===== ANALYTICS PAGE STYLES ===== */

/* Streaks Grid */
.streaks-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

.streak-card {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.05), rgba(118, 75, 162, 0.05));
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    display: flex;
    gap: var(--space-md);
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.streak-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 3px;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    opacity: 0;
    transition: opacity 0.3s ease;
}

.streak-card:hover {
    transform: translateY(-4px);
    border-color: var(--primary);
    box-shadow: 0 8px 30px rgba(102, 126, 234, 0.3);
}

.streak-card:hover::before {
    opacity: 1;
}

.streak-icon {
    font-size: 2.5rem;
    line-height: 1;
}

.streak-content {
    flex: 1;
}

.streak-value {
    font-size: 2.5rem;
    font-weight: 700;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    line-height: 1.2;
    margin-bottom: var(--space-xs);
}

.streak-label {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-xs);
}

.streak-subtitle {
    font-size: 0.875rem;
    color: var(--text-muted);
}

/* Analytics Grid */
.analytics-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

.analytics-stat-card {
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--radius-lg);
    padding: var(--space-lg);
    transition: all 0.3s ease;
}

.analytics-stat-card:hover {
    border-color: rgba(102, 126, 234, 0.4);
    box-shadow: 0 4px 20px rgba(102, 126, 234, 0.2);
}

.stat-header {
    display: flex;
    align-items: center;
    gap: var(--space-sm);
    margin-bottom: var(--space-md);
}

.stat-icon {
    font-size: 1.5rem;
}

.stat-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
}

.stat-value-large {
    font-size: 2.25rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-sm);
    line-height: 1;
}

.stat-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 0.875rem;
    color: var(--text-muted);
}

.stat-avg strong,
.stat-goal {
    color: var(--text-secondary);
}

/* Records Grid */
.records-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

.record-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius);
    padding: var(--space-lg);
    transition: all 0.3s ease;
}

.record-card.best {
    background: linear-gradient(135deg, rgba(102, 126, 234, 0.1), rgba(240, 147, 251, 0.05));
    border-color: var(--primary);
}

.record-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.2);
}

.record-label {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--primary);
    margin-bottom: var(--space-sm);
}

.record-date {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-md);
}

.record-details {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.record-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.record-stat strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Chart Controls */
.chart-controls {
    display: flex;
    gap: var(--space-sm);
}

.chart-toggle-btn {
    padding: var(--space-sm) var(--space-md);
    background: rgba(30, 41, 59, 0.6);
    border: 1px solid rgba(102, 126, 234, 0.2);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
}

.chart-toggle-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.chart-toggle-btn.active {
    background: linear-gradient(135deg, var(--primary), var(--primary-light));
    border-color: var(--primary);
    color: white;
    box-shadow: 0 0 15px rgba(102, 126, 234, 0.4);
}

/* Weekly Comparison */
.weekly-comparison {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
    gap: var(--space-lg);
    margin-top: var(--space-lg);
}

.week-card {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(102, 126, 234, 0.15);
    border-radius: var(--radius);
    padding: var(--space-lg);
    transition: all 0.3s ease;
}

.week-card:hover {
    border-color: rgba(102, 126, 234, 0.4);
    transform: scale(1.02);
}

.week-header {
    font-size: 1.125rem;
    font-weight: 700;
    color: var(--primary);
    margin-bottom: var(--space-md);
    padding-bottom: var(--space-sm);
    border-bottom: 1px solid rgba(102, 126, 234, 0.2);
}

.week-stats {
    display: flex;
    flex-direction: column;
    gap: var(--space-sm);
}

.week-stat {
    display: flex;
    justify-content: space-between;
    font-size: 0.875rem;
    color: var(--text-secondary);
}

.week-stat strong {
    color: var(--text-primary);
    font-weight: 600;
}

/* Responsive Analytics */
@media (max-width: 768px) {
    .streaks-grid {
        grid-template-columns: 1fr;
    }

    .analytics-grid {
        grid-template-columns: 1fr;
    }

    .records-grid {
        grid-template-columns: 1fr;
    }

    .weekly-comparison {
        grid-template-columns: 1fr;
    }

    .chart-controls {
        flex-wrap: wrap;
    }

    .streak-value {
        font-size: 2rem;
    }

    .stat-value-large {
        font-size: 1.75rem;
    }
}

/* ═══════════════════════════════════════════════════════
   BODY TRACKER — New Feature Styles
   ═══════════════════════════════════════════════════════ */

/* Section badge */
.bt-section-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    color: var(--primary);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: 20px;
    padding: 0.2rem 0.55rem;
    background: rgba(102, 126, 234, 0.08);
}

/* ── KPI Strip ── */
.bt-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
    margin-bottom: 1.25rem;
}

.bt-kpi {
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.25rem;
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    transition: border-color 0.2s, transform 0.2s;
}

.bt-kpi:hover {
    border-color: var(--primary);
    transform: translateY(-2px);
}

.bt-kpi-label {
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 1px;
    text-transform: uppercase;
    color: var(--text-muted);
}

.bt-kpi-value {
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.bt-kpi-value span {
    font-size: 0.85rem;
    color: var(--text-muted);
    font-weight: 500;
}

.bt-kpi-sub {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.bt-kpi--primary .bt-kpi-value { color: var(--primary); }
.bt-kpi--success .bt-kpi-value { color: var(--success); }
.bt-kpi--accent  .bt-kpi-value { color: var(--accent); }

/* ── Goal bar ── */
.bt-goal-bar-wrap {
    display: flex;
    align-items: center;
    gap: 1rem;
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1.25rem;
    margin-bottom: 1.5rem;
}

.bt-goal-label {
    font-size: 0.7rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    white-space: nowrap;
}

.bt-goal-bar-track {
    flex: 1;
    height: 7px;
    background: rgba(51, 65, 85, 0.6);
    border-radius: 4px;
    overflow: hidden;
}

.bt-goal-bar-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--primary), var(--accent));
    border-radius: 4px;
    width: 0%;
    transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
}

.bt-goal-pct {
    font-size: 0.8rem;
    color: var(--primary);
    font-weight: 700;
    white-space: nowrap;
    min-width: 3.5rem;
    text-align: right;
}

.bt-goal-set {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.bt-goal-input {
    width: 90px;
    padding: 0.38rem 0.6rem;
    background: rgba(15, 23, 42, 0.8);
    border: 1px solid var(--border);
    color: var(--text-primary);
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-size: 0.82rem;
}

.bt-goal-input:focus {
    outline: none;
    border-color: var(--primary);
}

.bt-goal-btn {
    padding: 0.38rem 0.8rem;
    background: transparent;
    border: 1px solid var(--primary);
    color: var(--primary);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}

.bt-goal-btn:hover {
    background: var(--primary);
    color: var(--bg-primary);
}

/* ── Two-column body ── */
.bt-body {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.25rem;
    align-items: start;
}

.bt-left-col {
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

/* ── Chart card ── */
.bt-chart-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.bt-chart-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.bt-chart-controls {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    flex-wrap: wrap;
    flex-shrink: 0;
}

.bt-chart-title {
    font-size: 0.75rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

.bt-period-tabs {
    display: flex;
    gap: 4px;
}

.bt-period-tab {
    padding: 0.28rem 0.7rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.bt-period-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.bt-chart-type-tab {
    padding: 0.28rem 0.7rem;
    font-size: 0.7rem;
    font-weight: 700;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.bt-chart-type-tab.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

.bt-chart-canvas-wrap {
    position: relative;
    height: 230px;
}

.bt-chart-canvas-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* ── Measurement chips ── */
.bt-measure-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.bt-measure-chip {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem 0.9rem;
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    transition: border-color 0.2s;
}

.bt-measure-chip:hover { border-color: rgba(102, 126, 234, 0.4); }

.bt-measure-chip-label {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
    font-weight: 700;
}

.bt-measure-chip-val {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-secondary);
}

.bt-measure-chip-delta { font-size: 0.65rem; }
.bt-measure-chip-delta.pos { color: var(--danger); }
.bt-measure-chip-delta.neg { color: var(--success); }
.bt-measure-chip-delta.neu { color: var(--text-muted); }

/* ── Right sidebar ── */
.bt-side-col {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

/* ── Add entry card ── */
.bt-add-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.bt-add-card h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin: 0 0 0.9rem;
}

/* Tab bar */
.bt-tab-bar {
    display: flex;
    gap: 5px;
    margin-bottom: 1rem;
}

.bt-tab-btn {
    flex: 1;
    padding: 0.42rem;
    font-size: 0.7rem;
    font-weight: 700;
    text-align: center;
    border-radius: var(--radius-sm);
    border: 1px solid var(--border);
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s;
}

.bt-tab-btn.active {
    background: rgba(102, 126, 234, 0.12);
    border-color: var(--primary);
    color: var(--primary);
}

.bt-tab-pane { display: none; }
.bt-tab-pane.active { display: block; }

/* Form fields */
.bt-field { margin-bottom: 0.75rem; }

.bt-field label {
    display: block;
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-bottom: 0.28rem;
}

.bt-input {
    width: 100%;
    padding: 0.52rem 0.75rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.83rem;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.bt-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.bt-row-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.55rem;
}

.bt-submit-btn {
    width: 100%;
    padding: 0.65rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.82rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    margin-top: 0.35rem;
    letter-spacing: 0.3px;
}

.bt-submit-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.bt-submit-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

.bt-msg {
    font-size: 0.76rem;
    margin-top: 0.45rem;
    min-height: 1rem;
}

.bt-msg.ok { color: var(--success); }
.bt-msg.err { color: var(--danger); }

/* ── History card ── */
.bt-history-card {
    background: rgba(15, 23, 42, 0.5);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.25rem;
}

.bt-history-card h4 {
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
    margin: 0 0 0.9rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.bt-history-count {
    font-size: 0.68rem;
    color: var(--text-muted);
    background: rgba(51, 65, 85, 0.5);
    padding: 0.18rem 0.5rem;
    border-radius: 20px;
    font-weight: 600;
    text-transform: none;
    letter-spacing: 0;
}

.bt-history-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.78rem;
}

.bt-history-table th {
    text-align: left;
    color: var(--text-muted);
    font-weight: 700;
    font-size: 0.62rem;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    padding: 0 0.6rem 0.5rem;
    border-bottom: 1px solid var(--border);
}

.bt-history-table th:first-child { padding-left: 0.2rem; }
.bt-history-table th:last-child  { padding-right: 0; }

.bt-history-table td {
    padding: 0.52rem 0.6rem;
    border-bottom: 1px solid rgba(51, 65, 85, 0.3);
    color: var(--text-muted);
    vertical-align: middle;
}

.bt-history-table td:first-child { color: var(--text-secondary); font-size: 0.72rem; padding-left: 0.2rem; }
.bt-history-table td:last-child  { padding-right: 0; }
.bt-history-table td.val { color: var(--text-primary); font-weight: 700; }

.bt-trend-up   { color: var(--danger);  font-size: 0.7rem; }
.bt-trend-down { color: var(--success); font-size: 0.7rem; }
.bt-trend-flat { color: var(--text-muted); font-size: 0.7rem; }

.bt-del-btn {
    background: none;
    border: none;
    color: var(--border);
    cursor: pointer;
    font-size: 0.85rem;
    padding: 0 0.25rem;
    transition: color 0.2s;
    line-height: 1;
}

.bt-del-btn:hover { color: var(--danger); }

.bt-empty {
    color: var(--text-muted);
    font-size: 0.78rem;
    padding: 0.5rem 0;
}

.bt-history-scroll {
    max-height: 230px;
    overflow-y: auto;
}

.bt-history-scroll::-webkit-scrollbar { width: 4px; }
.bt-history-scroll::-webkit-scrollbar-track { background: transparent; }
.bt-history-scroll::-webkit-scrollbar-thumb { background: var(--border); border-radius: 2px; }

/* ═══════════════════════════════════════════════════════
   COMPACT OVERRIDES — Macros section & Weekly section
   ═══════════════════════════════════════════════════════ */

/* Compact cyber-section: less padding/margin */
.cyber-section--compact {
    padding: var(--space-lg);
    margin-bottom: var(--space-lg);
}

.cyber-section--compact:hover {
    transform: none;
}

/* Compact section header */
.section-header--sm {
    margin-bottom: var(--space-md);
}

.section-title--sm {
    font-size: 1rem;
}

/* Compact tracker rings */
.tracker-grid--compact {
    grid-template-columns: repeat(5, 1fr);
    gap: 0.75rem;
    padding: 0.25rem;
}

.tracker-grid--compact .progress-ring {
    width: 100px;
    height: 100px;
}

.tracker-grid--compact .ring-percentage {
    font-size: 1.1rem;
}

.tracker-grid--compact .ring-label {
    font-size: 0.6rem;
}

.tracker-grid--compact .ring-stats {
    font-size: 0.72rem;
}

.tracker-grid--compact .tracker-ring-container {
    gap: 0.4rem;
}

/* Compact suggestions */
.suggestions-grid--compact {
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    gap: 0.65rem;
}

.suggestions-grid--compact .suggestion-card {
    padding: var(--space-md);
    gap: 0.65rem;
}

.suggestions-grid--compact .suggestion-icon {
    font-size: 1.4rem;
}

.suggestions-grid--compact .suggestion-content h3 {
    font-size: 0.85rem;
}

.suggestions-grid--compact .suggestion-content p {
    font-size: 0.75rem;
}

/* ── Weekly compact rows ── */
.weekly-compact-grid {
    display: flex;
    flex-direction: column;
    gap: 0.75rem;
}

.weekly-compact-row {
    display: flex;
    align-items: center;
    gap: 0.85rem;
}

.weekly-compact-icon {
    font-size: 1.1rem;
    flex-shrink: 0;
    width: 1.5rem;
    text-align: center;
}

.weekly-compact-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-secondary);
    white-space: nowrap;
    width: 70px;
    flex-shrink: 0;
}

.weekly-compact-bar-track {
    flex: 1;
    height: 7px;
    background: rgba(30, 41, 59, 0.8);
    border-radius: 999px;
    overflow: hidden;
}

.weekly-compact-values {
    display: flex;
    align-items: baseline;
    gap: 0.2rem;
    font-size: 0.8rem;
    white-space: nowrap;
    width: 140px;
    flex-shrink: 0;
    justify-content: flex-end;
}

.weekly-compact-values .current-value {
    font-weight: 700;
    color: var(--primary);
}

.weekly-compact-values .separator { color: var(--text-muted); }
.weekly-compact-values .goal-value { color: var(--text-secondary); }
.weekly-compact-values .unit { font-size: 0.7rem; color: var(--text-muted); }

/* ── Responsive breakpoints ── */
@media (max-width: 1200px) {
    .bt-body { grid-template-columns: 1fr 340px; }
    .bt-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 900px) {
    .bt-body { grid-template-columns: 1fr; }
    .bt-goal-bar-wrap { flex-wrap: wrap; }
    .bt-measure-grid { grid-template-columns: repeat(3, 1fr); }
    .tracker-grid--compact { grid-template-columns: repeat(3, 1fr); }
}

@media (max-width: 600px) {
    .bt-kpi-row { grid-template-columns: repeat(2, 1fr); }
    .bt-measure-grid { grid-template-columns: repeat(2, 1fr); }
    .bt-row-2 { grid-template-columns: 1fr; }
    .tracker-grid--compact { grid-template-columns: repeat(2, 1fr); }
    .weekly-compact-values { width: auto; min-width: 110px; }

    /* Chart cards: hard stop on overflow */
    .bt-chart-card { overflow: hidden; min-width: 0; }
    .bt-chart-canvas-wrap { overflow: hidden; min-width: 0; width: 100%; }
    .bt-chart-canvas-wrap canvas { max-width: 100% !important; }

    /* Chart header: stack title above controls */
    .bt-chart-header { flex-direction: column; align-items: flex-start; }
    .bt-chart-controls { width: 100%; justify-content: flex-start; }

    /* Each tab group fills evenly */
    .bt-period-tabs { flex-wrap: nowrap; }
    .bt-period-tab,
    .bt-chart-type-tab {
        flex: 1 1 auto;
        text-align: center;
        padding: 0.28rem 0.35rem;
        font-size: 0.65rem;
        min-width: 0;
    }
}

/* ═══════════════════════════════════════════════════════
   HYDRATION PAGE — Full Redesign
   ═══════════════════════════════════════════════════════ */

/* Date picker in section header */
.hydro-date-wrap { display: flex; align-items: center; flex-direction: column; }
.hydro-date-input {
    padding: 0.42rem 0.7rem;
    background: rgba(15, 23, 42, 0.75);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.83rem;
    cursor: pointer;
    transition: border-color 0.2s;
}
.hydro-date-input:focus { outline: none; border-color: #06b6d4; }

/* ── Two-column layout ── */
.hydro-layout {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 2.5rem;
    align-items: center;
}

/* ── LEFT: Ring visualization ── */
.hydro-vis {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1.25rem;
}

.hydro-ring-wrap {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: filter 0.5s ease;
}

.hydro-ring-wrap--done {
    filter: drop-shadow(0 0 20px rgba(74, 222, 128, 0.35));
}

.hydro-ring-svg {
    width: 220px;
    height: 220px;
    overflow: visible;
}

#hydro-ring-circle {
    stroke-dasharray: 565.49;
    stroke-dashoffset: 565.49;
    transition: stroke-dashoffset 0.85s cubic-bezier(0.4, 0, 0.2, 1),
                stroke 0.4s ease;
    filter: drop-shadow(0 0 8px rgba(6, 182, 212, 0.55));
}

#hydro-ring-circle.done {
    filter: drop-shadow(0 0 10px rgba(74, 222, 128, 0.6));
}

.hydro-ring-center {
    position: absolute;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    pointer-events: none;
}

.hydro-pct {
    font-size: 2.75rem;
    font-weight: 800;
    color: #06b6d4;
    line-height: 1;
    transition: color 0.4s;
}

.hydro-pct.done { color: var(--success); }

.hydro-liters {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    line-height: 1;
}

.hydro-goal-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Status pill ── */
.hydro-status {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.42rem 1.1rem;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    border: 1px solid var(--border);
    background: rgba(15, 23, 42, 0.55);
    color: var(--text-muted);
    transition: all 0.35s ease;
    max-width: 280px;
    text-align: center;
}

.hydro-status-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--text-muted);
    flex-shrink: 0;
    transition: background 0.3s;
}

.hydro-status--empty  { border-color: var(--border); color: var(--text-muted); }
.hydro-status--low    { border-color: rgba(248,113,113,0.45); color: var(--danger); background: rgba(248,113,113,0.06); }
.hydro-status--low    .hydro-status-dot { background: var(--danger); }
.hydro-status--mid    { border-color: rgba(251,191,36,0.45); color: var(--warning); background: rgba(251,191,36,0.06); }
.hydro-status--mid    .hydro-status-dot { background: var(--warning); animation: hydroDotPulse 1.5s ease-in-out infinite; }
.hydro-status--good   { border-color: rgba(6,182,212,0.45); color: #06b6d4; background: rgba(6,182,212,0.06); }
.hydro-status--good   .hydro-status-dot { background: #06b6d4; }
.hydro-status--done   { border-color: rgba(74,222,128,0.45); color: var(--success); background: rgba(74,222,128,0.06); }
.hydro-status--done   .hydro-status-dot { background: var(--success); animation: hydroDotPulse 1.2s ease-in-out infinite; }

@keyframes hydroDotPulse {
    0%, 100% { opacity: 1; transform: scale(1); }
    50%       { opacity: 0.4; transform: scale(1.4); }
}

/* ── Summary chips (Remaining / Goal / Logged) ── */
.hydro-summary-chips {
    display: flex;
    gap: 0.65rem;
}

.hydro-chip {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.18rem;
    background: rgba(15, 23, 42, 0.55);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.65rem 0.5rem;
}

.hydro-chip-label {
    font-size: 0.58rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.7px;
}

.hydro-chip-val {
    font-size: 0.92rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── RIGHT: Controls ── */
.hydro-controls {
    display: flex;
    flex-direction: column;
    gap: 1.1rem;
}

.hydro-section-lbl {
    font-size: 0.65rem;
    font-weight: 700;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.9px;
}

/* Quick-add grid */
.hydro-quick-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.6rem;
}

.hydro-quick-btn {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.22rem;
    padding: 0.9rem 0.4rem 0.75rem;
    background: rgba(15, 23, 42, 0.6);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    cursor: pointer;
    font-family: inherit;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    color: var(--text-secondary);
    position: relative;
    overflow: hidden;
}

.hydro-quick-btn::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(6,182,212,0.12), rgba(59,130,246,0.08));
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: inherit;
}

.hydro-quick-btn:hover::before,
.hydro-quick-btn:focus::before { opacity: 1; }

.hydro-quick-btn:hover,
.hydro-quick-btn:focus {
    border-color: #06b6d4;
    color: #06b6d4;
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(6, 182, 212, 0.2);
    outline: none;
}

.hydro-quick-btn:active {
    transform: translateY(0) scale(0.97);
}

.hydro-quick-btn--reset {
    border-color: rgba(248,113,113,0.3);
    color: var(--text-muted);
}

.hydro-quick-btn--reset::before {
    background: linear-gradient(135deg, rgba(248,113,113,0.1), rgba(248,113,113,0.06));
}

.hydro-quick-btn--reset:hover,
.hydro-quick-btn--reset:focus {
    border-color: var(--danger);
    color: var(--danger);
    box-shadow: 0 6px 20px rgba(248, 113, 113, 0.18);
}

.hydro-quick-icon {
    font-size: 1.25rem;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.hydro-reset-icon {
    font-size: 1.4rem;
}

.hydro-quick-val {
    font-size: 0.82rem;
    font-weight: 700;
    line-height: 1;
    position: relative;
    z-index: 1;
}

.hydro-quick-sub {
    font-size: 0.6rem;
    color: var(--text-muted);
    line-height: 1;
    position: relative;
    z-index: 1;
}

.hydro-quick-btn:hover .hydro-quick-sub { color: rgba(6,182,212,0.7); }
.hydro-quick-btn--reset:hover .hydro-quick-sub { color: rgba(248,113,113,0.7); }

/* Divider */
.hydro-divider {
    height: 1px;
    background: var(--border);
    opacity: 0.5;
}

/* Custom amount input row */
.hydro-custom-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.hydro-custom-input {
    flex: 1;
    padding: 0.65rem 0.8rem;
    background: rgba(15, 23, 42, 0.7);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    transition: border-color 0.2s;
}

.hydro-custom-input:focus {
    outline: none;
    border-color: #06b6d4;
    box-shadow: 0 0 0 2px rgba(6, 182, 212, 0.15);
}

.hydro-custom-unit {
    font-size: 0.9rem;
    font-weight: 600;
    color: var(--text-muted);
    flex-shrink: 0;
}

.hydro-custom-btn {
    padding: 0.65rem 1.25rem;
    background: linear-gradient(135deg, #06b6d4, #3b82f6);
    color: #fff;
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 700;
    font-size: 0.85rem;
    cursor: pointer;
    transition: opacity 0.2s, transform 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.hydro-custom-btn:hover { opacity: 0.88; transform: translateY(-1px); }
.hydro-custom-btn:disabled { opacity: 0.5; cursor: not-allowed; transform: none; }

/* Inline save feedback */
.hydro-save-msg {
    font-size: 0.75rem;
    min-height: 1rem;
    color: var(--success);
    font-weight: 600;
    transition: opacity 0.3s;
}

/* ── Weekly chart ── */
.hydro-chart-wrap {
    height: 180px;
    position: relative;
}

.hydro-chart-wrap canvas {
    width: 100% !important;
    height: 100% !important;
}

/* Legend row */
.hydro-week-legend {
    display: flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.68rem;
    color: var(--text-muted);
    font-weight: 500;
}

.hydro-legend-dot {
    display: inline-block;
    width: 8px;
    height: 8px;
    border-radius: 50%;
}

.hydro-legend-dot--goal { background: rgba(102,126,234,0.7); }
.hydro-legend-dot--met  { background: rgba(74,222,128,0.8); }

/* ── Celebrate: ring pulse when goal met ── */
@keyframes hydroCelebrate {
    0%   { filter: drop-shadow(0 0 6px rgba(74,222,128,0.3)); }
    50%  { filter: drop-shadow(0 0 22px rgba(74,222,128,0.7)); }
    100% { filter: drop-shadow(0 0 6px rgba(74,222,128,0.3)); }
}

.hydro-ring-wrap--done {
    animation: hydroCelebrate 2.5s ease-in-out infinite;
}

/* ── Button flash on click ── */
@keyframes hydroBtnFlash {
    0%   { box-shadow: 0 0 0 0 rgba(6,182,212,0.5); }
    70%  { box-shadow: 0 0 0 10px rgba(6,182,212,0); }
    100% { box-shadow: 0 0 0 0 rgba(6,182,212,0); }
}

.hydro-quick-btn.flash {
    animation: hydroBtnFlash 0.45s ease-out forwards;
}

/* ── Responsive ── */
@media (max-width: 900px) {
    .hydro-layout {
        grid-template-columns: 1fr;
        gap: 1.75rem;
    }
}

@media (max-width: 560px) {
    .hydro-ring-svg { width: 180px; height: 180px; }
    .hydro-pct { font-size: 2.2rem; }
    .hydro-quick-grid { grid-template-columns: repeat(2, 1fr); }
    .hydro-summary-chips { gap: 0.45rem; }
    .hydro-chip-val { font-size: 0.82rem; }
}

/* =============================================
   BARCODE SCANNER — scan button + modal
   ============================================= */

/* Scan button — sits next to search-btn inside .search-wrapper */
.scan-btn {
    background: linear-gradient(135deg, #764ba2, #667eea);
    color: white;
    border: none;
    padding: var(--space-sm) var(--space-md);
    border-radius: var(--radius-sm);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
    transition: var(--transition);
    flex-shrink: 0;
}

.scan-btn:hover {
    background: linear-gradient(135deg, #8b5cf6, #7c3aed);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(118, 75, 162, 0.4);
}

/* ─────────────────────────────────────────────────────────
   AI Natural Language Log — toggle button & panel
   ───────────────────────────────────────────────────────── */

/* Button lives inside .search-wrapper alongside scan-btn */
.nl-log-toggle-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.55rem 1rem;
    background: linear-gradient(135deg, #10b981, #059669);
    border: none;
    border-radius: 5px;
    color: #fff;
    font-size: 0.75rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.2s, transform 0.15s, box-shadow 0.2s;
    white-space: nowrap;
    flex-shrink: 0;
}

.nl-log-toggle-btn:hover {
    background: linear-gradient(135deg, #059669, #047857);
    box-shadow: 0 4px 12px rgba(16, 185, 129, 0.35);
}

.nl-log-toggle-btn.active {
    background: linear-gradient(135deg, #f59e0b, #d97706);
    box-shadow: 0 4px 12px rgba(245, 158, 11, 0.35);
}

/* Panel — fixed, centered, below sticky header (top set by JS) */
.nl-log-panel {
    position: fixed;
    top: 80px; /* fallback; overridden by JS on open */
    left: 50%;
    transform: translateX(-50%);
    width: min(660px, calc(100vw - 1.5rem));
    z-index: 1200;
    background: var(--bg-secondary);
    border: 1px solid rgba(16, 185, 129, 0.35);
    border-radius: var(--radius-lg);
    box-shadow: 0 16px 48px rgba(0,0,0,0.55), 0 0 0 1px rgba(16,185,129,0.1);
    animation: nlPanelIn 0.16s ease;
}

@keyframes nlPanelIn {
    from { opacity: 0; transform: translateX(-50%) translateY(-6px); }
    to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

.nl-log-panel-inner {
    padding: 0.9rem 1.1rem 1rem;
}

.nl-log-header {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    margin-bottom: 0.75rem;
}

.nl-log-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 0.82rem;
    font-weight: 600;
    color: #10b981;
    flex: 1;
}

.nl-log-quota {
    font-size: 0.7rem;
    color: var(--text-secondary);
    white-space: nowrap;
}

.nl-log-close {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 2px;
    border-radius: 4px;
    transition: color 0.15s;
    display: flex;
    align-items: center;
    flex-shrink: 0;
}
.nl-log-close:hover { color: var(--text-primary); }

.nl-log-body {
    display: flex;
    gap: 0.65rem;
    align-items: flex-end;
}

.nl-log-textarea {
    flex: 1;
    background: var(--bg-tertiary);
    border: 1px solid rgba(102, 126, 234, 0.25);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-size: 0.83rem;
    padding: 0.6rem 0.8rem;
    resize: none;
    font-family: inherit;
    transition: border-color 0.2s;
    line-height: 1.45;
    min-height: 60px;
}
.nl-log-textarea:focus {
    outline: none;
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16,185,129,0.12);
}
.nl-log-textarea::placeholder { color: var(--text-muted, #6b7280); }

.nl-log-submit {
    white-space: nowrap;
    flex-shrink: 0;
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border-color: transparent !important;
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 0.55rem 1rem;
}
.nl-log-submit:hover {
    background: linear-gradient(135deg, #059669, #047857) !important;
}
.nl-log-submit:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Parsed items preview */
.nl-log-preview {
    margin-top: 0.75rem;
    border-top: 1px solid rgba(102,126,234,0.15);
    padding-top: 0.65rem;
}

.nl-preview-title {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.45rem;
}

.nl-preview-items {
    display: flex;
    flex-direction: column;
    gap: 0.35rem;
    max-height: 180px;
    overflow-y: auto;
}

.nl-preview-item {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    background: var(--bg-tertiary);
    border-radius: var(--radius-md);
    padding: 0.4rem 0.65rem;
    font-size: 0.78rem;
    gap: 0.5rem;
}

.nl-preview-item-name {
    flex: 1;
    font-weight: 500;
    color: var(--text-primary);
}

.nl-preview-item-meta {
    color: var(--text-secondary);
    font-size: 0.72rem;
    white-space: nowrap;
    flex-shrink: 0;
}

.nl-preview-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
    margin-top: 0.55rem;
}

.nl-preview-confirm {
    background: linear-gradient(135deg, #10b981, #059669) !important;
    border-color: transparent !important;
}

.nl-log-error {
    margin-top: 0.5rem;
    font-size: 0.78rem;
    color: #f87171;
    padding: 0.45rem 0.65rem;
    background: rgba(248, 113, 113, 0.1);
    border-radius: var(--radius-md);
    border: 1px solid rgba(248,113,113,0.25);
}

/* Mobile: full-width panel flush to viewport edges */
@media (max-width: 600px) {
    .nl-log-panel {
        /* top is set by JS; these override the desktop centering */
        left: 0;
        right: 0;
        transform: none;
        width: 100%;
        border-radius: 0 0 var(--radius-lg) var(--radius-lg);
        border-left: none;
        border-right: none;
        border-top: none;
        animation: nlPanelInMobile 0.16s ease;
    }

    @keyframes nlPanelInMobile {
        from { opacity: 0; transform: translateY(-4px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    .nl-log-body {
        flex-direction: column;
        align-items: stretch;
    }

    .nl-log-submit {
        width: 100%;
        justify-content: center;
    }

    .nl-preview-item {
        flex-direction: column;
        gap: 0.2rem;
    }

    .nl-preview-item-meta {
        white-space: normal;
    }
}

/* Modal backdrop */
.barcode-modal {
    position: fixed;
    inset: 0;
    z-index: 9999;
    background: rgba(5, 10, 24, 0.88);
    backdrop-filter: blur(6px);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
}

/* Modal card */
.barcode-modal-inner {
    background: var(--bg-secondary);
    border: 1px solid rgba(102, 126, 234, 0.3);
    border-radius: var(--radius-lg);
    box-shadow: 0 24px 64px rgba(0,0,0,0.6), 0 0 0 1px rgba(102,126,234,0.1);
    padding: 1.5rem;
    width: 100%;
    max-width: 420px;
    display: flex;
    flex-direction: column;
    gap: 1rem;
}

.barcode-modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.barcode-modal-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0;
    background: linear-gradient(135deg, var(--primary), var(--accent));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.barcode-close-btn {
    background: rgba(255,255,255,0.06);
    border: 1px solid rgba(255,255,255,0.1);
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: var(--transition);
    flex-shrink: 0;
}

.barcode-close-btn:hover {
    background: rgba(248, 113, 113, 0.15);
    border-color: var(--danger);
    color: var(--danger);
}

/* Camera feed wrapper — html5-qrcode renders inside #barcode-reader */
.barcode-video-wrap {
    width: 100%;
    border-radius: var(--radius);
    overflow: hidden;
    background: #000;
}

/* Make html5-qrcode fill the wrapper and look right on dark theme */
#barcode-reader {
    width: 100%;
    background: #000;
    border-radius: var(--radius);
}

/* Override html5-qrcode default light-mode borders/backgrounds */
#barcode-reader > div {
    border: none !important;
    background: transparent !important;
    padding: 0 !important;
    overflow: visible !important;
}
/* Keep the scan region box visible so the decoder knows where to look */
#barcode-reader > div > div[style] {
    border: 2px solid rgba(102, 126, 234, 0.8) !important;
}

#barcode-reader video {
    border-radius: var(--radius);
    width: 100% !important;
}

/* html5-qrcode draws the qrbox outline via canvas — keep it visible */
#barcode-reader canvas {
    border-radius: var(--radius);
}

.barcode-hint {
    font-size: 0.8rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

.barcode-status {
    font-size: 0.78rem;
    color: var(--primary);
    text-align: center;
    margin: 0;
    min-height: 1em;
    font-weight: 500;
}

@media (max-width: 480px) {
    .barcode-modal-inner { padding: 1rem; }
    .scan-btn { padding: var(--space-sm); }
}

/* ===================================================================
   FOOD ITEM THUMBNAIL + LIGHTBOX
   =================================================================== */

.food-thumb {
    width: 52px;
    height: 52px;
    object-fit: contain;
    border-radius: var(--radius-sm);
    background: rgba(255,255,255,0.04);
    flex-shrink: 0;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.15s;
    border: 1px solid rgba(255,255,255,0.08);
}

.food-thumb:hover {
    opacity: 0.85;
    transform: scale(1.06);
}

/* Lightbox overlay */
.food-lightbox {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 9999;
    align-items: center;
    justify-content: center;
}

.food-lightbox-backdrop {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.85);
    backdrop-filter: blur(6px);
}

.food-lightbox-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    max-width: min(480px, 90vw);
    padding: 1.5rem;
    background: var(--surface);
    border: 1px solid rgba(255,255,255,0.1);
    border-radius: var(--radius);
}

.food-lightbox-img {
    max-width: 100%;
    max-height: 60vh;
    object-fit: contain;
    border-radius: var(--radius-sm);
}

.food-lightbox-caption {
    font-size: 0.9rem;
    color: var(--text-secondary);
    text-align: center;
    margin: 0;
}

.food-lightbox-close {
    position: absolute;
    top: 0.5rem;
    right: 0.5rem;
    background: rgba(255,255,255,0.08);
    border: none;
    color: var(--text);
    font-size: 1.4rem;
    line-height: 1;
    width: 2rem;
    height: 2rem;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s;
}

.food-lightbox-close:hover {
    background: rgba(255,255,255,0.16);
}

/* ===================================================================
   PWA BANNERS — Install & Update prompts
   =================================================================== */

.pwa-banner {
    position: fixed;
    bottom: 1.25rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10100;
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.85rem 1rem;
    background: rgba(30, 41, 59, 0.97);
    border: 1px solid rgba(102, 126, 234, 0.4);
    border-radius: var(--radius-lg);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(102, 126, 234, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    max-width: min(480px, calc(100vw - 2rem));
    width: 100%;
    animation: pwaSlideUp 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.pwa-banner--update {
    border-color: rgba(251, 191, 36, 0.4);
}

@keyframes pwaSlideUp {
    from { transform: translateX(-50%) translateY(120%); opacity: 0; }
    to   { transform: translateX(-50%) translateY(0);    opacity: 1; }
}

.pwa-banner-icon img {
    border-radius: var(--radius-sm);
    flex-shrink: 0;
    display: block;
}

.pwa-banner-text {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    min-width: 0;
}

.pwa-banner-text strong {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-banner-text span {
    font-size: 0.78rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.pwa-banner-btn {
    border: none;
    border-radius: var(--radius-sm);
    font-family: inherit;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.pwa-banner-btn--primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    font-size: 0.85rem;
    padding: 0.45rem 1rem;
    box-shadow: 0 2px 8px rgba(102, 126, 234, 0.3);
}

.pwa-banner-btn--primary:hover {
    opacity: 0.9;
    transform: translateY(-1px);
}

.pwa-banner-btn--dismiss {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-muted);
    font-size: 1rem;
    width: 2rem;
    height: 2rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
}

.pwa-banner-btn--dismiss:hover {
    background: rgba(255, 255, 255, 0.12);
    color: var(--text-primary);
}

@media (max-width: 480px) {
    .pwa-banner {
        bottom: 0;
        left: 0;
        right: 0;
        transform: none;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        max-width: none;
        animation: pwaSlideUpMobile 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    }
    @keyframes pwaSlideUpMobile {
        from { transform: translateY(120%); opacity: 0; }
        to   { transform: translateY(0);    opacity: 1; }
    }
}

/* ===================================================================
   WORKOUT MODULE
   =================================================================== */

/* ── Workout page date input ─────────────────────────────────────── */
.wk-date-input {
    padding: 0.45rem 0.65rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-size: 0.85rem;
    font-family: inherit;
    width: 100%;
}

.wk-date-input:focus {
    outline: none;
    border-color: var(--primary);
}

/* ── Section title ───────────────────────────────────────────────── */
.wk-section-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 0.75rem;
}

.wk-section-title svg { color: var(--primary-light); flex-shrink: 0; }

/* ── Search row ──────────────────────────────────────────────────── */
.wk-search-row {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.6rem;
}

.wk-search-input { flex: 1; }

.wk-filter-btn { flex-shrink: 0; }

/* ── Session header / notes / actions ───────────────────────────── */
.wk-session-header {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-bottom: 0.5rem;
}

.wk-session-notes-row {
    margin: 0.6rem 0;
}

.wk-session-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    margin-top: 0.5rem;
}

.wk-log-btn { flex: 1; justify-content: center; }

/* ── Suggestions area ────────────────────────────────────────────── */
.wk-suggestions {
    margin-top: 0.75rem;
    display: flex;
    flex-direction: column;
    gap: 0.5rem;
}

/* ── AI planner form ─────────────────────────────────────────────── */
.wk-ai-desc {
    font-size: 0.82rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    line-height: 1.5;
}

.wk-ai-form { display: flex; flex-direction: column; gap: 0.75rem; }

.wk-form-row { display: flex; flex-direction: column; gap: 0.3rem; }

.wk-form-row-2col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.75rem;
}

.wk-generate-btn { align-self: flex-start; margin-top: 0.25rem; }

.wk-plan-cooldown {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-top: 0.6rem;
    padding: 0.55rem 0.85rem;
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.35);
    border-radius: var(--radius-sm);
    font-size: 0.78rem;
    color: #fbbf24;
    line-height: 1.4;
}

.wk-plan-cooldown svg { flex-shrink: 0; color: #fbbf24; }

/* ── Weekly summary section ──────────────────────────────────────── */
.wk-weekly-summary { margin-top: 1rem; }

/* ── Plan summary / output area ──────────────────────────────────── */
.wk-plan-summary { margin-bottom: 0.75rem; }

/* ── Sub-tabs ─────────────────────────────────────────────────────── */
.wk-tabs {
    display: flex;
    gap: 0.25rem;
    background: rgba(255,255,255,0.04);
    border-radius: var(--radius-sm);
    padding: 0.25rem;
    margin-bottom: 1.25rem;
    border: 1px solid var(--border);
}

.wk-tab {
    flex: 1;
    padding: 0.5rem 0.75rem;
    background: transparent;
    border: none;
    border-radius: calc(var(--radius-sm) - 2px);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    white-space: nowrap;
}

.wk-tab:hover { color: var(--text-primary); background: rgba(255,255,255,0.06); }
.wk-tab.active {
    background: var(--primary);
    color: #fff;
    box-shadow: 0 2px 10px rgba(102,126,234,0.35);
}

.wk-tab-content { display: none; }
.wk-tab-content.active { display: block; }

/* ── Top row (date + quick stats) ─────────────────────────────────── */
.wk-top-row {
    display: flex;
    align-items: flex-start;
    gap: 1rem;
    flex-wrap: wrap;
    margin-bottom: 1.25rem;
}

.wk-date-wrap {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    min-width: 150px;
}

.wk-date-wrap label {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

/* ── Quick stats bar ─────────────────────────────────────────────── */
.wk-quick-stats {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    flex: 1;
}

.wk-qstat {
    flex: 1;
    min-width: 90px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.75rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.wk-qstat svg { flex-shrink: 0; color: var(--text-muted); }
.wk-qstat-burn svg { color: #f87171; }
.wk-qstat-in svg  { color: #60a5fa; }
.wk-qstat-net svg { color: #4ade80; }

/* Both naming conventions supported (module uses -value/-label, HTML uses -val/-lbl) */
.wk-qstat-val,
.wk-qstat-value {
    font-size: 1.2rem;
    font-weight: 700;
    color: var(--text-primary);
    display: block;
    line-height: 1;
}

.wk-qstat-lbl,
.wk-qstat-label,
.wk-qstat-unit {
    font-size: 0.65rem;
    color: var(--text-muted);
    display: block;
}

#wk-net-wrap.wk-qstat-surplus .wk-qstat-value { color: var(--warning); }
#wk-net-wrap.wk-qstat-deficit .wk-qstat-value { color: var(--success); }

/* ── Section labels ──────────────────────────────────────────────── */
.wk-section-label {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.08em;
    margin: 1rem 0 0.5rem;
}

/* ── Muscle group pills ──────────────────────────────────────────── */
.wk-muscle-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
    margin-bottom: 0.75rem;
}

.wk-pill {
    padding: 0.3rem 0.7rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.75rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
    white-space: nowrap;
}

.wk-pill:hover {
    border-color: var(--primary);
    color: var(--primary-light);
}

.wk-pill.active {
    background: rgba(102,126,234,0.2);
    border-color: var(--primary);
    color: var(--primary-light);
}

/* ── Exercise library list ───────────────────────────────────────── */
.wk-exercise-list {
    max-height: 280px;
    overflow-y: auto;
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    background: var(--bg-secondary);
    scrollbar-width: thin;
    scrollbar-color: var(--border) transparent;
}

.wk-exercise-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.9rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
    transition: background 0.15s;
    gap: 0.75rem;
}

.wk-exercise-item:last-child { border-bottom: none; }
.wk-exercise-item:hover { background: var(--bg-hover); }

.wk-exercise-info {
    display: flex;
    flex-direction: column;
    gap: 0.1rem;
    flex: 1;
    min-width: 0;
}

.wk-exercise-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wk-exercise-muscle {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.wk-exercise-meta {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-shrink: 0;
}

.wk-exercise-category {
    font-size: 0.65rem;
    padding: 0.15rem 0.45rem;
    border-radius: 999px;
    font-weight: 600;
    text-transform: capitalize;
}

.wk-cat-strength   { background: rgba(102,126,234,0.2); color: #7c8ff5; }
.wk-cat-compound   { background: rgba(116,75,162,0.2);  color: #c084fc; }
.wk-cat-isolation  { background: rgba(251,191,36,0.15); color: #fbbf24; }
.wk-cat-bodyweight { background: rgba(74,222,128,0.15); color: #4ade80; }
.wk-cat-cardio     { background: rgba(248,113,113,0.15); color: #f87171; }
.wk-cat-plyometric { background: rgba(251,146,60,0.15); color: #fb923c; }
.wk-cat-stability  { background: rgba(96,165,250,0.15); color: #60a5fa; }
.wk-cat-olympic    { background: rgba(240,147,251,0.15); color: #f0a0fb; }

/* ── Add Exercise Panel ──────────────────────────────────────────── */
.wk-add-panel {
    background: var(--bg-secondary);
    border: 1px solid var(--primary);
    border-radius: var(--radius-sm);
    margin-top: 0.5rem;
    overflow: hidden;
    animation: slideDown 0.2s ease;
}

@keyframes slideDown {
    from { opacity: 0; transform: translateY(-8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.wk-add-panel-inner { padding: 1rem; }

.wk-add-panel-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.wk-add-panel-header strong {
    font-size: 0.9rem;
    color: var(--text-primary);
    flex: 1;
}

.wk-add-panel-muscle {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: capitalize;
}

.wk-add-panel-close {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 1rem;
    cursor: pointer;
    padding: 0 0.25rem;
    line-height: 1;
    transition: color 0.15s;
}

.wk-add-panel-close:hover { color: var(--danger); }

.wk-add-panel-fields {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 0.75rem;
    flex-wrap: wrap;
}

.wk-field {
    display: flex;
    flex-direction: column;
    gap: 0.2rem;
    flex: 1;
    min-width: 70px;
}

.wk-label {
    font-size: 0.7rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wk-small-input {
    padding: 0.4rem 0.5rem !important;
    font-size: 0.85rem !important;
    text-align: center;
}

.wk-add-panel-est {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-bottom: 0.75rem;
}

.wk-add-panel-est svg { color: #fbbf24; flex-shrink: 0; }

.wk-confirm-btn { width: 100%; justify-content: center; }

/* ── Session builder ─────────────────────────────────────────────── */
.wk-session-exercises {
    min-height: 80px;
    border: 1px dashed var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    background: rgba(255,255,255,0.02);
    margin-bottom: 0.75rem;
}

.wk-session-ex-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.5rem;
    padding: 0.5rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.wk-session-ex-item:last-child { border-bottom: none; padding-bottom: 0; }

.wk-session-ex-left {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
    min-width: 0;
}

.wk-session-ex-name {
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--text-primary);
}

.wk-session-ex-params {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

/* ── Badges ──────────────────────────────────────────────────────── */
.wk-ex-badge {
    font-size: 0.65rem;
    padding: 0.15rem 0.4rem;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
    font-weight: 500;
}

.wk-ex-badge-cal {
    background: rgba(251,191,36,0.12);
    border-color: rgba(251,191,36,0.3);
    color: #fbbf24;
}

.wk-ex-badge-weight {
    background: rgba(167,139,250,0.12);
    border-color: rgba(167,139,250,0.3);
    color: #a78bfa;
}

/* PR badge inline in exercise name */
.wk-pr-inline {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 800;
    letter-spacing: 0.04em;
    color: #fbbf24;
    background: rgba(251,191,36,0.15);
    border: 1px solid rgba(251,191,36,0.4);
    border-radius: 4px;
    padding: 1px 5px;
    margin-left: 5px;
    vertical-align: middle;
}

/* Floating PR badge in the est. line of add panel */
.wk-pr-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 800;
    letter-spacing: 0.05em;
    color: #fbbf24;
    background: rgba(251,191,36,0.18);
    border: 1px solid rgba(251,191,36,0.5);
    border-radius: 5px;
    padding: 2px 7px;
    margin-left: 6px;
    animation: wk-pr-pop 0.25s ease;
}

@keyframes wk-pr-pop {
    from { transform: scale(0.7); opacity: 0; }
    to   { transform: scale(1);   opacity: 1; }
}

/* Previous best hint line */
.wk-pr-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    background: rgba(167,139,250,0.07);
    border: 1px solid rgba(167,139,250,0.2);
    border-radius: 6px;
    padding: 6px 10px;
    margin-bottom: 0.65rem;
}

.wk-pr-hint strong { color: #a78bfa; }

/* History chip with PR */
.wk-chip-pr {
    border-color: rgba(251,191,36,0.35) !important;
    background: rgba(251,191,36,0.07) !important;
}

/* ═══════════════════════════════════════════════════════════════════════
   PLAN vs REALITY
   ═══════════════════════════════════════════════════════════════════════ */

/* Tab bar */
.pvr-tab-bar {
    display: flex;
    gap: 0.25rem;
    margin-bottom: 1.25rem;
    border-bottom: 1px solid var(--border);
    padding-bottom: 0;
}
.pvr-tab {
    background: none;
    border: none;
    border-bottom: 2px solid transparent;
    color: var(--text-secondary);
    font-size: 0.85rem;
    font-weight: 600;
    letter-spacing: 0.04em;
    padding: 0.5rem 1rem;
    cursor: pointer;
    transition: color 0.2s, border-color 0.2s;
    margin-bottom: -1px;
}
.pvr-tab:hover { color: var(--text-primary); }
.pvr-tab.active {
    color: #667eea;
    border-bottom-color: #667eea;
}

/* Container */
.pvr-container { display: flex; flex-direction: column; gap: 1rem; }

/* Plan start date picker row */
.pvr-start-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
}
.pvr-start-label {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-secondary);
    white-space: nowrap;
}
.pvr-start-input {
    padding: 0.35rem 0.65rem;
    background: rgba(15,23,42,0.75);
    border: 1px solid rgba(102,126,234,0.3);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: inherit;
    font-size: 0.83rem;
    cursor: pointer;
    transition: border-color 0.2s;
}
.pvr-start-input:focus {
    outline: none;
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(102,126,234,0.15);
}
.pvr-start-hint {
    font-size: 0.72rem;
    color: var(--text-muted);
}

/* Weekly summary card */
.pvr-week-summary {
    background: rgba(102,126,234,0.06);
    border: 1px solid rgba(102,126,234,0.2);
    border-radius: 12px;
    padding: 1rem 1.25rem;
}
.pvr-week-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-bottom: 0.85rem;
}
.pvr-week-title {
    font-weight: 700;
    font-size: 0.9rem;
    color: var(--text-primary);
}
.pvr-week-logged {
    font-size: 0.75rem;
    color: var(--text-secondary);
    margin-left: auto;
}
.pvr-week-macros {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem;
}
.pvr-week-macro-col { display: flex; flex-direction: column; gap: 0.2rem; }
.pvr-week-macro-label {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-secondary);
}
.pvr-week-macro-vals { display: flex; align-items: baseline; gap: 0.25rem; }
.pvr-week-act { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.pvr-week-sep { color: var(--text-secondary); font-size: 0.75rem; }
.pvr-week-plan { font-size: 0.75rem; color: var(--text-secondary); }

/* Day rows */
.pvr-days { display: flex; flex-direction: column; gap: 0.6rem; }

.pvr-day-row {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 1rem;
    display: grid;
    grid-template-columns: 110px 1fr 2fr;
    gap: 1rem;
    align-items: center;
}
.pvr-day-row.pvr-day-empty {
    opacity: 0.6;
}

.pvr-day-label {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.pvr-day-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--text-primary);
}
.pvr-day-date {
    font-size: 0.7rem;
    color: var(--text-secondary);
}

.pvr-day-kcal {
    display: flex;
    flex-direction: column;
    gap: 0.15rem;
}
.pvr-kcal-planned { font-size: 0.75rem; color: var(--text-secondary); }
.pvr-kcal-actual  { font-size: 0.9rem;  font-weight: 700; color: var(--text-primary); }
.pvr-kcal-none    { font-size: 0.75rem; font-style: italic; color: var(--text-secondary); }

/* Adherence badges */
.pvr-badge {
    display: inline-block;
    font-size: 0.68rem;
    font-weight: 700;
    border-radius: 999px;
    padding: 0.15rem 0.55rem;
    margin-top: 0.25rem;
    letter-spacing: 0.03em;
}
.pvr-badge.pvr-good  { background: rgba(16,185,129,0.15); color: #10b981; border: 1px solid rgba(16,185,129,0.3); }
.pvr-badge.pvr-warn  { background: rgba(245,158,11,0.15); color: #f59e0b; border: 1px solid rgba(245,158,11,0.3); }
.pvr-badge.pvr-bad   { background: rgba(239,68,68,0.15);  color: #ef4444; border: 1px solid rgba(239,68,68,0.3); }
.pvr-badge.pvr-na    { background: rgba(148,163,184,0.12); color: var(--text-secondary); border: 1px solid var(--border); }

/* Macro bars */
.pvr-day-macros { display: flex; flex-direction: column; gap: 0.35rem; }
.pvr-macro-row  { display: flex; align-items: center; gap: 0.5rem; }
.pvr-macro-row label {
    font-size: 0.68rem;
    color: var(--text-secondary);
    width: 44px;
    flex-shrink: 0;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.pvr-macro-bar-wrap { flex: 1; display: flex; align-items: center; gap: 0.5rem; }
.pvr-macro-bar-track {
    flex: 1;
    height: 5px;
    background: rgba(255,255,255,0.07);
    border-radius: 999px;
    overflow: hidden;
}
.pvr-macro-bar-fill {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}
.pvr-bar-good { background: #10b981; }
.pvr-bar-warn { background: #f59e0b; }
.pvr-bar-bad  { background: #ef4444; }

.pvr-macro-nums {
    font-size: 0.7rem;
    color: var(--text-primary);
    white-space: nowrap;
}
.pvr-macro-goal { color: var(--text-secondary); }
.pvr-macro-na   { font-size: 0.7rem; color: var(--text-secondary); }

.pvr-empty { color: var(--text-secondary); font-size: 0.85rem; padding: 1rem 0; }

/* ── Responsive ── */
@media (max-width: 768px) {
    .pvr-day-row {
        grid-template-columns: 1fr;
        gap: 0.6rem;
    }
    .pvr-week-macros {
        grid-template-columns: repeat(2, 1fr);
    }
    .wk-session-ex-item {
        flex-direction: column;
    }
}

.wk-ex-badge-muscle {
    background: rgba(96,165,250,0.12);
    border-color: rgba(96,165,250,0.3);
    color: #60a5fa;
}

/* ── Session footer ──────────────────────────────────────────────── */
.wk-session-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    flex-wrap: wrap;
    margin-top: 0.75rem;
}

.wk-session-total {
    font-size: 0.82rem;
    color: var(--text-muted);
}

.wk-session-total strong {
    color: #fbbf24;
    font-size: 1rem;
}

.wk-session-actions {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex-wrap: wrap;
}

/* ── Notes ───────────────────────────────────────────────────────── */
.wk-notes-wrap { margin-top: 0.75rem; }
.wk-notes-wrap label {
    display: block;
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.3rem;
}

/* ── History ─────────────────────────────────────────────────────── */
.wk-history-day {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    margin-bottom: 0.75rem;
    overflow: hidden;
}

.wk-history-date-header {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex-wrap: wrap;
    padding: 0.75rem 1rem;
    background: rgba(102,126,234,0.07);
    border-bottom: 1px solid var(--border);
}

.wk-history-date {
    font-weight: 600;
    font-size: 0.88rem;
    color: var(--primary-light);
}

.wk-history-day-stats {
    display: flex;
    gap: 0.4rem;
    flex-wrap: wrap;
    margin-left: auto;
}

.wk-badge-stat {
    font-size: 0.7rem;
    padding: 0.15rem 0.5rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.07);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-weight: 500;
}

.wk-badge-fire { color: #fbbf24; border-color: rgba(251,191,36,0.3); background: rgba(251,191,36,0.1); }

.wk-history-session {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.wk-history-session:last-child { border-bottom: none; }

.wk-history-session-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.4rem;
    flex-wrap: wrap;
}

.wk-history-session-header strong {
    font-size: 0.85rem;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.wk-history-session-cal {
    font-size: 0.78rem;
    color: #fbbf24;
    font-weight: 600;
    white-space: nowrap;
}

.wk-history-exercises {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
    margin-bottom: 0.25rem;
}

.wk-history-ex-chip {
    font-size: 0.7rem;
    padding: 0.2rem 0.5rem;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    border-radius: 999px;
    color: var(--text-muted);
}

.wk-history-notes {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.25rem;
}

/* ── Weekly stats grid ───────────────────────────────────────────── */
.wk-week-stats {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.5rem;
    margin-bottom: 1.25rem;
}

.wk-week-stat {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.75rem;
    text-align: center;
}

/* Both naming conventions supported */
.wk-week-val,
.wk-week-stat-value {
    display: block;
    font-size: 1.4rem;
    font-weight: 700;
    color: var(--primary-light);
    line-height: 1;
    margin-bottom: 0.2rem;
}

.wk-week-lbl,
.wk-week-stat-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── AI Plan ─────────────────────────────────────────────────────── */
.wk-goal-pills {
    display: flex;
    flex-wrap: wrap;
    gap: 0.4rem;
    margin-bottom: 1rem;
}

.wk-goal-pill {
    padding: 0.35rem 0.8rem;
    border-radius: 999px;
    background: rgba(255,255,255,0.05);
    border: 1px solid var(--border);
    color: var(--text-muted);
    font-size: 0.78rem;
    font-weight: 500;
    cursor: pointer;
    transition: var(--transition-fast);
}

.wk-goal-pill:hover { border-color: var(--primary); color: var(--primary-light); }
.wk-goal-pill.active {
    background: rgba(102,126,234,0.2);
    border-color: var(--primary);
    color: var(--primary-light);
}

.wk-planner-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.wk-planner-field {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.wk-planner-field label {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.wk-ai-plan-output { display: none; }

.wk-plan-summary-row {
    display: flex;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.wk-plan-sum-stat {
    flex: 1;
    min-width: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0.6rem 0.5rem;
    text-align: center;
    overflow: hidden;
}

.wk-plan-sum-stat strong {
    display: block;
    font-size: 1rem;
    font-weight: 700;
    color: var(--primary-light);
    line-height: 1.2;
    margin-bottom: 0.2rem;
    word-break: break-word;
    overflow-wrap: break-word;
}

.wk-plan-sum-stat span {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

.wk-plan-days {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.75rem;
    margin-bottom: 1rem;
}

.wk-plan-day {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.wk-plan-day-rest {
    border-color: rgba(255,255,255,0.06);
    opacity: 0.7;
}

.wk-plan-day-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
    padding: 0.6rem 0.9rem;
    background: rgba(102,126,234,0.08);
    border-bottom: 1px solid var(--border);
}

.wk-plan-day-name {
    font-weight: 700;
    font-size: 0.85rem;
    color: var(--primary-light);
    white-space: nowrap;
}

.wk-plan-day-focus {
    font-size: 0.78rem;
    color: var(--text-secondary);
    flex: 1;
    text-align: right;
}

.wk-plan-day-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    width: 100%;
}

.wk-plan-exercises { padding: 0.6rem 0.9rem; }

.wk-plan-ex {
    padding: 0.4rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.wk-plan-ex:last-child { border-bottom: none; }

.wk-plan-ex-name {
    font-size: 0.82rem;
    font-weight: 500;
    color: var(--text-primary);
    display: block;
    margin-bottom: 0.2rem;
}

.wk-plan-ex-detail {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.wk-plan-ex-note {
    font-size: 0.72rem;
    color: var(--text-muted);
    font-style: italic;
    margin-top: 0.2rem;
    margin-bottom: 0;
}

.wk-plan-rest-label {
    padding: 0.75rem 0.9rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    font-style: italic;
}

.wk-plan-actions {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.wk-use-day-row {
    display: flex;
    gap: 0.5rem;
    align-items: center;
    flex: 1;
    min-width: 200px;
}

.wk-use-day-select {
    flex: 1;
    min-width: 170px;
    font-size: 0.85rem;
}

/* ── Empty hints ─────────────────────────────────────────────────── */
.wk-empty-hint {
    text-align: center;
    color: var(--text-muted);
    font-size: 0.82rem;
    padding: 1.25rem;
    font-style: italic;
}

/* ── Spin animation (for AI loading) ─────────────────────────────── */
@keyframes spin {
    from { transform: rotate(0deg); }
    to   { transform: rotate(360deg); }
}

.spin { animation: spin 0.8s linear infinite; }

/* ── Calendar: workout indicator ─────────────────────────────────── */
.day-indicators {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    margin-top: 2px;
}

.workout-indicator {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 0.58rem;
    color: #fbbf24;
    font-weight: 600;
    line-height: 1;
}

.workout-indicator svg { color: #fbbf24; flex-shrink: 0; }

/* ── Calendar: mobile list view ─────────────────────────────────── */
.calendar-list { display: none; }

.cal-list-card {
    display: flex;
    align-items: center;
    gap: 0;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    margin-bottom: 0.6rem;
    overflow: hidden;
    cursor: pointer;
    transition: transform 0.15s ease, border-color 0.15s ease, box-shadow 0.15s ease;
    position: relative;
}

.cal-list-card:active {
    transform: scale(0.985);
}

.cal-list-card:hover {
    border-color: var(--primary);
    box-shadow: 0 2px 12px rgba(102,126,234,0.15);
}

.cal-list-today {
    border-color: var(--primary) !important;
    box-shadow: 0 0 0 1px var(--primary);
}

.cal-list-left {
    display: flex;
    align-items: stretch;
    flex-shrink: 0;
}

.cal-list-accent-bar {
    width: 4px;
    background: var(--cal-accent, var(--border));
    align-self: stretch;
}

.cal-list-date-block {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 0.75rem 0.85rem;
    min-width: 52px;
    gap: 1px;
}

.cal-list-weekday {
    font-size: 0.65rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
}

.cal-list-day {
    font-size: 1.5rem;
    font-weight: 800;
    line-height: 1;
    color: var(--text-primary);
}

.cal-list-month {
    font-size: 0.6rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.cal-list-today .cal-list-day {
    color: var(--primary-light);
}

.cal-list-right {
    flex: 1;
    padding: 0.65rem 0.5rem 0.65rem 0.75rem;
    min-width: 0;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 0.35rem;
}

.cal-list-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 0.3rem;
}

.cal-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.2rem 0.5rem;
    border-radius: 999px;
    white-space: nowrap;
}

.cal-chip-food    { background: rgba(102,126,234,0.15); color: var(--primary-light); }
.cal-chip-protein { background: rgba(74,222,128,0.12);  color: #4ade80; }
.cal-chip-water   { background: rgba(96,165,250,0.12);  color: #60a5fa; }
.cal-chip-workout { background: rgba(251,191,36,0.12);  color: #fbbf24; }

.cal-list-progress-wrap {
    height: 3px;
    background: var(--border);
    border-radius: 999px;
    overflow: hidden;
    margin-top: 0.1rem;
}

.cal-list-progress-bar {
    height: 100%;
    border-radius: 999px;
    transition: width 0.4s ease;
}

.cal-list-progress-label {
    font-size: 0.62rem;
    color: var(--text-muted);
}

.cal-list-empty {
    font-size: 0.75rem;
    color: var(--text-muted);
    font-style: italic;
}

.cal-list-arrow {
    color: var(--text-muted);
    flex-shrink: 0;
    margin-right: 0.6rem;
}

.cal-list-empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 3rem 1rem;
    text-align: center;
    color: var(--text-muted);
}

.cal-list-empty-state p {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0;
}

.cal-list-empty-state span {
    font-size: 0.8rem;
}

/* Show grid on desktop, list on mobile */
@media (max-width: 768px) {
    .calendar-heatmap { display: none !important; }
    .calendar-list    { display: block !important; }
}

/* ╔══════════════════════════════════════════════════════════════════╗
   ║  ENTRY POPUP — Day Summary Modal                                ║
   ╚══════════════════════════════════════════════════════════════════╝ */

/* Wider modal for day summary on desktop */
.entry-popup-content {
    max-width: 680px !important;
    width: 95% !important;
}

.entry-popup-header {
    border-bottom: 1px solid rgba(102,126,234,0.2);
    padding-bottom: 0.9rem;
}

.entry-popup-header #entry-modal-title {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-secondary);
    letter-spacing: 0.01em;
}

.entry-popup-body {
    padding: 0 !important;
}

/* ── Container ──────────────────────────────────────────────────── */
.ep-container {
    display: flex;
    flex-direction: column;
    gap: 0;
}

/* ── Sections ───────────────────────────────────────────────────── */
.ep-section {
    padding: 1rem 1.25rem;
    border-bottom: 1px solid rgba(255,255,255,0.05);
}

.ep-section:last-of-type { border-bottom: none; }

.ep-section-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.75rem;
    padding: 0.3rem 0.6rem;
    border-radius: 5px;
    width: fit-content;
}

.ep-section-header--meals   { background: rgba(102,126,234,0.15); color: #a5b4fc; }
.ep-section-header--water   { background: rgba(96,165,250,0.15);  color: #60a5fa; }
.ep-section-header--workout { background: rgba(251,191,36,0.15);  color: #fbbf24; }

/* ── Meal cards ─────────────────────────────────────────────────── */
.ep-meal-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid rgba(255,255,255,0.07);
    border-radius: 10px;
    margin-bottom: 0.6rem;
    overflow: hidden;
}

.ep-meal-card:last-of-type { margin-bottom: 0; }

.ep-meal-card--workout { border-color: rgba(251,191,36,0.15); }

.ep-meal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.55rem 0.85rem;
    background: rgba(255,255,255,0.04);
    border-bottom: 1px solid rgba(255,255,255,0.06);
    gap: 0.5rem;
}

.ep-meal-title-row {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    min-width: 0;
}

.ep-meal-label {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text);
    letter-spacing: 0.01em;
}

.ep-meal-kcal {
    font-size: 0.75rem;
    font-weight: 600;
    color: var(--primary-light, #a5b4fc);
    background: rgba(102,126,234,0.12);
    padding: 0.15rem 0.5rem;
    border-radius: 20px;
    white-space: nowrap;
}

.ep-meal-kcal--burn {
    color: #fbbf24;
    background: rgba(251,191,36,0.12);
}

/* ── Delete button ──────────────────────────────────────────────── */
.ep-delete-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
    padding: 0.28rem 0.65rem;
    font-size: 0.7rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 6px;
    border: 1px solid rgba(239,68,68,0.4);
    background: rgba(239,68,68,0.1);
    color: #f87171;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
    flex-shrink: 0;
}

.ep-delete-btn:hover {
    background: rgba(239,68,68,0.25);
    border-color: rgba(239,68,68,0.7);
    color: #fca5a5;
}

.ep-delete-btn--ghost {
    border-color: rgba(239,68,68,0.25);
    background: transparent;
}

/* ── Food list inside cards ─────────────────────────────────────── */
.ep-food-list {
    padding: 0.35rem 0;
}

.ep-food-list-header {
    display: grid;
    grid-template-columns: 1fr 80px 90px;
    padding: 0.2rem 0.85rem;
    font-size: 0.62rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
    border-bottom: 1px solid rgba(255,255,255,0.04);
    margin-bottom: 0.15rem;
}

.ep-food-row {
    display: grid;
    grid-template-columns: 1fr 80px 90px;
    padding: 0.38rem 0.85rem;
    align-items: center;
    border-bottom: 1px solid rgba(255,255,255,0.03);
    transition: background 0.1s;
}

.ep-food-row:last-child { border-bottom: none; }

.ep-food-row:hover { background: rgba(255,255,255,0.03); }

.ep-food-name {
    font-size: 0.8rem;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    cursor: default;
    position: relative;
}

.ep-food-grams {
    font-size: 0.78rem;
    color: var(--text-muted);
    text-align: center;
}

.ep-food-kcal {
    font-size: 0.78rem;
    color: var(--text-secondary);
    text-align: right;
    font-variant-numeric: tabular-nums;
}

/* ── Day totals bar ─────────────────────────────────────────────── */
.ep-day-totals {
    margin-top: 0.65rem;
    padding: 0.65rem 0.85rem;
    background: rgba(102,126,234,0.08);
    border: 1px solid rgba(102,126,234,0.2);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    flex-wrap: wrap;
}

.ep-day-totals-main {
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.ep-totals-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-muted);
}

.ep-totals-kcal {
    font-size: 1rem;
    font-weight: 800;
    color: var(--primary-light, #a5b4fc);
}

.ep-macros-bar {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.ep-macro {
    font-size: 0.75rem;
    color: var(--text-muted);
}

.ep-macro strong { color: var(--text-secondary); font-weight: 700; }

.ep-macro-p strong { color: #86efac; }
.ep-macro-f strong { color: #fda4af; }
.ep-macro-c strong { color: #93c5fd; }

.ep-macro-sep { color: var(--border); font-size: 0.7rem; }

/* ── Hydration card ─────────────────────────────────────────────── */
.ep-hydration-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.6rem 0.85rem;
    background: rgba(96,165,250,0.06);
    border: 1px solid rgba(96,165,250,0.18);
    border-radius: 10px;
    gap: 0.75rem;
}

.ep-hydration-info {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.ep-water-icon { color: #60a5fa; flex-shrink: 0; }

.ep-hydration-amount {
    font-size: 1.1rem;
    font-weight: 800;
    color: #60a5fa;
}

.ep-hydration-label {
    font-size: 0.75rem;
    color: var(--text-muted);
}

/* ── Empty state ────────────────────────────────────────────────── */
.ep-empty {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-style: italic;
    padding: 0.4rem 0.25rem;
}

/* ── Tooltip (mobile tap) ───────────────────────────────────────── */
.popup-item-name .popup-name-tooltip {
    display: none;
    position: absolute;
    left: 0;
    top: calc(100% + 4px);
    z-index: 999;
    background: var(--surface2, #1e2433);
    color: var(--text, #e0e6f0);
    border: 1px solid var(--border, #2e3a50);
    border-radius: 6px;
    padding: 0.35rem 0.6rem;
    font-size: 0.78rem;
    white-space: normal;
    max-width: 240px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.5);
    pointer-events: none;
    line-height: 1.4;
}

.popup-item-name.tooltip-open .popup-name-tooltip { display: block; }

/* ── Danger zone (delete day) ───────────────────────────────────── */
.ep-danger-zone {
    padding: 0.85rem 1.25rem 1rem;
    border-top: 1px solid rgba(255,255,255,0.05);
    display: flex;
    justify-content: center;
}

.ep-delete-day-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    padding: 0.45rem 1.2rem;
    font-size: 0.75rem;
    font-weight: 600;
    font-family: inherit;
    border-radius: 8px;
    border: 1px solid rgba(239,68,68,0.35);
    background: rgba(239,68,68,0.07);
    color: #f87171;
    cursor: pointer;
    transition: all 0.15s;
    letter-spacing: 0.02em;
}

.ep-delete-day-btn:hover {
    background: rgba(239,68,68,0.18);
    border-color: rgba(239,68,68,0.6);
    color: #fca5a5;
}

.ep-danger-zone .delete-confirm-label {
    font-size: 0.78rem;
    color: #f87171;
    font-weight: 600;
    display: block;
    margin-bottom: 0.5rem;
    text-align: center;
}

.ep-danger-zone .delete-confirm-actions {
    display: flex;
    gap: 0.5rem;
    justify-content: center;
}

/* ── Mobile responsive ──────────────────────────────────────────── */
@media (max-width: 600px) {
    #entry-popup.active {
        align-items: flex-end;
    }

    .entry-popup-content {
        width: 100% !important;
        max-width: 100% !important;
        max-height: 78vh !important;
        border-radius: 18px 18px 0 0 !important;
        animation: slideUpSheet 0.3s cubic-bezier(0.32, 0.72, 0, 1) !important;
    }

    @keyframes slideUpSheet {
        from { transform: translateY(100%); opacity: 1; }
        to   { transform: translateY(0);    opacity: 1; }
    }

    .ep-section { padding: 0.85rem 1rem; }

    .ep-food-list-header,
    .ep-food-row { grid-template-columns: 1fr 58px 70px; }

    .ep-day-totals { flex-direction: column; align-items: flex-start; gap: 0.5rem; }

    .ep-totals-kcal { font-size: 1.1rem; }
}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 600px) {
    .wk-week-stats { grid-template-columns: repeat(2, 1fr); }
    .wk-planner-grid { grid-template-columns: 1fr; }
    .wk-plan-days { grid-template-columns: 1fr; }
    .wk-top-row { flex-direction: column; }
    .wk-quick-stats { flex-direction: row; }
    .wk-tab { font-size: 0.72rem; padding: 0.4rem 0.5rem; }
}


/* ╔══════════════════════════════════════════════════════════════════╗
   ║  HOMEPAGE DASHBOARD                                             ║
   ╚══════════════════════════════════════════════════════════════════╝ */

/* ── Hero greeting bar ──────────────────────────────────────────── */
.dash-hero {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: linear-gradient(135deg, rgba(102,126,234,0.15) 0%, rgba(118,75,162,0.10) 100%);
    border: 1px solid rgba(102,126,234,0.25);
    border-radius: var(--radius-lg);
    padding: 1.1rem 1.4rem;
    margin-bottom: 1.25rem;
    backdrop-filter: blur(8px);
}

.dash-greeting {
    font-size: 1.15rem;
    font-weight: 700;
    color: var(--text-primary);
    letter-spacing: -0.01em;
}

.dash-date {
    font-size: 0.8rem;
    color: var(--text-muted);
    margin-top: 0.2rem;
}

.dash-hero-badge {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(251,191,36,0.12);
    border: 1px solid rgba(251,191,36,0.3);
    color: #fbbf24;
    border-radius: 20px;
    padding: 0.35rem 0.8rem;
    font-size: 0.8rem;
    font-weight: 600;
    white-space: nowrap;
}

.dash-hero-badge svg { stroke: #fbbf24; flex-shrink: 0; }

/* ── KPI tiles row ──────────────────────────────────────────────── */
.dash-kpi-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.dash-kpi-tile {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem 1.1rem;
    display: flex;
    align-items: flex-start;
    gap: 0.8rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.dash-kpi-tile::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.dash-kpi--calories::before { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.dash-kpi--protein::before  { background: linear-gradient(90deg, #ec4899, #8b5cf6); }
.dash-kpi--water::before    { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.dash-kpi--workout::before  { background: linear-gradient(90deg, #10b981, #06b6d4); }
.dash-kpi--fat::before      { background: linear-gradient(90deg, #f97316, #fb923c); }
.dash-kpi--carbs::before    { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

.dash-kpi-icon {
    flex-shrink: 0;
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    margin-top: 0.1rem;
}

.dash-kpi--calories .dash-kpi-icon { background: rgba(245,158,11,0.15); color: #f59e0b; stroke: #f59e0b; }
.dash-kpi--protein  .dash-kpi-icon { background: rgba(236,72,153,0.15); color: #ec4899; stroke: #ec4899; }
.dash-kpi--water    .dash-kpi-icon { background: rgba(6,182,212,0.15);  color: #06b6d4; stroke: #06b6d4; }
.dash-kpi--workout  .dash-kpi-icon { background: rgba(16,185,129,0.15); color: #10b981; stroke: #10b981; }
.dash-kpi--fat      .dash-kpi-icon { background: rgba(249,115,22,0.15); color: #f97316; stroke: #f97316; }
.dash-kpi--carbs    .dash-kpi-icon { background: rgba(167,139,250,0.15); color: #a78bfa; stroke: #a78bfa; }

.dash-kpi-icon svg { display: block; }

.dash-kpi-body { flex: 1; min-width: 0; }

.dash-kpi-value {
    font-size: 1.4rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1.1;
    letter-spacing: -0.02em;
}

.dash-kpi-label {
    font-size: 0.72rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.06em;
    margin: 0.2rem 0 0.5rem;
}

.dash-kpi-bar-track {
    height: 4px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
    margin-bottom: 0.3rem;
}

.dash-kpi-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.dash-kpi--calories .dash-kpi-bar-fill { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.dash-kpi--protein  .dash-kpi-bar-fill { background: linear-gradient(90deg, #ec4899, #8b5cf6); }
.dash-kpi--water    .dash-kpi-bar-fill { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.dash-kpi--workout  .dash-kpi-bar-fill { background: linear-gradient(90deg, #10b981, #06b6d4); }
.dash-kpi--fat      .dash-kpi-bar-fill { background: linear-gradient(90deg, #f97316, #fb923c); }
.dash-kpi--carbs    .dash-kpi-bar-fill { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

.dash-kpi-sub {
    font-size: 0.68rem;
    color: var(--text-muted);
}

/* ── Activity row ───────────────────────────────────────────────── */
.dash-activity-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.dash-activity-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
}

.dash-activity-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.9rem;
}

.dash-activity-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.dash-activity-title svg { stroke: var(--primary-light); }

.dash-activity-badge {
    font-size: 0.7rem;
    font-weight: 600;
    padding: 0.25rem 0.6rem;
    border-radius: 12px;
    background: rgba(148,163,184,0.15);
    color: var(--text-muted);
    border: 1px solid rgba(148,163,184,0.2);
}

.dash-badge--success {
    background: rgba(74,222,128,0.12);
    color: #4ade80;
    border-color: rgba(74,222,128,0.25);
}

.dash-badge--info {
    background: rgba(96,165,250,0.12);
    color: #60a5fa;
    border-color: rgba(96,165,250,0.25);
}

/* Workout card */
.dash-workout-empty {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 1.2rem 0;
    color: var(--text-muted);
    font-size: 0.8rem;
}

.dash-workout-stats {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 0.5rem;
    padding-top: 0.3rem;
}

.dash-ws-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 0.6rem 0.4rem;
}

.dash-ws-val {
    font-size: 1.2rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.dash-ws-lbl {
    font-size: 0.65rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-top: 0.2rem;
}

/* Week card bars */
.dash-week-bars { display: flex; flex-direction: column; gap: 0.7rem; }

.dash-week-bar-row {
    display: flex;
    align-items: center;
    gap: 0.6rem;
}

.dash-week-bar-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    width: 52px;
    flex-shrink: 0;
}

.dash-week-bar-track {
    flex: 1;
    height: 6px;
    background: rgba(255,255,255,0.07);
    border-radius: 6px;
    overflow: hidden;
}

.dash-week-bar-fill {
    height: 100%;
    border-radius: 6px;
    transition: width 0.6s cubic-bezier(0.4,0,0.2,1);
}

.dash-week-bar--cal   { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.dash-week-bar--pro   { background: linear-gradient(90deg, #ec4899, #8b5cf6); }
.dash-week-bar--water { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.dash-week-bar--fat   { background: linear-gradient(90deg, #f97316, #fb923c); }
.dash-week-bar--carbs { background: linear-gradient(90deg, #a78bfa, #7c3aed); }

.dash-week-bar-pct {
    font-size: 0.72rem;
    font-weight: 600;
    color: var(--text-secondary);
    width: 30px;
    text-align: right;
    flex-shrink: 0;
}

/* ── Streaks row ────────────────────────────────────────────────── */
.dash-streaks-row {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 0.9rem;
    margin-bottom: 1.25rem;
}

.dash-streak-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 0.9rem 1rem;
    display: flex;
    align-items: center;
    gap: 0.8rem;
    transition: var(--transition);
}

.dash-streak-card:hover {
    border-color: var(--border-primary);
    transform: translateY(-1px);
}

.dash-streak-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.dash-streak-icon--cal     { background: rgba(245,158,11,0.15); color: #f59e0b; }
.dash-streak-icon--cal svg { stroke: #f59e0b; }
.dash-streak-icon--pro     { background: rgba(236,72,153,0.15); color: #ec4899; }
.dash-streak-icon--pro svg { stroke: #ec4899; }
.dash-streak-icon--water   { background: rgba(6,182,212,0.15);  color: #06b6d4; }
.dash-streak-icon--water svg { stroke: #06b6d4; }
.dash-streak-icon--perfect { background: rgba(167,139,250,0.15); color: #a78bfa; }
.dash-streak-icon--perfect svg { stroke: #a78bfa; }

.dash-streak-num {
    font-size: 1.5rem;
    font-weight: 900;
    color: var(--text-primary);
    line-height: 1;
    letter-spacing: -0.03em;
}

.dash-streak-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
    margin-top: 0.15rem;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}

/* ── Bottom row ─────────────────────────────────────────────────── */
.dash-bottom-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.9rem;
    margin-bottom: 1.5rem;
}

.dash-info-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.2rem;
    display: flex;
    flex-direction: column;
    gap: 0.7rem;
}

.dash-info-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
}

.dash-info-header svg { stroke: var(--primary-light); flex-shrink: 0; }

.dash-mealplan-idle,
.dash-mealplan-active {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.82rem;
    color: var(--text-muted);
}

.dash-status-dot {
    width: 8px; height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.dash-status-dot--idle   { background: var(--text-muted); }
.dash-status-dot--active { background: #4ade80; box-shadow: 0 0 6px rgba(74,222,128,0.5); }

/* Meal plan summary card content */
.dash-mp-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.65rem;
}

.dash-mp-title {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-mp-stats {
    display: flex;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.dash-mp-stat {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    background: rgba(255,255,255,0.04);
    border-radius: 8px;
    padding: 0.45rem 0.3rem;
}

.dash-mp-stat-val {
    font-size: 1rem;
    font-weight: 800;
    color: var(--text-primary);
    line-height: 1;
}

.dash-mp-stat-lbl {
    font-size: 0.62rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.04em;
    margin-top: 0.15rem;
}

.dash-mp-today {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    margin-bottom: 0.5rem;
}

.dash-mp-today-label {
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    color: var(--text-muted);
    margin-bottom: 0.15rem;
}

.dash-mp-meal-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.76rem;
    padding: 0.2rem 0;
    border-bottom: 1px solid rgba(255,255,255,0.04);
}

.dash-mp-meal-row:last-child { border-bottom: none; }

.dash-mp-meal-type {
    font-size: 0.65rem;
    color: var(--primary-light);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    flex-shrink: 0;
    width: 52px;
}

.dash-mp-meal-name {
    flex: 1;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.dash-mp-meal-cal {
    font-size: 0.68rem;
    color: var(--text-muted);
    flex-shrink: 0;
}

.dash-mp-cooldown {
    font-size: 0.7rem;
    color: var(--warning);
    padding: 0.25rem 0.5rem;
    background: rgba(251,191,36,0.08);
    border: 1px solid rgba(251,191,36,0.2);
    border-radius: 6px;
    margin-top: 0.4rem;
}

.dash-mp-empty-hint {
    font-size: 0.75rem;
    color: var(--text-muted);
    margin: 0.4rem 0 0;
    line-height: 1.4;
}

.dash-info-cta {
    margin-top: auto;
    background: rgba(102,126,234,0.1);
    border: 1px solid rgba(102,126,234,0.25);
    color: var(--primary-light);
    border-radius: 8px;
    padding: 0.5rem 0.8rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    text-align: center;
    transition: var(--transition-fast);
}

.dash-info-cta:hover {
    background: rgba(102,126,234,0.2);
    border-color: rgba(102,126,234,0.4);
}

/* Favorites list */
.dash-fav-list {
    list-style: none;
    padding: 0; margin: 0;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 0.3rem;
}

.dash-fav-empty {
    font-size: 0.8rem;
    color: var(--text-muted);
    padding: 0.3rem 0;
}

.dash-fav-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.4rem 0.6rem;
    background: rgba(255,255,255,0.04);
    border-radius: 6px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: background 0.15s;
}
.dash-fav-item:hover {
    background: rgba(255,255,255,0.1);
}

.dash-fav-name {
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 65%;
}

.dash-fav-cal {
    color: var(--text-muted);
    font-size: 0.72rem;
    flex-shrink: 0;
}

/* ── Dashboard responsive ───────────────────────────────────────── */
@media (max-width: 1100px) {
    .dash-kpi-row { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 768px) {
    .dash-hero { flex-direction: column; align-items: flex-start; gap: 0.6rem; }
    .dash-kpi-row { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
    .dash-activity-row { grid-template-columns: 1fr; }
    .dash-streaks-row { grid-template-columns: repeat(2, 1fr); }
    .dash-bottom-row { grid-template-columns: 1fr; }
    .dash-kpi-value { font-size: 1.2rem; }
    .dash-info-card { max-width: 360px; }
}

@media (max-width: 480px) {
    .dash-kpi-row { grid-template-columns: repeat(2, 1fr); gap: 0.55rem; }
    .dash-streaks-row { grid-template-columns: repeat(2, 1fr); }
    .dash-kpi-tile { padding: 0.75rem 0.8rem; gap: 0.5rem; }
    .dash-kpi-icon { width: 30px; height: 30px; }
    .dash-kpi-value { font-size: 1.1rem; }
}


/* ╔══════════════════════════════════════════════════════════════════╗
   ║  ANALYTICS PAGE REDESIGN                                        ║
   ╚══════════════════════════════════════════════════════════════════╝ */

.an-section { margin-bottom: 1.5rem; }

.an-section-sub {
    font-size: 0.78rem;
    color: var(--text-muted);
    font-weight: 500;
}

/* ── Streaks grid ───────────────────────────────────────────────── */
.an-streaks-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.an-streak-card {
    background: rgba(255,255,255,0.03);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1rem;
    position: relative;
    overflow: hidden;
    transition: var(--transition);
}

.an-streak-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 3px;
    border-radius: var(--radius) var(--radius) 0 0;
}

.an-streak--calories::before { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.an-streak--protein::before  { background: linear-gradient(90deg, #ec4899, #8b5cf6); }
.an-streak--water::before    { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.an-streak--fat::before      { background: linear-gradient(90deg, #f97316, #fb923c); }
.an-streak--carbs::before    { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.an-streak--perfect::before  { background: linear-gradient(90deg, #a78bfa, #ec4899); }

.an-streak-card:hover {
    border-color: var(--border-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow);
}

.an-streak-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.6rem;
}

.an-streak-icon {
    width: 36px; height: 36px;
    border-radius: 10px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.an-streak--calories .an-streak-icon { background: rgba(245,158,11,0.15); }
.an-streak--calories .an-streak-icon svg { stroke: #f59e0b; }
.an-streak--protein  .an-streak-icon { background: rgba(236,72,153,0.15); }
.an-streak--protein  .an-streak-icon svg { stroke: #ec4899; }
.an-streak--water    .an-streak-icon { background: rgba(6,182,212,0.15); }
.an-streak--water    .an-streak-icon svg { stroke: #06b6d4; }
.an-streak--fat      .an-streak-icon { background: rgba(249,115,22,0.15); }
.an-streak--fat      .an-streak-icon svg { stroke: #f97316; }
.an-streak--carbs    .an-streak-icon { background: rgba(167,139,250,0.15); }
.an-streak--carbs    .an-streak-icon svg { stroke: #a78bfa; }
.an-streak--perfect  .an-streak-icon { background: rgba(167,139,250,0.15); }
.an-streak--perfect  .an-streak-icon svg { stroke: #a78bfa; }

.an-streak-flame {
    font-size: 2rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
}

.an-streak-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.an-streak-sub {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.7rem;
}

.an-streak-bar-track {
    height: 4px;
    background: rgba(255,255,255,0.07);
    border-radius: 4px;
    overflow: hidden;
}

.an-streak-bar-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.an-streak--calories .an-streak-bar-fill { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.an-streak--protein  .an-streak-bar-fill { background: linear-gradient(90deg, #ec4899, #8b5cf6); }
.an-streak--water    .an-streak-bar-fill { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.an-streak--fat      .an-streak-bar-fill { background: linear-gradient(90deg, #f97316, #fb923c); }
.an-streak--carbs    .an-streak-bar-fill { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.an-streak--perfect  .an-streak-bar-fill { background: linear-gradient(90deg, #a78bfa, #ec4899); }

/* ── Monthly stats grid ─────────────────────────────────────────── */
.an-monthly-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 1rem;
}

.an-stat-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1.1rem 1rem;
    transition: var(--transition);
    position: relative;
    overflow: hidden;
}

.an-stat-card:hover {
    border-color: var(--border-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.an-stat-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.7rem;
}

.an-stat-icon-wrap {
    width: 30px; height: 30px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.an-stat--calories .an-stat-icon-wrap { background: rgba(245,158,11,0.15); }
.an-stat--calories .an-stat-icon-wrap svg { stroke: #f59e0b; }
.an-stat--protein  .an-stat-icon-wrap { background: rgba(236,72,153,0.15); }
.an-stat--protein  .an-stat-icon-wrap svg { stroke: #ec4899; }
.an-stat--water    .an-stat-icon-wrap { background: rgba(6,182,212,0.15); }
.an-stat--water    .an-stat-icon-wrap svg { stroke: #06b6d4; }
.an-stat--fat      .an-stat-icon-wrap { background: rgba(249,115,22,0.15); }
.an-stat--fat      .an-stat-icon-wrap svg { stroke: #f97316; }
.an-stat--carbs    .an-stat-icon-wrap { background: rgba(167,139,250,0.15); }
.an-stat--carbs    .an-stat-icon-wrap svg { stroke: #a78bfa; }
.an-stat--food     .an-stat-icon-wrap { background: rgba(16,185,129,0.15); }
.an-stat--food     .an-stat-icon-wrap svg { stroke: #10b981; }
.an-stat--active   .an-stat-icon-wrap { background: rgba(96,165,250,0.15); }
.an-stat--active   .an-stat-icon-wrap svg { stroke: #60a5fa; }
.an-stat--goals    .an-stat-icon-wrap { background: rgba(167,139,250,0.15); }
.an-stat--goals    .an-stat-icon-wrap svg { stroke: #a78bfa; }

.an-stat-title {
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-secondary);
    flex: 1;
}

.an-stat-badge {
    font-size: 0.68rem;
    font-weight: 700;
    padding: 0.15rem 0.5rem;
    border-radius: 10px;
    background: rgba(102,126,234,0.15);
    color: var(--primary-light);
    border: 1px solid rgba(102,126,234,0.2);
}

.an-badge--neutral {
    background: rgba(148,163,184,0.1);
    color: var(--text-muted);
    border-color: rgba(148,163,184,0.15);
}

.an-stat-value {
    font-size: 1.6rem;
    font-weight: 900;
    color: var(--text-primary);
    letter-spacing: -0.03em;
    line-height: 1;
    margin-bottom: 0.4rem;
}

.an-stat-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.65rem;
}

.an-stat-meta {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.an-stat-avg {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.an-stat-avg strong { color: var(--text-secondary); }

.an-stat-bar-track {
    height: 5px;
    background: rgba(255,255,255,0.07);
    border-radius: 5px;
    overflow: hidden;
}

.an-stat-bar-fill {
    height: 100%;
    border-radius: 5px;
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.an-bar--calories { background: linear-gradient(90deg, #f59e0b, #ef4444); }
.an-bar--protein  { background: linear-gradient(90deg, #ec4899, #8b5cf6); }
.an-bar--water    { background: linear-gradient(90deg, #06b6d4, #3b82f6); }
.an-bar--fat      { background: linear-gradient(90deg, #f97316, #fb923c); }
.an-bar--carbs    { background: linear-gradient(90deg, #a78bfa, #7c3aed); }
.an-bar--food     { background: linear-gradient(90deg, #10b981, #06b6d4); }
.an-bar--active   { background: linear-gradient(90deg, #60a5fa, #818cf8); }
.an-bar--goals    { background: linear-gradient(90deg, #a78bfa, #ec4899); }

/* Workout analytics ─────────────────────────────────────────────── */
.an-stat--wk-sessions  .an-stat-icon-wrap { background: rgba(16,185,129,0.15); }
.an-stat--wk-sessions  .an-stat-icon-wrap svg { stroke: #10b981; }
.an-stat--wk-burned    .an-stat-icon-wrap { background: rgba(239,68,68,0.15); }
.an-stat--wk-burned    .an-stat-icon-wrap svg { stroke: #ef4444; }
.an-stat--wk-exercises .an-stat-icon-wrap { background: rgba(59,130,246,0.15); }
.an-stat--wk-exercises .an-stat-icon-wrap svg { stroke: #3b82f6; }
.an-stat--wk-volume    .an-stat-icon-wrap { background: rgba(168,85,247,0.15); }
.an-stat--wk-volume    .an-stat-icon-wrap svg { stroke: #a855f7; }

.an-bar--wk-sessions  { background: linear-gradient(90deg, #10b981, #06b6d4); }
.an-bar--wk-burned    { background: linear-gradient(90deg, #ef4444, #f59e0b); }
.an-bar--wk-exercises { background: linear-gradient(90deg, #3b82f6, #60a5fa); }
.an-bar--wk-volume    { background: linear-gradient(90deg, #a855f7, #ec4899); }

.an-record--wk-heaviest   { border-top: 3px solid #10b981; }
.an-record--wk-topsession { border-top: 3px solid #ef4444; }
.an-record--wk-topvolume  { border-top: 3px solid #a855f7; }
.an-record--wk-streak     { border-top: 3px solid #3b82f6; }

.an-record--wk-heaviest   .an-record-icon { background: rgba(16,185,129,0.15); }
.an-record--wk-heaviest   .an-record-icon svg { stroke: #10b981; }
.an-record--wk-topsession .an-record-icon { background: rgba(239,68,68,0.15); }
.an-record--wk-topsession .an-record-icon svg { stroke: #ef4444; }
.an-record--wk-topvolume  .an-record-icon { background: rgba(168,85,247,0.15); }
.an-record--wk-topvolume  .an-record-icon svg { stroke: #a855f7; }
.an-record--wk-streak     .an-record-icon { background: rgba(59,130,246,0.15); }
.an-record--wk-streak     .an-record-icon svg { stroke: #3b82f6; }

/* Muscle group distribution */
.an-muscle-grid {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0.6rem;
}

.an-muscle-row {
    display: grid;
    grid-template-columns: 120px 1fr 60px;
    align-items: center;
    gap: 0.8rem;
    padding: 0.5rem 0.8rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.an-muscle-name {
    font-size: 0.82rem;
    font-weight: 600;
    color: var(--text-secondary);
    text-transform: capitalize;
}

.an-muscle-bar-track {
    height: 6px;
    background: rgba(255,255,255,0.07);
    border-radius: 6px;
    overflow: hidden;
}

.an-muscle-bar-fill {
    height: 100%;
    border-radius: 6px;
    background: linear-gradient(90deg, #a855f7, #ec4899);
    transition: width 0.8s cubic-bezier(0.4,0,0.2,1);
}

.an-muscle-count {
    font-size: 0.78rem;
    font-weight: 700;
    color: var(--text-primary);
    text-align: right;
}

.an-muscle-empty {
    padding: 1.2rem;
    text-align: center;
    font-size: 0.85rem;
    color: var(--text-muted);
    background: var(--bg-card);
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

@media (max-width: 640px) {
    .an-muscle-row {
        grid-template-columns: 90px 1fr 50px;
        gap: 0.5rem;
        padding: 0.45rem 0.6rem;
    }
    .an-muscle-name { font-size: 0.75rem; }
    .an-muscle-count { font-size: 0.72rem; }
}

/* ── Personal records ───────────────────────────────────────────── */
.an-records-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.an-record-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.1rem 1rem;
    display: flex;
    gap: 0.8rem;
    transition: var(--transition);
}

.an-record-card:hover {
    border-color: var(--border-primary);
    transform: translateY(-1px);
    box-shadow: var(--shadow);
}

.an-record--best     { border-top: 3px solid #a78bfa; }
.an-record--protein  { border-top: 3px solid #ec4899; }
.an-record--hydration{ border-top: 3px solid #06b6d4; }
.an-record--streak   { border-top: 3px solid #f59e0b; }

.an-record-icon {
    flex-shrink: 0;
    width: 32px; height: 32px;
    border-radius: 8px;
    display: flex; align-items: center; justify-content: center;
}

.an-record--best      .an-record-icon { background: rgba(167,139,250,0.15); }
.an-record--best      .an-record-icon svg { stroke: #a78bfa; }
.an-record--protein   .an-record-icon { background: rgba(236,72,153,0.15); }
.an-record--protein   .an-record-icon svg { stroke: #ec4899; }
.an-record--hydration .an-record-icon { background: rgba(6,182,212,0.15); }
.an-record--hydration .an-record-icon svg { stroke: #06b6d4; }
.an-record--streak    .an-record-icon { background: rgba(245,158,11,0.15); }
.an-record--streak    .an-record-icon svg { stroke: #f59e0b; }

.an-record-body { flex: 1; min-width: 0; }

.an-record-title {
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 0.2rem;
}

.an-record-date {
    font-size: 0.72rem;
    color: var(--text-muted);
    margin-bottom: 0.6rem;
}

.an-record-stats { display: flex; flex-direction: column; gap: 0.3rem; }

.an-record-stat {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.an-rs-lbl {
    font-size: 0.7rem;
    color: var(--text-muted);
}

.an-rs-val {
    font-size: 0.82rem;
    font-weight: 700;
    color: var(--text-primary);
}

/* ── Weekly averages grid ───────────────────────────────────────── */
.an-weekly-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 1rem;
}

.an-week-card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1rem;
    transition: var(--transition);
}

.an-week-card:hover {
    border-color: var(--border-primary);
}

.an-week-label {
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.07em;
    color: var(--primary-light);
    margin-bottom: 0.7rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

.an-week-stats { display: flex; flex-direction: column; gap: 0.5rem; }

.an-week-row {
    display: flex;
    align-items: center;
    gap: 0.4rem;
}

.an-week-row-icon {
    width: 20px; height: 20px;
    border-radius: 5px;
    display: flex; align-items: center; justify-content: center;
    flex-shrink: 0;
}

.an-week-icon--cal   { background: rgba(245,158,11,0.12); }
.an-week-icon--cal   svg { stroke: #f59e0b; }
.an-week-icon--pro   { background: rgba(236,72,153,0.12); }
.an-week-icon--pro   svg { stroke: #ec4899; }
.an-week-icon--water { background: rgba(6,182,212,0.12); }
.an-week-icon--water svg { stroke: #06b6d4; }
.an-week-icon--fat   { background: rgba(249,115,22,0.12); }
.an-week-icon--fat   svg { stroke: #f97316; }
.an-week-icon--carbs { background: rgba(167,139,250,0.12); }
.an-week-icon--carbs svg { stroke: #a78bfa; }

.an-week-lbl {
    font-size: 0.75rem;
    color: var(--text-muted);
    flex: 1;
}

.an-week-val {
    font-size: 0.82rem;
    color: var(--text-primary);
}

/* ── Analytics responsive ───────────────────────────────────────── */
@media (max-width: 1100px) {
    .an-streaks-grid    { grid-template-columns: repeat(2, 1fr); }
    .an-monthly-grid    { grid-template-columns: repeat(2, 1fr); }
    .an-records-grid    { grid-template-columns: repeat(2, 1fr); }
    .an-weekly-grid     { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 640px) {
    .an-streaks-grid    { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
    .an-monthly-grid    { grid-template-columns: 1fr; gap: 0.7rem; }
    .an-records-grid    { grid-template-columns: 1fr; gap: 0.7rem; }
    .an-weekly-grid     { grid-template-columns: repeat(2, 1fr); gap: 0.7rem; }
    .an-streak-flame    { font-size: 1.6rem; }
    .an-stat-value      { font-size: 1.3rem; }
}

/* ============================================================
   FAVORITES TABS + RECENT FOODS
   ============================================================ */
.fav-tabs-bar {
    display: flex;
    gap: 0.5rem;
    padding: 0 0 1rem 0;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1.2rem;
}
.fav-tab {
    display: flex;
    align-items: center;
    gap: 0.45rem;
    padding: 0.55rem 1.1rem;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: rgba(102,126,234,0.15);
    touch-action: manipulation;
}
.fav-tab:hover { color: var(--text-primary); border-color: var(--primary); }
.fav-tab.active {
    background: linear-gradient(135deg, rgba(102,126,234,0.15), rgba(118,75,162,0.12));
    border-color: var(--primary);
    color: var(--text-primary);
}
.fav-tab-pane { display: none; }
.fav-tab-pane.active { display: block; }

/* Recent Foods Grid */
.recent-foods-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
    gap: 0.8rem;
}
.recent-food-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 0.85rem 0.9rem;
    transition: border-color 0.2s, background 0.2s;
}
.recent-food-card:hover {
    border-color: var(--primary);
    background: rgba(102,126,234,0.06);
}
.rf-card-body { flex: 1; min-width: 0; }
.rf-card-top {
    display: flex;
    align-items: baseline;
    justify-content: space-between;
    gap: 0.5rem;
    margin-bottom: 0.45rem;
}
.rf-name {
    font-size: 0.85rem;
    font-weight: 600;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.rf-date {
    font-size: 0.7rem;
    color: var(--text-muted);
    white-space: nowrap;
    flex-shrink: 0;
}
.rf-macros {
    display: flex;
    flex-wrap: wrap;
    gap: 0.35rem;
}
.rf-macro {
    font-size: 0.7rem;
    padding: 0.15rem 0.45rem;
    border-radius: 5px;
    font-weight: 500;
}
.rf-macro--cal { background: rgba(245,158,11,0.15); color: #f59e0b; }
.rf-macro--p   { background: rgba(6,182,212,0.12);  color: #06b6d4; }
.rf-macro--f   { background: rgba(139,92,246,0.12); color: #8b5cf6; }
.rf-macro--c   { background: rgba(16,185,129,0.12); color: #10b981; }
.rf-add-btn {
    flex-shrink: 0;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s;
}
.rf-add-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: rgba(102,126,234,0.12);
}
.recent-empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 3rem 1rem;
    color: var(--text-muted);
}
.recent-empty p { font-size: 0.95rem; margin: 0.7rem 0 0.3rem; color: var(--text-secondary); }
.recent-empty span { font-size: 0.82rem; }

/* Mobile: recent foods */
@media (max-width: 600px) {
    .fav-tabs-bar { gap: 0.4rem; }
    .fav-tab { flex: 1; justify-content: center; padding: 0.5rem 0.6rem; font-size: 0.78rem; }
    .recent-foods-grid { grid-template-columns: 1fr; }
}

/* ============================================================
   PROFILE SECTION (SETTINGS)
   ============================================================ */
.profile-avatar-upload {
    position: relative;
    width: 80px;
    height: 80px;
    border-radius: 50%;
    border: 2px dashed var(--border);
    background: var(--bg-tertiary);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: border-color 0.2s;
}
.profile-avatar-upload:hover { border-color: var(--primary); }
.profile-avatar-upload:hover .profile-avatar-overlay { opacity: 1; }
#profile-avatar-placeholder { color: var(--text-muted); }
.profile-avatar-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0,0,0,0.55);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    opacity: 0;
    transition: opacity 0.2s;
    border-radius: 50%;
}
.profile-remove-photo-btn {
    margin-top: 0.4rem;
    font-size: 0.72rem;
    color: #f87171;
    background: none;
    border: 1px solid rgba(248,113,113,0.3);
    border-radius: 6px;
    padding: 0.2rem 0.6rem;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
}
.profile-remove-photo-btn:hover { background: rgba(248,113,113,0.08); }
.profile-avatar-row .settings-row-control {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.4rem;
}

/* Sidebar avatar image */
.user-avatar { overflow: hidden; border-radius: 50%; position: relative; }
#sidebar-avatar-initials {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    font-size: 1.1rem;
    font-weight: 700;
    color: var(--text-primary);
    background: linear-gradient(135deg, rgba(102,126,234,0.3), rgba(118,75,162,0.2));
    border-radius: 50%;
}
.sidebar-display-name {
    font-size: 0.68rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 120px;
    line-height: 1;
}

/* ============================================================
   ONBOARDING OVERLAY
   ============================================================ */
.onboarding-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.75);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1rem;
    opacity: 0;
    transition: opacity 0.35s ease;
}
.onboarding-overlay.visible { opacity: 1; }
.onboarding-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 20px;
    padding: 2.2rem 2rem 1.8rem;
    max-width: 440px;
    width: 100%;
    box-shadow: 0 20px 60px rgba(0,0,0,0.5);
    position: relative;
}
.onboarding-progress {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 2rem;
}
.onboarding-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--border);
    transition: background 0.3s, transform 0.2s;
}
.onboarding-dot.active { background: var(--primary); transform: scale(1.4); }
.onboarding-dot.done { background: rgba(102,126,234,0.45); }
.onboarding-step { display: none; text-align: center; animation: ob-fade-in 0.3s ease; }
.onboarding-step.active { display: flex; flex-direction: column; align-items: center; }
@keyframes ob-fade-in { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: none; } }
.onboarding-icon {
    font-size: 3rem;
    line-height: 1;
    margin-bottom: 1rem;
}
.onboarding-title {
    font-size: 1.35rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}
.onboarding-body {
    font-size: 0.9rem;
    color: var(--text-secondary);
    line-height: 1.6;
    margin: 0 0 1.6rem;
}
.onboarding-btns {
    display: flex;
    gap: 0.6rem;
    justify-content: center;
    width: 100%;
}
.onboarding-next, .onboarding-back, .onboarding-finish {
    padding: 0.65rem 1.6rem;
    border-radius: 10px;
    font-size: 0.88rem;
    font-weight: 600;
    cursor: pointer;
    border: none;
    transition: all 0.2s;
}
.onboarding-next, .onboarding-finish {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
}
.onboarding-next:hover, .onboarding-finish:hover { filter: brightness(1.1); transform: translateY(-1px); }
.onboarding-back {
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}
.onboarding-back:hover { color: var(--text-primary); }

@media (max-width: 480px) {
    .onboarding-card { padding: 1.8rem 1.3rem 1.4rem; border-radius: 16px; }
    .onboarding-title { font-size: 1.15rem; }
    .onboarding-icon { font-size: 2.5rem; }
}

/* ============================================================
   CALENDAR NOTES
   ============================================================ */
.cal-note-section {
    margin-top: 1.2rem;
    padding: 1rem;
    border-top: 1px solid var(--border);
}
.cal-note-header {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8rem;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 0.65rem;
}
.cal-note-textarea {
    width: 100%;
    background: var(--bg-tertiary);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.85rem;
    padding: 0.7rem 0.85rem;
    resize: vertical;
    min-height: 70px;
    box-sizing: border-box;
    transition: border-color 0.2s;
    font-family: inherit;
    line-height: 1.5;
}
.cal-note-textarea:focus { outline: none; border-color: var(--primary); }
.cal-note-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-top: 0.55rem;
}
.cal-note-char-count {
    font-size: 0.72rem;
    color: var(--text-muted);
}
.cal-note-save {
    padding: 0.45rem 1rem;
    font-size: 0.8rem;
}

/* Note indicator on calendar day cells */
.note-indicator {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    background: rgba(251,191,36,0.18);
    color: #fbbf24;
    border-radius: 4px;
    padding: 1px 4px;
    font-size: 0.65rem;
    margin-left: 2px;
}

/* Note chip in mobile list */
.cal-chip-note {
    background: rgba(251,191,36,0.14);
    color: #fbbf24;
}

@media (max-width: 600px) {
    .cal-note-footer { flex-wrap: wrap; gap: 0.4rem; }
    .cal-note-save { width: 100%; justify-content: center; }
}

/* ── Onboarding tooltip walkthrough ─────────────────────────────────────── */

/* Glowing highlight ring on the targeted element */
.ob-highlight {
    position: relative;
    z-index: 1001;
    border-radius: 8px;
    box-shadow:
        0 0 0 3px var(--primary),
        0 0 18px 4px rgba(99, 179, 237, 0.45),
        0 0 40px 8px rgba(99, 179, 237, 0.18);
    animation: ob-pulse 1.8s ease-in-out infinite;
    outline: none;
}

@keyframes ob-pulse {
    0%, 100% {
        box-shadow:
            0 0 0 3px var(--primary),
            0 0 18px 4px rgba(99, 179, 237, 0.45),
            0 0 40px 8px rgba(99, 179, 237, 0.18);
    }
    50% {
        box-shadow:
            0 0 0 3px var(--primary),
            0 0 26px 8px rgba(99, 179, 237, 0.65),
            0 0 55px 14px rgba(99, 179, 237, 0.28);
    }
}

/* Tooltip card */
.ob-tooltip {
    position: absolute;
    z-index: 2100;
    width: 280px;
    background: var(--bg-secondary);
    border: 1px solid var(--primary);
    border-radius: 12px;
    padding: 1.1rem 1.1rem 0.9rem;
    box-shadow:
        0 8px 32px rgba(0,0,0,0.45),
        0 0 0 1px rgba(99, 179, 237, 0.15);
    animation: ob-appear 0.22s cubic-bezier(0.34, 1.56, 0.64, 1) both;
    pointer-events: all;
}

@keyframes ob-appear {
    from { opacity: 0; transform: scale(0.88) translateY(6px); }
    to   { opacity: 1; transform: scale(1)    translateY(0); }
}

/* Dismiss link top-right */
.ob-dismiss {
    position: absolute;
    top: 0.5rem;
    right: 0.6rem;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.7rem;
    cursor: pointer;
    padding: 2px 4px;
    border-radius: 4px;
    transition: color 0.15s;
    line-height: 1;
}
.ob-dismiss:hover { color: var(--text-primary); }

/* Step counter badge */
.ob-step-badge {
    display: inline-block;
    font-size: 0.65rem;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--primary);
    text-transform: uppercase;
    margin-bottom: 0.35rem;
    opacity: 0.85;
}

/* Title */
.ob-title {
    font-size: 0.95rem;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 0.45rem;
    line-height: 1.3;
    padding-right: 3rem; /* avoid overlap with dismiss btn */
}

/* Body text */
.ob-body {
    font-size: 0.82rem;
    color: var(--text-secondary);
    line-height: 1.55;
    margin: 0 0 0.75rem;
}
.ob-body strong { color: var(--text-primary); }

/* Footer row */
.ob-footer {
    display: flex;
    gap: 0.5rem;
    justify-content: flex-end;
}

/* Primary action button */
.ob-btn-primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: #fff;
    border: none;
    border-radius: 6px;
    padding: 0.38rem 0.9rem;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: opacity 0.15s, transform 0.1s;
}
.ob-btn-primary:hover { opacity: 0.88; transform: translateY(-1px); }

/* Skip-step link */
.ob-skip-step {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 0.75rem;
    padding: 0.35rem 0.75rem;
    cursor: pointer;
    transition: color 0.15s, border-color 0.15s;
}
.ob-skip-step:hover { color: var(--text-primary); border-color: var(--text-muted); }

/* Arrow helpers — CSS triangles pointing from tooltip toward target */
.ob-arrow {
    position: absolute;
    width: 0;
    height: 0;
}

/* Arrow pointing LEFT (tooltip is to the right of target) */
.ob-arrow--left {
    left: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-top:    7px solid transparent;
    border-bottom: 7px solid transparent;
    border-right:  8px solid var(--primary);
}

/* Arrow pointing TOP (tooltip is below target) */
.ob-arrow--top {
    top: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left:  7px solid transparent;
    border-right: 7px solid transparent;
    border-bottom: 8px solid var(--primary);
}

/* Arrow pointing BOTTOM (tooltip is above target) */
.ob-arrow--bottom {
    bottom: -8px;
    left: 50%;
    transform: translateX(-50%);
    border-left:  7px solid transparent;
    border-right: 7px solid transparent;
    border-top: 8px solid var(--primary);
}

/* Arrow pointing RIGHT (tooltip is to the left of target) */
.ob-arrow--right {
    right: -8px;
    top: 50%;
    transform: translateY(-50%);
    border-top:    7px solid transparent;
    border-bottom: 7px solid transparent;
    border-left:   8px solid var(--primary);
}

/* Mobile: widen tooltip, arrows always point up */
@media (max-width: 600px) {
    .ob-tooltip { width: calc(100vw - 32px); max-width: 340px; }
    .ob-arrow--left,
    .ob-arrow--right {
        left: 50%; right: auto; top: -8px;
        transform: translateX(-50%);
        border-left: 7px solid transparent;
        border-right: 7px solid transparent;
        border-bottom: 8px solid var(--primary);
        border-top: none;
    }
}

/* ─── Progressive Overload hint ─────────────────────────────────────────── */
.wk-overload-hint {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 6px;
    font-size: 0.78rem;
    color: var(--text-secondary);
    background: rgba(16, 185, 129, 0.08);
    border: 1px solid rgba(16, 185, 129, 0.25);
    border-radius: var(--radius-sm);
    padding: 6px 10px;
    margin-top: 6px;
}
.wk-overload-hint svg { color: #10b981; flex-shrink: 0; }
.wk-overload-hint strong { color: #10b981; }
.wk-overload-apply-btn {
    margin-left: auto;
    padding: 2px 10px;
    font-size: 0.72rem;
    border-radius: 20px;
    border: 1px solid #10b981;
    background: transparent;
    color: #10b981;
    cursor: pointer;
    transition: background 0.15s, color 0.15s;
    white-space: nowrap;
}
.wk-overload-apply-btn:hover { background: #10b981; color: #fff; }
@media (max-width: 480px) {
    .wk-overload-hint { font-size: 0.74rem; }
    .wk-overload-apply-btn { margin-left: 0; }
}

/* ─── Save-as-Template row (inside session builder) ─────────────────────── */
.wk-save-template-row {
    display: flex;
    gap: 8px;
    margin-top: 10px;
    flex-wrap: wrap;
    align-items: center;
}
.wk-template-name-input {
    flex: 1 1 160px;
    min-width: 0;
}
.wk-save-template-row .cyber-btn {
    white-space: nowrap;
    flex-shrink: 0;
}
@media (max-width: 480px) {
    .wk-save-template-row { flex-direction: column; }
    .wk-template-name-input { width: 100%; }
    .wk-save-template-row .cyber-btn { width: 100%; justify-content: center; }
}

/* ─── Templates tab list ─────────────────────────────────────────────────── */
.wk-templates-list { display: flex; flex-direction: column; gap: 12px; }

.wk-template-card {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    background: var(--card-bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 14px;
    transition: border-color 0.2s;
}
.wk-template-card:hover { border-color: var(--primary); }

.wk-template-info { flex: 1; min-width: 0; }
.wk-template-name {
    display: block;
    font-weight: 600;
    font-size: 0.95rem;
    color: var(--text-primary);
    margin-bottom: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.wk-template-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 8px;
}
.wk-template-exercises {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
}

.wk-template-actions {
    display: flex;
    flex-direction: column;
    gap: 6px;
    flex-shrink: 0;
}
.wk-template-actions .cyber-btn {
    min-width: 60px;
    justify-content: center;
}

@media (max-width: 480px) {
    .wk-template-card { flex-direction: column; }
    .wk-template-actions {
        flex-direction: row;
        width: 100%;
        margin-top: 4px;
    }
    .wk-template-actions .cyber-btn { flex: 1; }
}

/* ─── Food source badge (USDA / OFF / AI) ───────────────────────────────── */
.food-name-row {
    display: flex;
    align-items: flex-start;
    gap: 6px;
    flex-wrap: wrap;
}
.food-name-row .food-name { flex: 1; min-width: 0; }

.food-src-badge {
    display: inline-flex;
    align-items: center;
    padding: 1px 7px;
    border-radius: 20px;
    font-size: 0.65rem;
    font-weight: 700;
    letter-spacing: 0.04em;
    white-space: nowrap;
    flex-shrink: 0;
    align-self: flex-start;
    margin-top: 2px;
}
.food-src-badge--usda  { background: rgba(59,130,246,0.15); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.food-src-badge--off   { background: rgba(16,185,129,0.12); color: #34d399; border: 1px solid rgba(16,185,129,0.3); }
.food-src-badge--ai    { background: rgba(168,85,247,0.12); color: #c084fc; border: 1px solid rgba(168,85,247,0.3); }

/* ─── Serving size presets ──────────────────────────────────────────────── */
.serving-presets-row {
    display: flex;
    flex-wrap: wrap;
    gap: 7px;
    margin-bottom: 12px;
}
.serving-preset-btn {
    padding: 5px 13px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--card-bg);
    color: var(--text-secondary);
    font-size: 0.8rem;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s, color 0.15s;
    min-height: 36px;
}
.serving-preset-btn:hover {
    border-color: var(--primary);
    color: var(--primary);
}
.serving-preset-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
@media (max-width: 480px) {
    .serving-preset-btn { flex: 1 1 calc(33% - 7px); text-align: center; font-size: 0.78rem; }
}

/* ══════════════════════════════════════════════════════════════════════════
   LIGHT MODE — overrides all dark CSS variables
   Applied via: document.documentElement.setAttribute('data-theme', 'light')
   ══════════════════════════════════════════════════════════════════════════ */
[data-theme="light"] {
    --primary:        #4f46e5;
    --primary-dark:   #4338ca;
    --primary-light:  #6366f1;
    --secondary:      #7c3aed;
    --accent:         #a855f7;

    --success:  #16a34a;
    --danger:   #dc2626;
    --warning:  #d97706;
    --info:     #2563eb;

    --bg-primary:   #f8fafc;
    --bg-secondary: #f1f5f9;
    --bg-tertiary:  #e2e8f0;
    --bg-card:      #ffffff;
    --bg-hover:     #e8edf5;

    --text-primary:   #0f172a;
    --text-secondary: #334155;
    --text-muted:     #64748b;

    --border:         #cbd5e1;
    --border-primary: #94a3b8;
    --shadow:         0 4px 20px rgba(0,0,0,0.08);
    --shadow-lg:      0 10px 40px rgba(0,0,0,0.12);
    --shadow-glow:    0 0 20px rgba(79,70,229,0.15);

    --card-bg: #ffffff;
}

[data-theme="light"] body {
    background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #f0f4ff 100%);
    color: var(--text-primary);
}

[data-theme="light"] body::before {
    background-image:
        radial-gradient(circle at 20% 50%, rgba(79,70,229,0.06) 0%, transparent 50%),
        radial-gradient(circle at 80% 80%, rgba(124,58,237,0.05) 0%, transparent 50%),
        radial-gradient(circle at 50% 10%, rgba(168,85,247,0.04) 0%, transparent 50%);
}

[data-theme="light"] .app-sidebar {
    background: rgba(248,250,252,0.97);
    border-right-color: rgba(79,70,229,0.15);
    box-shadow: 4px 0 20px rgba(0,0,0,0.08);
}

[data-theme="light"] .sidebar-overlay { background: rgba(15,23,42,0.4); }

[data-theme="light"] .cyber-section,
[data-theme="light"] .cyber-card {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: var(--shadow);
}

[data-theme="light"] .cyber-input,
[data-theme="light"] .cyber-select,
[data-theme="light"] .settings-input {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}

[data-theme="light"] .cyber-input:focus,
[data-theme="light"] .cyber-select:focus,
[data-theme="light"] .settings-input:focus {
    border-color: var(--primary);
    background: var(--bg-card);
}

[data-theme="light"] .cyber-btn.secondary {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-secondary);
}
[data-theme="light"] .cyber-btn.secondary:hover {
    border-color: var(--primary);
    color: var(--primary);
    background: var(--bg-card);
}

[data-theme="light"] .sidebar-link { color: var(--text-secondary); }
[data-theme="light"] .sidebar-link:hover,
[data-theme="light"] .sidebar-link.active { color: var(--primary); background: rgba(79,70,229,0.08); }

[data-theme="light"] .page-title,
[data-theme="light"] .section-title,
[data-theme="light"] .wk-section-title { color: var(--text-primary); }

[data-theme="light"] .food-item { background: var(--bg-card); border-color: var(--border); }
[data-theme="light"] .food-item:hover { border-color: var(--primary); }
[data-theme="light"] .food-name { color: var(--text-primary); }
[data-theme="light"] .food-calories { color: var(--text-secondary); }

[data-theme="light"] .favorite-card,
[data-theme="light"] .wk-history-day,
[data-theme="light"] .wk-template-card { background: var(--bg-card); border-color: var(--border); }

[data-theme="light"] .wk-pill,
[data-theme="light"] .wk-goal-pill {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-secondary);
}
[data-theme="light"] .wk-pill.active,
[data-theme="light"] .wk-goal-pill.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

[data-theme="light"] .fav-macro-track { background: var(--bg-tertiary); }
[data-theme="light"] .wk-ex-badge { background: var(--bg-tertiary); color: var(--text-secondary); }

[data-theme="light"] .notification { border-color: var(--border); }

[data-theme="light"] .fav-tag-pill,
[data-theme="light"] .serving-preset-btn,
[data-theme="light"] .fav-edit-tag-btn {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-secondary);
}
[data-theme="light"] .fav-tag-pill.active,
[data-theme="light"] .serving-preset-btn.active,
[data-theme="light"] .fav-edit-tag-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

[data-theme="light"] .fav-edit-panel { background: var(--bg-card); border-color: var(--border); }
[data-theme="light"] .sl-group { background: var(--bg-card); border-color: var(--border); }
[data-theme="light"] .sl-item:hover { background: var(--bg-secondary); }
[data-theme="light"] .sl-group-header { background: var(--bg-secondary); border-color: var(--border); }
[data-theme="light"] .fav-edit-item-row { background: var(--bg-secondary); }

/* ─── Light mode: top header ─────────────────────────────────────────────── */
[data-theme="light"] .cyber-header {
    background: rgba(248,250,252,0.93);
    border-bottom-color: rgba(79,70,229,0.15);
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

/* ─── Light mode: My Collection (cart) page ──────────────────────────────── */
[data-theme="light"] .cm-page {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: var(--shadow);
}
[data-theme="light"] .cm-macro-pill {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .cm-back-btn {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-secondary);
}
[data-theme="light"] .cm-back-btn:hover {
    background: rgba(79,70,229,0.08);
    border-color: var(--primary);
    color: var(--primary);
}
[data-theme="light"] .cm-item-card {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .cm-item-card:hover { border-color: var(--primary); }
[data-theme="light"] .cm-item-name { color: var(--text-primary); }
[data-theme="light"] .cm-items-title { color: var(--text-primary); }
[data-theme="light"] .cm-macro-val { color: var(--text-primary); }
[data-theme="light"] .cm-macro-lbl { color: var(--text-muted); }
[data-theme="light"] .cm-item-macro-badge { background: var(--bg-tertiary); }

/* ─── Light mode: search pagination ─────────────────────────────────────── */
[data-theme="light"] .page-button {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-secondary);
}
[data-theme="light"] .page-button:hover {
    background: rgba(79,70,229,0.08);
    border-color: var(--primary);
    color: var(--primary);
}
[data-theme="light"] .page-button.active {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}

/* ─── Light mode: body tracker / progress tracker ────────────────────────── */
[data-theme="light"] .bt-kpi {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="light"] .bt-chart-card {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="light"] .bt-chart-header { border-color: var(--border); }
[data-theme="light"] .bt-chart-type-tab {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-secondary);
}
[data-theme="light"] .bt-chart-type-tab.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}
[data-theme="light"] .bt-history-card {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="light"] .bt-history-table th {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-color: var(--border);
}
[data-theme="light"] .bt-history-table td { border-color: var(--border); }
[data-theme="light"] .bt-history-table td.val { color: var(--text-primary); }
[data-theme="light"] .bt-section-badge {
    background: rgba(79,70,229,0.08);
    color: var(--primary);
    border-color: rgba(79,70,229,0.25);
}

/* ─── Light mode: hydration tracker ──────────────────────────────────────── */
[data-theme="light"] .cyber-tank {
    background: var(--bg-tertiary);
    border-color: var(--border);
}
[data-theme="light"] .intake-btn {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}
[data-theme="light"] .intake-btn:hover {
    background: var(--primary);
    border-color: var(--primary);
    color: #fff;
}
[data-theme="light"] .hydration-summary {
    background: var(--bg-secondary);
    border-color: var(--border);
}

/* ─── Light mode: modals & popups ────────────────────────────────────────── */
[data-theme="light"] .modal-content {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: var(--shadow-lg);
}
[data-theme="light"] .modal-header {
    border-color: var(--border);
    background: var(--bg-secondary);
}
[data-theme="light"] .modal-header h3 { color: var(--text-primary); }
[data-theme="light"] .modal-body { color: var(--text-primary); }
[data-theme="light"] .entry-popup-header { border-color: var(--border); }
[data-theme="light"] .ep-section { border-color: var(--border); }
[data-theme="light"] .ep-meal-card {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .ep-section-header--meals   { background: rgba(79,70,229,0.1); color: var(--primary); }
[data-theme="light"] .ep-section-header--water   { background: rgba(37,99,235,0.1); color: var(--info); }
[data-theme="light"] .ep-section-header--workout { background: rgba(217,119,6,0.1); color: var(--warning); }

/* ─── Light mode: settings panels & rows ────────────────────────────────── */
[data-theme="light"] .settings-panel {
    background: var(--bg-card);
    border-color: var(--border);
    backdrop-filter: none;
}
[data-theme="light"] .settings-panel-header {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .settings-row {
    border-color: var(--border);
}
[data-theme="light"] .settings-row:hover { background: rgba(79,70,229,0.04); }
[data-theme="light"] .settings-input-wrap {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .settings-input-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.12);
}

/* ─── Light mode: cart log panel & grams input ───────────────────────────── */
[data-theme="light"] .cm-log-panel {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .cm-grams-input {
    background: var(--bg-card);
    border-color: var(--border);
    color: var(--text-primary);
}
[data-theme="light"] .cm-grams-input:focus {
    border-color: var(--primary);
    background: var(--bg-card);
}

/* ─── Light mode: progress tracker goal bar, add card, measure chips ──────── */
[data-theme="light"] .bt-goal-bar-wrap {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .bt-goal-bar-track { background: var(--bg-tertiary); }
[data-theme="light"] .bt-goal-input {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}
[data-theme="light"] .bt-add-card {
    background: var(--bg-card);
    border-color: var(--border);
}
[data-theme="light"] .bt-measure-chip {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .bt-measure-chip-val { color: var(--text-primary); }

/* ─── Light mode: hydration ──────────────────────────────────────────────── */
[data-theme="light"] .hydro-quick-btn {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-secondary);
}
[data-theme="light"] .hydro-quick-btn::before {
    background: linear-gradient(135deg, rgba(6,182,212,0.08), rgba(59,130,246,0.05));
}
[data-theme="light"] .hydro-date-input {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}
[data-theme="light"] .hydro-chip {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .hydro-chip-val { color: var(--text-primary); }
[data-theme="light"] .hydro-custom-input {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}

/* ─── Light mode: manual entry ───────────────────────────────────────────── */
[data-theme="light"] .me-field-wrap {
    background: var(--bg-secondary);
    border-color: var(--border);
}
[data-theme="light"] .me-field-wrap:focus-within {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px rgba(79,70,229,0.1);
}
[data-theme="light"] .me-input { color: var(--text-primary); }
[data-theme="light"] .me-hint {
    background: rgba(79,70,229,0.06);
    border-left-color: rgba(79,70,229,0.35);
}
[data-theme="light"] .me-preview-panel {
    background: var(--bg-card);
    border-color: var(--border);
    backdrop-filter: none;
}
[data-theme="light"] .me-preview-panel::after { display: none; }
[data-theme="light"] .me-preview-grams-lbl {
    background: rgba(79,70,229,0.08);
    border-color: rgba(79,70,229,0.2);
}
[data-theme="light"] .me-preview-macro-bar-wrap { background: var(--bg-tertiary); }
[data-theme="light"] .me-preview-macro-num { color: var(--text-primary); }

/* ─── Light mode: suggestion cards ──────────────────────────────────────── */
[data-theme="light"] .suggestion-card {
    background: var(--bg-secondary);
    border-color: var(--border);
    backdrop-filter: none;
}

/* ─── Light mode: meal planner cards (shadow on normal state too) ─────────── */
[data-theme="light"] .mp-meal-card {
    background: var(--bg-card);
    border-color: var(--border);
    box-shadow: 0 4px 16px rgba(0,0,0,0.08);
}
[data-theme="light"] .mp-meal-card:hover {
    border-color: var(--primary);
    box-shadow: 0 6px 24px rgba(79,70,229,0.15);
}

/* ─── Light mode: cart field inputs, select & secondary button ───────────── */
[data-theme="light"] .cm-field-input {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}
[data-theme="light"] .cm-field-input:focus {
    border-color: var(--primary);
    background: var(--bg-card);
}
[data-theme="light"] .cm-field-select {
    background-color: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
    color-scheme: light;
}
[data-theme="light"] .cm-field-select option {
    background: var(--bg-card);
    color: var(--text-primary);
}
[data-theme="light"] .cm-btn--secondary {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-secondary);
}
[data-theme="light"] .cm-btn--secondary:hover {
    background: rgba(79,70,229,0.08);
    border-color: var(--primary);
    color: var(--primary);
}

/* ─── Light mode: progress tracker log entry inputs ──────────────────────── */
[data-theme="light"] .bt-input {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}
[data-theme="light"] .bt-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.12);
}

/* ─── Light mode: hydration status pill ──────────────────────────────────── */
[data-theme="light"] .hydro-status {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-muted);
}

/* ─── Light mode: settings selects (DB source, country) ─────────────────── */
[data-theme="light"] #db-source,
[data-theme="light"] #off-country {
    color-scheme: light;
    background-color: #ffffff !important;
    color: #0f172a !important;
    border-color: var(--border);
}
[data-theme="light"] #db-source option,
[data-theme="light"] #off-country option {
    background-color: #ffffff;
    color: #0f172a;
}

/* ─── Light mode: meal planner plan-vs-reality date input ────────────────── */
[data-theme="light"] .pvr-start-input {
    background: var(--bg-secondary);
    border-color: var(--border);
    color: var(--text-primary);
}
[data-theme="light"] .pvr-start-input:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 2px rgba(79,70,229,0.12);
}

/* ─── Light mode: PWA update banner ──────────────────────────────────────── */
[data-theme="light"] .pwa-banner {
    background: rgba(255,255,255,0.97);
    border-color: var(--border);
    box-shadow: 0 8px 32px rgba(0,0,0,0.12), 0 0 0 1px rgba(79,70,229,0.1);
    backdrop-filter: none;
}
[data-theme="light"] .pwa-banner--update { border-color: rgba(217,119,6,0.4); }
[data-theme="light"] .pwa-banner-text strong { color: var(--text-primary); }
[data-theme="light"] .pwa-banner-text span { color: var(--text-muted); }
[data-theme="light"] .pwa-banner-btn--dismiss {
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border: 1px solid var(--border);
}

/* ─── Theme toggle button group ─────────────────────────────────────────── */
.theme-toggle-group {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}
.theme-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.82rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    min-height: 36px;
    font-family: inherit;
    -webkit-appearance: none;
    appearance: none;
    -webkit-tap-highlight-color: rgba(102,126,234,0.15);
    touch-action: manipulation;
}
.theme-toggle-btn:hover { border-color: var(--primary); color: var(--primary); }
.theme-toggle-btn.active {
    background: var(--primary);
    color: #fff;
    border-color: var(--primary);
}

/* ─── iOS-style theme toggle (mobile only) ──────────────────────────────── */
.theme-ios-toggle {
    display: none; /* hidden on desktop */
}

@media (max-width: 768px) {
    #theme-toggle-group .theme-toggle-btn {
        display: none; /* hide theme buttons on mobile, unit toggle remains visible */
    }
    .theme-ios-toggle {
        display: inline-flex;
        align-items: center;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
        touch-action: manipulation;
        user-select: none;
        -webkit-user-select: none;
    }
    .theme-ios-toggle input[type="checkbox"] {
        position: absolute;
        opacity: 0;
        width: 0;
        height: 0;
        pointer-events: none;
    }
    .theme-ios-track {
        position: relative;
        display: inline-block;
        width: 58px;
        height: 32px;
        border-radius: 16px;
        background: #3a3f5c;
        transition: background 0.25s ease;
        box-shadow: inset 0 1px 3px rgba(0,0,0,0.4);
    }
    .theme-ios-toggle input:checked ~ .theme-ios-track {
        background: #667eea;
    }
    .theme-ios-thumb {
        position: absolute;
        top: 3px;
        left: 3px;
        width: 26px;
        height: 26px;
        border-radius: 50%;
        background: #fff;
        box-shadow: 0 2px 6px rgba(0,0,0,0.3);
        transition: transform 0.25s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    .theme-ios-toggle input:checked ~ .theme-ios-track .theme-ios-thumb {
        transform: translateX(26px);
    }
    .theme-ios-icon { position: absolute; }
    .theme-ios-icon--dark { color: #667eea; opacity: 1; transition: opacity 0.2s; }
    .theme-ios-icon--light { color: #f59e0b; opacity: 0; transition: opacity 0.2s; }
    .theme-ios-toggle input:checked ~ .theme-ios-track .theme-ios-thumb .theme-ios-icon--dark { opacity: 0; }
    .theme-ios-toggle input:checked ~ .theme-ios-track .theme-ios-thumb .theme-ios-icon--light { opacity: 1; }
}

/* ─── Favourites tag filter bar ─────────────────────────────────────────── */
.fav-tag-filter-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 14px;
}
.fav-tag-pill {
    padding: 4px 12px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.78rem;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    min-height: 32px;
}
.fav-tag-pill.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.fav-tag-pill:hover  { border-color: var(--primary); color: var(--primary); }

/* ─── Favourite tag chips on cards ──────────────────────────────────────── */
.fav-card-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    margin-bottom: 6px;
}
.fav-tag-chip {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    padding: 2px 9px;
    border-radius: 20px;
    font-size: 0.68rem;
    font-weight: 600;
    background: rgba(102,126,234,0.12);
    color: var(--primary);
    border: 1px solid rgba(102,126,234,0.25);
}
.fav-tag-chip--removable { cursor: default; }
.fav-tag-remove {
    cursor: pointer;
    opacity: 0.6;
    font-size: 0.75rem;
    line-height: 1;
    padding-left: 2px;
}
.fav-tag-remove:hover { opacity: 1; }

/* ─── Favourite inline edit panel ───────────────────────────────────────── */
.fav-edit-panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    margin: 8px 0 14px;
    box-shadow: var(--shadow);
}
.fav-edit-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 14px;
}
.fav-edit-title { font-weight: 700; font-size: 0.95rem; color: var(--text-primary); }
.fav-edit-close {
    background: none;
    border: none;
    color: var(--text-muted);
    cursor: pointer;
    font-size: 1rem;
    padding: 4px;
}
.fav-edit-close:hover { color: var(--danger); }
.fav-edit-label {
    display: block;
    font-size: 0.78rem;
    font-weight: 600;
    color: var(--text-secondary);
    margin-bottom: 6px;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.fav-edit-tag-presets {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 8px;
}
.fav-edit-tag-btn {
    padding: 4px 11px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-secondary);
    color: var(--text-secondary);
    font-size: 0.76rem;
    cursor: pointer;
    transition: background 0.12s, color 0.12s;
    min-height: 30px;
}
.fav-edit-tag-btn.active { background: var(--primary); color: #fff; border-color: var(--primary); }
.fav-edit-custom-tag-row {
    display: flex;
    gap: 7px;
    margin-bottom: 8px;
    flex-wrap: wrap;
}
.fav-edit-custom-tag-row .cyber-input { flex: 1; min-width: 0; }
.fav-edit-active-tags { display: flex; flex-wrap: wrap; gap: 5px; min-height: 24px; margin-bottom: 4px; }

.fav-edit-items { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.fav-edit-item-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 7px 10px;
    background: var(--bg-secondary);
    border-radius: var(--radius-sm);
    flex-wrap: wrap;
}
.fav-edit-item-name { flex: 1; font-size: 0.85rem; color: var(--text-primary); min-width: 80px; }
.fav-edit-item-grams { width: 74px; text-align: center; flex-shrink: 0; }
.fav-edit-item-unit { font-size: 0.78rem; color: var(--text-muted); flex-shrink: 0; }
.fav-edit-item-remove {
    background: none; border: none; color: var(--text-muted);
    cursor: pointer; font-size: 0.9rem; padding: 3px 5px; flex-shrink: 0;
}
.fav-edit-item-remove:hover { color: var(--danger); }
.fav-edit-footer {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    margin-top: 14px;
}
.fav-edit-footer .cyber-btn { flex: 1; justify-content: center; min-width: 100px; }
@media (max-width: 480px) {
    .fav-edit-item-row { align-items: flex-start; }
    .fav-edit-item-grams { width: 30%; }
}

/* ─── Shopping list ──────────────────────────────────────────────────────── */
.sl-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 10px;
    margin-bottom: 18px;
}
.sl-meta { font-size: 0.82rem; color: var(--text-muted); }
.sl-actions { display: flex; gap: 7px; flex-wrap: wrap; }
.sl-empty { text-align: center; padding: 40px 20px; color: var(--text-muted); }
.sl-empty p { font-size: 0.95rem; margin-bottom: 6px; }
.sl-empty span { font-size: 0.82rem; }
.sl-groups { display: flex; flex-direction: column; gap: 14px; }
.sl-group {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    overflow: hidden;
}
.sl-group-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border);
}
.sl-group-name { font-weight: 700; font-size: 0.85rem; color: var(--text-primary); }
.sl-group-count {
    font-size: 0.72rem;
    background: rgba(102,126,234,0.15);
    color: var(--primary);
    padding: 2px 8px;
    border-radius: 20px;
}
.sl-items { list-style: none; padding: 4px 0; margin: 0; }
.sl-item { padding: 0; }
.sl-item:hover { background: var(--bg-hover); }
.sl-label {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 14px;
    cursor: pointer;
    user-select: none;
}
.sl-checkbox { display: none; }
.sl-check-mark {
    width: 18px; height: 18px; min-width: 18px;
    border: 2px solid var(--border);
    border-radius: 4px;
    display: flex; align-items: center; justify-content: center;
    transition: background 0.15s, border-color 0.15s;
    flex-shrink: 0;
}
.sl-checkbox:checked + .sl-check-mark {
    background: var(--primary);
    border-color: var(--primary);
}
.sl-checkbox:checked + .sl-check-mark::after {
    content: '✓';
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
}
.sl-item-text { font-size: 0.87rem; color: var(--text-primary); }
.sl-done .sl-item-text { text-decoration: line-through; color: var(--text-muted); }
.sl-done .sl-check-mark { background: var(--primary); border-color: var(--primary); }
@media (max-width: 480px) {
    .sl-header { flex-direction: column; align-items: flex-start; }
    .sl-actions { width: 100%; }
    .sl-actions .cyber-btn { flex: 1; justify-content: center; }
}

/* ===== LIGHT MODE MOBILE OVERRIDES =====
   Must be last in file — overrides the hardcoded !important dark
   background blocks in the nuclear-option mobile media queries above.
   Only fires when [data-theme="light"] is set on <html>.              */

@media only screen and (max-width: 768px) {
    [data-theme="light"] html,
    html[data-theme="light"] {
        background: #f0f4ff !important;
        background-color: #f0f4ff !important;
    }

    [data-theme="light"] body,
    html[data-theme="light"] body {
        background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #f0f4ff 100%) !important;
        background-color: #f0f4ff !important;
    }

    [data-theme="light"] #main-content,
    [data-theme="light"] .app-main-content,
    [data-theme="light"] .cyber-main,
    [data-theme="light"] .app-page,
    [data-theme="light"] .app-wrapper,
    [data-theme="light"] main,
    [data-theme="light"] .dashboard-layout {
        background: transparent !important;
        background-color: transparent !important;
    }

    [data-theme="light"] .cyber-section,
    [data-theme="light"] .cyber-card {
        background: var(--bg-card) !important;
        background-color: #ffffff !important;
        border-color: var(--border) !important;
    }

    [data-theme="light"] .cyber-header {
        background: rgba(248,250,252,0.97) !important;
        background-color: rgba(248,250,252,0.97) !important;
        border-bottom-color: rgba(79,70,229,0.15) !important;
    }
}

@media only screen and (max-width: 480px) {
    [data-theme="light"] html,
    html[data-theme="light"] {
        background: #f0f4ff !important;
        background-color: #f0f4ff !important;
    }

    [data-theme="light"] body,
    html[data-theme="light"] body {
        background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #f0f4ff 100%) !important;
        background-color: #f0f4ff !important;
    }

    [data-theme="light"] #main-content,
    [data-theme="light"] .app-main-content,
    [data-theme="light"] .cyber-main,
    [data-theme="light"] .app-page,
    [data-theme="light"] .app-wrapper,
    [data-theme="light"] main,
    [data-theme="light"] .dashboard-layout {
        background: transparent !important;
        background-color: transparent !important;
    }

    [data-theme="light"] .cyber-section,
    [data-theme="light"] .cyber-card {
        background: var(--bg-card) !important;
        background-color: #ffffff !important;
    }

    [data-theme="light"] .cyber-header {
        background: rgba(248,250,252,0.97) !important;
        background-color: rgba(248,250,252,0.97) !important;
    }
}

@supports (-webkit-touch-callout: none) {
    @media only screen and (max-width: 768px) {
        [data-theme="light"] html,
        html[data-theme="light"] {
            background: #f0f4ff !important;
            background-color: #f0f4ff !important;
        }

        [data-theme="light"] body,
        html[data-theme="light"] body {
            background: linear-gradient(135deg, #f0f4ff 0%, #faf5ff 50%, #f0f4ff 100%) !important;
            background-color: #f0f4ff !important;
            -webkit-background-size: cover !important;
            background-size: cover !important;
        }

        [data-theme="light"] #main-content,
        [data-theme="light"] .app-main-content,
        [data-theme="light"] .cyber-main,
        [data-theme="light"] .app-page,
        [data-theme="light"] .app-wrapper,
        [data-theme="light"] main,
        [data-theme="light"] .cyber-section,
        [data-theme="light"] .dashboard-layout {
            background: transparent !important;
            background-color: transparent !important;
        }

        [data-theme="light"] .cyber-header {
            background: rgba(248,250,252,0.97) !important;
            background-color: rgba(248,250,252,0.97) !important;
        }

        [data-theme="light"] .cyber-section,
        [data-theme="light"] .cyber-card {
            background: #ffffff !important;
            background-color: #ffffff !important;
        }
    }
}

/* ─── Light mode: mobile sidebar toggle ─────────────────────────────────── */
@media (max-width: 768px) {
    [data-theme="light"] .mobile-sidebar-toggle {
        background: rgba(248,250,252,0.97) !important;
        border-color: rgba(79,70,229,0.25) !important;
        color: var(--text-primary) !important;
        box-shadow: 0 2px 8px rgba(0,0,0,0.12) !important;
    }
    [data-theme="light"] .mobile-sidebar-toggle:hover {
        background: rgba(79,70,229,0.1) !important;
    }
}

/* ─── Light mode: meal planner day accordion ─────────────────────────────── */
[data-theme="light"] .mp-day-accordion {
    background: #ffffff !important;
    border-color: var(--border) !important;
}
[data-theme="light"] .mp-day-accordion[open] {
    border-color: rgba(79,70,229,0.3) !important;
}
[data-theme="light"] .mp-day-accordion-header {
    background: rgba(79,70,229,0.05) !important;
}
[data-theme="light"] .mp-day-accordion-count {
    background: rgba(0,0,0,0.04) !important;
    border-color: var(--border) !important;
    color: var(--text-muted) !important;
}


