:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-alt: #eef0f4;
  --text: #20232a;
  --text-muted: #777d89;
  --primary: #5265d8;
  --primary-soft: #eceefb;
  --primary-contrast: #ffffff;
  --danger: #d65c61;
  --danger-soft: #fbe9ea;
  --success: #329b73;
  --success-soft: #e7f6ef;
  --warning: #db9b35;
  --warning-soft: #fbf0dd;
  --border: #e7e9ef;

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;

  --shadow-xs: 0 1px 2px rgba(20, 23, 42, 0.04);
  --shadow-sm: 0 2px 8px rgba(20, 23, 42, 0.06);
  --shadow-md: 0 8px 24px rgba(20, 23, 42, 0.10);
  --shadow-fab: 0 8px 20px rgba(82, 101, 216, 0.35);

  --topbar-h: 56px;
  --sidenav-w: 248px;
  --tap: 44px;
  --ease: cubic-bezier(0.2, 0.8, 0.2, 1);

  color-scheme: light;
}

/* Mode sombre : palette dédiée (pas une simple inversion), déclenchée soit
   automatiquement par le thème du système, soit manuellement via
   `data-theme` posé sur <html> (Réglages → Apparence, voir settings.js). */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #14161c;
    --surface: #1d2027;
    --surface-alt: #262a33;
    --text: #edeef2;
    --text-muted: #9aa0ad;
    --primary: #8392ea;
    --primary-soft: #2a2f55;
    --primary-contrast: #11131a;
    --danger: #e8898d;
    --danger-soft: #3a2327;
    --success: #5bc69a;
    --success-soft: #1f3a30;
    --warning: #eab866;
    --warning-soft: #3a3020;
    --border: #2d313b;

    --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
    --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
    --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
    --shadow-fab: 0 8px 22px rgba(0, 0, 0, 0.5);

    color-scheme: dark;
  }
}

:root[data-theme="dark"] {
  --bg: #14161c;
  --surface: #1d2027;
  --surface-alt: #262a33;
  --text: #edeef2;
  --text-muted: #9aa0ad;
  --primary: #8392ea;
  --primary-soft: #2a2f55;
  --primary-contrast: #11131a;
  --danger: #e8898d;
  --danger-soft: #3a2327;
  --success: #5bc69a;
  --success-soft: #1f3a30;
  --warning: #eab866;
  --warning-soft: #3a3020;
  --border: #2d313b;

  --shadow-xs: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-sm: 0 2px 10px rgba(0, 0, 0, 0.35);
  --shadow-md: 0 10px 28px rgba(0, 0, 0, 0.45);
  --shadow-fab: 0 8px 22px rgba(0, 0, 0, 0.5);

  color-scheme: dark;
}

* { box-sizing: border-box; }

[hidden] { display: none !important; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", Roboto, sans-serif;
  font-size: 16px;
  -webkit-tap-highlight-color: transparent;
  overflow-x: hidden;
  transition: background-color 0.2s var(--ease), color 0.2s var(--ease);
}

body {
  animation: page-fade-in 0.25s var(--ease);
}

@keyframes page-fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

@media (prefers-reduced-motion: reduce) {
  body { animation: none; }
  * { transition-duration: 0.01ms !important; animation-duration: 0.01ms !important; }
}

a { color: inherit; text-decoration: none; }

.icon {
  width: 1.2em;
  height: 1.2em;
  display: inline-block;
  vertical-align: -0.22em;
  fill: currentColor;
  flex-shrink: 0;
}
.icon-lg { width: 1.6em; height: 1.6em; }
.icon-xl { width: 2.2em; height: 2.2em; }

.topbar {
  position: fixed;
  top: 0; left: 0; right: 0;
  height: calc(var(--topbar-h) + env(safe-area-inset-top));
  padding-top: env(safe-area-inset-top);
  background: color-mix(in srgb, var(--surface) 92%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding-left: 16px;
  padding-right: 16px;
  z-index: 20;
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), left 0.2s var(--ease);
}

.topbar-title { font-weight: 700; font-size: 1.1rem; letter-spacing: -0.01em; display: flex; align-items: baseline; gap: 8px; }
.topbar-clock { font-weight: 500; font-size: 0.82rem; color: var(--text-muted); font-variant-numeric: tabular-nums; }

.icon-btn {
  position: relative;
  background: none;
  border: none;
  font-size: 1.3rem;
  color: var(--text);
  width: 40px;
  height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), transform 0.1s var(--ease);
}
.icon-btn:active { background: var(--surface-alt); transform: scale(0.92); }

.badge {
  position: absolute;
  top: -2px; right: -2px;
  background: var(--danger);
  color: #fff;
  font-size: 0.65rem;
  min-width: 16px;
  height: 16px;
  border-radius: 8px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0 4px;
  box-shadow: 0 0 0 2px var(--surface);
}

.content {
  padding: calc(var(--topbar-h) + env(safe-area-inset-top) + 16px) 16px
    calc(env(safe-area-inset-bottom) + 24px);
  padding-left: calc(16px + env(safe-area-inset-left));
  padding-right: calc(16px + env(safe-area-inset-right));
  max-width: 720px;
  margin: 0 auto;
  min-height: 100vh;
  transition: margin-left 0.2s var(--ease);
}

/* Menu de navigation : un tiroir qui glisse depuis la gauche sur mobile
   (ouvert/fermé via #nav-toggle-btn, survol/estompage via le fond
   #side-nav-backdrop), remplacé par un panneau fixe sur écran d'ordinateur
   (voir le @media plus bas) — §5 du cahier des charges. */

.side-nav-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 11, 15, 0.45);
  z-index: 34;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s var(--ease);
}
.side-nav-backdrop.visible { opacity: 1; pointer-events: auto; }

.side-nav {
  position: fixed;
  top: 0; bottom: 0; left: 0;
  width: min(82vw, 300px);
  background: var(--surface);
  border-right: 1px solid var(--border);
  z-index: 36;
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: calc(env(safe-area-inset-top) + 14px) 0 calc(env(safe-area-inset-bottom) + 14px);
  overflow-y: auto;
  transform: translateX(-100%);
  transition: transform 0.25s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease);
  box-shadow: var(--shadow-md);
}
.side-nav.open { transform: translateX(0); }

.side-nav a {
  display: flex;
  align-items: center;
  gap: 13px;
  padding: 12px 22px;
  margin: 1px 8px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 0.95rem;
  font-weight: 500;
  white-space: nowrap;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease);
}
.side-nav a .icon { width: 1.3rem; height: 1.3rem; flex-shrink: 0; }
.side-nav a:active, .side-nav a:hover { background: var(--surface-alt); color: var(--text); }
.side-nav a.active { color: var(--primary); font-weight: 600; background: var(--primary-soft); }

.side-nav hr {
  border: none;
  border-top: 1px solid var(--border);
  margin: 10px 20px;
}

.side-nav-collapse-btn { display: none; }

.notif-panel {
  position: fixed;
  top: calc(var(--topbar-h) + env(safe-area-inset-top) + 6px);
  right: calc(8px + env(safe-area-inset-right));
  width: min(360px, calc(100vw - 16px));
  max-height: 70vh;
  overflow-y: auto;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  z-index: 30;
  animation: notif-panel-in 0.15s var(--ease);
}
@keyframes notif-panel-in {
  from { opacity: 0; transform: translateY(-6px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.notif-panel-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 14px;
  border-bottom: 1px solid var(--border);
}

.notif-list { padding: 6px; }

.notif-item {
  padding: 10px 8px;
  border-radius: var(--radius-sm);
  transition: background-color 0.15s var(--ease);
}
.notif-item.unread { background: var(--primary-soft); }
.notif-item .notif-title { font-weight: 600; font-size: 0.9rem; }
.notif-item .notif-meta { font-size: 0.75rem; color: var(--text-muted); }

.link-btn {
  background: none;
  border: none;
  color: var(--primary);
  font-size: 0.95rem;
  font-weight: 500;
  cursor: pointer;
  min-width: 36px;
  min-height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  border-radius: var(--radius-sm);
  flex-shrink: 0;
  transition: background-color 0.15s var(--ease), transform 0.1s var(--ease);
}
.link-btn:active { background: var(--surface-alt); transform: scale(0.92); }

h1 { font-size: 1.5rem; font-weight: 700; letter-spacing: -0.015em; margin: 0 0 18px; }
h2 { font-size: 1.05rem; font-weight: 600; margin: 26px 0 10px; color: var(--text); }
h2:first-child { margin-top: 0; }

/* Échelle typographique secondaire (cahier des charges §2.4) : réutilisée
   par les pages qui veulent une légende/texte secondaire explicite plutôt
   que du style en ligne. */
.text-muted { color: var(--text-muted); }
.caption { font-size: 0.78rem; color: var(--text-muted); }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 14px;
  box-shadow: var(--shadow-xs);
  transition: background-color 0.2s var(--ease), border-color 0.2s var(--ease), box-shadow 0.2s var(--ease);
}

.card-title {
  font-weight: 600;
  font-size: 0.95rem;
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text);
}

.empty-state { color: var(--text-muted); font-size: 0.9rem; padding: 12px 0; line-height: 1.5; }

/* État vide riche (icône + message + action), §10 du cahier des charges.
   Les pages existantes peuvent continuer à utiliser .empty-state (texte
   seul) ; ce composant s'ajoute pour les emplacements qui veulent une
   présentation plus engageante (ex: Dashboard, listes principales). */
.state-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 10px;
  padding: 28px 16px;
  color: var(--text-muted);
}
.state-empty .icon { width: 2.4rem; height: 2.4rem; opacity: 0.5; }
.state-empty strong { color: var(--text); font-size: 0.95rem; font-weight: 600; }
.state-empty p { margin: 0; font-size: 0.85rem; max-width: 280px; }

.state-error {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 14px;
  border-radius: var(--radius-sm);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 0.88rem;
}
.state-error .icon { flex-shrink: 0; margin-top: 1px; }

/* Indicateur de chargement discret (spinner CSS, pas d'image ni de JS
   supplémentaire — respecte la contrainte de sobriété Raspberry Pi 3). */
.spinner {
  width: 20px; height: 20px;
  border-radius: 50%;
  border: 2.5px solid var(--border);
  border-top-color: var(--primary);
  animation: spin 0.7s linear infinite;
  display: inline-block;
}
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) {
  .spinner { animation-duration: 1.4s; }
}
.state-loading {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 16px 0;
  color: var(--text-muted);
  font-size: 0.88rem;
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: var(--primary);
  color: var(--primary-contrast);
  border: none;
  border-radius: var(--radius-sm);
  padding: 12px 18px;
  min-height: var(--tap);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  box-shadow: var(--shadow-xs);
  transition: transform 0.1s var(--ease), opacity 0.1s var(--ease), box-shadow 0.15s var(--ease);
}
.btn:active { transform: scale(0.97); opacity: 0.9; box-shadow: none; }
.btn.secondary { background: var(--surface-alt); color: var(--text); border: 1px solid var(--border); box-shadow: none; }
.btn.danger { background: var(--danger); color: #fff; }
.btn.block { width: 100%; }

.fab {
  position: fixed;
  right: calc(16px + env(safe-area-inset-right));
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  width: 54px; height: 54px;
  border-radius: 50%;
  background: var(--primary);
  color: var(--primary-contrast);
  font-size: 1.6rem;
  border: none;
  box-shadow: var(--shadow-fab);
  z-index: 15;
  cursor: pointer;
  transition: transform 0.15s var(--ease), bottom 0.2s var(--ease);
}
.fab:active { transform: scale(0.92); }

input, textarea, select {
  width: 100%;
  min-height: var(--tap);
  padding: 10px 13px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: 0.95rem;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  transition: border-color 0.15s var(--ease), box-shadow 0.15s var(--ease), background-color 0.2s var(--ease);
}
textarea { min-height: 80px; }
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
input[type="checkbox"], input[type="radio"] { width: auto; min-height: auto; }
input::placeholder, textarea::placeholder { color: var(--text-muted); opacity: 0.8; }

input.compact, select.compact { width: 84px; }

label { display: block; font-size: 0.8rem; font-weight: 500; color: var(--text-muted); margin-bottom: 4px; margin-top: 10px; }

.field { margin-bottom: 4px; }

.row { display: flex; gap: 10px; flex-wrap: wrap; }
.row > * { flex: 1 1 140px; min-width: 0; }
/* Les boutons d'action (ex: deux boutons côte à côte) gardent un partage
   égal de la largeur ; les icônes compactes (✕, 🗑️…) ne s'étirent jamais. */
.row > .link-btn, .row > .pill, .row > select.compact, .row > input.compact {
  flex: 0 0 auto;
  min-width: auto;
}

.list-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 13px 4px;
  border-bottom: 1px solid var(--border);
  transition: background-color 0.15s var(--ease);
  border-radius: var(--radius-sm);
}
.list-row:last-child { border-bottom: none; }
.list-row:has([data-action="open"], [data-action="edit"]):active { background: var(--surface-alt); }

.checkbox {
  width: 28px; height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  flex-shrink: 0;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--surface);
  transition: background-color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
}
.checkbox.checked { background: var(--success); border-color: var(--success); color: #fff; }
.checkbox:active { transform: scale(0.88); }

.item-title { flex: 1; }
.item-title.done { text-decoration: line-through; color: var(--text-muted); }

.tag {
  display: inline-block;
  font-size: 0.7rem;
  font-weight: 600;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--primary-soft);
  color: var(--primary);
  margin-right: 4px;
}
.tag.priority-haute { background: var(--danger-soft); color: var(--danger); }
.tag.priority-basse { background: var(--success-soft); color: var(--success); }
.tag.overdue { background: var(--danger); color: #fff; }

.pill-filters {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding-bottom: 8px;
  margin-bottom: 8px;
  scrollbar-width: none;
}
.pill-filters::-webkit-scrollbar { display: none; }
.pill {
  padding: 9px 15px;
  min-height: 36px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), border-color 0.15s var(--ease), transform 0.1s var(--ease);
}
.pill:active { transform: scale(0.96); }
.pill.active { background: var(--primary); color: var(--primary-contrast); border-color: var(--primary); }

/* Sélecteur segmenté (ex: thème clair/sombre/auto) */
.segmented {
  display: flex;
  background: var(--surface-alt);
  border-radius: var(--radius-sm);
  padding: 3px;
  gap: 2px;
}
.segmented button {
  flex: 1;
  background: none;
  border: none;
  padding: 8px 10px;
  border-radius: calc(var(--radius-sm) - 2px);
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-muted);
  cursor: pointer;
  transition: background-color 0.15s var(--ease), color 0.15s var(--ease), box-shadow 0.15s var(--ease);
}
.segmented button.active {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-xs);
  font-weight: 600;
}

.modal-backdrop {
  position: fixed; inset: 0;
  background: rgba(10, 11, 15, 0.45);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 40;
  animation: backdrop-fade-in 0.2s var(--ease);
}
@keyframes backdrop-fade-in {
  from { background: rgba(10, 11, 15, 0); }
  to { background: rgba(10, 11, 15, 0.45); }
}
.modal {
  background: var(--surface);
  border-radius: var(--radius-lg) var(--radius-lg) 0 0;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 22px;
  padding-bottom: calc(22px + env(safe-area-inset-bottom));
  padding-left: calc(22px + env(safe-area-inset-left));
  padding-right: calc(22px + env(safe-area-inset-right));
  box-shadow: var(--shadow-md);
  animation: modal-slide-up 0.25s var(--ease);
}
@keyframes modal-slide-up {
  from { transform: translateY(28px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}
.modal-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; gap: 12px; }
.modal-head h2 { margin: 0; }

@media (min-width: 560px) {
  /* Sur un écran large, une modale "plein bord collé en bas" fait moins
     sens : elle se recentre comme une vraie boîte de dialogue. */
  .modal-backdrop { align-items: center; }
  .modal { border-radius: var(--radius-lg); }
}

.week-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.week-day-head { text-align: center; font-size: 0.7rem; color: var(--text-muted); padding-bottom: 4px; font-weight: 500; }
.week-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 70px;
  padding: 5px;
  font-size: 0.7rem;
  transition: border-color 0.15s var(--ease);
}
.week-day.today { border-color: var(--primary); border-width: 1.5px; }
.week-day.selected { background: var(--primary-soft); }
.week-day-num { font-weight: 600; font-size: 0.75rem; }
.week-event {
  background: var(--primary-soft);
  color: var(--primary);
  border-radius: 5px;
  padding: 2px 5px;
  margin-top: 2px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-weight: 500;
}

.view-tabs { display: flex; gap: 8px; margin-bottom: 12px; }

.month-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 5px; }
.month-day {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  min-height: 44px;
  padding: 5px;
  font-size: 0.7rem;
  cursor: pointer;
  position: relative;
  transition: border-color 0.15s var(--ease), background-color 0.15s var(--ease);
}
.month-day.other-month { opacity: 0.4; }
.month-day.today { border-color: var(--primary); border-width: 1.5px; }
.month-day.selected { background: var(--primary-soft); }
.month-day-num { font-weight: 600; font-size: 0.75rem; }
.month-day-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--primary);
  margin-top: 4px;
}
.month-day-count { font-size: 0.65rem; color: var(--primary); font-weight: 600; margin-top: 2px; }

.app-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 10px;
}
.app-grid .btn { justify-content: flex-start; }

.toast {
  position: fixed;
  bottom: calc(env(safe-area-inset-bottom) + 16px);
  left: 50%;
  max-width: calc(100vw - 32px);
  background: var(--text);
  color: var(--bg);
  padding: 11px 18px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  box-shadow: var(--shadow-md);
  z-index: 50;
  text-align: center;
  animation: toast-in 0.2s var(--ease), toast-out 0.2s var(--ease) 2.3s forwards;
}
@keyframes toast-in {
  from { transform: translate(-50%, 8px); opacity: 0; }
  to { transform: translate(-50%, 0); opacity: 1; }
}
@keyframes toast-out {
  to { transform: translate(-50%, 8px); opacity: 0; }
}

@media (min-width: 720px) {
  .content { padding-top: calc(var(--topbar-h) + 24px); }
}

/* --- Emploi du temps par jour (ONE School) --- */

.day-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 14px;
}
.day-nav-label { text-align: center; flex: 1; }
.day-nav-day { font-weight: 700; font-size: 1.05rem; text-transform: capitalize; }
.day-nav-date { font-size: 0.8rem; color: var(--text-muted); text-transform: capitalize; }

.day-schedule {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.day-schedule-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--subject-color, var(--primary));
  border-radius: var(--radius-sm);
  padding: 12px 14px;
  box-shadow: var(--shadow-xs);
}
.day-schedule-item.canceled { opacity: 0.55; }
.day-schedule-item.canceled .day-schedule-title { text-decoration: line-through; }

.day-schedule-time {
  flex-shrink: 0;
  width: 56px;
  text-align: right;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
  line-height: 1.3;
}

.day-schedule-body { flex: 1; min-width: 0; }
.day-schedule-title { font-weight: 600; font-size: 0.95rem; }
.day-schedule-meta { font-size: 0.78rem; color: var(--text-muted); margin-top: 2px; }

.day-schedule-break {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 14px;
  color: var(--text-muted);
  font-size: 0.78rem;
  font-weight: 500;
}
.day-schedule-break .icon { width: 1rem; height: 1rem; opacity: 0.7; }
.day-schedule-break-line {
  flex: 1;
  height: 1px;
  background: var(--border);
  border: none;
}

/* --- Dashboard (§4 du cahier des charges) --- */

.dash-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 18px;
}
.dash-header h1 { margin: 2px 0 0; }

.dash-summary {
  background: linear-gradient(135deg, var(--primary) 0%, color-mix(in srgb, var(--primary) 78%, #000 10%) 100%);
  color: var(--primary-contrast);
  border: none;
  padding: 18px;
}
.dash-summary-date { font-size: 0.85rem; opacity: 0.85; margin-bottom: 10px; font-weight: 500; }
.dash-summary-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}
.dash-summary-item { text-align: left; }
.dash-summary-value { font-size: 1.4rem; font-weight: 700; line-height: 1.2; }
.dash-summary-label { font-size: 0.72rem; opacity: 0.85; margin-top: 2px; }

.quick-actions {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}
.quick-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  padding: 14px 4px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  color: var(--text);
  font-size: 0.72rem;
  font-weight: 500;
  text-align: center;
  box-shadow: var(--shadow-xs);
  transition: transform 0.1s var(--ease), background-color 0.15s var(--ease);
}
.quick-action .icon { width: 1.5rem; height: 1.5rem; color: var(--primary); }
.quick-action:active { transform: scale(0.96); background: var(--surface-alt); }

.dash-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
}
@media (min-width: 540px) {
  .dash-grid { grid-template-columns: 1fr 1fr; }
}

.dash-card {
  display: flex;
  flex-direction: column;
  gap: 2px;
  color: var(--text);
}
.dash-card-head {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--text-muted);
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 6px;
}
.dash-card-head .icon { width: 1.1rem; height: 1.1rem; color: var(--primary); }
.dash-card-main { font-size: 1rem; font-weight: 600; line-height: 1.35; }
.dash-card-meta { font-size: 0.8rem; color: var(--text-muted); margin-top: 2px; }
.dash-card-wide { grid-column: 1 / -1; }

.clock-card { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; }
.clock-time { font-size: 2rem; font-weight: 700; letter-spacing: -0.02em; }
.clock-date { color: var(--text-muted); font-size: 0.85rem; text-transform: capitalize; }

/* Écran d'ordinateur : le tiroir devient un panneau fixe, toujours visible,
   avec un état réduit (icônes seules) en plus de l'état développé —
   §5.3 du cahier des charges. Pas de bouton menu ni de fond d'estompage :
   inutiles puisque le panneau ne se superpose plus au contenu. */
@media (min-width: 900px) {
  #nav-toggle-btn { display: none; }
  .side-nav-backdrop { display: none !important; }

  .side-nav {
    top: calc(var(--topbar-h) + env(safe-area-inset-top));
    width: var(--sidenav-w);
    transform: none;
    box-shadow: none;
    padding: 14px 0;
    z-index: 15;
    transition: width 0.2s var(--ease), background-color 0.2s var(--ease), border-color 0.2s var(--ease);
  }

  .side-nav a { font-size: 0.92rem; }

  .side-nav-collapse-btn {
    display: flex;
    align-items: center;
    gap: 13px;
    margin: auto 8px 0;
    padding: 11px 22px;
    background: none;
    border: none;
    color: var(--text-muted);
    font-size: 0.82rem;
    font-weight: 500;
    cursor: pointer;
    border-radius: var(--radius-sm);
    white-space: nowrap;
  }
  .side-nav-collapse-btn:hover { background: var(--surface-alt); color: var(--text); }
  .side-nav-collapse-btn .icon { width: 1.1rem; height: 1.1rem; flex-shrink: 0; transition: transform 0.2s var(--ease); }

  .topbar { left: var(--sidenav-w); transition: left 0.2s var(--ease); }

  .content {
    margin-left: var(--sidenav-w);
    padding-bottom: 24px;
    transition: margin-left 0.2s var(--ease);
  }

  /* Panneau réduit (icônes seules), basculé depuis le bouton en bas du
     menu ; préférence propre à cet appareil (voir applyNavCollapsed en
     JS), persistée en localStorage comme le thème. */
  body.nav-collapsed .side-nav { width: 64px; }
  body.nav-collapsed .topbar { left: 64px; }
  body.nav-collapsed .content { margin-left: 64px; }
  body.nav-collapsed .nav-label { display: none; }
  body.nav-collapsed .side-nav a { justify-content: center; padding: 11px 0; margin: 1px 10px; }
  body.nav-collapsed .side-nav-collapse-btn { justify-content: center; padding: 11px 0; }
  body.nav-collapsed .side-nav-collapse-btn .icon { transform: rotate(180deg); }
}
