@charset "UTF-8";
/* ==========================================================================
   GESIMMO — feuille de style unique
   Tokens et règles conformes à DESIGN.md. Aucune dépendance externe.
   ========================================================================== */

/* --------------------------------------------------------------- 1. Tokens */

:root {
  color-scheme: light;

  /* Surfaces — neutres froids (hue 262), à contre-courant du bronze */
  --bg: oklch(0.985 0.002 255);
  --surface: oklch(1 0 0);
  --surface-2: oklch(0.968 0.004 255);
  --surface-3: oklch(0.945 0.006 255);
  --border: oklch(0.906 0.006 255);
  --border-strong: oklch(0.64 0.012 262);

  /* Encre */
  --ink: oklch(0.255 0.010 262);
  --ink-2: oklch(0.468 0.011 262);
  --ink-3: oklch(0.545 0.011 262);

  /* Marque */
  --brand: oklch(0.639 0.076 52.7);
  --brand-strong: oklch(0.520 0.079 49);
  --brand-deep: oklch(0.435 0.070 47);
  --brand-wash: oklch(0.639 0.076 52.7 / 0.10);
  --on-brand: oklch(1 0 0);

  /* Sémantique */
  --success: oklch(0.505 0.118 152);
  --warning: oklch(0.545 0.115 72);
  --danger: oklch(0.520 0.175 26);
  --info: oklch(0.520 0.132 255);

  /* Typographie — échelle fixe, ratio 1.125 */
  --font: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --fs-xs: 0.75rem;
  --fs-sm: 0.8125rem;
  --fs-base: 0.875rem;
  --fs-md: 1rem;
  --fs-lg: 1.125rem;
  --fs-xl: 1.375rem;
  --fs-2xl: 1.75rem;

  /* Espacement — base 4 */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-6: 24px;
  --s-8: 32px;
  --s-12: 48px;
  --s-16: 64px;

  /* Rayons */
  --r-sm: 4px;
  --r-md: 8px;
  --r-lg: 12px;

  /* Élévation — deux niveaux, jamais colorée */
  --shadow-sm: 0 1px 2px oklch(0.255 0.01 262 / 0.05), 0 1px 3px oklch(0.255 0.01 262 / 0.06);
  --shadow-md: 0 4px 6px oklch(0.255 0.01 262 / 0.07), 0 10px 20px oklch(0.255 0.01 262 / 0.08);

  /* Motion */
  --ease: cubic-bezier(0.22, 1, 0.36, 1);
  --t-state: 150ms;
  --t-reveal: 200ms;

  /* Empilement sémantique */
  --z-dropdown: 100;
  --z-sticky: 200;
  --z-backdrop: 300;
  --z-modal: 400;
  --z-toast: 500;
  --z-tooltip: 600;

  --sidebar-w: 260px;
}

[data-theme="dark"] {
  color-scheme: dark;

  --bg: oklch(0.178 0.010 262);
  --surface: oklch(0.222 0.011 262);
  --surface-2: oklch(0.152 0.010 262);
  --surface-3: oklch(0.262 0.012 262);
  --border: oklch(0.310 0.013 262);
  --border-strong: oklch(0.53 0.014 262);

  --ink: oklch(0.960 0.003 262);
  --ink-2: oklch(0.770 0.010 262);
  --ink-3: oklch(0.688 0.012 262);

  --brand: oklch(0.760 0.080 58);
  --brand-strong: oklch(0.760 0.080 58);
  --brand-deep: oklch(0.830 0.070 60);
  --brand-wash: oklch(0.760 0.080 58 / 0.14);
  --on-brand: oklch(0.178 0.010 262);

  --success: oklch(0.760 0.120 155);
  --warning: oklch(0.812 0.120 80);
  --danger: oklch(0.712 0.150 25);
  --info: oklch(0.750 0.110 255);

  --shadow-sm: 0 1px 2px oklch(0 0 0 / 0.30), 0 1px 3px oklch(0 0 0 / 0.28);
  --shadow-md: 0 4px 6px oklch(0 0 0 / 0.34), 0 10px 20px oklch(0 0 0 / 0.36);
}

/* ----------------------------------------------------------- 2. Fondations */

*,
*::before,
*::after { box-sizing: border-box; }

/* Un display explicite (inline-flex sur .btn) l'emporte sinon sur le
   display:none que l'agent utilisateur applique à [hidden]. */
[hidden] { display: none !important; }

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

body {
  margin: 0;
  font-family: var(--font);
  font-size: var(--fs-base);
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0; font-weight: 600; line-height: 1.25; text-wrap: balance; }
p { margin: 0; }
a { color: var(--brand-strong); text-decoration-thickness: 1px; text-underline-offset: 2px; }
img, svg { max-width: 100%; display: block; }
button, input, select, textarea { font: inherit; color: inherit; }

/* Chiffres comparables verticalement — voir DESIGN.md § Typography */
.num, td.num, th.num, .montant, time, .ref {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum" 1;
}
.num, td.num, th.num { text-align: right; }

:focus-visible {
  outline: 2px solid var(--brand-strong);
  outline-offset: 2px;
  border-radius: var(--r-sm);
}

.saut-contenu {
  position: absolute;
  left: -9999px;
  top: var(--s-2);
  z-index: var(--z-tooltip);
  padding: var(--s-2) var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
}
.saut-contenu:focus { left: var(--s-2); }

.visuellement-cache {
  position: absolute;
  width: 1px; height: 1px;
  padding: 0; margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* ------------------------------------------------------------- 3. App shell */

.appli {
  display: grid;
  grid-template-columns: var(--sidebar-w) minmax(0, 1fr);
  min-height: 100vh;
}

/* ---- Sidebar */

.barre-laterale {
  grid-column: 1;
  background: var(--surface-2);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  overscroll-behavior: contain;
}

.marque {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-4);
  border-bottom: 1px solid var(--border);
  text-decoration: none;
  color: inherit;
}
.marque__logo {
  width: 34px; height: 34px;
  display: grid; place-items: center;
  background: var(--brand-wash);
  border-radius: var(--r-md);
  flex: none;
}
.marque__logo svg { width: 20px; height: 20px; color: var(--brand-strong); }
.marque__nom { font-weight: 600; font-size: var(--fs-md); letter-spacing: -0.01em; }
.marque__meta { font-size: var(--fs-xs); color: var(--ink-3); }

.nav { padding: var(--s-4) var(--s-3) var(--s-8); flex: 1; }
.nav__groupe + .nav__groupe { margin-top: var(--s-6); }
.nav__titre {
  font-size: var(--fs-xs);
  font-weight: 500;
  color: var(--ink-3);
  padding: 0 var(--s-3) var(--s-2);
  margin: 0;
}
.nav__liste { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }

.nav__lien {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-2) var(--s-3);
  border-radius: var(--r-md);
  color: var(--ink-2);
  text-decoration: none;
  font-size: var(--fs-base);
  transition: background-color var(--t-state) var(--ease), color var(--t-state) var(--ease);
}
.nav__lien svg { width: 17px; height: 17px; flex: none; opacity: 0.85; }
.nav__lien:hover { background: var(--surface-3); color: var(--ink); }
.nav__lien[aria-current="page"] {
  background: var(--brand-wash);
  color: var(--brand-strong);
  font-weight: 500;
}
.nav__lien[aria-current="page"] svg { opacity: 1; }

/* Écrans non encore repris : visibles mais inertes, pour montrer la portée restante */
.nav__lien--attente {
  color: var(--ink-3);
  cursor: not-allowed;
  opacity: 0.72;
}
.nav__lien--attente:hover { background: none; color: var(--ink-3); }
.nav__attente {
  margin-left: auto;
  font-size: 10px;
  letter-spacing: 0.02em;
  padding: 2px var(--s-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--ink-3);
}

.barre-laterale__pied {
  padding: var(--s-3);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--s-2);
}

/* ---- Topbar */

.principal { grid-column: 2; min-width: 0; display: flex; flex-direction: column; }

.barre-haute {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  display: flex;
  align-items: center;
  gap: var(--s-4);
  padding: var(--s-3) var(--s-6);
  background: var(--surface);
  border-bottom: 1px solid var(--border);
}

.recherche { position: relative; flex: 1; max-width: 420px; }
.recherche svg {
  position: absolute; left: 10px; top: 50%; transform: translateY(-50%);
  width: 16px; height: 16px; color: var(--ink-3); pointer-events: none;
}
.recherche input {
  width: 100%;
  height: 36px;
  padding: 0 var(--s-3) 0 34px;
  background: var(--bg);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-md);
  transition: border-color var(--t-state) var(--ease);
}
.recherche input::placeholder { color: var(--ink-3); }
.recherche input:hover { border-color: var(--ink-3); }

.barre-haute__actions { margin-left: auto; display: flex; align-items: center; gap: var(--s-2); }

.utilisateur { display: flex; align-items: center; gap: var(--s-3); padding-left: var(--s-3); border-left: 1px solid var(--border); }
.utilisateur__nom { font-size: var(--fs-sm); font-weight: 500; line-height: 1.2; }
.utilisateur__role { font-size: var(--fs-xs); color: var(--ink-3); line-height: 1.2; }

.pastille {
  width: 32px; height: 32px;
  flex: none;
  display: grid; place-items: center;
  border-radius: 50%;
  background: var(--brand-wash);
  color: var(--brand-strong);
  font-size: var(--fs-xs);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.pastille--lg { width: 44px; height: 44px; font-size: var(--fs-base); }

.contenu { padding: var(--s-6); max-width: 1600px; width: 100%; flex: 1; }

/* Bouton d'ouverture du tiroir — masqué au-dessus de 1024px */
.ouvre-menu { display: none; }

/* ------------------------------------------------------------ 4. En-têtes */

.entete-page {
  display: flex;
  align-items: flex-start;
  gap: var(--s-4);
  flex-wrap: wrap;
  margin-bottom: var(--s-6);
}
.entete-page__titre { font-size: var(--fs-xl); letter-spacing: -0.015em; }
.entete-page__sous { color: var(--ink-2); font-size: var(--fs-sm); margin-top: 2px; }
.entete-page__actions { margin-left: auto; display: flex; gap: var(--s-2); flex-wrap: wrap; }

.fil { display: flex; gap: var(--s-2); align-items: center; font-size: var(--fs-sm); color: var(--ink-3); margin-bottom: var(--s-2); }
.fil a { color: var(--ink-2); text-decoration: none; }
.fil a:hover { text-decoration: underline; }

/* ------------------------------------------------------------- 5. Boutons */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: var(--s-2);
  height: 36px;
  padding: 0 var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: var(--fs-base);
  font-weight: 500;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: background-color var(--t-state) var(--ease),
              border-color var(--t-state) var(--ease),
              color var(--t-state) var(--ease);
}
.btn svg { width: 16px; height: 16px; flex: none; }

.btn--primaire { background: var(--brand-strong); color: var(--on-brand); }
.btn--primaire:hover { background: var(--brand-deep); }
.btn--primaire:active { background: var(--brand-deep); }

.btn--secondaire { background: var(--surface); color: var(--ink); border-color: var(--border-strong); }
.btn--secondaire:hover { background: var(--surface-3); }

.btn--fantome { background: transparent; color: var(--ink-2); }
.btn--fantome:hover { background: var(--surface-3); color: var(--ink); }

.btn--danger { background: var(--danger); color: oklch(1 0 0); }
.btn--danger:hover { filter: brightness(0.92); }

.btn--icone { width: 36px; padding: 0; }

.btn[disabled], .btn[aria-disabled="true"] {
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}
.btn[data-chargement="1"] { pointer-events: none; opacity: 0.7; }

/* --------------------------------------------------------- 6. Panneaux */

.panneau {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
}
.panneau__tete {
  display: flex;
  align-items: center;
  gap: var(--s-3);
  padding: var(--s-4) var(--s-4);
  border-bottom: 1px solid var(--border);
}
.panneau__titre { font-size: var(--fs-lg); letter-spacing: -0.01em; }
.panneau__tete .btn { margin-left: auto; }
.panneau__corps { padding: var(--s-4); }
.panneau__pied {
  padding: var(--s-3) var(--s-4);
  border-top: 1px solid var(--border);
  display: flex;
  align-items: center;
  gap: var(--s-3);
  font-size: var(--fs-sm);
  color: var(--ink-2);
  flex-wrap: wrap;
}

/* ------------------------------------------------------------ 7. Repères */

/* Bande de repères du tableau de bord : chaque valeur est cliquable et mène
   à l'écran qui permet d'agir dessus (cf. PRODUCT.md, principe 1). */
.reperes {
  display: grid;
  /* 300px : six repères tombent en 3+3 sur desktop, 2+2+2 en tablette,
     plutôt qu'en 5+1 déséquilibré. */
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: var(--s-3);
  margin-bottom: var(--s-6);
}
.repere {
  display: block;
  padding: var(--s-4);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  text-decoration: none;
  color: inherit;
  transition: border-color var(--t-state) var(--ease), background-color var(--t-state) var(--ease);
}
a.repere:hover { border-color: var(--border-strong); background: var(--surface-3); }
/* Ces trois éléments sont des <span> : sans display:block ils se suivraient
   sur une même ligne au lieu de s'empiler. */
.repere__label,
.repere__valeur,
.repere__note { display: block; }

.repere__label { font-size: var(--fs-sm); color: var(--ink-2); }
.repere__valeur {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  margin-top: var(--s-1);
  font-variant-numeric: tabular-nums;
}
.repere__unite {
  display: inline;      /* l'unité reste collée au chiffre */
  font-size: var(--fs-sm);
  font-weight: 500;
  color: var(--ink-2);
  margin-left: 2px;
}
.repere__note { font-size: var(--fs-xs); color: var(--ink-3); margin-top: var(--s-1); }
.repere__note--alerte { color: var(--danger); }

/* -------------------------------------------------------- 8. Jauge simple */

.jauge {
  display: block;       /* <span> : sans cela, height serait ignoré */
  height: 6px;
  background: var(--surface-3);
  border-radius: 999px;
  overflow: hidden;
  margin-top: var(--s-2);
}
.jauge__part {
  display: block;       /* <span> : idem, sinon la barre reste vide */
  height: 100%;
  background: var(--brand-strong);
  border-radius: 999px;
}
.jauge__part--succes { background: var(--success); }
.jauge__part--alerte { background: var(--danger); }

/* Répartition horizontale légendée (occupation par résidence) */
.barres { display: grid; gap: var(--s-3); }
.barre__tete { display: flex; gap: var(--s-3); align-items: baseline; font-size: var(--fs-sm); }
.barre__nom { font-weight: 500; }
.barre__val { margin-left: auto; color: var(--ink-2); font-variant-numeric: tabular-nums; }

/* --------------------------------------------------------- 9. Tableaux */

.tableau-enveloppe { overflow-x: auto; }

.tableau { width: 100%; border-collapse: collapse; font-size: var(--fs-sm); }
.tableau caption { text-align: left; padding: 0 0 var(--s-3); color: var(--ink-2); font-size: var(--fs-sm); }
/* Ciblé sur thead : un <th scope="row"> dans le corps est une cellule de
   données, il ne doit hériter ni du fond ni du collage en haut. */
.tableau thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  text-align: left;
  font-weight: 500;
  color: var(--ink-2);
  background: var(--surface-3);
  padding: var(--s-3) var(--s-4);
  white-space: nowrap;
  border-bottom: 1px solid var(--border);
}
.tableau thead th.num { text-align: right; }

.tableau td,
.tableau tbody th {
  padding: var(--s-3) var(--s-4);
  border-bottom: 1px solid var(--border);
  line-height: 1.35;
  vertical-align: middle;
}
.tableau tbody th { text-align: left; font-weight: 500; }
.tableau tbody tr { transition: background-color var(--t-state) var(--ease); }
.tableau tbody tr:hover { background: var(--surface-3); }
.tableau tbody tr:last-child td,
.tableau tbody tr:last-child th { border-bottom: 0; }
.tableau a { color: var(--ink); text-decoration: none; font-weight: 500; }
.tableau a:hover { color: var(--brand-strong); text-decoration: underline; }
.tableau .secondaire { color: var(--ink-3); font-size: var(--fs-xs); display: block; margin-top: 1px; }

.cellule-identite { display: flex; align-items: center; gap: var(--s-3); }

/* ------------------------------------------------------------ 10. Badges */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px var(--s-2);
  border-radius: var(--r-sm);
  font-size: var(--fs-xs);
  font-weight: 500;
  white-space: nowrap;
  border: 1px solid;
}
.badge::before {
  content: "";
  width: 5px; height: 5px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
/* La couleur ne porte jamais seule l'information : le mot reste dans le HTML. */
.badge--neutre  { color: var(--ink-2);  background: var(--surface-3); border-color: var(--border); }
.badge--succes  { color: var(--success); background: color-mix(in oklch, var(--success) 12%, transparent); border-color: color-mix(in oklch, var(--success) 30%, transparent); }
.badge--alerte  { color: var(--warning); background: color-mix(in oklch, var(--warning) 12%, transparent); border-color: color-mix(in oklch, var(--warning) 30%, transparent); }
.badge--danger  { color: var(--danger);  background: color-mix(in oklch, var(--danger) 12%, transparent);  border-color: color-mix(in oklch, var(--danger) 30%, transparent); }
.badge--info    { color: var(--info);    background: color-mix(in oklch, var(--info) 12%, transparent);    border-color: color-mix(in oklch, var(--info) 30%, transparent); }
.badge--marque  { color: var(--brand-strong); background: var(--brand-wash); border-color: color-mix(in oklch, var(--brand) 30%, transparent); }

/* ------------------------------------------------- 11. Filtres & pagination */

.filtres {
  display: flex;
  gap: var(--s-3);
  align-items: flex-end;
  flex-wrap: wrap;
  padding: var(--s-4);
  border-bottom: 1px solid var(--border);
}
.filtres .champ { margin: 0; min-width: 170px; }
/* Le champ de recherche prend l'espace libre ; les listes déroulantes gardent
   leur largeur naturelle. */
.filtres .champ:has(input[type="search"]) { flex: 1 1 260px; max-width: 380px; }
.filtres__fin { margin-left: auto; display: flex; gap: var(--s-2); align-items: flex-end; }

.pagination { display: flex; gap: var(--s-1); align-items: center; margin-left: auto; }
.pagination a, .pagination span {
  min-width: 32px; height: 32px;
  padding: 0 var(--s-2);
  display: grid; place-items: center;
  border-radius: var(--r-sm);
  font-size: var(--fs-sm);
  text-decoration: none;
  color: var(--ink-2);
  font-variant-numeric: tabular-nums;
  transition: background-color var(--t-state) var(--ease);
}
.pagination a:hover { background: var(--surface-3); color: var(--ink); }
.pagination [aria-current="page"] { background: var(--brand-wash); color: var(--brand-strong); font-weight: 600; }
.pagination .ellipse { color: var(--ink-3); }

/* ---------------------------------------------------------- 12. Formulaires */

.form-grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
  gap: var(--s-4);
}
.form-grille--large { grid-column: 1 / -1; }

.champ { display: grid; gap: 6px; }
.champ__label { font-size: var(--fs-sm); font-weight: 500; color: var(--ink-2); }
.champ__label .requis { color: var(--danger); margin-left: 2px; }

.champ input,
.champ select,
.champ textarea {
  width: 100%;
  min-height: 38px;
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-md);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: border-color var(--t-state) var(--ease), box-shadow var(--t-state) var(--ease);
}
.champ textarea { min-height: 84px; resize: vertical; line-height: 1.5; }
.champ input::placeholder, .champ textarea::placeholder { color: var(--ink-3); }
.champ input:hover, .champ select:hover, .champ textarea:hover { border-color: var(--ink-3); }
.champ input:disabled, .champ select:disabled {
  background: var(--surface-3);
  color: var(--ink-3);
  cursor: not-allowed;
}
.champ__aide { font-size: var(--fs-xs); color: var(--ink-3); }

.champ--erreur input, .champ--erreur select, .champ--erreur textarea { border-color: var(--danger); }
.champ__erreur { font-size: var(--fs-xs); color: var(--danger); display: flex; gap: 5px; align-items: center; }

.form-section + .form-section { margin-top: var(--s-8); }
.form-section__titre {
  font-size: var(--fs-base);
  font-weight: 600;
  padding-bottom: var(--s-2);
  margin-bottom: var(--s-4);
  border-bottom: 1px solid var(--border);
}
.form-actions {
  display: flex;
  gap: var(--s-3);
  align-items: center;
  margin-top: var(--s-8);
  padding-top: var(--s-4);
  border-top: 1px solid var(--border);
}
.form-actions .annuler { margin-left: auto; }

/* -------------------------------------------------------------- 13. Alertes */

.alerte {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) var(--s-4);
  border-radius: var(--r-md);
  border: 1px solid;
  font-size: var(--fs-base);
  margin-bottom: var(--s-4);
}
.alerte svg { width: 18px; height: 18px; flex: none; margin-top: 1px; }
.alerte--success { color: var(--success); background: color-mix(in oklch, var(--success) 10%, var(--surface)); border-color: color-mix(in oklch, var(--success) 28%, transparent); }
.alerte--danger  { color: var(--danger);  background: color-mix(in oklch, var(--danger) 10%, var(--surface));  border-color: color-mix(in oklch, var(--danger) 28%, transparent); }
.alerte--info    { color: var(--info);    background: color-mix(in oklch, var(--info) 10%, var(--surface));    border-color: color-mix(in oklch, var(--info) 28%, transparent); }
.alerte strong { color: var(--ink); }

/* ---------------------------------------------------------- 14. État vide */

.vide {
  padding: var(--s-16) var(--s-6);
  text-align: center;
  max-width: 46ch;
  margin: 0 auto;
}
.vide__icone {
  width: 40px; height: 40px;
  margin: 0 auto var(--s-4);
  display: grid; place-items: center;
  border-radius: var(--r-md);
  background: var(--surface-3);
  color: var(--ink-3);
}
.vide__icone svg { width: 20px; height: 20px; }
.vide__titre { font-size: var(--fs-lg); margin-bottom: var(--s-2); }
.vide__texte { color: var(--ink-2); margin-bottom: var(--s-6); text-wrap: pretty; }

/* --------------------------------------------------------- 15. Fiche détail */

.detail {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr);
  gap: var(--s-6);
  align-items: start;
}

.donnees { display: grid; gap: var(--s-4); }
.donnee { display: grid; gap: 2px; }
.donnee__label { font-size: var(--fs-xs); color: var(--ink-3); }
.donnee__valeur { font-size: var(--fs-base); }
.donnee__valeur--forte { font-size: var(--fs-lg); font-weight: 600; font-variant-numeric: tabular-nums; }

.donnees--paires {
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: var(--s-4) var(--s-6);
}

/* --------------------------------------------------------- 16. Connexion */

.page-connexion {
  min-height: 100vh;
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
}
.connexion__forme {
  display: grid;
  place-items: center;
  padding: var(--s-6);
  background: var(--bg);
}
.connexion__boite { width: 100%; max-width: 380px; }
.connexion__marque { display: flex; align-items: center; gap: var(--s-3); margin-bottom: var(--s-8); }
.connexion__titre { font-size: var(--fs-xl); letter-spacing: -0.015em; }
.connexion__sous { color: var(--ink-2); font-size: var(--fs-sm); margin-top: var(--s-1); margin-bottom: var(--s-6); }
.connexion__champs { display: grid; gap: var(--s-4); }
.connexion__forme .btn { width: 100%; height: 42px; margin-top: var(--s-2); }

/* Panneau latéral : aplat de marque, aucune photo — chargement nul */
.connexion__aside {
  background: var(--brand-deep);
  color: oklch(1 0 0);
  padding: var(--s-16) var(--s-12);
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: var(--s-4);
  position: relative;
  overflow: hidden;
}
.connexion__aside h2 {
  font-size: var(--fs-2xl);
  font-weight: 600;
  letter-spacing: -0.02em;
  max-width: 18ch;
}
.connexion__aside p { color: oklch(1 0 0 / 0.82); max-width: 42ch; }
.connexion__toits {
  position: absolute;
  inset: auto -40px 45% -40px;
  opacity: 0.14;
  color: oklch(1 0 0);
}
.connexion__pied { font-size: var(--fs-xs); color: var(--ink-3); margin-top: var(--s-8); }

/* ------------------------------------------------------- 17. Tiroir mobile */

dialog.tiroir {
  padding: 0;
  border: 0;
  margin: 0;
  height: 100dvh;
  max-height: 100dvh;
  width: min(var(--sidebar-w), 84vw);
  max-width: 84vw;
  margin-right: auto;
  background: var(--surface-2);
  color: var(--ink);
  overflow: visible;
}
dialog.tiroir::backdrop { background: oklch(0.178 0.01 262 / 0.5); }
dialog.tiroir .barre-laterale { height: 100dvh; position: static; border-right: 0; }

/* ------------------------------------------------------------- 18. Divers */

.pile { display: grid; gap: var(--s-6); }
.rangee { display: flex; gap: var(--s-3); align-items: center; flex-wrap: wrap; }
.grille-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--s-6); }
.muet { color: var(--ink-2); }
.discret { color: var(--ink-3); font-size: var(--fs-sm); }
.mono { font-variant-numeric: tabular-nums; }

.activite { list-style: none; margin: 0; padding: 0; display: grid; }
.activite li {
  display: flex;
  gap: var(--s-3);
  padding: var(--s-3) 0;
  border-bottom: 1px solid var(--border);
  font-size: var(--fs-sm);
}
.activite li:last-child { border-bottom: 0; }
.activite time { color: var(--ink-3); font-size: var(--fs-xs); margin-left: auto; white-space: nowrap; }

/* ---------------------------------------------------------- 19. Responsive */

@media (max-width: 1024px) {
  .appli { grid-template-columns: minmax(0, 1fr); }
  .barre-laterale:not(.tiroir .barre-laterale) { display: none; }
  .principal { grid-column: 1; }
  .ouvre-menu { display: inline-flex; }
  .contenu { padding: var(--s-4); }
  .barre-haute { padding: var(--s-3) var(--s-4); }
  .detail { grid-template-columns: minmax(0, 1fr); }
}

@media (max-width: 860px) {
  /* Repli structurel : chaque ligne devient une fiche libellé/valeur.
     Jamais de défilement horizontal — cf. PRODUCT.md principe 4. */
  .tableau--repliable thead { display: none; }
  .tableau--repliable,
  .tableau--repliable tbody,
  .tableau--repliable tr,
  .tableau--repliable td,
  .tableau--repliable tbody th { display: block; width: 100%; }
  .tableau--repliable tr {
    border: 1px solid var(--border);
    border-radius: var(--r-md);
    padding: var(--s-2) var(--s-3);
    margin-bottom: var(--s-3);
    background: var(--surface);
  }
  .tableau--repliable tr:hover { background: var(--surface); }
  .tableau--repliable td {
    border: 0;
    padding: var(--s-2) 0;
    display: flex;
    gap: var(--s-4);
    align-items: baseline;
    text-align: left;
  }
  .tableau--repliable td + td { border-top: 1px dashed var(--border); }

  /* Le <th> de ligne devient le titre de la fiche empilée. */
  .tableau--repliable tbody th {
    border: 0;
    padding: var(--s-2) 0;
    font-size: var(--fs-base);
    font-weight: 600;
  }
  .tableau--repliable td::before {
    content: attr(data-label);
    flex: none;
    width: 42%;
    color: var(--ink-3);
    font-size: var(--fs-xs);
  }
  .tableau--repliable td.num { text-align: left; justify-content: flex-start; }
  .tableau--repliable td[data-label=""]::before { display: none; }

  /* La mention secondaire passe sous la valeur principale plutôt que de
     s'aligner à côté d'elle. */
  .tableau--repliable td { flex-wrap: wrap; }
  .tableau--repliable td > .secondaire {
    flex: 0 0 100%;
    /* 42% du libellé + la gouttière, pour tomber pile sous la valeur */
    margin-left: calc(42% + var(--s-4));
    margin-top: 2px;
  }

  .page-connexion { grid-template-columns: minmax(0, 1fr); }
  .connexion__aside { display: none; }

  /* Cibles tactiles sur les vues terrain */
  .btn { height: 44px; }
  .champ input, .champ select, .champ textarea { min-height: 44px; }
}

@media (max-width: 620px) {
  .entete-page__actions { width: 100%; margin-left: 0; }
  .entete-page__actions .btn { flex: 1; }
  .filtres { flex-direction: column; align-items: stretch; }
  .filtres__fin { margin-left: 0; }
  /* En colonne, flex-basis porterait sur la hauteur : le champ de recherche
     deviendrait une boîte de 260px de haut. */
  .filtres .champ,
  .filtres .champ:has(input[type="search"]) { flex: none; max-width: none; }
  .utilisateur__texte { display: none; }
}

/* -------------------------------------------------------- 20. Mouvement */

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
    scroll-behavior: auto !important;
  }
  dialog.tiroir { animation: none !important; }
}

@media (prefers-reduced-motion: no-preference) {
  dialog.tiroir[open] { animation: tiroir-entre var(--t-reveal) var(--ease); }
  @keyframes tiroir-entre {
    from { transform: translateX(-100%); }
    to   { transform: translateX(0); }
  }
}

/* ------------------------------------------------------------ 21. Impression */

@media print {
  .barre-laterale, .barre-haute, .entete-page__actions, .pagination, .filtres { display: none !important; }
  .appli { grid-template-columns: 1fr; }
  .panneau { border: 0; box-shadow: none; }
  .tableau th { background: transparent; border-bottom: 2px solid #000; }
  body { background: #fff; }
}

/* ------------------------------------------------ 22. Pièce imprimable */
/* Quittance, reçu, proforma : document remis à un tiers, pensé pour le A4. */

.document {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-sm);
  max-width: 820px;
  padding: var(--s-8);
}
.document__tete {
  display: flex;
  justify-content: space-between;
  gap: var(--s-6);
  flex-wrap: wrap;
  padding-bottom: var(--s-4);
  border-bottom: 2px solid var(--brand-strong);
}
.document__emetteur { font-size: var(--fs-lg); font-weight: 600; letter-spacing: -0.01em; }
.document__meta { font-size: var(--fs-sm); color: var(--ink-2); }
.document__reference { text-align: right; }
.document__type {
  font-size: var(--fs-sm);
  font-weight: 600;
  color: var(--brand-strong);
}
.document__reference .mono { font-size: var(--fs-lg); font-weight: 600; }

.document__corps { padding: var(--s-6) 0; }
.document__phrase {
  line-height: 1.7;
  max-width: 68ch;
  text-wrap: pretty;
  margin-bottom: var(--s-8);
}

.document__grille {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: var(--s-4) var(--s-6);
  margin: 0 0 var(--s-8);
}
.document__grille dt { font-size: var(--fs-xs); color: var(--ink-3); margin-bottom: 2px; }
.document__grille dd { margin: 0; font-size: var(--fs-base); }

.document__montant {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: var(--s-4);
  padding: var(--s-4);
  background: var(--surface-3);
  border-radius: var(--r-sm);
}
.document__montant strong {
  font-size: var(--fs-xl);
  font-variant-numeric: tabular-nums;
}

.document__pied {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: var(--s-6);
  flex-wrap: wrap;
  padding-top: var(--s-6);
  border-top: 1px solid var(--border);
}
.document__signature {
  text-align: center;
  font-size: var(--fs-sm);
  color: var(--ink-2);
  padding-top: var(--s-12);
  border-top: 1px dotted var(--border-strong);
  min-width: 220px;
}

@media print {
  .document { border: 0; box-shadow: none; padding: 0; max-width: none; }
  .fil, .document + p { display: none !important; }
}

/* ------------------------------------------------ 23. Planning d'occupation */
/* Grille jour × lot. Les séjours contigus sont fusionnés en une cellule via
   colspan, ce qui les fait lire comme des barres continues. */

.planning { border-collapse: collapse; font-size: var(--fs-xs); width: 100%; }
.planning th, .planning td { border: 1px solid var(--border); }

.planning__lot {
  position: sticky;
  left: 0;
  z-index: 2;
  background: var(--surface);
  text-align: left;
  font-weight: 500;
  padding: var(--s-2) var(--s-3);
  min-width: 190px;
  font-size: var(--fs-sm);
}
.planning thead .planning__lot { background: var(--surface-3); z-index: 3; }
.planning__lot a { color: var(--ink); text-decoration: none; }
/* .secondaire n'est stylé que sous .tableau : le planning a sa propre table. */
.planning__lot .secondaire {
  display: block;
  color: var(--ink-3);
  font-size: var(--fs-xs);
  font-weight: 400;
  margin-top: 1px;
}
.planning__lot a:hover { color: var(--brand-strong); text-decoration: underline; }

.planning__jour {
  background: var(--surface-3);
  padding: var(--s-2) 0;
  width: 30px;
  min-width: 30px;
  text-align: center;
  font-weight: 500;
  color: var(--ink-2);
  line-height: 1.2;
}
.planning__dow { display: block; font-size: 10px; color: var(--ink-3); }
.planning__num { display: block; font-variant-numeric: tabular-nums; }
.planning__jour--we { color: var(--ink-3); }
.planning__jour--today {
  background: var(--brand-wash);
  color: var(--brand-strong);
  box-shadow: inset 0 -2px 0 var(--brand-strong);
}

.planning__case { height: 34px; background: var(--surface); }
.planning__case--we { background: var(--surface-2); }

.planning__sejour { padding: 2px; }
.planning__sejour a {
  display: block;
  border-radius: var(--r-sm);
  padding: 4px 6px;
  text-decoration: none;
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  border: 1px solid;
  transition: filter var(--t-state) var(--ease);
}
.planning__sejour a:hover { filter: brightness(0.95); }

.planning__sejour--alerte a { color: var(--warning); background: color-mix(in oklch, var(--warning) 14%, var(--surface)); border-color: color-mix(in oklch, var(--warning) 34%, transparent); }
.planning__sejour--info a   { color: var(--info);    background: color-mix(in oklch, var(--info) 14%, var(--surface));    border-color: color-mix(in oklch, var(--info) 34%, transparent); }
.planning__sejour--succes a { color: var(--success); background: color-mix(in oklch, var(--success) 14%, var(--surface)); border-color: color-mix(in oklch, var(--success) 34%, transparent); }
.planning__sejour--neutre a { color: var(--ink-2);   background: var(--surface-3); border-color: var(--border); }

.legende {
  display: flex;
  gap: var(--s-4);
  list-style: none;
  margin: 0 0 0 auto;
  padding: 0;
  flex-wrap: wrap;
  font-size: var(--fs-xs);
  color: var(--ink-2);
}
.legende li { display: flex; align-items: center; gap: 6px; }
.legende__puce { width: 10px; height: 10px; border-radius: 3px; border: 1px solid; flex: none; }
.legende__puce--alerte { background: color-mix(in oklch, var(--warning) 30%, transparent); border-color: var(--warning); }
.legende__puce--info   { background: color-mix(in oklch, var(--info) 30%, transparent);    border-color: var(--info); }
.legende__puce--succes { background: color-mix(in oklch, var(--success) 30%, transparent); border-color: var(--success); }
.legende__puce--neutre { background: var(--surface-3); border-color: var(--border-strong); }

/* Le planning est la seule vue qui garde un défilement horizontal assumé :
   un calendrier replié en fiches ne veut rien dire. */
@media (max-width: 860px) {
  .planning__lot { min-width: 140px; }
}

/* --------------------------------------- 24. Contrôle de saisie en tableau */
/* Feuille de pointage, lignes de bon : le champ occupe sa cellule sans
   reprendre la structure verticale de .champ. */

.saisie {
  width: 100%;
  min-height: 36px;
  padding: var(--s-2) var(--s-3);
  font-size: var(--fs-base);
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  transition: border-color var(--t-state) var(--ease);
}
.saisie:hover { border-color: var(--ink-3); }
.saisie:disabled { background: var(--surface-3); color: var(--ink-3); cursor: not-allowed; }

@media (max-width: 860px) {
  .saisie { min-height: 44px; }
}
