/* ==========================================================================
   SaphirG — bureau virtuel, interface de type application mobile
   Mobile d'abord : barre d'onglets en bas, grands titres, listes groupées,
   panneaux qui montent du bas. Sur grand écran : rail de navigation à gauche.
   ========================================================================== */

/* --- Jetons -------------------------------------------------------------- */
:root {
  color-scheme: light;
  --fond: #f2f4f9;
  --surface: #ffffff;
  --surface-2: #f6f7fb;
  --surface-3: #eceff6;
  --bordure: #e4e7ef;
  --bordure-forte: #d2d8e4;
  --separateur: rgba(20, 27, 45, .08);
  --texte: #10172a;
  --texte-doux: #5b6478;
  --texte-faible: #8b93a6;

  --principal: #2554eb;
  --principal-fonce: #1b40c4;
  --principal-doux: #e8eeff;
  --violet: #7c3aed;
  --degrade: linear-gradient(140deg, #2554eb 0%, #5b47ef 55%, #7c3aed 100%);

  --succes: #0f8a55;
  --succes-doux: #e2f6ec;
  --danger: #d92d27;
  --danger-doux: #fdeceb;
  --alerte: #b26200;
  --alerte-doux: #fff2dc;

  --verre: rgba(242, 244, 249, .82);
  --verre-surface: rgba(255, 255, 255, .86);
  --ombre: 0 1px 2px rgba(16, 23, 42, .04), 0 1px 1px rgba(16, 23, 42, .03);
  --ombre-haute: 0 18px 44px -12px rgba(16, 23, 42, .28), 0 4px 12px -4px rgba(16, 23, 42, .08);
  --anneau: 0 0 0 3px rgba(37, 84, 235, .28);

  --c-direction: #6d3fd1;
  --c-comptabilite: #0f8a55;
  --c-rh: #d03f78;
  --c-informatique: #2554eb;
  --c-commercial: #d9690f;
  --c-marketing: #b8329f;
  --c-clients: #0b8597;
  --c-technique: #5f7a10;
  --c: var(--principal);

  --rayon: 16px;
  --hauteur-onglets: 64px;
  --largeur-rail: 92px;
  --haut-sur: env(safe-area-inset-top, 0px);
  --bas-sur: env(safe-area-inset-bottom, 0px);
  --ressort: cubic-bezier(.2, .9, .25, 1);
}

:root[data-theme="sombre"] {
  color-scheme: dark;
  --fond: #000000;
  --surface: #14161d;
  --surface-2: #1b1e27;
  --surface-3: #242833;
  --bordure: #262a35;
  --bordure-forte: #353a48;
  --separateur: rgba(255, 255, 255, .08);
  --texte: #f1f3f8;
  --texte-doux: #a3aabb;
  --texte-faible: #6f7688;
  --principal: #7097ff;
  --principal-fonce: #94b1ff;
  --principal-doux: #18234a;
  --succes: #3fd28f;
  --succes-doux: #0d2a1e;
  --danger: #ff6b62;
  --danger-doux: #36151a;
  --alerte: #f6b44e;
  --alerte-doux: #33240c;
  --verre: rgba(0, 0, 0, .78);
  --verre-surface: rgba(20, 22, 29, .86);
  --ombre: none;
  --ombre-haute: 0 20px 50px -12px rgba(0, 0, 0, .8);
  --anneau: 0 0 0 3px rgba(112, 151, 255, .4);
  --c-direction: #a98bff;
  --c-comptabilite: #3fd28f;
  --c-rh: #f47fae;
  --c-informatique: #7097ff;
  --c-commercial: #f6a061;
  --c-marketing: #ea7fd8;
  --c-clients: #45c9db;
  --c-technique: #b5cf4f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    color-scheme: dark;
    --fond: #000000;
    --surface: #14161d;
    --surface-2: #1b1e27;
    --surface-3: #242833;
    --bordure: #262a35;
    --bordure-forte: #353a48;
    --separateur: rgba(255, 255, 255, .08);
    --texte: #f1f3f8;
    --texte-doux: #a3aabb;
    --texte-faible: #6f7688;
    --principal: #7097ff;
    --principal-fonce: #94b1ff;
    --principal-doux: #18234a;
    --succes: #3fd28f;
    --succes-doux: #0d2a1e;
    --danger: #ff6b62;
    --danger-doux: #36151a;
    --alerte: #f6b44e;
    --alerte-doux: #33240c;
    --verre: rgba(0, 0, 0, .78);
    --verre-surface: rgba(20, 22, 29, .86);
    --ombre: none;
    --ombre-haute: 0 20px 50px -12px rgba(0, 0, 0, .8);
    --anneau: 0 0 0 3px rgba(112, 151, 255, .4);
    --c-direction: #a98bff;
    --c-comptabilite: #3fd28f;
    --c-rh: #f47fae;
    --c-informatique: #7097ff;
    --c-commercial: #f6a061;
    --c-marketing: #ea7fd8;
    --c-clients: #45c9db;
    --c-technique: #b5cf4f;
  }
}

.espace-direction { --c: var(--c-direction); }
.espace-comptabilite { --c: var(--c-comptabilite); }
.espace-rh { --c: var(--c-rh); }
.espace-informatique { --c: var(--c-informatique); }
.espace-commercial { --c: var(--c-commercial); }
.espace-marketing { --c: var(--c-marketing); }
.espace-clients { --c: var(--c-clients); }
.espace-technique { --c: var(--c-technique); }

/* --- Base ---------------------------------------------------------------- */
@view-transition { navigation: auto; }
::view-transition-old(root), ::view-transition-new(root) { animation-duration: .18s; }

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; scroll-padding-top: 80px; }
html, body { margin: 0; }
body {
  background: var(--fond);
  color: var(--texte);
  font: 16px/1.45 -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI Variable Text", "Segoe UI", Roboto, system-ui, sans-serif;
  -webkit-font-smoothing: antialiased;
  -webkit-tap-highlight-color: transparent;
  overscroll-behavior-y: contain;
}
a { color: var(--principal); text-decoration: none; }
h1, h2, h3, p { margin: 0; }
h1, h2, h3 { letter-spacing: -.015em; line-height: 1.2; }
small { color: var(--texte-doux); }
button { font: inherit; color: inherit; }
[hidden] { display: none !important; }
.mono { font-family: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace; font-size: .85em; }
.visuellement-cache { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: none; box-shadow: var(--anneau); border-radius: 10px; }

.ic {
  width: 22px; height: 22px; flex-shrink: 0;
  fill: none; stroke: currentColor; stroke-width: 1.85; stroke-linecap: round; stroke-linejoin: round;
}

/* --- Barres de défilement ------------------------------------------------ */
:root {
  --defil-pouce: color-mix(in srgb, var(--texte) 22%, transparent);
  --defil-pouce-survol: color-mix(in srgb, var(--texte) 40%, transparent);
  --defil-pouce-actif: var(--principal);
}

/* Firefox (propriétés standard) */
@supports (-moz-appearance: none) {
  * { scrollbar-width: thin; scrollbar-color: var(--defil-pouce) transparent; }
}

/* Chrome, Edge, Safari : pouce arrondi « flottant » (bordure transparente = marge autour) */
::-webkit-scrollbar { width: 12px; height: 12px; background: transparent; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb {
  background-color: var(--defil-pouce); background-clip: padding-box;
  border: 3px solid transparent; border-radius: 99px; min-height: 40px;
}
::-webkit-scrollbar-thumb:hover { background-color: var(--defil-pouce-survol); }
::-webkit-scrollbar-thumb:active { background-color: var(--defil-pouce-actif); }
::-webkit-scrollbar-corner { background: transparent; }
::-webkit-scrollbar-button { display: none; width: 0; height: 0; }

/* Zones internes (feuilles, tableaux, menus) : encore plus fines */
dialog.feuille::-webkit-scrollbar, .tableau-perf::-webkit-scrollbar, .tableau-rapport::-webkit-scrollbar,
.tableau-defilant::-webkit-scrollbar, .periode-form::-webkit-scrollbar { width: 8px; height: 8px; }
dialog.feuille::-webkit-scrollbar-thumb, .tableau-perf::-webkit-scrollbar-thumb, .tableau-rapport::-webkit-scrollbar-thumb,
.tableau-defilant::-webkit-scrollbar-thumb, .periode-form::-webkit-scrollbar-thumb { border-width: 2px; }

/* Rail de navigation : jamais de barre visible */
.onglets { scrollbar-width: none; }
.onglets::-webkit-scrollbar { display: none; }

/* Bandeaux horizontaux façon application : défilement au doigt, sans barre */
.carrousel, .puces-filtre { scrollbar-width: none; }
.carrousel::-webkit-scrollbar, .puces-filtre::-webkit-scrollbar { display: none; }

/* --- Logo ---------------------------------------------------------------- */
.logo-app {
  display: inline-grid; place-items: center; flex-shrink: 0;
  width: 44px; height: 44px; border-radius: 13px;
  background: var(--degrade); color: #fff;
  box-shadow: 0 8px 18px -8px rgba(61, 72, 236, .7), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.logo-app .ic { width: 58%; height: 58%; }
.logo-app.grand { width: 76px; height: 76px; border-radius: 22px; }
.logo-app.clair { background: rgba(255, 255, 255, .18); box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .3), 0 10px 30px -10px rgba(0, 0, 0, .35); }

/* --- Coquille de l'application ------------------------------------------ */
.app { min-height: 100vh; min-height: 100dvh; }
.ecran { min-height: 100vh; min-height: 100dvh; }

/* Barre d'onglets (bas de l'écran) */
.onglets {
  position: fixed; z-index: 40; left: 0; right: 0; bottom: 0;
  display: flex; justify-content: space-around; align-items: stretch;
  height: calc(var(--hauteur-onglets) + var(--bas-sur)); padding: 6px 4px var(--bas-sur);
  background: var(--verre-surface);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--separateur);
  user-select: none; -webkit-user-select: none;
  view-transition-name: onglets;
}
.onglets-logo { display: none; }
.onglet {
  flex: 1; max-width: 120px;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px;
  color: var(--texte-faible); font-size: 11px; font-weight: 600; letter-spacing: .01em;
}
.onglet-icone {
  display: grid; place-items: center; width: 60px; height: 30px; border-radius: 15px;
  transition: background .25s var(--ressort), color .2s;
}
.onglet .ic { width: 24px; height: 24px; }
.onglet.actif { color: var(--principal); }
.onglet.actif .onglet-icone { background: var(--principal-doux); }
.onglet.actif .ic { stroke-width: 2.15; }
.onglet:active .onglet-icone { transform: scale(.92); }

/* Barre du haut : bouton retour + titre compact qui apparaît au défilement */
.barre-app {
  position: sticky; top: 0; z-index: 30;
  display: grid; grid-template-columns: 1fr auto 1fr; align-items: center; gap: 8px;
  min-height: calc(48px + var(--haut-sur)); padding: var(--haut-sur) 12px 0;
  background: transparent; border-bottom: .5px solid transparent;
  transition: background .2s, border-color .2s;
}
.barre-app.defile {
  background: var(--verre);
  backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-bottom-color: var(--separateur);
}
.barre-gauche { justify-self: start; min-width: 0; }
.barre-droite { justify-self: end; display: flex; align-items: center; gap: 6px; }
.barre-titre {
  font-size: 17px; font-weight: 650; max-width: 56vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  opacity: 0; transform: translateY(4px); transition: opacity .2s, transform .2s;
}
.barre-app.defile .barre-titre { opacity: 1; transform: none; }
.bouton-retour {
  display: inline-flex; align-items: center; gap: 0; margin-left: -6px; padding: 8px 6px;
  color: var(--principal); font-size: 17px; font-weight: 500; border-radius: 10px;
}
.bouton-retour .ic { width: 26px; height: 26px; stroke-width: 2.2; }
.bouton-retour span { max-width: 42vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bouton-retour:active { opacity: .5; }
.session {
  font-size: 12px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--texte-faible);
  padding: 4px 9px; border-radius: 99px; background: var(--surface-3);
}
.session:empty { display: none; }
.session.bientot { color: #fff; background: var(--danger); }

.contenu {
  padding: 4px 16px calc(var(--hauteur-onglets) + var(--bas-sur) + 96px);
  max-width: 1080px; margin: 0 auto;
  animation: entree .28s var(--ressort);
}
@keyframes entree { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --- Titres -------------------------------------------------------------- */
.grand-titre { margin: 2px 0 18px; }
.grand-titre h1 { font-size: 34px; font-weight: 800; letter-spacing: -.025em; line-height: 1.1; }
.sur-titre { font-size: 13px; font-weight: 600; color: var(--texte-faible); text-transform: uppercase; letter-spacing: .05em; margin-bottom: 4px; }
.avec-avatar { display: flex; align-items: flex-end; justify-content: space-between; gap: 12px; }
.avec-avatar .avatar { width: 42px; height: 42px; font-size: 15px; }
.description { color: var(--texte-doux); font-size: 15px; margin-top: 6px; }
.entete-espace { display: flex; gap: 14px; align-items: flex-start; }
.entete-espace h1 { font-size: 28px; }

.section { margin-top: 28px; }
.section-tete { display: flex; align-items: baseline; justify-content: space-between; margin: 0 4px 10px; }
.section-tete h2 { font-size: 21px; font-weight: 750; }
.section-tete a { font-size: 15px; font-weight: 500; }
.titre-groupe {
  font-size: 13px; font-weight: 600; text-transform: uppercase; letter-spacing: .05em; color: var(--texte-faible);
  margin: 26px 16px 8px;
}
.colonnes { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0 24px; }
.colonnes > * { min-width: 0; }

/* --- Cartes -------------------------------------------------------------- */
.carte { background: var(--surface); border-radius: var(--rayon); padding: 18px; box-shadow: var(--ombre); }
.carte.etroit { max-width: 520px; }

/* Icônes d'application (accueil) */
.grille-apps { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 18px 6px; padding: 4px 0; }
.app-icone { display: flex; flex-direction: column; align-items: center; gap: 7px; color: var(--texte); text-align: center; }
.app-tuile {
  position: relative; display: grid; place-items: center; flex-shrink: 0;
  width: 62px; height: 62px; border-radius: 17px; color: #fff;
  background: linear-gradient(150deg, color-mix(in srgb, var(--c) 72%, #fff) 0%, var(--c) 55%, color-mix(in srgb, var(--c) 80%, #000) 100%);
  box-shadow: 0 8px 18px -10px var(--c), inset 0 1px 0 rgba(255, 255, 255, .3);
  transition: transform .2s var(--ressort);
}
.app-tuile .ic { width: 30px; height: 30px; stroke-width: 1.9; }
.app-tuile.petite { width: 44px; height: 44px; border-radius: 12px; }
.app-tuile.petite .ic { width: 22px; height: 22px; }
.app-tuile.mini { width: 30px; height: 30px; border-radius: 8px; }
.app-tuile.mini .ic { width: 17px; height: 17px; }
.entete-espace .app-tuile { width: 56px; height: 56px; border-radius: 16px; }
.app-icone:active .app-tuile { transform: scale(.9); }
.app-nom { font-size: 12.5px; font-weight: 500; line-height: 1.2; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bulle {
  position: absolute; top: -6px; right: -6px; min-width: 22px; height: 22px; padding: 0 6px;
  display: grid; place-items: center; border-radius: 11px;
  background: var(--danger); color: #fff; font-size: 12px; font-weight: 700; box-shadow: 0 0 0 2px var(--fond);
}
.app-lecture {
  position: absolute; bottom: -5px; right: -5px; width: 22px; height: 22px; display: grid; place-items: center;
  border-radius: 50%; background: var(--surface); color: var(--texte-doux); box-shadow: 0 0 0 2px var(--fond);
}
.app-lecture .ic { width: 13px; height: 13px; }

/* Statistiques défilantes */
.carrousel {
  display: flex; gap: 10px; overflow-x: auto; scroll-snap-type: x mandatory;
  margin: 0 -16px; padding: 2px 16px 6px; scrollbar-width: none;
}
.carrousel::-webkit-scrollbar { display: none; }
.stat {
  flex: 0 0 142px; scroll-snap-align: start;
  display: flex; flex-direction: column; gap: 2px;
  padding: 14px; border-radius: var(--rayon); background: var(--surface); color: var(--texte); box-shadow: var(--ombre);
  transition: transform .15s;
}
.stat:active { transform: scale(.97); }
.stat-icone { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: var(--principal-doux); color: var(--principal); margin-bottom: 8px; }
.stat-icone .ic { width: 19px; height: 19px; }
.stat-valeur { font-size: 26px; font-weight: 750; line-height: 1.1; font-variant-numeric: tabular-nums; }
.stat-libelle { font-size: 13px; color: var(--texte-doux); }
.stat-alerte .stat-icone { background: var(--danger-doux); color: var(--danger); }
.stat-alerte .stat-valeur { color: var(--danger); }

/* --- Listes groupées ----------------------------------------------------- */
.liste-groupe {
  list-style: none; margin: 0; padding: 0;
  background: var(--surface); border-radius: var(--rayon); overflow: hidden; box-shadow: var(--ombre);
}
.liste-groupe > li { position: relative; }
.liste-groupe > li + li::before {
  content: ""; position: absolute; top: 0; right: 0; left: 66px; height: .5px; background: var(--separateur); z-index: 1;
}
.liste-groupe > li > form { margin: 0; }
.ligne {
  display: flex; align-items: center; gap: 13px; width: 100%; min-height: 58px;
  padding: 10px 16px; border: 0; background: none; color: var(--texte); text-align: left;
  cursor: pointer; transition: background .12s;
}
div.ligne { cursor: default; }
a.ligne:active, button.ligne:active { background: var(--surface-3); }
@media (hover: hover) { a.ligne:hover, button.ligne:hover { background: var(--surface-2); } }
.ligne > .ic { color: var(--texte-doux); margin: 0 4px; }
.ligne-haute { padding-top: 13px; padding-bottom: 13px; }
.ligne-texte { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.ligne-texte strong { font-size: 16px; font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-texte small { font-size: 13.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-meta { font-size: 12.5px; font-weight: 600; color: var(--c); }
.ligne-extrait { font-size: 15px; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ligne-fin { display: flex; align-items: center; gap: 6px; flex-shrink: 0; color: var(--texte-faible); font-size: 14px; }
.ligne-fin .ic { width: 20px; height: 20px; }
.ligne-fin .chevron { width: 18px; height: 18px; stroke-width: 2.4; color: var(--bordure-forte); }
.ligne-danger, .ligne-danger > .ic { color: var(--danger) !important; }
.ligne-centre { justify-content: center; font-weight: 600; }
.ligne.inactif .ligne-texte, .ligne.inactif .avatar { opacity: .45; }
.ligne-alerte { background: color-mix(in srgb, var(--alerte-doux) 60%, transparent); }
.compteur {
  display: inline-grid; place-items: center; min-width: 24px; height: 22px; padding: 0 7px;
  border-radius: 11px; background: var(--surface-3); color: var(--texte-doux); font-size: 13px; font-weight: 650;
}
.point-actif { width: 9px; height: 9px; border-radius: 50%; background: var(--succes); box-shadow: 0 0 0 3px var(--succes-doux); }

.puce-espace {
  display: grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 11px;
  background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c);
}
.puce-espace .ic { width: 20px; height: 20px; }
.pastille-icone {
  display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 10px;
  background: var(--surface-3); color: var(--texte-doux);
}
.pastille-icone .ic { width: 19px; height: 19px; }
.pastille-icone.ok { background: var(--succes-doux); color: var(--succes); }
.pastille-icone.alerte { background: var(--alerte-doux); color: var(--alerte); }
.pastille-icone.geante { width: 84px; height: 84px; border-radius: 26px; background: var(--principal-doux); color: var(--principal); }
.pastille-icone.geante .ic { width: 40px; height: 40px; }

.ext {
  display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px;
  font-size: 10px; font-weight: 800; letter-spacing: .02em; background: var(--principal-doux); color: var(--principal);
}
.ext-pdf { background: color-mix(in srgb, #e5484d 15%, transparent); color: #e0393f; }
.ext-doc, .ext-docx, .ext-odt { background: color-mix(in srgb, #2b6be6 15%, transparent); color: #3b78ef; }
.ext-xls, .ext-xlsx, .ext-ods, .ext-csv { background: color-mix(in srgb, #12a150 15%, transparent); color: #17a957; }
.ext-ppt, .ext-pptx, .ext-odp { background: color-mix(in srgb, #e5701c 15%, transparent); color: #e5701c; }
.ext-png, .ext-jpg, .ext-jpeg, .ext-gif { background: color-mix(in srgb, #a54de5 15%, transparent); color: #a957e8; }
.ext-zip { background: color-mix(in srgb, #a3824a 18%, transparent); color: #a8874f; }
.ext-dwg, .ext-dxf { background: color-mix(in srgb, #0b8597 16%, transparent); color: #1aa6b8; }

.badge {
  display: inline-flex; align-items: center; gap: 4px; white-space: nowrap;
  font-size: 12px; font-weight: 600; padding: 3px 9px; border-radius: 99px; background: var(--surface-3); color: var(--texte-doux);
}
.badge .ic { width: 13px; height: 13px; }
.badge-ok { background: var(--succes-doux); color: var(--succes); }
.badge-alerte { background: var(--alerte-doux); color: var(--alerte); }
.badge-danger { background: var(--danger-doux); color: var(--danger); }
.pastilles { display: flex; flex-wrap: wrap; gap: 5px; margin-top: 6px; }
.pastilles.centre { justify-content: center; }
.pastille {
  font-size: 12px; font-weight: 600; padding: 2px 9px; border-radius: 99px;
  background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); border: 1px solid transparent;
}
.pastille.lecture { background: transparent; border: 1px dashed color-mix(in srgb, var(--c) 65%, transparent); }

.vide {
  display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 34px 20px;
  color: var(--texte-faible); text-align: center; font-size: 15px;
}
.vide > .ic { width: 38px; height: 38px; stroke-width: 1.4; }

/* --- Contrôles ----------------------------------------------------------- */
.segmente {
  display: flex; gap: 2px; padding: 3px; margin: 0 0 18px;
  border-radius: 12px; background: var(--surface-3);
}
.segmente > button, .segmente > a {
  flex: 1; display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 6px 10px; border: 0; border-radius: 9px; background: none;
  color: var(--texte-doux); font-size: 14.5px; font-weight: 600; cursor: pointer; transition: background .2s, color .2s;
}
.segmente > [aria-selected="true"], .segmente > [aria-pressed="true"] { background: var(--surface); color: var(--texte); box-shadow: 0 2px 6px rgba(16, 23, 42, .1); }
.segmente .compteur { height: 19px; min-width: 20px; font-size: 12px; background: transparent; }
.segmente.compact { margin: 0; flex-shrink: 0; }
.segmente.compact > button { padding: 5px 9px; font-size: 13px; min-height: 30px; }

.puces-filtre { display: flex; gap: 8px; overflow-x: auto; margin: 0 -16px 18px; padding: 0 16px 2px; scrollbar-width: none; }
.puces-filtre::-webkit-scrollbar { display: none; }
.puce {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 5px; padding: 7px 14px; border-radius: 99px;
  background: var(--surface); color: var(--texte); font-size: 14px; font-weight: 600; box-shadow: var(--ombre); border: 1px solid var(--bordure);
}
.puce .ic { width: 15px; height: 15px; }
.puce.actif { background: var(--texte); color: var(--surface); border-color: var(--texte); }
.puce-alerte:not(.actif) { color: var(--alerte); }

.recherche { position: relative; display: block; margin: 0 0 14px; }
.recherche .ic { position: absolute; left: 11px; top: 50%; transform: translateY(-50%); width: 19px; height: 19px; color: var(--texte-faible); pointer-events: none; }
.recherche input { padding-left: 38px !important; min-height: 42px !important; background: var(--surface-3) !important; border-color: transparent !important; }

/* Boutons */
.bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  min-height: 50px; padding: 12px 20px; border-radius: 14px;
  border: 0; background: var(--surface-3); color: var(--principal);
  font-size: 16.5px; font-weight: 650; cursor: pointer; white-space: nowrap;
  transition: transform .12s, background .15s, opacity .15s;
}
.bouton .ic { width: 20px; height: 20px; }
.bouton:active { transform: scale(.97); opacity: .85; }
.bouton:disabled { opacity: .55; }
.bouton-principal { background: var(--principal); color: #fff; }
:root[data-theme="sombre"] .bouton-principal { color: #050816; }
@media (prefers-color-scheme: dark) { :root:not([data-theme="clair"]) .bouton-principal { color: #050816; } }
.bouton-danger-plein { background: var(--danger); color: #fff; }
.bouton-petit { min-height: 34px; padding: 6px 14px; font-size: 14px; border-radius: 10px; }
.bouton.plein { width: 100%; }
.bouton-lien { background: none; border: 0; padding: 0; color: var(--principal); font-weight: 600; cursor: pointer; }
.bouton-lien.petit { font-size: 13px; font-weight: 500; color: var(--texte-faible); }

/* Bouton d'action flottant */
.fab {
  position: fixed; z-index: 35; right: 18px; bottom: calc(var(--hauteur-onglets) + var(--bas-sur) + 18px);
  display: grid; place-items: center; width: 60px; height: 60px; border: 0; border-radius: 20px;
  background: var(--degrade); color: #fff; cursor: pointer;
  box-shadow: 0 14px 30px -10px rgba(61, 72, 236, .75), 0 4px 10px -4px rgba(0, 0, 0, .2);
  transition: transform .2s var(--ressort);
  animation: fab-entree .35s var(--ressort);
}
.fab .ic { width: 28px; height: 28px; stroke-width: 2.3; }
.fab:active { transform: scale(.9); }
@keyframes fab-entree { from { transform: scale(.4); opacity: 0; } to { transform: none; opacity: 1; } }

/* Champs */
label { display: block; font-size: 14px; font-weight: 600; color: var(--texte-doux); margin: 16px 4px 6px; }
.requis { color: var(--danger); }
input[type=text], input[type=password], input[type=email], input[type=search], input[type=tel], input[type=number], input[type=date], input[type=time], select, textarea {
  width: 100%; min-height: 50px; padding: 12px 14px;
  border: 1px solid var(--bordure); border-radius: 13px;
  background: var(--surface-2); color: var(--texte);
  font: inherit; font-size: 16px; /* 16 px : pas de zoom automatique sur iPhone */
  -webkit-appearance: none; appearance: none; transition: border-color .15s, box-shadow .15s, background .15s;
}
input::placeholder, textarea::placeholder { color: var(--texte-faible); }
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--principal); background: var(--surface); box-shadow: var(--anneau); }
input[type=search]::-webkit-search-cancel-button { -webkit-appearance: none; }
select {
  padding-right: 40px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--texte-faible) 50%), linear-gradient(135deg, var(--texte-faible) 50%, transparent 50%);
  background-position: calc(100% - 20px) 52%, calc(100% - 14px) 52%; background-size: 6px 6px; background-repeat: no-repeat;
}
textarea { resize: none; min-height: 120px; }
.aide { display: block; margin: 8px 4px 0; font-size: 13px; color: var(--texte-faible); }
.erreur-champ { color: var(--danger); font-size: 13.5px; margin: 6px 4px 0; }
.alerte-formulaire {
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; border-radius: 13px; margin-bottom: 4px;
  background: var(--danger-doux); color: var(--danger); font-size: 14.5px; font-weight: 500;
}
.champ-icone { position: relative; }
.champ-icone > .ic { position: absolute; left: 14px; top: 50%; transform: translateY(-50%); width: 20px; height: 20px; color: var(--texte-faible); pointer-events: none; }
.champ-icone input { padding-left: 44px; }
.champ-mdp input { padding-right: 50px; }
.voir-mdp {
  position: absolute; right: 5px; top: 50%; transform: translateY(-50%);
  display: grid; place-items: center; width: 42px; height: 42px; border-radius: 10px; border: 0; background: none; color: var(--texte-faible); cursor: pointer;
}
.voir-mdp .ic { width: 20px; height: 20px; }
.jauge { height: 6px; background: var(--surface-3); border-radius: 99px; margin: 10px 4px 0; overflow: hidden; }
.jauge span { display: block; height: 100%; width: 0; border-radius: 99px; transition: width .25s, background .25s; }
.aide-mdp { list-style: none; font-size: 13.5px; color: var(--texte-doux); padding: 0; margin: 10px 4px 0; display: grid; gap: 4px; }
.aide-mdp li::before { content: "○"; display: inline-block; width: 20px; color: var(--texte-faible); }
.aide-mdp li.ok { color: var(--succes); }
.aide-mdp li.ok::before { content: "✓"; color: var(--succes); font-weight: 700; }
.carte form > .bouton, .connexion-feuille form > .bouton { margin-top: 22px; }
.ligne-champ { display: flex; gap: 8px; }
.ligne-champ .bouton { min-height: 50px; }

/* --- Panneaux montants (feuilles) --------------------------------------- */
dialog.feuille {
  position: fixed; inset: auto 0 0 0; margin: 0 auto; width: 100%; max-width: 560px; max-height: 92dvh;
  padding: 0; border: 0; border-radius: 26px 26px 0 0;
  background: var(--fond); color: var(--texte); overflow: auto; overscroll-behavior: contain;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, .18);
}
dialog.feuille[open] { animation: feuille-monte .34s var(--ressort); }
dialog.feuille.ferme { animation: feuille-descend .22s ease-in forwards; }
dialog.feuille::backdrop { background: rgba(4, 8, 20, .42); animation: voile .3s ease-out; }
dialog.feuille.ferme::backdrop { animation: voile .22s ease-in reverse forwards; }
@keyframes feuille-monte { from { transform: translateY(100%); } to { transform: none; } }
@keyframes feuille-descend { to { transform: translateY(100%); } }
@keyframes voile { from { opacity: 0; } to { opacity: 1; } }
.feuille-corps { display: block; padding: 8px 16px calc(18px + var(--bas-sur)); }
.feuille-poignee { width: 40px; height: 5px; margin: 0 auto 14px; border-radius: 3px; background: var(--bordure-forte); touch-action: none; cursor: grab; }
.feuille h2 { font-size: 22px; font-weight: 750; margin: 0 4px 4px; }
.feuille .liste-groupe { margin: 14px 0; }
.feuille-entete { display: flex; align-items: center; gap: 13px; padding: 4px; }
.feuille-entete .ligne-texte strong { font-size: 18px; white-space: normal; overflow-wrap: anywhere; }
.feuille-entete .avatar { width: 48px; height: 48px; font-size: 17px; }
.feuille-boutons { display: grid; gap: 10px; margin-top: 22px; }
.confirmation-texte { text-align: center; font-size: 17px; font-weight: 600; padding: 6px 10px 0; }
.formulaire-role { margin-top: 14px; padding: 12px 14px 14px; }
.formulaire-role label { margin-top: 0; }

/* Zone de dépôt dans la feuille */
form[data-zone-depot] > input[type=file] { position: absolute; width: 1px; height: 1px; opacity: 0; }
label.zone-depot {
  display: flex; flex-direction: column; align-items: center; gap: 8px; margin: 16px 0 0; padding: 30px 20px;
  border: 2px dashed var(--bordure-forte); border-radius: 20px; background: var(--surface);
  color: var(--texte); text-align: center; cursor: pointer; font-weight: 500;
  transition: border-color .15s, background .15s;
}
label.zone-depot small { font-size: 13px; font-weight: 400; }
label.zone-depot strong { font-size: 17px; overflow-wrap: anywhere; }
form.survol label.zone-depot, label.zone-depot.choisi { border-color: var(--principal); background: var(--principal-doux); }
.zone-icone { display: grid; place-items: center; width: 56px; height: 56px; border-radius: 16px; background: var(--principal-doux); color: var(--principal); }
.zone-icone .ic { width: 28px; height: 28px; }

/* --- Annonces (bulles) -------------------------------------------------- */
.bulle-annonce { display: flex; gap: 10px; margin-bottom: 14px; align-items: flex-end; }
.bulle-corps {
  flex: 1; min-width: 0; padding: 11px 14px; border-radius: 20px 20px 20px 6px;
  background: var(--surface); box-shadow: var(--ombre);
}
.bulle-tete { display: flex; justify-content: space-between; gap: 10px; font-size: 13px; margin-bottom: 3px; }
.bulle-tete strong { color: var(--principal); font-weight: 650; }
.bulle-tete time { color: var(--texte-faible); }
.bulle-corps p { font-size: 15.5px; overflow-wrap: anywhere; }
.bulle-corps form { margin-top: 6px; text-align: right; }

/* --- Avatar ------------------------------------------------------------- */
.avatar {
  display: inline-grid; place-items: center; flex-shrink: 0; width: 38px; height: 38px; border-radius: 50%;
  background: var(--degrade); color: #fff; font-weight: 700; font-size: 14px; letter-spacing: .02em;
}
.avatar.petit { width: 38px; height: 38px; font-size: 13.5px; }
.avatar.tres-grand { width: 92px; height: 92px; font-size: 32px; box-shadow: 0 14px 30px -12px rgba(61, 72, 236, .7); }

.profil-carte { display: flex; flex-direction: column; align-items: center; text-align: center; padding: 26px 18px 22px; gap: 4px; }
.profil-carte h2 { font-size: 22px; margin-top: 10px; }
.profil-carte p { color: var(--texte-doux); font-size: 15px; }
.espace-haut { margin-top: 28px !important; }

/* --- Administration ----------------------------------------------------- */
.encart-mdp { margin-bottom: 18px; display: grid; gap: 14px; border: 1px solid color-mix(in srgb, var(--alerte) 35%, transparent); }
.encart-tete { display: flex; gap: 12px; align-items: center; }
.encart-tete .ligne-texte strong { white-space: normal; }
.encart-mdp code {
  display: block; text-align: center; font-family: ui-monospace, "SF Mono", Consolas, monospace;
  font-size: 22px; font-weight: 650; letter-spacing: .06em; padding: 14px; border-radius: 13px; background: var(--surface-2); user-select: all;
}
.pagination { display: flex; justify-content: center; align-items: center; gap: 14px; margin-top: 18px; font-size: 14px; color: var(--texte-doux); }
.pagination .ic { width: 16px; height: 16px; }

/* --- Notifications ------------------------------------------------------ */
.toasts {
  position: fixed; z-index: 100; left: 50%; transform: translateX(-50%);
  bottom: calc(var(--hauteur-onglets) + var(--bas-sur) + 14px);
  width: min(460px, calc(100% - 24px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none;
}
.page-seule ~ .toasts { bottom: calc(16px + var(--bas-sur)); }
.toast {
  display: flex; align-items: center; gap: 11px; padding: 13px 16px; border-radius: 16px;
  background: rgba(22, 26, 38, .94); color: #fff; font-size: 15px; font-weight: 500;
  backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
  box-shadow: 0 12px 30px -10px rgba(0, 0, 0, .45); pointer-events: auto; cursor: pointer;
  animation: toast-entree .4s var(--ressort);
}
.toast .ic { width: 20px; height: 20px; }
.toast-success .ic { color: #4be39b; }
.toast-error .ic { color: #ff8a80; }
.toast.sortie { animation: toast-sortie .25s ease-in forwards; }
@keyframes toast-entree { from { opacity: 0; transform: translateY(20px) scale(.96); } to { opacity: 1; transform: none; } }
@keyframes toast-sortie { to { opacity: 0; transform: translateY(14px) scale(.97); } }

.bandeau-hors-ligne {
  position: fixed; z-index: 110; top: calc(8px + var(--haut-sur)); left: 50%; transform: translateX(-50%);
  display: flex; align-items: center; gap: 7px; padding: 7px 14px; border-radius: 99px;
  background: #1c2132; color: #fff; font-size: 13.5px; font-weight: 600; box-shadow: var(--ombre-haute);
}
.bandeau-hors-ligne .ic { width: 16px; height: 16px; color: #f6b44e; }

/* --- Écrans sans navigation : connexion, premier mot de passe ---------- */
.page-seule { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; background: var(--fond); }
.ecran-connexion { flex: 1; display: flex; flex-direction: column; background: var(--degrade); }
.connexion-haut {
  position: relative; flex: 1; min-height: 250px; overflow: hidden;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: calc(34px + var(--haut-sur)) 24px 40px; color: #fff; text-align: center;
}
.connexion-haut::before { content: ""; position: absolute; width: 380px; height: 380px; right: -150px; top: -150px; border-radius: 50%; background: radial-gradient(circle, rgba(255, 255, 255, .24), transparent 65%); }
.connexion-haut > * { position: relative; }
.connexion-haut .logo-app { margin-bottom: 8px; }
.connexion-haut h1 { font-size: 30px; font-weight: 800; letter-spacing: -.025em; }
.connexion-haut p { opacity: .85; font-size: 16px; max-width: 320px; }
.puces-services { display: flex; flex-wrap: wrap; justify-content: center; gap: 8px; margin-top: 18px; max-width: 320px; }
.puces-services span { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 10px; background: rgba(255, 255, 255, .14); }
.puces-services .ic { width: 17px; height: 17px; }
.connexion-feuille {
  position: relative; margin-top: -24px; padding: 28px 20px calc(28px + var(--bas-sur));
  border-radius: 28px 28px 0 0; background: var(--fond);
  animation: feuille-monte .5s var(--ressort);
}
.connexion-feuille h2 { font-size: 26px; font-weight: 800; margin: 0 4px 6px; }
.connexion-feuille form .bouton.plein { margin-top: 22px; }
.connexion-feuille > .bouton.plein { margin-top: 12px; }
.note { display: flex; gap: 9px; align-items: flex-start; margin: 18px 4px 0; font-size: 13px; color: var(--texte-faible); }
.note .ic { width: 17px; height: 17px; color: var(--succes); margin-top: 1px; }
.lien-centre { text-align: center; margin-top: 16px; }

.page-erreur {
  min-height: 70vh; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 10px;
  padding: 40px 24px calc(40px + var(--bas-sur)); text-align: center; margin: auto; max-width: 420px;
}
.page-erreur h1 { font-size: 26px; font-weight: 800; }
.page-erreur p:not(.code-erreur) { color: var(--texte-doux); margin-bottom: 10px; }
.page-erreur .bouton { margin-top: 10px; }
.code-erreur { font-size: 15px; font-weight: 700; color: var(--texte-faible); letter-spacing: .1em; margin-top: 8px; }
.logo-etat { position: relative; display: inline-block; margin-bottom: 14px; }
.pastille-etat { position: absolute; right: -10px; bottom: -10px; display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; background: var(--surface); color: var(--alerte); box-shadow: var(--ombre-haute); }
.pastille-etat .ic { width: 18px; height: 18px; }

/* --- Prospection -------------------------------------------------------- */
.statut-nouveau    { --s: #2f6bff; }
.statut-contacte   { --s: #0ea5c6; }
.statut-discussion { --s: #7c4dff; }
.statut-devis      { --s: #e8780c; }
.statut-relance    { --s: #c99000; }
.statut-client     { --s: #12a15a; }
.statut-perdu      { --s: #8b93a6; }
.point-statut { width: 10px; height: 10px; border-radius: 50%; background: var(--s, var(--texte-faible)); flex-shrink: 0; }
.avatar-statut {
  display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 50%;
  background: color-mix(in srgb, var(--s) 16%, transparent); color: var(--s); font-weight: 750; font-size: 15px;
}
.avatar-statut.geant { width: 88px; height: 88px; font-size: 32px; box-shadow: 0 0 0 5px var(--fond), 0 0 0 7px color-mix(in srgb, var(--s) 35%, transparent); }
.badge-statut {
  display: inline-flex; align-items: center; white-space: nowrap; font-size: 12px; font-weight: 650;
  padding: 3px 10px; border-radius: 99px; background: color-mix(in srgb, var(--s) 15%, transparent); color: var(--s);
}
.badge-statut.grand { font-size: 14px; padding: 5px 14px; }
.puce .point-statut { width: 8px; height: 8px; }
.puce-nb { font-size: 12px; font-weight: 700; opacity: .55; margin-left: 2px; }
.puce.actif .puce-nb { opacity: .8; }
.relance { display: inline-flex !important; align-items: center; gap: 4px; font-weight: 600; color: var(--texte-doux) !important; }
.relance .ic { width: 14px; height: 14px; }
.relance.jour { color: var(--alerte) !important; }
.relance.retard { color: var(--danger) !important; }
small.mini { font-size: 12px !important; color: var(--texte-faible); }

.alerte-relance {
  display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 14px; color: var(--texte);
  border: 1px solid color-mix(in srgb, var(--alerte) 35%, transparent); background: var(--alerte-doux);
}
.alerte-relance .chevron { width: 18px; height: 18px; color: var(--texte-faible); stroke-width: 2.4; }
.outils-liste { display: flex; gap: 10px; flex-wrap: wrap; align-items: flex-start; }
.outils-liste .recherche { flex: 1 1 240px; }
.filtre-responsable { flex: 1 1 200px; margin-bottom: 14px; }
.filtre-responsable select { min-height: 42px; background-color: var(--surface-3); border-color: transparent; }

.bouton-texte { color: var(--principal); font-size: 17px; font-weight: 600; padding: 8px 4px; }
.bouton-texte:active { opacity: .5; }

.fiche-tete { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 6px; margin: 4px 0 18px; }
.grand-titre.centre { margin: 10px 0 0; }
.grand-titre.centre h1 { font-size: 28px; }
.fiche-entreprise { display: inline-flex; align-items: center; gap: 6px; color: var(--texte-doux); font-size: 15px; }
.fiche-entreprise .ic { width: 17px; height: 17px; }

.actions-rapides { display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 8px; margin-bottom: 18px; }
.actions-rapides > a, .actions-rapides > button, .actions-rapides > span {
  display: flex; flex-direction: column; align-items: center; gap: 6px; padding: 10px 2px;
  border: 0; border-radius: 14px; background: var(--surface); box-shadow: var(--ombre);
  color: var(--principal); font-size: 12px; font-weight: 600; cursor: pointer;
}
.actions-rapides > a:active, .actions-rapides > button:active { transform: scale(.95); }
.actions-rapides .inactif { color: var(--texte-faible); opacity: .5; cursor: default; }
.action-icone { display: grid; place-items: center; width: 36px; height: 36px; border-radius: 50%; background: var(--principal-doux); }
.action-icone .ic { width: 19px; height: 19px; }
.action-icone.whatsapp { background: color-mix(in srgb, #25d366 18%, transparent); color: #16a34a; }
.inactif .action-icone { background: var(--surface-3); color: var(--texte-faible); }

.pipeline {
  list-style: none; margin: 0 0 18px; padding: 14px 10px 12px; display: grid; grid-template-columns: repeat(6, 1fr);
  background: var(--surface); border-radius: var(--rayon); box-shadow: var(--ombre);
}
.pipeline li {
  position: relative; display: flex; flex-direction: column; align-items: center; gap: 6px; text-align: center;
  font-size: 10.5px; font-weight: 600; color: var(--texte-faible); line-height: 1.15;
}
.pipeline li span { position: relative; z-index: 1; width: 14px; height: 14px; border-radius: 50%; background: var(--surface-3); border: 2px solid var(--surface); box-shadow: 0 0 0 1px var(--bordure-forte); }
.pipeline li + li::before { content: ""; position: absolute; top: 6px; right: 50%; width: 100%; height: 2px; background: var(--surface-3); }
.pipeline li.fait span, .pipeline li.courant span { background: var(--principal); box-shadow: 0 0 0 1px var(--principal); }
.pipeline li.fait + li::before { background: var(--principal); }
.pipeline li.fait { color: var(--texte-doux); }
.pipeline li.courant { color: var(--principal); }
.pipeline li.courant span { box-shadow: 0 0 0 4px var(--principal-doux), 0 0 0 1px var(--principal); }
.bandeau-perdu { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; color: var(--texte-doux); font-weight: 600; }

.carte-relance { display: flex; align-items: center; gap: 12px; padding: 12px 14px; margin-bottom: 4px; }
.carte-relance .pastille-icone { background: var(--principal-doux); color: var(--principal); }
.carte-relance.jour { background: var(--alerte-doux); }
.carte-relance.jour .pastille-icone { background: color-mix(in srgb, var(--alerte) 18%, transparent); color: var(--alerte); }
.carte-relance.retard { background: var(--danger-doux); }
.carte-relance.retard .pastille-icone { background: color-mix(in srgb, var(--danger) 16%, transparent); color: var(--danger); }
.carte-relance.retard strong { color: var(--danger); }

.infos .ligne { min-height: 50px; justify-content: space-between; gap: 16px; }
.infos .libelle { color: var(--texte-doux); font-size: 15px; flex-shrink: 0; }
.infos .valeur { text-align: right; font-size: 15px; overflow-wrap: anywhere; min-width: 0; }
.infos .valeur.fort { font-weight: 700; }
.liste-groupe.infos > li + li::before { left: 16px; }
.notes { display: flex; gap: 10px; font-size: 15px; }
.notes .ic { width: 18px; height: 18px; color: var(--texte-faible); margin-top: 2px; }

.chronologie { list-style: none; margin: 0; padding: 0 0 0 4px; }
.chronologie li { position: relative; display: flex; gap: 12px; padding-bottom: 14px; }
.chronologie li:not(:last-child)::before { content: ""; position: absolute; left: 17px; top: 38px; bottom: 0; width: 2px; background: var(--bordure); }
.chrono-icone { display: grid; place-items: center; flex-shrink: 0; width: 36px; height: 36px; border-radius: 50%; background: var(--surface); color: var(--principal); box-shadow: var(--ombre); border: 1px solid var(--bordure); }
.chrono-icone .ic { width: 17px; height: 17px; }
.type-statut .chrono-icone { background: var(--principal-doux); }
.type-whatsapp .chrono-icone { color: #16a34a; }
.chrono-corps { flex: 1; min-width: 0; background: var(--surface); border-radius: 14px; padding: 10px 13px; box-shadow: var(--ombre); }
.chrono-tete { display: flex; justify-content: space-between; gap: 8px; font-size: 13.5px; }
.chrono-tete time { color: var(--texte-faible); font-size: 12.5px; white-space: nowrap; }
.chrono-corps p { font-size: 15px; margin: 3px 0 2px; overflow-wrap: anywhere; }
.chrono-corps small { font-size: 12.5px; color: var(--texte-faible); }

.choix-types { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-top: 12px; }
.choix-type { margin: 0; cursor: pointer; position: relative; }
.choix-type input { position: absolute; opacity: 0; pointer-events: none; }
.choix-type span {
  display: flex; flex-direction: column; align-items: center; gap: 5px; padding: 11px 4px; border-radius: 13px;
  background: var(--surface); border: 1.5px solid var(--bordure); color: var(--texte-doux); font-size: 13px; font-weight: 600; transition: all .15s;
}
.choix-type .ic { width: 20px; height: 20px; }
.choix-type span { text-align: center; line-height: 1.2; }
.choix-type input:checked + span { border-color: var(--principal); background: var(--principal-doux); color: var(--principal); }
.choix-type input:focus-visible + span { box-shadow: var(--anneau); }
.choix-statuts label.ligne { margin: 0; color: var(--texte); font-size: 16px; min-height: 50px; position: relative; }
.choix-statuts input { position: absolute; opacity: 0; pointer-events: none; }
.choix-statuts .coche { color: var(--principal); visibility: hidden; display: inline-flex; }
.choix-statuts input:checked ~ .coche { visibility: visible; }
.choix-statuts input:focus-visible ~ .ligne-texte { text-decoration: underline; }
.choix-statuts > li + li::before { left: 40px; }

.formulaire-fiche .carte { padding: 4px 16px 18px; }
.formulaire-fiche .champ label { margin-top: 14px; }
.champ.en-erreur input, .champ.en-erreur select { border-color: var(--danger); }
.bouton-enregistrer { margin-top: 24px; }

.mini-stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 8px; }
.mini-stats a { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 14px; background: var(--surface); box-shadow: var(--ombre); color: var(--texte); text-align: center; }
.mini-stats strong { font-size: 22px; font-weight: 750; font-variant-numeric: tabular-nums; }
.mini-stats span { font-size: 11.5px; color: var(--texte-doux); line-height: 1.2; }
.mini-stats a.alerte strong { color: var(--danger); }
.mini-stats a.ok strong { color: var(--succes); }
.mini-stats a:active { transform: scale(.96); }
.espace-haut-petit { margin-top: 12px !important; }

/* --- Clients et affaires ------------------------------------------------- */
.affaire-devis   { --s: #2f6bff; }
.affaire-signe   { --s: #7c4dff; }
.affaire-facture { --s: #e8780c; }
.affaire-paye    { --s: #12a15a; }
.affaire-annule  { --s: #8b93a6; }
.avatar-client {
  display: grid; place-items: center; flex-shrink: 0; width: 42px; height: 42px; border-radius: 12px;
  background: linear-gradient(150deg, color-mix(in srgb, var(--principal) 22%, transparent), color-mix(in srgb, var(--violet) 22%, transparent));
  color: var(--principal); font-weight: 750; font-size: 15px;
}
.avatar-client.geant { width: 88px; height: 88px; border-radius: 26px; font-size: 32px; box-shadow: 0 14px 30px -14px rgba(61, 72, 236, .6); }
.montant { font-weight: 700; color: var(--texte); font-variant-numeric: tabular-nums; font-size: 15px; }
.ligne-fin.colonne { flex-direction: column; align-items: flex-end; gap: 3px; }
.badge-affaire {
  font-size: 11.5px; font-weight: 650; padding: 2px 9px; border-radius: 99px;
  background: color-mix(in srgb, var(--s) 15%, transparent); color: var(--s); white-space: nowrap;
}
.pastille-icone.affaire { background: color-mix(in srgb, var(--s, var(--succes)) 15%, transparent); color: var(--s, var(--succes)); }
.resume-ca { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 14px 16px; }
.resume-ca .ligne-texte strong { font-size: 22px; font-weight: 750; white-space: normal; }
.lien-client, .bouton-convertir { margin-bottom: 18px; }
.lien-client { display: flex; align-items: center; gap: 12px; padding: 12px 14px; color: var(--texte); }
.lien-client .chevron { width: 18px; height: 18px; color: var(--bordure-forte); stroke-width: 2.4; }
.bouton-convertir { background: var(--succes-doux); color: var(--succes); }
.mini-stats > div { display: flex; flex-direction: column; align-items: center; gap: 2px; padding: 12px 4px; border-radius: 14px; background: var(--surface); box-shadow: var(--ombre); text-align: center; min-width: 0; }
.mini-stats > div strong { font-size: 18px; font-weight: 750; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.mini-stats > div.ok strong { color: var(--succes); }
.mini-stats > div.alerte-douce strong { color: var(--alerte); }
.mini-stats.trois { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.espace-haut-moyen { margin-top: 24px; }
.marge-haut { margin-top: 12px; }
.texte-danger { color: var(--danger) !important; }
.valeur.lien { color: var(--principal); display: inline-flex; align-items: center; gap: 2px; }
.valeur.lien .chevron { width: 16px; height: 16px; stroke-width: 2.4; }

/* Interrupteur (case à cocher façon application) */
.interrupteur { position: relative; display: flex; align-items: center; gap: 12px; margin: 18px 4px 4px; color: var(--texte); font-size: 16px; font-weight: 500; cursor: pointer; }
.interrupteur input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.glissiere { position: relative; flex-shrink: 0; width: 51px; height: 31px; border-radius: 16px; background: var(--surface-3); transition: background .2s; }
.glissiere::after { content: ""; position: absolute; top: 2px; left: 2px; width: 27px; height: 27px; border-radius: 50%; background: #fff; box-shadow: 0 2px 5px rgba(0, 0, 0, .25); transition: transform .25s var(--ressort); }
.interrupteur input:checked + .glissiere { background: var(--succes); }
.interrupteur input:checked + .glissiere::after { transform: translateX(20px); }
.interrupteur input:focus-visible + .glissiere { box-shadow: var(--anneau); }

/* --- Tâches, agenda, notifications --------------------------------------- */
@media (max-width: 819px) { .rail-seulement { display: none !important; } }

.bouton-cloche { position: relative; display: grid; place-items: center; width: 40px; height: 40px; border-radius: 12px; color: var(--texte); }
.bouton-cloche .ic { width: 23px; height: 23px; }
.bouton-cloche:active { background: var(--surface-3); }
.bouton-cloche.actif { color: var(--principal); }
.pastille-cloche, .pastille-onglet {
  position: absolute; display: grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 9px;
  background: var(--danger); color: #fff; font-size: 11px; font-weight: 750; box-shadow: 0 0 0 2px var(--fond);
}
.pastille-cloche { top: 3px; right: 1px; }
.onglet-icone { position: relative; }
.pastille-onglet { top: -3px; right: 8px; box-shadow: 0 0 0 2px var(--surface); }
.pastille-cloche.secoue { animation: secoue .5s; }
@keyframes secoue { 0%, 100% { transform: none; } 25% { transform: scale(1.3); } 50% { transform: scale(.9); } 75% { transform: scale(1.15); } }

/* Lignes de tâche avec case à cocher ronde */
.ligne-tache { display: flex; align-items: center; }
.liste-taches > li + li::before { left: 58px; }
.case-form { margin: 0; padding-left: 14px; }
.case {
  display: grid; place-items: center; width: 28px; height: 28px; border-radius: 50%; padding: 0;
  border: 2px solid var(--bordure-forte); background: none; color: transparent; cursor: pointer; transition: all .2s var(--ressort);
}
.case .ic { width: 16px; height: 16px; stroke-width: 3; }
.case:hover { border-color: var(--succes); }
.case:active { transform: scale(.85); }
.prio-haute .case { border-color: #e8780c; }
.prio-urgente .case { border-color: var(--danger); }
.faite .case, .case.cochee { background: var(--succes); border-color: var(--succes); color: #fff; }
.ligne-tache-corps { flex: 1; min-width: 0; display: flex; align-items: center; gap: 10px; padding: 11px 16px 11px 12px; color: var(--texte); min-height: 60px; }
.ligne-tache-corps:active { background: var(--surface-3); }
.faite .ligne-texte strong { text-decoration: line-through; color: var(--texte-faible); }
.meta-tache { display: flex !important; align-items: center; gap: 5px; }
.retard .meta-tache { color: var(--danger); }
.icone-type { display: inline-grid; place-items: center; width: 18px; height: 18px; border-radius: 5px; flex-shrink: 0; background: var(--surface-3); color: var(--texte-doux); }
.icone-type .ic { width: 12px; height: 12px; stroke-width: 2.4; }
.icone-type.type-rdv { background: color-mix(in srgb, #7c4dff 16%, transparent); color: #7c4dff; }
.icone-type.type-relance { background: color-mix(in srgb, #e8780c 16%, transparent); color: #e8780c; }
.icone-type.type-echeance { background: color-mix(in srgb, var(--danger) 14%, transparent); color: var(--danger); }
.drapeau { font-size: 11.5px; font-weight: 700; padding: 2px 8px; border-radius: 99px; background: color-mix(in srgb, #e8780c 15%, transparent); color: #d26a06; }
.prio-urgente .drapeau { background: var(--danger-doux); color: var(--danger); }
.compte-groupe { font-weight: 700; opacity: .6; margin-left: 4px; }
.terminees summary { cursor: pointer; list-style: none; }
.terminees summary::-webkit-details-marker { display: none; }
.terminees summary::after { content: " ›"; display: inline-block; transition: transform .2s; }
.terminees[open] summary::after { transform: rotate(90deg); }
.rien-a-faire { display: flex; align-items: center; gap: 12px; padding: 13px 14px; color: var(--texte); }
.rien-a-faire .chevron { width: 20px; height: 20px; color: var(--principal); }
.lien-discret { display: inline-flex; align-items: center; gap: 6px; margin: 10px 6px 0; font-size: 14px; font-weight: 600; color: var(--danger); }
.lien-discret .ic { width: 16px; height: 16px; }
.bouton-planifier { margin-bottom: 18px; }

/* Détail d'une tâche */
.tache-icone { display: grid; place-items: center; width: 76px; height: 76px; border-radius: 24px; background: var(--principal-doux); color: var(--principal); }
.tache-icone .ic { width: 36px; height: 36px; }
.tache-icone.type-rdv { background: color-mix(in srgb, #7c4dff 15%, transparent); color: #7c4dff; }
.tache-icone.type-relance { background: color-mix(in srgb, #e8780c 15%, transparent); color: #e8780c; }
.tache-icone.type-echeance { background: var(--danger-doux); color: var(--danger); }
.drapeau-haute { background: color-mix(in srgb, #e8780c 15%, transparent); color: #d26a06; }
.drapeau-urgente { background: var(--danger-doux); color: var(--danger); }
.action-principale { margin-bottom: 8px; }

/* Formulaire de tâche */
.choix-types.quatre { grid-template-columns: repeat(4, 1fr); margin-top: 0; }
.deux-champs { display: grid; grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); gap: 10px; }
.segmente-formulaire { margin: 0; }
.segmente-formulaire > label {
  flex: 1; position: relative; margin: 0; display: flex; align-items: center; justify-content: center;
  min-height: 38px; border-radius: 9px; font-size: 14px; font-weight: 600; color: var(--texte-doux); cursor: pointer;
}
.segmente-formulaire input { position: absolute; opacity: 0; pointer-events: none; }
.segmente-formulaire label:has(input:checked) { background: var(--surface); color: var(--texte); box-shadow: 0 2px 6px rgba(16, 23, 42, .1); }
.segmente-formulaire label.prio-haute:has(input:checked) { color: #d26a06; }
.segmente-formulaire label.prio-urgente:has(input:checked) { color: var(--danger); }
.segmente-formulaire label:has(input:focus-visible) { box-shadow: var(--anneau); }

/* Agenda : bandeau de la semaine */
.semaine { display: flex; align-items: center; gap: 4px; padding: 10px 6px; }
.semaine-fleche { display: grid; place-items: center; width: 32px; height: 44px; border-radius: 10px; color: var(--texte-doux); flex-shrink: 0; }
.semaine-fleche .ic { width: 20px; height: 20px; stroke-width: 2.3; }
.semaine-jours { flex: 1; list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; }
.jour { display: flex; flex-direction: column; align-items: center; gap: 3px; padding: 6px 0; border-radius: 14px; color: var(--texte); }
.jour-nom { font-size: 11px; font-weight: 600; color: var(--texte-faible); text-transform: uppercase; }
.jour-num { display: grid; place-items: center; width: 34px; height: 34px; border-radius: 50%; font-size: 17px; font-weight: 650; }
.jour.aujourdhui .jour-num { color: var(--principal); }
.jour.choisi .jour-num { background: var(--principal); color: #fff; }
.jour-point { width: 5px; height: 5px; border-radius: 50%; }
.jour-point.occupe { background: var(--principal); }
.jour.choisi .jour-point.occupe { background: var(--texte-faible); }

.programme { list-style: none; margin: 0; padding: 0; display: grid; gap: 10px; }
.creneau { display: grid; grid-template-columns: 62px minmax(0, 1fr); gap: 10px; align-items: stretch; }
.creneau-heure { display: flex; flex-direction: column; padding-top: 12px; font-size: 14px; font-weight: 700; font-variant-numeric: tabular-nums; color: var(--texte); }
.creneau-heure small { font-size: 11.5px; font-weight: 500; color: var(--texte-faible); }
.creneau-carte {
  --t: var(--principal);
  display: flex; flex-direction: column; gap: 2px; padding: 11px 14px; border-radius: 14px; color: var(--texte);
  background: color-mix(in srgb, var(--t) 10%, var(--surface)); border-left: 4px solid var(--t);
}
.creneau-carte small { color: var(--texte-doux); font-size: 13.5px; }
.creneau-rdv .creneau-carte { --t: #7c4dff; }
.creneau-relance .creneau-carte { --t: #e8780c; }
.creneau-echeance .creneau-carte { --t: var(--danger); }
.creneau.faite .creneau-carte { opacity: .55; }
.creneau.faite strong { text-decoration: line-through; }

/* Notifications */
.notif.non-lue { background: color-mix(in srgb, var(--principal-doux) 55%, transparent); }
.notif.non-lue strong { font-weight: 700; }
.notif .ligne-texte strong { white-space: normal; }
.point-non-lu { width: 10px; height: 10px; border-radius: 50%; background: var(--principal); }
.notif-tache .ic, .notif-rappel .ic { color: var(--succes); }
.notif-rdv { background: color-mix(in srgb, #7c4dff 15%, transparent) !important; color: #7c4dff !important; }
.notif-relance, .notif-rappel { background: color-mix(in srgb, #e8780c 15%, transparent) !important; color: #e8780c !important; }
.notif-document, .notif-annonce { background: var(--principal-doux) !important; color: var(--principal) !important; }
.notif-prospect, .notif-client { background: var(--succes-doux) !important; color: var(--succes) !important; }
.notif-acces { background: var(--alerte-doux) !important; color: var(--alerte) !important; }

/* --- Direction : indicateurs, graphiques, rapports ----------------------- */
.carte-direction { display: flex; align-items: center; gap: 12px; padding: 13px 14px; margin-bottom: 4px; color: var(--texte); }
.carte-direction .pastille-icone { background: var(--principal-doux); color: var(--principal); }
.carte-direction .chevron { width: 18px; height: 18px; color: var(--bordure-forte); stroke-width: 2.4; }
.marge-haut-grande { margin-top: 28px; }
.nombre { text-align: right; font-variant-numeric: tabular-nums; }

/* Filtres de période */
.filtres-periode { margin-bottom: 4px; }
.periode-perso { position: relative; flex-shrink: 0; }
.periode-perso summary { list-style: none; cursor: pointer; }
.periode-perso summary::-webkit-details-marker { display: none; }
.periode-form { position: absolute; z-index: 20; top: calc(100% + 6px); right: 0; width: 260px; box-shadow: var(--ombre-haute); }
.periode-form label:first-of-type { margin-top: 0; }

/* Tuiles d'indicateurs (chiffres héros) */
.tuiles-kpi { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; margin-bottom: 8px; }
.kpi {
  display: flex; flex-direction: column; gap: 2px; min-width: 0; padding: 14px; border-radius: var(--rayon);
  background: var(--surface); box-shadow: var(--ombre); color: var(--texte);
}
.kpi-libelle { font-size: 12.5px; font-weight: 600; color: var(--texte-doux); }
.kpi-valeur { font-size: 26px; font-weight: 750; line-height: 1.15; font-variant-numeric: tabular-nums; overflow-wrap: anywhere; }
.kpi-valeur small { font-size: 14px; font-weight: 600; color: var(--texte-doux); }
.kpi-detail { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; color: var(--texte-faible); }
.kpi-detail .ic { width: 14px; height: 14px; }
.kpi.principal { grid-column: 1 / -1; background: var(--degrade); color: #fff; box-shadow: 0 16px 34px -18px rgba(61, 72, 236, .8); }
.kpi.principal .kpi-libelle, .kpi.principal .kpi-detail, .kpi.principal .kpi-valeur small { color: rgba(255, 255, 255, .82); }
.kpi.principal .kpi-valeur { font-size: 32px; }
.kpi-alerte { background: var(--danger-doux); }
.kpi-alerte .kpi-valeur, .kpi-alerte .kpi-detail { color: var(--danger); }
a.kpi:active { transform: scale(.98); }
.tuiles-kpi.compact .kpi-valeur { font-size: 21px; }

/* Graphiques */
.graphique { margin: 18px 0 0; padding: 16px 16px 12px; }
.graphique-tete { display: flex; flex-direction: column; gap: 2px; margin-bottom: 14px; }
.graphique-tete h2 { font-size: 17px; font-weight: 700; }
.graphique-tete small { font-size: 12.5px; color: var(--texte-faible); }

/* Info-bulle au survol / au focus (aucun script) */
[data-info] { position: relative; outline: none; }
[data-info]:hover::after, [data-info]:focus-visible::after {
  content: attr(data-info); position: absolute; z-index: 5; left: 50%; bottom: calc(100% + 6px); transform: translateX(-50%);
  padding: 6px 10px; border-radius: 9px; background: rgba(22, 26, 38, .95); color: #fff;
  font-size: 12.5px; font-weight: 600; white-space: nowrap; pointer-events: none; box-shadow: var(--ombre-haute);
}

/* Barres verticales : une série, couleur unique, ancrées sur la ligne de base */
.barres-v { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); gap: 2px; height: 190px; padding-top: 22px; border-bottom: 1px solid var(--bordure-forte); }
.colonne-barre { position: relative; display: flex; flex-direction: column; align-items: center; justify-content: flex-end; cursor: default; }
.colonne-barre .piste { position: relative; display: flex; align-items: flex-end; justify-content: center; width: 100%; height: 100%; }
.colonne-barre .barre { display: block; width: min(30px, 70%); height: 0; min-height: 0; border-radius: 4px 4px 0 0; background: var(--principal); transition: height .6s var(--ressort); }
.colonne-barre:hover .barre, .colonne-barre:focus-visible .barre { background: var(--principal-fonce); }
.etiquette-valeur { position: absolute; top: -20px; font-size: 11.5px; font-weight: 700; color: var(--texte); white-space: nowrap; }
.etiquette-axe { position: absolute; bottom: -22px; font-size: 11.5px; color: var(--texte-faible); }
.graphique .barres-v { margin-bottom: 26px; }

/* Barres horizontales (pipeline, CA par commercial) */
.barres-h { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.barres-h li { display: grid; grid-template-columns: 108px minmax(0, 1fr) 34px; align-items: center; gap: 10px; }
.barre-h-libelle { font-size: 13.5px; color: var(--texte-doux); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.barre-h-valeur { font-size: 14px; font-weight: 700; text-align: right; font-variant-numeric: tabular-nums; }
.piste-h { display: block; height: 12px; border-radius: 0 4px 4px 0; background: transparent; border-left: 1px solid var(--bordure-forte); }
.piste-h .barre { display: block; height: 100%; width: 0; border-radius: 0 4px 4px 0; background: var(--principal); transition: width .6s var(--ressort); }
.barres-h li:hover .barre, .barres-h li:focus-visible .barre { background: var(--principal-fonce); }
.barres-h [data-info]:hover::after, .barres-h [data-info]:focus-visible::after { left: auto; right: 0; transform: none; }

.donnees { margin-top: 6px; font-size: 13.5px; }
.donnees summary { cursor: pointer; color: var(--principal); font-weight: 600; font-size: 13px; }
.donnees table, .tableau-perf table, .tableau-rapport table { width: 100%; border-collapse: collapse; margin-top: 8px; font-size: 14px; }
.donnees th, .donnees td, .tableau-perf th, .tableau-perf td, .tableau-rapport th, .tableau-rapport td {
  padding: 9px 10px; border-bottom: .5px solid var(--separateur); text-align: left; vertical-align: middle;
}
.donnees th, .tableau-perf th, .tableau-rapport th { font-size: 11.5px; font-weight: 650; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-faible); }
.donnees th.nombre, .tableau-perf th.nombre, .tableau-rapport th.nombre, td.nombre { text-align: right; }

/* Tableau de performance par commercial */
.tableau-perf { padding: 6px 8px; overflow-x: auto; }
.cellule-personne { display: inline-flex; align-items: center; gap: 9px; font-weight: 600; white-space: nowrap; }
.col-ca { min-width: 190px; }
.ca-ligne { display: grid; grid-template-columns: minmax(0, 1fr) auto; align-items: center; gap: 10px; }
.ca-ligne .montant { font-size: 14px; }
.ca-ligne[data-info]:hover::after, .ca-ligne[data-info]:focus-visible::after { left: auto; right: 0; transform: none; }

/* Aperçu de rapport */
.exports { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; margin: 6px 0 18px; }
.tableau-rapport { padding: 4px 8px; overflow-x: auto; }
.tableau-rapport tfoot td { font-weight: 750; border-top: 1.5px solid var(--principal); border-bottom: 0; }
.tableau-rapport td { font-size: 13.5px; }
.rapport-icone { background: var(--principal-doux); color: var(--principal); }
.deux-lignes { white-space: normal !important; display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.choix-employe { max-width: 440px; }

@media (max-width: 819px) {
  /* Le tableau de performance devient une liste de cartes */
  .tableau-perf thead { display: none; }
  .tableau-perf table, .tableau-perf tbody { display: block; }
  .tableau-perf tr { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 6px 8px; padding: 12px 6px; border-bottom: .5px solid var(--separateur); }
  .tableau-perf tr:last-child { border-bottom: 0; }
  .tableau-perf td { display: flex; flex-direction: column; padding: 0; border: 0; text-align: left !important; font-size: 15px; font-weight: 650; }
  .tableau-perf td:first-child, .tableau-perf td.col-ca { grid-column: 1 / -1; }
  .tableau-perf td[data-label]::before { content: attr(data-label); font-size: 11px; font-weight: 600; color: var(--texte-faible); text-transform: uppercase; letter-spacing: .03em; }
  .tableau-perf td.col-ca::before { margin-bottom: 4px; }
  .col-ca { min-width: 0; }
}
@media (min-width: 820px) {
  .tuiles-kpi { grid-template-columns: repeat(4, minmax(0, 1fr)); }
  .kpi.principal { grid-column: span 2; }
  .tuiles-kpi.compact { grid-template-columns: repeat(auto-fill, minmax(190px, 1fr)); }
  .exports { display: flex; max-width: 440px; }
  .exports .bouton { flex: 1; }
}

/* --- Dossiers, versions, partage, corbeille, 2FA, droits, sauvegardes ---- */
.fil-ariane { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; margin-top: 6px; font-size: 14px; color: var(--texte-faible); }
.fil-ariane a { font-weight: 600; }
.fil-ariane [aria-current] { color: var(--texte); font-weight: 600; }
.icone-dossier { display: grid; place-items: center; flex-shrink: 0; width: 40px; height: 40px; border-radius: 11px; background: color-mix(in srgb, var(--c) 15%, transparent); color: var(--c); }
.icone-dossier .ic { width: 21px; height: 21px; fill: color-mix(in srgb, var(--c) 25%, transparent); }
.outils-espace .ligne { min-height: 50px; }
.outils-espace .ligne > .ic { color: var(--principal); }
.outils-espace .ligne-danger > .ic { color: var(--danger); }
.marge-bas { margin-bottom: 16px; }
.app-tuile.partage { --c: #0ea5c6; }

.ext.ext-geant { width: 84px; height: 84px; border-radius: 22px; font-size: 18px; }
.titre-fichier { font-size: 22px !important; overflow-wrap: anywhere; }
.version-num { display: grid; place-items: center; flex-shrink: 0; min-width: 40px; height: 28px; padding: 0 8px; border-radius: 8px; background: var(--surface-3); color: var(--texte-doux); font-size: 13px; font-weight: 750; }
.version-num.actuelle { background: var(--principal-doux); color: var(--principal); }
.mini-ic { width: 14px !important; height: 14px !important; vertical-align: -2px; }
.actions-corbeille { display: flex; align-items: center; gap: 6px; flex-shrink: 0; }
.actions-corbeille form { margin: 0; }
.recherche-globale .recherche input { min-height: 48px !important; font-size: 17px; }

/* Double authentification */
.statut-2fa { display: flex; align-items: center; gap: 12px; padding: 14px; }
.statut-2fa.actif { background: var(--succes-doux); }
.carte-2fa { display: flex; align-items: center; gap: 12px; padding: 13px 14px; margin-bottom: 12px; color: var(--texte);
  border: 1px solid color-mix(in srgb, var(--alerte) 35%, transparent); background: var(--alerte-doux); }
.carte-2fa .chevron { width: 18px; height: 18px; color: var(--texte-faible); stroke-width: 2.4; }
.codes-secours { display: grid; grid-template-columns: repeat(2, 1fr); gap: 8px; margin: 0; padding: 0; list-style: none; counter-reset: code; }
.codes-secours li { padding: 10px; border-radius: 10px; background: var(--surface-2); text-align: center;
  font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 17px; font-weight: 650; letter-spacing: .04em; user-select: all; }
.etapes { list-style: none; margin: 18px 0 0; padding: 0; display: grid; gap: 18px; }
.etapes > li { display: flex; gap: 14px; }
.etapes > li > div { flex: 1; min-width: 0; }
.etapes strong { display: block; font-size: 17px; }
.etapes small { display: block; margin-top: 2px; font-size: 14px; }
.etape-num { display: grid; place-items: center; flex-shrink: 0; width: 32px; height: 32px; border-radius: 50%; background: var(--principal); color: #fff; font-weight: 750; }
.qr { display: grid; place-items: center; width: 220px; max-width: 100%; margin-top: 12px; padding: 12px; background: #fff; }
.qr svg { width: 100%; height: auto; display: block; }
.cle-manuelle { margin-top: 10px; font-size: 14px; }
.cle-manuelle summary { cursor: pointer; color: var(--principal); font-weight: 600; }
.cle-manuelle code { display: block; margin-top: 8px; padding: 10px; border-radius: 10px; background: var(--surface); font-size: 15px; letter-spacing: .06em; overflow-wrap: anywhere; user-select: all; }
.champ-code { font-family: ui-monospace, "SF Mono", Consolas, monospace; font-size: 24px !important; letter-spacing: .3em; text-align: center; }

/* Droits détaillés */
.formulaire-droits { display: grid; gap: 12px; }
.bloc-droit { margin: 0; border: 0; display: grid; gap: 12px; }
.bloc-droit-tete { display: flex; align-items: center; gap: 12px; }
.bloc-droit .segmente { max-width: none; }
.cases-droits { display: flex; flex-wrap: wrap; gap: 8px; transition: opacity .2s; }
.cases-droits.desactive { opacity: .45; }
.case-droit { position: relative; margin: 0; cursor: pointer; }
.case-droit input { position: absolute; opacity: 0; pointer-events: none; }
.case-droit span { display: inline-flex; align-items: center; gap: 6px; padding: 7px 13px; border-radius: 99px; border: 1.5px solid var(--bordure); background: var(--surface); color: var(--texte-doux); font-size: 14px; font-weight: 600; }
.case-droit span::before { content: ""; width: 14px; height: 14px; border-radius: 4px; border: 1.5px solid var(--bordure-forte); }
.case-droit input:checked + span { border-color: var(--principal); background: var(--principal-doux); color: var(--principal); }
.case-droit input:checked + span::before { background: var(--principal); border-color: var(--principal); box-shadow: inset 0 0 0 2px var(--surface); }
.case-droit input:focus-visible + span { box-shadow: var(--anneau); }
.case-droit input:disabled + span { cursor: not-allowed; }

.notes-securite { display: grid; gap: 12px; font-size: 14.5px; }
.notes-securite .ic { width: 16px; height: 16px; vertical-align: -3px; color: var(--principal); }
.notes-securite code { font-size: 13px; padding: 1px 6px; border-radius: 6px; background: var(--surface-3); overflow-wrap: anywhere; }

/* --- Devis ----------------------------------------------------------------- */
.devis-brouillon  { --s: #8b93a6; }
.devis-soumis     { --s: #e8780c; }
.devis-a_corriger { --s: #d92d27; }
.devis-valide     { --s: #2f6bff; }
.devis-envoye     { --s: #7c4dff; }
.devis-accepte    { --s: #12a15a; }
.devis-refuse     { --s: #8b93a6; }
.devis-annule     { --s: #b0b6c3; }
.icone-devis { background: color-mix(in srgb, var(--s) 15%, transparent); color: var(--s); }
.grand-titre .badge-statut { font-size: 11.5px; letter-spacing: 0; text-transform: none; vertical-align: 1px; }
.alerte-compteur { background: var(--danger) !important; color: #fff !important; }
.texte-libre { white-space: normal !important; overflow-wrap: anywhere; }

.pipeline-devis { grid-template-columns: repeat(5, 1fr); }
.pipeline li.refuse span { background: var(--danger); box-shadow: 0 0 0 1px var(--danger); }
.pipeline li.refuse { color: var(--danger); }

.actions-devis { display: grid; gap: 10px; margin-bottom: 8px; }
.actions-devis form { margin: 0; }
.deux-boutons { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.bouton-succes { background: var(--succes); color: #fff; }
.info-attente { display: flex; align-items: center; gap: 10px; padding: 13px 14px; color: var(--texte-doux); font-size: 15px; }
.info-attente .ic { color: var(--alerte); }

/* Formulaire : lignes en cartes */
.lignes-devis { list-style: none; margin: 0 0 10px; padding: 0; display: grid; gap: 10px; }
.ligne-devis { padding: 12px; display: grid; gap: 10px; transition: opacity .2s; }
.ligne-devis.retiree { opacity: .4; }
.ligne-devis.retiree input, .ligne-devis.retiree select { text-decoration: line-through; }
.ligne-devis-tete { display: flex; align-items: center; gap: 8px; }
.ligne-devis-tete input { flex: 1; min-width: 0; }
.numero-ligne { display: grid; place-items: center; flex-shrink: 0; width: 26px; height: 26px; border-radius: 8px;
  background: var(--principal-doux); color: var(--principal); font-size: 13px; font-weight: 750; }
.supprimer-ligne { position: relative; display: grid; place-items: center; width: 40px; height: 40px; margin: 0; border-radius: 10px;
  color: var(--texte-faible); cursor: pointer; flex-shrink: 0; }
.supprimer-ligne input { position: absolute; opacity: 0; pointer-events: none; }
.supprimer-ligne:hover, .supprimer-ligne:has(input:checked) { background: var(--danger-doux); color: var(--danger); }
.supprimer-ligne:has(input:focus-visible) { box-shadow: var(--anneau); }
.supprimer-ligne .ic { width: 19px; height: 19px; }
.ligne-devis-chiffres { display: grid; grid-template-columns: 1fr 1.2fr 1.5fr; gap: 8px; align-items: end; }
.ligne-devis-chiffres label { margin: 0; font-size: 12px; display: flex; flex-direction: column; gap: 4px; }
.ligne-devis-chiffres input, .ligne-devis-chiffres select { min-height: 44px; padding: 8px 10px; }
.total-ligne { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: baseline; padding-top: 6px;
  border-top: .5px solid var(--separateur); }
.total-ligne small { font-size: 12.5px; }
.total-ligne strong { font-size: 16px; font-variant-numeric: tabular-nums; }

.totaux-devis { display: grid; gap: 10px; margin-top: 14px; padding: 14px 16px; }
.totaux-devis > div { display: flex; justify-content: space-between; align-items: center; gap: 10px; font-size: 15px; }
.totaux-devis strong { font-variant-numeric: tabular-nums; }
.totaux-devis .total-ttc { padding-top: 10px; border-top: 1.5px solid var(--principal); font-size: 18px; }
.totaux-devis .total-ttc strong { color: var(--principal); font-size: 20px; font-weight: 800; }
.ligne-tva label { margin: 0; font-size: 15px; font-weight: 400; color: var(--texte); }
.champ-tva { display: inline-flex; align-items: center; gap: 4px; margin-right: auto; color: var(--texte-doux); }
.champ-tva input { width: 86px; min-height: 38px; padding: 6px 8px; text-align: right; }

@media (min-width: 820px) {
  .ligne-devis-chiffres { grid-template-columns: 90px 140px 1fr 160px; }
  .total-ligne { grid-column: auto; flex-direction: column; align-items: flex-end; border-top: 0; padding: 0 0 8px; }
}

/* --- Éditeur de devis (façon Invoice Fly) -------------------------------- */
.editeur-devis { padding-bottom: 84px; }
.entete-editeur { padding: 16px; display: grid; gap: 4px; }
.entete-editeur-haut { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 6px; }
.petite-etiquette { font-size: 12px; font-weight: 650; text-transform: uppercase; letter-spacing: .06em; color: var(--texte-faible); }
.numero-devis { font-size: 26px; font-weight: 800; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.logo-mini { max-width: 96px; max-height: 52px; object-fit: contain; padding: 5px 8px; border-radius: 12px; background: #1B223F; }
.ligne-reglage {
  display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 0; border: 0; border-top: .5px solid var(--separateur);
  background: none; color: var(--texte); text-align: left; cursor: pointer;
}
.ligne-reglage .ligne-texte small { font-size: 12px; text-transform: uppercase; letter-spacing: .04em; color: var(--texte-faible); }
.ligne-reglage .ligne-texte strong { font-size: 17px; white-space: normal; }
.ligne-reglage .chevron, .carte-choix .chevron { width: 18px; height: 18px; color: var(--bordure-forte); stroke-width: 2.4; flex-shrink: 0; }
.dates-editeur { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding-top: 10px; border-top: .5px solid var(--separateur); }
.dates-editeur > * { display: flex; flex-direction: column; gap: 1px; padding: 8px 10px; border: 0; border-radius: 11px; background: var(--surface-2); color: var(--texte); text-align: left; font: inherit; cursor: pointer; }
.dates-editeur small { font-size: 12px; color: var(--texte-faible); }
.dates-editeur strong { font-size: 15px; }
.vide-resume { color: var(--principal) !important; font-weight: 600; }

.carte-choix { display: flex; align-items: center; gap: 12px; width: 100%; padding: 13px 14px; border: 0; color: var(--texte); text-align: left; cursor: pointer; }
.carte-choix .ligne-texte strong { font-size: 17px; }

.liste-articles .ligne-article { align-items: flex-start; padding-top: 12px; padding-bottom: 12px; }
.liste-articles .numero-ligne { margin-top: 1px; }
.liste-articles > li + li::before { left: 50px; }
.desc-article { white-space: normal !important; display: -webkit-box !important; -webkit-line-clamp: 2; -webkit-box-orient: vertical; color: var(--texte-faible) !important; }
.liste-articles .montant { padding-top: 1px; }
.vide-articles { color: var(--texte-faible); font-size: 15px; }
.bouton-ajout-article { margin-top: 10px; background: var(--principal-doux); }

.totaux-editeur { display: grid; gap: 2px; margin-top: 18px; padding: 8px 16px; }
.ligne-total {
  display: flex; justify-content: space-between; align-items: center; gap: 10px; padding: 10px 0;
  border: 0; background: none; color: var(--texte); font: inherit; font-size: 15.5px; text-align: left;
}
.ligne-total + .ligne-total { border-top: .5px solid var(--separateur); }
.ligne-total.cliquable { cursor: pointer; }
.ligne-total.cliquable strong { color: var(--principal); }
.ligne-total em { font-style: normal; color: var(--texte-faible); font-size: 14px; }
.ligne-total strong { font-variant-numeric: tabular-nums; }
.total-final { padding-top: 14px; }
.total-final span { font-size: 18px; font-weight: 750; }
.total-final strong { font-size: 24px; font-weight: 800; color: var(--principal); }

.barre-action-devis {
  position: fixed; z-index: 36; left: 0; right: 0; bottom: calc(var(--hauteur-onglets) + var(--bas-sur));
  display: grid; grid-template-columns: 1fr 1.6fr; gap: 10px; padding: 10px 16px;
  background: var(--verre-surface); backdrop-filter: saturate(180%) blur(20px); -webkit-backdrop-filter: saturate(180%) blur(20px);
  border-top: .5px solid var(--separateur);
}
@media (min-width: 820px) {
  .barre-action-devis { left: var(--largeur-rail); bottom: 0; padding: 12px max(32px, calc((100% - var(--largeur-rail) - 1080px) / 2 + 32px)); }
}

/* Panneau article */
.catalogue-choix { margin: 6px 0 4px; }
.catalogue-choix summary { display: flex; align-items: center; gap: 8px; padding: 12px 14px; border-radius: 13px; background: var(--principal-doux);
  color: var(--principal); font-weight: 650; cursor: pointer; list-style: none; }
.catalogue-choix summary::-webkit-details-marker { display: none; }
.catalogue-choix summary .ic { width: 19px; height: 19px; }
.catalogue-choix[open] summary { margin-bottom: 10px; }
.catalogue-choix .liste-groupe { max-height: 240px; overflow-y: auto; }
.ajout-rapide { display: grid; place-items: center; width: 30px; height: 30px; border-radius: 50%; background: var(--principal); color: #fff; font-size: 20px; font-weight: 600; flex-shrink: 0; }
.stepper { display: grid; grid-template-columns: 52px 1fr 52px; gap: 8px; }
.stepper button { min-height: 50px; border: 0; border-radius: 13px; background: var(--surface-3); color: var(--principal); font-size: 24px; font-weight: 600; cursor: pointer; }
.stepper button:active { transform: scale(.94); }
.stepper input { text-align: center; font-size: 19px; font-weight: 650; }
.total-article { display: flex; justify-content: space-between; align-items: baseline; margin: 14px 4px 4px; font-size: 15px; }
.total-article strong { font-size: 20px; font-weight: 800; color: var(--principal); }
.champ-erreur { border-color: var(--danger) !important; box-shadow: 0 0 0 3px color-mix(in srgb, var(--danger) 25%, transparent) !important; }
.raccourcis { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.raccourcis button { padding: 8px 14px; border: 1px solid var(--bordure); border-radius: 99px; background: var(--surface); color: var(--texte); font-weight: 600; cursor: pointer; }
.raccourcis button:active { background: var(--principal-doux); }
.carnet { max-height: 300px; overflow-y: auto; margin-top: 4px !important; }
.ligne-nouveau-client strong { color: var(--principal); }
.ligne-nouveau-client .avatar-client { background: var(--principal); color: #fff; font-size: 20px; }

/* Catalogue et fiche entreprise */
.categorie-fourniture { background: var(--principal-doux); color: var(--principal); }
.categorie-main_oeuvre { background: color-mix(in srgb, #7c4dff 15%, transparent); color: #7c4dff; }
.categorie-service { background: var(--succes-doux); color: var(--succes); }
.categorie-deplacement { background: color-mix(in srgb, #e8780c 15%, transparent); color: #e8780c; }
.apercu-logo { display: flex; align-items: center; gap: 16px; padding-top: 14px; }
.apercu-logo img { width: 84px; height: 84px; object-fit: contain; border-radius: 16px; background: #1B223F; padding: 6px; }
.apercu-logo .champ { flex: 1; min-width: 0; }
.apercu-logo label { margin-top: 0; }
.apercu-logo input[type=file] { width: 100%; font-size: 14px; }
.case-simple { display: flex; align-items: center; gap: 8px; margin: 8px 0 0; font-weight: 500; }
.choix-couleur { display: flex; align-items: center; gap: 12px; }
.choix-couleur input[type=color] { width: 56px; height: 44px; padding: 3px; border-radius: 12px; border: 1px solid var(--bordure); background: var(--surface); cursor: pointer; }

/* --- Réunions -------------------------------------------------------------- */
.actions-reunion { display: grid; grid-template-columns: 1.4fr 1fr; gap: 10px; margin-bottom: 4px; }
.date-reunion { display: flex; flex-direction: column; align-items: center; justify-content: center; flex-shrink: 0;
  width: 46px; height: 50px; border-radius: 12px; background: color-mix(in srgb, #7c4dff 13%, transparent); color: #7c4dff; }
.date-reunion strong { font-size: 19px; line-height: 1; }
.date-reunion small { font-size: 11px; color: inherit; text-transform: uppercase; font-weight: 700; }
.reunion-audio .date-reunion { background: color-mix(in srgb, #0ea5c6 14%, transparent); color: #0b8fab; }
.badge-direct { color: var(--succes) !important; font-weight: 700; }
.liste-passee .ligne { opacity: .6; }
.carte-reunion { display: flex; align-items: center; gap: 12px; padding: 13px 14px; margin-bottom: 12px; color: var(--texte); }
.carte-reunion .pastille-icone { background: color-mix(in srgb, #7c4dff 14%, transparent); color: #7c4dff; }
.carte-reunion.en-cours { background: var(--succes-doux); border: 1px solid color-mix(in srgb, var(--succes) 35%, transparent); }
.carte-reunion.en-cours .pastille-icone { background: var(--succes); color: #fff; animation: pulsation 1.6s infinite; }
.carte-reunion .ligne-texte small { font-weight: 600; }
.bouton-rejoindre { min-height: 56px; font-size: 18px; margin-bottom: 8px; }
.creneau-reunion .creneau-carte { --t: #7c4dff; }
.liste-invites { max-height: 320px; overflow-y: auto; margin-top: 6px !important; }
.choix-invite { margin: 0; cursor: pointer; font-weight: 500; color: var(--texte); }
.choix-invite input { position: absolute; opacity: 0; pointer-events: none; }
.coche-invite { display: grid; place-items: center; width: 24px; height: 24px; border-radius: 50%; border: 2px solid var(--bordure-forte); color: transparent; }
.coche-invite .ic { width: 14px; height: 14px; stroke-width: 3; }
.choix-invite:has(input:checked) .coche-invite { background: var(--principal); border-color: var(--principal); color: #fff; }
.choix-invite:has(input:focus-visible) { box-shadow: inset var(--anneau); }
.masque-immediat { display: none !important; }
.salle-visio { position: relative; height: calc(100dvh - 200px); min-height: 420px; border-radius: var(--rayon); overflow: hidden; background: #000; }
.salle-visio iframe { width: 100%; height: 100%; border: 0; }
@keyframes pulsation { 0%, 100% { box-shadow: 0 0 0 0 color-mix(in srgb, var(--succes) 50%, transparent); } 50% { box-shadow: 0 0 0 7px transparent; } }

/* --- Animation d'ouverture ---------------------------------------------- */
.ouverture { display: none; }
html.avec-ouverture .ouverture {
  position: fixed; inset: 0; z-index: 1000; display: grid; place-items: center; overflow: hidden;
  background: radial-gradient(120% 80% at 50% 0%, #2b3fae 0%, #141c48 45%, #070b1a 100%);
  color: #fff; cursor: pointer;
  animation: ouverture-sortie .55s cubic-bezier(.6, 0, .4, 1) 2.15s forwards;
}
html.avec-ouverture { overflow: hidden; }
.ouverture.passer { animation: ouverture-sortie .3s ease-in forwards !important; }
.ouverture-halo {
  position: absolute; width: 520px; height: 520px; border-radius: 50%;
  background: radial-gradient(circle, rgba(124, 58, 237, .55), rgba(37, 84, 235, .25) 40%, transparent 70%);
  filter: blur(10px); animation: halo 2.4s ease-out both;
}
.ouverture-centre { position: relative; display: flex; flex-direction: column; align-items: center; }
.ouverture-logo {
  position: relative; overflow: hidden; display: grid; place-items: center;
  width: 112px; height: 112px; border-radius: 32px;
  background: linear-gradient(140deg, #2554eb 0%, #5b47ef 55%, #7c3aed 100%);
  box-shadow: 0 24px 60px -16px rgba(91, 71, 239, .9), inset 0 1px 0 rgba(255, 255, 255, .3);
  animation: logo-apparait .7s cubic-bezier(.2, 1.4, .4, 1) both;
}
.ouverture-gemme { width: 64px; height: 64px; fill: none; stroke: #fff; stroke-width: 1.5; stroke-linecap: round; stroke-linejoin: round; overflow: visible; }
.ouverture-gemme path { stroke-dasharray: 100; stroke-dashoffset: 100; animation: trace .8s cubic-bezier(.6, 0, .3, 1) forwards; }
.ouverture-gemme .trait-1 { animation-delay: .35s; fill: rgba(255, 255, 255, 0); animation-name: trace, remplit; animation-duration: .8s, .5s; animation-delay: .35s, 1.05s; }
.ouverture-gemme .trait-2 { animation-delay: .75s; }
.ouverture-gemme .trait-3 { animation-delay: .9s; }
.ouverture-eclat {
  position: absolute; inset: -40%; transform: translateX(-120%) rotate(25deg);
  background: linear-gradient(90deg, transparent 35%, rgba(255, 255, 255, .55) 50%, transparent 65%);
  animation: eclat .8s ease-in-out 1.25s forwards;
}
.ouverture-nom { margin-top: 26px; font-size: 38px; font-weight: 800; letter-spacing: -.02em; display: flex; }
.ouverture-nom span { display: inline-block; opacity: 0; transform: translateY(14px); animation: lettre .5s cubic-bezier(.2, .9, .25, 1) forwards; }
.ouverture-nom span:nth-child(1) { animation-delay: .95s; }
.ouverture-nom span:nth-child(2) { animation-delay: 1.0s; }
.ouverture-nom span:nth-child(3) { animation-delay: 1.05s; }
.ouverture-nom span:nth-child(4) { animation-delay: 1.1s; }
.ouverture-nom span:nth-child(5) { animation-delay: 1.15s; }
.ouverture-nom span:nth-child(6) { animation-delay: 1.2s; }
.ouverture-nom .g { animation-delay: 1.3s; background: linear-gradient(140deg, #8fb0ff, #c4a6ff); -webkit-background-clip: text; background-clip: text; color: transparent; }
.ouverture-sous {
  margin-top: 6px; font-size: 13px; font-weight: 600; text-transform: uppercase; color: rgba(255, 255, 255, .7);
  letter-spacing: .6em; opacity: 0; animation: sous-titre .8s ease-out 1.45s forwards;
}
.ouverture-barre {
  position: absolute; bottom: calc(56px + var(--bas-sur)); width: 120px; height: 3px; border-radius: 3px;
  background: rgba(255, 255, 255, .15); overflow: hidden;
}
.ouverture-barre span { display: block; height: 100%; width: 0; border-radius: 3px; background: linear-gradient(90deg, #8fb0ff, #c4a6ff); animation: charge 1.9s cubic-bezier(.4, 0, .2, 1) .2s forwards; }

@keyframes halo { from { opacity: 0; transform: scale(.4); } to { opacity: 1; transform: scale(1); } }
@keyframes logo-apparait { from { opacity: 0; transform: scale(.5) rotate(-12deg); } to { opacity: 1; transform: none; } }
@keyframes trace { to { stroke-dashoffset: 0; } }
@keyframes remplit { to { fill: rgba(255, 255, 255, .16); } }
@keyframes eclat { to { transform: translateX(120%) rotate(25deg); } }
@keyframes lettre { to { opacity: 1; transform: none; } }
@keyframes sous-titre { from { opacity: 0; letter-spacing: .9em; } to { opacity: 1; letter-spacing: .32em; } }
@keyframes charge { to { width: 100%; } }
@keyframes ouverture-sortie { to { opacity: 0; transform: scale(1.08); visibility: hidden; } }
@media (prefers-reduced-motion: reduce) { html.avec-ouverture .ouverture { display: none; } }

/* --- Tablette et ordinateur : rail de navigation à gauche --------------- */
@media (min-width: 820px) {
  .onglets {
    top: 0; right: auto; width: var(--largeur-rail); height: auto;
    flex-direction: column; justify-content: flex-start; align-items: center; gap: 10px;
    padding: calc(18px + var(--haut-sur)) 0 18px;
    border-top: 0; border-right: .5px solid var(--separateur);
  }
  .onglets-logo { display: block; margin-bottom: 18px; }
  .onglet { flex: 0 0 auto; width: 100%; padding: 4px 0; font-size: 12px; }
  .onglet-icone { width: 56px; height: 34px; border-radius: 17px; }
  .ecran { margin-left: var(--largeur-rail); }
  .barre-app { padding-left: 24px; padding-right: 24px; }
  .contenu { padding: 8px 32px 120px; }
  .grand-titre h1 { font-size: 38px; }
  .grille-apps { grid-template-columns: repeat(auto-fill, minmax(96px, 1fr)); gap: 24px 10px; }
  .app-tuile { width: 70px; height: 70px; border-radius: 19px; }
  .carrousel { display: grid; grid-template-columns: repeat(4, 1fr); overflow: visible; margin: 0; padding: 0; }
  .stat { flex: none; }
  .colonnes { grid-template-columns: repeat(2, minmax(0, 1fr)); align-items: start; }
  .segmente { max-width: 440px; }
  .segmente.compact { max-width: none; }
  .puces-filtre { flex-wrap: wrap; overflow: visible; margin: 0 0 18px; padding: 0; }
  .recherche { max-width: 440px; }
  .fab { right: 32px; bottom: 32px; }
  .toasts { bottom: 28px; left: calc(50% + var(--largeur-rail) / 2); }

  dialog.feuille { inset: 0; margin: auto; border-radius: 26px; max-height: 86vh; height: fit-content; box-shadow: var(--ombre-haute); }
  dialog.feuille[open] { animation: dialogue-entree .28s var(--ressort); }
  dialog.feuille.ferme { animation: dialogue-sortie .18s ease-in forwards; }
  .feuille-poignee { visibility: hidden; height: 0; margin-bottom: 8px; }
  .feuille-corps { padding: 18px 22px 22px; }

  .page-seule { align-items: center; justify-content: center; padding: 32px; background:
    radial-gradient(900px 500px at 10% -10%, color-mix(in srgb, var(--principal) 16%, transparent), transparent 60%),
    radial-gradient(700px 500px at 110% 110%, color-mix(in srgb, var(--violet) 14%, transparent), transparent 60%), var(--fond); }
  .ecran-connexion { flex: none; width: 420px; min-height: 0; border-radius: 34px; overflow: hidden; box-shadow: var(--ombre-haute); }
  .connexion-haut { flex: none; min-height: 0; padding-top: 44px; }
  .page-seule ~ .toasts { left: 50%; }
}
@media (min-width: 820px) and (hover: hover) {
  .onglet:hover .onglet-icone { background: var(--surface-3); }
  .onglet.actif:hover .onglet-icone { background: var(--principal-doux); }
}
@keyframes dialogue-entree { from { opacity: 0; transform: translateY(12px) scale(.97); } to { opacity: 1; transform: none; } }
@keyframes dialogue-sortie { to { opacity: 0; transform: scale(.97); } }

/* Application installée (mode autonome) */
@media (display-mode: standalone) {
  body { user-select: none; -webkit-user-select: none; }
  input, textarea, .ligne-texte, code, .bulle-corps p { user-select: text; -webkit-user-select: text; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

@media print {
  .onglets, .barre-app, .fab, .toasts { display: none !important; }
  .ecran { margin: 0; }
}

/* ==========================================================================
   Thème vif : plus de couleurs et de modernité, pensé d'abord pour le mobile
   (couche ajoutée par-dessus le style de base ; la retirer rend l'ancien look)
   ========================================================================== */
:root {
  --vif-indigo: #4f46e5;
  --vif-violet: #8b5cf6;
  --vif-rose: #ec4899;
  --vif-orange: #f97316;
  --vif-ambre: #f59e0b;
  --vif-vert: #10b981;
  --vif-cyan: #06b6d4;
  --vif-bleu: #3b82f6;
  --degrade: linear-gradient(135deg, #1e40af 0%, #2563eb 45%, #0ea5e9 100%);
  --accent: #2563eb;
  --degrade-doux: linear-gradient(135deg, color-mix(in srgb, #2563eb 12%, transparent), color-mix(in srgb, #0ea5e9 10%, transparent));
  --d-1: linear-gradient(135deg, #6366f1, #8b5cf6);
  --d-2: linear-gradient(135deg, #06b6d4, #3b82f6);
  --d-3: linear-gradient(135deg, #f97316, #ec4899);
  --d-4: linear-gradient(135deg, #10b981, #06b6d4);
  --d-5: linear-gradient(135deg, #f59e0b, #f97316);
  --d-6: linear-gradient(135deg, #ec4899, #8b5cf6);
  --d-danger: linear-gradient(135deg, #ef4444, #f43f5e);
  --rayon: 20px;
  --ombre: 0 1px 2px rgba(15, 35, 90, .04), 0 10px 28px -18px rgba(37, 99, 235, .35);
  --ombre-couleur: 0 14px 30px -14px rgba(37, 99, 235, .55);
  --contour-verre: inset 0 0 0 1px rgba(255, 255, 255, .6);
  --fond: #f4f8ff;
  --point-trame: rgba(37, 99, 235, .16);
  --vague-1: #dbeafe;
  --vague-2: #bfdbfe;
  --fond-maille:
    radial-gradient(70vmax 45vmax at 0% -5%, rgba(37, 99, 235, .22), transparent 62%),
    radial-gradient(60vmax 40vmax at 105% 0%, rgba(14, 165, 233, .20), transparent 60%),
    radial-gradient(50vmax 40vmax at 50% 55%, rgba(255, 255, 255, .9), transparent 70%),
    linear-gradient(180deg, #e0ecff 0%, #f4f8ff 38%, #ffffff 70%, #eef5ff 100%);
}
:root[data-theme="sombre"] {
  --ombre: 0 0 0 1px rgba(255, 255, 255, .05), 0 12px 30px -18px rgba(0, 0, 0, .9);
  --contour-verre: inset 0 0 0 1px rgba(255, 255, 255, .06);
  --surface: #12131c;
  --fond: #050b1f;
  --fond-maille:
    radial-gradient(70vmax 45vmax at 0% -5%, rgba(37, 99, 235, .35), transparent 62%),
    radial-gradient(60vmax 40vmax at 105% 0%, rgba(14, 165, 233, .22), transparent 60%),
    linear-gradient(180deg, #071330 0%, #050b1f 45%, #040816 100%);
  --point-trame: rgba(96, 165, 250, .14);
  --vague-1: #0b1d45;
  --vague-2: #0f2a5f;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="clair"]) {
    --ombre: 0 0 0 1px rgba(255, 255, 255, .05), 0 12px 30px -18px rgba(0, 0, 0, .9);
    --contour-verre: inset 0 0 0 1px rgba(255, 255, 255, .06);
    --surface: #12131c;
    --fond: #050b1f;
    --fond-maille:
    radial-gradient(70vmax 45vmax at 0% -5%, rgba(37, 99, 235, .35), transparent 62%),
      radial-gradient(60vmax 40vmax at 105% 0%, rgba(14, 165, 233, .22), transparent 60%),
      linear-gradient(180deg, #071330 0%, #050b1f 45%, #040816 100%);
    --point-trame: rgba(96, 165, 250, .14);
    --vague-1: #0b1d45;
    --vague-2: #0f2a5f;
  }
}

/* Fond coloré en dégradés doux, fixe derrière le contenu */
body { background: var(--fond); }
body::before {
  content: ""; position: fixed; inset: 0; z-index: -2; pointer-events: none;
  background: var(--fond-maille), var(--fond);
}
/* Trame de points bleus (estompée vers le bas) et vagues décoratives */
body::after {
  content: ""; position: fixed; inset: 0; z-index: -1; pointer-events: none;
  background:
    radial-gradient(circle at 1.5px 1.5px, var(--point-trame) 1.4px, transparent 2px) 0 0 / 22px 22px;
  -webkit-mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .55) 30%, transparent 60%);
  mask-image: linear-gradient(180deg, #000 0%, rgba(0, 0, 0, .55) 30%, transparent 60%);
}
.app::before {
  content: ""; position: fixed; left: 0; right: 0; bottom: 0; height: 32vh; z-index: -1; pointer-events: none;
  background:
    radial-gradient(120% 70% at 20% 100%, var(--vague-2) 0 40%, transparent 41%),
    radial-gradient(110% 80% at 85% 100%, var(--vague-1) 0 45%, transparent 46%);
  opacity: .7;
}

/* Titres : dégradé dans le texte, accent coloré devant les sections */
.grand-titre h1, .numero-devis, .connexion-feuille h2 {
  background: var(--degrade); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.section-tete h2 { display: flex; align-items: center; gap: 9px; }
.section-tete h2::before {
  content: ""; width: 6px; height: 22px; border-radius: 99px; background: var(--degrade); flex-shrink: 0;
}
.titre-groupe, .sur-titre { color: var(--accent); }

/* Cartes et listes : ombre teintée, liseré « verre » */
.carte, .liste-groupe, .stat, .bulle-corps { box-shadow: var(--ombre), var(--contour-verre); }

/* Icônes de ligne en couleurs tournantes */
.liste-groupe > li:nth-child(6n+1) { --vif: var(--vif-indigo); }
.liste-groupe > li:nth-child(6n+2) { --vif: var(--vif-rose); }
.liste-groupe > li:nth-child(6n+3) { --vif: var(--vif-cyan); }
.liste-groupe > li:nth-child(6n+4) { --vif: var(--vif-orange); }
.liste-groupe > li:nth-child(6n+5) { --vif: var(--vif-vert); }
.liste-groupe > li:nth-child(6n+6) { --vif: var(--accent); }
.liste-groupe .pastille-icone:not(.ok):not(.alerte):not(.icone-devis) {
  background: color-mix(in srgb, var(--vif, var(--principal)) 14%, transparent); color: var(--vif, var(--principal));
}
.numero-ligne { background: var(--degrade); color: #fff; }

/* Statistiques : tuiles en dégradés vifs */
.carrousel .stat { position: relative; overflow: hidden; color: #fff; background: var(--d-1); box-shadow: var(--ombre-couleur); }
.carrousel .stat:nth-child(6n+2) { background: var(--d-2); box-shadow: 0 14px 30px -14px rgba(59, 130, 246, .6); }
.carrousel .stat:nth-child(6n+3) { background: var(--d-3); box-shadow: 0 14px 30px -14px rgba(236, 72, 153, .6); }
.carrousel .stat:nth-child(6n+4) { background: var(--d-4); box-shadow: 0 14px 30px -14px rgba(16, 185, 129, .6); }
.carrousel .stat:nth-child(6n+5) { background: var(--d-5); box-shadow: 0 14px 30px -14px rgba(245, 158, 11, .6); }
.carrousel .stat:nth-child(6n+6) { background: var(--d-6); }
.carrousel .stat.stat-alerte { background: var(--d-danger); box-shadow: 0 14px 30px -14px rgba(239, 68, 68, .65); }
.carrousel .stat::after {
  content: ""; position: absolute; width: 120px; height: 120px; right: -40px; top: -50px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, .35), transparent 65%); pointer-events: none;
}
.carrousel .stat .stat-icone { background: rgba(255, 255, 255, .22); color: #fff; box-shadow: inset 0 0 0 1px rgba(255, 255, 255, .25); }
.carrousel .stat .stat-valeur, .carrousel .stat.stat-alerte .stat-valeur { color: #fff; }
.carrousel .stat .stat-libelle { color: rgba(255, 255, 255, .88); font-weight: 500; }

/* Tuiles d'application : effet brillant */
.app-tuile { box-shadow: 0 12px 22px -12px var(--c), inset 0 1px 0 rgba(255, 255, 255, .45), inset 0 -2px 6px rgba(0, 0, 0, .12); }
.app-tuile::after {
  content: ""; position: absolute; inset: 0 0 50% 0; border-radius: inherit;
  background: linear-gradient(180deg, rgba(255, 255, 255, .28), transparent); pointer-events: none;
}

/* Boutons : dégradé et halo */
.bouton { background: color-mix(in srgb, var(--principal) 11%, var(--surface)); }
.bouton-principal {
  background: var(--degrade); color: #fff !important;
  box-shadow: 0 12px 24px -12px rgba(37, 99, 235, .8), inset 0 1px 0 rgba(255, 255, 255, .25);
}
.bouton-succes { background: linear-gradient(135deg, #10b981, #059669); color: #fff; box-shadow: 0 12px 24px -12px rgba(16, 185, 129, .8); }
.bouton-danger-plein { background: var(--d-danger); box-shadow: 0 12px 24px -12px rgba(239, 68, 68, .8); }
.fab { background: var(--degrade); box-shadow: 0 16px 34px -10px rgba(37, 99, 235, .8), 0 0 0 6px color-mix(in srgb, var(--accent) 14%, transparent); }

/* Filtres et onglets segmentés */
.puce.actif { background: var(--degrade); color: #fff; border-color: transparent; box-shadow: var(--ombre-couleur); }
.segmente > [aria-selected="true"], .segmente > [aria-pressed="true"] { color: var(--accent); }

/* Champs */
input:focus, select:focus, textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 4px color-mix(in srgb, var(--accent) 20%, transparent); }

/* Avatars */
.avatar { background: var(--degrade); box-shadow: 0 8px 18px -10px rgba(37, 99, 235, .7); }

/* Panneaux du bas : liseré en dégradé, fond flouté */
dialog.feuille { border-top: 3px solid transparent; background: linear-gradient(var(--fond), var(--fond)) padding-box, var(--degrade) border-box; }
dialog.feuille::backdrop { background: rgba(10, 25, 70, .38); backdrop-filter: blur(3px); -webkit-backdrop-filter: blur(3px); }
.feuille-poignee { background: var(--degrade); opacity: .7; }

/* Notifications */
.toast { border-left: 4px solid var(--accent); }
.toast-success { border-left-color: var(--vif-vert); }
.toast-error { border-left-color: #f43f5e; }

/* Barre du haut et compteur de session */
.barre-app.defile { box-shadow: 0 8px 24px -18px rgba(37, 99, 235, .5); }
.session.bientot { background: var(--d-danger); }

/* Devis : totaux mis en valeur */
.total-final strong, .totaux-devis .total-ttc strong {
  background: var(--degrade); -webkit-background-clip: text; background-clip: text; color: transparent;
}
.totaux-devis .total-ttc { border-top: 2px solid var(--accent); }
.bouton-ajout-article { background: var(--degrade-doux); color: var(--accent); border: 1.5px dashed color-mix(in srgb, var(--accent) 45%, transparent); }

/* Connexion : fond animé multicolore */
.ecran-connexion {
  background: linear-gradient(130deg, #1e3a8a, #2563eb, #0ea5e9, #38bdf8, #1e3a8a);
  background-size: 300% 300%; animation: degrade-anime 16s ease infinite;
}
@keyframes degrade-anime { 0%, 100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* --- Mobile : barre d'onglets flottante, accueil en bannière ------------- */
@media (max-width: 819px) {
  :root { --hauteur-onglets: 78px; }

  .onglets {
    left: 12px; right: 12px; bottom: calc(10px + var(--bas-sur));
    height: 64px; padding: 6px; border-radius: 24px; border-top: 0;
    box-shadow: 0 18px 40px -16px rgba(15, 35, 90, .45), var(--contour-verre);
  }
  .onglet { gap: 2px; font-size: 10.5px; }
  .onglet-icone { width: 48px; height: 30px; transition: background .3s var(--ressort), transform .3s var(--ressort), box-shadow .3s; }
  .onglet.actif { color: var(--accent); }
  .onglet.actif .onglet-icone {
    background: var(--degrade); color: #fff; transform: translateY(-2px);
    box-shadow: 0 8px 16px -8px rgba(37, 99, 235, .9);
  }

  /* Accueil : le bonjour devient une bannière colorée */
  .contenu > .grand-titre.avec-avatar:first-child {
    position: relative; overflow: hidden; align-items: center;
    margin: 6px 0 20px; padding: 22px 18px; border-radius: 26px;
    background: var(--degrade); box-shadow: var(--ombre-couleur);
  }
  .contenu > .grand-titre.avec-avatar:first-child::before,
  .contenu > .grand-titre.avec-avatar:first-child::after {
    content: ""; position: absolute; border-radius: 50%; pointer-events: none;
  }
  .contenu > .grand-titre.avec-avatar:first-child::before { width: 200px; height: 200px; right: -60px; top: -90px; background: radial-gradient(circle, rgba(255, 255, 255, .3), transparent 65%); }
  .contenu > .grand-titre.avec-avatar:first-child::after { width: 160px; height: 160px; left: -50px; bottom: -90px; background: radial-gradient(circle, rgba(125, 211, 252, .55), transparent 65%); }
  .contenu > .grand-titre.avec-avatar:first-child > * { position: relative; z-index: 1; }
  .contenu > .grand-titre.avec-avatar:first-child h1 { color: #fff; background: none; font-size: 28px; }
  .contenu > .grand-titre.avec-avatar:first-child .sur-titre { color: rgba(255, 255, 255, .85); }
  .contenu > .grand-titre.avec-avatar:first-child .avatar {
    width: 48px; height: 48px; background: rgba(255, 255, 255, .22); box-shadow: inset 0 0 0 2px rgba(255, 255, 255, .5);
  }

  .stat { flex-basis: 150px; }
  .grand-titre h1 { font-size: 31px; }

  /* Barre d'action du devis : flottante, au-dessus des onglets */
  .barre-action-devis {
    left: 12px; right: 12px; bottom: calc(var(--hauteur-onglets) + var(--bas-sur) + 4px);
    border-radius: 20px; border-top: 0; padding: 8px;
    box-shadow: 0 14px 32px -16px rgba(15, 35, 90, .45), var(--contour-verre);
  }
}

/* Grand écran : rail aux mêmes couleurs */
@media (min-width: 820px) {
  .onglet.actif { color: var(--accent); }
  .onglet.actif .onglet-icone { background: var(--degrade); color: #fff; box-shadow: 0 8px 16px -8px rgba(37, 99, 235, .9); }
}
@media (min-width: 820px) and (hover: hover) {
  .onglet.actif:hover .onglet-icone { background: var(--degrade); }
}

@media print {
  body::before { display: none; }
  .grand-titre h1, .numero-devis, .total-final strong, .totaux-devis .total-ttc strong { color: #000 !important; background: none !important; }
}
