/* ==========================================================================
   NAYAM — feuille de style
   Design system minimal, sans dependance externe (fonctionne hors ligne).
   ========================================================================== */

:root {
  --teal-50: #f0fdfa;
  --teal-100: #ccfbf1;
  --teal-200: #99f6e4;
  --teal-500: #14b8a6;
  --teal-600: #0d9488;
  --teal-700: #0f766e;
  --teal-800: #115e59;
  --slate-50: #f8fafc;
  --slate-100: #f1f5f9;
  --slate-200: #e2e8f0;
  --slate-300: #cbd5e1;
  --slate-400: #94a3b8;
  --slate-500: #64748b;
  --slate-600: #475569;
  --slate-700: #334155;
  --slate-800: #1e293b;
  --slate-900: #0f172a;
  --amber-100: #fef3c7;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --red-50: #fef2f2;
  --red-100: #fee2e2;
  --red-500: #ef4444;
  --red-600: #dc2626;
  --green-50: #f0fdf4;
  --green-500: #22c55e;
  --green-600: #16a34a;
  --blue-50: #eff6ff;
  --blue-500: #3b82f6;
  --blue-600: #2563eb;
  --purple-500: #8b5cf6;
  --radius: 10px;
  --radius-lg: 16px;
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.1);
  --shadow: 0 4px 6px -1px rgba(15, 23, 42, 0.1), 0 2px 4px -2px rgba(15, 23, 42, 0.06);
  --shadow-lg: 0 10px 15px -3px rgba(15, 23, 42, 0.1), 0 4px 6px -4px rgba(15, 23, 42, 0.05);
  --header-height: 60px;
  --sidebar-width: 248px;
}

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

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

body {
  margin: 0;
  font-family: 'Segoe UI', system-ui, -apple-system, 'Helvetica Neue', Arial, sans-serif;
  font-size: 15px;
  line-height: 1.55;
  color: var(--slate-800);
  background: var(--slate-100);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { margin: 0 0 0.5rem; line-height: 1.25; font-weight: 650; }
h1 { font-size: 1.5rem; }
h2 { font-size: 1.2rem; }
h3 { font-size: 1.05rem; }
p { margin: 0 0 0.75rem; }
a { color: var(--teal-700); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; height: auto; }

/* ------------------------------------------------------------------ layout */

.app-shell { min-height: 100vh; display: flex; flex-direction: column; }

.app-header {
  position: sticky; top: 0; z-index: 40;
  height: var(--header-height);
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0 1rem;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-800));
  color: #fff;
  box-shadow: var(--shadow);
}
.app-header .brand { display: flex; align-items: center; gap: 0.6rem; color: #fff; font-weight: 700; font-size: 1.05rem; }
.app-header .brand:hover { text-decoration: none; }
.app-header .brand-mark { width: 30px; height: 30px; flex: none; }
.app-header .spacer { flex: 1; }
.app-header .header-actions { display: flex; align-items: center; gap: 0.35rem; }

.app-body { flex: 1; display: flex; min-height: 0; }

.app-sidebar {
  width: var(--sidebar-width); flex: none;
  background: #fff; border-right: 1px solid var(--slate-200);
  padding: 1rem 0.75rem; display: flex; flex-direction: column; gap: 0.25rem;
}
.app-main { flex: 1; padding: 1.25rem; min-width: 0; max-width: 100%; }

/* --------------------------------------------------------------- navigation */

.nav-item {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.6rem 0.75rem; border-radius: var(--radius);
  color: var(--slate-700); font-weight: 500; font-size: 0.94rem;
  cursor: pointer; border: 0; background: none; width: 100%; text-align: left;
}
.nav-item:hover { background: var(--slate-100); text-decoration: none; }
.nav-item.active { background: var(--teal-50); color: var(--teal-800); font-weight: 650; }
.nav-item .nav-icon { width: 22px; height: 22px; flex: none; }
.nav-item .nav-icon svg { display: block; width: 100%; height: 100%; }
.nav-item .nav-badge {
  margin-left: auto; background: var(--red-500); color: #fff;
  font-size: 0.72rem; font-weight: 700; padding: 0.1rem 0.4rem; border-radius: 999px;
}

/* ------------------------------------------------------------------ controls */

.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem;
  padding: 0.5rem 0.9rem; border-radius: var(--radius);
  border: 1px solid var(--slate-300); background: #fff; color: var(--slate-700);
  font-size: 0.9rem; font-weight: 550; cursor: pointer; white-space: nowrap;
  transition: background 0.12s, border-color 0.12s, transform 0.06s;
}
.btn:hover { background: var(--slate-50); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: 0.55; cursor: not-allowed; }
.btn-primary { background: var(--teal-700); border-color: var(--teal-700); color: #fff; }
.btn-primary:hover { background: var(--teal-800); }
.btn-danger { background: var(--red-600); border-color: var(--red-600); color: #fff; }
.btn-danger:hover { background: #b91c1c; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: rgba(255, 255, 255, 0.14); }
.btn-sm { padding: 0.32rem 0.6rem; font-size: 0.82rem; }
.btn-block { width: 100%; }

/* Bouton en ICONE SEULE (micro, trombone) : le libelle n'est plus affiche mais
   reste annonce par `title` et `aria-label`. La cible tactile est conservee. */
.btn-icon { padding: 0.34rem 0.5rem; font-size: 1rem; line-height: 1; min-width: 2.3rem; }
/* Icone SVG en ligne : elle herite de la couleur du bouton (`currentColor`) et
   ne participe pas au flux du texte. */
.icon { display: block; flex: none; }
/* Icone agrandie : vignette de media et lien de document. */
.icon-lg { width: 28px; height: 28px; stroke-width: 1.6; }
/* Vignette d'une piece jointe non affichable (PDF, tableur, archive) : elle
   remplace l'ancien emoji et occupe la meme hauteur que les apercus voisins. */
.media-placeholder { height: 96px; display: flex; align-items: center; justify-content: center; color: var(--slate-400); }
/* Boutons en icones alignes dans une colonne d'actions : sans cet ecart, deux
   icones voisines se touchent et la corbeille devient difficile a viser. */
td.actions .btn-icon + .btn-icon { margin-left: 0.3rem; }
/* Enregistrement en cours : le micro passe au rouge, comme sur un magnetophone. */
.btn-icon.rec-active { background: var(--red-600); border-color: var(--red-600); color: #fff; }

input, select, textarea {
  width: 100%; padding: 0.55rem 0.7rem;
  border: 1px solid var(--slate-300); border-radius: var(--radius);
  font-size: 0.94rem; font-family: inherit; color: var(--slate-800); background: #fff;
}
input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--teal-500); outline-offset: -1px; border-color: var(--teal-500);
}
textarea { resize: vertical; min-height: 90px; }
label { display: block; font-size: 0.85rem; font-weight: 600; color: var(--slate-600); margin-bottom: 0.25rem; }
.field { margin-bottom: 0.85rem; }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 0.75rem; }
.hint { font-size: 0.78rem; color: var(--slate-500); margin-top: 0.2rem; }
.checkbox-line { display: flex; align-items: center; gap: 0.5rem; }
/* Un choix n est pas un champ de saisie : la regle generale `input { width: 100% }`
   etirerait une case a cocher ou un bouton radio sur toute la largeur, et la
   case se retrouverait a des centaines de pixels de son libelle. */
.checkbox-line input[type="radio"],
.checkbox-line input[type="checkbox"] { width: auto; flex: none; }

/* --- Groupes de choix (bulletin d indicateurs) -----------------------------
   `fieldset` apporte le regroupement SEMANTIQUE (un lecteur d ecran annonce
   « Zone du vol, groupe de 2 »), mais ses styles par defaut — bordure, marges,
   retrait — ne conviennent pas ici : on les neutralise. */
.ind-group { border: 0; padding: 0; margin: 0 0 0.85rem; min-width: 0; }
.ind-group > legend {
  padding: 0; margin-bottom: 0.35rem;
  font-size: 0.85rem; font-weight: 600; color: var(--slate-600);
}
.checkbox-stack { display: flex; flex-direction: column; gap: 0.4rem; }
/* Les libelles de choix restent en graisse normale : le libelle du CHAMP porte
   deja l accent, tous les mettre en gras rendrait l ensemble illisible. */
.checkbox-stack .checkbox-line label { font-weight: 400; color: var(--slate-700); margin-bottom: 0; }

/* Le bulletin est long (18 champs) : deux colonnes sur grand ecran evitent un
   defilement interminable, une seule sur telephone. Le champ « Impacts de la
   crise » occupe toute la largeur (voir `.ind-wide`). */
@media (min-width: 700px) {
  #ind-fields { display: grid; grid-template-columns: 1fr 1fr; gap: 0 1rem; align-content: start; }
  #ind-fields .ind-wide { grid-column: 1 / -1; }
}

/* -------------------------------------------------------------------- cards */

.card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); }
.card-pad { padding: 1.1rem; }
.card-head {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  padding: 0.85rem 1.1rem; border-bottom: 1px solid var(--slate-200);
}
.card-head h2 { margin: 0; font-size: 1.05rem; }
.card-head .spacer { flex: 1; }

.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: 0.85rem; margin-bottom: 1.1rem; }
.stat-card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 0.85rem 1rem; }
.stat-card .stat-label { font-size: 0.78rem; color: var(--slate-500); text-transform: uppercase; letter-spacing: 0.03em; font-weight: 600; }
.stat-card .stat-value { font-size: 1.6rem; font-weight: 700; color: var(--slate-800); line-height: 1.2; }
.stat-card.alert .stat-value { color: var(--red-600); }
.stat-card.ok .stat-value { color: var(--green-600); }

/* ------------------------------------------------------------------- tables */

.table-wrap { overflow-x: auto; }
table.data { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
table.data th, table.data td { padding: 0.6rem 0.7rem; text-align: left; border-bottom: 1px solid var(--slate-200); vertical-align: middle; }
table.data th { background: var(--slate-50); font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.03em; color: var(--slate-500); font-weight: 700; white-space: nowrap; }
table.data tbody tr:hover { background: var(--teal-50); }
table.data td.actions { white-space: nowrap; text-align: right; }
.empty-cell { text-align: center; color: var(--slate-500); padding: 1.5rem !important; }

/* -------------------------------------------------------------------- badges */

.badge {
  display: inline-flex; align-items: center; gap: 0.25rem;
  padding: 0.12rem 0.5rem; border-radius: 999px;
  font-size: 0.75rem; font-weight: 650; white-space: nowrap;
}
.badge-open { background: var(--blue-50); color: var(--blue-600); }
.badge-assigned { background: var(--amber-100); color: var(--amber-600); }
.badge-in_progress { background: #ede9fe; color: #6d28d9; }
.badge-resolved { background: var(--green-50); color: var(--green-600); }
.badge-closed { background: var(--slate-100); color: var(--slate-500); }
.badge-priority-low { background: var(--slate-100); color: var(--slate-500); }
.badge-priority-normal { background: var(--blue-50); color: var(--blue-600); }
.badge-priority-high { background: var(--amber-100); color: var(--amber-600); }
.badge-priority-urgent { background: var(--red-100); color: var(--red-600); }
.badge-role { background: var(--teal-50); color: var(--teal-800); }
.badge-merged { background: #f3e8ff; color: #7e22ce; }
.badge-ok { background: var(--green-50); color: var(--green-600); }
.badge-fail { background: var(--red-100); color: var(--red-600); }
.badge-pending { background: var(--slate-100); color: var(--slate-500); }
.badge-public { background: rgba(255, 255, 255, 0.2); color: #fff; font-size: 0.7rem; }

/* -------------------------------------------------------------- ticket list */

.ticket-list { display: flex; flex-direction: column; }
.ticket-row {
  display: grid; grid-template-columns: auto 1fr auto; gap: 0.5rem 0.85rem;
  align-items: center; padding: 0.75rem 1rem; border-bottom: 1px solid var(--slate-200);
  cursor: pointer; background: #fff;
}
.ticket-row:hover { background: var(--teal-50); }
.ticket-row.unread { background: var(--teal-50); }
.ticket-row-main { min-width: 0; }
.ticket-row-top { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.ticket-ref { font-family: ui-monospace, 'SF Mono', Menlo, monospace; font-size: 0.8rem; color: var(--slate-500); }
.ticket-contact { font-weight: 650; }
.ticket-subject { color: var(--slate-600); font-size: 0.88rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ticket-row-meta { display: flex; align-items: center; gap: 0.4rem; flex-wrap: wrap; justify-content: flex-end; }
.avatar {
  width: 38px; height: 38px; border-radius: 999px; flex: none;
  display: flex; align-items: center; justify-content: center;
  background: var(--teal-100); color: var(--teal-800); font-weight: 700; font-size: 0.85rem;
}
.avatar.sm { width: 30px; height: 30px; font-size: 0.75rem; }
.unread-dot { width: 9px; height: 9px; border-radius: 999px; background: var(--red-500); flex: none; }

/* ------------------------------------------------------------ ticket detail */

.thread { display: flex; flex-direction: column; gap: 0.6rem; padding: 1rem; max-height: 60vh; overflow-y: auto; background: var(--slate-50); }
.msg { max-width: 78%; display: flex; flex-direction: column; gap: 0.2rem; }
.msg-inbound { align-self: flex-start; }
.msg-outbound { align-self: flex-end; align-items: flex-end; }
.msg-bubble {
  padding: 0.55rem 0.8rem; border-radius: 14px; box-shadow: var(--shadow-sm);
  background: #fff; border: 1px solid var(--slate-200); word-wrap: break-word; overflow-wrap: anywhere;
}
.msg-outbound .msg-bubble { background: var(--teal-100); border-color: var(--teal-200); }
.msg-meta { font-size: 0.72rem; color: var(--slate-500); display: flex; gap: 0.4rem; align-items: center; flex-wrap: wrap; }
.msg-system { align-self: center; font-size: 0.78rem; color: var(--slate-500); background: var(--slate-100); padding: 0.2rem 0.6rem; border-radius: 999px; }
.msg-media img, .msg-media video { border-radius: 10px; max-height: 320px; display: block; }
.msg-media audio { width: 260px; max-width: 100%; }
.msg-media .doc-link { display: flex; align-items: center; gap: 0.5rem; font-size: 0.88rem; }
.msg-status { font-size: 0.7rem; }
.msg-status.failed { color: var(--red-600); }
.msg-status.sent { color: var(--green-600); }

.composer { border-top: 1px solid var(--slate-200); padding: 0.85rem 1rem; background: #fff; }
.composer-row { display: flex; gap: 0.5rem; align-items: flex-end; }
.composer textarea { min-height: 46px; max-height: 160px; }
.window-alert {
  display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap;
  background: var(--amber-100); color: #92400e; border-radius: var(--radius);
  padding: 0.5rem 0.75rem; font-size: 0.84rem; margin-bottom: 0.6rem;
}
.window-ok {
  background: var(--green-50); color: var(--green-600);
}

/* ------------------------------------------------------------------- modals */

.modal-backdrop {
  position: fixed; inset: 0; background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 100; padding: 1rem;
}
.modal {
  background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  width: 100%; max-width: 560px; max-height: 90vh; overflow-y: auto;
}
.modal.wide { max-width: 760px; }
.modal-head { display: flex; align-items: center; gap: 0.75rem; padding: 1rem 1.1rem; border-bottom: 1px solid var(--slate-200); }
.modal-head h2 { margin: 0; font-size: 1.1rem; }
.modal-head .spacer { flex: 1; }
.modal-body { padding: 1.1rem; }
.modal-foot { display: flex; justify-content: flex-end; gap: 0.5rem; padding: 0.85rem 1.1rem; border-top: 1px solid var(--slate-200); background: var(--slate-50); border-radius: 0 0 var(--radius-lg) var(--radius-lg); }

/* ------------------------------------------------------------------ alerts */

.alert { border-radius: var(--radius); padding: 0.7rem 0.9rem; font-size: 0.88rem; margin-bottom: 0.85rem; border: 1px solid transparent; }
.alert-error { background: var(--red-50); color: #991b1b; border-color: var(--red-100); }
.alert-success { background: var(--green-50); color: #166534; border-color: #bbf7d0; }
.alert-info { background: var(--blue-50); color: #1e40af; border-color: #bfdbfe; }
.alert-warn { background: var(--amber-100); color: #92400e; border-color: #fcd34d; }

.toast-stack { position: fixed; bottom: 1rem; right: 1rem; z-index: 200; display: flex; flex-direction: column; gap: 0.5rem; max-width: 360px; }
.toast { background: var(--slate-900); color: #fff; padding: 0.65rem 0.9rem; border-radius: var(--radius); box-shadow: var(--shadow-lg); font-size: 0.88rem; }
.toast.error { background: var(--red-600); }
.toast.success { background: var(--green-600); }
/* Avertissement : la notification est PARTIE, mais pas sous la forme du
   modele choisi (repli en texte libre). Sans cette variante, le message
   s'afficherait en gris neutre et passerait pour une info anodine. */
.toast.warn { background: var(--amber-600); }

/* -------------------------------------------------------------------- login */

.login-wrap { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 1.25rem; background: linear-gradient(160deg, var(--teal-800), var(--slate-900)); }
.login-card { background: #fff; border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); width: 100%; max-width: 400px; padding: 1.75rem; }
.login-brand { display: flex; flex-direction: column; align-items: center; gap: 0.4rem; margin-bottom: 1.25rem; text-align: center; }
.login-brand img { width: 56px; height: 56px; }
.login-brand h1 { font-size: 1.3rem; margin: 0; }
.login-brand p { color: var(--slate-500); font-size: 0.88rem; margin: 0; }
.login-foot { margin-top: 1rem; text-align: center; font-size: 0.82rem; color: var(--slate-500); }

/* ------------------------------------------------------------- public page */

.public-body { background: var(--slate-50); }
.public-topbar {
  display: flex; align-items: center; gap: 0.75rem; padding: 0.75rem 1.25rem;
  background: linear-gradient(135deg, var(--teal-700), var(--teal-800)); color: #fff;
  position: sticky; top: 0; z-index: 20;
}
.public-topbar .brand { color: #fff; font-weight: 700; }
.public-topbar .badge-public { margin-left: auto; }
.public-main { max-width: 820px; margin: 0 auto; padding: 1.5rem 1.25rem 3rem; }
.page-header { background: #fff; border-radius: var(--radius-lg); padding: 1.5rem; box-shadow: var(--shadow-sm); margin-bottom: 1.75rem; border: 1px solid var(--slate-200); }
.page-title { font-size: 1.7rem; margin-bottom: 0.5rem; }
.page-summary { color: var(--slate-600); font-size: 1rem; }
.page-meta { display: flex; gap: 1rem; font-size: 0.82rem; color: var(--slate-500); flex-wrap: wrap; margin-top: 0.5rem; }
.page-header-content { margin-top: 1rem; padding-top: 1rem; border-top: 1px solid var(--slate-200); }
.page-header-content img { border-radius: var(--radius); }

/* Bandeau d'administration des pages publiques.
   Il n'est rendu par le serveur QUE pour un visiteur connecte disposant des
   droits sur la page consultee : un simple visiteur ne recoit pas ce balisage,
   d'ou l'absence de regle de masquage. */
.admin-bar {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  background: var(--teal-800); color: #fff;
  border-radius: var(--radius-lg); padding: 0.7rem 0.95rem;
  margin-bottom: 1.1rem; box-shadow: var(--shadow-sm);
}
.admin-bar-who { display: inline-flex; align-items: center; gap: 0.45rem; font-size: 0.85rem; }
.admin-bar-dot {
  width: 8px; height: 8px; border-radius: 999px;
  background: var(--teal-200); box-shadow: 0 0 0 3px rgba(153, 246, 228, 0.25);
}
.admin-bar-edit {
  margin-left: auto; display: inline-flex; align-items: center; gap: 0.35rem;
  background: #fff; color: var(--teal-800); font-weight: 600; font-size: 0.85rem;
  text-decoration: none; border-radius: 999px; padding: 0.35rem 0.85rem;
}
.admin-bar-edit:hover { background: var(--teal-50); }

.timeline { position: relative; padding-left: 1.75rem; }
.timeline::before { content: ''; position: absolute; left: 7px; top: 6px; bottom: 6px; width: 2px; background: var(--slate-200); }
.entry { position: relative; margin-bottom: 1.5rem; }
.entry-marker { position: absolute; left: -1.75rem; top: 0.45rem; width: 16px; height: 16px; border-radius: 999px; background: var(--teal-600); border: 3px solid var(--slate-50); box-shadow: 0 0 0 2px var(--teal-200); }
.entry-head { display: flex; align-items: baseline; gap: 0.6rem; flex-wrap: wrap; margin-bottom: 0.35rem; }
.entry-date { font-weight: 700; color: var(--teal-800); font-size: 0.92rem; }
.entry-author { font-size: 0.8rem; color: var(--slate-500); }
.entry-card { background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-lg); padding: 1.1rem; box-shadow: var(--shadow-sm); }
.entry-title { margin-bottom: 0.5rem; }
.entry-content { color: var(--slate-700); }
.entry-content img { border-radius: var(--radius); }

/* Lien « Enregistrer un commentaire » sous chaque publication publique.
   Il n'est rendu par le serveur que si le visiteur presente une session. */
.entry-actions { margin-top: 0.6rem; }
.entry-comment-link {
  display: inline-flex; align-items: center; gap: 0.35rem;
  font-size: 0.85rem; font-weight: 600; color: var(--teal-700);
  text-decoration: none; border: 1px solid var(--teal-200);
  background: var(--teal-50); border-radius: 999px; padding: 0.28rem 0.7rem;
}
.entry-comment-link:hover { background: var(--teal-100); }

.media-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 0.85rem; margin-top: 0.85rem; }
.media { margin: 0; }
.media img, .media video { width: 100%; border-radius: var(--radius); display: block; background: var(--slate-900); }
.media audio { width: 100%; }
.media-caption { font-size: 0.82rem; color: var(--slate-500); margin-top: 0.3rem; }
.media-document .doc-link { display: flex; align-items: center; gap: 0.7rem; padding: 0.85rem; border: 1px solid var(--slate-200); border-radius: var(--radius); background: var(--slate-50); }
.media-document .doc-icon { color: var(--slate-500); }
.media-image { grid-column: span 1; }
.public-footer { text-align: center; padding: 1.5rem; color: var(--slate-500); font-size: 0.82rem; }

.empty-state { text-align: center; padding: 2.5rem 1rem; color: var(--slate-500); }
.empty-state h1 { color: var(--slate-700); }

/* ------------------------------------------------------------- misc / utils */

.row { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.row.tight { gap: 0.3rem; }
.spacer { flex: 1; }
.muted { color: var(--slate-500); }
.small { font-size: 0.82rem; }
.mono { font-family: ui-monospace, 'SF Mono', Menlo, monospace; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mb-2 { margin-bottom: 1rem; }
.text-right { text-align: right; }
.hidden { display: none !important; }
.spin { display: inline-block; width: 15px; height: 15px; border: 2px solid rgba(255,255,255,0.4); border-top-color: #fff; border-radius: 999px; animation: spin 0.7s linear infinite; }
.spin.dark { border-color: rgba(15,23,42,0.2); border-top-color: var(--slate-700); }
@keyframes spin { to { transform: rotate(360deg); } }

.skeleton { background: linear-gradient(90deg, var(--slate-200) 25%, var(--slate-100) 50%, var(--slate-200) 75%); background-size: 200% 100%; animation: shimmer 1.3s ease-in-out infinite; border-radius: var(--radius); height: 1rem; }
@keyframes shimmer { 0% { background-position: 200% 0; } 100% { background-position: -200% 0; } }

.lang-switch { display: inline-flex; border: 1px solid rgba(255,255,255,0.35); border-radius: 999px; overflow: hidden; }
.lang-switch button { background: none; border: 0; color: #fff; padding: 0.25rem 0.6rem; font-size: 0.78rem; font-weight: 650; cursor: pointer; }
.lang-switch button.active { background: rgba(255,255,255,0.22); }

.tabs { display: flex; gap: 0.25rem; border-bottom: 1px solid var(--slate-200); margin-bottom: 1rem; overflow-x: auto; }
.tab { padding: 0.5rem 0.85rem; border: 0; background: none; cursor: pointer; font-size: 0.9rem; font-weight: 600; color: var(--slate-500); border-bottom: 2px solid transparent; white-space: nowrap; }
.tab.active { color: var(--teal-700); border-bottom-color: var(--teal-600); }

.perm-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0.75rem; }
.perm-group { border: 1px solid var(--slate-200); border-radius: var(--radius); padding: 0.7rem; }
.perm-group h4 { font-size: 0.85rem; color: var(--slate-600); margin-bottom: 0.4rem; }
.perm-item { display: flex; align-items: flex-start; gap: 0.4rem; font-size: 0.82rem; font-weight: 400; color: var(--slate-700); margin-bottom: 0.2rem; text-transform: none; }
.perm-item input { width: auto; margin-top: 0.2rem; }

.media-thumb-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 0.6rem; margin-top: 0.5rem; }
.media-thumb { position: relative; border: 1px solid var(--slate-200); border-radius: var(--radius); overflow: hidden; background: var(--slate-50); }
.media-thumb img, .media-thumb video { width: 100%; height: 96px; object-fit: cover; display: block; }
.media-thumb .thumb-label { padding: 0.3rem 0.4rem; font-size: 0.72rem; color: var(--slate-600); display: flex; align-items: center; gap: 0.3rem; }
.media-thumb .thumb-remove { position: absolute; top: 4px; right: 4px; background: rgba(15,23,42,0.75); color: #fff; border: 0; border-radius: 999px; width: 22px; height: 22px; cursor: pointer; font-size: 0.8rem; line-height: 1; }

.dropzone { border: 2px dashed var(--slate-300); border-radius: var(--radius); padding: 1rem; text-align: center; color: var(--slate-500); font-size: 0.85rem; cursor: pointer; }
.dropzone:hover, .dropzone.dragover { border-color: var(--teal-500); background: var(--teal-50); color: var(--teal-800); }

.online-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--green-500); }
.offline-dot { width: 8px; height: 8px; border-radius: 999px; background: var(--slate-400); }

.copy-field { display: flex; gap: 0.4rem; align-items: center; }
.copy-field input { font-size: 0.82rem; font-family: ui-monospace, Menlo, monospace; }

/* --------------------------------------------------------------- config -- */

.cred-row {
  border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 0.7rem 0.8rem; margin-bottom: 0.6rem; background: var(--slate-50);
}
.cred-head { display: flex; align-items: center; gap: 0.45rem; flex-wrap: wrap; }
.cred-head strong { font-size: 0.85rem; }
.cred-row input[type="password"] { font-family: ui-monospace, Menlo, monospace; font-size: 0.82rem; }
.cred-row input:disabled, .cred-row input[readonly] { background: var(--slate-100); color: var(--slate-500); }

.sep { border: 0; border-top: 1px solid var(--slate-200); margin: 1.1rem 0; }

/* ------------------------------------------------------------- responsive */

@media (max-width: 900px) {
  :root { --sidebar-width: 100%; }
  .app-body { flex-direction: column; }
  .app-sidebar {
    width: 100%; flex-direction: row; overflow-x: auto; gap: 0.3rem;
    padding: 0.5rem; border-right: 0; border-bottom: 1px solid var(--slate-200);
    position: sticky; top: var(--header-height); z-index: 30;
  }
  .nav-item { width: auto; flex: none; font-size: 0.85rem; padding: 0.45rem 0.65rem; }
  .nav-item .nav-label { display: none; }
  /* Les libelles disparaissent : l icone seule porte la rubrique, elle
     reprend donc un peu de taille. */
  .nav-item .nav-icon { width: 26px; height: 26px; }
  .app-main { padding: 0.85rem; }
  .field-row { grid-template-columns: 1fr; }
  .msg { max-width: 92%; }
  .thread { max-height: none; }
}

@media (min-width: 901px) {
  .nav-item .nav-label { display: inline; }
}

@media print {
  .app-header, .app-sidebar, .btn, .composer { display: none !important; }
}

/* ------------------------------------------------------ identite visuelle -- */
/* Logo de la plateforme (remplacable depuis la page Configuration). L'image
   televersee est un JPEG sans transparence : sur les fonds colores (en-tete de
   l'application, barre des pages publiques) il est presente dans une pastille
   blanche arrondie, sinon il apparaitrait comme un carre blanc sur le degrade. */
.app-header .brand-mark {
  width: 32px; height: 32px; flex: none; object-fit: contain;
  background: #fff; border-radius: 9px; padding: 2px;
}
.login-brand img {
  width: 76px; height: 76px; object-fit: contain;
  background: #fff; border-radius: 16px; padding: 4px;
  border: 1px solid var(--slate-200);
}
.public-topbar .brand { display: flex; align-items: center; gap: 0.6rem; }
.public-topbar .brand-logo {
  width: 34px; height: 34px; flex: none; object-fit: contain;
  background: #fff; border-radius: 9px; padding: 2px;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.2; }
.brand-name { font-weight: 700; }
.brand-tagline { font-weight: 400; font-size: 0.72rem; opacity: 0.85; }
.public-footer .brand-tagline { opacity: 1; color: var(--slate-500); margin: 0.15rem 0 0; }

/* Apercu du logo dans la page Configuration. */
.logo-preview {
  display: flex; align-items: center; gap: 0.75rem; flex-wrap: wrap;
  border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 0.7rem 0.8rem; background: var(--slate-50);
}
.logo-preview img {
  width: 64px; height: 64px; flex: none; object-fit: contain;
  background: #fff; border: 1px solid var(--slate-200); border-radius: 10px; padding: 4px;
}
.logo-preview .logo-meta { font-size: 0.8rem; color: var(--slate-600); }
/* ---------------------------------------------------------- rapports ------ */
/* Styles du menu Rapports : huit sections, bandeau de filtres colle en haut de
   la zone de contenu, graphiques en SVG et en CSS purs. Aucune dependance
   externe : l application doit rester utilisable hors ligne. */

/* ----------------------------------------------------------------- en-tete */
.rp-head {
  display: flex; align-items: flex-end; gap: 0.5rem;
  margin-bottom: 1rem; flex-wrap: wrap;
}
.rp-head h1 { font-size: 1.5rem; margin: 0; }
.h-period { color: var(--slate-500); font-weight: 500; }
.crumbs { font-size: 0.8rem; color: var(--slate-500); margin-bottom: 0.15rem; }
.crumbs span { margin: 0 0.3rem; }
.crumbs span:first-child { margin-left: 0; }

/* ------------------------------------------------------------- barre collee */
/* Le bandeau reste colle sous l en-tete pendant le defilement : regler la
   periode dans une page de huit sections obligeait sinon a remonter tout en
   haut. Le fond opaque est indispensable, sinon le texte defilerait dessous. */
.rp-sticky {
  position: sticky; top: calc(var(--header-height) + 0.5rem); z-index: 20;
  background: var(--slate-100); padding-bottom: 0.35rem;
}

/* Sommaire des huit sections, en bandeau horizontal. */
.rp-sticky .subnav { display: flex; flex-wrap: wrap; gap: 0.3rem; margin: 0 0 0.6rem; padding: 0; }
.rp-sticky .subnav-item {
  border: 0; background: none; font-family: inherit;
  font-size: 0.86rem; font-weight: 550; color: var(--slate-600);
  padding: 0.35rem 0.7rem; border-radius: 999px; cursor: pointer;
}
.rp-sticky .subnav-item:hover { background: var(--slate-200); color: var(--slate-800); }
.rp-sticky .subnav-item.active { background: #fff; color: var(--teal-800); box-shadow: var(--shadow-sm); }

/* ------------------------------------------------------------------ filtres */
.filters { padding: 0.9rem 1rem 0.7rem; margin-bottom: 1.1rem; }
/* Cinq colonnes : le mode de periode, ses bornes, puis la cascade territoriale.
   Les listes s alignent meme quand les libelles n ont pas la meme longueur. */
.f-row {
  display: grid; align-items: end; gap: 0.75rem;
  grid-template-columns: auto minmax(190px, 1.2fr) repeat(3, minmax(120px, 1fr));
}
/* Les bornes libres demandent plus de place que le couple mois + annee. */
.f-row.is-range { grid-template-columns: auto minmax(280px, 1.5fr) repeat(3, minmax(110px, 1fr)); }
.f-row2 {
  grid-template-columns: repeat(2, minmax(150px, 220px));
  margin-top: 0.7rem; padding-top: 0.7rem; border-top: 1px dashed var(--slate-200);
}
.f-group { min-width: 0; }
.f-group label { margin-bottom: 0.25rem; }
/* Hauteur commune aux listes et au selecteur segmente : sans elle, les colonnes
   alignees sur la ligne de base ne se touchent pas. */
.f-row select, .f-row input, .f-row2 select { height: 2.25rem; padding: 0.4rem 0.55rem; font-size: 0.88rem; }
.f-period .row { flex-wrap: nowrap; }
.f-period .row input { flex: 1; min-width: 0; width: auto; padding: 0.4rem 0.4rem; }

/* Selecteur segmente (une seule valeur possible). */
.seg {
  display: inline-flex; background: var(--slate-100); border-radius: var(--radius);
  padding: 3px; gap: 2px; height: 2.25rem;
}
.seg button {
  border: 0; background: none; font-family: inherit; font-size: 0.86rem; font-weight: 550;
  color: var(--slate-600); padding: 0 0.8rem; border-radius: 7px; cursor: pointer; white-space: nowrap;
}
.seg button.on { background: #fff; color: var(--teal-800); box-shadow: var(--shadow-sm); }
.seg.sm { height: 2rem; }
.seg.sm button { font-size: 0.8rem; padding: 0 0.6rem; }

/* Stepper de periode : deux fleches encadrant le mois et l annee. */
.stepper { display: flex; gap: 0.35rem; align-items: center; }
.stepper select { flex: 1; min-width: 0; }

.f-foot {
  display: flex; align-items: center; gap: 0.75rem;
  margin-top: 0.8rem; flex-wrap: wrap; font-size: 0.86rem;
}
.f-count { color: var(--slate-600); }
.f-count strong { color: var(--slate-900); font-size: 1rem; }

/* Interrupteur a bascule, en CSS pur : aucune image, aucun script. */
.toggle {
  display: inline-flex; align-items: center; gap: 0.5rem;
  text-transform: none; letter-spacing: 0; font-size: 0.86rem; font-weight: 500;
  color: var(--slate-700); margin: 0; cursor: pointer;
}
.toggle input { position: absolute; opacity: 0; width: 0; height: 0; }
.tg {
  width: 32px; height: 18px; border-radius: 999px; background: var(--slate-300);
  position: relative; transition: background 0.15s; flex: none;
}
.tg::after {
  content: ''; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px;
  border-radius: 999px; background: #fff; transition: left 0.15s;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2);
}
.toggle input:checked + .tg { background: var(--teal-700); }
.toggle input:checked + .tg::after { left: 16px; }
.toggle input:focus-visible + .tg { outline: 2px solid var(--teal-500); outline-offset: 2px; }

/* Puces des filtres poses : chacune se retire d un clic. */
.chips { display: flex; gap: 0.35rem; flex-wrap: wrap; }
.chip {
  display: inline-flex; align-items: center; gap: 0.25rem;
  background: var(--teal-50); color: var(--teal-800); border: 1px solid var(--teal-200);
  border-radius: 999px; padding: 0.12rem 0.25rem 0.12rem 0.6rem;
  font-size: 0.8rem; font-weight: 550;
}
.chip button {
  border: 0; background: none; color: inherit; cursor: pointer;
  padding: 0.15rem; border-radius: 999px; display: flex;
}
.chip button:hover { background: var(--teal-100); }

/* Boutons secondaires propres a la vue. */
.btn-ghost-dark { border-color: transparent; background: transparent; color: var(--slate-600); }
.btn-ghost-dark:hover { background: var(--slate-200); }
/* Un bouton secondaire qui porte un etat actif (filtres avances ouverts). */
.btn.on { background: var(--teal-50); border-color: var(--teal-200); color: var(--teal-800); }

/* ------------------------------------------------------------------ sections */
.rp-section { margin-bottom: 2rem; scroll-margin-top: 6rem; }
.rp-sec-title {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 1.15rem; margin: 0 0 0.8rem; padding-top: 1.4rem;
  border-top: 1px solid var(--slate-200);
}
/* Un trait vertical marque le debut de section sans ajouter de mise en page. */
.rp-sec-title::before { content: ''; width: 4px; height: 1.1em; background: var(--teal-700); border-radius: 2px; }

/* ------------------------------------------------------------------- grille */
.grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 1rem; }
.span-2 { grid-column: span 2; }
.span-3 { grid-column: 1 / -1; }
.stack { display: flex; flex-direction: column; gap: 1rem; }
.stack .panel { flex: 1; }

.panel {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm); padding: 1rem 1.1rem 1.1rem; min-width: 0;
}
.panel-head {
  display: flex; align-items: flex-start; justify-content: space-between;
  gap: 0.75rem; margin-bottom: 0.85rem;
}
.panel-head h3 { font-size: 1rem; margin: 0; }
.panel-hint { font-size: 0.8rem; color: var(--slate-500); margin: 0.15rem 0 0; }

/* ---------------------------------------------------------------------- KPI */
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 1rem; }
.kpi {
  background: #fff; border: 1px solid var(--slate-200); border-radius: var(--radius);
  padding: 0.85rem 1rem; box-shadow: var(--shadow-sm);
}
/* Hauteur de libelle reservee : sans elle, une carte a libelle court remonte
   son chiffre et les six cartes ne sont plus alignees. */
.kpi-label {
  font-size: 0.75rem; color: var(--slate-500); text-transform: uppercase;
  letter-spacing: 0.03em; font-weight: 600; min-height: 2.1em; line-height: 1.35;
}
.kpi-value {
  font-size: 1.85rem; font-weight: 700; color: var(--slate-900); line-height: 1.15;
  font-variant-numeric: tabular-nums; margin-top: 0.15rem;
}
.kpi-suffix { font-size: 1rem; font-weight: 600; color: var(--slate-500); }
.kpi-warm .kpi-value { color: var(--amber-600); }
.kpi-hot .kpi-value { color: var(--red-600); }
.kpi-good .kpi-value { color: var(--teal-700); }
.kpi-foot {
  display: flex; gap: 0.45rem; align-items: center; flex-wrap: wrap;
  margin-top: 0.3rem; font-size: 0.78rem; min-height: 1.3em;
}
.kpi-prev { color: var(--slate-400); }
.kpi-sub { color: var(--slate-500); }
.delta {
  font-weight: 700; font-size: 0.74rem; padding: 0.05rem 0.4rem;
  border-radius: 999px; white-space: nowrap; font-variant-numeric: tabular-nums;
}
.delta.good { background: var(--green-50); color: var(--green-600); }
.delta.bad { background: var(--red-50); color: var(--red-600); }
.delta.flat { background: var(--slate-100); color: var(--slate-500); }

/* ------------------------------------------------------------------- barres */
.hbars { display: flex; flex-direction: column; gap: 0.45rem; }
.hbar {
  display: grid; grid-template-columns: minmax(90px, 38%) 1fr auto;
  gap: 0.6rem; align-items: center; font-size: 0.85rem;
}
.hbar-label { color: var(--slate-700); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hbar-track { height: 12px; background: var(--slate-100); border-radius: 3px; position: relative; }
.hbar-fill { height: 100%; border-radius: 3px; min-width: 2px; transition: width 0.35s ease; }
/* Repere de la periode precedente : un trait, pas une barre — il ne doit pas
   etre confondu avec l effectif de la periode courante. */
.hbar-prev {
  position: absolute; top: -3px; bottom: -3px; width: 2px;
  background: var(--slate-700); border-radius: 1px; opacity: 0.55;
}
.hbar-val { display: flex; gap: 0.4rem; justify-content: flex-end; min-width: 4.6rem; font-variant-numeric: tabular-nums; }
.hbar-val span { color: var(--slate-500); min-width: 2.6rem; text-align: right; }

.split-bar { display: flex; height: 30px; border-radius: 6px; overflow: hidden; gap: 2px; }
.split-bar div {
  display: flex; align-items: center; justify-content: center;
  color: #fff; font-size: 0.78rem; font-weight: 700;
  transition: width 0.35s ease; min-width: 3px;
}
.legend { display: flex; flex-wrap: wrap; gap: 0.35rem 1rem; margin-top: 0.6rem; font-size: 0.8rem; color: var(--slate-600); }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 2px; margin-right: 0.35rem; }
/* Le repere de la periode precedente est une barre fine, pas un aplat. */
.legend i.ln { height: 3px; width: 14px; }
.legend b { color: var(--slate-900); margin-left: 0.15rem; font-variant-numeric: tabular-nums; }

/* ----------------------------------------------------------------- colonnes */
.cols { position: relative; }
.cols svg { display: block; width: 100%; height: auto; overflow: visible; }
/* Lignes de repere horizontales, dessinees dans le SVG. */
.cols .grid { stroke: var(--slate-200); stroke-width: 1; vector-effect: non-scaling-stroke; }
.cols .axis { font-size: 10px; fill: var(--slate-500); }
.tip {
  position: absolute; top: 0; transform: translateX(-50%);
  background: var(--slate-900); color: #fff; font-size: 0.78rem;
  padding: 0.45rem 0.6rem; border-radius: 8px; pointer-events: none;
  white-space: nowrap; box-shadow: var(--shadow); z-index: 5;
}
.tip-h { font-weight: 700; margin-bottom: 0.15rem; }
.tip i { display: inline-block; width: 8px; height: 8px; border-radius: 2px; margin-right: 0.35rem; }
.tip b { margin-left: 0.3rem; }

/* ----------------------------------------------------------------- tableaux */
/* Les variantes de table.data reprennent la table de base (voir plus haut) et
   n en changent que l alignement des chiffres. */
.num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
td.hot { color: var(--red-600); font-weight: 700; }
td.warm { color: var(--amber-600); font-weight: 650; }
.nowrap { white-space: nowrap; }
tr.pickable { cursor: pointer; }
.chev { color: var(--slate-400); margin-left: 0.4rem; font-weight: 700; }

/* Colonne « volume » : une barre, l effectif et sa part du total. */
.terr .w-bar { width: 34%; min-width: 150px; }
.terr td.w-bar { display: flex; align-items: center; gap: 0.5rem; }
.cell-bar { flex: 1; height: 8px; background: var(--slate-100); border-radius: 3px; overflow: hidden; min-width: 60px; }
.cell-bar span { display: block; height: 100%; background: var(--teal-600); border-radius: 3px; transition: width 0.35s; }
.cell-n { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 2rem; text-align: right; }
.cell-p { color: var(--slate-500); font-size: 0.78rem; min-width: 2.4rem; text-align: right; }

/* ---------------------------------------------------------------- entonnoir */
.funnel { display: flex; flex-direction: column; gap: 0.5rem; }
.fn-row {
  display: grid; grid-template-columns: minmax(140px, 30%) 1fr 6.5rem;
  gap: 0.75rem; align-items: center; font-size: 0.86rem;
}
.fn-track { height: 22px; background: var(--slate-50); border-radius: 4px; overflow: hidden; }
.fn-fill { height: 100%; border-radius: 4px; transition: width 0.35s; }
.fn-val { display: flex; justify-content: flex-end; gap: 0.5rem; font-variant-numeric: tabular-nums; }
.fn-val span { color: var(--slate-500); min-width: 2.8rem; text-align: right; }
.fn-base .fn-label { color: var(--slate-500); }

/* ---------------------------------------------------------- carte de chaleur */
/* Un tableau, pas un SVG : les cases restent lisibles et copiables, et la
   grille s adapte au nombre de mois sans calcul de largeur. */
table.heat {
  border-collapse: separate; border-spacing: 3px; width: 100%;
  font-size: 0.8rem; font-variant-numeric: tabular-nums;
}
table.heat thead th {
  font-size: 0.72rem; color: var(--slate-500); font-weight: 600;
  text-transform: capitalize; padding: 0.2rem;
}
table.heat tbody th {
  text-align: left; padding: 0.3rem 0.6rem 0.3rem 0; white-space: nowrap;
  font-weight: 600; color: var(--slate-700);
}
table.heat tbody th small { display: block; font-weight: 400; color: var(--slate-400); font-size: 0.72rem; }
table.heat tbody th.pickable { cursor: pointer; }
table.heat tbody th.pickable:hover span { color: var(--teal-700); text-decoration: underline; }
table.heat td {
  text-align: center; height: 34px; min-width: 30px; border-radius: 4px; font-weight: 600;
}
table.heat td.heat-sum { background: none; color: var(--slate-900); font-weight: 700; padding-left: 0.5rem; }

/* -------------------------------------------------------------- remplissage */
.fill-groups { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 1.25rem 2rem; }
.fill-group h4 {
  font-size: 0.78rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--slate-500); margin-bottom: 0.5rem;
}
.fill-row {
  display: grid; grid-template-columns: 1fr 34% 3rem; gap: 0.6rem;
  align-items: center; font-size: 0.85rem; padding: 0.25rem 0;
}
/* Jauge de remplissage, en CSS pur : une barre de progression par champ. */
.fill-bar {
  display: block; width: 100%; height: 8px; border-radius: 999px;
  background: var(--slate-100); overflow: hidden;
}
.fill-bar > span { display: block; height: 100%; background: var(--teal-600); border-radius: 999px; }
/* Deux paliers d alerte sous 75 % et sous 50 % : la couleur signale le champ
   mal renseigne avant que le chiffre ne soit lu. */
.fill-bar > span.mid { background: var(--amber-500); }
.fill-bar > span.low { background: var(--red-500); }
.fill-p { text-align: right; font-weight: 700; font-variant-numeric: tabular-nums; }
.fill-p.low { color: var(--red-600); }

/* ---------------------------------------------------------------- citations */
.quotes { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 0.75rem; }
.quotes li { background: var(--slate-50); border-radius: var(--radius); padding: 0.75rem 0.9rem; }
.quotes p { margin: 0 0 0.35rem; color: var(--slate-700); }
.quotes span { font-size: 0.78rem; color: var(--slate-500); }
.lvl { font-weight: 650; }
.lvl-open { color: var(--red-600); }
.lvl-latent { color: var(--amber-600); }

/* -------------------------------------------------------------- adaptation */
@media (max-width: 1160px) {
  .f-row, .f-row.is-range { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  /* La cascade territoriale passe sur deux colonnes, sous les bornes. */
  .f-row .f-group:nth-child(2) { grid-column: span 2; }
  .grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .span-2 { grid-column: 1 / -1; }
}
@media (max-width: 900px) {
  .grid { grid-template-columns: 1fr; }
  .span-2, .span-3 { grid-column: auto; }
  .f-row, .f-row.is-range, .f-row2 { grid-template-columns: 1fr 1fr; }
  .f-row .f-group:nth-child(2) { grid-column: auto; }
  .fill-groups, .quotes { grid-template-columns: 1fr; }
  /* Coller une barre qui occupe la moitie de l ecran ne sert plus a rien. */
  .rp-sticky { position: static; }
  .rp-sticky .subnav { flex-wrap: nowrap; overflow-x: auto; }
  .rp-sticky .subnav-item { flex: none; }
  .kpi-value { font-size: 1.6rem; }
}
@media print {
  .rp-sticky { position: static; background: none; }
  .rp-sticky .subnav, .f-foot, .rp-head .btn { display: none; }
  .filters { box-shadow: none; }
  .panel, .kpi { break-inside: avoid; box-shadow: none; }
  .rp-sec-title { break-after: avoid; }
}
