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

:root {
    /* ── Core backgrounds ── */
    --bg-main:       #07090f;
    --bg-sidebar:    #050709;
    --bg-card:       rgba(255, 255, 255, 0.035);
    --bg-card-solid: #0d1018;
    --bg-card-hover: rgba(255, 255, 255, 0.055);
    --bg-input:      rgba(255, 255, 255, 0.05);
    --bg-hover:      rgba(255, 255, 255, 0.04);

    /* keep legacy aliases */
    --bg-primary:    var(--bg-main);
    --bg-secondary:  var(--bg-sidebar);

    /* ── Borders ── */
    --border:        rgba(255, 255, 255, 0.07);
    --border-light:  rgba(255, 255, 255, 0.13);

    /* ── Text ── */
    --text-primary:   #eef0ff;
    --text-secondary: #8892aa;
    --text-muted:     #464d62;
    --text-inverse:   #07090f;

    /* ── Accent (indigo → violet) ── */
    --accent:        #6366f1;
    --accent-hover:  #818cf8;
    --accent-soft:   rgba(99, 102, 241, 0.12);
    --accent-glow:   rgba(99, 102, 241, 0.3);
    --accent-green:  #34d399;
    --accent-grad:   linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);

    /* ── Discipline colors ── */
    --swim:       #38bdf8;
    --swim-bg:    rgba(56, 189, 248, 0.1);
    --bike:       #a78bfa;
    --bike-bg:    rgba(167, 139, 250, 0.1);
    --run:        #34d399;
    --run-bg:     rgba(52, 211, 153, 0.1);
    --strength:   #fb923c;
    --strength-bg: rgba(251, 146, 60, 0.1);

    /* ── Semantic ── */
    --success: #34d399;
    --warning: #fbbf24;
    --danger:  #f87171;
    --info:    #38bdf8;

    /* ── RPE gradient ── */
    --rpe-low:  #34d399;
    --rpe-mid:  #fbbf24;
    --rpe-high: #f87171;

    /* ── Layout ── */
    --sidebar-width:    230px;
    --topbar-height:    58px;
    --bottomnav-height: 64px;
    --radius:    16px;
    --radius-sm:  9px;
    --radius-lg: 24px;

    /* ── Glass effect ── */
    --glass-bg:     rgba(255, 255, 255, 0.035);
    --glass-border: rgba(255, 255, 255, 0.07);
    --glass-blur:   blur(20px);
    --glass-inset:  inset 0 1px 0 rgba(255, 255, 255, 0.06);
    --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.35);

    /* ── Transitions ── */
    --transition:      0.2s ease;
    --transition-slow: 0.35s ease;
}

/* ── Light theme ── */
:root[data-theme="light"] {
    --bg-main:       #f2f4f8;
    --bg-sidebar:    #ffffff;
    --bg-card:       rgba(255, 255, 255, 0.9);
    --bg-card-solid: #ffffff;
    --bg-card-hover: #f7f8fc;
    --bg-input:      #f0f2f7;
    --bg-hover:      rgba(0, 0, 0, 0.03);
    --border:        rgba(0, 0, 0, 0.07);
    --border-light:  rgba(0, 0, 0, 0.12);
    --text-primary:  #111420;
    --text-secondary:#4a5268;
    --text-muted:    #9098b0;
    --text-inverse:  #ffffff;
    --glass-bg:      rgba(255, 255, 255, 0.85);
    --glass-border:  rgba(0, 0, 0, 0.07);
    --glass-shadow:  0 8px 32px rgba(0, 0, 0, 0.1);
    --glass-inset:   inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

/* ===== SVG ICON DEFAULTS ===== */
svg[aria-hidden="true"] { flex-shrink: 0; pointer-events: none; }

/* ===== TYPOGRAPHY ===== */
html { font-size: 15px; }

body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--bg-main);
    color: var(--text-primary);
    line-height: 1.5;
    overflow-x: hidden;
    overflow-wrap: break-word;
    min-height: 100vh;
    min-height: 100dvh;
    transition: background-color 0.3s ease, color 0.3s ease;
    font-feature-settings: 'cv02', 'cv03', 'cv04', 'cv11';
    -webkit-font-smoothing: antialiased;
}

img, canvas, svg { max-width: 100%; }

a { color: var(--accent); text-decoration: none; }
a:hover { color: var(--accent-hover); }

/* ===== SIDEBAR ===== */
.sidebar {
    position: fixed;
    top: 0; left: 0;
    width: var(--sidebar-width);
    height: 100vh;
    height: 100dvh;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    z-index: 100;
    transition: transform var(--transition-slow);
}

.sidebar-header {
    padding: 22px 18px 18px;
    border-bottom: 1px solid var(--border);
}

.logo {
    display: flex;
    align-items: center;
    gap: 10px;
}

.logo-icon {
    width: 32px;
    height: 32px;
    border-radius: 9px;
    background: var(--accent-grad);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1rem;
    color: white;
    flex-shrink: 0;
    box-shadow: 0 4px 12px var(--accent-glow);
}

.logo-text {
    font-size: 1.05rem;
    font-weight: 700;
    letter-spacing: -0.4px;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
}

.nav-links {
    list-style: none;
    padding: 10px 10px;
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.nav-link {
    display: flex;
    align-items: center;
    gap: 11px;
    padding: 9px 12px;
    border-radius: 11px;
    color: var(--text-muted);
    font-size: 0.875rem;
    font-weight: 500;
    transition: all var(--transition);
    position: relative;
}

.nav-link:hover {
    background: rgba(255, 255, 255, 0.04);
    color: var(--text-secondary);
}

.nav-link.active {
    background: var(--accent-soft);
    color: var(--accent-hover);
}

.nav-link.active::before {
    content: '';
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 0 3px 3px 0;
    background: var(--accent-grad);
}

.nav-icon {
    font-size: 1.05rem;
    width: 20px;
    text-align: center;
    opacity: 0.8;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.nav-icon svg { display: block; }

.sidebar-footer {
    padding: 14px 18px;
    border-top: 1px solid var(--border);
}

.race-countdown {
    text-align: center;
    font-size: 0.72rem;
    color: var(--text-muted);
    line-height: 1.7;
    letter-spacing: 0.2px;
}

.race-countdown .countdown-number {
    font-size: 1.8rem;
    font-weight: 800;
    letter-spacing: -1px;
    background: var(--accent-grad);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    display: block;
}

/* ===== TOP BAR ===== */
.main-content {
    margin-left: var(--sidebar-width);
    min-height: 100vh;
    min-height: 100dvh;
}

.top-bar {
    position: sticky;
    top: 0;
    height: var(--topbar-height);
    background: rgba(7, 9, 15, 0.75);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--border);
    display: flex;
    align-items: center;
    padding: 0 24px;
    gap: 14px;
    z-index: 50;
}

:root[data-theme="light"] .top-bar {
    background: rgba(242, 244, 248, 0.85);
}

.page-title {
    font-size: 1.05rem;
    font-weight: 600;
    letter-spacing: -0.3px;
    flex: 1;
}

.theme-toggle {
    background: var(--glass-bg);
    border: 1px solid var(--border);
    border-radius: 50%;
    width: 36px;
    height: 36px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    transition: all var(--transition);
    flex-shrink: 0;
    backdrop-filter: var(--glass-blur);
    color: var(--text-secondary);
}
.theme-toggle svg { display: block; }
.theme-toggle:hover {
    border-color: var(--accent);
    box-shadow: 0 0 12px var(--accent-glow);
}

.menu-toggle {
    display: none;
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 1.3rem;
    cursor: pointer;
    padding: 4px;
}
.menu-toggle svg { display: block; }

.page-container {
    padding: 24px;
    max-width: 1200px;
}

/* ===== BOTTOM NAV (Mobile) ===== */
.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0; left: 0; right: 0;
    height: calc(var(--bottomnav-height) + env(safe-area-inset-bottom, 0px));
    padding-bottom: env(safe-area-inset-bottom, 0px);
    background: rgba(5, 7, 9, 0.85);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid var(--border);
    grid-template-columns: 1fr 1fr auto 1fr 1fr;
    align-items: center;
    justify-items: center;
    padding-left: 8px;
    padding-right: 8px;
    z-index: 100;
}

:root[data-theme="light"] .bottom-nav {
    background: rgba(255, 255, 255, 0.92);
}

.bottom-nav-link {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--text-muted);
    font-size: 0.65rem;
    font-weight: 500;
    padding: 6px 12px;
    border-radius: 12px;
    transition: all var(--transition);
    letter-spacing: 0.3px;
    min-width: 56px;
    text-decoration: none;
}

.bottom-nav-link.active {
    color: var(--accent-hover);
}

.bottom-nav-link.active .bottom-icon {
    filter: drop-shadow(0 0 6px var(--accent-glow));
}

.bottom-icon {
    font-size: 1.25rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.bottom-icon svg { display: block; }

/* Center logo button (AI Coach trigger) */
.bottom-nav-center {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    border-radius: 16px;
    background: var(--accent-grad);
    border: none;
    cursor: pointer;
    position: relative;
    top: -2px;
    box-shadow: 0 4px 18px rgba(99, 102, 241, 0.45), inset 0 1px 0 rgba(255, 255, 255, 0.2);
    transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1), box-shadow 0.2s;
    flex-shrink: 0;
    margin: 0 12px;
}

.bottom-nav-center:hover {
    transform: scale(1.08) translateY(-2px);
    box-shadow: 0 6px 24px rgba(99, 102, 241, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.2);
}

.bottom-nav-center:active {
    transform: scale(0.95);
}

.bottom-nav-logo {
    color: white;
    font-size: 1.2rem;
    font-weight: 800;
    line-height: 1;
}

/* ===== BUTTONS ===== */
.btn-primary {
    background: var(--accent-grad);
    color: #fff;
    border: none;
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    box-shadow: 0 2px 12px rgba(99, 102, 241, 0.35);
    font-family: inherit;
    letter-spacing: -0.1px;
}
.btn-primary:hover {
    box-shadow: 0 4px 20px rgba(99, 102, 241, 0.55);
    transform: translateY(-1px);
}
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
    background: var(--glass-bg);
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    backdrop-filter: var(--glass-blur);
    font-family: inherit;
}
.btn-secondary:hover {
    background: var(--bg-card-hover);
    color: var(--text-primary);
    border-color: var(--border-light);
}

.btn-danger {
    background: rgba(248, 113, 113, 0.12);
    color: var(--danger);
    border: 1px solid rgba(248, 113, 113, 0.2);
    padding: 9px 20px;
    border-radius: var(--radius-sm);
    font-size: 0.875rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-danger:hover {
    background: rgba(248, 113, 113, 0.2);
    border-color: rgba(248, 113, 113, 0.4);
}

.btn-sm { padding: 6px 14px; font-size: 0.8rem; }

.btn-icon {
    background: none;
    border: none;
    color: var(--text-secondary);
    cursor: pointer;
    padding: 5px 8px;
    border-radius: var(--radius-sm);
    transition: all var(--transition);
}
.btn-icon:hover { background: var(--bg-hover); color: var(--text-primary); }

.quick-add-btn { white-space: nowrap; }

/* ===== CARDS ===== */
.card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 20px;
    box-shadow: var(--glass-shadow), var(--glass-inset);
    transition: box-shadow var(--transition), transform var(--transition);
}

.card:hover {
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.4), var(--glass-inset);
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 16px;
}

.card-title {
    font-size: 0.72rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.8px;
    color: var(--text-muted);
}

/* ===== KPI CARDS ===== */
.kpi-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(148px, 1fr));
    gap: 12px;
    margin-bottom: 20px;
}

.kpi-card {
    background: var(--glass-bg);
    backdrop-filter: var(--glass-blur);
    -webkit-backdrop-filter: var(--glass-blur);
    border: 1px solid var(--glass-border);
    border-radius: var(--radius);
    padding: 18px 12px;
    text-align: center;
    box-shadow: var(--glass-shadow), var(--glass-inset);
    transition: all var(--transition);
    position: relative;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
}

.kpi-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: linear-gradient(90deg, transparent, rgba(255,255,255,0.1), transparent);
}

.kpi-card:hover {
    transform: translateY(-2px);
    box-shadow: 0 16px 48px rgba(0,0,0,0.4), var(--glass-inset);
    border-color: var(--border-light);
}

.kpi-value {
    font-size: 2.1rem;
    font-weight: 800;
    line-height: 1.1;
    letter-spacing: -1.5px;
    color: var(--text-primary);
}

.kpi-label {
    font-size: 0.68rem;
    color: var(--text-muted);
    text-transform: uppercase;
    letter-spacing: 0.8px;
    margin-top: 5px;
    font-weight: 500;
}

.kpi-trend {
    font-size: 0.73rem;
    margin-top: 5px;
    font-weight: 500;
}

.trend-up { color: var(--success); }
.trend-down { color: var(--danger); }
.trend-neutral { color: var(--text-muted); }

/* ===== FORM ELEMENTS ===== */
input[type="text"], input[type="number"], input[type="date"],
input[type="time"], input[type="email"], select, textarea {
    width: 100%;
    background: var(--bg-input);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    padding: 9px 13px;
    font-size: 0.875rem;
    font-family: inherit;
    transition: border-color var(--transition), box-shadow var(--transition);
}

input:focus, select:focus, textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px var(--accent-soft);
}

label {
    display: block;
    font-size: 0.76rem;
    color: var(--text-secondary);
    margin-bottom: 5px;
    font-weight: 500;
    letter-spacing: 0.2px;
}

.form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 14px;
}

.form-group { flex: 1; }
.form-group.full-width { flex: 1 1 100%; }

.form-actions {
    justify-content: space-between;
    margin-top: 8px;
}

.form-actions-right {
    display: flex;
    gap: 8px;
    margin-left: auto;
}

/* ===== CHIPS ===== */
.discipline-chips, .sensation-chips, .fatigue-chips, .pain-toggle {
    display: flex;
    gap: 6px;
    flex-wrap: wrap;
}

.chip, .chip-sensation, .chip-fatigue, .chip-pain {
    padding: 6px 15px;
    border-radius: 20px;
    border: 1px solid var(--border);
    background: var(--bg-input);
    color: var(--text-secondary);
    font-size: 0.8rem;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition);
    white-space: nowrap;
    font-family: inherit;
}

.chip svg, .chip-sensation svg { vertical-align: -3px; flex-shrink: 0; }

.chip:hover, .chip-sensation:hover {
    border-color: var(--border-light);
    color: var(--text-primary);
}

.chip.active, .chip-sensation.active {
    border-color: var(--accent);
    background: var(--accent-soft);
    color: var(--accent-hover);
    box-shadow: 0 0 12px var(--accent-soft);
}

.chip-swim.active  { border-color: var(--swim); background: var(--swim-bg); color: var(--swim); }
.chip-bike.active  { border-color: var(--bike); background: var(--bike-bg); color: var(--bike); }
.chip-run.active   { border-color: var(--run); background: var(--run-bg); color: var(--run); }
.chip-strength.active { border-color: var(--strength); background: var(--strength-bg); color: var(--strength); }

/* ===== RPE SLIDER ===== */
.rpe-slider-container { padding: 4px 0; }

.rpe-slider {
    -webkit-appearance: none;
    appearance: none;
    width: 100%;
    height: 5px;
    border-radius: 3px;
    background: linear-gradient(to right, var(--rpe-low), var(--rpe-mid), var(--rpe-high));
    outline: none;
}
.rpe-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0,0,0,0.5), 0 0 0 2px rgba(255,255,255,0.2);
    transition: transform var(--transition);
}
.rpe-slider::-webkit-slider-thumb:hover { transform: scale(1.15); }

.rpe-labels {
    display: flex;
    justify-content: space-between;
    font-size: 0.68rem;
    color: var(--text-muted);
    margin-top: 5px;
}
.rpe-value {
    text-align: center;
    font-size: 0.84rem;
    font-weight: 600;
    margin-top: 7px;
    color: var(--text-primary);
}

/* ===== DETAILS / OPTIONAL FIELDS ===== */
.optional-fields {
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    padding: 0;
    margin-bottom: 14px;
}
.optional-fields summary {
    padding: 10px 14px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.84rem;
    font-weight: 500;
    list-style: none;
}
.optional-fields summary::marker { display: none; }
.optional-fields summary:hover { color: var(--text-primary); }
.optional-fields[open] > summary { border-bottom: 1px solid var(--border); margin-bottom: 14px; }
.optional-fields > .form-row { padding: 0 14px; }

/* ===== BADGES ===== */
.badge {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 3px 10px;
    border-radius: 12px;
    font-size: 0.72rem;
    font-weight: 600;
}
.badge svg { vertical-align: -2px; flex-shrink: 0; }
.badge-swim { background: var(--swim-bg); color: var(--swim); }
.badge-bike { background: var(--bike-bg); color: var(--bike); }
.badge-run  { background: var(--run-bg);  color: var(--run); }
.badge-strength { background: var(--strength-bg); color: var(--strength); }

/* ===== TAGS ===== */
.tag {
    display: inline-block;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 0.7rem;
    background: var(--bg-input);
    color: var(--text-muted);
    border: 1px solid var(--border);
}

/* ===== TABLES ===== */
.data-table {
    width: 100%;
    border-collapse: collapse;
}

.data-table th {
    text-align: left;
    padding: 10px 14px;
    font-size: 0.68rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.7px;
    color: var(--text-muted);
    border-bottom: 1px solid var(--border);
}

.data-table td {
    padding: 11px 14px;
    font-size: 0.86rem;
    border-bottom: 1px solid var(--border);
    vertical-align: middle;
    transition: background var(--transition);
}

.data-table tr:hover td { background: var(--bg-hover); }
.data-table tr { cursor: pointer; }

/* ===== EMPTY STATE ===== */
.empty-state {
    text-align: center;
    padding: 52px 24px;
    color: var(--text-muted);
}
.empty-state-icon { font-size: 2.5rem; margin-bottom: 12px; opacity: 0.5; }
.empty-state-text { font-size: 0.92rem; font-weight: 500; }

/* ===== GRID HELPERS ===== */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.grid-3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 16px; }

/* ===== PROGRESS BAR ===== */
.progress-bar {
    width: 100%;
    height: 6px;
    background: var(--bg-input);
    border-radius: 3px;
    overflow: hidden;
}
.progress-fill {
    height: 100%;
    border-radius: 3px;
    transition: width 0.6s ease;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 5px; height: 5px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,0.08); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,0.15); }

/* ===== CHART CONTAINERS ===== */
.chart-container {
    position: relative;
    width: 100%;
    height: 250px;
}
.chart-container-sm {
    position: relative;
    width: 100%;
    height: 180px;
}

/* ===== STRAVA BAR ===== */
.strava-sync-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    background: rgba(252, 82, 0, 0.06);
    border: 1px solid rgba(252, 82, 0, 0.15);
    border-radius: var(--radius-sm);
    padding: 10px 14px;
    margin-bottom: 18px;
    backdrop-filter: var(--glass-blur);
}
.strava-sync-info { display: flex; align-items: center; gap: 8px; }
.strava-logo { font-size: 1.1rem; }
.strava-sync-text { font-size: 0.8rem; color: var(--text-muted); }
.btn-strava {
    background: rgba(252, 82, 0, 0.15);
    color: #fc5200;
    border: 1px solid rgba(252, 82, 0, 0.25);
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 0.78rem;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition);
    font-family: inherit;
}
.btn-strava:hover { background: rgba(252, 82, 0, 0.25); }

/* ===== FILE INPUT ===== */
.file-input-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    opacity: 0;
    pointer-events: none;
}

/* ===== ANIMATIONS ===== */
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(14px); }
    to   { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to   { opacity: 1; }
}
@keyframes slideInRight {
    from { transform: translateX(100%); }
    to   { transform: translateX(0); }
}

.page-enter { animation: fadeInUp 0.28s ease; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
    .sidebar { transform: translateX(-100%); }
    .sidebar.open { transform: translateX(0); box-shadow: 8px 0 40px rgba(0,0,0,0.5); z-index: 201; }
    .sidebar-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.45);
        backdrop-filter: blur(8px);
        -webkit-backdrop-filter: blur(8px);
        z-index: 200;
    }
    .sidebar-overlay.active { display: block; }
    .main-content {
        margin-left: 0;
        padding-bottom: calc(var(--bottomnav-height) + env(safe-area-inset-bottom, 0px));
    }
    .bottom-nav { display: grid; }
    .menu-toggle { display: block; min-width: 44px; min-height: 44px; }
    .theme-toggle { width: 44px; height: 44px; }
    .top-bar { padding: 0 16px; }
    .page-container { padding: 14px; }
    .grid-2, .grid-3 { grid-template-columns: 1fr; }
    .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
    .form-row { flex-direction: column; gap: 10px; }
    .quick-add-btn { font-size: 0.82rem; padding: 8px 14px; }
    input, select, textarea { font-size: max(16px, 0.875rem); }
}

@media (max-width: 480px) {
    .kpi-grid { grid-template-columns: 1fr 1fr; gap: 8px; }
    .kpi-value { font-size: 1.65rem; letter-spacing: -0.8px; }
    .kpi-card { padding: 14px 12px; }
}
