/* ─── PHYSIQ ENGINE — Styles ─────────────────────────────────────────────── */

/* ─── Theme Variables ────────────────────────────────────────────────────── */
:root,
[data-theme="dark"] {
    --bg: #0B0F1A;
    --bg-header: rgba(59, 130, 246, 0.08);
    --surface: rgba(255, 255, 255, 0.03);
    --surface-hover: rgba(255, 255, 255, 0.06);
    --surface-alt: rgba(255, 255, 255, 0.02);
    --border: rgba(255, 255, 255, 0.05);
    --border-active: rgba(59, 130, 246, 0.4);
    --border-faint: rgba(255, 255, 255, 0.04);
    --track: rgba(255, 255, 255, 0.06);
    --text: #E2E8F0;
    --text-dim: #94A3B8;
    --text-muted: #64748B;
    --text-faint: #475569;
    --text-bright: #F1F5F9;
    --text-white: #F8FAFC;
    --text-suggestion: #CBD5E1;
    --nav-bg: rgba(11, 15, 26, 0.95);
    --input-bg: rgba(255, 255, 255, 0.05);
    --input-border: rgba(255, 255, 255, 0.1);
    --water-bg: rgba(56, 189, 248, 0.06);
    --water-border: rgba(56, 189, 248, 0.12);
    --water-btn-bg: rgba(56, 189, 248, 0.12);
    --water-btn-border: rgba(56, 189, 248, 0.2);
    --water-btn-hover: rgba(56, 189, 248, 0.25);
    --muscle-active-bg: rgba(168, 85, 247, 0.12);
    --muscle-active-border: rgba(168, 85, 247, 0.4);
    --muscle-tag-bg: rgba(168, 85, 247, 0.12);
    --muscle-tag-border: rgba(168, 85, 247, 0.25);
    --sex-active-bg: rgba(59, 130, 246, 0.15);
    --option-active-bg: rgba(59, 130, 246, 0.1);
    --option-active-border: rgba(59, 130, 246, 0.3);
    --stat-border: rgba(255, 255, 255, 0.03);
    --blue: #3B82F6;
    --blue-light: #60A5FA;
    --blue-glow: rgba(59, 130, 246, 0.3);
    --orange: #F97316;
    --yellow: #EAB308;
    --purple: #A855F7;
    --purple-light: #C084FC;
    --green: #22C55E;
    --red: #EF4444;
    --pink: #F43F5E;
    --teal: #14B8A6;
    --cyan: #06B6D4;
    --sky: #38BDF8;
    --amber: #FBBF24;
    --indigo: #6366F1;
    --magenta: #D946EF;
    --rose: #EC4899;
    --scrollbar-thumb: rgba(255, 255, 255, 0.1);
    --chart-grid: rgba(255, 255, 255, 0.05);
    --chart-text: rgba(255, 255, 255, 0.3)
}

[data-theme="light"] {
    --bg: #F1F5F9;
    --bg-header: rgba(59, 130, 246, 0.06);
    --surface: rgba(0, 0, 0, 0.03);
    --surface-hover: rgba(0, 0, 0, 0.06);
    --surface-alt: rgba(0, 0, 0, 0.02);
    --border: rgba(0, 0, 0, 0.08);
    --border-active: rgba(59, 130, 246, 0.5);
    --border-faint: rgba(0, 0, 0, 0.04);
    --track: rgba(0, 0, 0, 0.07);
    --text: #1E293B;
    --text-dim: #475569;
    --text-muted: #64748B;
    --text-faint: #94A3B8;
    --text-bright: #0F172A;
    --text-white: #0F172A;
    --text-suggestion: #334155;
    --nav-bg: rgba(241, 245, 249, 0.95);
    --input-bg: rgba(0, 0, 0, 0.04);
    --input-border: rgba(0, 0, 0, 0.12);
    --water-bg: rgba(56, 189, 248, 0.08);
    --water-border: rgba(56, 189, 248, 0.18);
    --water-btn-bg: rgba(56, 189, 248, 0.1);
    --water-btn-border: rgba(56, 189, 248, 0.25);
    --water-btn-hover: rgba(56, 189, 248, 0.2);
    --muscle-active-bg: rgba(168, 85, 247, 0.1);
    --muscle-active-border: rgba(168, 85, 247, 0.35);
    --muscle-tag-bg: rgba(168, 85, 247, 0.1);
    --muscle-tag-border: rgba(168, 85, 247, 0.25);
    --sex-active-bg: rgba(59, 130, 246, 0.1);
    --option-active-bg: rgba(59, 130, 246, 0.08);
    --option-active-border: rgba(59, 130, 246, 0.35);
    --stat-border: rgba(0, 0, 0, 0.06);
    --blue: #2563EB;
    --blue-light: #3B82F6;
    --blue-glow: rgba(37, 99, 235, 0.2);
    --orange: #EA580C;
    --yellow: #CA8A04;
    --purple: #9333EA;
    --purple-light: #A855F7;
    --green: #16A34A;
    --red: #DC2626;
    --pink: #E11D48;
    --teal: #0D9488;
    --cyan: #0891B2;
    --sky: #0284C7;
    --amber: #D97706;
    --indigo: #4F46E5;
    --magenta: #C026D3;
    --rose: #DB2777;
    --scrollbar-thumb: rgba(0, 0, 0, 0.15);
    --chart-grid: rgba(0, 0, 0, 0.06);
    --chart-text: rgba(0, 0, 0, 0.3)
}

/* ─── Reset & Base ───────────────────────────────────────────────────────── */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    -webkit-tap-highlight-color: transparent
}

body {
    background: var(--bg);
    color: var(--text);
    font-family: 'DM Sans', -apple-system, sans-serif;
    min-height: 100vh;
    min-height: 100dvh;
    overflow-x: hidden;
    transition: background .3s, color .3s
}

#app {
    max-width: 480px;
    margin: 0 auto;
    position: relative;
    padding-bottom: 80px
}

/* ─── Typography ─────────────────────────────────────────────────────────── */
.mono {
    font-family: 'Space Mono', monospace
}

.label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin-bottom: 12px
}

/* ─── Inputs ─────────────────────────────────────────────────────────────── */
.input {
    background: var(--input-bg);
    border: 1px solid var(--input-border);
    border-radius: 8px;
    padding: 10px 12px;
    color: var(--text-bright);
    font-size: 14px;
    font-family: 'Space Mono', monospace;
    outline: none;
    width: 100%;
    transition: border-color .2s
}

.input:focus {
    border-color: var(--blue)
}

.input::placeholder {
    color: var(--text-faint)
}

/* ─── Cards ──────────────────────────────────────────────────────────────── */
.card {
    background: var(--surface);
    border-radius: 12px;
    padding: 14px;
    border: 1px solid var(--border);
    transition: all .2s
}

.card:hover {
    background: var(--surface-hover)
}

/* ─── Buttons ────────────────────────────────────────────────────────────── */
.btn {
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
    -webkit-appearance: none
}

.btn-primary {
    padding: 14px;
    border-radius: 10px;
    width: 100%;
    background: linear-gradient(135deg, #3B82F6, #2563EB);
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    letter-spacing: .5px;
    box-shadow: 0 4px 20px var(--blue-glow)
}

.btn-primary:hover {
    transform: translateY(-1px)
}

.btn-primary:active {
    transform: translateY(0)
}

.btn-primary:disabled {
    opacity: .5;
    cursor: default;
    transform: none
}

/* ─── Progress ───────────────────────────────────────────────────────────── */
.progress-track {
    height: 4px;
    border-radius: 2px;
    background: var(--track);
    overflow: hidden
}

.progress-fill {
    height: 100%;
    border-radius: 2px;
    transition: width .6s ease
}

/* ─── Navigation ─────────────────────────────────────────────────────────── */
.nav {
    position: fixed;
    bottom: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 100%;
    max-width: 480px;
    background: var(--nav-bg);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    display: flex;
    padding: 8px 0 max(12px, env(safe-area-inset-bottom));
    z-index: 100
}

.nav-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 0;
    color: var(--text-faint);
    transition: color .2s;
    font-family: 'DM Sans', sans-serif
}

.nav-btn.active {
    color: var(--blue)
}

.nav-btn span:first-child {
    font-size: 16px
}

.nav-btn span:last-child {
    font-size: 9px;
    font-weight: 600;
    letter-spacing: .5px
}

/* ─── Layout Helpers ─────────────────────────────────────────────────────── */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

.grid-2-10 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

.flex-col {
    display: flex;
    flex-direction: column
}

.flex-row {
    display: flex;
    align-items: center
}

.gap-6 {
    gap: 6px
}

.gap-8 {
    gap: 8px
}

.gap-10 {
    gap: 10px
}

/* ─── Animations ─────────────────────────────────────────────────────────── */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(8px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.fade-in {
    animation: fadeIn .3s ease forwards
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(30px)
    }

    to {
        opacity: 1;
        transform: translateY(0)
    }
}

.slide-up {
    animation: slideUp .5s ease forwards
}

/* ─── Scrollbar ──────────────────────────────────────────────────────────── */
::-webkit-scrollbar {
    width: 4px
}

::-webkit-scrollbar-track {
    background: transparent
}

::-webkit-scrollbar-thumb {
    background: var(--scrollbar-thumb);
    border-radius: 2px
}

/* ─── Water Tracker ──────────────────────────────────────────────────────── */
.water-btn {
    flex: 1;
    padding: 8px 0;
    border-radius: 8px;
    background: var(--water-btn-bg);
    border: 1px solid var(--water-btn-border);
    color: var(--sky);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s
}

.water-btn:hover {
    background: var(--water-btn-hover)
}

.water-btn.subtract {
    color: var(--red);
    background: rgba(239, 68, 68, 0.08);
    border-color: rgba(239, 68, 68, 0.2)
}

.water-btn.subtract:hover {
    background: rgba(239, 68, 68, 0.15)
}

/* ─── Muscle & Option Buttons ────────────────────────────────────────────── */
.muscle-btn {
    padding: 16px 14px;
    border-radius: 12px;
    cursor: pointer;
    text-align: left;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all .2s;
    color: var(--text-dim);
    font-family: 'DM Sans', sans-serif
}

.muscle-btn.active {
    background: var(--muscle-active-bg);
    border-color: var(--muscle-active-border);
    color: var(--purple-light)
}

.option-btn {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 10px;
    cursor: pointer;
    background: var(--surface-alt);
    border: 1px solid var(--border-faint);
    color: var(--text-dim);
    transition: all .2s;
    text-align: left;
    width: 100%;
    font-family: 'DM Sans', sans-serif
}

.option-btn.active {
    background: var(--option-active-bg);
    border-color: var(--option-active-border);
    color: var(--blue-light)
}

/* ─── Suggestions ────────────────────────────────────────────────────────── */
.suggestion {
    padding: 12px 14px;
    border-radius: 10px;
    font-size: 12px;
    line-height: 1.5;
    color: var(--text-suggestion)
}

/* ─── Meal Log ───────────────────────────────────────────────────────────── */
.meal-row {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border)
}

.meal-remove {
    background: none;
    border: none;
    color: var(--text-faint);
    cursor: pointer;
    font-size: 14px;
    padding: 0 4px
}

/* ─── Nutrients ──────────────────────────────────────────────────────────── */
.nutrient-compact {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 0
}

.nutrient-focus {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px
}

/* ─── Sex Toggle ─────────────────────────────────────────────────────────── */
.sex-btn {
    flex: 1;
    padding: 12px;
    border-radius: 10px;
    cursor: pointer;
    font-size: 13px;
    font-weight: 600;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-muted);
    transition: all .2s;
    font-family: 'DM Sans', sans-serif
}

.sex-btn.active {
    background: var(--sex-active-bg);
    border-color: var(--border-active);
    color: var(--blue-light)
}

/* ─── Stats ──────────────────────────────────────────────────────────────── */
.stat-row {
    display: flex;
    justify-content: space-between;
    padding: 8px 0;
    border-bottom: 1px solid var(--stat-border)
}

.muscle-tag {
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    background: var(--muscle-tag-bg);
    border: 1px solid var(--muscle-tag-border);
    color: var(--purple-light)
}

/* ─── Reset & Utility Buttons ────────────────────────────────────────────── */
.reset-btn {
    padding: 10px 16px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.2);
    color: var(--red);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s
}

.reset-btn:hover {
    background: rgba(239, 68, 68, 0.2)
}

/* ─── Theme Toggle ───────────────────────────────────────────────────────── */
.theme-toggle {
    width: 44px;
    height: 24px;
    border-radius: 12px;
    cursor: pointer;
    background: var(--track);
    border: 1px solid var(--border);
    position: relative;
    transition: all .3s;
    flex-shrink: 0
}

.theme-toggle::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--blue);
    transition: transform .3s
}

[data-theme="light"] .theme-toggle::after {
    transform: translateX(20px)
}

/* ─── BMR Controls ───────────────────────────────────────────────────────── */
.bmr-edit-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 10px;
    padding: 3px 8px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s
}

.bmr-edit-btn:hover {
    border-color: var(--blue);
    color: var(--blue)
}

.bmr-override-badge {
    font-size: 9px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--amber);
    margin-left: 6px
}

/* ═══════════════════════════════════════════════════════════════════════════ */
/* ─── EATS TAB — MyFitnessPal-Inspired Design System ─────────────────────── */
/* ═══════════════════════════════════════════════════════════════════════════ */

/* ─── Eats Tab Container ────────────────────────────────────────────────── */
.eats-tab {
    padding-top: 12px
}

/* ─── Daily Summary (Calorie Ring + Macros) ──────────────────────────────── */
.eats-daily-summary {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 16px;
    border-radius: 16px;
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 16px
}

.calorie-ring-container {
    position: relative;
    width: 100px;
    height: 100px;
    flex-shrink: 0
}

.calorie-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg)
}

.calorie-ring-bg {
    fill: none;
    stroke: var(--track);
    stroke-width: 7
}

.calorie-ring-fill {
    fill: none;
    stroke-width: 7;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1)
}

.calorie-ring-fill.over {
    animation: ringPulse 1.5s ease infinite
}

@keyframes ringPulse {
    0%, 100% { opacity: 1 }
    50% { opacity: 0.6 }
}

.calorie-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center
}

.calorie-ring-number {
    font-size: 22px;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1
}

.calorie-ring-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px
}

.eats-macros-summary {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 8px
}

.macro-mini-bar {
    display: flex;
    flex-direction: column;
    gap: 3px
}

.macro-mini-header {
    display: flex;
    justify-content: space-between;
    align-items: center
}

.macro-mini-label {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim)
}

.macro-mini-value {
    font-size: 10px;
    color: var(--text-muted)
}

.macro-mini-sep {
    opacity: 0.4;
    margin: 0 1px
}

.macro-mini-track {
    height: 5px;
    border-radius: 3px;
    background: var(--track);
    overflow: hidden
}

.macro-mini-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1)
}

/* ─── Meal Period Cards ─────────────────────────────────────────────────── */
.meal-periods-container {
    display: flex;
    flex-direction: column;
    gap: 6px;
    margin-bottom: 16px
}

.meal-period-card {
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    overflow: hidden;
    transition: all 0.2s
}

.meal-period-card.expanded {
    border-color: var(--border-active)
}

.meal-period-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    cursor: pointer;
    transition: background 0.15s
}

.meal-period-header:hover {
    background: var(--surface-hover)
}

.meal-period-left {
    display: flex;
    align-items: center;
    gap: 10px
}

.meal-period-icon {
    font-size: 18px;
    width: 28px;
    text-align: center
}

.meal-period-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright)
}

.meal-period-count {
    font-size: 10px;
    color: var(--text-faint)
}

.meal-period-right {
    display: flex;
    align-items: center;
    gap: 8px
}

.meal-period-cals {
    font-size: 12px;
    color: var(--text-faint)
}

.meal-period-cals.has-cals {
    color: var(--text-bright)
}

.meal-period-add-btn {
    width: 26px;
    height: 26px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--green);
    font-size: 16px;
    font-weight: 600;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif
}

.meal-period-add-btn:hover {
    border-color: var(--green);
    background: rgba(34, 197, 94, 0.1)
}

.meal-period-chevron {
    font-size: 14px;
    color: var(--text-faint);
    transition: transform 0.2s;
    display: inline-block
}

.meal-period-chevron.open {
    transform: rotate(90deg)
}

.meal-period-items {
    border-top: 1px solid var(--border);
    padding: 6px 8px;
    animation: fadeIn 0.2s ease
}

.meal-period-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 6px;
    border-radius: 8px;
    transition: background 0.1s
}

.meal-period-item:hover {
    background: var(--surface-hover)
}

.meal-period-item-info {
    flex: 1;
    min-width: 0
}

.meal-period-item-name {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.meal-period-item-macros {
    display: flex;
    gap: 6px;
    font-size: 10px;
    margin-top: 1px
}

.meal-period-item-right {
    display: flex;
    align-items: center;
    gap: 6px;
    flex-shrink: 0;
    margin-left: 8px
}

.meal-period-item-cal {
    font-size: 11px;
    color: var(--text-dim)
}

.meal-period-item-remove {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.5;
    transition: all 0.15s
}

.meal-period-item-remove:hover {
    opacity: 1;
    color: var(--red)
}

.meal-period-empty {
    padding: 16px;
    text-align: center;
    border-top: 1px solid var(--border);
    animation: fadeIn 0.2s ease
}

.meal-period-empty span {
    font-size: 12px;
    color: var(--text-faint);
    display: block;
    margin-bottom: 8px
}

.meal-period-empty-add {
    background: none;
    border: 1px dashed var(--border);
    border-radius: 8px;
    padding: 8px 16px;
    color: var(--green);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s
}

.meal-period-empty-add:hover {
    border-color: var(--green);
    background: rgba(34, 197, 94, 0.06)
}

/* ─── Drag & Drop States ────────────────────────────────────────────────── */
.meal-period-item-grip {
    font-size: 10px;
    color: var(--text-faint);
    cursor: grab;
    padding: 2px 4px 2px 0;
    flex-shrink: 0;
    user-select: none;
    opacity: 0.4;
    transition: opacity 0.15s;
    letter-spacing: -1px
}

.meal-period-item:hover .meal-period-item-grip {
    opacity: 0.8
}

.meal-period-item-grip:active {
    cursor: grabbing
}

.meal-period-item.dragging {
    opacity: 0.3;
    background: var(--surface-hover);
    border: 1px dashed var(--border)
}

.meal-period-item[draggable="true"] {
    cursor: grab;
    touch-action: none
}

.meal-period-item[draggable="true"]:active {
    cursor: grabbing
}

.meal-period-card.drag-over {
    border-color: var(--green) !important;
    background: rgba(34, 197, 94, 0.04);
    transform: scale(1.01);
    box-shadow: 0 0 12px rgba(34, 197, 94, 0.15)
}

.meal-period-card.drag-active {
    transition: all 0.15s ease
}

.meal-period-drop-hint {
    color: var(--green);
    font-weight: 600;
    font-size: 10px;
    animation: fadeIn 0.2s ease
}

.meal-period-drop-hint-lg {
    color: var(--green);
    font-weight: 700;
    font-size: 13px;
    display: block;
    padding: 8px 0;
    animation: fadeIn 0.2s ease
}

.meal-period-empty.drag-over {
    border-top-color: var(--green);
    background: rgba(34, 197, 94, 0.04)
}

.meal-drag-hint {
    text-align: center;
    font-size: 10px;
    color: var(--text-faint);
    padding: 6px;
    margin-top: 4px;
    border-radius: 6px;
    background: var(--surface);
    border: 1px dashed var(--border)
}

/* ─── Segmented Control ─────────────────────────────────────────────────── */
.eats-segmented-control {
    display: flex;
    gap: 3px;
    padding: 3px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 16px
}

.eats-seg-btn {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    padding: 8px 4px;
    border: none;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif
}

.eats-seg-btn.active {
    background: var(--bg);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2)
}

.eats-seg-icon {
    font-size: 14px
}

.eats-seg-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-faint);
    letter-spacing: 0.3px
}

.eats-seg-btn.active .eats-seg-label {
    color: var(--text-bright)
}

/* ─── Diary Section ─────────────────────────────────────────────────────── */
.eats-empty-state {
    text-align: center;
    padding: 32px 16px
}

.eats-empty-icon {
    font-size: 40px;
    margin-bottom: 12px;
    opacity: 0.5
}

.eats-empty-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-bright);
    margin-bottom: 6px
}

.eats-empty-sub {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 260px;
    margin: 0 auto
}

.eats-diary-list {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.eats-diary-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 4px 2px 8px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim)
}

.eats-diary-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    transition: all 0.15s
}

.eats-diary-item:hover {
    background: var(--surface-hover)
}

.eats-diary-item-left {
    display: flex;
    align-items: center;
    gap: 10px;
    flex: 1;
    min-width: 0
}

.eats-diary-item-period {
    font-size: 16px;
    flex-shrink: 0
}

.eats-diary-item-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.eats-diary-item-time {
    font-size: 10px;
    color: var(--text-faint)
}

.eats-diary-item-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-shrink: 0;
    margin-left: 10px
}

.eats-diary-item-cal {
    font-size: 12px;
    color: var(--orange)
}

.eats-diary-item-remove {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px;
    opacity: 0.4;
    transition: all 0.15s
}

.eats-diary-item-remove:hover {
    opacity: 1;
    color: var(--red)
}

/* ─── Search Section ────────────────────────────────────────────────────── */
.eats-search-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 8px
}

.eats-search-input-wrap {
    flex: 1;
    position: relative
}

.eats-search-icon {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 13px;
    pointer-events: none
}

.eats-search-input {
    width: 100%;
    padding: 10px 32px 10px 34px;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-bright);
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s
}

.eats-search-input:focus {
    border-color: var(--green)
}

.eats-search-input::placeholder {
    color: var(--text-faint)
}

.eats-search-clear {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 16px;
    cursor: pointer;
    padding: 2px 4px
}

.eats-search-btn {
    padding: 10px 16px;
    border-radius: 10px;
    background: linear-gradient(135deg, var(--green), var(--teal));
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s;
    white-space: nowrap
}

.eats-search-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(34, 197, 94, 0.3)
}

.eats-search-btn:disabled {
    opacity: 0.5;
    cursor: default;
    transform: none;
    box-shadow: none
}

.eats-search-source {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px
}

.eats-source-badge {
    font-size: 8px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    padding: 3px 8px;
    border-radius: 4px
}

.eats-source-badge.off {
    background: rgba(34, 197, 94, 0.12);
    color: var(--green)
}

.eats-source-count {
    font-size: 10px;
    color: var(--text-faint)
}

.eats-search-error {
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.08);
    border: 1px solid rgba(239, 68, 68, 0.15);
    color: var(--red);
    font-size: 12px;
    margin-bottom: 12px
}

/* ─── Food Result Cards ─────────────────────────────────────────────────── */
.eats-search-results {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.food-result-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s
}

.food-result-card:hover {
    background: var(--surface-hover);
    border-color: var(--green)
}

.food-result-card:active {
    transform: scale(0.985)
}

.food-result-img {
    width: 42px;
    height: 42px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-hover)
}

.food-result-img img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.food-result-info {
    flex: 1;
    min-width: 0
}

.food-result-top {
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 1px
}

.food-result-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.food-result-brand {
    font-size: 10px;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px
}

.food-result-macros {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px
}

.food-result-dot {
    color: var(--text-faint);
    font-size: 8px
}

.food-result-serving {
    font-size: 9px;
    color: var(--text-faint);
    margin-top: 1px
}

.food-result-add {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.25);
    color: var(--green);
    font-size: 16px;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s
}

.food-result-card:hover .food-result-add {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--green)
}

/* ─── Nutri-Score Badge ─────────────────────────────────────────────────── */
.nutri-score-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    border-radius: 4px;
    font-size: 10px;
    font-weight: 800;
    color: #fff;
    flex-shrink: 0
}

.portion-nutri-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    border-radius: 5px;
    font-size: 11px;
    font-weight: 800;
    color: #fff;
    vertical-align: middle
}

/* ─── Portion Modal (enhanced) ──────────────────────────────────────────── */
.portion-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 150;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: fadeIn 0.2s ease
}

.portion-modal {
    width: 100%;
    max-width: 480px;
    background: var(--bg);
    border-top: 1px solid var(--border);
    border-radius: 20px 20px 0 0;
    padding: 24px 20px max(20px, env(safe-area-inset-bottom));
    animation: slideUp 0.3s ease
}

.portion-modal-header {
    display: flex;
    gap: 12px;
    margin-bottom: 16px
}

.portion-modal-thumb {
    width: 52px;
    height: 52px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface)
}

.portion-modal-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.portion-modal-title-wrap {
    flex: 1;
    min-width: 0
}

.portion-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--track);
    outline: none;
    margin: 12px 0
}

.portion-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green);
    cursor: pointer;
    border: 2px solid var(--bg)
}

.portion-slider::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green);
    cursor: pointer;
    border: 2px solid var(--bg)
}

.portion-presets {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px
}

.portion-preset {
    padding: 6px 12px;
    border-radius: 16px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s
}

.portion-preset:hover {
    border-color: var(--green);
    color: var(--green)
}

.portion-preset.active {
    border-color: var(--green);
    color: var(--green);
    background: rgba(34, 197, 94, 0.1)
}

/* ─── Portion Unit Toggle ───────────────────────────────────────────────── */
.portion-unit-toggle {
    display: flex;
    gap: 4px;
    margin-bottom: 14px;
    padding: 3px;
    background: var(--surface);
    border-radius: 12px;
    border: 1px solid var(--border)
}

.portion-unit-btn {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 9px 12px;
    border-radius: 9px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all 0.25s ease
}

.portion-unit-btn:hover {
    color: var(--text-dim)
}

.portion-unit-btn.active {
    background: linear-gradient(135deg, var(--green), var(--teal));
    color: #fff;
    box-shadow: 0 2px 8px rgba(34, 197, 94, 0.25)
}

.portion-unit-icon {
    font-size: 14px
}

.portion-serving-info {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 12px;
    margin-bottom: 12px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.12);
    font-size: 11px;
    color: var(--text-muted)
}

.portion-serving-icon {
    font-size: 14px;
    flex-shrink: 0
}

/* ─── Recent & Popular Sections ─────────────────────────────────────────── */
.eats-search-empty {
    padding: 8px 0
}

.eats-section-label {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 10px;
    display: flex;
    justify-content: space-between;
    align-items: center
}

.eats-section-badge {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    text-transform: none;
    letter-spacing: 0
}

.eats-recent-section {
    margin-bottom: 20px;
    padding-bottom: 16px
}

.eats-recent-grid {
    display: flex;
    flex-direction: column;
    gap: 5px
}

.eats-recent-food-card {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s
}

.eats-recent-food-card:hover {
    background: var(--surface-hover);
    border-color: var(--green)
}

.eats-recent-food-card:active {
    transform: scale(0.985)
}

.eats-recent-food-info {
    flex: 1;
    min-width: 0
}

.eats-recent-food-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px
}

.eats-recent-food-macros {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px
}

.eats-recent-food-dot {
    color: var(--text-faint);
    font-size: 8px
}

.eats-recent-food-add {
    padding: 5px 12px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--green);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.15s
}

.eats-recent-food-card:hover .eats-recent-food-add {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--green)
}

.eats-recent-list {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.eats-recent-chip {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s;
    font-family: 'DM Sans', sans-serif
}

.eats-recent-chip:hover {
    background: var(--surface-hover);
    border-color: var(--green)
}

.eats-recent-name {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-bright)
}

.eats-recent-cal {
    font-size: 11px;
    color: var(--orange)
}

.eats-popular-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px
}

.eats-popular-chip {
    padding: 7px 14px;
    border-radius: 18px;
    font-size: 12px;
    font-weight: 500;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all 0.2s
}

.eats-popular-chip:hover {
    border-color: var(--green);
    color: var(--green);
    background: rgba(34, 197, 94, 0.06)
}

/* ─── Nearby Restaurants ────────────────────────────────────────────────── */
.eats-nearby-section {
    padding-bottom: 16px
}

.eats-nearby-locating {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 16px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.12);
    margin-bottom: 14px;
    font-size: 12px;
    color: var(--blue-light)
}

.eats-locating-pulse {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: var(--blue);
    animation: locatingPulse 1.5s ease infinite
}

@keyframes locatingPulse {
    0% { transform: scale(1); opacity: 1 }
    50% { transform: scale(1.6); opacity: 0.3 }
    100% { transform: scale(1); opacity: 1 }
}

.eats-nearby-error {
    text-align: center;
    padding: 30px 16px
}

.eats-nearby-error-icon {
    font-size: 36px;
    margin-bottom: 10px;
    opacity: 0.5
}

.eats-nearby-error-msg {
    font-size: 13px;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 260px;
    margin: 0 auto
}

.eats-nearby-group {
    margin-bottom: 20px
}

.nearby-restaurant-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 4px;
    transition: all 0.15s
}

.nearby-restaurant-card.is-chain {
    cursor: pointer
}

.nearby-restaurant-card.is-chain:hover {
    background: var(--surface-hover);
    border-color: var(--orange)
}

.nearby-restaurant-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    flex-shrink: 0
}

.nearby-restaurant-info {
    flex: 1;
    min-width: 0
}

.nearby-restaurant-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis
}

.nearby-restaurant-meta {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 2px
}

.nearby-restaurant-distance {
    font-size: 10px;
    color: var(--text-muted)
}

.nearby-restaurant-cuisine {
    font-size: 10px;
    color: var(--text-faint);
    text-transform: capitalize
}

.nearby-restaurant-action {
    font-size: 10px;
    font-weight: 600;
    padding: 4px 10px;
    border-radius: 8px;
    flex-shrink: 0
}

.nearby-restaurant-action.chain {
    background: rgba(249, 115, 22, 0.1);
    color: var(--orange);
    border: 1px solid rgba(249, 115, 22, 0.2)
}

.nearby-restaurant-action.local {
    background: var(--surface-hover);
    color: var(--text-faint);
    border: 1px solid var(--border)
}

.eats-nearby-tip {
    padding: 10px 14px;
    border-radius: 8px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.1);
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 8px;
    line-height: 1.4
}

/* ─── All Chains Grid ───────────────────────────────────────────────────── */
.eats-all-chains {
    display: flex;
    flex-wrap: wrap;
    gap: 6px
}

.eats-chain-pill {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif;
    position: relative
}

.eats-chain-pill:hover {
    background: var(--surface-hover);
    border-color: var(--orange)
}

.eats-chain-pill.nearby {
    background: rgba(249, 115, 22, 0.06)
}

.eats-chain-nearby-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    flex-shrink: 0
}

/* ─── Chain Detail View ─────────────────────────────────────────────────── */
.eats-chain-detail {
    padding-bottom: 16px
}

.eats-chain-back {
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 6px 0;
    margin-bottom: 10px;
    font-family: 'DM Sans', sans-serif;
    transition: color 0.15s
}

.eats-chain-back:hover {
    color: var(--text-bright)
}

.eats-chain-header {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 14px;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 12px
}

.eats-chain-header-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0
}

.eats-chain-header-name {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white)
}

.eats-chain-header-count {
    font-size: 11px;
    color: var(--text-muted)
}

.eats-chain-search-wrap {
    position: relative;
    margin-bottom: 10px
}

.eats-chain-search {
    width: 100%;
    padding: 10px 12px 10px 34px;
    border-radius: 10px;
    border: 1px solid var(--input-border);
    background: var(--input-bg);
    color: var(--text-bright);
    font-size: 13px;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color 0.2s
}

.eats-chain-search:focus {
    border-color: var(--orange)
}

.eats-chain-search::placeholder {
    color: var(--text-faint)
}

.eats-chain-categories {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
    margin-bottom: 12px
}

.eats-cat-chip {
    padding: 5px 12px;
    border-radius: 14px;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    transition: all 0.2s;
    font-family: 'DM Sans', sans-serif
}

.eats-cat-chip.active {
    border-color: var(--blue);
    color: var(--blue);
    background: rgba(59, 130, 246, 0.08)
}

.eats-chain-items {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.eats-chain-empty {
    text-align: center;
    padding: 24px;
    color: var(--text-faint);
    font-size: 13px
}

.eats-chain-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s
}

.eats-chain-item:hover {
    background: var(--surface-hover);
    border-color: var(--orange)
}

.eats-chain-item:active {
    transform: scale(0.985)
}

.eats-chain-item-info {
    flex: 1;
    min-width: 0
}

.eats-chain-item-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    margin-bottom: 2px
}

.eats-chain-item-macros {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 11px
}

.eats-chain-item-dot {
    color: var(--text-faint);
    font-size: 8px
}

.eats-chain-item-micro {
    display: flex;
    gap: 8px;
    margin-top: 2px;
    font-size: 9px;
    color: var(--text-faint)
}

.eats-chain-item-add {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(249, 115, 22, 0.08);
    border: 1px solid rgba(249, 115, 22, 0.2);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.15s
}

.eats-chain-item:hover .eats-chain-item-add {
    background: rgba(249, 115, 22, 0.15)
}

/* ─── Barcode Scanner Section ───────────────────────────────────────────── */
.eats-scan-section {
    padding-bottom: 16px
}

.scan-start-section {
    text-align: center;
    padding: 40px 20px;
    border-radius: 14px;
    background: var(--surface);
    border: 1.5px dashed var(--border);
    margin-bottom: 16px
}

.scan-start-icon {
    font-size: 48px;
    margin-bottom: 12px;
    filter: grayscale(0.3)
}

.scan-start-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 6px
}

.scan-start-sub {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 280px;
    margin: 0 auto 20px
}

.scan-start-btn {
    max-width: 220px;
    margin: 0 auto;
    padding: 14px 24px !important;
    font-size: 14px !important;
    border-radius: 12px !important;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px
}

/* Camera viewport */
.scan-viewport-wrap {
    border-radius: 14px;
    overflow: hidden;
    background: #000;
    margin-bottom: 12px;
    position: relative
}

.scan-viewport {
    width: 100%
}

.scan-viewport video {
    border-radius: 14px
}

.scan-stop-btn {
    display: block;
    width: 100%;
    padding: 12px;
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.25);
    color: var(--red);
    font-size: 12px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    border-radius: 0 0 14px 14px;
    cursor: pointer;
    transition: all 0.2s
}

.scan-stop-btn:hover {
    background: rgba(239, 68, 68, 0.18)
}

/* Scan result card */
.scan-result-card {
    border-radius: 14px;
    background: var(--surface);
    border: 1.5px solid rgba(34, 197, 94, 0.3);
    padding: 16px;
    margin-bottom: 16px;
    box-shadow: 0 4px 20px rgba(34, 197, 94, 0.08)
}

.scan-result-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 12px
}

.scan-result-badge {
    font-size: 11px;
    font-weight: 700;
    padding: 4px 10px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.12);
    color: var(--green)
}

.scan-result-close {
    background: none;
    border: none;
    font-size: 20px;
    color: var(--text-faint);
    cursor: pointer;
    padding: 2px 6px;
    line-height: 1
}

.scan-result-close:hover {
    color: var(--text-dim)
}

.scan-result-body {
    display: flex;
    gap: 14px;
    align-items: flex-start;
    margin-bottom: 14px
}

.scan-result-img {
    width: 64px;
    height: 64px;
    border-radius: 10px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-hover);
    border: 1px solid var(--border)
}

.scan-result-img img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.scan-result-info {
    flex: 1;
    min-width: 0
}

.scan-result-name {
    font-size: 15px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 2px;
    line-height: 1.3
}

.scan-result-brand {
    font-size: 11px;
    color: var(--text-muted);
    margin-bottom: 4px
}

.scan-result-macros {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 12px;
    margin-top: 6px
}

.scan-result-dot {
    color: var(--text-faint);
    font-size: 8px
}

.scan-result-serving {
    font-size: 10px;
    color: var(--text-faint);
    margin-top: 3px
}

.scan-result-add-btn {
    width: 100%;
    padding: 14px !important;
    border-radius: 10px !important;
    font-size: 14px !important;
    font-weight: 700 !important
}

/* Loading */
.scan-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 16px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.06);
    border: 1px solid rgba(59, 130, 246, 0.12);
    margin-bottom: 12px;
    font-size: 12px;
    color: var(--blue-light)
}

.scan-loading-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(59, 130, 246, 0.2);
    border-top-color: var(--blue);
    border-radius: 50%;
    animation: spin 0.8s linear infinite
}

@keyframes spin {
    to { transform: rotate(360deg) }
}

/* Error */
.scan-error {
    text-align: center;
    padding: 20px 16px;
    border-radius: 10px;
    background: rgba(239, 68, 68, 0.06);
    border: 1px solid rgba(239, 68, 68, 0.12);
    margin-bottom: 12px
}

.scan-error-icon {
    font-size: 28px;
    margin-bottom: 8px;
    opacity: 0.7
}

.scan-error-msg {
    font-size: 12px;
    color: var(--text-muted);
    line-height: 1.5;
    max-width: 300px;
    margin: 0 auto
}

/* Manual entry */
.scan-manual-section {
    margin-top: 4px;
    margin-bottom: 16px
}

.scan-manual-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 14px
}

.scan-manual-divider-line {
    flex: 1;
    height: 1px;
    background: var(--border)
}

.scan-manual-divider-text {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-faint);
    white-space: nowrap
}

.scan-manual-row {
    display: flex;
    gap: 8px
}

.scan-manual-input {
    flex: 3;
    min-width: 0;
    padding: 12px 14px !important;
    font-size: 14px !important;
    border-radius: 10px !important;
    letter-spacing: 2px
}

.scan-manual-btn {
    flex: 1;
    padding: 12px 18px !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 600 !important;
    white-space: nowrap
}

/* Scan history */
.scan-history-section {
    margin-top: 8px
}

.scan-history-list {
    display: flex;
    flex-direction: column;
    gap: 5px
}

.scan-history-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    cursor: pointer;
    transition: all 0.15s
}

.scan-history-card:hover {
    background: var(--surface-hover);
    border-color: var(--green)
}

.scan-history-card:active {
    transform: scale(0.985)
}

.scan-history-img {
    width: 38px;
    height: 38px;
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-hover)
}

.scan-history-img img {
    width: 100%;
    height: 100%;
    object-fit: cover
}

.scan-history-info {
    flex: 1;
    min-width: 0
}

.scan-history-name {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-bright);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    margin-bottom: 2px
}

.scan-history-brand {
    font-size: 10px;
    color: var(--text-muted);
    margin-bottom: 2px
}

.scan-history-macros {
    display: flex;
    align-items: center;
    gap: 4px;
    font-size: 10px
}

.scan-history-add {
    padding: 5px 12px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.1);
    border: 1px solid rgba(34, 197, 94, 0.2);
    color: var(--green);
    font-size: 11px;
    font-weight: 600;
    flex-shrink: 0;
    transition: all 0.15s
}

.scan-history-card:hover .scan-history-add {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--green)
}

.scan-powered-by {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px
}

/* Override html5-qrcode internal styles */
#barcode-scanner-reader {
    border: none !important
}

#barcode-scanner-reader img[alt="Info icon"] {
    display: none !important
}

#barcode-scanner-reader video {
    border-radius: 10px !important
}

#barcode-scanner-reader__scan_region {
    min-height: 200px
}

#barcode-scanner-reader__dashboard {
    display: none !important
}

/* ─── Manual Entry Section ──────────────────────────────────────────────── */
.eats-manual-section {
    padding-bottom: 16px
}

.eats-manual-title {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 4px
}

.eats-manual-sub {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: 14px
}

.eats-manual-name {
    margin-bottom: 12px !important
}

.eats-manual-macros-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

.eats-manual-field {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.eats-manual-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-muted)
}

.eats-manual-input-wrap {
    position: relative
}

.eats-manual-input {
    padding-right: 28px !important
}

.eats-manual-unit {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 10px;
    color: var(--text-faint);
    pointer-events: none
}

.eats-manual-extras {
    margin-top: 12px
}

.eats-manual-extras-toggle {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    padding: 6px 0;
    list-style: none
}

.eats-manual-extras-toggle::-webkit-details-marker {
    display: none
}

/* ─── Skeleton Loading ──────────────────────────────────────────────────── */
.skeleton-container {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.skeleton-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    animation: fadeIn 0.3s ease forwards;
    opacity: 0
}

.skeleton-icon {
    width: 38px;
    height: 38px;
    border-radius: 10px;
    background: var(--track);
    flex-shrink: 0
}

.skeleton-lines {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 6px
}

.skeleton-line {
    height: 10px;
    border-radius: 4px;
    background: var(--track)
}

.skeleton-line.long {
    width: 75%
}

.skeleton-line.short {
    width: 45%
}

.pulse {
    animation: skeletonPulse 1.5s ease infinite
}

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

/* ─── Toast ──────────────────────────────────────────────────────────────── */
.added-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    background: linear-gradient(135deg, var(--green), var(--teal));
    color: #fff;
    padding: 10px 20px;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 600;
    z-index: 200;
    animation: toastIn .3s ease, toastOut .3s ease 1.5s forwards;
    pointer-events: none;
    box-shadow: 0 4px 16px rgba(34, 197, 94, 0.3)
}

@keyframes toastIn {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px)
    }

    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0)
    }
}

@keyframes toastOut {
    from {
        opacity: 1
    }

    to {
        opacity: 0
    }
}

/* ─── Onboarding ─────────────────────────────────────────────────────────── */
.onboard-screen {
    min-height: 100vh;
    min-height: 100dvh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 24px;
    text-align: center
}

.onboard-card {
    width: 100%;
    max-width: 400px;
    padding: 32px 24px;
    border-radius: 20px;
    background: var(--surface);
    border: 1px solid var(--border)
}

.onboard-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--text-white);
    margin-bottom: 8px;
    line-height: 1.2
}

.onboard-sub {
    font-size: 13px;
    color: var(--text-muted);
    margin-bottom: 24px;
    line-height: 1.5
}

.onboard-step {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 2px;
    color: var(--blue);
    margin-bottom: 16px
}

.onboard-input-group {
    text-align: left;
    margin-bottom: 14px
}

.onboard-input-group label {
    font-size: 10px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-muted);
    display: block;
    margin-bottom: 4px
}

/* ─── Charts ─────────────────────────────────────────────────────────────── */
.chart-container {
    background: var(--surface);
    border-radius: 12px;
    padding: 16px;
    border: 1px solid var(--border);
    margin-bottom: 16px
}

.chart-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-muted);
    margin-bottom: 12px
}

/* ─── Account Bar ────────────────────────────────────────────────────────── */
.account-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    margin-bottom: 16px
}

.account-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--purple));
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: #fff;
    flex-shrink: 0
}

.logout-btn {
    background: none;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-muted);
    font-size: 10px;
    padding: 4px 10px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
    margin-left: auto
}

.logout-btn:hover {
    border-color: var(--red);
    color: var(--red)
}

/* ─── Muscle Card Wrapper (Exercise Expansion) ───────────────────────────── */
.muscle-card {
    border-radius: 12px;
    overflow: hidden;
    transition: all .3s ease
}

.muscle-card.expanded {
    grid-column: 1 / -1;
    background: var(--muscle-active-bg);
    border-radius: 14px;
    border: 1px solid var(--muscle-active-border)
}

.muscle-card.expanded .muscle-btn {
    border: none;
    border-radius: 14px 14px 0 0
}

.exercise-toggle-wrapper {
    padding: 0 12px 8px;
    text-align: center
}

.exercise-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: 1px solid var(--muscle-active-border);
    border-radius: 20px;
    color: var(--purple-light);
    font-size: 11px;
    font-weight: 600;
    padding: 5px 14px;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
    letter-spacing: .3px
}

.exercise-toggle-btn:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: var(--purple-light)
}

.exercise-chevron {
    display: inline-block;
    transition: transform .25s ease;
    font-size: 12px
}

.exercise-chevron.open {
    transform: rotate(180deg)
}

.exercise-list {
    padding: 4px 12px 14px;
    display: flex;
    flex-direction: column;
    gap: 6px
}

.exercise-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 9px 12px;
    border-radius: 9px;
    background: rgba(168, 85, 247, 0.06);
    border: 1px solid rgba(168, 85, 247, 0.1);
    transition: all .15s
}

.exercise-item:hover {
    background: rgba(168, 85, 247, 0.12);
    border-color: rgba(168, 85, 247, 0.2)
}

.exercise-num {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(168, 85, 247, 0.15);
    color: var(--purple-light);
    font-size: 11px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    font-family: 'Space Mono', monospace
}

.exercise-name {
    font-size: 12.5px;
    font-weight: 500;
    color: var(--text);
    line-height: 1.3
}

.exercise-item-add {
    cursor: pointer
}

.exercise-item-add:hover {
    border-color: var(--green);
    background: rgba(34, 197, 94, 0.08)
}

.exercise-add-icon {
    margin-left: auto;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: rgba(34, 197, 94, 0.15);
    color: var(--green);
    font-size: 14px;
    font-weight: 700;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .15s
}

.exercise-item-add:hover .exercise-add-icon {
    background: rgba(34, 197, 94, 0.25)
}

.exercise-item-added {
    background: rgba(168, 85, 247, 0.15) !important;
    border-color: var(--purple-light) !important;
    transition: all .3s ease
}

.exercise-add-icon.added {
    background: rgba(168, 85, 247, 0.25) !important;
    color: var(--purple-light) !important
}

/* ─── Exercise Tab ──────────────────────────────────────────────────────── */
.day-selector {
    display: flex;
    gap: 6px
}

.day-pill {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    padding: 10px 0;
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-family: 'DM Sans', sans-serif;
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    position: relative
}

.day-pill.active {
    background: var(--option-active-bg);
    border-color: var(--border-active);
    color: var(--blue-light)
}

.day-pill.today {
    border-color: rgba(34, 197, 94, 0.3)
}

.day-pill.today.active {
    border-color: var(--border-active)
}

.day-pill-label {
    font-size: 11px;
    font-weight: 600
}

.day-pill-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: var(--purple-light);
    position: absolute;
    bottom: 5px
}

.ex-empty {
    text-align: center;
    padding: 40px 20px;
    border-radius: 12px;
    border: 2px dashed var(--border);
    color: var(--text-faint)
}

.ex-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 12px;
    padding: 14px
}

.ex-card-header {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    margin-bottom: 12px
}

.ex-remove-btn {
    background: none;
    border: none;
    color: var(--text-faint);
    font-size: 14px;
    cursor: pointer;
    padding: 2px 6px;
    border-radius: 4px;
    transition: all .2s
}

.ex-remove-btn:hover {
    color: var(--red);
    background: rgba(239, 68, 68, 0.1)
}

.ex-controls {
    display: flex;
    gap: 10px
}

.ex-control-group {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 4px
}

.ex-control-label {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-faint)
}

.ex-stepper {
    display: flex;
    align-items: center;
    border-radius: 8px;
    border: 1px solid var(--border);
    overflow: hidden;
    background: var(--input-bg)
}

.ex-stepper-btn {
    width: 32px;
    height: 34px;
    background: none;
    border: none;
    color: var(--blue-light);
    font-size: 16px;
    font-weight: 700;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: background .15s
}

.ex-stepper-btn:hover {
    background: rgba(59, 130, 246, 0.1)
}

.ex-stepper-value {
    flex: 1;
    text-align: center;
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white)
}

.ex-weight-input {
    width: 100%;
    height: 34px;
    border-radius: 8px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text-white);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    outline: none;
    font-family: 'Space Mono', monospace;
    transition: border-color .2s;
    -moz-appearance: textfield
}

.ex-weight-input::-webkit-inner-spin-button,
.ex-weight-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0
}

.ex-weight-input:focus {
    border-color: var(--blue)
}

.ex-weight-input::placeholder {
    color: var(--text-faint);
    font-weight: 400
}

/* ─── Edit Workout Banner & Buttons ─────────────────────────────────────── */
.edit-workout-banner {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.1);
    border: 1px solid rgba(59, 130, 246, 0.3);
    margin-bottom: 16px
}

.edit-done-btn {
    padding: 8px 16px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), #2563EB);
    color: #fff;
    font-size: 12px;
    font-weight: 700;
    border: none;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
    white-space: nowrap
}

.edit-done-btn:hover {
    transform: translateY(-1px)
}

.edit-workout-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--purple-light);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
    white-space: nowrap
}

.edit-workout-btn:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: var(--purple-light)
}

.add-workouts-btn {
    padding: 10px 20px;
    border-radius: 10px;
    background: rgba(168, 85, 247, 0.12);
    border: 1px solid rgba(168, 85, 247, 0.3);
    color: var(--purple-light);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
    margin-top: 4px
}

.add-workouts-btn:hover {
    background: rgba(168, 85, 247, 0.2);
    border-color: var(--purple-light)
}

/* ─── Start / End Workout Buttons ───────────────────────────────────────── */
.start-workout-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: var(--green);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
    white-space: nowrap
}

.start-workout-btn:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--green)
}

.end-workout-btn {
    padding: 6px 12px;
    border-radius: 8px;
    background: rgba(239, 68, 68, 0.12);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: var(--red);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s;
    white-space: nowrap
}

.end-workout-btn:hover {
    background: rgba(239, 68, 68, 0.2);
    border-color: var(--red)
}

/* ─── Workout Active Banner ─────────────────────────────────────────────── */
.workout-active-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.08);
    border: 1px solid rgba(34, 197, 94, 0.2);
    margin-bottom: 14px
}

/* ─── Workout Logging Mode ──────────────────────────────────────────────── */
.ex-card-workout {
    border-color: rgba(168, 85, 247, 0.2)
}

.ex-card-done {
    border-color: rgba(34, 197, 94, 0.3);
    background: rgba(34, 197, 94, 0.04)
}

.set-log-header {
    display: flex;
    align-items: center;
    padding: 0 4px 8px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px
}

.set-log-header span {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-faint)
}

.set-log-col-set {
    width: 60px;
    flex-shrink: 0
}

.set-log-col-reps {
    flex: 1;
    text-align: center
}

.set-log-col-weight {
    flex: 1;
    text-align: center
}

.set-log-col-done {
    width: 44px;
    flex-shrink: 0;
    text-align: center
}

.set-log-rows {
    display: flex;
    flex-direction: column;
    gap: 4px
}

.set-log-row {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    border-radius: 8px;
    transition: all .2s
}

.set-log-row:hover {
    background: rgba(255, 255, 255, 0.02)
}

.set-log-row-done {
    background: rgba(34, 197, 94, 0.06)
}

.set-log-row-done .set-log-input {
    color: var(--text-muted)
}

.set-log-row .set-log-col-set {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim)
}

.set-log-input {
    width: 56px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text-white);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    outline: none;
    font-family: 'Space Mono', monospace;
    transition: border-color .2s;
    margin: 0 auto;
    display: block;
    -moz-appearance: textfield
}

.set-log-input::-webkit-inner-spin-button,
.set-log-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0
}

.set-log-input:focus {
    border-color: var(--blue)
}

.set-done-checkbox {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 2px solid var(--border);
    background: none;
    color: transparent;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    margin: 0 auto
}

.set-done-checkbox:hover {
    border-color: var(--green)
}

.set-done-checkbox.checked {
    background: var(--green);
    border-color: var(--green);
    color: #fff
}

/* ─── Calories Burned Banner ───────────────────────────────────────────── */
.cal-burned-banner {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    border-radius: 10px;
    background: rgba(251, 146, 60, 0.08);
    border: 1px solid rgba(251, 146, 60, 0.2);
    margin-bottom: 14px
}

.cal-burned-value {
    display: inline-flex;
    align-items: center;
    position: relative
}

/* ─── Calorie Pop Animation ────────────────────────────────────────────── */
.cal-pop {
    position: absolute;
    right: -32px;
    top: -2px;
    font-family: 'Space Mono', monospace;
    font-size: 13px;
    font-weight: 700;
    pointer-events: none;
    animation: calPopUp 0.9s ease-out forwards;
    white-space: nowrap
}

@keyframes calPopUp {
    0% {
        opacity: 1;
        transform: translateY(0)
    }
    60% {
        opacity: 1;
        transform: translateY(-18px)
    }
    100% {
        opacity: 0;
        transform: translateY(-28px)
    }
}

/* ─── Flexible Sets: Delete Column & Add Set Button ────────────────────── */
.set-log-col-del {
    width: 28px;
    flex-shrink: 0;
    text-align: center
}

.set-del-btn {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: none;
    background: none;
    color: var(--text-faint);
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    opacity: 0.4;
    padding: 0
}

.set-del-btn:hover {
    opacity: 1;
    color: var(--red);
    background: rgba(239, 68, 68, 0.1)
}

.add-set-btn {
    display: block;
    width: 100%;
    padding: 8px 0;
    margin-top: 8px;
    border-radius: 8px;
    border: 1px dashed rgba(168, 85, 247, 0.25);
    background: rgba(168, 85, 247, 0.04);
    color: var(--purple-light);
    font-size: 12px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all .2s;
    letter-spacing: 0.3px
}

.add-set-btn:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: var(--purple-light)
}

/* ─── Centered Nav "+" Button ─────────────────────────────────────────── */
.nav-add-btn {
    position: relative;
    justify-content: center;
    padding-top: 0;
    padding-bottom: 0
}

.nav-add-circle {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 34px;
    height: 34px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--purple-light, #a855f7));
    color: #fff !important;
    font-size: 18px !important;
    font-weight: 400;
    line-height: 1;
    box-shadow: 0 3px 10px rgba(59, 130, 246, 0.3);
    transform: translateY(-2px);
    transition: transform .2s, box-shadow .2s
}

.nav-add-btn:hover .nav-add-circle {
    transform: translateY(-3px);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.45)
}

.nav-add-btn.active .nav-add-circle {
    box-shadow: 0 3px 14px rgba(168, 85, 247, 0.55)
}

/* ─── Add Menu Bottom Sheet ───────────────────────────────────────────── */
.add-menu-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.55);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 90;
    display: flex;
    align-items: flex-end;
    justify-content: center;
    animation: addMenuFade .2s ease-out
}

.add-menu-sheet {
    width: 100%;
    max-width: 480px;
    background: var(--card-bg, #1a1a1f);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    border: 1px solid var(--border);
    border-bottom: none;
    padding: 10px 18px calc(24px + env(safe-area-inset-bottom));
    margin-bottom: 72px;
    animation: addMenuSlide .25s cubic-bezier(.2,.8,.2,1)
}

.add-menu-handle {
    width: 40px;
    height: 4px;
    border-radius: 2px;
    background: var(--border);
    margin: 4px auto 12px
}

.add-menu-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    color: var(--text-faint);
    margin-bottom: 10px;
    text-align: center
}

.add-menu-item {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 14px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-white);
    font-size: 14px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    margin-bottom: 8px;
    transition: all .2s
}

.add-menu-item:hover {
    background: rgba(59, 130, 246, 0.08);
    border-color: var(--blue);
    transform: translateY(-1px)
}

.add-menu-item-icon {
    font-size: 20px;
    width: 28px;
    text-align: center
}

.add-menu-item-label {
    flex: 1;
    text-align: left
}

.add-menu-item-arrow {
    color: var(--text-faint);
    font-size: 18px
}

@keyframes addMenuFade {
    from { opacity: 0 }
    to   { opacity: 1 }
}

@keyframes addMenuSlide {
    from { transform: translateY(100%) }
    to   { transform: translateY(0) }
}

/* ══════════════════════════════════════════════════════════════════════
   ROUTINE BUILDER + WORKOUT TRACKER
   ══════════════════════════════════════════════════════════════════════ */

/* ─── Screen Header (shared across create/pick/active views) ──────────── */
.screen-header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 14px
}

.screen-back-btn {
    padding: 6px 12px 6px 8px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 13px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all .2s
}

.screen-back-btn:hover {
    background: rgba(255, 255, 255, 0.08);
    color: var(--text-white)
}

.screen-primary-btn {
    padding: 7px 14px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--blue), var(--purple-light, #a855f7));
    border: none;
    color: #fff;
    font-size: 13px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all .2s;
    box-shadow: 0 2px 10px rgba(59, 130, 246, 0.25)
}

.screen-primary-btn:hover:not(.disabled):not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 4px 14px rgba(59, 130, 246, 0.4)
}

.screen-primary-btn.disabled,
.screen-primary-btn:disabled {
    background: rgba(255, 255, 255, 0.05);
    color: var(--text-faint);
    box-shadow: none;
    cursor: not-allowed
}

/* ─── Main Exercise Page: New Routine Hero Button ─────────────────────── */
.new-routine-btn {
    display: flex;
    align-items: center;
    gap: 14px;
    width: 100%;
    padding: 16px 16px;
    border-radius: 14px;
    background: linear-gradient(135deg, rgba(59, 130, 246, 0.08), rgba(168, 85, 247, 0.08));
    border: 1px solid rgba(168, 85, 247, 0.3);
    cursor: pointer;
    font-family: 'DM Sans', sans-serif;
    transition: all .2s
}

.new-routine-btn:hover {
    transform: translateY(-1px);
    border-color: var(--purple-light);
    box-shadow: 0 4px 16px rgba(168, 85, 247, 0.2)
}

.new-routine-plus {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--blue), var(--purple-light, #a855f7));
    color: #fff;
    font-size: 22px;
    font-weight: 400;
    flex-shrink: 0
}

.new-routine-arrow {
    color: var(--text-faint);
    font-size: 20px
}

/* ─── My Routines: Empty State ────────────────────────────────────────── */
.routines-empty {
    text-align: center;
    padding: 32px 16px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px dashed var(--border)
}

/* ─── Routine Card ────────────────────────────────────────────────────── */
.routine-card {
    padding: 14px;
    border-radius: 12px;
    background: var(--card-bg, #1a1a1f);
    border: 1px solid var(--border);
    transition: all .2s
}

.routine-card:hover {
    border-color: rgba(168, 85, 247, 0.4)
}

.routine-card-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px
}

.routine-edit-btn,
.routine-delete-btn {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-faint);
    font-size: 13px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .2s
}

.routine-edit-btn:hover {
    color: var(--blue);
    border-color: var(--blue)
}

.routine-delete-btn:hover {
    color: var(--red);
    border-color: var(--red)
}

.routine-muscles {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px
}

.routine-muscle-pill {
    font-size: 10px;
    font-weight: 600;
    padding: 3px 8px;
    border-radius: 10px;
    background: rgba(168, 85, 247, 0.12);
    color: var(--purple-light);
    text-transform: uppercase;
    letter-spacing: .5px
}

.start-routine-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    padding: 10px;
    border-radius: 10px;
    background: rgba(34, 197, 94, 0.12);
    border: 1px solid rgba(34, 197, 94, 0.35);
    color: var(--green);
    font-size: 13px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all .2s
}

.start-routine-btn:hover {
    background: rgba(34, 197, 94, 0.2);
    border-color: var(--green);
    transform: translateY(-1px)
}

/* ─── Create Routine: Title Input ─────────────────────────────────────── */
.routine-title-input {
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: var(--input-bg);
    border: 1px solid var(--border);
    color: var(--text-white);
    font-size: 15px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    outline: none;
    transition: border-color .2s
}

.routine-title-input:focus {
    border-color: var(--blue)
}

.routine-title-input::placeholder {
    color: var(--text-faint);
    font-weight: 400
}

/* ─── Draft Exercise Card (within Create Routine) ─────────────────────── */
.draft-ex-card {
    padding: 12px;
    border-radius: 12px;
    background: var(--card-bg, #1a1a1f);
    border: 1px solid var(--border)
}

.draft-ex-header {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 10px
}

.draft-ex-remove {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-faint);
    font-size: 12px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all .2s
}

.draft-ex-remove:hover {
    color: var(--red);
    border-color: var(--red)
}

.draft-set-header {
    display: flex;
    align-items: center;
    padding: 0 4px 6px;
    border-bottom: 1px solid var(--border);
    margin-bottom: 4px
}

.draft-set-header span {
    font-size: 10px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .5px;
    color: var(--text-faint)
}

.draft-set-col-num {
    width: 44px;
    flex-shrink: 0;
    text-align: center
}

.draft-set-col-reps,
.draft-set-col-weight {
    flex: 1;
    text-align: center
}

.draft-set-col-del,
.draft-set-col-done {
    width: 44px;
    flex-shrink: 0;
    text-align: center
}

.draft-set-row {
    display: flex;
    align-items: center;
    padding: 6px 4px;
    border-radius: 8px;
    transition: background .2s
}

.draft-set-row.set-done {
    background: rgba(34, 197, 94, 0.08)
}

.draft-set-row .draft-set-col-num {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-dim)
}

.draft-set-input {
    width: 60px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: var(--input-bg);
    color: var(--text-white);
    font-size: 14px;
    font-weight: 700;
    text-align: center;
    outline: none;
    font-family: 'Space Mono', monospace;
    transition: border-color .2s;
    margin: 0 auto;
    display: block;
    -moz-appearance: textfield
}

.draft-set-input::-webkit-inner-spin-button,
.draft-set-input::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0
}

.draft-set-input:focus {
    border-color: var(--blue)
}

.draft-set-del {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 1px solid var(--border);
    background: rgba(255, 255, 255, 0.03);
    color: var(--text-faint);
    font-size: 14px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all .2s;
    margin: 0 auto
}

.draft-set-del:hover {
    color: var(--red);
    border-color: var(--red)
}

.draft-add-set {
    display: block;
    width: 100%;
    padding: 8px 0;
    margin-top: 8px;
    border-radius: 8px;
    border: 1px dashed rgba(168, 85, 247, 0.25);
    background: rgba(168, 85, 247, 0.04);
    color: var(--purple-light);
    font-size: 12px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all .2s
}

.draft-add-set:hover {
    background: rgba(168, 85, 247, 0.1);
    border-color: var(--purple-light)
}

/* ─── Add Exercise Full-width Button ──────────────────────────────────── */
.add-exercise-btn {
    display: block;
    width: 100%;
    padding: 12px;
    margin-top: 14px;
    border-radius: 12px;
    border: 1px dashed rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.06);
    color: var(--blue);
    font-size: 13px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    transition: all .2s;
    letter-spacing: .3px
}

.add-exercise-btn:hover {
    background: rgba(59, 130, 246, 0.12);
    border-color: var(--blue);
    transform: translateY(-1px)
}

/* ─── Exercise Picker: Category Row ───────────────────────────────────── */
.picker-cat-row {
    display: flex;
    gap: 6px;
    overflow-x: auto;
    padding-bottom: 4px;
    margin-bottom: 4px;
    -webkit-overflow-scrolling: touch
}

.picker-cat-row::-webkit-scrollbar {
    display: none
}

.picker-cat-pill {
    padding: 8px 14px;
    border-radius: 18px;
    background: rgba(255, 255, 255, 0.04);
    border: 1px solid var(--border);
    color: var(--text-dim);
    font-size: 12px;
    font-weight: 600;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    white-space: nowrap;
    flex-shrink: 0;
    transition: all .2s
}

.picker-cat-pill:hover {
    color: var(--text-white);
    border-color: var(--text-dim)
}

.picker-cat-pill.active {
    background: rgba(59, 130, 246, 0.15);
    border-color: var(--blue);
    color: var(--blue)
}

/* ─── Exercise Picker: List Items ─────────────────────────────────────── */
.picker-item {
    display: flex;
    align-items: center;
    gap: 12px;
    width: 100%;
    padding: 12px 14px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid var(--border);
    color: var(--text-white);
    font-size: 14px;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    text-align: left;
    transition: all .15s
}

.picker-item:hover {
    border-color: rgba(59, 130, 246, 0.4);
    background: rgba(59, 130, 246, 0.04)
}

.picker-item.selected {
    border-color: var(--blue);
    background: rgba(59, 130, 246, 0.1)
}

.picker-item-name {
    flex: 1;
    font-weight: 500
}

.picker-item-check {
    width: 24px;
    height: 24px;
    border-radius: 6px;
    border: 2px solid var(--border);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    color: transparent;
    flex-shrink: 0;
    transition: all .15s
}

.picker-item-check.checked {
    background: var(--blue);
    border-color: var(--blue);
    color: #fff
}

/* ─── Exercise Picker: Floating Action Bar ────────────────────────────── */
.picker-action-bar {
    position: fixed;
    bottom: 86px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 32px);
    max-width: 448px;
    z-index: 50;
    animation: pickerBarSlide .25s cubic-bezier(.2,.8,.2,1)
}

.picker-confirm-btn {
    display: block;
    width: 100%;
    padding: 14px;
    border-radius: 12px;
    background: linear-gradient(135deg, var(--blue), var(--purple-light, #a855f7));
    border: none;
    color: #fff;
    font-size: 14px;
    font-weight: 700;
    font-family: 'DM Sans', sans-serif;
    cursor: pointer;
    box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
    transition: all .2s
}

.picker-confirm-btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 8px 24px rgba(59, 130, 246, 0.5)
}

@keyframes pickerBarSlide {
    from { transform: translateX(-50%) translateY(100%); opacity: 0 }
    to   { transform: translateX(-50%) translateY(0); opacity: 1 }
}

/* ─── Active Workout Cards ────────────────────────────────────────────── */
.active-ex-card {
    padding: 12px;
    border-radius: 12px;
    background: var(--card-bg, #1a1a1f);
    border: 1px solid rgba(168, 85, 247, 0.2);
    transition: all .3s
}

.active-ex-card.active-ex-done {
    border-color: rgba(34, 197, 94, 0.5);
    background: rgba(34, 197, 94, 0.04)
}

/* ══════════════════════════════════════════════════════════════════════════
   REDESIGNED ADD MENU — Bottom Sheet + Full-Screen Popup
   ══════════════════════════════════════════════════════════════════════════ */

/* ─── Add Menu Cards (Eats + Exercise) ──────────────────────────────────── */
.add-menu-cards {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
    padding: 0 2px
}

.add-menu-card {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    padding: 24px 16px;
    border-radius: 16px;
    border: 1px solid var(--border);
    cursor: pointer;
    overflow: hidden;
    transition: all .25s cubic-bezier(.2,.8,.2,1);
    font-family: 'DM Sans', sans-serif;
    -webkit-appearance: none;
    width: 100%;
    background: transparent
}

.add-menu-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 16px;
    opacity: 0.06;
    transition: opacity .3s
}

.add-menu-card:hover::before {
    opacity: 0.12
}

.add-menu-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-active)
}

.add-menu-card:active {
    transform: scale(0.97)
}

.add-menu-card.eats-card::before {
    background: linear-gradient(135deg, #22C55E, #14B8A6)
}

.add-menu-card.eats-card {
    border-color: rgba(34, 197, 94, 0.15)
}

.add-menu-card.eats-card:hover {
    border-color: rgba(34, 197, 94, 0.4);
    box-shadow: 0 4px 24px rgba(34, 197, 94, 0.12)
}

.add-menu-card.exercise-card::before {
    background: linear-gradient(135deg, #A855F7, #6366F1)
}

.add-menu-card.exercise-card {
    border-color: rgba(168, 85, 247, 0.15)
}

.add-menu-card.exercise-card:hover {
    border-color: rgba(168, 85, 247, 0.4);
    box-shadow: 0 4px 24px rgba(168, 85, 247, 0.12)
}

.add-menu-card-icon {
    width: 48px;
    height: 48px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    transition: transform .3s
}

.add-menu-card:hover .add-menu-card-icon {
    transform: scale(1.08)
}

.add-menu-card.eats-card .add-menu-card-icon {
    background: linear-gradient(135deg, rgba(34, 197, 94, 0.15), rgba(20, 184, 166, 0.15));
    box-shadow: 0 2px 12px rgba(34, 197, 94, 0.1)
}

.add-menu-card.exercise-card .add-menu-card-icon {
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.15), rgba(99, 102, 241, 0.15));
    box-shadow: 0 2px 12px rgba(168, 85, 247, 0.1)
}

.add-menu-card-label {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
    letter-spacing: 0.3px
}

.add-menu-card-sub {
    font-size: 10px;
    color: var(--text-muted);
    margin-top: -4px;
    letter-spacing: 0.2px
}

/* ─── Full-Screen Popup Overlay ────────────────────────────────────────── */
.popup-overlay {
    position: fixed;
    inset: 0;
    z-index: 200;
    display: flex;
    flex-direction: column;
    animation: popupFadeIn .3s ease-out
}

.popup-overlay::before {
    content: '';
    position: absolute;
    inset: 0;
    background: var(--bg);
    opacity: 0.97
}

.popup-content {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    flex: 1;
    overflow-y: auto;
    padding: 0 16px 40px;
    -webkit-overflow-scrolling: touch
}

.popup-header {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 480px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    padding: 16px 16px 8px;
    gap: 12px
}

.popup-close-btn {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    font-size: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
    flex-shrink: 0;
    font-family: 'DM Sans', sans-serif;
    line-height: 1
}

.popup-close-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-active);
    color: var(--text-white);
    transform: scale(1.05)
}

.popup-close-btn:active {
    transform: scale(0.95)
}

.popup-header-title {
    font-size: 18px;
    font-weight: 700;
    color: var(--text-white);
    flex: 1
}

.popup-header-icon {
    font-size: 20px
}

/* ─── Popup Option Grid ────────────────────────────────────────────────── */
.popup-section-title {
    font-size: 11px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--text-muted);
    margin: 24px 0 14px;
    display: flex;
    align-items: center;
    gap: 8px
}

.popup-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border)
}

.popup-options-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px
}

.popup-option-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 12px 16px;
    border-radius: 14px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: all .25s cubic-bezier(.2,.8,.2,1);
    font-family: 'DM Sans', sans-serif;
    -webkit-appearance: none;
    width: 100%;
    text-align: center;
    position: relative;
    overflow: hidden
}

.popup-option-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 14px;
    opacity: 0;
    transition: opacity .3s
}

.popup-option-card:hover::before {
    opacity: 0.06
}

.popup-option-card:hover {
    transform: translateY(-2px);
    border-color: var(--border-active);
    box-shadow: 0 4px 20px rgba(0,0,0,0.15)
}

.popup-option-card:active {
    transform: scale(0.96)
}

.popup-option-icon {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 20px;
    transition: transform .3s
}

.popup-option-card:hover .popup-option-icon {
    transform: scale(1.1)
}

.popup-option-label {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-white)
}

.popup-option-desc {
    font-size: 10px;
    color: var(--text-muted);
    line-height: 1.3
}

/* ── Eats option coloring ── */
.popup-option-card.opt-recent::before { background: linear-gradient(135deg, #EAB308, #F97316) }
.popup-option-card.opt-recent .popup-option-icon { background: rgba(234, 179, 8, 0.12) }

.popup-option-card.opt-search::before { background: linear-gradient(135deg, #3B82F6, #06B6D4) }
.popup-option-card.opt-search .popup-option-icon { background: rgba(59, 130, 246, 0.12) }

.popup-option-card.opt-scan::before { background: linear-gradient(135deg, #14B8A6, #22C55E) }
.popup-option-card.opt-scan .popup-option-icon { background: rgba(20, 184, 166, 0.12) }

.popup-option-card.opt-nearby::before { background: linear-gradient(135deg, #F43F5E, #F97316) }
.popup-option-card.opt-nearby .popup-option-icon { background: rgba(244, 63, 94, 0.12) }

.popup-option-card.opt-manual::before { background: linear-gradient(135deg, #A855F7, #EC4899) }
.popup-option-card.opt-manual .popup-option-icon { background: rgba(168, 85, 247, 0.12) }

/* ── Exercise option coloring ── */
.popup-option-card.opt-new-routine::before { background: linear-gradient(135deg, #22C55E, #14B8A6) }
.popup-option-card.opt-new-routine .popup-option-icon { background: rgba(34, 197, 94, 0.12) }

.popup-option-card.opt-my-routines::before { background: linear-gradient(135deg, #6366F1, #A855F7) }
.popup-option-card.opt-my-routines .popup-option-icon { background: rgba(99, 102, 241, 0.12) }

.popup-option-card.opt-workout-log::before { background: linear-gradient(135deg, #F97316, #EAB308) }
.popup-option-card.opt-workout-log .popup-option-icon { background: rgba(249, 115, 22, 0.12) }

/* Full-width option variant */
.popup-option-card.full-width {
    grid-column: 1 / -1;
    flex-direction: row;
    gap: 14px;
    padding: 16px 18px;
    text-align: left
}

.popup-option-card.full-width .popup-option-info {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px
}

.popup-option-card.full-width .popup-option-arrow {
    font-size: 16px;
    color: var(--text-faint);
    transition: transform .2s
}

.popup-option-card.full-width:hover .popup-option-arrow {
    transform: translateX(3px)
}

/* ─── Popup Animations ─────────────────────────────────────────────────── */
@keyframes popupFadeIn {
    from {
        opacity: 0
    }
    to {
        opacity: 1
    }
}

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

/* When popup-content embeds a full tab, just do a single fade-in on the tab container */
.popup-content > .eats-tab,
.popup-content > .fade-in {
    animation: popupSlideUp .3s ease-out backwards;
    animation-delay: .05s
}

/* Ensure PortionModal inside popup renders above popup overlay */
.popup-overlay .portion-overlay {
    z-index: 260
}

/* Ensure the popup's embedded content uses full height properly */
.popup-content > .eats-tab {
    padding-bottom: 30px
}

/* ── Dashboard Quick Access Section ──────────────────────────────────── */
.dash-quick-access {
    margin-bottom: 20px
}

.dash-quick-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 10px
}

.dash-quick-card {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    cursor: pointer;
    transition: all .25s cubic-bezier(.2,.8,.2,1);
    font-family: 'DM Sans', sans-serif;
    -webkit-appearance: none;
    width: 100%;
    text-align: left;
    position: relative;
    overflow: hidden
}

.dash-quick-card::before {
    content: '';
    position: absolute;
    inset: 0;
    border-radius: 12px;
    opacity: 0.05;
    transition: opacity .3s
}

.dash-quick-card:hover::before {
    opacity: 0.1
}

.dash-quick-card:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 16px rgba(0,0,0,0.1)
}

.dash-quick-card:active {
    transform: scale(0.97)
}

.dash-quick-card.qc-search::before { background: linear-gradient(135deg, #3B82F6, #06B6D4) }
.dash-quick-card.qc-search { border-color: rgba(59, 130, 246, 0.12) }
.dash-quick-card.qc-search:hover { border-color: rgba(59, 130, 246, 0.3) }

.dash-quick-card.qc-scan::before { background: linear-gradient(135deg, #14B8A6, #22C55E) }
.dash-quick-card.qc-scan { border-color: rgba(20, 184, 166, 0.12) }
.dash-quick-card.qc-scan:hover { border-color: rgba(20, 184, 166, 0.3) }

.dash-quick-card.qc-workout::before { background: linear-gradient(135deg, #A855F7, #6366F1) }
.dash-quick-card.qc-workout { border-color: rgba(168, 85, 247, 0.12) }
.dash-quick-card.qc-workout:hover { border-color: rgba(168, 85, 247, 0.3) }

.dash-quick-card.qc-nearby::before { background: linear-gradient(135deg, #F43F5E, #F97316) }
.dash-quick-card.qc-nearby { border-color: rgba(244, 63, 94, 0.12) }
.dash-quick-card.qc-nearby:hover { border-color: rgba(244, 63, 94, 0.3) }

.dash-quick-icon {
    width: 34px;
    height: 34px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    flex-shrink: 0;
    transition: transform .2s
}

.dash-quick-card:hover .dash-quick-icon {
    transform: scale(1.08)
}

.dash-quick-card.qc-search .dash-quick-icon { background: rgba(59, 130, 246, 0.12) }
.dash-quick-card.qc-scan .dash-quick-icon { background: rgba(20, 184, 166, 0.12) }
.dash-quick-card.qc-workout .dash-quick-icon { background: rgba(168, 85, 247, 0.12) }
.dash-quick-card.qc-nearby .dash-quick-icon { background: rgba(244, 63, 94, 0.12) }

.dash-quick-info {
    flex: 1;
    min-width: 0
}

.dash-quick-label {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-white);
    line-height: 1.2
}

.dash-quick-sub {
    font-size: 9px;
    color: var(--text-faint);
    margin-top: 1px
}

/* ══════════════════════════════════════════════════════════════════════════
   HEALTH TAB — Workout Breakdown
   ══════════════════════════════════════════════════════════════════════════ */

/* ─── Stats Row (ring + mini stats) ──────────────────────────────────── */
.health-stats-row {
    display: flex;
    gap: 14px;
    align-items: stretch
}

.health-stat-card {
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px
}

.health-stat-primary {
    min-width: 110px;
    flex-shrink: 0;
    border-color: rgba(168, 85, 247, 0.15);
    position: relative;
    overflow: hidden
}

.health-stat-primary::before {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(168, 85, 247, 0.06), rgba(99, 102, 241, 0.04));
    border-radius: 14px
}

/* Weekly ring SVG */
.health-ring-wrap {
    position: relative;
    width: 76px;
    height: 76px
}

.health-ring-svg {
    width: 100%;
    height: 100%;
    transform: rotate(-90deg)
}

.health-ring-bg {
    fill: none;
    stroke: var(--track);
    stroke-width: 5
}

.health-ring-fill {
    fill: none;
    stroke-width: 5;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.8s cubic-bezier(0.4, 0, 0.2, 1)
}

.health-ring-center {
    position: absolute;
    inset: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center
}

/* Mini stats grid */
.health-mini-stats {
    flex: 1;
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 8px
}

.health-mini-stat {
    border-radius: 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 12px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px
}

.health-mini-val {
    font-size: 16px;
    font-weight: 700;
    color: var(--text-white);
    line-height: 1.2
}

.health-mini-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    text-align: center
}

/* ─── Section Cards ──────────────────────────────────────────────────── */
.health-section-card {
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 14px;
    overflow: hidden
}

.health-section-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 14px;
    text-transform: uppercase;
    letter-spacing: 0.5px
}

/* ─── Weekly Heatmap ─────────────────────────────────────────────────── */
.health-week-heatmap {
    display: flex;
    justify-content: space-between;
    gap: 6px
}

.health-day-cell {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px
}

.health-day-label {
    font-size: 10px;
    font-weight: 600;
    color: var(--text-faint);
    letter-spacing: 0.3px
}

.health-day-cell.today .health-day-label {
    color: var(--blue)
}

.health-day-dot {
    width: 32px;
    height: 32px;
    border-radius: 10px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--track);
    font-size: 11px;
    font-weight: 700;
    color: transparent;
    transition: all .3s
}

.health-day-dot.filled {
    background: rgba(168, 85, 247, 0.18);
    border: 1px solid rgba(168, 85, 247, 0.35);
    color: var(--purple-light)
}

.health-day-cell.today .health-day-dot {
    border: 1px solid rgba(59, 130, 246, 0.3)
}

/* ─── Muscle Frequency Bars ──────────────────────────────────────────── */
.health-muscle-freq {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.health-muscle-bar-row {
    display: flex;
    align-items: center;
    gap: 10px
}

.health-muscle-name {
    font-size: 11px;
    font-weight: 600;
    color: var(--text-dim);
    width: 70px;
    flex-shrink: 0;
    text-transform: capitalize
}

.health-muscle-track {
    flex: 1;
    height: 8px;
    border-radius: 4px;
    background: var(--track);
    overflow: hidden
}

.health-muscle-fill {
    height: 100%;
    border-radius: 4px;
    transition: width 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    min-width: 4px
}

.health-muscle-count {
    font-size: 11px;
    font-weight: 700;
    color: var(--text-muted);
    width: 24px;
    text-align: right
}

/* ─── Recent Sessions ────────────────────────────────────────────────── */
.health-recent-sessions {
    display: flex;
    flex-direction: column;
    gap: 8px
}

.health-session-card {
    padding: 12px 14px;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-faint);
    transition: all .2s
}

.health-session-card:hover {
    background: var(--surface-hover);
    border-color: var(--border)
}

.health-session-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 4px
}

.health-session-title {
    font-size: 13px;
    font-weight: 700;
    color: var(--text-white);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap
}

.health-session-badge {
    font-size: 10px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 6px;
    background: rgba(168, 85, 247, 0.1);
    color: var(--purple-light);
    border: 1px solid rgba(168, 85, 247, 0.2);
    flex-shrink: 0
}

.health-session-badge.complete {
    background: rgba(34, 197, 94, 0.1);
    color: var(--green);
    border-color: rgba(34, 197, 94, 0.25)
}

.health-session-meta {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 11px;
    color: var(--text-faint)
}

.health-session-dot {
    font-size: 8px;
    opacity: 0.4
}

.health-session-muscles {
    display: flex;
    flex-wrap: wrap;
    gap: 4px;
    margin-top: 6px
}

.health-session-muscle-pill {
    font-size: 9px;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.03);
    border: 1px solid;
    text-transform: capitalize
}

/* ══════════════════════════════════════════════════════════════════════════
   CALENDAR TAB
   ══════════════════════════════════════════════════════════════════════════ */

/* ─── Month Navigation ─────────────────────────────────────────────────── */
.cal-nav {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px
}

.cal-nav-btn {
    width: 38px;
    height: 38px;
    border-radius: 12px;
    border: 1px solid var(--border);
    background: var(--surface);
    color: var(--text-dim);
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all .2s;
    font-family: 'DM Sans', sans-serif;
    line-height: 1
}

.cal-nav-btn:hover {
    background: var(--surface-hover);
    border-color: var(--border-active);
    color: var(--text-white)
}

.cal-nav-btn:active {
    transform: scale(0.93)
}

.cal-nav-title {
    text-align: center
}

/* ─── Month/Year Select Dropdowns ────────────────────────────────────── */
.cal-nav-selectors {
    display: flex;
    align-items: center;
    gap: 4px;
    justify-content: center
}

.cal-select {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text-white);
    font-family: 'DM Sans', sans-serif;
    font-size: 15px;
    font-weight: 700;
    padding: 6px 10px;
    cursor: pointer;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%236B7280' fill='none' stroke-width='1.5' stroke-linecap='round'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 8px center;
    padding-right: 24px;
    transition: all .2s
}

.cal-select:hover {
    border-color: var(--border-active);
    background-color: var(--surface-hover)
}

.cal-select:focus {
    outline: none;
    border-color: var(--blue);
    box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.15)
}

.cal-select option {
    background: var(--bg);
    color: var(--text-white)
}

.cal-select-year {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-muted)
}

.cal-today-btn {
    display: block;
    margin: 0 auto 14px;
    padding: 6px 16px;
    border-radius: 20px;
    border: 1px solid rgba(59, 130, 246, 0.2);
    background: rgba(59, 130, 246, 0.08);
    color: var(--blue);
    font-size: 11px;
    font-weight: 600;
    cursor: pointer;
    transition: all .2s;
    font-family: 'DM Sans', sans-serif
}

.cal-today-btn:hover {
    background: rgba(59, 130, 246, 0.15);
    border-color: rgba(59, 130, 246, 0.35)
}

/* ─── Calendar Grid ────────────────────────────────────────────────────── */
.cal-grid {
    display: grid;
    grid-template-columns: repeat(7, 1fr);
    gap: 4px;
    margin-bottom: 12px
}

.cal-header {
    text-align: center;
    font-size: 10px;
    font-weight: 700;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 4px 0 8px
}

.cal-cell {
    aspect-ratio: 1;
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border: 1.5px solid transparent;
    background: var(--surface);
    transition: all .2s cubic-bezier(.2,.8,.2,1);
    position: relative;
    font-family: 'DM Sans', sans-serif;
    -webkit-appearance: none;
    width: 100%;
    gap: 3px
}

.cal-blank {
    background: transparent;
    cursor: default;
    border: none
}

.cal-day-num {
    font-size: 13px;
    font-weight: 600;
    color: var(--text-dim);
    line-height: 1
}

.cal-dot {
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: currentColor;
    opacity: 0.7
}

/* ── Status Colors ── */
.cal-status-green {
    background: rgba(34, 197, 94, 0.08);
    border-color: rgba(34, 197, 94, 0.2);
    color: #22C55E
}

.cal-status-green .cal-day-num { color: #22C55E }

.cal-status-yellow {
    background: rgba(234, 179, 8, 0.08);
    border-color: rgba(234, 179, 8, 0.2);
    color: #EAB308
}

.cal-status-yellow .cal-day-num { color: #EAB308 }

.cal-status-red {
    background: rgba(239, 68, 68, 0.06);
    border-color: rgba(239, 68, 68, 0.15);
    color: #EF4444
}

.cal-status-red .cal-day-num { color: #EF4444 }

.cal-status-future {
    opacity: 0.35;
    cursor: default
}

.cal-status-none {
    background: var(--surface);
    border-color: var(--border)
}

/* ── Today highlight ── */
.cal-today {
    box-shadow: 0 0 0 2px var(--blue);
    border-color: transparent !important
}

.cal-today .cal-day-num {
    color: var(--blue) !important;
    font-weight: 800
}

/* ── Selected state ── */
.cal-selected {
    transform: scale(1.08);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    z-index: 2
}

/* ── Hover ── */
.cal-cell:not(.cal-blank):not(.cal-status-future):hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1)
}

.cal-cell:not(.cal-blank):active {
    transform: scale(0.95)
}

/* ─── Legend ────────────────────────────────────────────────────────────── */
.cal-legend {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-bottom: 14px
}

.cal-legend-item {
    display: flex;
    align-items: center;
    gap: 5px;
    font-size: 10px;
    color: var(--text-faint);
    font-weight: 500
}

.cal-legend-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%
}

.cal-legend-green { background: #22C55E }
.cal-legend-yellow { background: #EAB308 }
.cal-legend-red { background: #EF4444 }

/* ─── Monthly Summary ──────────────────────────────────────────────────── */
.cal-summary {
    display: flex;
    gap: 8px;
    margin-bottom: 16px
}

.cal-summary-stat {
    flex: 1;
    border-radius: 12px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 10px 8px;
    text-align: center
}

.cal-summary-val {
    font-size: 18px;
    font-weight: 800;
    color: var(--text-white);
    line-height: 1.2;
    font-family: 'Space Mono', monospace
}

.cal-val-green { color: #22C55E }
.cal-val-yellow { color: #EAB308 }
.cal-val-red { color: #EF4444 }

.cal-summary-label {
    font-size: 9px;
    font-weight: 600;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-top: 2px
}

/* ─── Day Detail Panel ─────────────────────────────────────────────────── */
.cal-detail {
    border-radius: 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    padding: 16px;
    margin-bottom: 16px
}

.cal-detail-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 14px
}

.cal-detail-date {
    font-size: 14px;
    font-weight: 700;
    color: var(--text-white);
    display: flex;
    align-items: center;
    gap: 8px
}

.cal-detail-today-badge {
    font-size: 9px;
    font-weight: 700;
    padding: 2px 8px;
    border-radius: 10px;
    background: rgba(59, 130, 246, 0.12);
    color: var(--blue);
    border: 1px solid rgba(59, 130, 246, 0.2)
}

.cal-detail-status {
    font-size: 10px;
    font-weight: 700;
    padding: 3px 10px;
    border-radius: 8px
}

.cal-detail-green {
    background: rgba(34, 197, 94, 0.1);
    color: #22C55E;
    border: 1px solid rgba(34, 197, 94, 0.2)
}

.cal-detail-yellow {
    background: rgba(234, 179, 8, 0.1);
    color: #EAB308;
    border: 1px solid rgba(234, 179, 8, 0.2)
}

.cal-detail-red {
    background: rgba(239, 68, 68, 0.1);
    color: #EF4444;
    border: 1px solid rgba(239, 68, 68, 0.2)
}

.cal-detail-future {
    background: rgba(100, 116, 139, 0.1);
    color: var(--text-muted);
    border: 1px solid rgba(100, 116, 139, 0.2)
}

.cal-detail-none {
    background: var(--surface);
    color: var(--text-faint);
    border: 1px solid var(--border)
}

.cal-detail-section {
    padding: 12px;
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid var(--border-faint);
    margin-bottom: 8px
}

.cal-detail-section:last-child {
    margin-bottom: 0
}

.cal-detail-section-title {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 700;
    color: var(--text-dim);
    margin-bottom: 8px
}

.cal-detail-check {
    font-size: 11px;
    color: #22C55E;
    margin-left: auto
}

.cal-detail-macros {
    display: flex;
    gap: 12px;
    flex-wrap: wrap
}

.cal-detail-macro {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 1px
}

.cal-detail-macro-val {
    font-size: 14px;
    font-weight: 700;
    color: var(--orange)
}

.cal-detail-macro-label {
    font-size: 9px;
    color: var(--text-faint);
    text-transform: uppercase;
    letter-spacing: 0.5px
}

.cal-detail-empty {
    font-size: 11px;
    color: var(--text-faint);
    font-style: italic
}

.cal-detail-workouts {
    display: flex;
    flex-direction: column;
    gap: 6px
}

.cal-detail-workout-card {
    padding: 8px 10px;
    border-radius: 8px;
    background: var(--surface);
    border: 1px solid var(--border)
}

.cal-detail-workout-top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2px
}

.cal-detail-workout-title {
    font-size: 12px;
    font-weight: 600;
    color: var(--text-white)
}

.cal-detail-workout-pct {
    font-size: 10px;
    font-weight: 700;
    color: var(--purple-light)
}

.cal-detail-workout-pct.complete {
    color: var(--green)
}

.cal-detail-workout-meta {
    font-size: 10px;
    color: var(--text-faint)
}
/* ─── Calendar workout recap (expandable) ─────────────────────────────── */
.cal-detail-workout-card {
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 10px;
  overflow: hidden;
  transition: border-color .15s;
}
.cal-detail-workout-card.expanded {
  border-color: rgba(139,92,246,0.35);
}
.cal-workout-card-btn {
  display: block;
  width: 100%;
  text-align: left;
  background: transparent;
  border: none;
  padding: 10px 12px;
  cursor: pointer;
  color: inherit;
}
.cal-workout-card-btn:hover { background: rgba(255,255,255,0.02); }
.cal-workout-chevron {
  float: right;
  font-size: 11px;
  color: var(--text-faint);
  transition: transform .2s;
  display: inline-block;
}
.cal-workout-chevron.open { transform: rotate(180deg); }
.cal-workout-muscles {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 6px;
}
.cal-workout-muscle-pill {
  font-size: 9px;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 4px;
  background: rgba(139,92,246,0.12);
  color: var(--purple-light);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.cal-workout-recap {
  border-top: 1px solid rgba(255,255,255,0.06);
  padding: 10px 12px;
  background: rgba(0,0,0,0.18);
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.cal-recap-ex {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.cal-recap-ex-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.cal-recap-ex-name {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-white);
}
.cal-recap-ex-count {
  font-size: 10px;
  color: var(--green);
  font-weight: 700;
}
.cal-recap-sets {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}
.cal-recap-set {
  font-size: 10px;
  padding: 2px 6px;
  background: rgba(34,197,94,0.1);
  border: 1px solid rgba(34,197,94,0.25);
  border-radius: 4px;
  color: var(--text-white);
}
.cal-recap-sets-empty {
  font-size: 10px;
  color: var(--text-faint);
  font-style: italic;
}

/* ─── MuscleDiagram (Weekly Muscle Tracker) ───────────────────────────── */
.md-card {
  background: linear-gradient(180deg, rgba(255,255,255,0.03), rgba(255,255,255,0.01));
  border: 1px solid var(--border-subtle);
  border-radius: 18px;
  padding: 18px 16px 16px;
  box-shadow: 0 4px 24px rgba(0,0,0,0.25), inset 0 1px 0 rgba(255,255,255,0.03);
}

/* Header ---------------------------------------------------------------- */
.md-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 16px;
}
.md-title {
  font-size: 15px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.2px;
}
.md-sub {
  font-size: 11px;
  color: var(--text-muted);
  margin-top: 3px;
}
.md-legend {
  display: flex;
  gap: 10px;
  font-family: "Space Mono", monospace;
  font-size: 10px;
  color: var(--text-dim);
  align-items: center;
}
.md-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.md-legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
  box-shadow: 0 0 0 1px rgba(255,255,255,0.06);
}

/* Front / Back toggle --------------------------------------------------- */
.md-toggle {
  position: relative;
  display: flex;
  background: rgba(0,0,0,0.25);
  border-radius: 12px;
  padding: 4px;
  margin-bottom: 12px;
  border: 1px solid var(--border-subtle);
}
.md-toggle-indicator {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  width: calc(50% - 4px);
  background: linear-gradient(180deg, rgba(139,92,246,0.35), rgba(139,92,246,0.18));
  border-radius: 9px;
  border: 1px solid rgba(139,92,246,0.45);
  transition: transform .28s cubic-bezier(.4,.0,.2,1);
  pointer-events: none;
  box-shadow: 0 2px 8px rgba(139,92,246,0.25);
}
.md-toggle-indicator.md-toggle-back {
  transform: translateX(100%);
}
.md-toggle-btn {
  position: relative;
  z-index: 1;
  flex: 1;
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 12px;
  font-weight: 600;
  padding: 8px 0;
  border-radius: 9px;
  cursor: pointer;
  transition: color .2s;
  letter-spacing: 0.2px;
}
.md-toggle-btn.active {
  color: var(--text-white);
}

/* SVG stage ------------------------------------------------------------- */
.md-stage {
  display: flex;
  justify-content: center;
  padding: 4px 0 8px;
}
.md-svg {
  width: 240px;
  max-width: 100%;
  height: auto;
  display: block;
}

/* Silhouette fill is handled via gradient in <defs> */
.md-silhouette path {
  transition: fill .3s;
}

/* Regions --------------------------------------------------------------- */
.md-region {
  cursor: pointer;
  transition: transform .2s cubic-bezier(.4,.0,.2,1), opacity .2s;
  transform-origin: center;
  transform-box: fill-box;
}
.md-region path {
  transition: fill .4s, stroke .2s, stroke-width .2s, filter .3s;
}
.md-region:hover {
  opacity: 0.92;
}
.md-region.md-selected path {
  filter: drop-shadow(0 0 6px rgba(139,92,246,0.55));
}
/* Gentle pulse on hit muscles so they feel alive */
.md-region.md-state-hit path {
  animation: mdPulseHit 3s ease-in-out infinite;
}
.md-region.md-state-partial path {
  animation: mdPulsePartial 2.6s ease-in-out infinite;
}
@keyframes mdPulseHit {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(34,197,94,0.35)); }
  50%      { filter: drop-shadow(0 0 6px rgba(34,197,94,0.75)); }
}
@keyframes mdPulsePartial {
  0%, 100% { filter: drop-shadow(0 0 2px rgba(239,68,68,0.30)); }
  50%      { filter: drop-shadow(0 0 6px rgba(239,68,68,0.65)); }
}
.md-region.md-selected.md-state-hit path,
.md-region.md-selected.md-state-partial path {
  animation: none;
}

/* Cardio badge ---------------------------------------------------------- */
.md-cardio {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 14px;
  margin-top: 6px;
  background: rgba(255,255,255,0.02);
  border: 1px solid var(--border-subtle);
  border-radius: 12px;
  color: var(--text-white);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .2s, border-color .3s, transform .15s;
}
.md-cardio:hover { background: rgba(255,255,255,0.04); transform: translateY(-1px); }
.md-cardio:active { transform: translateY(0); }
.md-cardio.md-state-partial {
  border-color: rgba(239,68,68,0.45);
  background: linear-gradient(180deg, rgba(239,68,68,0.08), rgba(239,68,68,0.02));
}
.md-cardio.md-state-hit {
  border-color: rgba(34,197,94,0.45);
  background: linear-gradient(180deg, rgba(34,197,94,0.08), rgba(34,197,94,0.02));
}
.md-cardio-icon {
  font-size: 16px;
  width: 24px;
  height: 24px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: rgba(0,0,0,0.25);
  border-radius: 8px;
}
.md-cardio-label { flex: 1; text-align: left; }
.md-cardio-count { font-size: 11px; font-weight: 700; }

/* Tooltip / detail ------------------------------------------------------ */
.md-tooltip {
  margin-top: 12px;
  padding: 12px 14px;
  background: linear-gradient(180deg, rgba(139,92,246,0.12), rgba(139,92,246,0.04));
  border: 1px solid rgba(139,92,246,0.28);
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(139,92,246,0.15);
}
.md-tooltip-head {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.md-tooltip-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  box-shadow: 0 0 6px currentColor;
}
.md-tooltip-name {
  flex: 1;
  font-size: 13px;
  font-weight: 700;
  color: var(--text-white);
  letter-spacing: -0.1px;
}
.md-tooltip-count { font-size: 11px; font-weight: 700; }
.md-tooltip-sessions { display: flex; flex-direction: column; gap: 4px; }
.md-tooltip-row {
  display: flex;
  gap: 10px;
  font-size: 11px;
  padding: 4px 0;
  border-top: 1px solid rgba(255,255,255,0.05);
}
.md-tooltip-row:first-child { border-top: none; padding-top: 0; }
.md-tooltip-day {
  font-family: "Space Mono", monospace;
  color: var(--text-dim);
  width: 88px;
  flex-shrink: 0;
}
.md-tooltip-title {
  color: var(--text-white);
  flex: 1;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.md-tooltip-empty {
  font-size: 11px;
  color: var(--text-faint);
  font-style: italic;
}
.md-hint {
  text-align: center;
  font-size: 11px;
  color: var(--text-faint);
  margin-top: 10px;
  letter-spacing: 0.3px;
}
