/* ================================================================
   Agenda — thème sombre « application mobile »
   Même grammaire que /srv/annuaire et /srv/contact (topbar fixe +
   pastille d'onglets flottante opaque, sidebar sur grand écran,
   icônes Lucide inline), avec une identité propre : nuit chaude et
   ambre, là où l'Annuaire est bleu marine et Contact turquoise.
   Navigation volontairement réduite à 4 onglets : Aujourd'hui,
   Agenda, Repérage, Ajouter. Tout le reste vit dans /admin.
   Règle absolue : AUCUN box-shadow, nulle part (préférence
   utilisateur) — les reliefs sont rendus par bordures et fonds.
   Jamais d'emoji : uniquement des icônes Lucide.
   ================================================================ */
* { box-sizing: border-box; }
:root {
  color-scheme: dark;
  --fond: #0d0b07;
  --fond-2: #191308;
  --carte: #191410;
  --carte-2: #241d14;
  --texte: #f1ebe1;
  --muted: #a89880;
  --bord: #3a2f1f;
  --bord-soft: rgba(255, 255, 255, .07);
  --accent: #f0a94c;
  --accent-2: #7db8f7;
  --accent-soft: rgba(240, 169, 76, .16);
  --accent-line: rgba(240, 169, 76, .38);
  --degrade: linear-gradient(135deg, #f2b45c, #e07f37);
  --sur-accent: #2a1a06;
  /* Fond OPAQUE de la barre d'onglets flottante : une pastille d'encre
     posée sur le fond, jamais un voile translucide. */
  --tabbar-base: #17120b;
  --ok: #8fd2a8; --warn: #ffb54d; --err: #e07a7a;
  /* Couleur de puce par défaut (surchargée par --puce sur les types). */
  --puce: var(--accent);
  --safe-top: env(safe-area-inset-top, 0px);
  --safe-bottom: env(safe-area-inset-bottom, 0px);
  --safe-left: env(safe-area-inset-left, 0px);
  --safe-right: env(safe-area-inset-right, 0px);
}
html { -webkit-text-size-adjust: 100%; text-size-adjust: 100%; }
html, body { margin: 0; padding: 0; }
body {
  font: 15px/1.55 -apple-system, "Segoe UI", Roboto, sans-serif;
  color: var(--texte);
  background: var(--fond);
  background-image: radial-gradient(1100px 500px at 50% -140px, var(--fond-2), var(--fond) 70%);
  background-attachment: fixed;
  -webkit-tap-highlight-color: rgba(240, 169, 76, .18);
}
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 6px; }
::selection { background: rgba(240, 169, 76, .3); }
img, svg, video { max-width: 100%; }
code { background: rgba(255,255,255,.07); border-radius: 6px; padding: 1px 6px; font-size: .92em; }
pre { white-space: pre-wrap; overflow-wrap: break-word; }

.lucide { width: 1.2em; height: 1.2em; vertical-align: -.24em; flex: none; }
button .lucide, .btn .lucide { margin-right: 3px; }
summary .lucide { color: var(--accent); margin-right: 2px; }

/* Notice explicative en tête de page (partials/notice.ejs) */
.notice {
  display: flex; gap: 10px; align-items: flex-start;
  background: rgba(240, 169, 76, .07);
  border: 1px solid rgba(240, 169, 76, .2); border-left: 3px solid var(--accent);
  border-radius: 14px; padding: 11px 14px; margin: 0 0 16px;
  font-size: 13.5px; line-height: 1.55; color: #d8cdbd;
}
.notice > .lucide { width: 18px; height: 18px; color: var(--accent); margin-top: 3px; }
.notice .n-txt { min-width: 0; }

.layout { display: flex; min-height: 100vh; min-height: 100dvh; }

/* ---------------------------------------------------------------- Sidebar (bureau) */
.sidebar {
  width: 244px; flex: 0 0 244px; background: rgba(15, 12, 7, .92);
  border-right: 1px solid var(--bord-soft);
  padding: 14px 10px 20px; position: sticky; top: 0; height: 100vh; height: 100dvh;
  overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}
.brand {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 19px; font-weight: 800; color: #fff; padding: 6px 8px 16px; letter-spacing: .3px;
}
.brand-ico {
  display: inline-flex; align-items: center; justify-content: center;
  width: 28px; height: 28px; background: var(--degrade); color: #2a1a06;
  border-radius: 9px; margin-right: 6px; vertical-align: middle;
}
.brand-ico svg { width: 17px; height: 17px; }
.sidebar a {
  display: flex; align-items: center; gap: 10px;
  color: #c8b9a4; padding: 10px 12px; font-size: 14.5px; border-radius: 12px; margin: 2px 0;
}
.sidebar a:hover { background: rgba(255,255,255,.06); text-decoration: none; color: #fff; }
.sidebar a.active {
  background: var(--accent-soft); color: #fff; font-weight: 600;
  outline: 1px solid var(--accent-line); outline-offset: -1px;
}
.sidebar .ico { display: inline-flex; width: 24px; justify-content: center; }
.sidebar .ico .lucide { width: 19px; height: 19px; }
.logout-form { padding: 16px 8px 4px; }
.logout-form.logout-admin { padding: 8px 0 0; max-width: 320px; }
.logout-form button {
  background: transparent; border: 1px solid var(--bord); color: #c8b9a4;
  border-radius: 12px; padding: 9px 12px; cursor: pointer; width: 100%;
}
.logout-form button:hover { border-color: var(--err); color: var(--err); }
.topbar, .tabbar { display: none; }

/* ---------------------------------------------------------------- Contenu */
.content { flex: 1; padding: 22px 26px 60px; max-width: 1240px; min-width: 0; }
h1 { font-size: 23px; font-weight: 800; letter-spacing: -.2px; margin: 0 0 16px; overflow-wrap: break-word; }
h1 .lucide { color: var(--accent); }
h2 { font-size: 16.5px; font-weight: 700; margin: 24px 0 10px; }
h3 { font-size: 14.5px; font-weight: 700; margin: 16px 0 6px; }
.muted { color: var(--muted); font-size: 13px; }
.vide { color: var(--muted); font-size: 13.5px; padding: 12px 2px; }

/* ---------------------------------------------------------------- Tuiles de stats */
.cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(152px, 1fr)); gap: 12px; margin: 14px 0; }
.card {
  background: linear-gradient(160deg, var(--carte-2), var(--carte));
  border: 1px solid var(--bord-soft); border-radius: 18px; padding: 14px 16px;
}
.card .num { font-size: 24px; font-weight: 800; letter-spacing: -.5px; }
.card .lbl { font-size: 12.5px; color: var(--muted); margin-top: 2px; }
a.card.lien { display: block; color: var(--texte); }
a.card.lien:hover { text-decoration: none; border-color: var(--accent); }
.cards.mini { grid-template-columns: repeat(auto-fill, minmax(128px, 1fr)); margin: 12px 0; }
.cards.mini .card { padding: 10px 14px; }
.cards.mini .num { font-size: 20px; }

/* ---------------------------------------------------------------- Panneaux */
.panel {
  background: var(--carte); border: 1px solid var(--bord-soft); border-radius: 18px;
  padding: 16px; margin: 14px 0;
}
.panel.warn { border-color: rgba(255, 181, 77, .4); background: linear-gradient(160deg, rgba(255,181,77,.10), var(--carte)); }
.panel.ok { border-color: rgba(143, 210, 168, .35); background: linear-gradient(160deg, rgba(143,210,168,.10), var(--carte)); }
.panel.logic h2 { margin-top: 0; display: flex; align-items: center; gap: 8px; font-size: 17px; }
.ico-h {
  display: inline-flex; align-items: center; justify-content: center;
  width: 32px; height: 32px; border-radius: 10px; flex: none;
  background: color-mix(in srgb, var(--puce) 16%, transparent); color: var(--puce);
}
.ico-h .lucide { width: 18px; height: 18px; }

details.bloc {
  background: var(--carte); border: 1px solid var(--bord-soft); border-radius: 18px;
  padding: 12px 16px; margin: 12px 0;
}
details.bloc summary { cursor: pointer; font-weight: 700; padding: 4px 0; }
details.bloc summary::marker { color: var(--accent); }
details.bloc[open] summary { margin-bottom: 6px; }

/* ---------------------------------------------------------------- Page Administration */
.admin-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
  gap: 10px; margin: 10px 0 20px;
}
.admin-tile {
  display: flex; flex-direction: column; gap: 4px;
  background: var(--carte); border: 1px solid var(--bord-soft); border-radius: 16px;
  padding: 13px 14px; color: var(--texte);
}
.admin-tile:hover { text-decoration: none; border-color: var(--accent); }
.admin-tile .ico { position: relative; display: inline-flex; width: 34px; height: 34px;
  align-items: center; justify-content: center; border-radius: 10px;
  background: var(--accent-soft); color: var(--accent); margin-bottom: 2px; }
.admin-tile .ico .lucide { width: 18px; height: 18px; }
.admin-tile .lbl { font-weight: 700; font-size: 14px; }
.admin-tile .hint { font-size: 12px; color: var(--muted); line-height: 1.35; }

/* ================================================================
   RECHERCHE
   ================================================================ */
.recherche { margin: 4px 0 16px; }
.recherche-ligne {
  display: flex; align-items: center; gap: 8px;
  background: var(--carte); border: 1px solid var(--bord); border-radius: 16px;
  padding: 6px 8px 6px 14px;
}
.recherche-ligne:focus-within { border-color: var(--accent); outline: 3px solid rgba(240, 169, 76, .18); }
.recherche-ligne > .lucide { color: var(--muted); width: 20px; height: 20px; }
.recherche-ligne input[type="search"], .recherche-ligne input[type="text"] {
  flex: 1; min-width: 0; border: 0; background: transparent; padding: 10px 0; font-size: 16px;
}
.recherche-ligne input:focus { outline: none; }
.btn-micro {
  display: inline-flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: none; border-radius: 12px; cursor: pointer;
  background: var(--accent-soft); color: var(--accent); border: 1px solid var(--accent-line);
  padding: 0;
}
.btn-micro .lucide { width: 20px; height: 20px; margin: 0; }
.btn-micro.ecoute { background: var(--degrade); color: var(--sur-accent); border-color: transparent; }
.btn-micro[hidden] { display: none; }
.micro-etat { font-size: 12.5px; color: var(--accent); margin: 6px 2px 0; min-height: 18px; }

/* Bascule mois / à venir / passé */
.bascule { display: flex; flex-wrap: wrap; gap: 6px; margin: 12px 0; }
.bascule .bt {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 8px 14px; border-radius: 999px; font-size: 13.5px; font-weight: 700;
  border: 1px solid var(--bord); background: var(--carte); color: var(--muted);
}
.bascule .bt:hover { text-decoration: none; border-color: var(--accent); color: var(--texte); }
.bascule .bt.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--texte); }

/* ================================================================
   ÉVÉNEMENTS : la carte de liste (partials/carte-evenement.ejs)
   ================================================================ */
.ev-liste { display: flex; flex-direction: column; gap: 8px; margin: 12px 0; }
.ev-carte {
  display: flex; gap: 12px; align-items: flex-start;
  background: var(--carte); border: 1px solid var(--bord-soft); border-radius: 16px;
  padding: 12px 14px; color: var(--texte); min-width: 0;
  border-left: 3px solid var(--puce);
}
.ev-carte:hover { text-decoration: none; border-color: var(--accent); border-left-color: var(--puce); }
.ev-carte.passe { opacity: .62; }
/* Pastille de date : le jour, gros, et le mois dessous. */
.ev-date {
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  flex: none; width: 48px; height: 52px; border-radius: 14px;
  background: color-mix(in srgb, var(--puce) 14%, transparent);
  border: 1px solid color-mix(in srgb, var(--puce) 38%, transparent);
  color: var(--puce);
}
.ev-date .j { font-size: 20px; font-weight: 800; line-height: 1; letter-spacing: -.5px; }
.ev-date .m { font-size: 10.5px; text-transform: uppercase; letter-spacing: .5px; margin-top: 2px; }
.ev-corps { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 2px; }
.ev-titre { font-weight: 700; font-size: 15.5px; letter-spacing: -.15px; overflow-wrap: anywhere; }
.ev-ligne {
  display: flex; gap: 7px; align-items: baseline; font-size: 13px; color: #cbbca6; min-width: 0;
}
.ev-ligne .lucide { width: 14px; height: 14px; color: var(--muted); vertical-align: -.15em; }
.ev-ligne span { overflow-wrap: anywhere; }
.ev-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }

/* Ligne compacte (accueil : « à préparer ») */
.ligne-simple {
  display: flex; flex-wrap: wrap; gap: 8px; align-items: center;
  padding: 7px 0; border-bottom: 1px solid var(--bord-soft);
}
.ligne-simple:last-child { border-bottom: 0; }
.ligne-simple form { margin-left: auto; }

/* ================================================================
   CALENDRIER (vue mois)
   ================================================================ */
.cal-tete { display: flex; align-items: center; gap: 8px; margin: 14px 0 8px; flex-wrap: wrap; }
.cal-mois { font-weight: 800; font-size: 17px; text-transform: capitalize; }
.calendrier {
  display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); gap: 4px;
  margin: 8px 0 14px;
}
.cal-jour-nom {
  text-align: center; font-size: 11px; text-transform: uppercase; letter-spacing: .6px;
  color: var(--muted); padding: 4px 0;
}
.cal-case {
  display: flex; flex-direction: column; gap: 3px; min-height: 96px;
  background: var(--carte); border: 1px solid var(--bord-soft); border-radius: 12px;
  padding: 6px 6px 8px; color: var(--texte); overflow: hidden;
}
.cal-case:hover { text-decoration: none; border-color: var(--accent); }
.cal-case.hors { opacity: .4; }
.cal-case.auj { border-color: var(--accent); background: linear-gradient(160deg, var(--accent-soft), var(--carte)); }
.cal-num { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.cal-case.auj .cal-num { color: var(--accent); }
.cal-events { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-ev {
  font-size: 11px; line-height: 1.25; border-radius: 6px; padding: 2px 5px;
  background: color-mix(in srgb, var(--puce) 18%, transparent);
  border-left: 2px solid var(--puce);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.cal-ev b { font-weight: 700; }
.cal-plus { font-size: 10.5px; color: var(--muted); padding-left: 3px; }

/* ================================================================
   CHOIX DE L'AGENDA (page /nouveau)
   ================================================================ */
.choix-agenda { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 12px; margin: 14px 0; }
.choix-carte {
  display: flex; flex-direction: column; gap: 6px;
  background: var(--carte); border: 1px solid var(--bord-soft); border-radius: 18px;
  padding: 18px; color: var(--texte); position: relative;
}
.choix-carte:hover { text-decoration: none; border-color: var(--accent); }
.choix-carte .c-titre { font-weight: 800; font-size: 17px; }
.choix-carte .c-hint { font-size: 13.5px; color: var(--muted); line-height: 1.5; }
.choix-carte .c-go { color: var(--accent); margin-top: 4px; }

/* ---------------------------------------------------------------- Fiche */
.fiche-tete { display: flex; gap: 14px; align-items: flex-start; margin: 4px 0 14px; }
.fiche-tete .t-corps { min-width: 0; flex: 1; }
.fiche-tete h1 { margin: 0 0 2px; }
.fiche-tete .sous { color: var(--muted); font-size: 13.5px; }
.fiche-tete .c-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }

.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 14px;
  background: color-mix(in srgb, var(--puce) 16%, transparent); color: var(--puce);
  border: 1px solid color-mix(in srgb, var(--puce) 38%, transparent);
  font-weight: 800; font-size: 15px; letter-spacing: .5px; overflow: hidden;
}
.avatar.grand { width: 68px; height: 68px; border-radius: 20px; font-size: 22px; }
.avatar.grand .lucide { width: 30px; height: 30px; }
.avatar.mini { width: 34px; height: 34px; border-radius: 11px; font-size: 12.5px; }

.champs-fiche { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.champs-fiche .bloc-champ {
  background: var(--carte); border: 1px solid var(--bord-soft); border-radius: 14px; padding: 10px 13px;
  min-width: 0;
}
.champs-fiche .bloc-champ.plein { grid-column: 1 / -1; }
.bloc-champ .etiq {
  display: flex; align-items: center; gap: 6px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted); margin-bottom: 3px;
}
.bloc-champ .etiq .lucide { width: 14px; height: 14px; }
.bloc-champ .val { overflow-wrap: anywhere; white-space: pre-wrap; }

/* ---------------------------------------------------------------- Formulaire */
/* Grille de champs : chaque champ complémentaire décide de sa largeur (1/1 ou
   1/2) dans /admin/champs — c'est la personnalisation demandée. */
.champs-form { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 12px; margin: 8px 0 4px; }
.ch { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.ch.plein { grid-column: 1 / -1; }
.ch > label { font-size: 13px; font-weight: 600; color: #d3c5b0; display: flex; align-items: center; gap: 6px; }
.ch > label .lucide { width: 15px; height: 15px; color: var(--muted); }
.ch .oblig { color: var(--accent); }
.ch input, .ch select, .ch textarea { width: 100%; }
.ch .aide { font-size: 12px; color: var(--muted); }
.ch-cases { display: flex; flex-wrap: wrap; gap: 8px; }
.ch-cases label {
  display: inline-flex; align-items: center; gap: 7px; font-size: 14px;
  border: 1px solid var(--bord); border-radius: 12px; padding: 7px 12px; background: #15110b;
}
.groupe-titre {
  display: flex; align-items: center; gap: 8px; margin: 18px 0 4px;
  font-size: 12px; text-transform: uppercase; letter-spacing: .8px; color: var(--muted);
}
.groupe-titre .lucide { width: 14px; height: 14px; color: var(--accent); }
.groupe-titre::after { content: ""; flex: 1; height: 1px; background: var(--bord-soft); }

.form-actions { display: flex; gap: 10px; flex-wrap: wrap; margin: 18px 0 4px; align-items: center; }

/* ---------------------------------------------------------------- Tableaux */
table.liste {
  width: 100%; border-collapse: collapse; background: var(--carte);
  border: 1px solid var(--bord-soft); border-radius: 16px; overflow: hidden; font-size: 14px;
}
table.liste th {
  text-align: left; background: rgba(255,255,255,.045); padding: 9px 12px;
  font-size: 11.5px; text-transform: uppercase; letter-spacing: .6px; color: var(--muted);
}
table.liste td { padding: 8px 12px; border-top: 1px solid var(--bord-soft); vertical-align: top; }
table.liste tr:hover td { background: rgba(255,255,255,.03); }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; border-radius: 16px; }

/* ---------------------------------------------------------------- Badges */
.badge {
  display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px;
  background: var(--accent-soft); color: #f4cb96; white-space: nowrap;
}
.badge.ok { background: rgba(143, 210, 168, .16); color: var(--ok); }
.badge.warn { background: rgba(255, 181, 77, .16); color: var(--warn); }
.badge.err { background: rgba(224, 122, 122, .16); color: var(--err); }
.badge.gris { background: rgba(255, 255, 255, .08); color: var(--muted); }
.badge .lucide { width: 13px; height: 13px; vertical-align: -.15em; margin-right: 2px; }

/* ---------------------------------------------------------------- Formulaires */
form.inline { display: inline; }
input, select, textarea, button {
  font: inherit; padding: 9px 12px; border: 1px solid var(--bord);
  border-radius: 12px; background: #15110b; color: var(--texte); max-width: 100%;
}
input::placeholder, textarea::placeholder { color: rgba(168, 152, 128, .7); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); outline: 3px solid rgba(240, 169, 76, .2); outline-offset: 0;
}
select { appearance: none; -webkit-appearance: none; padding-right: 30px;
  background-image: url("data:image/svg+xml;charset=utf8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1 1l5 5 5-5' fill='none' stroke='%23a89880' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 11px center; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--accent); width: 18px; height: 18px; padding: 0; }
input[type="date"], input[type="time"] { color-scheme: dark; }
textarea { width: 100%; min-height: 76px; }
button, .btn {
  background: var(--degrade); border: 0; color: var(--sur-accent); cursor: pointer;
  border-radius: 12px; padding: 10px 16px; display: inline-block; font-size: 14px; font-weight: 700;
}
button:hover, .btn:hover { filter: brightness(1.08); text-decoration: none; }
button:active, .btn:active { transform: scale(.97); }
button.sec, .btn.sec {
  background: rgba(240, 169, 76, .1); color: #f4cb96; border: 1px solid var(--accent-line);
}
button.neutre, .btn.neutre {
  background: transparent; color: #c8b9a4; border: 1px solid var(--bord);
}
button.danger, .btn.danger { background: linear-gradient(135deg, #f43f5e, #dc2626); color: #fff; }
button.mini, .btn.mini { padding: 5px 12px; font-size: 13px; border-radius: 10px; }
button.icone {
  display: inline-flex; align-items: center; justify-content: center;
  width: 40px; height: 40px; padding: 0; border-radius: 12px;
}
button.icone .lucide { margin: 0; }

.filtres { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 12px 0; }
.filtres input, .filtres select { padding: 8px 10px; }
.champ-large { min-width: 340px; flex: 1 1 340px; }

.erreur-msg { color: var(--err); background: rgba(224, 122, 122, .12); border: 1px solid rgba(224,122,122,.35); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.succes-msg { color: var(--ok); background: rgba(143, 210, 168, .12); border: 1px solid rgba(143,210,168,.35); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }

/* ---------------------------------------------------------------- Divers */
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 14px; }
.kv { margin: 5px 0; overflow-wrap: break-word; }
.kv b { display: inline-block; min-width: 150px; color: var(--muted); font-weight: 500; font-size: 13px; }
.actions-row { display: flex; flex-wrap: wrap; gap: 8px; margin: 10px 0; align-items: center; }
.pile { display: flex; flex-direction: column; gap: 4px; }

.login-box {
  max-width: 400px; margin: 14vh auto; background: var(--carte);
  border: 1px solid var(--bord); border-radius: 22px; padding: 30px 26px;
}
.login-box h1 { text-align: center; }
.login-box input { width: 100%; margin: 8px 0; }
.login-box button { width: 100%; margin-top: 10px; padding: 12px; }

.pagination { margin: 16px 0; display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.pagination a, .pagination span { padding: 6px 12px; border: 1px solid var(--bord); border-radius: 10px; background: var(--carte); }
.pagination .cur { background: var(--degrade); color: var(--sur-accent); border-color: transparent; font-weight: 700; }

/* Pastille de notification (repérages à décider) */
.notif-dot {
  position: absolute; top: -4px; right: -6px; min-width: 18px; height: 18px;
  background: #f43f5e; color: #fff; border-radius: 99px; font-size: 11px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; padding: 0 4px;
}

/* Liste des champs personnalisables (/admin/champs) */
.champ-ligne {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  background: var(--carte); border: 1px solid var(--bord-soft); border-radius: 14px;
  padding: 10px 12px; margin: 8px 0;
}
.champ-ligne.inactif { opacity: .55; }
.champ-ligne .c-titre { font-weight: 700; }
.champ-ligne .c-info { flex: 1; min-width: 180px; }
.champ-ligne .c-cle { font-size: 12px; color: var(--muted); }
.champ-ligne .c-marques { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 4px; }
.champ-ligne .c-actions { display: flex; gap: 6px; align-items: center; }
.ordre-btns { display: flex; gap: 4px; }
.ordre-btns button {
  width: 34px; height: 34px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  background: transparent; border: 1px solid var(--bord); color: var(--muted); border-radius: 10px;
}
.ordre-btns button:hover { border-color: var(--accent); color: var(--accent); }
.ordre-btns .lucide { margin: 0; width: 16px; height: 16px; }

.c-marques { display: flex; flex-wrap: wrap; gap: 5px; }

/* Aperçu en direct du formulaire de champ (/admin/champs/:id) */
.apercu-champ {
  border: 1px dashed var(--accent-line); border-radius: 14px; padding: 12px 14px;
  background: rgba(240, 169, 76, .05);
}

/* ================================================================
   MODE APPLICATION (≤ 900px) : topbar + tabbar flottante
   ================================================================ */
@media (max-width: 900px) {
  .layout { display: block; }

  .topbar {
    display: flex; align-items: center; gap: 12px;
    position: fixed; top: 0; left: 0; right: 0; z-index: 60;
    background: rgba(13, 11, 7, .82);
    -webkit-backdrop-filter: blur(16px); backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--bord-soft);
    padding: 10px 16px;
    padding-top: calc(10px + var(--safe-top));
    padding-left: calc(16px + var(--safe-left));
    padding-right: calc(16px + var(--safe-right));
  }
  .topbar .brand-ico { margin: 0; }
  .topbar-title { flex: 1; font-weight: 800; font-size: 17px; letter-spacing: -.2px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  /* Bouton texte « Admin » (sans icône) : même convention que l'Annuaire. */
  .topbar-admin {
    display: inline-flex; align-items: center; min-height: 34px;
    padding: 6px 14px; border-radius: 999px;
    background: rgba(255, 255, 255, .07); border: 1px solid var(--bord);
    color: var(--texte); font-size: 13.5px; font-weight: 700; letter-spacing: -.01em;
    white-space: nowrap; flex: none;
  }
  .topbar-admin:hover { text-decoration: none; border-color: var(--accent); }
  .topbar-admin.on { background: var(--accent-soft); border-color: var(--accent-line); color: #f4cb96; }
  .topbar-bell { position: relative; display: inline-flex; padding: 4px 2px; color: var(--texte); flex: none; }
  .topbar-bell .lucide { width: 22px; height: 22px; }
  .topbar-bell:hover { text-decoration: none; }

  /* Pastille d'encre OPAQUE flottante, détachée des bords, sans bordure ni
     flou. Les 4 onglets sont strictement identiques : la seule destination
     mise en avant est la page ouverte. Ne pas réintroduire de trait, d'ombre,
     de bouton flottant ni de backdrop-filter ici. */
  .tabbar {
    display: flex; align-items: stretch; gap: 6px;
    position: fixed; z-index: 60;
    left: calc(12px + var(--safe-left));
    right: calc(12px + var(--safe-right));
    bottom: calc(4px + var(--safe-bottom));
    transform: translateY(15px);
    padding: 7px;
    background: var(--tabbar-base);
    border-radius: 26px;
  }
  body::after {
    content: ""; position: fixed; z-index: 59;
    left: 0; right: 0; bottom: 0;
    height: calc(4px + var(--safe-bottom));
    pointer-events: none; background: var(--tabbar-base);
  }
  .tab {
    position: relative; flex: 1 1 0; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center;
    gap: 6px; min-height: 66px; padding: 10px 2px;
    color: var(--muted); text-decoration: none; cursor: pointer;
    font-weight: 700; line-height: 1; letter-spacing: -.01em;
    border-radius: 20px; background: transparent;
    -webkit-user-select: none; user-select: none;
    transition: background .16s ease, color .16s ease, transform .1s ease;
  }
  .tab:hover { text-decoration: none; }
  .tab:active { transform: scale(.95); }
  .tab .t-ico { display: flex; align-items: center; justify-content: center; }
  .tab .t-ico .lucide { width: 25px; height: 25px; }
  .tab .t-lbl { max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
  .tab.on { background: var(--accent-soft); color: #f4cb96; font-weight: 800; }

  .sidebar { display: none; }

  .content {
    padding: calc(64px + var(--safe-top)) 14px calc(96px + var(--safe-bottom));
    padding-left: calc(14px + var(--safe-left));
    padding-right: calc(14px + var(--safe-right));
  }

  .grid2, .grid3 { grid-template-columns: 1fr; }
  .login-box { margin: max(8vh, calc(24px + var(--safe-top))) auto; padding: 26px 20px; max-width: min(400px, calc(100vw - 28px)); }
}

/* ================================================================
   SMARTPHONE (≤ 740px) : champs empilés, tactile ≥ 44px, 16px (anti-zoom iOS)
   ================================================================ */
@media (max-width: 740px) {
  input, select, textarea, button, .btn { font-size: 16px; }
  input, select { padding: 11px 12px; }
  button, .btn { min-height: 46px; padding: 11px 18px; }
  button.mini, .btn.mini {
    min-height: 40px; padding: 7px 14px; font-size: 14.5px;
    display: inline-flex; align-items: center; justify-content: center;
  }
  button.icone { min-height: 44px; width: 44px; }
  .ordre-btns button { min-height: 38px; width: 38px; }

  h1 { font-size: 21px; }
  .cards { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .card { padding: 12px 14px; }
  .panel { padding: 14px; border-radius: 16px; }
  details.bloc { padding: 10px 14px; border-radius: 16px; }

  .champs-form, .champs-fiche { grid-template-columns: 1fr; }
  .ch.plein, .champs-fiche .bloc-champ.plein { grid-column: auto; }

  /* Calendrier : sur iPhone, les cases deviennent des pastilles compactes.
     Le détail d'un jour se lit en le touchant (page /jour/:date). */
  .calendrier { gap: 3px; }
  .cal-case { min-height: 56px; padding: 4px 3px 5px; border-radius: 10px; }
  .cal-num { font-size: 12px; text-align: center; }
  .cal-ev {
    font-size: 0; line-height: 0; height: 5px; padding: 0; border-radius: 99px;
    border-left: 0; background: var(--puce);
  }
  .cal-ev b { font-size: 0; }
  .cal-plus { font-size: 9.5px; text-align: center; padding: 0; }
  .cal-jour-nom { font-size: 10px; }

  .filtres { gap: 10px; }
  .filtres > input:not([type=checkbox]):not([type=radio]),
  .filtres > select,
  .filtres > textarea { flex: 1 1 100%; width: 100%; }
  .filtres > button, .filtres > .btn { flex: 1 1 auto; }
  .filtres > label {
    flex: 1 1 100%; display: flex; align-items: center;
    justify-content: space-between; gap: 10px; min-width: 0;
  }
  .filtres > label > select,
  .filtres > label > input:not([type=checkbox]):not([type=radio]):not([type=number]) { flex: 1 1 auto; width: auto; min-width: 0; }
  .filtres > label:has(> input[type=checkbox]) { flex: 0 1 auto; justify-content: flex-start; }
  .filtres input[style*="min-width"], .champ-large { min-width: 0 !important; width: 100% !important; flex: 1 1 100%; }

  .kv b { display: block; min-width: 0; }
  .actions-row form.inline { display: contents; }

  /* Tableaux « cartes » : chaque ligne devient une fiche empilée */
  table.liste.cartes { display: block; border: 0; background: none; overflow: visible; }
  table.liste.cartes thead, table.liste.cartes tbody { display: block; }
  table.liste.cartes tr {
    display: block; background: var(--carte); border: 1px solid var(--bord-soft);
    border-radius: 16px; margin: 10px 0; padding: 12px 14px;
  }
  table.liste.cartes tr:first-child { display: none; }
  table.liste.cartes tr:hover td { background: transparent; }
  table.liste.cartes td {
    display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px 10px;
    border: 0; padding: 3px 0; overflow-wrap: anywhere;
  }
  table.liste.cartes td[data-th]::before {
    content: attr(data-th);
    flex: 0 0 96px; color: var(--muted); font-size: 11px;
    text-transform: uppercase; letter-spacing: .5px; line-height: 2.1;
  }
  table.liste.cartes td:empty { display: none; }
  table.liste.cartes td .badge { align-self: center; }

  .pagination a, .pagination span { padding: 9px 14px; }
  textarea { min-height: 92px; }
  .champ-ligne .c-actions { width: 100%; justify-content: flex-end; }
}

/* ================================================================
   iPhone étroit (≤ 380px)
   ================================================================ */
@media (max-width: 380px) {
  .tabbar { gap: 4px; padding: 6px; }
  .tab { min-height: 62px; gap: 5px; border-radius: 18px; }
  .tab .t-ico .lucide { width: 23px; height: 23px; }
  .tab .t-lbl { font-size: 12px; }
  .topbar-admin { padding: 6px 11px; font-size: 13px; }
  .topbar { gap: 9px; }
  .ev-date { width: 42px; height: 48px; }
  .ev-date .j { font-size: 18px; }
}

/* ================================================================
   Impression : fond clair lisible (fiche d'un événement)
   ================================================================ */
@media print {
  :root { color-scheme: light; }
  body { background: #fff !important; color: #111 !important; }
  .sidebar, .topbar, .tabbar, .filtres button, .logout-form, .form-actions,
  .btn-micro, .bascule, .actions-row { display: none !important; }
  body::after { content: none !important; }
  .content { padding: 0; }
  .panel, .card, table.liste, details.bloc, .ev-carte, .bloc-champ, .cal-case {
    background: #fff !important; color: #111 !important; border-color: #ccc !important;
  }
  table.liste td, table.liste th { color: #111 !important; background: #fff !important; }
  a { color: #b45309; }
  .muted, .kv b, .bloc-champ .etiq { color: #555 !important; }
}
