/* ==========================================================================
   YATOU — design system
   --------------------------------------------------------------------------
   Fondation : la couche de design « Hali » fournie (palette teal, composants
   hl-*, tableaux lisibles, impression propre). Retiré : les correctifs
   KaiAdmin et le vocabulaire médical. Ajouté : mise en page autonome
   (barre latérale + barre du bas mobile), mode sombre, cibles 48 px,
   texte 16 px sur mobile, tableaux en cartes, feuille d'action.

   Principes (inchangés) :
   - lisibilité d'abord : des tableaux denses, lus toute la journée ;
   - sobriété : la couleur signale, elle ne décore pas ;
   - légèreté : aucune police ni image externe (connexions 3G) ;
   - l'impression reste propre (factures, reçus, relevés).
   ========================================================================== */

:root {
    --yt-primaire: #0f766e;
    --yt-primaire-fonce: #115e59;
    --yt-primaire-clair: #ccfbf1;
    --yt-primaire-pale: #f0fdfa;

    --yt-succes: #15803d;
    --yt-succes-pale: #f0fdf4;
    --yt-alerte: #b45309;
    --yt-alerte-pale: #fffbeb;
    --yt-danger: #b91c1c;
    --yt-danger-pale: #fef2f2;
    --yt-info: #1d4ed8;
    --yt-info-pale: #eff6ff;

    --yt-encre: #111827;
    --yt-texte: #374151;
    --yt-discret: #6b7280;
    --yt-bordure: #e5e7eb;
    --yt-ligne: #f1f2f4;
    --yt-fond: #f6f7f9;
    --yt-surface: #ffffff;
    --yt-surface-2: #fafbfc;

    --yt-rayon: 12px;
    --yt-rayon-petit: 8px;
    --yt-ombre: 0 1px 2px rgba(17, 24, 39, .04), 0 4px 12px rgba(17, 24, 39, .06);
    --yt-ombre-forte: 0 8px 24px rgba(17, 24, 39, .12);

    --yt-cible: 48px;            /* taille tactile minimale */
    --yt-haut: 60px;             /* barre du haut */
    --yt-bas: 68px;              /* barre du bas mobile */
    --yt-lateral: 248px;

    /* Barre latérale et tiroir (refonte UX) */
    --yt-nuit: #0b2624;
    --yt-nuit-texte: #c7dbd8;
    --yt-nuit-discret: #7fa19d;
    --yt-accent: #2dd4bf;

    color-scheme: light;
}

/* Toujours clair (choix du propriétaire, 28/09/2026) : pas de bascule automatique en mode sombre selon
   le réglage de l'appareil. Le thème sombre reste disponible seulement s'il est demandé explicitement. */
:root[data-theme="dark"] {
    --yt-primaire: #2dd4bf; --yt-primaire-fonce: #5eead4; --yt-primaire-clair: #134e4a; --yt-primaire-pale: #0f2a28;
    --yt-succes: #4ade80; --yt-succes-pale: #052e16; --yt-alerte: #fbbf24; --yt-alerte-pale: #3a2a06;
    --yt-danger: #f87171; --yt-danger-pale: #3b0d0d; --yt-info: #93c5fd; --yt-info-pale: #0c1f3f;
    --yt-encre: #f3f4f6; --yt-texte: #d1d5db; --yt-discret: #9ca3af; --yt-bordure: #2b3340; --yt-ligne: #232a35;
    --yt-fond: #0f141b; --yt-surface: #161c25; --yt-surface-2: #1b222d;
    color-scheme: dark;
}

/* ------------------------------------------------------------------ Base */

*, *::before, *::after { box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

[hidden] { display: none !important; }
body {
    margin: 0;
    background: var(--yt-fond);
    color: var(--yt-texte);
    font: 15px/1.55 system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 { color: var(--yt-encre); font-weight: 650; letter-spacing: -.01em; line-height: 1.25; margin: 0 0 .5rem; }
h1 { font-size: 1.45rem; } h2 { font-size: 1.1rem; } h3 { font-size: 1rem; }
p { margin: 0 0 .75rem; }
a { color: var(--yt-primaire); text-decoration: none; }
a:hover { color: var(--yt-primaire-fonce); text-decoration: underline; }
img, svg { vertical-align: middle; }
hr { border: 0; border-top: 1px solid var(--yt-bordure); margin: 1rem 0; }
small, .discret { color: var(--yt-discret); }
.chiffres, .montant { font-variant-numeric: tabular-nums; white-space: nowrap; }
.montant-fort { font-weight: 700; color: var(--yt-encre); }
.positif { color: var(--yt-succes); }
.negatif { color: var(--yt-danger); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
:focus-visible { outline: 2px solid var(--yt-primaire); outline-offset: 2px; }

.ico { width: 20px; height: 20px; flex: none; stroke: currentColor; fill: none; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.ico-petit { width: 16px; height: 16px; }

/* ------------------------------------------------------------------ Mise en page (refonte UX, 17/10/2026)
   Barre latérale sombre et calme (on la lit peu, on la reconnaît) ; barre du haut claire (le titre et
   l'action « Nouveau ») ; onglets d'espace sous la barre : les écrans d'un même espace côte à côte. */

.app { min-height: 100vh; min-height: 100dvh; }

.lateral {
    position: fixed; inset: 0 auto 0 0; width: var(--yt-lateral); z-index: 30;
    display: none; flex-direction: column;
    background: var(--yt-nuit); color: var(--yt-nuit-texte);
}
.lateral-marque, .tiroir-entete {
    display: flex; align-items: center; gap: 11px; min-height: var(--yt-haut); padding: 10px 18px;
}
.logo { width: 34px; height: 34px; flex: none; border-radius: 10px; display: grid; place-items: center; background: var(--yt-primaire); color: #fff; font-weight: 800; font-size: 1rem; }
.marque-texte { display: grid; min-width: 0; line-height: 1.25; }
.marque-texte strong { color: #fff; font-size: .98rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.marque-texte small { color: var(--yt-nuit-discret); font-size: .74rem; font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lateral nav, .tiroir nav { flex: 1; overflow-y: auto; padding: 6px 0 16px; }
.lateral .section, .tiroir .section { margin: 18px 0 6px; padding-left: 22px; color: var(--yt-nuit-discret); font-size: .68rem; font-weight: 700; letter-spacing: .1em; text-transform: uppercase; }
.lateral a.lien, .tiroir a.lien {
    display: flex; align-items: center; gap: 12px; min-height: 42px; margin: 2px 10px; padding: 0 12px;
    border-radius: 10px; color: var(--yt-nuit-texte); font-size: .92rem; font-weight: 500;
}
.lien-texte { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lateral a.lien .ico, .tiroir a.lien .ico { opacity: .8; }
.lateral a.lien:hover, .tiroir a.lien:hover { background: rgba(255,255,255,.07); color: #fff; text-decoration: none; }
.lateral a.lien.est-actif, .tiroir a.lien.est-actif { background: rgba(45,212,191,.16); color: #fff; font-weight: 650; box-shadow: inset 3px 0 0 var(--yt-accent); }
.lateral a.lien.est-actif .ico, .tiroir a.lien.est-actif .ico { opacity: 1; color: var(--yt-accent); }
.compteur { margin-left: auto; min-width: 22px; padding: 1px 7px; border-radius: 999px; background: var(--yt-alerte); color: #fff; font-size: .72rem; font-weight: 700; text-align: center; line-height: 1.5; }
.lateral-pied { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-top: 1px solid rgba(255,255,255,.08); }
.lateral-qui { display: grid; min-width: 0; line-height: 1.25; }
.lateral-qui strong { color: #fff; font-size: .85rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.lateral-qui small { color: var(--yt-nuit-discret); font-size: .74rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar-menu { width: 34px; height: 34px; flex: none; border-radius: 50%; display: grid; place-items: center; background: rgba(255,255,255,.1); color: #fff; font-weight: 700; font-size: .8rem; }

.haut {
    position: sticky; top: 0; z-index: 20; height: var(--yt-haut);
    display: flex; align-items: center; gap: 10px; padding: 0 12px 0 10px;
    background: color-mix(in srgb, var(--yt-surface) 92%, transparent); backdrop-filter: saturate(1.4) blur(10px);
    border-bottom: 1px solid var(--yt-bordure); color: var(--yt-encre);
}
.haut .titre { display: grid; min-width: 0; line-height: 1.2; font-weight: 700; font-size: 1.02rem; padding-left: 6px; }
.haut .titre small { color: var(--yt-discret); font-size: .75rem; font-weight: 500; }
.haut .titre span { font-weight: 700; font-size: 1.02rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.haut .titre .titre-espace { color: var(--yt-discret); font-size: .72rem; font-weight: 650; letter-spacing: .04em; text-transform: uppercase; }
.haut .droite { margin-left: auto; display: flex; align-items: center; gap: 8px; }
.haut .bouton-haut {
    width: 44px; height: 44px; flex: none; display: inline-grid; place-items: center; padding: 0;
    border: 0; border-radius: 12px; background: transparent; color: var(--yt-encre); cursor: pointer;
}
.haut .bouton-haut:hover { background: var(--yt-ligne); }
.bouton-nouveau { min-height: 40px; white-space: nowrap; }
.avatar-haut { width: 38px; height: 38px; border: 0; border-radius: 50%; display: grid; place-items: center; background: var(--yt-primaire-clair); color: var(--yt-primaire-fonce); font: inherit; font-weight: 700; font-size: .82rem; cursor: pointer; }
.avatar-haut:hover { box-shadow: 0 0 0 3px var(--yt-primaire-pale); }
.compte { position: relative; }
/* Audit A6 : aide orale de l'écran (bouton en haut, une ligne par langue). */
.aide-vocale { position: relative; }
.aide-vocale .compte-menu { width: 300px; }
.aide-vocale .aide-ligne { display: grid; gap: 4px; padding: 8px; }
.aide-vocale .aide-ligne audio { width: 100%; height: 36px; }
.bouton-aide { gap: 6px; }
.compte-menu {
    position: absolute; right: 0; top: calc(100% + 8px); z-index: 45; width: 260px; padding: 6px;
    background: var(--yt-surface); border: 1px solid var(--yt-bordure); border-radius: 14px; box-shadow: var(--yt-ombre-forte);
}
.compte-qui { display: grid; padding: 10px 12px 12px; border-bottom: 1px solid var(--yt-ligne); margin-bottom: 4px; }
.compte-qui strong { color: var(--yt-encre); }
.compte-qui small { font-size: .8rem; }
.compte-menu a, .compte-menu button {
    display: flex; align-items: center; gap: 10px; width: 100%; min-height: 42px; padding: 0 12px;
    border: 0; border-radius: 10px; background: none; color: var(--yt-texte); font: inherit; font-size: .9rem; font-weight: 550; cursor: pointer; text-align: left;
}
.compte-menu a:hover, .compte-menu button:hover { background: var(--yt-ligne); color: var(--yt-encre); text-decoration: none; }

.contenu { padding: 16px 16px calc(var(--yt-bas) + 28px); max-width: 1320px; margin: 0 auto; }

/* Onglets d'un espace : les écrans voisins à un geste, sans repasser par le menu. */
.espace-onglets {
    display: flex; gap: 4px; margin: -4px 0 18px; padding: 4px; overflow-x: auto; scrollbar-width: none;
    background: var(--yt-surface); border: 1px solid var(--yt-bordure); border-radius: 14px; width: max-content; max-width: 100%;
}
.espace-onglets::-webkit-scrollbar { display: none; }
.espace-onglets a {
    display: inline-flex; align-items: center; gap: 6px; flex: none; min-height: 38px; padding: 0 14px;
    border-radius: 10px; color: var(--yt-discret); font-size: .88rem; font-weight: 650; white-space: nowrap;
}
.espace-onglets a:hover { color: var(--yt-encre); background: var(--yt-ligne); text-decoration: none; }
.espace-onglets a.est-actif { background: var(--yt-primaire); color: #fff; }
.espace-onglets a.est-actif .compteur { background: #fff; color: var(--yt-primaire-fonce); }

/* Barre du bas mobile : 3 onglets, le « + » au centre, et « Menu » pour tout le reste. */
.bas {
    position: fixed; inset: auto 0 0 0; z-index: 25; height: calc(var(--yt-bas) + env(safe-area-inset-bottom));
    padding-bottom: env(safe-area-inset-bottom);
    display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
    background: var(--yt-surface); border-top: 1px solid var(--yt-bordure); box-shadow: 0 -4px 16px rgba(17,24,39,.06);
}
.bas a, .bas button.onglet {
    display: grid; justify-items: center; gap: 3px; min-width: 0; min-height: var(--yt-cible); padding: 6px 2px;
    border: 0; background: none; color: var(--yt-discret); font: inherit; font-size: .7rem; font-weight: 650; cursor: pointer;
    overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.bas a.est-actif { color: var(--yt-primaire); }
.bas a.est-actif .ico { stroke-width: 2.2; }
.bas a:hover { text-decoration: none; }
.bas .plus {
    justify-self: center; width: 56px; height: 56px; margin-top: -26px; border: 4px solid var(--yt-fond); border-radius: 18px;
    display: grid; place-items: center; background: var(--yt-primaire); color: #fff; cursor: pointer; box-shadow: var(--yt-ombre-forte);
}
.bas .plus .ico { width: 26px; height: 26px; stroke-width: 2.4; }

/* Tiroir du menu (téléphone) */
.tiroir {
    position: fixed; inset: 0 auto 0 0; z-index: 41; width: min(320px, 86vw); display: flex; flex-direction: column;
    background: var(--yt-nuit); color: var(--yt-nuit-texte); box-shadow: var(--yt-ombre-forte);
    padding-bottom: env(safe-area-inset-bottom); animation: tiroir .18s ease-out;
}
@keyframes tiroir { from { transform: translateX(-100%); } }
.tiroir-entete { border-bottom: 1px solid rgba(255,255,255,.08); }
.bouton-fermer { margin-left: auto; width: 40px; height: 40px; flex: none; display: grid; place-items: center; border: 0; border-radius: 10px; background: rgba(255,255,255,.08); color: #fff; cursor: pointer; }
.tiroir-pied { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; padding: 12px; border-top: 1px solid rgba(255,255,255,.08); }
.tiroir-pied form { display: contents; }
.tiroir-pied .hl-bouton { background: rgba(255,255,255,.06); border-color: rgba(255,255,255,.1); color: #fff; font-size: .85rem; padding: 0 8px; white-space: nowrap; }

@media (min-width: 1024px) {
    .lateral { display: flex; }
    .haut, .contenu, .pied { margin-left: var(--yt-lateral); }
    .haut { padding: 0 28px; }
    .contenu { padding: 24px 28px 40px; }
    .bas { display: none; }
    .seulement-mobile { display: none !important; }
}
@media (max-width: 1023.98px) {
    .seulement-bureau { display: none !important; }
}

/* Feuille d'action (le « + ») */
.feuille-fond { position: fixed; inset: 0; z-index: 40; background: rgba(17,24,39,.45); }
.feuille {
    position: fixed; inset: auto 0 0 0; z-index: 41; max-height: 85vh; overflow-y: auto;
    padding: 10px 16px calc(20px + env(safe-area-inset-bottom));
    background: var(--yt-surface); border-radius: 18px 18px 0 0; box-shadow: var(--yt-ombre-forte);
}
.feuille::before { content: ""; display: block; width: 40px; height: 4px; margin: 0 auto 12px; border-radius: 99px; background: var(--yt-bordure); }
.feuille h2 { font-size: 1rem; margin: 4px 4px 12px; }
.feuille-grille { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.feuille-action {
    display: flex; align-items: center; gap: 12px; min-height: 64px; padding: 12px 14px;
    border: 1px solid var(--yt-bordure); border-radius: var(--yt-rayon); background: var(--yt-surface-2);
    color: var(--yt-encre); font-weight: 600;
}
.feuille-action:hover { border-color: var(--yt-primaire); text-decoration: none; }
.feuille-action .pastille-ico { width: 38px; height: 38px; border-radius: 11px; display: grid; place-items: center; background: var(--yt-primaire-clair); color: var(--yt-primaire-fonce); }
@media (min-width: 1024px) {
    .feuille { inset: 12vh auto auto 50%; transform: translateX(-50%); width: min(560px, 92vw); border-radius: 18px; }
}

/* ------------------------------------------------------------------ En-tête de page */

.hl-entete { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 12px 16px; margin-bottom: 18px; }
.hl-entete h1 { margin: 0; font-size: 1.45rem; font-weight: 700; letter-spacing: -.015em; }
.hl-entete p { margin: 4px 0 0; color: var(--yt-discret); font-size: .92rem; }
.hl-entete-actions { margin-left: auto; display: flex; flex-wrap: wrap; gap: 8px; }
.fil { display: inline-flex; align-items: center; gap: 6px; margin-bottom: 6px; font-size: .85rem; font-weight: 600; }

/* ------------------------------------------------------------------ Blocs */

.hl-bloc { background: var(--yt-surface); border: 1px solid var(--yt-bordure); border-radius: var(--yt-rayon); box-shadow: 0 1px 2px rgba(17,24,39,.04); margin-bottom: 16px; }
.hl-bloc-titre { display: flex; align-items: center; gap: 8px; margin: 0; padding: 14px 18px; border-bottom: 1px solid var(--yt-bordure); font-size: .95rem; font-weight: 650; color: var(--yt-encre); }
.hl-bloc-titre small, .hl-bloc-titre .a-droite { margin-left: auto; color: var(--yt-discret); font-weight: 500; font-size: .82rem; }
.hl-bloc-corps { padding: 16px 18px; }
.hl-bloc-pied { padding: 12px 18px; border-top: 1px solid var(--yt-bordure); background: var(--yt-surface-2); border-radius: 0 0 var(--yt-rayon) var(--yt-rayon); }

.grille { display: grid; gap: 16px; }
/* Lignes de saisie répétées (complément de reprise) : empilées sur mobile, en ligne sur écran large. */
.grille-complement { display: grid; gap: 0 12px; padding-bottom: 6px; }
.grille-complement > * { min-width: 0; }
@media (min-width: 700px) { .grille-complement { grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); } }
@media (min-width: 900px) {
    .grille-2 { grid-template-columns: 1fr 1fr; }
    .grille-3 { grid-template-columns: repeat(3, 1fr); }
    .grille-2-1 { grid-template-columns: 2fr 1fr; }
}

/* ------------------------------------------------------------------ Boutons */

.hl-bouton {
    display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 44px; padding: 0 16px;
    border: 1px solid var(--yt-bordure); border-radius: var(--yt-rayon-petit); background: var(--yt-surface);
    color: var(--yt-texte); font: inherit; font-size: .9rem; font-weight: 600; text-decoration: none; cursor: pointer;
    transition: border-color .12s ease, color .12s ease, background-color .12s ease;
}
.hl-bouton:hover { border-color: var(--yt-primaire); color: var(--yt-primaire-fonce); text-decoration: none; }
.hl-bouton:disabled, .hl-bouton[aria-disabled="true"] { opacity: .55; cursor: not-allowed; }
.hl-bouton-plein { background: var(--yt-primaire); border-color: var(--yt-primaire); color: #fff; }
.hl-bouton-plein:hover { background: var(--yt-primaire-fonce); border-color: var(--yt-primaire-fonce); color: #fff; }
.hl-bouton-danger { background: var(--yt-surface); border-color: #fecaca; color: var(--yt-danger); }
.hl-bouton-danger:hover { background: var(--yt-danger-pale); border-color: var(--yt-danger); color: var(--yt-danger); }
.hl-bouton-large { width: 100%; min-height: var(--yt-cible); font-size: 1rem; }
.hl-bouton-petit { min-height: 36px; padding: 0 12px; font-size: .82rem; }
.hl-bouton .chargement { display: none; }
.hl-bouton[data-loading] .chargement, .hl-bouton.est-charge .chargement { display: inline-block; }

.tourne { width: 16px; height: 16px; border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(360deg); } }

/* ------------------------------------------------------------------ Puces, pastilles */

.hl-puces { display: flex; flex-wrap: wrap; gap: 8px; }
.hl-puce {
    display: inline-flex; align-items: center; gap: 7px; min-height: 38px; padding: 0 14px;
    border: 1px solid var(--yt-bordure); border-radius: 999px; background: var(--yt-surface);
    color: var(--yt-texte); font: inherit; font-size: .85rem; font-weight: 600; text-decoration: none; cursor: pointer;
}
.hl-puce:hover { border-color: var(--yt-primaire); color: var(--yt-primaire-fonce); text-decoration: none; }
.hl-puce.est-actif, .hl-puce[aria-pressed="true"] { background: var(--yt-primaire); border-color: var(--yt-primaire); color: #fff; }
.hl-puce b { font-weight: 700; font-variant-numeric: tabular-nums; opacity: .8; }

/* Statuts : toujours une couleur ET un mot, jamais la couleur seule. */
.hl-statut { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; border-radius: 999px; font-size: .78rem; font-weight: 600; white-space: nowrap; }
.hl-statut::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.hl-s-succes { background: var(--yt-succes-pale); color: var(--yt-succes); }
.hl-s-alerte { background: var(--yt-alerte-pale); color: var(--yt-alerte); }
.hl-s-danger { background: var(--yt-danger-pale); color: var(--yt-danger); }
.hl-s-info { background: var(--yt-info-pale); color: var(--yt-info); }
.hl-s-neutre { background: var(--yt-ligne); color: var(--yt-texte); }
.hl-s-barre { background: var(--yt-ligne); color: var(--yt-discret); text-decoration: line-through; }

/* ------------------------------------------------------------------ Chiffres clés */

.hl-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 14px; margin-bottom: 16px; }
.hl-kpi { padding: 16px 18px; display: grid; gap: 4px; align-content: start; background: var(--yt-surface); border: 1px solid var(--yt-bordure); border-radius: var(--yt-rayon); color: inherit; }
a.hl-kpi:hover { border-color: var(--yt-primaire); text-decoration: none; }
.hl-kpi-libelle { color: var(--yt-discret); font-size: .85rem; font-weight: 600; }
.hl-kpi-valeur { color: var(--yt-encre); font-size: 1.65rem; font-weight: 700; line-height: 1.15; letter-spacing: -.02em; font-variant-numeric: tabular-nums; }
.hl-kpi-valeur small { font-size: .9rem; font-weight: 600; color: var(--yt-discret); letter-spacing: 0; }
.hl-kpi-detail { color: var(--yt-discret); font-size: .83rem; }
.hl-kpi.est-alerte .hl-kpi-valeur { color: var(--yt-alerte); }
.hl-kpi.est-danger .hl-kpi-valeur { color: var(--yt-danger); }
.hl-kpi.est-succes .hl-kpi-valeur { color: var(--yt-succes); }

/* ------------------------------------------------------------------ Jauges */

.hl-jauge { position: relative; height: 8px; border-radius: 999px; background: var(--yt-ligne); overflow: hidden; }
.hl-jauge > span { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--hl-jauge, var(--yt-primaire)); }

/* ------------------------------------------------------------------ Listes et classements */

.hl-liste { margin: 0; padding: 0; list-style: none; }
.hl-liste > li { display: flex; align-items: center; gap: 12px; min-height: 56px; padding: 10px 18px; border-bottom: 1px solid var(--yt-ligne); }
.hl-liste > li:last-child { border-bottom: 0; }
.hl-liste li a.couvrant { display: flex; align-items: center; gap: 12px; flex: 1 1 14rem; color: inherit; min-width: 0; }
.hl-liste li a.couvrant:hover { text-decoration: none; }
.hl-liste .principal { min-width: 0; flex: 1; }
.hl-liste .principal strong { display: block; color: var(--yt-encre); font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-liste .principal span { display: block; color: var(--yt-discret); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hl-liste .fin { text-align: right; display: grid; justify-items: end; gap: 4px; }

.hl-avatar { width: 40px; height: 40px; flex: 0 0 40px; display: grid; place-items: center; border-radius: 11px; background: var(--yt-primaire-clair); color: var(--yt-primaire-fonce); font-size: .85rem; font-weight: 700; }

/* ------------------------------------------------------------------ Tableaux */

.table-conteneur { overflow-x: auto; }
table.hl-table { width: 100%; border-collapse: collapse; color: var(--yt-texte); }
.hl-table th {
    background: var(--yt-surface-2); border-bottom: 1px solid var(--yt-bordure); color: var(--yt-discret);
    font-size: .72rem; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; padding: 11px 16px; text-align: left; white-space: nowrap;
}
.hl-table td { border-top: 1px solid var(--yt-ligne); padding: 12px 16px; vertical-align: middle; }
.hl-table tbody tr:hover td { background: var(--yt-primaire-pale); }
.hl-table .a-droite, .hl-table th.a-droite { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
/* Tableau de synthèse (libellé | montant) : sur petit écran, la cellule de droite peut passer à la ligne
   entre deux montants (« avant → après », « montant · référence ») au lieu de déborder. */
@media (max-width: 600px) {
    .hl-table.resume td { padding: 10px 8px; }
    .hl-table.resume .a-droite { white-space: normal; }
}
.hl-table tfoot td, .hl-table tfoot th { background: var(--yt-surface-2); border-top: 2px solid var(--yt-bordure); font-weight: 650; color: var(--yt-encre); }
.hl-table tr.est-barre td { color: var(--yt-discret); text-decoration: line-through; }

/* Sous 640 px, un tableau devient une liste de cartes (chaque cellule porte son libellé). */
@media (max-width: 639.98px) {
    table.hl-table.en-cartes thead { display: none; }
    table.hl-table.en-cartes, .en-cartes tbody, .en-cartes tr, .en-cartes td { display: block; width: 100%; }
    .en-cartes tr { padding: 10px 16px; border-bottom: 1px solid var(--yt-ligne); }
    .en-cartes td { border: 0; padding: 3px 0; display: flex; justify-content: space-between; gap: 12px; text-align: right; }
    .en-cartes td::before { content: attr(data-libelle); color: var(--yt-discret); font-size: .82rem; font-weight: 600; text-align: left; }
    .en-cartes td.titre-carte { font-weight: 650; color: var(--yt-encre); font-size: 1rem; text-align: left; }
    .en-cartes td.titre-carte::before { content: none; }
    .en-cartes tfoot { display: block; }
    .en-cartes tbody tr:hover td { background: none; }
}

/* ------------------------------------------------------------------ Formulaires */

.champ { display: grid; gap: 6px; margin-bottom: 16px; }
.champ label, .etiquette { color: var(--yt-encre); font-size: .85rem; font-weight: 650; }
.champ .aide { color: var(--yt-discret); font-size: .8rem; }
.champ .erreur, .erreur-texte { color: var(--yt-danger); font-size: .82rem; font-weight: 600; }
.saisie, select.saisie, textarea.saisie {
    width: 100%; min-height: var(--yt-cible); padding: 10px 12px;
    border: 1px solid var(--yt-bordure); border-radius: var(--yt-rayon-petit);
    background: var(--yt-surface); color: var(--yt-encre); font: inherit; font-size: 1rem;
    transition: border-color .12s ease, box-shadow .12s ease;
}
.saisie:focus { outline: none; border-color: var(--yt-primaire); box-shadow: 0 0 0 3px var(--yt-primaire-clair); }
.saisie.est-invalide { border-color: var(--yt-danger); }
textarea.saisie { min-height: 88px; line-height: 1.5; }
.saisie-montant { font-size: 1.5rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; }
.en-lettres { color: var(--yt-discret); font-size: .85rem; font-style: italic; min-height: 1.2em; }
.rangee { display: grid; gap: 0 14px; }
@media (min-width: 640px) { .rangee-2 { grid-template-columns: 1fr 1fr; } .rangee-3 { grid-template-columns: repeat(3, 1fr); } }

/* Choix en tuiles (type d'opération, compte, mode) : de vraies cibles tactiles. */
.tuiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 10px; }
.tuile {
    position: relative; display: grid; gap: 4px; min-height: 64px; padding: 12px 14px;
    border: 1.5px solid var(--yt-bordure); border-radius: var(--yt-rayon); background: var(--yt-surface);
    color: var(--yt-encre); font: inherit; text-align: left; cursor: pointer;
}
.tuile small { color: var(--yt-discret); font-size: .8rem; }
.tuile:hover { border-color: var(--yt-primaire); }
.tuile.est-choisie, .tuile[aria-pressed="true"] { border-color: var(--yt-primaire); background: var(--yt-primaire-pale); box-shadow: inset 0 0 0 1px var(--yt-primaire); }

/* Étapes d'un formulaire guidé */
.etapes { display: flex; gap: 6px; margin-bottom: 16px; }
.etapes span { flex: 1; height: 4px; border-radius: 99px; background: var(--yt-bordure); }
.etapes span.faite { background: var(--yt-primaire); }
.resume { display: grid; gap: 0; margin: 0; }
.resume div { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 4px 16px; padding: 10px 0; border-bottom: 1px solid var(--yt-ligne); }
.resume dt { color: var(--yt-discret); font-weight: 600; font-size: .9rem; }
.resume dd { margin: 0 0 0 auto; color: var(--yt-encre); font-weight: 600; text-align: right; }
.resume .total dd { font-size: 1.25rem; }

/* ------------------------------------------------------------------ Alertes, notes, vides */

.hl-note { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; border-radius: 10px; font-size: .9rem; margin-bottom: 14px; border-left: 4px solid transparent; }
.hl-note-succes { background: var(--yt-succes-pale); color: var(--yt-succes); border-color: var(--yt-succes); }
.hl-note-alerte { background: var(--yt-alerte-pale); color: var(--yt-alerte); border-color: var(--yt-alerte); }
.hl-note-danger { background: var(--yt-danger-pale); color: var(--yt-danger); border-color: var(--yt-danger); }
.hl-note-info { background: var(--yt-info-pale); color: var(--yt-info); border-color: var(--yt-info); }
.hl-note strong { color: inherit; }

.hl-vide { padding: 36px 24px; text-align: center; color: var(--yt-discret); }
.hl-vide .ico { width: 34px; height: 34px; margin-bottom: 10px; color: var(--yt-bordure); stroke-width: 1.5; }
.hl-vide strong { display: block; color: var(--yt-encre); margin-bottom: 4px; }

.bandeau-hors-ligne { display: flex; align-items: center; gap: 10px; padding: 10px 16px; background: var(--yt-alerte-pale); color: var(--yt-alerte); font-weight: 600; font-size: .88rem; }
.bandeau-hors-ligne.est-ok { background: var(--yt-succes-pale); color: var(--yt-succes); }

/* ------------------------------------------------------------------ Voyant et équation */

.voyant { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; border-radius: var(--yt-rayon); border: 1px solid; }
.voyant .point { width: 14px; height: 14px; margin-top: 4px; border-radius: 50%; flex: none; box-shadow: 0 0 0 5px color-mix(in srgb, currentColor 18%, transparent); background: currentColor; }
.voyant-vert { background: var(--yt-succes-pale); border-color: color-mix(in srgb, var(--yt-succes) 35%, transparent); color: var(--yt-succes); }
.voyant-orange { background: var(--yt-alerte-pale); border-color: color-mix(in srgb, var(--yt-alerte) 35%, transparent); color: var(--yt-alerte); }
.voyant-rouge { background: var(--yt-danger-pale); border-color: color-mix(in srgb, var(--yt-danger) 35%, transparent); color: var(--yt-danger); }
.voyant strong { display: block; font-size: 1rem; color: inherit; }
.voyant ul { margin: 6px 0 0; padding-left: 18px; font-size: .88rem; }

.equation { display: grid; gap: 10px; align-items: center; text-align: center; }
@media (min-width: 720px) { .equation { grid-template-columns: 1fr auto 1fr; } }
.equation .membre { padding: 16px; border-radius: var(--yt-rayon); background: var(--yt-surface-2); border: 1px solid var(--yt-bordure); }
.equation .membre small { display: block; font-weight: 600; }
.equation .membre b { display: block; margin-top: 4px; font-size: 1.5rem; color: var(--yt-encre); font-variant-numeric: tabular-nums; }
.equation .egal { font-size: 1.6rem; font-weight: 700; color: var(--yt-discret); }

/* ------------------------------------------------------------------ Connexion */

.page-connexion { min-height: 100vh; min-height: 100dvh; display: grid; place-items: center; padding: 24px 16px; background: var(--yt-fond); }
.carte-connexion { width: min(420px, 100%); padding: 28px 24px; background: var(--yt-surface); border: 1px solid var(--yt-bordure); border-top: 4px solid var(--yt-primaire); border-radius: 14px; box-shadow: var(--yt-ombre); }
.carte-connexion .marque { display: flex; align-items: center; gap: 12px; margin-bottom: 20px; }
.carte-connexion .marque .logo { width: 44px; height: 44px; border-radius: 12px; display: grid; place-items: center; background: var(--yt-primaire); color: #fff; font-weight: 800; font-size: 1.2rem; }

/* ------------------------------------------------------------------ Refonte 06/10/2026 (docs/refonte/02-DESIGN-SYSTEM.md) */

[x-cloak] { display: none !important; }
.hl-bouton-discret { background: transparent; border-color: transparent; color: var(--yt-discret); }
.hl-bouton-discret:hover { background: var(--yt-ligne); border-color: transparent; color: var(--yt-encre); }
button.hl-bouton-discret:not(.hl-bouton) { border: 0; padding: 4px; border-radius: var(--yt-rayon-petit); cursor: pointer; min-width: 36px; min-height: 36px; display: inline-grid; place-items: center; }
.hl-bouton-danger-plein { background: var(--yt-danger); border-color: var(--yt-danger); color: #fff; }
.hl-bouton-danger-plein:hover { filter: brightness(.92); color: #fff; }
.hl-bouton[disabled] .tourne, .hl-bouton .tourne { margin-left: 4px; }

/* Utilitaires qui remplacent les style="" les plus fréquents (audit UI, incohérence 1). */
.ligne-actions { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; }
.ligne-actions.a-droite { justify-content: flex-end; }
.pile { display: grid; gap: 12px; }
.sans-marge { margin: 0; }
.page-etroite { max-width: 720px; margin-inline: auto; }
.page-moyenne { max-width: 960px; margin-inline: auto; }

/* Messages après une action Livewire (correctif U3). */
.flash .hl-note { align-items: center; }
.flash-texte { flex: 1; }

/* Fenêtre de confirmation (x-confirmation) : feuille en bas sur téléphone, boîte centrée sur ordinateur. */
.modale-fond { position: fixed; inset: 0; z-index: 50; display: grid; align-items: end; background: rgba(17,24,39,.45); }
.modale { width: 100%; padding: 20px 18px calc(18px + env(safe-area-inset-bottom)); background: var(--yt-surface); border-radius: 16px 16px 0 0; box-shadow: var(--yt-ombre-forte); }
.modale h2 { font-size: 1.1rem; margin-bottom: 8px; }
.modale-texte { color: var(--yt-texte); margin-bottom: 16px; }
.modale .ligne-actions { justify-content: flex-end; }
.modale .ligne-actions .hl-bouton { min-height: var(--yt-cible); }
@media (max-width: 639.98px) { .modale .ligne-actions .hl-bouton { flex: 1; } }
@media (min-width: 640px) { .modale-fond { place-items: center; } .modale { width: min(460px, calc(100% - 32px)); border-radius: var(--yt-rayon); } }

/* Chiffres clés en 2 × 2 sur téléphone (tableaux de bord, fiche produit). */
@media (max-width: 639.98px) {
    .hl-kpis.kpis-compacts { grid-template-columns: 1fr 1fr; gap: 10px; }
    .kpis-compacts .hl-kpi { padding: 12px; }
    .kpis-compacts .hl-kpi-detail { font-size: .78rem; }
}
.pile-serree { display: grid; gap: 4px; justify-items: start; text-align: left; }
.espace-haut { margin-top: 12px; }

/* Mouvements de stock : avant → mouvement → après. */
.mouvement-entree { color: var(--yt-succes); font-weight: 650; }
.mouvement-sortie { color: var(--yt-danger); font-weight: 650; }

/* ------------------------------------------------------------------ Mobile */

@media (max-width: 639.98px) {
    /* Filtres sur une seule ligne qui défile, plutôt que trois lignes de puces avant le contenu. */
    .hl-puces[aria-label^="Filtrer"], .hl-puces[role="tablist"] { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; margin-inline: -2px; padding: 2px; }
    .hl-puces .hl-puce { flex: none; }
    /* Un nom de caisse ou de client se lit en entier : deux lignes plutôt que des points de suspension. */
    .hl-liste .principal strong, .hl-liste .principal span { white-space: normal; display: -webkit-box; -webkit-box-orient: vertical; -webkit-line-clamp: 2; }
    body { font-size: 16px; }
    .contenu { padding-left: 12px; padding-right: 12px; }
    .hl-entete h1 { font-size: 1.3rem; }
    .hl-entete-actions { margin-left: 0; width: 100%; }
    .hl-entete-actions .hl-bouton { flex: 1; }
    .hl-kpi-valeur { font-size: 1.4rem; }
    .hl-bloc-corps { padding: 14px; }
    .hl-liste > li { padding: 10px 14px; }
    .hl-bouton { min-height: var(--yt-cible); }
}

/* ------------------------------------------------------------------ Impression */

.impression-seule { display: none; }
@media print {
    .lateral, .haut, .bas, .no-print, .hl-entete-actions, .hl-puces, .hl-bouton, .feuille, .bandeau-hors-ligne { display: none !important; }
    .haut, .contenu { margin: 0 !important; }
    .contenu { padding: 0 !important; max-width: none; }
    .hl-bloc { border: 1px solid #ddd !important; box-shadow: none !important; break-inside: avoid; }
    body { background: #fff; color: #000; font-size: 12px; }
    .impression-seule { display: block; }
    a { color: inherit; }
}

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

/* Une colonne de grille ou un élément de liste ne s'élargit jamais au-delà de l'écran
   à cause d'un texte long : il rétrécit et le texte passe en points de suspension. */
.grille > *, .hl-kpis > *, .hl-liste > li > * { min-width: 0; }
.hl-kpi-valeur { font-size: clamp(1.25rem, 1rem + 1.1vw, 1.65rem); overflow-wrap: anywhere; }
.hl-kpis { grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); }
.hl-kpi-valeur .montant { white-space: normal; }
.feuille-grille > *, .tuiles > * { min-width: 0; }
code { overflow-wrap: anywhere; word-break: break-word; }

/* ------------------------------------------------------------------ Refonte UX 17/10/2026 : pages plus courtes */

/* Listes repliées à 5 lignes (x-voir-plus). */
.est-replie > :nth-child(n+6) { display: none !important; }
.voir-plus {
    display: block; width: 100%; min-height: 46px; padding: 0 18px; border: 0; border-top: 1px solid var(--yt-ligne);
    border-radius: 0 0 var(--yt-rayon) var(--yt-rayon); background: none; color: var(--yt-primaire); font: inherit; font-size: .88rem; font-weight: 650; cursor: pointer;
}
.voir-plus:hover { background: var(--yt-primaire-pale); }

/* Un bloc vide n'occupe plus la hauteur d'un écran : une ligne discrète. */
.hl-liste .hl-vide, .hl-bloc > .hl-vide {
    display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 0; text-align: left; font-size: .88rem;
}
.hl-liste .hl-vide .ico, .hl-bloc > .hl-vide .ico { width: 22px; height: 22px; margin: 0; color: var(--yt-discret); opacity: .55; }
.hl-liste .hl-vide strong, .hl-bloc > .hl-vide strong { display: inline; margin: 0 6px 0 0; font-weight: 600; color: var(--yt-texte); }
.hl-bloc > .hl-vide { padding: 14px 18px; }

/* Chiffres clés en 2 × 2 sur téléphone, partout : on voit l'essentiel sans défiler. */
@media (max-width: 639.98px) {
    .hl-kpis { grid-template-columns: 1fr 1fr; gap: 10px; }
    .hl-kpi { padding: 12px; }
    .hl-kpi-libelle { font-size: .78rem; }
    .hl-kpi-detail { font-size: .76rem; }
    .hl-kpi-valeur { font-size: min(1.15rem, 4.1vw); letter-spacing: -.03em; }
}

/* Cartes des tableaux sur téléphone : deux champs par ligne (libellé au-dessus), la carte fait moitié moins haut. */
@media (max-width: 639.98px) {
    .en-cartes tbody tr { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 8px 14px; padding: 12px 16px; }
    .en-cartes tbody td { display: block; padding: 0; text-align: left; min-width: 0; overflow-wrap: anywhere; }
    .en-cartes tbody td::before { display: block; margin-bottom: 1px; font-size: .7rem; letter-spacing: .04em; text-transform: uppercase; }
    .en-cartes tbody td.titre-carte { grid-column: 1 / -1; font-size: 1rem; }
    .en-cartes tbody td .montant { white-space: nowrap; }
}

/* ------------------------------------------------------------------ Refonte UX : listes et formulaires (18/10/2026) */

/* Listes en lignes sur téléphone (factures, commandes, opérations) : une ligne d'environ 60 px par élément,
   titre et montant en haut, détail et statut en dessous, toute la ligne cliquable. */
.en-lignes .c-sous, .en-lignes .c-mobile { display: none; }
.est-replie-10 > :nth-child(n+11) { display: none !important; }
/* À l'impression, tout est imprimé : rien ne reste replié. */
@media print { .est-replie > :nth-child(n), .est-replie-10 > :nth-child(n) { display: revert !important; } }
@media (max-width: 639.98px) {
    table.en-lignes thead { display: none; }
    table.en-lignes, .en-lignes tbody { display: block; width: 100%; }
    .en-lignes tbody tr {
        position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto;
        grid-template-areas: "titre montant" "sous statut"; align-items: center; gap: 3px 12px;
        padding: 11px 16px; border-bottom: 1px solid var(--yt-ligne);
    }
    .en-lignes tbody td { display: none; padding: 0; border: 0; min-width: 0; background: none !important; }
    .en-lignes tbody td.c-titre, .en-lignes tbody td.c-montant, .en-lignes tbody td.c-statut, .en-lignes tbody td.c-sous { display: block; }
    .en-lignes .c-titre { grid-area: titre; font-weight: 650; color: var(--yt-encre); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .en-lignes .c-titre br, .en-lignes .c-titre small { display: none; }
    .en-lignes .c-titre a { color: var(--yt-encre); }
    .en-lignes .c-titre a::after { content: ""; position: absolute; inset: 0; }
    .en-lignes .c-montant { grid-area: montant; text-align: right; font-weight: 650; color: var(--yt-encre); }
    .en-lignes .c-statut { grid-area: statut; justify-self: end; }
    .en-lignes .c-sous { grid-area: sous; color: var(--yt-discret); font-size: .84rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
    .en-lignes tbody tr:active { background: var(--yt-primaire-pale); }
    .en-lignes tr.est-barre .c-titre, .en-lignes tr.est-barre .c-montant { text-decoration: line-through; color: var(--yt-discret); }
}

/* Formulaires sur téléphone : le bouton qui valide reste à portée de pouce, au-dessus de la barre du bas. */
@media (max-width: 1023.98px) {
    .hl-bloc-pied:has(.hl-bouton-plein) {
        position: sticky; bottom: calc(var(--yt-bas) + env(safe-area-inset-bottom) + 6px); z-index: 5;
        background: color-mix(in srgb, var(--yt-surface) 94%, transparent); backdrop-filter: blur(8px);
        border-radius: var(--yt-rayon); box-shadow: 0 -6px 16px rgba(17, 24, 39, .06);
    }
}

/* Champ photo / fichier : un vrai bouton, au lieu du « Choose File » du navigateur. */
input[type="file"].saisie { padding: 8px; font-size: .9rem; color: var(--yt-discret); }
input[type="file"].saisie::file-selector-button {
    min-height: 40px; margin-right: 12px; padding: 0 16px; border: 1px solid var(--yt-primaire); border-radius: var(--yt-rayon-petit);
    background: var(--yt-primaire-pale); color: var(--yt-primaire-fonce); font: inherit; font-weight: 650; cursor: pointer;
}

/* Sur téléphone, le titre de la page est déjà dans la barre du haut : on ne le répète pas en grand. */
@media (max-width: 639.98px) {
    .titre-repete { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* Liste avec un bouton par ligne (caisses à compter) : sur téléphone, le nom et le solde occupent toute la
   ligne, les boutons passent dessous à droite — plus de noms coupés sur trois lignes. */
@media (max-width: 639.98px) {
    .hl-liste.liste-actions li a.couvrant { flex: 1 1 100%; }
    .hl-liste.liste-actions li a.couvrant + .hl-bouton { margin-left: auto; }
}

/* Tuiles sans sous-titre (catégories de dépense) : compactes, deux par ligne. */
.tuile:not(:has(small)) { min-height: 48px; padding: 10px 14px; align-content: center; }
@media (max-width: 639.98px) { .tuiles { grid-template-columns: 1fr 1fr; gap: 8px; } }
