/* Mode sombre de Temps d'Écran.
   Suit le réglage de l'appareil, ou le choix fait avec le bouton 🌙 (retenu par le navigateur).
   theme.js pose data-theme="dark" sur <html> ; ces règles passent alors devant celles des pages. */

.theme-toggle { position: fixed; right: 16px; bottom: 16px; width: 42px; height: 42px; border-radius: 50%; border: 1px solid #ced4da;
                background: #fff; font-size: 20px; line-height: 1; cursor: pointer; box-shadow: 0 2px 8px rgba(0,0,0,0.15); padding: 0; margin: 0; z-index: 100; }
.share-banner { background: #fff3cd; color: #856404; }

html[data-theme="dark"] { color-scheme: dark; }
html[data-theme="dark"] body { background: #121417 !important; color: #e6e8eb !important; }
html[data-theme="dark"] .container,
html[data-theme="dark"] body > .card { background: #1e2229 !important; box-shadow: 0 4px 15px rgba(0,0,0,0.4) !important; }
html[data-theme="dark"] .cards .card,
html[data-theme="dark"] .pc,
html[data-theme="dark"] .limits,
html[data-theme="dark"] th { background: #262b33 !important; }
html[data-theme="dark"] h1, html[data-theme="dark"] h2, html[data-theme="dark"] h3,
html[data-theme="dark"] .card .value, html[data-theme="dark"] .pc .pc-name,
html[data-theme="dark"] .apps-list .app-name { color: #e6e8eb !important; }
html[data-theme="dark"] .user-info, html[data-theme="dark"] label, html[data-theme="dark"] .steps,
html[data-theme="dark"] .limit .figures, html[data-theme="dark"] .limits h3, html[data-theme="dark"] th,
html[data-theme="dark"] .heatmap th.day { color: #c9ced4 !important; }
html[data-theme="dark"] .help, html[data-theme="dark"] .no-data, html[data-theme="dark"] .card .label,
html[data-theme="dark"] .card .detail, html[data-theme="dark"] .pc .pc-label, html[data-theme="dark"] .share-text,
html[data-theme="dark"] .heatmap th, html[data-theme="dark"] .heatmap-legend, html[data-theme="dark"] .day-num,
html[data-theme="dark"] .device-row .state, html[data-theme="dark"] p.info, html[data-theme="dark"] .trend.same { color: #9aa3ad !important; }
html[data-theme="dark"] a:not([class]) { color: #6cb4ff; }
html[data-theme="dark"] .nav a { color: #fff; }

/* Boutons et barres gris clair */
html[data-theme="dark"] .device-btn:not(.active), html[data-theme="dark"] .link-dashboard,
html[data-theme="dark"] .exports a { background: #343a42 !important; color: #dfe3e8 !important; }
html[data-theme="dark"] .device-btn:not(.active):hover, html[data-theme="dark"] .link-dashboard:hover,
html[data-theme="dark"] .exports a:hover { background: #3d444d !important; }
html[data-theme="dark"] .limit .bar, html[data-theme="dark"] .share-bar, html[data-theme="dark"] .apps-list .app-bar,
html[data-theme="dark"] .heatmap td { background: #343a42; }
html[data-theme="dark"] .apps-list .app-time { color: #b197fc !important; }

/* Calendrier et tableaux */
html[data-theme="dark"] td, html[data-theme="dark"] th { border-color: #3a4049 !important; }
html[data-theme="dark"] .other-month { background: #191c21 !important; color: #555c64 !important; }
html[data-theme="dark"] th.week-head, html[data-theme="dark"] td.week-total { background: #1c2a3a !important; }
html[data-theme="dark"] td.week-total { color: #6cb4ff !important; }
html[data-theme="dark"] .devices-table th { background: none !important; }
html[data-theme="dark"] .header-bar, html[data-theme="dark"] .device-row, html[data-theme="dark"] .apps-list li,
html[data-theme="dark"] .devices-table th, html[data-theme="dark"] .devices-table td,
html[data-theme="dark"] .section { border-color: #3a4049 !important; }

/* Options */
html[data-theme="dark"] .section.admin { background: #2a2618 !important; border-color: #8a6d1a !important; }
html[data-theme="dark"] input, html[data-theme="dark"] select { background: #15181d !important; color: #e6e8eb !important; border-color: #4a515a !important; }

/* Messages */
html[data-theme="dark"] .flash.success { background: #1e3a26 !important; color: #8fd19e !important; }
html[data-theme="dark"] .flash.error { background: #3d1f23 !important; color: #f1a7ae !important; }
html[data-theme="dark"] .share-banner { background: #3a3220; color: #ffd970; }
html[data-theme="dark"] .theme-toggle { background: #262b33; border-color: #4a515a; }
