/* =============================================
   FITFORGE — REDESIGNED DESIGN SYSTEM
   Premium dark fitness aesthetic
   ============================================= */

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

/* ---- VARIABLES ---- */
:root {
    --green:        #00e87a;
    --green-dim:    #00c464;
    --green-glow:   rgba(0, 232, 122, 0.18);
    --green-glow2:  rgba(0, 232, 122, 0.07);

    --blue:         #3b82f6;
    --purple:       #8b5cf6;
    --orange:       #f97316;

    --bg:           #080d1a;
    --bg-card:      #0f1629;
    --bg-raised:    #162035;
    --bg-hover:     #1e2d4a;
    --border:       rgba(255,255,255,0.07);
    --border-hi:    rgba(255,255,255,0.14);

    --text:         #eef2ff;
    --text-muted:   #6b7a9f;
    --text-dim:     #3d4f72;

    --protein-c:    #f87171;
    --carbs-c:      #38bdf8;
    --fats-c:       #fbbf24;

    --radius-sm:    6px;
    --radius:       10px;
    --radius-md:    14px;
    --radius-lg:    20px;
    --radius-xl:    28px;

    --shadow:       0 2px 8px rgba(0,0,0,.4);
    --shadow-md:    0 8px 24px rgba(0,0,0,.5);
    --shadow-lg:    0 20px 40px rgba(0,0,0,.6);
    --glow:         0 0 24px var(--green-glow);

    --transition:   all 0.22s cubic-bezier(.4,0,.2,1);
}

/* ---- BASE ---- */
body {
    font-family: 'Outfit', -apple-system, BlinkMacSystemFont, sans-serif;
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.55;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3 { line-height: 1.2; }
h1 { font-size: clamp(1.8rem, 4vw, 2.6rem); font-weight: 800; letter-spacing: -.03em; }
h2 { font-size: clamp(1.1rem, 2.5vw, 1.4rem); font-weight: 700; letter-spacing: -.02em; }
h3 { font-size: 1rem; font-weight: 600; }

.mono { font-family: 'JetBrains Mono', monospace; }
.muted { color: var(--text-muted); }

/* ---- SCREEN SYSTEM ---- */
.screen { display: none; }
.screen.active { display: block; animation: fadeUp .35s ease; }
@keyframes fadeUp {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

.hidden { display: none !important; }

/* =============================================
   AUTH SCREEN
   ============================================= */
.auth-bg {
    position: fixed; inset: 0; z-index: 0;
    background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0,232,122,.12), transparent 70%),
                linear-gradient(160deg, #080d1a 0%, #0b1525 100%);
}
.auth-glow {
    position: absolute; width: 600px; height: 600px;
    top: -200px; left: 50%; transform: translateX(-50%);
    background: radial-gradient(circle, rgba(0,232,122,.08), transparent 70%);
    pointer-events: none;
}
.auth-container {
    position: relative; z-index: 1;
    min-height: 100vh; display: flex;
    align-items: center; justify-content: center;
    padding: 24px;
}
.auth-card {
    background: var(--bg-card);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-xl);
    padding: 44px 40px;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg), 0 0 60px rgba(0,232,122,.06);
}
.auth-logo {
    text-align: center;
    margin-bottom: 32px;
}
.logo-icon { font-size: 2.8rem; margin-bottom: 8px; }
.auth-logo h1 {
    background: linear-gradient(135deg, var(--green), #00ffa3);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 4px;
}
.tagline { color: var(--text-muted); font-size: .95rem; }
.auth-heading {
    text-align: center; margin-bottom: 24px; color: var(--text);
}
.btn-google {
    width: 100%; display: flex; align-items: center; justify-content: center;
    gap: 10px; padding: 12px 20px;
    background: white; color: #1a1a1a;
    border: none; border-radius: var(--radius-md);
    font-family: inherit; font-size: 1rem; font-weight: 600;
    cursor: pointer; transition: var(--transition);
    box-shadow: var(--shadow);
    margin-bottom: 4px;
}
.btn-google:hover { transform: translateY(-2px); box-shadow: var(--shadow-md); }

.divider {
    display: flex; align-items: center; gap: 12px;
    margin: 20px 0; color: var(--text-dim);
    font-size: .9rem;
}
.divider::before, .divider::after {
    content: ''; flex: 1; height: 1px; background: var(--border);
}
.auth-switch {
    text-align: center; margin-top: 20px;
    color: var(--text-muted); font-size: .95rem;
}
.auth-switch a { color: var(--green); font-weight: 600; text-decoration: none; }
.auth-switch a:hover { text-decoration: underline; }
.form-error {
    color: #f87171; font-size: .9rem; text-align: center;
    min-height: 18px; margin-bottom: 8px;
}

/* =============================================
   BUTTONS
   ============================================= */
.btn {
    display: inline-flex; align-items: center; justify-content: center;
    gap: 6px; padding: 10px 22px;
    font-family: inherit; font-size: .95rem; font-weight: 600;
    border: none; border-radius: var(--radius-md);
    cursor: pointer; transition: var(--transition);
    min-height: 42px; text-decoration: none;
    white-space: nowrap;
}
.btn-primary {
    background: linear-gradient(135deg, var(--green), var(--green-dim));
    color: #021a0b;
    box-shadow: 0 0 0 0 var(--green-glow);
}
.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px var(--green-glow), var(--shadow-md);
}
.btn-primary:active { transform: translateY(0); }
.btn-secondary {
    background: transparent;
    border: 1.5px solid var(--border-hi);
    color: var(--text-muted);
}
.btn-secondary:hover {
    border-color: var(--green);
    color: var(--green);
    background: var(--green-glow2);
}
.btn-sm { padding: 7px 14px; font-size: .875rem; min-height: 34px; }
.full-width { width: 100%; }

/* =============================================
   FORMS
   ============================================= */
.form-group { margin-bottom: 16px; }
.form-group label {
    display: block; margin-bottom: 6px;
    font-size: .875rem; font-weight: 600;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
}
input, select, textarea {
    width: 100%;
    background: var(--bg-raised);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    font-family: inherit; font-size: 1rem; color: var(--text);
    transition: var(--transition);
    outline: none;
}
input:focus, select:focus, textarea:focus {
    border-color: var(--green);
    box-shadow: 0 0 0 3px var(--green-glow);
}
input::placeholder, textarea::placeholder { color: var(--text-dim); }
select option { background: var(--bg-raised); }
/* Date input styling */
input[type="date"] { color-scheme: dark; }

textarea { resize: vertical; }
small { color: var(--text-muted); font-size: .85rem; margin-top: 4px; display: block; }
.form-row {
    display: grid; grid-template-columns: 1fr 1fr;
    gap: 12px;
}
@media (max-width: 480px) { .form-row { grid-template-columns: 1fr; } }

/* =============================================
   CONTAINER
   ============================================= */
.container {
    max-width: 1380px; margin: 0 auto;
    padding: 20px 16px;
}
@media (min-width: 768px) { .container { padding: 28px 32px; } }

/* =============================================
   DASHBOARD HEADER
   ============================================= */
.dash-header {
    display: flex; justify-content: space-between; align-items: center;
    flex-wrap: wrap; gap: 12px;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 16px 24px;
    margin-bottom: 20px;
    box-shadow: var(--shadow);
}
.dash-header-left {}
.dash-logo {
    font-size: 1.4rem; font-weight: 800; letter-spacing: -.02em;
    background: linear-gradient(135deg, var(--green), #00ffa3);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text;
    margin-bottom: 2px;
}
.user-welcome { color: var(--text-muted); font-size: .9rem; }
.dash-header-right {
    display: flex; align-items: center; gap: 12px;
}
.streak-pill {
    display: flex; align-items: center; gap: 6px;
    background: var(--bg-raised);
    border: 1.5px solid var(--green);
    border-radius: 99px;
    padding: 6px 16px;
    box-shadow: var(--glow);
}
.streak-fire { font-size: 1.1rem; }
.streak-number { font-size: 1.3rem; font-weight: 800; color: var(--green); font-family: 'JetBrains Mono', monospace; }
.streak-label { font-size: .8rem; color: var(--text-muted); }

/* =============================================
   DAILY FOCUS
   ============================================= */
.daily-focus {
    background: linear-gradient(135deg, rgba(139,92,246,.25), rgba(59,130,246,.15));
    border: 1px solid rgba(139,92,246,.3);
    border-radius: var(--radius-lg);
    padding: 14px 24px;
    margin-bottom: 20px;
    text-align: center;
    font-size: 1rem; font-weight: 500;
    color: #c4b5fd;
}

/* =============================================
   MAIN 2-COLUMN GRID
   ============================================= */
.dash-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 960px) {
    .dash-grid { grid-template-columns: 1fr; }
}

.dash-col-left, .dash-col-right {
    display: flex; flex-direction: column; gap: 20px;
}

/* =============================================
   PANEL (replaces "section")
   ============================================= */
.panel {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px;
    box-shadow: var(--shadow);
    transition: var(--transition);
}
.panel:hover { border-color: var(--border-hi); }

.panel-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 18px; gap: 12px; flex-wrap: wrap;
}
.panel-title {
    font-size: 1.05rem; font-weight: 700;
    color: var(--green); margin: 0;
    display: flex; align-items: center; gap: 6px;
}
.sub-title {
    font-size: .9rem; font-weight: 600;
    color: var(--text-muted); margin-bottom: 12px;
    text-transform: uppercase; letter-spacing: .04em;
}

/* =============================================
   STATS GRID (body composition cards)
   ============================================= */
.stats-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 10px;
    margin-top: 4px;
}
@media (max-width: 1100px) {
    .stats-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 480px) {
    .stats-grid { grid-template-columns: repeat(3, 1fr); }
}

.stat-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 12px;
    transition: var(--transition);
    position: relative; overflow: hidden;
}
.stat-card::after {
    content: ''; position: absolute; bottom: 0; left: 0; right: 0;
    height: 2px;
    background: linear-gradient(90deg, var(--green), transparent);
    opacity: 0; transition: var(--transition);
}
.stat-card:hover { border-color: var(--border-hi); transform: translateY(-2px); }
.stat-card:hover::after { opacity: 1; }

.stat-label {
    font-size: .7rem; font-weight: 700;
    color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em;
    margin-bottom: 6px;
}
.stat-value {
    font-size: 1.3rem; font-weight: 800;
    font-family: 'JetBrains Mono', monospace;
    color: var(--green); line-height: 1;
    margin-bottom: 6px;
}
.stat-trend {
    display: flex; align-items: center; gap: 4px;
    font-size: .75rem; font-weight: 500;
}
.trend-up   { color: #f87171; }
.trend-down { color: var(--green); }
.trend-neutral { color: var(--text-dim); }

/* =============================================
   CALORIES RING
   ============================================= */
.calories-center {
    display: flex; justify-content: center;
    margin-bottom: 24px;
}
.calories-ring-wrap {
    position: relative; width: 140px; height: 140px;
}
.calories-ring {
    width: 100%; height: 100%;
    transform: rotate(-90deg);
}
.ring-bg {
    fill: none; stroke: var(--bg-raised); stroke-width: 10;
}
.ring-fill {
    fill: none; stroke: var(--green); stroke-width: 10;
    stroke-linecap: round;
    transition: stroke-dashoffset .6s cubic-bezier(.4,0,.2,1);
}
.calories-ring-text {
    position: absolute; inset: 0;
    display: flex; flex-direction: column;
    align-items: center; justify-content: center;
    line-height: 1.15;
}
.cal-num {
    font-size: 1.6rem; font-weight: 800; color: var(--green);
    font-family: 'JetBrains Mono', monospace;
}
.cal-sep { font-size: .8rem; color: var(--text-dim); }
.cal-target { font-size: 1rem; font-weight: 700; color: var(--text-muted); font-family: 'JetBrains Mono', monospace; }
.cal-unit { font-size: .7rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-top: 2px; }

/* =============================================
   MACRO ROWS
   ============================================= */
.macro-rows { display: flex; flex-direction: column; gap: 12px; margin-bottom: 20px; }
.macro-row { display: grid; grid-template-columns: 100px 1fr 80px; align-items: center; gap: 10px; }

@media (max-width: 400px) {
    .macro-row { grid-template-columns: 80px 1fr 70px; gap: 6px; }
}

.macro-row-label { display: flex; align-items: center; gap: 7px; font-size: .85rem; font-weight: 600; color: var(--text-muted); }
.macro-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.protein-dot { background: var(--protein-c); }
.carbs-dot   { background: var(--carbs-c); }
.fats-dot    { background: var(--fats-c); }

.macro-bar-track {
    height: 7px; border-radius: 99px;
    background: var(--bg-raised);
    overflow: hidden;
}
.macro-bar-fill {
    height: 100%; border-radius: 99px;
    transition: width .5s cubic-bezier(.4,0,.2,1);
}
.protein-fill { background: var(--protein-c); }
.carbs-fill   { background: var(--carbs-c); }
.fats-fill    { background: var(--fats-c); }

.macro-row-nums {
    font-size: .85rem; text-align: right;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}
.macro-row-nums .muted { font-size: .78rem; color: var(--text-muted); }

.mini-chart-wrap { margin-bottom: 20px; }
.weekly-chart-wrap { margin-bottom: 20px; }

/* =============================================
   FOOD LOG
   ============================================= */
.food-log-section { margin-top: 4px; }
.food-list { display: flex; flex-direction: column; gap: 6px; }
.food-item {
    display: flex; justify-content: space-between; align-items: center;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 10px 14px;
    transition: var(--transition);
    gap: 8px;
}
.food-item:hover { border-color: var(--border-hi); }
.food-item-info { flex: 1; min-width: 0; }
.food-item-name { font-weight: 600; font-size: .95rem; margin-bottom: 2px; truncate: true; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.food-item-macros { font-size: .8rem; color: var(--text-muted); }
.food-item-delete {
    background: none; border: none; cursor: pointer;
    font-size: 1rem; opacity: .4; transition: var(--transition);
    padding: 4px; flex-shrink: 0;
}
.food-item-delete:hover { opacity: 1; transform: scale(1.15); }

.empty-state { text-align: center; padding: 32px 16px; color: var(--text-muted); }
.empty-icon { font-size: 2.5rem; margin-bottom: 8px; opacity: .5; }

/* =============================================
   CHARTS
   ============================================= */
.chart-controls { margin-bottom: 14px; }
.chart-tabs, .time-range-tabs {
    display: flex; flex-wrap: wrap; gap: 6px; margin-bottom: 8px;
}
.chart-tab, .time-tab {
    padding: 5px 12px; font-size: .8rem; font-weight: 600;
    font-family: inherit;
    background: var(--bg-raised);
    border: 1.5px solid var(--border);
    border-radius: 99px; color: var(--text-muted);
    cursor: pointer; transition: var(--transition);
}
.chart-tab:hover, .time-tab:hover {
    border-color: var(--green); color: var(--green);
}
.chart-tab.active, .time-tab.active {
    background: var(--green); border-color: var(--green);
    color: #021a0b; font-weight: 700;
}
.chart-container { height: 220px; }

/* =============================================
   STATS & INSIGHTS (populated by JS)
   ============================================= */
.stats-insights {}
.insight-card {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
}

/* =============================================
   ACHIEVEMENTS
   ============================================= */
.achievements {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
    gap: 10px;
}
.achievement-item {
    background: var(--bg-raised);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px 10px;
    text-align: center;
    transition: var(--transition);
}
.achievement-item.unlocked {
    border-color: rgba(0,232,122,.4);
    background: rgba(0,232,122,.05);
    box-shadow: var(--glow);
}
.achievement-item.locked { opacity: .45; }
.achievement-icon { font-size: 1.8rem; margin-bottom: 6px; }
.achievement-title { font-size: .8rem; font-weight: 700; color: var(--text); margin-bottom: 2px; }
.achievement-desc { font-size: .72rem; color: var(--text-muted); }

/* =============================================
   MODALS
   ============================================= */
.modal {
    display: none; position: fixed; inset: 0; z-index: 1000;
    background: rgba(0,0,0,.75);
    backdrop-filter: blur(8px);
    justify-content: center; align-items: flex-start;
    padding: 40px 16px;
    overflow-y: auto;
}
.modal.active { display: flex; }

.modal-content {
    background: var(--bg-card);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-xl);
    padding: 28px;
    width: 100%; max-width: 540px;
    box-shadow: var(--shadow-lg);
    animation: fadeUp .25s ease;
}
.modal-large { max-width: 640px; }
.modal-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px;
}
.modal-header h2 { color: var(--text); margin: 0; }
.modal-subtitle { color: var(--text-muted); font-size: .9rem; margin-bottom: 20px; }
.close-btn {
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius); color: var(--text-muted);
    width: 32px; height: 32px; font-size: 1.2rem;
    cursor: pointer; transition: var(--transition);
    display: flex; align-items: center; justify-content: center;
}
.close-btn:hover { background: var(--bg-hover); color: var(--text); }

/* Food modal tabs */
.food-input-methods {
    display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap;
}
.method-btn {
    flex: 1; padding: 9px 14px; min-width: 90px;
    font-family: inherit; font-size: .9rem; font-weight: 600;
    background: var(--bg-raised); border: 1.5px solid var(--border);
    border-radius: var(--radius-md); color: var(--text-muted);
    cursor: pointer; transition: var(--transition);
}
.method-btn:hover { border-color: var(--green); color: var(--green); }
.method-btn.active { background: var(--green); border-color: var(--green); color: #021a0b; }
.food-method { display: none; }
.food-method.active { display: block; }
.food-search-results { max-height: 320px; overflow-y: auto; }
.food-result-item {
    padding: 12px 14px;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    border: 1px solid transparent;
}
.food-result-item:hover {
    background: var(--bg-raised); border-color: var(--border-hi);
}
.food-result-name { font-weight: 600; margin-bottom: 2px; }
.food-result-macros { font-size: .82rem; color: var(--text-muted); }

.parsed-result {
    margin-top: 16px;
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 16px;
}

/* =============================================
   ONBOARDING
   ============================================= */
.onboarding-container {
    min-height: 100vh;
    display: flex; align-items: center; justify-content: center;
    padding: 24px;
    background: radial-gradient(ellipse 80% 60% at 50% -10%, rgba(0,232,122,.1), transparent 70%),
                var(--bg);
}
.onboarding-card {
    background: var(--bg-card);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-xl);
    padding: 40px 36px;
    width: 100%; max-width: 600px;
    box-shadow: var(--shadow-lg);
}
.onboarding-header { text-align: center; margin-bottom: 28px; }
.onboarding-header h1 {
    background: linear-gradient(135deg, var(--green), #00ffa3);
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    background-clip: text; margin-bottom: 6px;
}
.onboarding-header .tagline { color: var(--text-muted); }

/* Step dots */
.step-indicator {
    display: flex; justify-content: center; gap: 10px;
    margin-bottom: 28px;
}
.step-dot {
    width: 10px; height: 10px; border-radius: 50%;
    background: var(--bg-hover);
    border: 2px solid var(--border-hi);
    transition: var(--transition);
}
.step-dot.active {
    background: var(--green); border-color: var(--green);
    box-shadow: 0 0 8px var(--green-glow);
}
.step-dot.completed { background: var(--green-dim); border-color: var(--green-dim); }

.onboarding-step { display: none; }
.onboarding-step.active { display: block; animation: fadeUp .25s ease; }
.onboarding-step h2 { margin-bottom: 20px; color: var(--text); }

/* Goal cards */
.goal-options {
    display: grid; grid-template-columns: repeat(4, 1fr);
    gap: 10px; margin-bottom: 16px;
}
@media (max-width: 560px) { .goal-options { grid-template-columns: repeat(2, 1fr); } }

.goal-card {
    background: var(--bg-raised);
    border: 2px solid transparent;
    border-radius: var(--radius-md);
    padding: 18px 10px; text-align: center;
    cursor: pointer; transition: var(--transition);
    min-height: 120px;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
}
.goal-card:hover { border-color: var(--green); transform: translateY(-3px); box-shadow: var(--glow); }
.goal-card.selected { background: rgba(0,232,122,.12); border-color: var(--green); }
.goal-icon { font-size: 2rem; margin-bottom: 8px; }
.goal-title { font-weight: 700; font-size: .9rem; margin-bottom: 3px; }
.goal-desc { font-size: .78rem; color: var(--text-muted); }
.goal-card.selected .goal-desc { color: rgba(255,255,255,.7); }

/* Radio / Checkbox */
.radio-group, .checkbox-group { display: flex; flex-direction: column; gap: 8px; }
.radio-option, .checkbox-option {
    display: flex; align-items: center;
    padding: 12px 14px;
    background: var(--bg-raised);
    border: 1.5px solid transparent;
    border-radius: var(--radius-md);
    cursor: pointer; transition: var(--transition);
}
.radio-option:hover, .checkbox-option:hover { border-color: rgba(0,232,122,.3); background: rgba(0,232,122,.05); }
.radio-option input[type="radio"], .checkbox-option input[type="checkbox"] { position: absolute; opacity: 0; width: 0; height: 0; }
.radio-circle, .checkbox-custom {
    width: 20px; height: 20px; min-width: 20px;
    border: 2px solid var(--text-muted); border-radius: 50%;
    margin-right: 12px; background: var(--bg);
    position: relative; transition: var(--transition);
}
.checkbox-custom { border-radius: var(--radius-sm); }
.radio-circle::after {
    content: ''; position: absolute; top: 50%; left: 50%;
    width: 8px; height: 8px; background: white; border-radius: 50%;
    transform: translate(-50%, -50%) scale(0); opacity: 0; transition: var(--transition);
}
.checkbox-custom::after {
    content: ''; position: absolute; left: 5px; top: 2px;
    width: 6px; height: 11px; border: solid white; border-width: 0 2px 2px 0;
    transform: scale(0) rotate(45deg); opacity: 0; transition: var(--transition);
}
.radio-option input:checked ~ .radio-circle, .checkbox-option input:checked ~ .checkbox-custom {
    background: var(--green); border-color: var(--green);
}
.radio-option input:checked ~ .radio-circle::after,
.checkbox-option input:checked ~ .checkbox-custom::after { opacity: 1; transform: translate(-50%,-50%) scale(1); }
.checkbox-option input:checked ~ .checkbox-custom::after { transform: scale(1) rotate(45deg); }
.radio-label, .checkbox-label { flex: 1; color: var(--text); }
.radio-option:has(input:checked), .checkbox-option:has(input:checked) {
    border-color: var(--green); background: rgba(0,232,122,.08);
}

.btn-group { display: flex; gap: 12px; margin-top: 24px; }
@media (max-width: 480px) { .btn-group { flex-direction: column; } }
.btn-group .btn, .btn-next { flex: 1; }

/* Review sections */
.review-section {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px; margin-bottom: 12px;
}
.review-section h3 { color: var(--green); margin-bottom: 8px; }
.review-section p { margin: 4px 0; font-size: .95rem; color: var(--text-secondary); }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 8px; }
::-webkit-scrollbar-track { background: var(--bg-card); }
::-webkit-scrollbar-thumb { background: var(--bg-hover); border-radius: 4px; }
::-webkit-scrollbar-thumb:hover { background: var(--green-dim); }

/* =============================================
   NOTIFICATION
   ============================================= */
.notification {
    position: fixed; top: 20px; right: 20px; z-index: 9999;
    padding: 12px 22px; border-radius: var(--radius-md);
    font-weight: 600; font-size: .95rem;
    box-shadow: var(--shadow-md);
    animation: slideIn .3s ease;
}
.notification-success { background: var(--green); color: #021a0b; }
.notification-error   { background: #ef4444; color: white; }
.notification-info    { background: var(--blue); color: white; }
.notification-warning { background: var(--orange); color: white; }
@keyframes slideIn {
    from { transform: translateX(120%); opacity: 0; }
    to   { transform: translateX(0);    opacity: 1; }
}

/* =============================================
   ACCESSIBILITY
   ============================================= */
*:focus-visible {
    outline: 2px solid var(--green); outline-offset: 2px;
}
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}

/* =============================================
   LOADING SPINNER
   ============================================= */
.loading {
    width: 24px; height: 24px; border-radius: 50%;
    border: 3px solid var(--bg-raised); border-top-color: var(--green);
    animation: spin .7s linear infinite;
    display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   MISC UTILITIES
   ============================================= */
.section-title { color: var(--green); }
/* backward compat for dashboard.js generated HTML */
.section {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius-lg);
    padding: 22px; margin-bottom: 0;
}

/* Nutrition overview (legacy compat) */
.nutrition-card { background: var(--bg-raised); padding: 14px; border-radius: var(--radius-md); }
.nutrition-label { font-size: .75rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.nutrition-value { font-size: 1.4rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; color: var(--green); }

/* Macro card compat */
.macro-card { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; }
.macro-label { font-size: .75rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .06em; margin-bottom: 6px; }
.macro-values { display: flex; justify-content: space-between; font-size: .8rem; color: var(--text-muted); margin-top: 4px; }
.macro-bar { height: 7px; border-radius: 99px; background: var(--bg-hover); overflow: hidden; margin-top: 8px; }
.nutrition-grid { display: grid; grid-template-columns: repeat(3,1fr); gap: 10px; margin-bottom: 16px; }

/* food-tracker compat */
.food-log {}

/* day-details (not used anymore but keep for compat) */
.day-details { background: var(--bg-raised); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px; margin-top: 12px; }

/* =============================================
   WORKOUT TRACKER
   ============================================= */

/* --- Panel loading --- */
.wm-loading {
    display: flex; justify-content: center; padding: 28px 0;
}

/* --- Workout history list (dashboard panel) --- */
.w-list { display: flex; flex-direction: column; gap: 8px; }

.w-item {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 12px 14px;
    cursor: pointer; transition: var(--transition);
}
.w-item:hover { border-color: var(--border-hi); background: var(--bg-hover); }

.w-item-top {
    display: flex; align-items: center; gap: 10px; margin-bottom: 5px;
}
.w-item-date {
    font-weight: 700; font-size: .95rem; color: var(--green);
    font-family: 'JetBrains Mono', monospace;
}
.w-item-name {
    font-size: .85rem; color: var(--text-muted);
    background: var(--bg-hover); padding: 2px 8px; border-radius: 99px;
}
.w-item-meta {
    display: flex; gap: 14px; font-size: .8rem; color: var(--text-muted);
    margin-bottom: 8px; flex-wrap: wrap;
}
.w-tags { display: flex; flex-wrap: wrap; gap: 5px; }
.w-tag {
    font-size: .75rem; font-weight: 600;
    border: 1.5px solid; border-radius: 99px;
    padding: 2px 9px; white-space: nowrap;
}
.w-tag-more {
    font-size: .75rem; color: var(--text-muted);
    padding: 2px 6px;
}

/* --- Workout modal body --- */
.wm-body { /* scrollable via modal-content overflow */ }

/* Exercise blocks */
.wm-ex-block {
    background: var(--bg-raised);
    border: 1px solid var(--border);
    border-radius: var(--radius-md);
    padding: 14px;
    margin-bottom: 10px;
    transition: var(--transition);
}
.wm-ex-block:hover { border-color: var(--border-hi); }

.wm-ex-hdr {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 10px;
}
.wm-ex-title {
    display: flex; align-items: center; gap: 8px; flex-wrap: wrap;
}
.wm-dot {
    width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.wm-dot-sm {
    width: 7px; height: 7px; border-radius: 50%; flex-shrink: 0; display: inline-block;
}
.wm-e1rm-badge {
    font-size: .75rem; font-weight: 700;
    color: var(--green); background: var(--green-glow2);
    border: 1px solid rgba(0,232,122,.2);
    padding: 2px 8px; border-radius: 99px;
    font-family: 'JetBrains Mono', monospace;
}
.wm-ex-del {
    background: none; border: none; cursor: pointer;
    font-size: 1rem; opacity: .4; transition: var(--transition);
    padding: 4px; flex-shrink: 0;
}
.wm-ex-del:hover { opacity: 1; transform: scale(1.15); }

/* Sets */
.wm-sets { display: flex; flex-direction: column; gap: 6px; margin-bottom: 10px; }
.wm-set-row {
    display: grid;
    grid-template-columns: 24px 1fr 16px 1fr 28px;
    align-items: center; gap: 6px;
}
.wm-set-num {
    font-size: .8rem; font-weight: 700; color: var(--text-dim);
    font-family: 'JetBrains Mono', monospace; text-align: center;
}
.wm-set-inp {
    /* override full-width from base */
    width: 100%; padding: 7px 10px; font-size: .9rem;
    text-align: center;
}
.wm-x { text-align: center; color: var(--text-dim); font-weight: 700; }
.wm-set-del {
    background: none; border: none; cursor: pointer;
    color: var(--text-dim); font-size: 1.1rem; line-height: 1;
    transition: var(--transition); padding: 2px;
}
.wm-set-del:hover { color: #f87171; }
.wm-add-set { font-size: .82rem; margin-top: 4px; }

/* Exercise adder / search */
.wm-adder {
    margin-top: 12px;
    background: var(--bg-raised);
    border: 1.5px solid var(--border);
    border-radius: var(--radius-md);
    overflow: hidden;
}
.wm-adder input {
    border: none; border-radius: 0;
    background: transparent;
    border-bottom: 1px solid var(--border);
    padding: 11px 14px; font-size: .95rem;
}
.wm-adder input:focus { box-shadow: none; border-color: var(--green); }

.wm-results { max-height: 260px; overflow-y: auto; }
.wm-cat-label {
    padding: 6px 14px 2px; font-size: .72rem; font-weight: 700;
    text-transform: uppercase; letter-spacing: .06em;
}
.wm-ex-item {
    display: flex; align-items: center; gap: 8px;
    padding: 9px 14px; cursor: pointer; font-size: .9rem;
    transition: var(--transition);
}
.wm-ex-item:hover { background: var(--bg-hover); }
.wm-ex-done { opacity: .45; cursor: default; }
.wm-check {
    margin-left: auto; color: var(--green);
    font-weight: 700; font-size: .85rem;
}
.wm-hint, .wm-custom {
    padding: 10px 14px; font-size: .85rem; color: var(--text-muted);
    text-align: center;
}
.wm-custom { cursor: pointer; color: var(--green); }
.wm-custom:hover { background: var(--bg-hover); }

/* --- Workout detail modal --- */
.wd-info-block { margin-bottom: 16px; }
.wd-date {
    font-size: .85rem; color: var(--text-muted);
    text-transform: capitalize; margin-bottom: 4px;
}
.wd-name {
    font-size: 1.15rem; font-weight: 700; margin-bottom: 6px;
}
.wd-summary {
    display: flex; gap: 14px; font-size: .85rem; color: var(--text-muted);
    flex-wrap: wrap;
}

.wd-ex {
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 12px 14px; margin-bottom: 8px;
}
.wd-ex-hdr {
    display: flex; align-items: center; gap: 8px; margin-bottom: 8px;
}
.wd-sets { display: flex; flex-wrap: wrap; gap: 6px; }
.wd-set {
    background: var(--bg-hover); border-radius: var(--radius-sm);
    padding: 4px 10px; font-size: .82rem; font-weight: 600;
    font-family: 'JetBrains Mono', monospace; color: var(--text-secondary);
}
.wd-notes {
    background: rgba(139,92,246,.1); border: 1px solid rgba(139,92,246,.2);
    border-radius: var(--radius-md); padding: 10px 14px;
    font-size: .9rem; color: #c4b5fd; margin-top: 12px;
}

/* --- Progress modal --- */
.progress-alert {
    padding: 12px 16px; border-radius: var(--radius-md);
    font-size: .9rem; font-weight: 600; margin-bottom: 16px;
    line-height: 1.45;
}
.progress-alert.success { background: rgba(0,232,122,.1); border: 1px solid rgba(0,232,122,.25); color: #6ee7b7; }
.progress-alert.warning { background: rgba(251,191,36,.1);  border: 1px solid rgba(251,191,36,.25); color: #fde68a; }
.progress-alert.error   { background: rgba(248,113,113,.1); border: 1px solid rgba(248,113,113,.25); color: #fca5a5; }
.progress-alert.info    { background: rgba(59,130,246,.1);  border: 1px solid rgba(59,130,246,.25);  color: #93c5fd; }

.wp-stat-row {
    display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 20px;
}
@media (max-width: 480px) { .wp-stat-row { grid-template-columns: repeat(2,1fr); } }

.wp-stat {
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 12px 10px; text-align: center;
}
.wp-stat-l { font-size: .72rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 4px; }
.wp-stat-v { font-size: 1.1rem; font-weight: 800; color: var(--text); font-family: 'JetBrains Mono', monospace; }
.wp-stat-v.gold { color: #fbbf24; }

.wp-chart-lbl {
    font-size: .8rem; font-weight: 700; color: var(--text-muted);
    text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px;
}

/* =============================================
   FOOD TRACKER — IMPROVED
   ============================================= */

/* Food search results */
.food-search-results {
    max-height: 360px; overflow-y: auto;
}
.db-section-label {
    padding: 8px 14px 4px;
    font-size: .72rem; font-weight: 700; color: var(--text-dim);
    text-transform: uppercase; letter-spacing: .05em;
}
.db-no-results {
    text-align: center; padding: 28px 16px; color: var(--text-muted);
}
.db-hint { font-size: .85rem; color: var(--text-dim); margin-top: 4px; }

.food-result-item {
    display: flex; justify-content: space-between; align-items: center;
    padding: 10px 14px; cursor: pointer;
    border-radius: var(--radius-md);
    transition: var(--transition);
    gap: 10px;
}
.food-result-item:hover { background: var(--bg-raised); }
.food-result-left { flex: 1; min-width: 0; }
.food-result-name { font-weight: 600; font-size: .9rem; }
.food-result-cat  { font-size: .75rem; color: var(--text-muted); margin-top: 1px; }
.food-result-right { text-align: right; flex-shrink: 0; }
.food-result-cal  { font-weight: 700; font-size: .9rem; color: var(--green); font-family: 'JetBrains Mono', monospace; }
.food-result-macros { font-size: .72rem; color: var(--text-dim); margin-top: 1px; }

/* Meal groups on dashboard */
.meal-group { margin-bottom: 14px; }
.meal-group-hdr {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px; padding: 0 2px;
}
.meal-group-label { font-size: .8rem; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em; }
.meal-group-cal   { font-size: .85rem; font-weight: 700; color: var(--green); font-family: 'JetBrains Mono', monospace; }

/* AI parse results */
.parse-results { display: flex; flex-direction: column; gap: 8px; margin-bottom: 4px; }
.parse-item {
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 10px 14px;
}
.parse-item-name   { font-weight: 600; margin-bottom: 2px; }
.parse-item-macros { font-size: .82rem; color: var(--text-muted); }

/* =============================================
   PORTION PICKER OVERLAY
   ============================================= */
.portion-overlay {
    position: fixed; inset: 0; z-index: 2000;
    background: rgba(0,0,0,.8); backdrop-filter: blur(8px);
    display: flex; align-items: center; justify-content: center;
    padding: 20px;
}
.portion-card {
    background: var(--bg-card);
    border: 1px solid var(--border-hi);
    border-radius: var(--radius-xl);
    padding: 24px;
    width: 100%; max-width: 420px;
    box-shadow: var(--shadow-lg);
    animation: fadeUp .2s ease;
}
.portion-header {
    display: flex; justify-content: space-between; align-items: center;
    margin-bottom: 6px; font-size: 1.05rem;
}
.portion-per100 {
    font-size: .8rem; color: var(--text-muted);
    margin-bottom: 14px;
}

/* Quick gram buttons */
.portion-quick-btns { display: flex; gap: 6px; margin-bottom: 14px; flex-wrap: wrap; }
.pq-btn {
    flex: 1; min-width: 50px;
    padding: 7px 10px; font-size: .85rem; font-weight: 700;
    font-family: inherit;
    background: var(--bg-raised); border: 1.5px solid var(--border);
    border-radius: var(--radius-md); color: var(--text-muted);
    cursor: pointer; transition: var(--transition);
}
.pq-btn:hover { border-color: var(--green); color: var(--green); }

/* Slider */
.portion-slider-wrap { margin-bottom: 14px; }
.portion-slider-wrap label {
    display: block; font-size: .8rem; font-weight: 700;
    color: var(--text-muted); text-transform: uppercase; letter-spacing: .04em;
    margin-bottom: 8px;
}
.portion-slider-row { display: flex; align-items: center; gap: 10px; }
.portion-slider-row input[type="range"] {
    flex: 1; height: 5px; padding: 0; border: none;
    background: var(--bg-raised); border-radius: 99px;
    accent-color: var(--green);
    box-shadow: none;
}
.portion-slider-row input[type="range"]:focus { box-shadow: none; }
.portion-grams-inp {
    width: 72px; text-align: center; font-size: 1rem; font-weight: 700;
    padding: 7px 10px; flex-shrink: 0;
    font-family: 'JetBrains Mono', monospace;
}
.portion-g-label { font-size: .9rem; color: var(--text-muted); flex-shrink: 0; }

/* Live preview */
.portion-preview {
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 14px;
    text-align: center; margin-bottom: 4px;
}
.pp-cal {
    font-size: 1.8rem; font-weight: 800; color: var(--green);
    font-family: 'JetBrains Mono', monospace; margin-bottom: 6px;
}
.pp-macros { display: flex; justify-content: center; gap: 14px; font-size: .9rem; font-weight: 600; }
.pp-p { color: var(--protein-c); }
.pp-s { color: var(--carbs-c); }
.pp-r { color: var(--fats-c); }

/* =============================================
   ANALYTICS — 4 features
   ============================================= */

/* --- 1. Nädalane kaloriaruanne --- */
.wcr-summary {
    display: flex; justify-content: space-between; align-items: baseline;
    margin-bottom: 16px; flex-wrap: wrap; gap: 6px;
}
.wcr-avg  { font-size: .9rem; color: var(--text-muted); }
.wcr-delta { font-size: .9rem; font-weight: 800; font-family: 'JetBrains Mono', monospace; }
.wcr-goal-badge {
    font-size: .75rem; font-weight: 700; color: var(--text-dim);
    background: var(--bg-raised); border: 1px solid var(--border);
    padding: 3px 10px; border-radius: 99px;
}

.wcr-bars {
    display: grid; grid-template-columns: repeat(7, 1fr);
    gap: 6px; height: 130px; align-items: end;
    margin-bottom: 10px;
}
.wcr-bar-col {
    display: flex; flex-direction: column; align-items: center; gap: 4px; height: 100%;
}
.wcr-bar-val {
    font-size: .7rem; font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}
.wcr-bar-wrap {
    flex: 1; width: 100%; position: relative; background: var(--bg-raised);
    border-radius: var(--radius-sm); overflow: visible;
    display: flex; align-items: flex-end;
}
.wcr-bar-fill {
    width: 100%; border-radius: var(--radius-sm);
    transition: height .4s cubic-bezier(.4,0,.2,1);
    min-height: 2px;
}
.wcr-bar-empty { width: 100%; height: 3px; background: var(--border); border-radius: 2px; }
.wcr-goal-tick {
    position: absolute; left: -3px; right: -3px; height: 2px;
    background: rgba(255,255,255,.18); border-radius: 1px;
}
.wcr-bar-label {
    font-size: .72rem; color: var(--text-dim); text-align: center;
}
.wcr-bar-delta {
    font-size: .68rem; font-weight: 700;
    font-family: 'JetBrains Mono', monospace;
    white-space: nowrap;
}

.wcr-legend {
    display: flex; gap: 14px; flex-wrap: wrap; justify-content: center;
    margin-top: 8px;
}
.wcr-leg-item { display: flex; align-items: center; gap: 5px; font-size: .75rem; color: var(--text-dim); }
.wcr-dot { width: 8px; height: 8px; border-radius: 50%; }

/* --- 2. Weight MA — no extra CSS needed (chart does it) --- */

/* --- 3. Treeningu mahu kokkuvõte --- */
.wvs-stats {
    display: grid; grid-template-columns: repeat(4,1fr); gap: 8px; margin-bottom: 14px;
}
.wvs-stat {
    background: var(--bg-raised); border: 1px solid var(--border);
    border-radius: var(--radius-md); padding: 10px 8px; text-align: center;
}
.wvs-stat-v {
    font-size: 1.25rem; font-weight: 800; color: var(--green);
    font-family: 'JetBrains Mono', monospace;
}
.wvs-stat-l { font-size: .72rem; color: var(--text-dim); margin-top: 2px; text-transform: uppercase; letter-spacing: .03em; }

/* Mini daily bar chart */
.wvs-mini-bars {
    display: grid; grid-template-columns: repeat(7,1fr);
    gap: 4px; height: 70px; align-items: end; margin-bottom: 14px;
}
.wvs-mini-col { display: flex; flex-direction: column; align-items: center; gap: 3px; height: 100%; }
.wvs-mini-bar {
    width: 100%; border-radius: 3px 3px 0 0;
    min-height: 2px; transition: height .3s ease;
}
.wvs-mini-lbl { font-size: .65rem; color: var(--text-dim); }

/* Muscle group bars */
.wvs-groups { margin-top: 4px; }
.wvs-groups-title { font-size: .72rem; font-weight: 700; color: var(--text-dim); text-transform: uppercase; letter-spacing: .04em; margin-bottom: 8px; }
.wvs-group-row {
    display: grid; grid-template-columns: 90px 1fr 32px;
    align-items: center; gap: 8px; margin-bottom: 6px;
}
.wvs-group-name { font-size: .82rem; font-weight: 600; }
.wvs-group-bar-wrap {
    height: 8px; background: var(--bg-raised); border-radius: 99px; overflow: hidden;
}
.wvs-group-bar-fill {
    height: 100%; border-radius: 99px;
    transition: width .5s cubic-bezier(.4,0,.2,1);
}
.wvs-group-count { font-size: .78rem; font-weight: 700; color: var(--text-muted); text-align: right; }

/* --- 4. Toidu korduse hoiatus --- */
.fva-card {
    display: flex; gap: 12px; align-items: flex-start;
    padding: 14px 16px; border-radius: var(--radius-md);
    margin-bottom: 8px;
    border: 1px solid;
    animation: fadeUp .3s ease;
}
.fva-warning {
    background: rgba(251,191,36,.08); border-color: rgba(251,191,36,.25);
}
.fva-ok {
    background: rgba(0,232,122,.08); border-color: rgba(0,232,122,.25);
}
.fva-icon { font-size: 1.5rem; flex-shrink: 0; }
.fva-title { font-weight: 700; margin-bottom: 4px; font-size: .95rem; }
.fva-warning .fva-title { color: #fde68a; }
.fva-ok      .fva-title { color: #6ee7b7; }
.fva-msg { font-size: .87rem; color: var(--text-secondary); line-height: 1.5; }