/* ==========================================================================
   Calendrier AdD Manosque — feuille de style unique
   Conception MOBILE FIRST : les regles de base ciblent le telephone,
   les media queries enrichissent progressivement tablette et bureau.
   La charte graphique se regle via les variables de :root (--accent...).
   ========================================================================== */

/* --- 1. Jetons de design -------------------------------------------------- */
:root {
  color-scheme: light;

  --accent: #1b6f96;
  --accent-hover: #175d7e;
  --accent-contrast: #ffffff;
  --accent-soft: #e7f1f7;
  --accent-ring: rgba(27, 111, 150, 0.35);

  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #f1f3f6;
  --text: #16191f;
  --text-muted: #646e7d;
  --text-subtle: #8b95a3;
  --border: #e4e7ec;
  --border-strong: #d3d8e0;
  --danger: #b3261e;
  --today: #b8531f;
  --holiday: #6aa987;
  --holiday-soft: #eef6f1;

  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow-md: 0 6px 24px rgba(16, 24, 40, 0.10);
  --shadow-lg: 0 18px 48px rgba(16, 24, 40, 0.18);

  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-xl: 24px;

  --space-1: 4px;
  --space-2: 8px;
  --space-3: 12px;
  --space-4: 16px;
  --space-5: 24px;
  --space-6: 32px;

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue",
          Arial, "Noto Sans", sans-serif;
  --tap: 44px;
  --header-height: 56px;
  --transition: 160ms cubic-bezier(0.2, 0, 0.2, 1);
}

/* Palette sombre, factorisee dans une regle appliquee deux fois :
   - automatiquement si le systeme est en mode sombre ;
   - explicitement si l'utilisateur a choisi le theme sombre. */
:root[data-theme="dark"] {
  color-scheme: dark;
  --accent: #58a9cd;
  --accent-hover: #74bcdb;
  --accent-contrast: #0b1016;
  --accent-soft: #14303e;
  --accent-ring: rgba(88, 169, 205, 0.45);

  --bg: #0e1116;
  --surface: #171b22;
  --surface-2: #1e242c;
  --text: #eceff4;
  --text-muted: #a2acbb;
  --text-subtle: #7c8797;
  --border: #262d37;
  --border-strong: #333c48;
  --danger: #f2b8b5;
  --today: #f0a373;
  --holiday: #5b9a78;
  --holiday-soft: #16261d;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.45);
  --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    color-scheme: dark;
    --accent: #58a9cd;
    --accent-hover: #74bcdb;
    --accent-contrast: #0b1016;
    --accent-soft: #14303e;
    --accent-ring: rgba(88, 169, 205, 0.45);

    --bg: #0e1116;
    --surface: #171b22;
    --surface-2: #1e242c;
    --text: #eceff4;
    --text-muted: #a2acbb;
    --text-subtle: #7c8797;
    --border: #262d37;
    --border-strong: #333c48;
    --danger: #f2b8b5;
    --today: #f0a373;
    --holiday: #5b9a78;
    --holiday-soft: #16261d;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
    --shadow-md: 0 6px 24px rgba(0, 0, 0, 0.45);
    --shadow-lg: 0 18px 48px rgba(0, 0, 0, 0.6);
  }
}

/* --- 2. Base -------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
  margin: 0;
  font-family: var(--font);
  font-size: 16px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}

h1, h2, h3, p, figure { margin: 0; }
button { font: inherit; color: inherit; }
img { max-width: 100%; display: block; }
a { color: var(--accent); text-decoration: underline; text-underline-offset: 2px; }

:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
  border-radius: 4px;
}

[hidden] { display: none !important; }

.skip-link {
  position: absolute;
  left: -9999px;
  top: 0;
  background: var(--surface);
  color: var(--text);
  padding: var(--space-3);
  z-index: 100;
  border-radius: 0 0 var(--radius-md) 0;
}
.skip-link:focus { left: 0; }

.icon {
  width: 20px;
  height: 20px;
  fill: none;
  stroke: currentColor;
  stroke-width: 1.8;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* --- 3. Boutons ----------------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--space-2);
  min-height: var(--tap);
  padding: 0 var(--space-4);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: var(--surface-2);
  font-weight: 550;
  cursor: pointer;
  transition: background var(--transition), border-color var(--transition),
              transform var(--transition);
}
.btn:active { transform: scale(0.98); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; }

.btn-primary { background: var(--accent); color: var(--accent-contrast); }
.btn-primary:hover:not(:disabled) { background: var(--accent-hover); }

.btn-soft { background: var(--surface); border-color: var(--border); color: var(--text); }
.btn-soft:hover { border-color: var(--border-strong); }

.btn-ghost { background: transparent; color: var(--text-muted); }
.btn-ghost:hover { background: var(--surface-2); color: var(--text); }

.btn-small { min-height: 38px; padding: 0 var(--space-3); font-size: 0.875rem; }
.btn-block { width: 100%; }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: var(--tap);
  height: var(--tap);
  border: 1px solid transparent;
  border-radius: var(--radius-md);
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.icon-btn:hover { background: var(--surface-2); color: var(--text); }

.spinner {
  width: 16px;
  height: 16px;
  border: 2px solid currentColor;
  border-right-color: transparent;
  border-radius: 50%;
  animation: spin 700ms linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* --- 4. Page de connexion ------------------------------------------------- */
.page-login {
  min-height: 100vh;
  min-height: 100dvh;
  display: grid;
  place-items: center;
  padding: var(--space-4);
  background:
    radial-gradient(120% 80% at 50% 0%, var(--accent-soft) 0%, transparent 60%),
    var(--bg);
}

.login-wrapper { width: 100%; max-width: 400px; }

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-md);
  padding: var(--space-6) var(--space-5);
  text-align: center;
}

.login-logo { margin: 0 auto var(--space-4); border-radius: var(--radius-lg); }
.login-title { font-size: 1.375rem; font-weight: 650; letter-spacing: -0.01em; }
.login-subtitle { margin-top: var(--space-2); color: var(--text-muted); font-size: 0.9375rem; }
.login-form { margin-top: var(--space-5); text-align: left; }

.field-label {
  display: block;
  margin-bottom: var(--space-2);
  font-size: 0.875rem;
  font-weight: 550;
  color: var(--text-muted);
}

.password-wrapper { position: relative; display: flex; align-items: center; }

.field-input {
  width: 100%;
  min-height: var(--tap);
  padding: 0 88px 0 var(--space-4);
  font-size: 1rem;
  color: var(--text);
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: border-color var(--transition), box-shadow var(--transition);
}
.field-input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-ring);
}

.password-toggle {
  position: absolute;
  right: var(--space-1);
  min-height: 36px;
  padding: 0 var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  cursor: pointer;
}
.password-toggle:hover { color: var(--text); }

.form-error {
  margin-top: var(--space-3);
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: color-mix(in srgb, var(--danger) 10%, transparent);
  color: var(--danger);
  font-size: 0.875rem;
}

.login-form .btn { margin-top: var(--space-4); }
.login-footer { margin-top: var(--space-5); font-size: 0.75rem; color: var(--text-subtle); }

/* --- 5. En-tete et barre d'outils ---------------------------------------- */
.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  min-height: var(--header-height);
  padding: var(--space-2) var(--space-3);
  padding-top: max(var(--space-2), env(safe-area-inset-top));
  background: color-mix(in srgb, var(--bg) 88%, transparent);
  backdrop-filter: saturate(180%) blur(12px);
  border-bottom: 1px solid var(--border);
}

.brand { display: flex; align-items: center; gap: var(--space-2); min-width: 0; }
.brand-logo { border-radius: var(--radius-sm); flex-shrink: 0; }
.brand-name {
  font-weight: 600;
  font-size: 0.875rem;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.header-actions { display: flex; align-items: center; gap: var(--space-1); }

.icon-sun { display: none; }
:root[data-theme="dark"] .icon-sun { display: block; }
:root[data-theme="dark"] .icon-moon { display: none; }
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) .icon-sun { display: block; }
  :root:not([data-theme="light"]) .icon-moon { display: none; }
}

.toolbar {
  position: sticky;
  top: var(--header-height);
  z-index: 15;
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
  padding: var(--space-3);
  background: var(--bg);
  border-bottom: 1px solid var(--border);
}

.view-switch {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}

.view-tab {
  min-height: 38px;
  border: 0;
  border-radius: calc(var(--radius-md) - 4px);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 550;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.view-tab[aria-selected="true"] {
  background: var(--surface);
  color: var(--text);
  box-shadow: var(--shadow-sm);
}

.period-bar { display: flex; align-items: center; gap: var(--space-1); }
.nav-btn { flex-shrink: 0; }
.period-label {
  flex: 1;
  min-width: 0;
  text-align: center;
  font-size: 1rem;
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* --- 6. Bandeau d'information -------------------------------------------- */
.notice {
  margin: var(--space-3) var(--space-3) 0;
  padding: var(--space-3);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--surface);
  color: var(--text-muted);
  font-size: 0.8125rem;
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.notice[data-tone="warning"] {
  border-color: color-mix(in srgb, var(--today) 40%, var(--border));
  color: var(--text);
}
.notice-action {
  margin-left: auto;
  border: 0;
  background: none;
  color: var(--accent);
  font-size: 0.8125rem;
  font-weight: 550;
  cursor: pointer;
  min-height: 32px;
  padding: 0 var(--space-2);
}

/* --- 7. Zone de vue ------------------------------------------------------- */
.view {
  padding: var(--space-3) var(--space-3) var(--space-6);
  max-width: 1080px;
  margin: 0 auto;
  outline: none;
}

.skeleton { display: grid; gap: var(--space-3); }
.skeleton-line { height: 18px; border-radius: var(--radius-sm); }
.skeleton-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-2); }
.skeleton-grid span { height: 56px; border-radius: var(--radius-md); display: block; }
.skeleton-line, .skeleton-grid span {
  background: linear-gradient(90deg, var(--surface-2), var(--surface), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s ease-in-out infinite;
}
@keyframes shimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.view-content { animation: fade-in 180ms ease-out; }
@keyframes fade-in {
  from { opacity: 0; transform: translateY(4px); }
  to { opacity: 1; transform: none; }
}

/* --- 8. Vue MOIS ---------------------------------------------------------- */
.month-weekdays {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  margin-bottom: var(--space-2);
}
.month-weekdays span {
  text-align: center;
  font-size: 0.6875rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--text-subtle);
}

.month-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 3px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  overflow: hidden;
}

.day-cell {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  min-height: 58px;
  padding: 6px 2px;
  border: 0;
  background: var(--surface);
  color: var(--text);
  font: inherit;
  cursor: pointer;
  transition: background var(--transition);
}
.day-cell:hover { background: var(--surface-2); }
.day-cell.is-outside { color: var(--text-subtle); background: var(--surface-2); }
.day-cell.is-outside .day-number { opacity: 0.55; }

.day-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 50%;
  font-size: 0.875rem;
  font-variant-numeric: tabular-nums;
}
.day-cell.is-today .day-number { background: var(--today); color: #fff; font-weight: 650; }
.day-cell.is-selected { background: var(--accent-soft); }
.day-cell.is-selected .day-number { box-shadow: 0 0 0 2px var(--accent); font-weight: 650; }

.day-dots { display: flex; gap: 3px; align-items: center; height: 6px; }
.day-dot { width: 5px; height: 5px; border-radius: 50%; background: var(--accent); }
.day-more { font-size: 0.625rem; color: var(--text-subtle); line-height: 1; }

.day-events { display: none; width: 100%; gap: 2px; flex-direction: column; }
.day-chip {
  width: 100%;
  padding: 2px 5px;
  border-radius: 5px;
  background: var(--accent-soft);
  color: var(--text);
  font-size: 0.6875rem;
  line-height: 1.35;
  text-align: left;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border-left: 2px solid var(--accent);
}
.day-chip.is-allday {
  background: var(--accent);
  color: var(--accent-contrast);
  border-left-color: var(--accent);
}

.day-agenda { margin-top: var(--space-5); }
.day-agenda-title {
  font-size: 0.9375rem;
  font-weight: 650;
  margin-bottom: var(--space-3);
}

/* --- 9. Listes d'evenements (vues semaine et agenda du jour) ------------- */
.event-list { display: flex; flex-direction: column; gap: var(--space-2); }

.event-card {
  display: flex;
  gap: var(--space-3);
  width: 100%;
  padding: var(--space-3);
  text-align: left;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  cursor: pointer;
  transition: border-color var(--transition), transform var(--transition);
}
.event-card:hover { border-color: var(--border-strong); }
.event-card:active { transform: scale(0.995); }

.event-time {
  flex-shrink: 0;
  width: 54px;
  font-size: 0.8125rem;
  font-weight: 600;
  color: var(--accent);
  font-variant-numeric: tabular-nums;
  line-height: 1.35;
}
.event-time-end { display: block; font-weight: 450; color: var(--text-subtle); }
.event-time.is-allday { font-size: 0.75rem; }

.event-main { min-width: 0; flex: 1; }
.event-title {
  font-size: 0.9375rem;
  font-weight: 550;
  line-height: 1.35;
  overflow-wrap: anywhere;
}
.event-meta {
  margin-top: 2px;
  font-size: 0.8125rem;
  color: var(--text-muted);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.week-day { margin-bottom: var(--space-5); }
.week-day-header {
  display: flex;
  align-items: baseline;
  gap: var(--space-2);
  margin-bottom: var(--space-2);
  padding-bottom: var(--space-2);
  border-bottom: 1px solid var(--border);
}
.week-day-name { font-size: 0.9375rem; font-weight: 650; }
.week-day-date { font-size: 0.8125rem; color: var(--text-subtle); }
.week-day.is-today .week-day-name { color: var(--today); }
.week-day-count { margin-left: auto; font-size: 0.75rem; color: var(--text-subtle); }

.empty-day { font-size: 0.875rem; color: var(--text-subtle); padding: var(--space-2) 0; }

/* Journée sans événement : présentation compacte (une seule ligne). */
.week-day.is-empty { margin-bottom: var(--space-3); }
.week-day.is-empty .week-day-header { margin-bottom: 0; padding-bottom: var(--space-1); }
.week-day.is-empty .week-day-name { font-weight: 550; color: var(--text-muted); }

/* --- 10. Vue TRIMESTRE ---------------------------------------------------- */
.quarter { display: flex; flex-direction: column; gap: var(--space-4); }

.quarter-month {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: var(--space-4);
  box-shadow: var(--shadow-sm);
}
.quarter-month-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-2);
  margin-bottom: var(--space-3);
}
.quarter-month-name { font-size: 1rem; font-weight: 650; }
.quarter-month-count { font-size: 0.75rem; color: var(--text-subtle); }

.mini-weekdays, .mini-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 2px;
}
.mini-weekdays span {
  text-align: center;
  font-size: 0.625rem;
  font-weight: 600;
  color: var(--text-subtle);
  padding-bottom: 4px;
}
.mini-day {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 2px;
  aspect-ratio: 1 / 1;
  min-height: 36px;
  border: 0;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  font-size: 0.8125rem;
  font-variant-numeric: tabular-nums;
  cursor: default;
  padding: 0;
}
.mini-day.has-events {
  background: var(--accent-soft);
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}
.mini-day.has-events:hover { background: color-mix(in srgb, var(--accent) 22%, var(--surface)); }
.mini-day.is-today { box-shadow: inset 0 0 0 2px var(--today); font-weight: 700; }
.mini-day.is-outside { visibility: hidden; }
.mini-dot { width: 4px; height: 4px; border-radius: 50%; background: var(--accent); }

.quarter-hint {
  font-size: 0.75rem;
  color: var(--text-subtle);
  text-align: center;
  margin-top: var(--space-3);
}

/* --- 10 bis. Vacances scolaires (affichage discret) ---------------------- */
/* Liseré fin en bas des jours de vacances : informe sans encombrer. */
.day-cell.is-holiday::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 3px;
  background: var(--holiday);
  opacity: 0.85;
}
.mini-day.is-holiday::after {
  content: "";
  position: absolute;
  left: 5px;
  right: 5px;
  bottom: 2px;
  height: 2px;
  border-radius: 2px;
  background: var(--holiday);
}

.holiday-list { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-3); }
.holiday-banner {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  width: 100%;
  min-height: 36px;
  padding: 6px var(--space-3);
  border: 0;
  border-radius: var(--radius-sm);
  background: var(--holiday-soft);
  color: var(--text-muted);
  font-size: 0.8125rem;
  text-align: left;
  cursor: pointer;
}
.holiday-banner:hover { color: var(--text); }
/* Titre complet (peut passer à la ligne) : « Vacances de la Toussaint — Zone B » */
.holiday-title { font-weight: 550; min-width: 0; line-height: 1.35; overflow-wrap: anywhere; }
.holiday-dates { margin-left: auto; flex-shrink: 0; white-space: nowrap; font-size: 0.75rem; color: var(--text-subtle); }
.holiday-swatch {
  display: inline-block;
  flex-shrink: 0;
  width: 14px;
  height: 3px;
  border-radius: 2px;
  background: var(--holiday);
}
.holiday-legend {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: var(--space-2);
  font-size: 0.75rem;
  color: var(--text-subtle);
}
.week-day.is-holiday .week-day-header { border-bottom-color: color-mix(in srgb, var(--holiday) 55%, var(--border)); }

/* --- 11. Etats vides / erreurs ------------------------------------------- */
.state {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: var(--space-3);
  padding: var(--space-6) var(--space-4);
  text-align: center;
  color: var(--text-muted);
}
.state-icon {
  width: 44px;
  height: 44px;
  display: grid;
  place-items: center;
  border-radius: 50%;
  background: var(--surface-2);
  color: var(--text-subtle);
}
.state-title { font-size: 0.9375rem; font-weight: 600; color: var(--text); }
.state-text { font-size: 0.875rem; max-width: 34ch; }

/* --- 12. Modale ----------------------------------------------------------- */
.modal {
  border: 0;
  padding: 0;
  background: transparent;
  width: 100%;
  max-width: 100%;
  max-height: 100%;
  color: var(--text);
  margin: auto auto 0;
  animation: sheet-in 220ms cubic-bezier(0.2, 0, 0.2, 1);
}
.modal::backdrop { background: rgba(10, 14, 20, 0.45); backdrop-filter: blur(2px); }
@keyframes sheet-in {
  from { transform: translateY(16px); opacity: 0; }
  to { transform: none; opacity: 1; }
}

.modal-inner {
  position: relative;
  background: var(--surface);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  box-shadow: var(--shadow-lg);
  max-height: 88dvh;
  display: flex;
  flex-direction: column;
  padding-bottom: env(safe-area-inset-bottom);
}

.modal-grabber {
  width: 36px;
  height: 4px;
  border-radius: 999px;
  background: var(--border-strong);
  margin: var(--space-2) auto 0;
}

.modal-close { position: absolute; top: 6px; right: 6px; }

.modal-body {
  padding: var(--space-4) var(--space-4) var(--space-5);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
}

.modal-kicker {
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--accent);
  padding-right: 44px;
}
.modal-title {
  margin-top: var(--space-2);
  font-size: 1.25rem;
  font-weight: 650;
  line-height: 1.3;
  letter-spacing: -0.01em;
  overflow-wrap: anywhere;
  padding-right: 44px;
}
.modal-schedule { margin-top: var(--space-2); color: var(--text-muted); font-size: 0.9375rem; }
.modal-description { margin-top: var(--space-4); }

/* --- 13. Texte riche (descriptions Google deja assainies cote serveur) --- */
.rich-text { font-size: 0.9375rem; line-height: 1.6; overflow-wrap: anywhere; }
.rich-text p { margin: 0 0 var(--space-3); }
.rich-text p:last-child { margin-bottom: 0; }
.rich-text ul, .rich-text ol { margin: 0 0 var(--space-3); padding-left: 1.25rem; }
.rich-text li { margin-bottom: var(--space-1); }
.rich-text h1, .rich-text h2, .rich-text h3,
.rich-text h4, .rich-text h5, .rich-text h6 {
  font-size: 1rem;
  font-weight: 650;
  margin: var(--space-4) 0 var(--space-2);
}
.rich-text blockquote {
  margin: 0 0 var(--space-3);
  padding-left: var(--space-3);
  border-left: 3px solid var(--border-strong);
  color: var(--text-muted);
}
.rich-text pre {
  background: var(--surface-2);
  padding: var(--space-3);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: 0.8125rem;
}
.rich-text code { font-size: 0.875em; }
.rich-text hr { border: 0; border-top: 1px solid var(--border); margin: var(--space-4) 0; }
.rich-text a { word-break: break-word; }

.empty-description { color: var(--text-subtle); font-size: 0.875rem; font-style: italic; }

/* --- 14. Pied de page ----------------------------------------------------- */
.app-footer {
  text-align: center;
  font-size: 0.6875rem;
  color: var(--text-subtle);
  padding: 0 var(--space-4) var(--space-5);
  padding-bottom: max(var(--space-5), env(safe-area-inset-bottom));
}

/* --- 14 bis. Très petits écrans (320 px) et écrans tactiles -------------- */
@media (max-width: 400px) {
  .period-label { font-size: 0.9375rem; }
  .btn-small { padding: 0 10px; font-size: 0.8125rem; }
  .view { padding-inline: var(--space-2); }
  .toolbar { padding-inline: var(--space-2); }
  .notice { margin-inline: var(--space-2); }
}

/* Sur écran tactile, les boutons secondaires restent facilement atteignables. */
@media (pointer: coarse) {
  .btn-small { min-height: 42px; }
  .view-tab { min-height: 42px; }
}

/* --- 15. Tablette --------------------------------------------------------- */
@media (min-width: 640px) {
  .app-header { padding-inline: var(--space-5); }
  .brand-name { font-size: 1rem; }

  .toolbar {
    flex-direction: row-reverse;
    align-items: center;
    justify-content: space-between;
    padding-inline: var(--space-5);
  }
  .view-switch { width: 300px; flex-shrink: 0; }
  .period-bar { flex: 1; justify-content: flex-start; }
  .period-label { flex: 0 1 auto; text-align: left; padding: 0 var(--space-3); font-size: 1.0625rem; }

  .view { padding-inline: var(--space-5); }
  .notice { margin-inline: var(--space-5); }

  .day-cell { min-height: 94px; align-items: stretch; padding: 6px; }
  .day-number { align-self: flex-start; }
  .day-dots { display: none; }
  .day-events { display: flex; }

  .quarter { flex-direction: row; align-items: flex-start; gap: var(--space-4); }
  .quarter-month { flex: 1; min-width: 0; padding: var(--space-3); }
  .mini-day { min-height: 30px; font-size: 0.75rem; }

  .modal { margin: auto; max-width: 560px; padding: var(--space-4); }
  .modal-inner { border-radius: var(--radius-xl); max-height: 82vh; }
  .modal-grabber { display: none; }
  .modal-body { padding: var(--space-5); }
}

/* --- 16. Bureau ----------------------------------------------------------- */
@media (min-width: 1024px) {
  .day-cell { min-height: 110px; }
  .week-columns { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-5); }
  .week-columns .week-day { margin-bottom: 0; }
}

/* --- 17. Preferences d'accessibilite ------------------------------------- */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.001ms !important;
  }
}

@media print {
  .app-header, .toolbar, .app-footer, .notice { display: none; }
}
