/* ================================================================
   Contact — thème sombre « application mobile »
   Même grammaire que /srv/annuaire (topbar fixe + pastille d'onglets
   flottante opaque, sidebar sur grand écran, icônes Lucide inline),
   avec une identité propre : nuit turquoise au lieu du bleu marine.
   Navigation volontairement réduite à 4 onglets : Accueil, Contacts,
   Ajouter, Liens. 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: #070f14;
  --fond-2: #0c1a20;
  --carte: #101b22;
  --carte-2: #16242d;
  --texte: #e7f1f2;
  --muted: #8ea6ad;
  --bord: #21363f;
  --bord-soft: rgba(255, 255, 255, .07);
  --accent: #2fd0ac;
  --accent-2: #4aa8ff;
  --accent-soft: rgba(47, 208, 172, .16);
  --accent-line: rgba(47, 208, 172, .38);
  --degrade: linear-gradient(135deg, #21c8a4, #3f9bf5);
  --sur-accent: #04211b;
  /* Fond OPAQUE de la barre d'onglets flottante : une pastille d'encre
     posée sur le fond, jamais un voile translucide. */
  --tabbar-base: #0e1a21;
  --ok: #3ddc97; --warn: #ffb54d; --err: #ff6b6b;
  --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(47, 208, 172, .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(47, 208, 172, .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(47, 208, 172, .07);
  border: 1px solid rgba(47, 208, 172, .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: #c3d6d9;
}
.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(9, 20, 26, .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: #04211b;
  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: #b3c6cb; 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: #b3c6cb;
  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; }
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(61, 220, 151, .35); background: linear-gradient(160deg, rgba(61,220,151,.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: var(--accent-soft); color: var(--accent);
}
.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 (la première des deux logiques de l'application)
   ================================================================ */
.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(47, 208, 172, .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; }

/* Index alphabétique de la liste */
.index-az { display: flex; flex-wrap: wrap; gap: 4px; margin: 10px 0 14px; }
.index-az a {
  min-width: 32px; text-align: center; padding: 5px 7px; border-radius: 9px;
  border: 1px solid var(--bord); background: var(--carte); color: var(--muted);
  font-size: 13px; font-weight: 700;
}
.index-az a:hover { text-decoration: none; border-color: var(--accent); color: var(--texte); }
.index-az a.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--texte); }

/* ================================================================
   CONTACTS : liste en cartes (aperçu configurable dans /admin/champs)
   ================================================================ */
.contacts { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 10px; margin: 12px 0; }
.c-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;
}
.c-carte:hover { text-decoration: none; border-color: var(--accent); }
.c-corps { min-width: 0; flex: 1; }
.c-nom { font-weight: 700; font-size: 15.5px; letter-spacing: -.15px; overflow-wrap: anywhere; }
.c-surnom { color: var(--muted); font-weight: 500; font-size: 13.5px; }
.c-apercu { margin-top: 4px; display: flex; flex-direction: column; gap: 2px; }
.c-apercu .ligne {
  display: flex; gap: 7px; align-items: baseline; font-size: 13px; color: #b8ccd1; min-width: 0;
}
.c-apercu .ligne .lucide { width: 14px; height: 14px; color: var(--muted); vertical-align: -.15em; }
.c-apercu .ligne .v { overflow-wrap: anywhere; }
.c-meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 7px; }

/* Pastille d'initiales (aucune image requise) */
.avatar {
  display: inline-flex; align-items: center; justify-content: center; flex: none;
  width: 44px; height: 44px; border-radius: 14px;
  background: var(--accent-soft); color: var(--accent);
  border: 1px solid var(--accent-line);
  font-weight: 800; font-size: 15px; letter-spacing: .5px; overflow: hidden;
}
.avatar img { width: 100%; height: 100%; object-fit: cover; }
.avatar.grand { width: 68px; height: 68px; border-radius: 20px; font-size: 22px; }
.avatar.mini { width: 34px; height: 34px; border-radius: 11px; font-size: 12.5px; }

/* ---------------------------------------------------------------- Fiche contact */
.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; }
.prononciation { color: var(--accent); font-size: 13px; display: inline-flex; align-items: center; gap: 5px; }
.prononciation .lucide { width: 14px; height: 14px; }

.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; }

/* ---------------------------------------------------------------- Liens entre contacts */
.liens-liste { display: flex; flex-direction: column; gap: 8px; margin: 10px 0; }
.lien-item {
  display: flex; align-items: center; gap: 10px;
  background: var(--carte); border: 1px solid var(--bord-soft); border-radius: 14px; padding: 9px 12px;
}
.lien-item .l-corps { flex: 1; min-width: 0; }
.lien-item .l-role { font-size: 12.5px; color: var(--accent); font-weight: 700; }
.lien-item .l-nom { font-weight: 600; overflow-wrap: anywhere; }
.lien-item .l-detail { font-size: 12.5px; color: var(--muted); }
.lien-item form { margin: 0; }
.fil-lien { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; font-size: 14px; }
.fil-lien .role { color: var(--accent); font-weight: 700; }

/* ---------------------------------------------------------------- Formulaire de contact */
/* Grille de champs : chaque champ 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: #c3d6d9; 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: #0c161c;
}
.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::after { content: ""; flex: 1; height: 1px; background: var(--bord-soft); }

/* Barre d'actions collée en bas du formulaire */
.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: #9fe3d1; white-space: nowrap;
}
.badge.ok { background: rgba(61, 220, 151, .16); color: var(--ok); }
.badge.warn { background: rgba(255, 181, 77, .16); color: var(--warn); }
.badge.err { background: rgba(255, 107, 107, .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: #0c161c; color: var(--texte); max-width: 100%;
}
input::placeholder, textarea::placeholder { color: rgba(142, 166, 173, .7); }
input:focus, select:focus, textarea:focus {
  border-color: var(--accent); outline: 3px solid rgba(47, 208, 172, .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='%238ea6ad' 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(47, 208, 172, .1); color: #9fe3d1; border: 1px solid var(--accent-line);
}
button.neutre, .btn.neutre {
  background: transparent; color: #b3c6cb; 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(255, 107, 107, .12); border: 1px solid rgba(255,107,107,.35); border-radius: 12px; padding: 10px 14px; margin: 10px 0; }
.succes-msg { color: var(--ok); background: rgba(61, 220, 151, .12); border: 1px solid rgba(61,220,151,.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: 8px; }

.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 (cloche des anniversaires) */
.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; }
.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; }

/* 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(47, 208, 172, .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(7, 15, 20, .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: #9fe3d1; }
  .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: #9fe3d1; 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; }
  .contacts { grid-template-columns: 1fr; }

  /* Un champ de formulaire en demi-largeur reste en demi-largeur sur iPhone
     s'il est court (date, téléphone…) : la grille passe à une colonne, mais
     les paires restent lisibles. Choix : tout empiler, plus confortable. */
  .champs-form, .champs-fiche { grid-template-columns: 1fr; }
  .ch.plein, .champs-fiche .bloc-champ.plein { grid-column: auto; }

  .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; }
}

/* ================================================================
   Impression : fond clair lisible (fiche contact)
   ================================================================ */
@media print {
  :root { color-scheme: light; }
  body { background: #fff !important; color: #111 !important; }
  .sidebar, .topbar, .tabbar, .filtres button, .logout-form, .form-actions, .btn-micro { display: none !important; }
  body::after { content: none !important; }
  .content { padding: 0; }
  .panel, .card, table.liste, details.bloc, .c-carte, .bloc-champ, .lien-item {
    background: #fff !important; color: #111 !important; border-color: #ccc !important;
  }
  table.liste td, table.liste th { color: #111 !important; background: #fff !important; }
  a { color: #0f766e; }
  .muted, .kv b, .bloc-champ .etiq { color: #555 !important; }
}
