/* =========================================
   KLIMAT STYLE v6.6.0 (FINAL EXPANDED)
   ========================================= */

/* --- VARIABLES & RESET --- */
:root {
    --bg: #030712;
    --card-bg: rgba(30, 41, 59, 0.6);
    --primary: #3b82f6;
    --primary-glow: rgba(59, 130, 246, 0.5);
    --accent: #60a5fa;
    --text: #f8fafc;
    --text-muted: #94a3b8;
    --orange: #f97316;
    --orange-glow: rgba(249, 115, 22, 0.5);
    --green: #22c55e;
    --red: #ef4444;
    
    --glass-border: rgba(255, 255, 255, 0.08);
    --glass-surface: rgba(255, 255, 255, 0.03);
    --metal-gradient: linear-gradient(145deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.02) 100%);
}

* { 
    box-sizing: border-box; 
    -webkit-tap-highlight-color: transparent; 
}

/* Scrollbar Custom */
::-webkit-scrollbar { 
    width: 6px; 
}
::-webkit-scrollbar-track { 
    background: transparent; 
}
::-webkit-scrollbar-thumb { 
    background: rgba(255, 255, 255, 0.15); 
    border-radius: 10px; 
}
::-webkit-scrollbar-thumb:hover { 
    background: rgba(255, 255, 255, 0.25); 
}

body { 
    margin: 0; 
    padding: 0; 
    background: var(--bg); 
    color: var(--text); 
    font-family: 'Inter', sans-serif; 
    height: 100dvh; 
    display: flex; 
    flex-direction: column; 
    align-items: center; 
    justify-content: center; 
    overflow: hidden; 
    position: relative;
    /* Lissage des polices */
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

/* FOND TECH (Grille) */
body::before {
    content: ""; 
    position: absolute; 
    inset: 0;
    background-image: 
        linear-gradient(rgba(255, 255, 255, 0.03) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.03) 1px, transparent 1px);
    background-size: 40px 40px;
    mask-image: radial-gradient(circle at center, black 40%, transparent 80%);
    pointer-events: none; 
    z-index: -1;
}

/* VIGNETTE D'AMBIANCE */
body::after {
    content: ""; 
    position: absolute; 
    inset: 0;
    background: radial-gradient(circle at center, transparent 0%, rgba(3, 7, 18, 0.4) 100%);
    pointer-events: none; 
    z-index: -1;
}

/* --- UTILS --- */
.hidden { display: none !important; }
.animate-spin { animation: spin 1s linear infinite; }

@keyframes spin { 
    100% { transform: rotate(360deg); } 
}

/* Optimisation Mobile (Tap & Select) */
button, .icon-btn, .adjust-btn, .switch, .tab-btn { 
    user-select: none; 
    touch-action: manipulation; /* Supprime le délai de 300ms sur mobile */
    -webkit-tap-highlight-color: transparent;
}

/* --- LOGIN --- */
#login-overlay { 
    position: fixed; inset: 0; 
    background: var(--bg); 
    z-index: 100; 
    display: flex; align-items: center; justify-content: center; 
    transition: opacity 0.5s; 
    backdrop-filter: blur(20px); 
}

.login-box { 
    text-align: center; width: 320px; position: relative; 
}
.login-box::after { 
    content: ""; position: absolute; inset: -50px; 
    background: radial-gradient(circle, var(--primary-glow) 0%, transparent 60%); 
    z-index: -1; opacity: 0.3; 
}

.logo-icon { 
    width: 90px; height: 90px; 
    background: linear-gradient(135deg, var(--primary), #1d4ed8); 
    border-radius: 28px; 
    display: flex; align-items: center; justify-content: center; 
    margin: 0 auto 30px; 
    font-size: 36px; 
    box-shadow: 0 0 40px var(--primary-glow); 
    border: 1px solid rgba(255,255,255,0.2); 
}

#password-input { 
    width: 100%; 
    background: rgba(15, 23, 42, 0.8); 
    border: 1px solid var(--glass-border); 
    padding: 18px; 
    border-radius: 16px; 
    color: white; 
    text-align: center; 
    margin-bottom: 15px; 
    font-size: 18px; 
    transition: 0.3s; 
    box-shadow: inset 0 2px 10px rgba(0,0,0,0.5); 
    font-family: 'JetBrains Mono', monospace; 
}
#password-input:focus { 
    outline: none; 
    border-color: var(--primary); 
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.2); 
}

#login-btn { 
    width: 100%; 
    background: white; 
    color: black; 
    font-weight: 800; 
    padding: 18px; 
    border-radius: 16px; 
    border: none; 
    cursor: pointer; 
    transition: 0.2s; 
    text-transform: uppercase; 
    letter-spacing: 1px; 
    font-size: 14px; 
}
#login-btn:active { transform: scale(0.96); }

#login-error { 
    color: var(--red); 
    margin-top: 15px; 
    font-size: 14px; 
    opacity: 0; 
    transition: opacity 0.3s; 
    font-weight: 600; 
}

/* --- LAYOUT RESPONSIVE --- */
#app-content { 
    width: 100%; max-width: 460px; height: 100%; 
    display: flex; flex-direction: column; 
    padding: 24px; 
    opacity: 0; transition: opacity 0.6s cubic-bezier(0.2, 0.8, 0.2, 1); 
    pointer-events: none; 
    margin: 0 auto;
}

/* --- HEADER --- */
.app-header { 
    display: flex; 
    justify-content: space-between; 
    align-items: center; 
    margin-bottom: 20px; 
    flex-shrink: 0; 
    flex-wrap: nowrap; 
}

.header-left { display: flex; align-items: center; gap: 12px; }

.status-wrapper { position: relative; }
.status-dot { 
    width: 10px; height: 10px; border-radius: 50%; 
    position: absolute; top: -2px; right: -2px; 
    background: #475569; border: 2px solid var(--bg); 
    box-shadow: 0 0 0 2px #1e293b; z-index: 2; 
}
.status-dot.online { background: var(--green); box-shadow: 0 0 10px var(--green); }
.status-dot.offline { background: var(--red); box-shadow: 0 0 10px var(--red); }

.temp-icon { 
    width: 42px; height: 42px; 
    background: var(--glass-surface); 
    border: 1px solid var(--glass-border); 
    border-radius: 14px; 
    display: flex; align-items: center; justify-content: center; 
    font-size: 18px; color: var(--text-muted); 
    backdrop-filter: blur(10px); flex-shrink: 0; 
}

.title-wrapper h1 { 
    margin: 0; font-size: 20px; font-weight: 800; letter-spacing: -0.5px; 
    background: linear-gradient(to right, white, #94a3b8); 
    -webkit-background-clip: text; -webkit-text-fill-color: transparent; 
    white-space: nowrap; 
}

.time-wrapper { 
    font-size: 11px; color: var(--text-muted); 
    display: flex; gap: 6px; align-items: center; 
    font-family: 'JetBrains Mono', monospace; 
    margin-top: 2px; opacity: 0.8; 
}

.header-right { display: flex; gap: 6px; align-items: center; } 

.icon-btn { 
    width: 40px; height: 40px; 
    background: var(--glass-surface); 
    border: 1px solid var(--glass-border); 
    border-radius: 12px; 
    color: var(--text-muted); 
    display: flex; align-items: center; justify-content: center; 
    cursor: pointer; 
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1); 
    position: relative; 
    overflow: visible; 
    flex-shrink: 0;
}
.icon-btn:active { transform: scale(0.92); filter: brightness(1.2); }
.icon-btn.logout { 
    color: #f87171; 
    border-color: rgba(239, 68, 68, 0.15); 
    background: rgba(239, 68, 68, 0.05); 
}

.volt-btn { overflow: visible; }
.volt-popup { 
    position: absolute; bottom: -38px; right: 0; 
    font-size: 11px; font-family: 'JetBrains Mono', monospace; 
    background: #0f172a; padding: 6px 8px; 
    border-radius: 8px; border: 1px solid var(--glass-border); 
    opacity: 0; transition: all 0.3s; pointer-events: none; 
    white-space: nowrap; transform: translateY(-10px) scale(0.9); 
    z-index: 100; box-shadow: 0 4px 12px rgba(0,0,0,0.5); 
    font-weight: 700; color: var(--primary); 
}
.volt-popup.visible { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

/* --- THERMOSTAT 3D --- */
.thermostat-wrapper { 
    flex: 1; display: flex; align-items: center; justify-content: center; 
    position: relative; min-height: 280px; perspective: 1000px;
}

.thermostat-circle { 
    width: 280px; height: 280px; border-radius: 50%; 
    background: radial-gradient(circle at 30% 30%, #1e293b, #020617 70%);
    box-shadow: 
        -20px -20px 60px rgba(255, 255, 255, 0.03), 
        20px 20px 60px rgba(0, 0, 0, 0.8), 
        inset 0 0 0 2px rgba(255, 255, 255, 0.05), 
        inset 10px 10px 40px rgba(0, 0, 0, 0.5); 
    display: flex; align-items: center; justify-content: center; 
    position: relative; z-index: 10; 
    transition: transform 0.5s; 
    overflow: hidden; 
    border: 1px solid rgba(255,255,255,0.02);
}

/* CANVAS PARTICULES */
#particle-canvas { 
    position: absolute; top: 0; left: 0; width: 100%; height: 100%; 
    z-index: 15; pointer-events: none; border-radius: 50%; opacity: 0.8; 
}

@media (max-width: 380px) {
    .app-header { padding: 0; }
    .header-left { gap: 8px; }
    .title-wrapper h1 { font-size: 18px; }
    .thermostat-circle { width: 240px; height: 240px; }
    .adjust-btn { width: 56px; height: 56px; font-size: 20px; }
    #current-temp { font-size: 64px; }
    #target-display { font-size: 36px; }
    .icon-btn { width: 38px; height: 38px; } 
}

/* --- HEARTBEAT OPTIMISÉ --- */
.glow-heat { 
    position: absolute; width: 360px; height: 360px; 
    background: radial-gradient(circle, var(--orange-glow) 0%, transparent 60%); 
    opacity: 0; filter: blur(30px); 
    transition: opacity 1.2s cubic-bezier(0.4, 0, 0.2, 1);
    pointer-events: none; z-index: 0; mix-blend-mode: screen;
    will-change: transform, opacity; transform: translateZ(0); 
}
.glow-heat.active { 
    opacity: 0.7; 
    animation: pulse-heat 3s infinite cubic-bezier(0.4, 0, 0.6, 1); 
}

@keyframes pulse-heat { 
    0%, 100% { opacity: 0.5; transform: scale(0.95) translateZ(0); } 
    50% { opacity: 0.85; transform: scale(1.12) translateZ(0); } 
}

.progress-ring {
    position: absolute; inset: 10px; border-radius: 50%; border: 2px solid transparent;
    mask: linear-gradient(#fff 0 0) padding-box, linear-gradient(#fff 0 0);
    -webkit-mask-composite: xor; mask-composite: exclude;
    background: conic-gradient(from 180deg, transparent 20%, rgba(255,255,255,0.1) 50%, transparent 80%) border-box;
    animation: rotate-slow 20s linear infinite; 
    pointer-events: none; z-index: 16; 
}
@keyframes rotate-slow { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }

.active-ring {
    position: absolute; inset: 0; border-radius: 50%; 
    box-shadow: inset 0 0 30px var(--orange-glow);
    opacity: 0; transition: opacity 1s; 
    pointer-events: none; z-index: 16;
}
.active-ring.active { opacity: 1; }

.thermostat-content { 
    text-align: center; display: flex; flex-direction: column; align-items: center; 
    z-index: 20; transform: translateZ(20px); text-shadow: 0 4px 10px rgba(0,0,0,0.8); 
}
.label-actuel { 
    font-size: 10px; font-weight: 800; color: var(--text-muted); 
    letter-spacing: 3px; text-transform: uppercase; margin-bottom: 8px; opacity: 0.7; 
}
.temp-display { 
    display: flex; align-items: flex-start; position: relative; left: 6px; 
}
#current-temp { 
    font-size: 72px; font-weight: 800; line-height: 1; letter-spacing: -4px; 
    background: linear-gradient(180deg, #fff 20%, #94a3b8 100%); 
    -webkit-background-clip: text; -webkit-text-fill-color: transparent;
    filter: drop-shadow(0 4px 10px rgba(0,0,0,0.5)); 
    font-variant-numeric: tabular-nums; 
}
#current-temp-dec { 
    font-size: 28px; font-weight: 600; color: var(--text-muted); 
    margin-top: 8px; opacity: 0.8; 
}
.meta-info { display: flex; gap: 12px; margin-top: 15px; }
.info-badge { 
    background: rgba(0,0,0,0.3); padding: 6px 14px; border-radius: 30px; 
    font-size: 12px; color: var(--accent); font-weight: 700; 
    display: flex; gap: 8px; align-items: center; 
    border: 1px solid rgba(255,255,255,0.05); box-shadow: 0 4px 10px rgba(0,0,0,0.2);
}

/* --- CONTROLS PANEL --- */
.controls-panel { 
    background: var(--card-bg); 
    border: 1px solid var(--glass-border); 
    backdrop-filter: blur(24px); 
    border-radius: 32px; padding: 20px; flex-shrink: 0;
    box-shadow: 0 20px 50px rgba(0,0,0,0.5), inset 0 1px 0 rgba(255,255,255,0.1);
}

.mode-tabs { 
    display: grid; grid-template-columns: 1fr 1fr; 
    background: rgba(0,0,0,0.3); border-radius: 18px; padding: 5px; 
    position: relative; margin-bottom: 24px; 
    box-shadow: inset 0 2px 5px rgba(0,0,0,0.2);
}
.mode-bg { 
    position: absolute; top: 5px; bottom: 5px; width: calc(50% - 5px); 
    background: var(--primary); border-radius: 14px; 
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    box-shadow: 0 4px 15px var(--primary-glow);
}
.tab-btn { 
    position: relative; z-index: 1; background: none; border: none; 
    padding: 12px; font-size: 13px; font-weight: 800; cursor: pointer; 
    transition: color 0.3s; color: var(--text); letter-spacing: 0.5px; 
}

.target-control { 
    display: flex; justify-content: space-between; align-items: center; 
    margin-bottom: 24px; padding: 0 5px; 
}
.adjust-btn { 
    width: 60px; height: 60px; border-radius: 20px; border: none; 
    background: var(--metal-gradient); color: white; font-size: 24px; 
    cursor: pointer; transition: 0.2s; 
    box-shadow: 0 4px 10px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.1); 
    border: 1px solid rgba(255,255,255,0.05);
}
.adjust-btn:active { 
    transform: scale(0.95); filter: brightness(0.9); 
    box-shadow: 0 2px 5px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05); 
}
.adjust-btn.plus { 
    background: white; color: black; box-shadow: 0 4px 15px rgba(255,255,255,0.2); 
}
.adjust-btn.plus:active { 
    background: #e2e8f0; filter: brightness(0.95); transform: scale(0.95); 
}

.target-display-wrapper { text-align: center; }
.target-label { 
    font-size: 10px; font-weight: 800; color: var(--text-muted); 
    letter-spacing: 2px; display: block; margin-bottom: 4px; 
}
#target-display { 
    font-size: 38px; font-weight: 800; letter-spacing: -2px; 
    text-shadow: 0 2px 10px rgba(0,0,0,0.5); 
    font-variant-numeric: tabular-nums; 
}

.presets-grid { 
    display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; 
}
.preset-btn { 
    background: rgba(255,255,255,0.02); border: 1px solid transparent; 
    border-radius: 18px; padding: 12px 0; color: var(--text-muted); 
    display: flex; flex-direction: column; align-items: center; gap: 6px; 
    cursor: pointer; transition: 0.2s; 
}
.preset-btn i { font-size: 18px; transition: 0.3s; }
.preset-btn span { font-size: 10px; font-weight: 700; }
.preset-active { 
    background: rgba(37,99,235,0.1); border-color: rgba(37,99,235,0.4); 
    color: var(--accent); box-shadow: 0 0 15px rgba(37, 99, 235, 0.15); 
}
.preset-active i { transform: scale(1.1); color: var(--primary); }

.manual-wrapper { 
    display: flex; flex-direction: column; align-items: center; 
    padding: 10px 0; position: relative; 
}
.switch { 
    position: relative; display: inline-block; width: 56px; height: 32px; flex-shrink: 0; 
}
.switch input { 
    position: absolute; opacity: 0; width: 100%; height: 100%; 
    top: 0; left: 0; z-index: 10; cursor: pointer; 
}
.slider { 
    position: absolute; cursor: pointer; top: 0; left: 0; right: 0; bottom: 0; 
    background-color: #334155; transition: .3s; 
    border-radius: 32px; border: 2px solid #334155; z-index: 1; 
}
.slider:before { 
    position: absolute; content: ""; height: 24px; width: 24px; 
    left: 2px; bottom: 2px; background-color: white; 
    transition: .3s cubic-bezier(0.175, 0.885, 0.32, 1.275); 
    border-radius: 50%; box-shadow: 0 2px 5px rgba(0,0,0,0.3); 
}
input:checked + .slider { background-color: var(--orange); border-color: var(--orange); }
input:checked + .slider:before { transform: translateX(24px); }
#manual-status-text { 
    font-size: 12px; font-weight: 800; margin-top: 15px; 
    letter-spacing: 1px; color: var(--text-muted); 
}

/* --- STATUS & ALERTS --- */
.rssi-icon { font-size: 16px; margin-left: 10px; vertical-align: middle; }
.rssi-bad { color: #ef4444; }
.rssi-ok { color: #f97316; }
.rssi-good { color: #22c55e; }

/* ERROR ANIMATION */
.pump-error { 
    border-color: #ef4444 !important; 
    box-shadow: 0 0 20px #ef4444, inset 0 0 20px #ef4444 !important; 
    animation: pulse-error 2s infinite; 
}
@keyframes pulse-error { 
    0%, 100% { opacity: 0.5; } 
    50% { opacity: 1; } 
}

/* --- MODALS --- */
.modal-overlay { 
    position: fixed; inset: 0; background: rgba(0,0,0,0.6); 
    z-index: 50; opacity: 0; pointer-events: none; 
    transition: opacity 0.4s; backdrop-filter: blur(12px); 
}
.modal-overlay.visible { opacity: 1; pointer-events: auto; }

.bottom-sheet { 
    position: fixed; bottom: 0; left: 0; right: 0; background: #0f172a; 
    border-top: 1px solid rgba(255,255,255,0.1); border-radius: 36px 36px 0 0; 
    z-index: 60; transform: translateY(100%); 
    transition: transform 0.5s cubic-bezier(0.19, 1, 0.22, 1); 
    height: 85dvh; display: flex; flex-direction: column; 
    box-shadow: 0 -20px 60px rgba(0,0,0,0.6); 
}
.bottom-sheet.short { height: auto; padding-bottom: 40px; }
.bottom-sheet.visible { transform: translateY(0); }

.sheet-header { 
    padding: 24px; border-bottom: 1px solid rgba(255,255,255,0.05); 
    display: flex; justify-content: space-between; align-items: center; 
}
.sheet-header h3 { margin: 0; font-size: 20px; font-weight: 800; }
.close-btn { 
    width: 40px; height: 40px; background: rgba(255,255,255,0.05); 
    border: none; border-radius: 50%; color: white; cursor: pointer; 
}
.scroll-content { flex: 1; overflow-y: auto; padding: 20px; }
.sheet-footer { 
    padding: 24px; border-top: 1px solid rgba(255,255,255,0.05); 
    background: #0f172a; padding-bottom: max(24px, env(safe-area-inset-bottom)); 
}

.primary-btn { 
    width: 100%; background: var(--primary); color: white; border: none; 
    padding: 18px; border-radius: 20px; font-weight: 800; font-size: 15px; 
    letter-spacing: 0.5px; cursor: pointer; transition: 0.2s; 
    box-shadow: 0 8px 25px rgba(37, 99, 235, 0.25); text-transform: uppercase; 
}
.primary-btn:active { transform: scale(0.98); }
.secondary-btn { 
    background: #1e293b; color: #cbd5e1; border: 1px solid #334155; 
    padding: 18px; border-radius: 20px; font-weight: 800; flex: 1; 
    cursor: pointer; text-transform: uppercase; 
}

/* --- TASK ITEM --- */
.task-item { 
    display: flex; align-items: stretch; background: rgba(255,255,255,0.02); 
    border-radius: 24px; margin-bottom: 12px; overflow: hidden; 
    border: 1px solid rgba(255,255,255,0.04); transition: 0.2s; 
}
.task-item:active { transform: scale(0.98); }
.task-item.disabled { opacity: 0.5; filter: grayscale(1); }

.task-info { 
    flex: 1; padding: 18px; cursor: pointer; display: flex; 
    flex-direction: column; gap: 8px; background: none; border: none; text-align: left; 
}
.task-time { 
    font-size: 22px; font-weight: 700; font-family: 'JetBrains Mono', monospace; color: white; 
}
.task-temp { color: var(--accent); font-weight: 700; font-size: 15px; }

.days-row { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 2px; }
.day-badge { 
    font-size: 10px; font-weight: 700; padding: 4px 8px; border-radius: 6px; 
    background: rgba(255,255,255,0.05); color: #64748b; border: 1px solid transparent; 
}
.day-badge.active { 
    background: rgba(37, 99, 235, 0.2); color: #60a5fa; border-color: rgba(59, 130, 246, 0.3); 
}
.task-switch { 
    padding: 0 15px; display: flex; align-items: center; 
    border-left: 1px solid rgba(255,255,255,0.04); background: rgba(0,0,0,0.15); 
}

/* --- CENTER MODAL --- */
.center-modal { 
    position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.9); 
    width: 90%; max-width: 360px; background: #0f172a; border-radius: 32px; 
    z-index: 70; padding: 24px; opacity: 0; pointer-events: none; 
    transition: 0.4s; border: 1px solid #334155; box-shadow: 0 25px 80px rgba(0,0,0,0.7); 
}
.center-modal.visible { opacity: 1; pointer-events: auto; transform: translate(-50%, -50%) scale(1); }

.time-picker { 
    display: flex; justify-content: center; gap: 15px; align-items: center; 
    background: rgba(255,255,255,0.02); padding: 15px; border-radius: 20px; 
    border: 1px solid rgba(255,255,255,0.04); margin-bottom: 20px; 
}
.time-picker .col { display: flex; flex-direction: column; align-items: center; gap: 5px; }
.time-picker button { 
    background: none; border: none; color: #64748b; padding: 5px; 
    cursor: pointer; font-size: 18px; 
}
.time-picker span { font-size: 36px; font-weight: 800; font-family: 'JetBrains Mono', monospace; }

.row { 
    display: flex; align-items: center; justify-content: space-between; 
    background: rgba(255,255,255,0.02); padding: 12px; border-radius: 20px; 
    border: 1px solid rgba(255,255,255,0.04); margin-bottom: 20px; 
}
.square-btn { 
    width: 44px; height: 44px; border-radius: 14px; 
    border: 1px solid rgba(255,255,255,0.1); background: #1e293b; 
    color: white; cursor: pointer; font-size: 16px; 
}
.temp-val-wrapper { text-align: center; }
.temp-val-wrapper span { font-size: 24px; font-weight: 700; display: block; }
.temp-val-wrapper small { font-size: 10px; color: var(--text-muted); font-weight: 700; }

.days-selector { display: flex; justify-content: space-between; margin-bottom: 24px; }
.day-toggle { 
    width: 40px; height: 40px; border-radius: 50%; 
    background: rgba(255,255,255,0.02); color: #64748b; 
    border: 1px solid #334155; font-weight: 700; cursor: pointer; 
}
.day-toggle.selected { 
    background: var(--primary); color: white; border-color: var(--primary); 
    box-shadow: 0 2px 10px var(--primary-glow); 
}
.modal-actions { display: flex; gap: 12px; }
.delete-link { 
    background: none; border: none; color: #ef4444; width: 100%; margin-top: 20px; 
    font-size: 12px; font-weight: 700; cursor: pointer; 
    text-transform: uppercase; letter-spacing: 1px; 
}

/* --- STATS (OPTIMISÉ POUR GRID 2x2) --- */
.stat-card { 
    background: #1e293b; padding: 20px; border-radius: 24px; 
    border: 1px solid rgba(255,255,255,0.05); position: relative; 
    overflow: hidden; 
    /* Margin supprimée pour la grille 2x2 */
}
.stat-card p { font-size: 24px; font-weight: 800; margin: 0; }
.stats-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; padding: 20px; }

.graph-box { 
    height: 100px; margin: 0 20px 20px 20px; 
    display: flex; align-items: flex-end; gap: 6px; padding: 10px; 
    background: rgba(0,0,0,0.3); border-radius: 20px; 
    border: 1px solid rgba(255,255,255,0.03); 
}
.bar { 
    flex: 1; min-width: 6px; border-radius: 6px 6px 0 0; 
    background: #334155; position: relative; overflow: hidden; 
    transition: height 0.5s; 
}
.bar.good { background: var(--green); } 
.bar.high { background: var(--orange); } 

/* --- TOAST --- */
#toast { 
    position: fixed; top: 30px; left: 50%; transform: translateX(-50%) translateY(-150px); 
    background: #ffffff; color: #0f172a; 
    padding: 14px 28px; border-radius: 50px; 
    display: flex; align-items: center; gap: 12px; 
    box-shadow: 0 10px 40px rgba(0,0,0,0.6); 
    transition: transform 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275), opacity 0.4s; 
    z-index: 999; opacity: 0; font-weight: 700; font-size: 14px; 
    width: max-content; max-width: 90%;
}
#toast.visible { transform: translateX(-50%) translateY(0); opacity: 1; }

/* BATTERY ANIM */
@keyframes battery-pulse { 
    0% { opacity: 1; } 
    50% { opacity: 0.3; } 
    100% { opacity: 1; } 
}
.battery-blink { animation: battery-pulse 1s infinite; }