/* Télépro : une vue contacts, un tiroir. Figtree pour le texte, Bricolage pour les titres. */
:root {
  --sans: "Figtree", -apple-system, "Segoe UI", system-ui, sans-serif;
  --display: "Bricolage Grotesque", var(--sans);
  --fond: #f6f7f9; --papier: #ffffff; --encre: #111318; --encre-2: #4a5061; --muet: #8b91a1;
  --trait: #e4e7ec; --trait-2: #eef0f4; --survol: #f8fafc;
  --accent: #0e7a5a; --accent-fonce: #0b6248; --accent-doux: #e6f5ef; --accent-texte: #0a5a42;
  --alerte: #c2410c; --alerte-doux: #fff1e8; --danger: #b42318; --danger-doux: #fdecea;
  --chaud: #b45309; --chaud-doux: #fef3c7; --bleu: #1d4ed8; --bleu-doux: #e8efff;
  --ombre: 0 1px 2px rgba(17,19,24,.05), 0 8px 24px rgba(17,19,24,.06);
  --ombre-forte: 0 12px 40px rgba(17,19,24,.18);
  --r: 12px; --r-s: 8px;
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 14px/1.45 var(--sans); color: var(--encre); background: var(--fond); padding-bottom: env(safe-area-inset-bottom); }
a { color: inherit; }
b { font-weight: 650; }
h1 { font-family: var(--display); font-size: 24px; font-weight: 700; letter-spacing: -.02em; margin: 0; }
h2 { font-family: var(--display); font-size: 19px; font-weight: 700; letter-spacing: -.015em; margin: 0; }
h3 { font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muet); margin: 0 0 .6rem; }
code { font-size: .9em; background: var(--papier); padding: 1px 5px; border-radius: 6px; border: 1px solid var(--trait); word-break: break-all; }
small { font-size: 12px; }
.muet { color: var(--muet); }
.sous { color: var(--encre-2); margin: .25rem 0; }
.aide { color: var(--muet); font-size: 12.5px; margin: .2rem 0 .4rem; }
.aide.centre { text-align: center; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
.bandeau { padding: .6rem .9rem; border-radius: var(--r-s); margin: .6rem 0; font-size: 13.5px; }
.bandeau.erreur, .erreur { background: var(--danger-doux); color: var(--danger); }
.bandeau.ok { background: var(--accent-doux); color: var(--accent-texte); }
.lien { color: var(--bleu); text-decoration: none; }
.lien:hover { text-decoration: underline; }
.lien-discret { color: var(--encre-2); font-size: 13px; text-decoration: none; padding: .3rem .5rem; }
.lien-discret:hover { color: var(--encre); text-decoration: underline; }
.enligne { display: inline; }

/* ---------- barre ---------- */
.barre { position: sticky; top: 0; z-index: 20; background: var(--papier); border-bottom: 1px solid var(--trait); height: 56px;
  display: flex; align-items: center; gap: 1.2rem; padding: 0 20px; }
.marque { display: inline-flex; align-items: center; gap: .55rem; font-family: var(--display); font-weight: 700; font-size: 15px; text-decoration: none; letter-spacing: -.01em; }
.pastille { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-doux); flex: none; }
.nav { display: flex; gap: .2rem; height: 100%; }
.nav a { display: inline-flex; align-items: center; padding: 0 .8rem; text-decoration: none; color: var(--encre-2); font-weight: 500; border-bottom: 2px solid transparent; margin-bottom: -1px; height: 56px; }
.nav a:hover { color: var(--encre); }
.nav a[aria-current] { color: var(--encre); border-bottom-color: var(--accent); font-weight: 600; }
.barre-droite { margin-left: auto; display: flex; align-items: center; gap: .8rem; }
.mode { font-size: 12px; font-weight: 600; color: var(--chaud); background: var(--chaud-doux); padding: 3px 9px; border-radius: 999px; white-space: nowrap; }
.avatar-btn { display: inline-flex; align-items: center; gap: .5rem; background: none; border: 0; padding: .25rem .4rem; font: inherit; color: var(--encre-2); cursor: pointer; border-radius: 999px; }
.avatar-btn:hover { background: var(--fond); }
.avatar { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 50%; background: var(--accent-doux); color: var(--accent-texte); font-weight: 700; font-size: 13px; flex: none; }
.avatar.petit { width: 28px; height: 28px; font-size: 12px; }
.avatar.grand { width: 48px; height: 48px; font-size: 19px; }
@media (max-width: 760px) { .marque-nom, .avatar-nom { display: none; } .barre { gap: .6rem; padding: 0 12px; } .nav a { padding: 0 .55rem; } }

.zone { padding: 0 20px 4rem; max-width: 1560px; margin: 0 auto; }
@media (max-width: 760px) { .zone { padding: 0 12px 4rem; } }

/* ---------- en-tete de vue ---------- */
.entete-vue { display: flex; flex-direction: column; gap: .7rem; padding: 1.2rem 0 .7rem; }
.titre-ligne { display: flex; align-items: flex-end; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
.actions-page { display: flex; gap: .5rem; }
.vues { display: flex; gap: .1rem; border-bottom: 1px solid var(--trait); overflow-x: auto; scrollbar-width: none; }
.vues::-webkit-scrollbar { display: none; }
.vues a { display: inline-flex; align-items: center; gap: .4rem; padding: .55rem .8rem; text-decoration: none; color: var(--encre-2); font-weight: 500; white-space: nowrap;
  border-bottom: 2px solid transparent; margin-bottom: -1px; font-size: 13.5px; }
.vues a:hover { color: var(--encre); }
.vues a[aria-current] { color: var(--encre); font-weight: 650; border-bottom-color: var(--encre); }
.vues .compte { font-variant-numeric: tabular-nums; color: var(--muet); font-size: 12px; }
.vues .du { background: var(--danger); color: #fff; font-size: 11px; padding: 1px 6px; border-radius: 999px; font-weight: 700; }
.filtres-ligne { display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; }
.recherche-champ { position: relative; flex: 1 1 260px; max-width: 420px; }
.recherche-champ svg { position: absolute; left: 10px; top: 50%; width: 16px; height: 16px; transform: translateY(-50%); color: var(--muet); }
.recherche-champ input { padding-left: 32px; }
.filtres-ligne select { width: auto; max-width: 46vw; }
.bascule { display: inline-flex; align-items: center; gap: .45rem; font-size: 13.5px; color: var(--encre-2); cursor: pointer; user-select: none; flex-direction: row; }
.bascule input { position: absolute; opacity: 0; width: 0; height: 0; }
.bascule span { width: 32px; height: 18px; border-radius: 999px; background: var(--trait); position: relative; transition: background .15s; flex: none; }
.bascule span::after { content: ""; position: absolute; top: 2px; left: 2px; width: 14px; height: 14px; border-radius: 50%; background: #fff; transition: transform .15s; box-shadow: 0 1px 2px rgba(0,0,0,.2); }
.bascule input:checked + span { background: var(--accent); }
.bascule input:checked + span::after { transform: translateX(14px); }
.bascule input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* ---------- controles ---------- */
label { display: flex; flex-direction: column; gap: .3rem; font-size: 12.5px; color: var(--encre-2); font-weight: 500; }
input, select, textarea { font: inherit; font-size: 14px; padding: .5rem .7rem; border: 1px solid var(--trait); border-radius: var(--r-s); background: var(--papier); color: var(--encre); width: 100%; transition: border-color .15s, box-shadow .15s; }
input:hover, select:hover, textarea:hover { border-color: #cfd4dd; }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
button:focus-visible, a:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
textarea { resize: vertical; }
.btn { display: inline-flex; align-items: center; justify-content: center; gap: .4rem; padding: .5rem .85rem; min-height: 36px; border-radius: var(--r-s); border: 1px solid var(--trait);
  background: var(--papier); color: var(--encre); font: inherit; font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; transition: background .15s, border-color .15s, transform .1s; }
.btn svg { width: 16px; height: 16px; }
.btn:hover { background: var(--survol); border-color: #cfd4dd; }
.btn:active { transform: translateY(1px); }
.btn.principal { background: var(--accent); border-color: var(--accent); color: #fff; }
.btn.principal:hover { background: var(--accent-fonce); border-color: var(--accent-fonce); }
.btn.large { width: 100%; min-height: 44px; }
.btn.htmx-request, .ico.htmx-request, .action.htmx-request { opacity: .55; pointer-events: none; }
.deux { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
.trois { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: .6rem; }
.ligne-boutons { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; padding-top: .3rem; }

/* ---------- puces ---------- */
.chip { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600; background: var(--accent-doux); color: var(--accent-texte); white-space: nowrap; line-height: 1.5; }
.chip.etat-nouveau { background: var(--bleu-doux); color: var(--bleu); }
.chip.etat-nrp { background: var(--chaud-doux); color: var(--chaud); }
.chip.etat-a_rappeler { background: var(--chaud-doux); color: var(--chaud); }
.chip.etat-rdv { background: var(--accent-doux); color: var(--accent-texte); }
.chip.etat-absent { background: var(--danger-doux); color: var(--danger); }
.chip.etat-venu { background: var(--accent); color: #fff; }
.chip.etat-sorti { background: var(--trait-2); color: var(--muet); }
.du { color: var(--danger); font-weight: 650; }

/* ---------- tableau ---------- */
.tableau-cadre { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--r); overflow: visible; }
.tableau { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.tableau th, .tableau td { text-align: left; padding: .55rem .75rem; vertical-align: middle; border-bottom: 1px solid var(--trait-2); }
.tableau tr:last-child td { border-bottom: 0; }
.tableau th { font-size: 11.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--muet); white-space: nowrap; background: var(--papier); border-bottom: 1px solid var(--trait); }
.tableau th:first-child { border-top-left-radius: var(--r); }
.tableau th:last-child { border-top-right-radius: var(--r); }
.tableau th a { text-decoration: none; color: inherit; display: inline-flex; align-items: center; gap: .3rem; }
.tableau th a:hover { color: var(--encre); }
.fleche { display: inline-block; width: 0; height: 0; border-left: 4px solid transparent; border-right: 4px solid transparent; opacity: .3; border-top: 5px solid currentColor; }
.tableau th.tri-asc .fleche { opacity: 1; border-top: 0; border-bottom: 5px solid var(--accent); }
.tableau th.tri-desc .fleche { opacity: 1; border-top: 5px solid var(--accent); }
.tableau th.tri-asc a, .tableau th.tri-desc a { color: var(--accent-texte); }
.tableau .etroit { width: 3.2rem; white-space: nowrap; }
.tableau .date { white-space: nowrap; }
.tableau .num { text-align: right; font-variant-numeric: tabular-nums; }
.tableau td small { display: block; line-height: 1.3; }
.tableau.compact th, .tableau.compact td { padding: .45rem .6rem; }
.tableau tr.total td { font-weight: 650; border-top: 2px solid var(--trait); }
tr.ligne { transition: background .12s; }
tr.ligne:hover { background: var(--survol); }
tr.ligne td:first-child { box-shadow: inset 3px 0 0 transparent; }
tr.ligne.due td:first-child { box-shadow: inset 3px 0 0 var(--danger); }
tr.ligne.aujourdhui td:first-child, tr.ligne.statut-nouveau td:first-child { box-shadow: inset 3px 0 0 var(--accent); }
.cel-nom { min-width: 200px; }
.cel-nom .nom { display: inline-flex; align-items: center; gap: .6rem; text-decoration: none; font-weight: 650; color: var(--encre); }
.cel-nom .nom:hover .nom-texte { color: var(--accent-texte); text-decoration: underline; }
.nom-texte { display: flex; flex-direction: column; }
.nom-texte small { font-weight: 400; }
.tel { text-decoration: none; font-variant-numeric: tabular-nums; color: var(--bleu); font-weight: 500; white-space: nowrap; }
.tel:hover { text-decoration: underline; }
.gestes-col { width: 1%; white-space: nowrap; }
.gestes-rapides { display: flex; gap: .2rem; justify-content: flex-end; opacity: .55; transition: opacity .12s; }
tr.ligne:hover .gestes-rapides, tr.ligne:focus-within .gestes-rapides { opacity: 1; }
.ico { display: inline-flex; align-items: center; gap: .3rem; height: 30px; padding: 0 .5rem; border-radius: var(--r-s); border: 1px solid transparent; background: transparent; color: var(--encre-2);
  font: inherit; font-size: 12.5px; font-weight: 600; cursor: pointer; list-style: none; white-space: nowrap; }
.ico svg { width: 16px; height: 16px; }
.ico:hover { background: var(--papier); border-color: var(--trait); color: var(--encre); box-shadow: var(--ombre); }
.ico.accent { color: var(--accent-texte); }
.ico.accent:hover { background: var(--accent-doux); border-color: transparent; }
.ico span { display: none; }
@media (min-width: 1280px) { .ico span { display: inline; } }
details.menu { position: relative; }
details.menu > summary { list-style: none; }
details.menu > summary::-webkit-details-marker { display: none; }
.volet { position: absolute; z-index: 30; top: calc(100% + 6px); right: 0; min-width: 290px; max-width: calc(100vw - 32px);
  background: var(--papier); border: 1px solid var(--trait); border-radius: var(--r); box-shadow: var(--ombre-forte); padding: .9rem; display: flex; flex-direction: column; gap: .6rem; text-align: left; }
.volet-titre { margin: 0 0 .1rem; font-weight: 700; font-size: 14px; }
.rapides { display: flex; flex-wrap: wrap; gap: .35rem; }
.rapides button { font: inherit; font-size: 13px; padding: .4rem .7rem; border-radius: 999px; border: 1px solid var(--trait); background: var(--papier); cursor: pointer; }
.rapides button:hover { background: var(--accent-doux); border-color: var(--accent); color: var(--accent-texte); }
.rapides.colonne { flex-direction: column; align-items: stretch; }
.rapides.colonne button { text-align: left; border-radius: var(--r-s); }
.vide { background: var(--papier); border: 1px dashed var(--trait); border-radius: var(--r); padding: 3rem 1rem; text-align: center; color: var(--muet); display: flex; flex-direction: column; align-items: center; gap: .6rem; }
.vide svg { width: 48px; height: 48px; opacity: .5; }

/* tableau -> cartes */
@media (max-width: 900px) {
  .tableau-cadre { background: none; border: 0; }
  .tableau, .tableau tbody, .tableau tr, .tableau td { display: block; }
  .tableau thead { display: none; }
  tr.ligne { background: var(--papier); border: 1px solid var(--trait); border-radius: var(--r); padding: .7rem .9rem .6rem; margin-bottom: .55rem; position: relative; }
  tr.ligne td { border: 0; padding: .1rem 0; display: inline-block; margin-right: .7rem; font-size: 13px; color: var(--encre-2); box-shadow: none !important; }
  tr.ligne td.cel-nom { display: block; margin: 0 0 .2rem; font-size: 15px; }
  tr.ligne td[data-l]:not(.cel-tel)::before { content: attr(data-l) " "; color: var(--muet); font-size: 11.5px; }
  tr.ligne td:empty { display: none; }
  .tableau td small { display: inline; margin-left: .3rem; }
  tr.ligne.due { border-left: 3px solid var(--danger); }
  tr.ligne.aujourdhui, tr.ligne.statut-nouveau { border-left: 3px solid var(--accent); }
  tr.ligne td.gestes-col { display: block; margin: .4rem 0 0; white-space: normal; padding: .4rem 0 0; border-top: 1px solid var(--trait-2); width: auto; }
  .gestes-rapides { opacity: 1; justify-content: flex-start; }
  .ico span { display: inline; }
  .volet { right: auto; left: 0; }
  .tableau.compact, .tableau.compact tbody, .tableau.compact tr, .tableau.compact td, .tableau.compact thead { display: revert; }
  .bord .tableau-cadre { background: var(--papier); border: 1px solid var(--trait); overflow-x: auto; }
}

/* ---------- tiroir ---------- */
.voile { position: fixed; inset: 0; background: rgba(17,19,24,.28); z-index: 40; backdrop-filter: blur(1px); }
.voile[hidden] { display: none; }
.tiroir { position: fixed; top: 0; right: 0; bottom: 0; width: min(520px, 100vw); background: var(--papier); z-index: 50; box-shadow: var(--ombre-forte); overflow-y: auto; overscroll-behavior: contain;
  transform: translateX(100%); transition: transform .22s ease-out; }
.tiroir[hidden] { display: none; }
.tiroir.ouvert { transform: translateX(0); }
.tiroir-corps { display: flex; flex-direction: column; min-height: 100%; }
.tiroir-tete { position: relative; padding: 1.2rem 1.3rem .9rem; border-bottom: 1px solid var(--trait); display: flex; flex-direction: column; gap: .7rem; }
.fermer { position: absolute; top: .8rem; right: .8rem; width: 32px; height: 32px; border-radius: 50%; border: 0; background: var(--fond); color: var(--encre-2); cursor: pointer; display: grid; place-items: center; }
.fermer:hover { background: var(--trait); color: var(--encre); }
.fermer svg { width: 16px; height: 16px; }
.identite { display: flex; gap: .8rem; align-items: flex-start; padding-right: 2.2rem; }
.identite-texte { display: flex; flex-direction: column; gap: .3rem; min-width: 0; }
.identite-sous { margin: 0; display: flex; flex-wrap: wrap; gap: .35rem; align-items: center; font-size: 13px; }
.identite-contacts { margin: 0; display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: 14px; }
.repere { display: flex; flex-wrap: wrap; gap: .3rem 1rem; font-size: 13px; color: var(--encre-2); }
.actions-fiche { display: flex; flex-wrap: wrap; gap: .35rem; }
.action { display: inline-flex; flex-direction: column; align-items: center; justify-content: center; gap: .25rem; min-width: 64px; padding: .5rem .6rem; border-radius: var(--r-s); border: 1px solid var(--trait);
  background: var(--papier); color: var(--encre-2); font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; text-decoration: none; list-style: none; }
.action svg { width: 18px; height: 18px; }
.action:hover { background: var(--survol); color: var(--encre); border-color: #cfd4dd; }
.action.accent { background: var(--accent-doux); border-color: transparent; color: var(--accent-texte); }
.action.accent:hover { background: #d6eee3; }
.actions-fiche details.menu .volet { left: 0; right: auto; }
.bloc { padding: 1rem 1.3rem; border-bottom: 1px solid var(--trait-2); }
.bloc:last-child { border-bottom: 0; }
.proprietes { display: flex; flex-direction: column; gap: .6rem; }
.chips-choix { display: flex; flex-wrap: wrap; gap: .35rem; }
.chip-choix input { position: absolute; opacity: 0; width: 0; height: 0; }
.chip-choix span { display: inline-block; padding: .3rem .7rem; border-radius: 999px; border: 1px solid var(--trait); font-size: 12.5px; color: var(--encre-2); cursor: pointer; user-select: none; transition: all .12s; }
.chip-choix span:hover { border-color: #cfd4dd; }
.chip-choix input:checked + span { background: var(--accent-doux); border-color: var(--accent); color: var(--accent-texte); font-weight: 600; }
.chip-choix input:focus-visible + span { outline: 2px solid var(--accent); outline-offset: 2px; }
.note { display: flex; gap: .4rem; margin-bottom: .8rem; }
.chrono { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.chrono li { display: grid; grid-template-columns: 28px 1fr; gap: .5rem; padding: .5rem 0; border-bottom: 1px solid var(--trait-2); font-size: 13.5px; align-items: start; }
.chrono li:last-child { border-bottom: 0; }
.chrono li small { display: block; }
.chrono li.prevu { color: var(--chaud); }
.chrono li.prevu small { color: var(--chaud); opacity: .8; }
.chrono-ico { display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; background: var(--fond); font-size: 14px; }
.correspondance { display: grid; grid-template-columns: 1fr 1fr; gap: .5rem; }
.apercu { overflow-x: auto; border: 1px solid var(--trait); border-radius: var(--r-s); font-size: 12px; }
.apercu .tableau th, .apercu .tableau td { white-space: nowrap; }

/* ---------- connexion, reglages, bord ---------- */
.carte-connexion { max-width: 380px; margin: 12vh auto 0; background: var(--papier); padding: 1.8rem; border-radius: 16px; box-shadow: var(--ombre); display: flex; flex-direction: column; gap: .9rem; text-align: center; border: 1px solid var(--trait); }
.carte-connexion .marque { justify-content: center; font-size: 22px; }
.carte-connexion form { display: flex; flex-direction: column; gap: .8rem; text-align: left; }
.page-etroite { max-width: 760px; padding-top: 1.2rem; }
.formulaire { display: flex; flex-direction: column; gap: .8rem; background: var(--papier); padding: 1.2rem; border-radius: var(--r); border: 1px solid var(--trait); margin: 1rem 0 1.5rem; }
.formulaire h2, .page-etroite h2 { font-size: 16px; margin: .6rem 0 0; }
.formulaire h2:first-child { margin-top: 0; }
.case { flex-direction: row; align-items: center; gap: .5rem; font-size: 13.5px; }
.case input { width: auto; }
.etat { font-size: 11.5px; padding: 1px 8px; border-radius: 999px; font-weight: 600; }
.etat.ok { background: var(--accent-doux); color: var(--accent-texte); }
.etat.ko { background: var(--danger-doux); color: var(--danger); }
.utilisateurs { list-style: none; padding: 0; margin: 0 0 1rem; display: flex; flex-direction: column; gap: .4rem; }
.utilisateurs li { background: var(--papier); padding: .6rem .9rem; border-radius: var(--r-s); border: 1px solid var(--trait); display: flex; flex-wrap: wrap; gap: .5rem; align-items: center; justify-content: space-between; }
.utilisateurs li.inactif { opacity: .55; }
.bord h1 { margin: 1.2rem 0 .6rem; }
.bord h2 { font-size: 15px; margin: 1.4rem 0 .5rem; }
.tuiles { display: grid; grid-template-columns: 1fr 1fr; gap: .6rem; }
@media (min-width: 900px) { .tuiles { grid-template-columns: repeat(4, 1fr); } }
.tuile { background: var(--papier); border-radius: var(--r); border: 1px solid var(--trait); padding: 1rem 1.1rem; display: flex; flex-direction: column; gap: .1rem; }
.tuile .chiffre { font-family: var(--display); font-size: 30px; font-weight: 700; line-height: 1.1; color: var(--accent-texte); font-variant-numeric: tabular-nums; letter-spacing: -.02em; }
.tuile small { font-size: 12px; }
.deux-colonnes { display: grid; grid-template-columns: 1fr; gap: 0 1.5rem; }
@media (min-width: 900px) { .deux-colonnes { grid-template-columns: 1fr 1fr; } }

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