/* Design system commun à toutes les pages : tokens (clair + sombre), navbar,
   barre d'onglets mobile, boutons, formulaires, cartes, badges, dialogs,
   popovers. Le CSS propre à une page reste dans son <style> inline, mais ne
   contient plus AUCUNE couleur en dur : tout passe par les tokens ci-dessous —
   c'est la condition du thème sombre automatique. */

/* ---------- 1. Tokens ---------- */
:root {
  color-scheme: light dark; /* les contrôles natifs (datetime-local, dialog…) suivent le thème */

  --bg: #f5f5f7;
  --card: #ffffff;
  --elev: #ffffff;          /* surfaces élevées : dialogs, popovers, sheets */
  --text: #1d1d1f;
  --muted: #6e6e73;
  --border: #e4e4e9;
  --border-strong: #d3d3da;

  --accent: #3f6ce0;
  --on-accent: #ffffff;
  --accent-hover: #3459c2;
  --accent-soft: #edf2fd;
  --ok: #2e9e5b;
  --warn: #b07d10;
  --warn-soft: #fdf4dc;
  --danger: #c9403a;
  --danger-soft: #fceae8;
  --danger-border: #f0c4c0;
  --now: #e0245e;           /* ligne « maintenant » du calendrier */

  /* Statuts d'une publication : paires fond/texte, consommées par les badges
     ET par les blocs du calendrier. */
  --st-pending-bg: #fdf4dc;   --st-pending-fg: #8a6400;
  --st-running-bg: #edf2fd;   --st-running-fg: #3f6ce0;
  --st-done-bg: #e5f6ea;      --st-done-fg: #257a46;
  --st-failed-bg: #fceae8;    --st-failed-fg: #b2372e;
  --st-cancelled-bg: #f0f0f3; --st-cancelled-fg: #6e6e73;
  --mod-removed-bg: #fbe3e6;  --mod-removed-fg: #a30d1d;

  --r-sm: 6px; --r-md: 10px; --r-lg: 14px; --r-xl: 20px; --r-full: 999px;

  --shadow-1: 0 1px 2px rgba(16, 17, 20, .05), 0 1px 1px rgba(16, 17, 20, .03);
  --shadow-2: 0 4px 16px rgba(16, 17, 20, .10);
  --shadow-3: 0 16px 40px rgba(16, 17, 20, .18);

  --nav-h: 56px;    /* hauteur de la navbar — les toolbars sticky s'y calent */
  --tabbar-h: 58px; /* barre d'onglets mobile */
}

@media (prefers-color-scheme: dark) {
  :root {
    --bg: #141417;
    --card: #1e1e22;
    --elev: #26262b;
    --text: #ededf0;
    --muted: #9b9ba3;
    --border: #2c2c33;
    --border-strong: #3a3a42;

    --accent: #6d95f6;
    --accent-hover: #86a8f8;
    --accent-soft: rgba(109, 149, 246, .14);
    --ok: #4dbb7e;
    --warn: #d9a84e;
    --warn-soft: rgba(217, 168, 78, .14);
    --danger: #e26a62;
    --danger-soft: rgba(226, 106, 98, .14);
    --danger-border: rgba(226, 106, 98, .35);

    --st-pending-bg: rgba(217, 168, 78, .16);   --st-pending-fg: #dfb268;
    --st-running-bg: rgba(109, 149, 246, .16);  --st-running-fg: #8fadf8;
    --st-done-bg: rgba(77, 187, 126, .16);      --st-done-fg: #6fca94;
    --st-failed-bg: rgba(226, 106, 98, .16);    --st-failed-fg: #ec8b84;
    --st-cancelled-bg: rgba(255, 255, 255, .06); --st-cancelled-fg: #9b9ba3;
    --mod-removed-bg: rgba(226, 106, 98, .2);   --mod-removed-fg: #f0a19a;

    --shadow-1: 0 1px 2px rgba(0, 0, 0, .35);
    --shadow-2: 0 4px 16px rgba(0, 0, 0, .45);
    --shadow-3: 0 16px 40px rgba(0, 0, 0, .6);
  }
}

/* ---------- 2. Base ---------- */
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
}
main { max-width: 760px; margin: 28px auto; padding: 0 20px; }

/* Le bandeau légal (injecté par nav.js) doit rester en bas de la fenêtre même
   quand la page est courte : le body devient une colonne pleine hauteur et
   <main> absorbe l'espace libre. Le :has() épargne login/appairage, qui ont
   leur propre mise en page dans auth.css. width:100% : dans une colonne flex,
   des marges auto laisseraient <main> se rétrécir à son contenu. */
body:has(.app-footer) {
  min-height: 100vh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
}
body:has(.app-footer) > main {
  flex: 1 0 auto;
  width: 100%;
}

code {
  background: var(--st-cancelled-bg);
  padding: 2px 6px;
  border-radius: var(--r-sm);
  font-size: .9em;
}

.muted { color: var(--muted); }
.tnum { font-variant-numeric: tabular-nums; }
.row { display: flex; align-items: center; gap: 10px; }
.visually-hidden {
  position: absolute;
  width: 1px; height: 1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

button, a, input, select, textarea { font-family: inherit; }
button:focus-visible, a:focus-visible, [tabindex]:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Icônes SVG inline (voir icons.js) : calées sur la ligne de texte. */
.icon { width: 18px; height: 18px; display: inline-block; vertical-align: -4px; flex: none; }
.icon.sm { width: 15px; height: 15px; vertical-align: -3px; }
.icon.lg { width: 22px; height: 22px; }

/* ---------- 3. Navbar (injectée par nav.js) ---------- */
.topnav {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  height: var(--nav-h);
  padding: 0 16px;
  display: flex;
  gap: 4px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 20;
  overflow-x: auto;
}
/* Effet verre à la Apple quand le navigateur sait le faire. */
@supports (backdrop-filter: blur(1px)) {
  .topnav {
    background: color-mix(in srgb, var(--card) 80%, transparent);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
  }
}
.topnav .brand {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 15px;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: var(--text);
  text-decoration: none;
  margin-right: 14px;
  white-space: nowrap;
}
.brand-mark {
  width: 26px; height: 26px;
  border-radius: 7px;
  background: var(--accent);
  color: var(--on-accent);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex: none;
}
.brand-mark .icon { width: 15px; height: 15px; vertical-align: 0; }
.topnav .nav-links { display: flex; gap: 2px; align-items: center; }
.topnav a:not(.brand) {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  color: var(--muted);
  text-decoration: none;
  font-size: 14px;
  font-weight: 500;
  padding: 7px 12px;
  border-radius: var(--r-full);
  white-space: nowrap;
  transition: background .15s ease, color .15s ease;
}
.topnav a:not(.brand):hover { background: var(--accent-soft); color: var(--text); }
.topnav a.active { background: var(--accent-soft); color: var(--accent); font-weight: 600; }

/* Identité (remplie par nav.js) : visible aussi en mobile — repère de sécurité. */
.topnav .nav-user { margin-left: auto; display: flex; gap: 8px; align-items: center; white-space: nowrap; }
.topnav .nav-user select {
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  padding: 5px 8px;
  font-size: 13px;
  background: var(--card);
  color: var(--text);
  max-width: 160px;
}
.topnav .nav-user span { color: var(--muted); font-size: 13px; }

/* Barre d'onglets mobile (injectée par nav.js, affichée ≤ 640px seulement). */
.tabbar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: calc(var(--tabbar-h) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom);
  background: var(--card);
  border-top: 1px solid var(--border);
  display: none;
  z-index: 30;
}
@supports (backdrop-filter: blur(1px)) {
  .tabbar {
    background: color-mix(in srgb, var(--card) 82%, transparent);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
  }
}
.tabbar .tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  border: 0;
  background: none;
  color: var(--muted);
  text-decoration: none;
  font-size: 11px;
  font-weight: 500;
  cursor: pointer;
  padding: 6px 0 5px;
}
.tabbar .tab .icon { width: 22px; height: 22px; vertical-align: 0; }
.tabbar .tab.active { color: var(--accent); }

/* Compteur des commentaires à traiter, posé par nav.js sur l'onglet
   Commentaires : en ligne dans la navbar, épinglé sur l'icône dans la tabbar. */
.nav-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--r-full);
  background: var(--danger);
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.tabbar .tab { position: relative; }
.tabbar .tab .nav-badge { position: absolute; top: 3px; left: calc(50% + 6px); }

/* Panneau « Plus » : petite feuille au-dessus de la barre d'onglets. */
.tabbar-sheet {
  position: fixed;
  right: 10px;
  bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom) + 10px);
  min-width: 220px;
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-3);
  padding: 6px;
  z-index: 31;
}
.tabbar-sheet a {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 11px 12px;
  border-radius: var(--r-md);
  color: var(--text);
  text-decoration: none;
  font-size: 15px;
}
.tabbar-sheet a:hover { background: var(--accent-soft); }
.tabbar-sheet a.active { color: var(--accent); font-weight: 600; }
.tabbar-sheet a .icon { color: var(--muted); }
.tabbar-sheet a.active .icon { color: var(--accent); }

@media (max-width: 640px) {
  .tabbar { display: flex; }
  .topnav .nav-links { display: none; }
  /* Le contenu ne doit pas finir sous la barre d'onglets. Login et appairage
     n'injectent pas de tabbar : le :has() les laisse tranquilles. */
  body:has(.tabbar) { padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom)); }
}

/* ---------- 4. Bandeau d'outils, sticky sous la navbar ---------- */
.toolbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 14px 20px;
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  position: sticky;
  top: var(--nav-h);
  z-index: 10;
}
@supports (backdrop-filter: blur(1px)) {
  .toolbar {
    background: color-mix(in srgb, var(--card) 85%, transparent);
    backdrop-filter: blur(16px) saturate(1.6);
    -webkit-backdrop-filter: blur(16px) saturate(1.6);
  }
}
.toolbar h1 { font-size: 19px; font-weight: 650; letter-spacing: -0.015em; margin: 0 auto 0 0; }
#count { color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }

/* ---------- 5. Boutons ---------- */
.primary-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 9px 16px;
  border: 0;
  border-radius: var(--r-md);
  background: var(--accent);
  color: var(--on-accent);
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.primary-btn:hover { background: var(--accent-hover); }
.primary-btn:disabled { opacity: .55; cursor: default; }

.danger-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  border: 1px solid var(--danger-border);
  border-radius: var(--r-md);
  background: var(--danger-soft);
  color: var(--danger);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background .15s ease;
}
.danger-btn:hover { background: var(--mod-removed-bg); }
.danger-btn:disabled { opacity: .5; cursor: default; }

.tool-btn, .nav-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 13px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  background: var(--card);
  color: var(--text);
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background .15s ease, border-color .15s ease;
}
.tool-btn:hover, .nav-btn:hover { background: var(--accent-soft); border-color: var(--border-strong); }
.tool-btn:disabled { opacity: .55; cursor: default; pointer-events: none; }
.tool-btn .icon, .nav-btn .icon { color: var(--muted); }

.link-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: none;
  border: 0;
  color: var(--accent);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  padding: 0;
}
.link-btn:hover { color: var(--accent-hover); }
.link-danger {
  background: none;
  border: 0;
  color: var(--danger);
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  padding: 0;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px; height: 34px;
  border: 0;
  border-radius: var(--r-md);
  background: none;
  color: var(--muted);
  cursor: pointer;
  transition: background .15s ease, color .15s ease;
  padding: 0;
}
.icon-btn:hover { background: var(--accent-soft); color: var(--text); }
.icon-btn .icon { vertical-align: 0; }

/* ---------- 6. Formulaires ---------- */
input[type="text"], input[type="search"], input[type="password"],
input[type="datetime-local"], input:not([type]), select, textarea {
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: var(--r-md);
  font-size: 14px;
  background: var(--card);
  color: var(--text);
  transition: border-color .15s ease, box-shadow .15s ease;
}
input[type="text"]:focus, input[type="search"]:focus, input[type="password"]:focus,
input[type="datetime-local"]:focus, input:not([type]):focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}
textarea { font: inherit; font-size: 14px; resize: vertical; }
input::placeholder, textarea::placeholder { color: var(--muted); opacity: .8; }

/* Libellés de champs : uniquement dans les contextes de formulaire — les
   labels de cases à cocher (cibles, popovers) gardent leur rendu en ligne. */
dialog label, form label, .form-card label {
  display: block;
  font-size: 13px;
  font-weight: 500;
  color: var(--muted);
  margin: 14px 0 5px;
}

.toolbar input[type="search"] { width: 260px; }
.toolbar select { padding: 8px 10px; }

/* ---------- 7. Cartes, panneaux, tuiles ---------- */
.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 18px;
  margin-bottom: 14px;
}
.card .meta {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  color: var(--muted);
  font-size: 13px;
  margin-bottom: 8px;
}
.card .stats { display: flex; flex-wrap: wrap; gap: 16px; color: var(--muted); font-size: 13px; margin-top: 10px; }
.card footer {
  display: flex;
  align-items: center;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid var(--border);
}

.panel {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  overflow: hidden;
  margin-bottom: 28px;
}
.panel-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  padding: 16px 18px;
  border-bottom: 1px solid var(--border);
}
.panel-head h2 { font-size: 17px; font-weight: 650; letter-spacing: -0.01em; margin: 0; }
.panel-head .sub { color: var(--muted); font-size: 13px; }
.panel-head a { margin-left: auto; color: var(--accent); text-decoration: none; font-size: 13px; font-weight: 500; white-space: nowrap; }
.panel-head a:hover { color: var(--accent-hover); }
.panel-foot { padding: 10px 18px; color: var(--muted); font-size: 13px; }
.panel .empty-state { margin: 36px 16px; }
.panel .empty-state a { color: var(--accent); text-decoration: none; }
.panel .empty-state a:hover { text-decoration: underline; }

.sched-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 18px;
  border-bottom: 1px solid var(--border);
  color: inherit;
  text-decoration: none;
}
.sched-row:last-of-type { border-bottom: 0; }
.sched-row:hover { background: var(--accent-soft); }
.sched-row .time { font-weight: 600; font-size: 14px; min-width: 44px; font-variant-numeric: tabular-nums; }
.sched-row .txt {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.sched-row .txt.empty { color: var(--muted); font-style: italic; }
.sched-row .extras { color: var(--muted); font-size: 12px; white-space: nowrap; display: inline-flex; align-items: center; gap: 4px; }
.sched-row .badge { white-space: nowrap; }

.section-title {
  font-size: 13px;
  color: var(--muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin: 0 0 10px 2px;
}
.tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.tile {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-1);
  padding: 14px 16px;
  color: inherit;
  text-decoration: none;
  display: block;
  transition: border-color .15s ease;
}
a.tile:hover { border-color: var(--accent); }
.tile .value { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.tile .label { color: var(--muted); font-size: 13px; margin-top: 2px; }
.tile .value .dot { margin-right: 4px; }

/* ---------- 8. Badges et pastilles ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--accent-soft);
  color: var(--accent);
  border-radius: var(--r-full);
  padding: 2px 9px;
  font-size: 12px;
  font-weight: 500;
}
/* Statuts d'une publication programmée */
.badge.st-pending { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.badge.st-running { background: var(--st-running-bg); color: var(--st-running-fg); }
.badge.st-done { background: var(--st-done-bg); color: var(--st-done-fg); }
.badge.st-failed { background: var(--st-failed-bg); color: var(--st-failed-fg); }
.badge.st-cancelled { background: var(--st-cancelled-bg); color: var(--st-cancelled-fg); }
/* Modération dans les groupes */
.badge.mod-pending { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.badge.mod-declined { background: var(--st-failed-bg); color: var(--st-failed-fg); }
.badge.mod-removed { background: var(--mod-removed-bg); color: var(--mod-removed-fg); }
/* Suppressions demandées à l'extension (page posts) */
.badge.del-pending { background: var(--st-pending-bg); color: var(--st-pending-fg); }
.badge.del-done { background: var(--mod-removed-bg); color: var(--mod-removed-fg); }
.badge.del-failed { background: var(--st-failed-bg); color: var(--st-failed-fg); }
/* Appartenance à un groupe */
.badge.member { background: var(--st-done-bg); color: var(--st-done-fg); }
.badge.gone { background: var(--st-cancelled-bg); color: var(--st-cancelled-fg); }
.badge.cross { background: var(--warn-soft); color: var(--warn); }

/* La pastille intégrée remplace les emojis d'état : chaque badge d'état porte
   un point de sa couleur, aucun call site à changer. */
.badge.st-pending::before, .badge.st-running::before, .badge.st-done::before,
.badge.st-failed::before, .badge.st-cancelled::before,
.badge.del-pending::before, .badge.del-done::before, .badge.del-failed::before,
.badge.member::before, .badge.gone::before {
  content: "";
  width: 6px; height: 6px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}

/* Pastille autonome (santé des extensions, verdicts) */
.dot {
  display: inline-block;
  width: 9px; height: 9px;
  border-radius: 50%;
  background: currentColor;
  flex: none;
}
.dot.ok { color: var(--ok); }
.dot.warn { color: var(--warn); }
.dot.err { color: var(--danger); }

/* ---------- 9. Dialogs ---------- */
dialog {
  border: 0;
  border-radius: var(--r-xl);
  padding: 22px;
  width: 460px;
  max-width: min(92vw, 100%);
  background: var(--elev);
  color: var(--text);
  box-shadow: var(--shadow-3);
}
dialog::backdrop { background: rgba(0, 0, 0, .45); }
dialog h2 { margin: 0 0 6px; font-size: 18px; font-weight: 650; letter-spacing: -0.01em; }
dialog h3 { margin: 20px 0 6px; font-size: 14px; font-weight: 600; }
dialog p { font-size: 13px; color: var(--muted); line-height: 1.55; margin: 6px 0; }
dialog input[type="text"], dialog input[type="password"], dialog select { width: 100%; }
.dlg-actions { margin-top: 18px; display: flex; gap: 14px; align-items: center; }
.dlg-msg { font-size: 13px; color: var(--danger); min-height: 16px; margin-top: 8px; }
.dlg-msg.ok { color: var(--ok); }

/* ---------- 10. Popovers (détail planning, dossiers, menu contextuel) ---------- */
.detail-pop, .folder-pop, .ctx-menu {
  position: fixed;
  z-index: 50;
  background: var(--elev);
  border: 1px solid var(--border);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-2);
}
.detail-pop { width: 320px; max-width: 92vw; padding: 14px; font-size: 13px; }
.folder-pop { width: 240px; max-width: 92vw; padding: 12px 14px; font-size: 14px; }

/* Au doigt, la popover devient une feuille ancrée en bas de l'écran. */
@media (max-width: 700px) {
  .detail-pop, .folder-pop, .ctx-menu {
    left: 0 !important;
    right: 0;
    top: auto !important;
    bottom: 0;
    width: auto;
    max-width: none;
    border-radius: var(--r-xl) var(--r-xl) 0 0;
    border-left: 0; border-right: 0; border-bottom: 0;
    box-shadow: var(--shadow-3);
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    max-height: 75dvh;
    overflow-y: auto;
    z-index: 60; /* au-dessus de la barre d'onglets */
  }
}

/* ---------- 11. Messages, bandeaux, états vides ---------- */
.form-msg { margin-top: 10px; font-size: 13px; color: var(--muted); min-height: 18px; }
.form-msg.err { color: var(--danger); }
.warn {
  background: var(--warn-soft);
  border: 1px solid transparent;
  color: var(--st-pending-fg);
  border-radius: var(--r-md);
  padding: 10px 12px;
  font-size: 13px;
  line-height: 1.5;
  margin-bottom: 14px;
}
.warn:empty { display: none; }
.empty-state { text-align: center; color: var(--muted); margin-top: 60px; line-height: 1.6; }

/* ---------- Bandeau légal, injecté en fin de page par nav.js ---------- */
/* Discret : ces liens doivent être atteignables partout, sans concurrencer le
   contenu. Le body réserve déjà la hauteur de la tabbar en mobile, le pied ne
   passe donc jamais dessous. */
.app-footer {
  margin-top: 32px;
  padding: 18px 20px calc(18px + env(safe-area-inset-bottom));
  border-top: 1px solid var(--border);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  font-size: 12px;
  color: var(--muted);
}

.app-footer a {
  color: var(--muted);
  text-decoration: none;
}

.app-footer a:hover {
  color: var(--text);
  text-decoration: underline;
}

.app-footer-copyright {
  margin-left: auto;
}

@media (max-width: 640px) {
  .app-footer-copyright {
    margin-left: 0;
    width: 100%;
  }
}
