/* ==========================================================================
   Trame · CRM de démonstration (Clair Ensemble)
   Trois volets : menu sombre, liste, fiche. Encre, papier, jaune.
   ========================================================================== */

@font-face { font-family: "Public Sans"; font-weight: 400; font-display: swap; src: url("../assets/fonts/public-sans-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 500; font-display: swap; src: url("../assets/fonts/public-sans-latin-500-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 600; font-display: swap; src: url("../assets/fonts/public-sans-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Public Sans"; font-weight: 700; font-display: swap; src: url("../assets/fonts/public-sans-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-weight: 600; font-display: swap; src: url("../assets/fonts/schibsted-grotesk-latin-600-normal.woff2") format("woff2"); }
@font-face { font-family: "Schibsted Grotesk"; font-weight: 700; font-display: swap; src: url("../assets/fonts/schibsted-grotesk-latin-700-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 400; font-display: swap; src: url("../assets/fonts/ibm-plex-mono-latin-400-normal.woff2") format("woff2"); }
@font-face { font-family: "IBM Plex Mono"; font-weight: 500; font-display: swap; src: url("../assets/fonts/ibm-plex-mono-latin-500-normal.woff2") format("woff2"); }

:root {
  --nuit: #121A19;
  --nuit-2: #1A2624;
  --sur-nuit: #E9ECE6;
  --sur-nuit-2: #A9B6B1;
  --trait-nuit: rgba(255, 255, 255, .1);

  --fond: #F4F5F0;          /* volet liste, fond général */
  --surface: #FFFFFF;       /* volet fiche, champs */
  --teinte: #ECEEE7;        /* survol, zones secondaires */
  --bord: #E1E4DA;
  --bord-fort: #C3C9BC;
  --texte: #1E2F2D;
  --texte-2: #4D5D5A;
  --texte-3: #66746F;

  --accent: #EDB82E;
  --sur-accent: #1E2F2D;
  --accent-doux: color-mix(in srgb, var(--accent) 20%, var(--surface));
  --accent-trait: color-mix(in srgb, var(--accent) 60%, var(--texte));

  --ok: #1B6E46;       --ok-fond: #E2F1E7;
  --alerte: #8A5A00;   --alerte-fond: #FAEED0;
  --danger: #A93226;   --danger-fond: #FAE5E0;
  --info: #235A73;     --info-fond: #E0EDF2;
  --serie: #2F6B62;    /* teinte unique des graphiques */
  --serie-2: #B9C9C3;

  --f-titre: "Schibsted Grotesk", "Public Sans", Arial, sans-serif;
  --f-texte: "Public Sans", Arial, Calibri, sans-serif;
  --f-mono: "IBM Plex Mono", Consolas, "Courier New", monospace;

  --r-s: 8px; --r-m: 10px; --r-l: 14px;
  --ombre: 0 1px 2px rgba(18, 26, 25, .06), 0 8px 24px rgba(18, 26, 25, .08);
  --ombre-forte: 0 2px 6px rgba(18, 26, 25, .1), 0 24px 60px rgba(18, 26, 25, .22);
  --ease: cubic-bezier(.16, 1, .3, 1);
  --rail-l: 232px;
  color-scheme: light;
}

:root[data-theme="sombre"] {
  --fond: #0F1615;
  --surface: #151F1D;
  --teinte: #1D2A28;
  --bord: #2A3936;
  --bord-fort: #3D4F4B;
  --texte: #E9ECE6;
  --texte-2: #A9B6B1;
  --texte-3: #8E9C97;
  --accent-doux: color-mix(in srgb, var(--accent) 16%, var(--surface));
  --accent-trait: color-mix(in srgb, var(--accent) 80%, var(--texte));
  --ok: #7BD0A2;       --ok-fond: #17332A;
  --alerte: #EBC46A;   --alerte-fond: #33290F;
  --danger: #F08A75;   --danger-fond: #3A1D18;
  --info: #8CC4DC;     --info-fond: #152F3A;
  --serie: #6FB3A6;
  --serie-2: #33443F;
  --ombre: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  --ombre-forte: 0 2px 6px rgba(0, 0, 0, .4), 0 24px 60px rgba(0, 0, 0, .55);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { font-size: 15px; -webkit-text-size-adjust: 100%; }
body { margin: 0; height: 100dvh; overflow: hidden; background: var(--fond); color: var(--texte); font: 400 1rem/1.5 var(--f-texte); -webkit-font-smoothing: antialiased; }
h1, h2, h3, h4, p, ul, ol, dl, dd, figure { margin: 0; }
ul, ol { padding: 0; list-style: none; }
a { color: inherit; text-decoration: none; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
svg { flex: none; }
::selection { background: color-mix(in srgb, var(--accent) 45%, transparent); color: var(--texte); }
:focus-visible { outline: 2px solid var(--accent-trait); outline-offset: 2px; }
.rail :focus-visible { outline-color: var(--accent); }
* { scrollbar-width: thin; scrollbar-color: var(--bord-fort) transparent; }
.rail * { scrollbar-color: rgba(255, 255, 255, .2) transparent; }
input, textarea { caret-color: var(--accent-trait); }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.mono { font-family: var(--f-mono); font-variant-numeric: tabular-nums; font-size: .93em; }
.muted { color: var(--texte-2); }
.droite { text-align: right; }
.nowrap { white-space: nowrap; }
[hidden] { display: none !important; }

/* ================= STRUCTURE ================= */
.app { display: grid; grid-template-columns: var(--rail-l) minmax(0, 1fr); height: 100dvh; }

.rail { background: var(--nuit); color: var(--sur-nuit); display: flex; flex-direction: column; min-height: 0; padding: 14px 10px 10px; }
.rail-marque { display: flex; align-items: center; gap: 10px; padding: 4px 8px 14px; }
.rail-marque img { width: 30px; height: 30px; border-radius: 8px; }
.rail-marque b { font: 700 1.2rem/1 var(--f-titre); letter-spacing: -.01em; }
.rail-marque span { font-size: .72rem; color: var(--sur-nuit-2); display: block; margin-top: 3px; }
.rail-chercher { display: flex; align-items: center; gap: 8px; width: 100%; padding: 8px 10px; margin-bottom: 10px; border: 1px solid var(--trait-nuit); border-radius: var(--r-s); background: rgba(255, 255, 255, .05); color: var(--sur-nuit-2); font-size: .9rem; text-align: left; transition: background-color .18s, color .18s; }
.rail-chercher:hover { background: rgba(255, 255, 255, .09); color: var(--sur-nuit); }
.rail-chercher span { white-space: nowrap; }
.rail-chercher kbd { white-space: nowrap; margin-left: auto; font: 500 .7rem var(--f-mono); padding: 1px 5px; border: 1px solid var(--trait-nuit); border-radius: 4px; }
.rail-nav { flex: 1; min-height: 0; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; }
.rail-groupe { display: flex; flex-direction: column; gap: 1px; }
.rail-groupe h2 { font: 600 .7rem/1 var(--f-texte); letter-spacing: .06em; text-transform: uppercase; color: #8E9C97; padding: 4px 10px 6px; }
.rail-lien { display: flex; align-items: center; gap: 10px; padding: 7px 10px; border-radius: var(--r-s); color: var(--sur-nuit); font-size: .95rem; font-weight: 500; transition: background-color .16s; }
.rail-lien svg { color: var(--sur-nuit-2); }
.rail-lien:hover { background: rgba(255, 255, 255, .06); }
.rail-lien.actif { background: rgba(255, 255, 255, .11); color: #fff; }
.rail-lien.actif svg { color: var(--accent); }
.rail-compte { margin-left: auto; min-width: 20px; padding: 0 6px; border-radius: 999px; background: rgba(255, 255, 255, .1); font: 600 .72rem/20px var(--f-texte); text-align: center; color: var(--sur-nuit); }
.rail-compte.auto { background: var(--accent); color: var(--sur-accent); }
.rail-bas { border-top: 1px solid var(--trait-nuit); padding-top: 8px; margin-top: 8px; display: flex; flex-direction: column; gap: 1px; }
.rail-moi { display: flex; align-items: center; gap: 10px; padding: 8px 10px; font-size: .88rem; color: var(--sur-nuit-2); }
.rail-moi b { display: block; color: var(--sur-nuit); font-weight: 600; }

.scene { display: grid; min-width: 0; min-height: 0; grid-template-columns: minmax(320px, 400px) minmax(0, 1fr); }
.scene[data-mode="large"] { grid-template-columns: minmax(0, 1fr); }
.scene[data-mode="large"] .volet-fiche { display: none; }
.scene[data-mode="large-fiche"] { grid-template-columns: minmax(0, 1fr) minmax(380px, 460px); }

.volet-liste { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--fond); border-right: 1px solid var(--bord); }
.vl-tete { padding: 16px 16px 10px; display: flex; flex-direction: column; gap: 10px; }
.vl-ligne { display: flex; align-items: center; gap: 8px; min-width: 0; }
.vl-titre { font: 700 1.35rem/1.15 var(--f-titre); letter-spacing: -.01em; flex: 1; min-width: 0; }
.vl-titre small { font: 500 .85rem var(--f-texte); color: var(--texte-2); letter-spacing: 0; margin-left: 6px; }
.vl-corps { flex: 1; min-height: 0; overflow-y: auto; padding: 0 8px 16px; }
.scene[data-mode^="large"] .volet-liste { background: var(--fond); }
.scene[data-mode^="large"] .vl-tete { padding: 18px 24px 12px; }
.scene[data-mode^="large"] .vl-corps { padding: 0 24px 24px; }

.volet-fiche { min-width: 0; min-height: 0; background: var(--surface); display: flex; flex-direction: column; }
.scene[data-mode="large-fiche"] .volet-fiche { border-left: 1px solid var(--bord); box-shadow: -12px 0 30px rgba(18, 26, 25, .06); }
.vf-defile { flex: 1; min-height: 0; overflow-y: auto; padding: 22px 28px 40px; }
.vf-contenu { max-width: 860px; }
.barre-mobile { display: none; }

/* ================= LIGNES DE LISTE ================= */
.groupe-titre { font: 600 .74rem/1 var(--f-texte); letter-spacing: .05em; text-transform: uppercase; color: var(--texte-2); padding: 16px 8px 6px; display: flex; gap: 8px; align-items: center; }
.groupe-titre:first-child { padding-top: 6px; }
.groupe-titre span { font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--texte-3); }
.ligne { position: relative; display: flex; align-items: center; gap: 10px; padding: 9px 8px; border-radius: var(--r-s); min-width: 0; transition: background-color .14s; }
.ligne:hover { background: var(--teinte); }
.ligne.actif { background: var(--surface); box-shadow: 0 0 0 1px var(--bord), 0 2px 8px rgba(18, 26, 25, .06); }
.ligne.actif::before { content: ""; position: absolute; left: -4px; top: 50%; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); transform: translateY(-50%); box-shadow: 0 0 0 2px var(--fond); }
.ligne-corps { flex: 1; min-width: 0; }
.ligne-titre { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; display: flex; align-items: center; gap: 6px; }
.ligne-titre > span:first-child { overflow: hidden; text-overflow: ellipsis; }
.ligne-sous { font-size: .87rem; color: var(--texte-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.ligne-fin { display: flex; flex-direction: column; align-items: flex-end; gap: 3px; flex: none; font-size: .87rem; color: var(--texte-2); }
.ligne-fin b { color: var(--texte); font-weight: 600; }
.ligne.fait .ligne-titre { text-decoration: line-through; color: var(--texte-2); font-weight: 500; }

.avatar { flex: none; width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--teinte); color: var(--texte); font: 600 .8rem var(--f-texte); border: 1px solid var(--bord); }
.avatar.carre { border-radius: var(--r-s); }
.avatar.grand { width: 52px; height: 52px; font-size: 1.1rem; }
.avatar.nuit { background: rgba(255, 255, 255, .1); border-color: transparent; color: var(--sur-nuit); width: 30px; height: 30px; }

/* Marque « fait automatiquement » : reste allumée tant que l'élément n'a pas été vu */
.auto-marque { display: inline-flex; align-items: center; gap: 4px; flex: none; padding: 1px 7px 1px 5px; border-radius: 999px; background: var(--accent); color: var(--sur-accent); font: 600 .7rem/1.5 var(--f-texte); }
.auto-marque svg { width: 11px; height: 11px; }
.auto-marque.vu { background: transparent; color: var(--texte-2); box-shadow: inset 0 0 0 1px var(--bord-fort); }
.auto-pastille { flex: none; width: 8px; height: 8px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 30%, transparent); }

/* ================= CONTRÔLES ================= */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 7px; padding: 7px 13px; min-height: 36px; border-radius: var(--r-s); border: 1px solid var(--bord-fort); background: var(--surface); color: var(--texte); font-weight: 600; font-size: .93rem; white-space: nowrap; transition: background-color .16s, border-color .16s, transform .1s; }
.btn:hover { background: var(--teinte); }
.btn:active { transform: translateY(1px); }
.btn.principal { background: var(--accent); border-color: transparent; color: var(--sur-accent); }
.btn.principal:hover { background: color-mix(in srgb, var(--accent) 88%, var(--texte)); }
.btn.discret { border-color: transparent; background: transparent; }
.btn.discret:hover { background: var(--teinte); }
.btn.danger { color: var(--danger); }
.btn.danger.plein { background: var(--danger); color: #fff; border-color: transparent; }
:root[data-theme="sombre"] .btn.danger.plein { color: #1E0F0C; }
.btn.petit { min-height: 30px; padding: 4px 10px; font-size: .87rem; }
.btn.icone { padding: 0; width: 36px; }
.btn.icone.petit { width: 30px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }

.recherche { position: relative; flex: 1; min-width: 0; }
.recherche svg { position: absolute; left: 10px; top: 50%; transform: translateY(-50%); color: var(--texte-3); pointer-events: none; }
.recherche input { width: 100%; padding: 7px 10px 7px 34px; min-height: 36px; border: 1px solid var(--bord-fort); border-radius: var(--r-s); background: var(--surface); }
.recherche input::placeholder, .f-champ input::placeholder, .f-champ textarea::placeholder { color: var(--texte-3); }

.segments { display: inline-flex; flex-wrap: wrap; padding: 3px; gap: 2px; border-radius: var(--r-m); background: var(--teinte); max-width: 100%; }
.segments button { border: 0; background: transparent; padding: 4px 11px; border-radius: 7px; font-size: .87rem; font-weight: 600; color: var(--texte-2); white-space: nowrap; transition: background-color .16s, color .16s; }
.segments button:hover { color: var(--texte); }
.segments button[aria-pressed="true"] { background: var(--surface); color: var(--texte); box-shadow: 0 1px 2px rgba(18, 26, 25, .12); }

select.filtre { min-height: 32px; padding: 3px 28px 3px 10px; border: 1px solid var(--bord-fort); border-radius: var(--r-s); background: var(--surface); font-size: .87rem; font-weight: 500; max-width: 100%; }

.badge { display: inline-flex; align-items: center; gap: 5px; padding: 1px 8px; border-radius: 999px; font: 600 .76rem/1.6 var(--f-texte); white-space: nowrap; background: var(--teinte); color: var(--texte-2); }
.badge::before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: currentColor; }
.badge[data-ton="ok"] { background: var(--ok-fond); color: var(--ok); }
.badge[data-ton="alerte"] { background: var(--alerte-fond); color: var(--alerte); }
.badge[data-ton="danger"] { background: var(--danger-fond); color: var(--danger); }
.badge[data-ton="info"] { background: var(--info-fond); color: var(--info); }
.etiquette { display: inline-flex; padding: 1px 9px; border-radius: 6px; border: 1px solid var(--bord-fort); font-size: .8rem; font-weight: 500; color: var(--texte-2); }

.interrupteur { position: relative; flex: none; width: 38px; height: 22px; border: 0; padding: 0; border-radius: 999px; background: var(--bord-fort); transition: background-color .18s; }
.interrupteur::after { content: ""; position: absolute; top: 3px; left: 3px; width: 16px; height: 16px; border-radius: 50%; background: #fff; box-shadow: 0 1px 2px rgba(0, 0, 0, .25); transition: transform .2s var(--ease); }
.interrupteur[aria-checked="true"] { background: var(--ok); }
.interrupteur[aria-checked="true"]::after { transform: translateX(16px); }

.coche { flex: none; width: 20px; height: 20px; border-radius: 6px; border: 1.5px solid var(--bord-fort); background: var(--surface); display: grid; place-items: center; padding: 0; color: transparent; transition: background-color .16s, border-color .16s; }
.coche:hover { border-color: var(--texte-2); }
.coche[aria-checked="true"] { background: var(--ok); border-color: var(--ok); color: #fff; }
:root[data-theme="sombre"] .coche[aria-checked="true"] { color: #0F1615; }

/* ================= FICHE ================= */
.fiche-tete { display: flex; align-items: flex-start; gap: 14px; margin-bottom: 18px; }
.fiche-tete > div:nth-child(2), .fiche-tete > .ft-corps { flex: 1; min-width: 0; }
.fiche-titre { font: 700 1.6rem/1.15 var(--f-titre); letter-spacing: -.015em; overflow-wrap: anywhere; }
.fiche-sous { color: var(--texte-2); margin-top: 3px; display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: center; }
.fiche-sous a { text-decoration: underline; text-decoration-color: var(--bord-fort); text-underline-offset: 3px; }
.fiche-sous a:hover { text-decoration-color: currentColor; }
.fiche-actions { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 22px; }
.fiche-retour { display: none; }

.section { margin-top: 28px; }
.section-tete { display: flex; align-items: center; gap: 10px; margin-bottom: 10px; }
.section-titre { font: 700 1.02rem/1.2 var(--f-titre); flex: 1; }
.section-titre small { font: 500 .85rem var(--f-texte); color: var(--texte-2); margin-left: 6px; }
.dl { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 12px 24px; }
.dl dt { font-size: .8rem; color: var(--texte-2); margin-bottom: 1px; }
.dl dd { font-weight: 500; overflow-wrap: anywhere; }
.dl dd a { text-decoration: underline; text-decoration-color: var(--bord-fort); text-underline-offset: 3px; }
.etiquettes { display: flex; flex-wrap: wrap; gap: 6px; }
.note-libre { white-space: pre-wrap; color: var(--texte-2); max-width: 70ch; }

.mini-liste { border: 1px solid var(--bord); border-radius: var(--r-m); overflow: hidden; }
.mini-liste > * + * { border-top: 1px solid var(--bord); }
.mini { display: flex; align-items: center; gap: 10px; padding: 9px 12px; min-width: 0; transition: background-color .14s; }
a.mini:hover { background: var(--teinte); }
.mini-corps { flex: 1; min-width: 0; }
.mini-corps b { font-weight: 600; display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-corps span { font-size: .87rem; color: var(--texte-2); }
.mini.fait b { text-decoration: line-through; color: var(--texte-2); font-weight: 500; }
.rien { color: var(--texte-2); font-size: .93rem; padding: 2px 0; }

/* Le fil : parcours d'une affaire, une ligne et ses stations */
.fil { display: flex; align-items: flex-start; margin: 4px 0 6px; overflow-x: auto; padding: 6px 2px 4px; }
.fil-station { position: relative; flex: 1 1 0; min-width: 84px; border: 0; background: transparent; padding: 22px 4px 0; text-align: center; font-size: .82rem; font-weight: 500; color: var(--texte-2); line-height: 1.25; }
.fil-station::before { content: ""; position: absolute; top: 7px; left: -50%; right: 50%; height: 3px; background: var(--bord-fort); border-radius: 2px; }
.fil-station:first-child::before { display: none; }
.fil-station::after { content: ""; position: absolute; top: 2px; left: 50%; width: 13px; height: 13px; margin-left: -6.5px; border-radius: 50%; background: var(--surface); border: 3px solid var(--bord-fort); transition: transform .2s var(--ease), background-color .2s; }
.fil-station.fait::before, .fil-station.courant::before { background: var(--texte); }
.fil-station.fait::after { background: var(--texte); border-color: var(--texte); }
.fil-station.courant { color: var(--texte); font-weight: 700; }
.fil-station.courant::after { background: var(--accent); border-color: var(--texte); transform: scale(1.35); }
.fil-station.perdu.courant::after { background: var(--danger); border-color: var(--danger); }
button.fil-station:hover::after { transform: scale(1.35); }
.fil-mini { display: flex; gap: 3px; align-items: center; }
.fil-mini i { width: 14px; height: 4px; border-radius: 2px; background: var(--bord-fort); }
.fil-mini i.fait { background: var(--texte); }
.fil-mini i.courant { background: var(--accent); box-shadow: 0 0 0 1px var(--texte); }

/* Historique */
.composer { border: 1px solid var(--bord-fort); border-radius: var(--r-m); padding: 10px; display: flex; flex-direction: column; gap: 8px; margin-bottom: 14px; background: var(--surface); }
.composer textarea { border: 0; outline: 0; resize: vertical; min-height: 44px; width: 100%; background: transparent; padding: 2px 4px; }
.composer:focus-within { border-color: var(--accent-trait); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.composer-bas { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.composer-bas .btn { margin-left: auto; }
.histo { position: relative; }
.histo-item { position: relative; display: grid; grid-template-columns: 30px 1fr; gap: 10px; padding-bottom: 16px; }
.histo-item::before { content: ""; position: absolute; left: 14px; top: 30px; bottom: 0; width: 2px; background: var(--bord); }
.histo-item:last-child::before { display: none; }
.histo-puce { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; background: var(--teinte); color: var(--texte-2); }
.histo-item.auto .histo-puce { background: var(--accent); color: var(--sur-accent); }
.histo-item.auto.vu .histo-puce { background: var(--accent-doux); color: var(--texte); }
.histo-meta { font-size: .82rem; color: var(--texte-2); display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.histo-meta b { color: var(--texte); font-weight: 600; }
.histo-texte { white-space: pre-wrap; overflow-wrap: anywhere; max-width: 70ch; }
.histo-item .btn { margin-top: 6px; }

/* ================= FORMULAIRES ================= */
.form { max-width: 720px; }
.form-titre { font: 700 1.45rem/1.2 var(--f-titre); margin-bottom: 4px; }
.form-aide { color: var(--texte-2); margin-bottom: 18px; max-width: 65ch; }
.form-grille { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 16px; margin-top: 18px; }
.f-champ { display: flex; flex-direction: column; gap: 4px; min-width: 0; }
.f-champ.large { grid-column: 1 / -1; }
.f-champ > label, .f-champ > .f-label { font-size: .87rem; font-weight: 600; }
.f-champ .requis { color: var(--danger); }
.f-champ input:not([type="checkbox"]):not([type="radio"]):not([type="color"]), .f-champ select, .f-champ textarea { width: 100%; min-height: 38px; padding: 7px 10px; border: 1px solid var(--bord-fort); border-radius: var(--r-s); background: var(--surface); transition: border-color .16s, box-shadow .16s; }
.f-champ textarea { min-height: 84px; resize: vertical; }
.f-champ input:focus, .f-champ select:focus, .f-champ textarea:focus, .recherche input:focus { outline: 0; border-color: var(--accent-trait); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 25%, transparent); }
.f-champ input:user-invalid { border-color: var(--danger); }
.f-aide { font-size: .82rem; color: var(--texte-2); }
.f-cases { display: flex; flex-wrap: wrap; gap: 6px 14px; padding: 4px 0; }
.f-cases label { display: inline-flex; align-items: center; gap: 6px; font-weight: 500; font-size: .93rem; }
input[type="checkbox"], input[type="radio"] { accent-color: var(--texte); width: 16px; height: 16px; }
.form-actions { display: flex; gap: 8px; margin-top: 22px; align-items: center; }
.form-actions .pousse { margin-left: auto; }
.sous-titre { grid-column: 1 / -1; font: 700 1rem var(--f-titre); margin-top: 8px; padding-top: 14px; border-top: 1px solid var(--bord); }

/* Lignes de devis / facture en édition */
.lignes-edit { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 8px; }
.ligne-edit { display: grid; grid-template-columns: minmax(0, 1fr) 70px 104px 76px 34px; gap: 6px; align-items: start; }
.ligne-edit.entete { font-size: .8rem; font-weight: 600; color: var(--texte-2); }
.ligne-edit input, .ligne-edit select { width: 100%; min-height: 36px; padding: 6px 8px; border: 1px solid var(--bord-fort); border-radius: var(--r-s); background: var(--surface); min-width: 0; }
.ligne-edit input.num { text-align: right; font-family: var(--f-mono); font-size: .9rem; }
.totaux-edit { grid-column: 1 / -1; display: flex; justify-content: flex-end; }
.totaux { min-width: 260px; display: grid; grid-template-columns: 1fr auto; gap: 4px 24px; }
.totaux dt { color: var(--texte-2); }
.totaux dd { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; }
.totaux .total { font-weight: 700; font-size: 1.1rem; padding-top: 6px; border-top: 2px solid var(--texte); margin-top: 4px; color: var(--texte); font-family: var(--f-texte); }
.totaux dd.total { font-family: var(--f-mono); }

/* ================= DOCUMENT (devis, facture) ================= */
.feuille { background: #fff; color: #1E2F2D; border: 1px solid var(--bord); border-radius: 4px; box-shadow: var(--ombre); padding: 44px 48px; max-width: 800px; font-size: .93rem; }
.feuille-tete { display: flex; justify-content: space-between; gap: 24px; margin-bottom: 34px; }
.feuille-tete h2 { font: 700 1.7rem/1 var(--f-titre); letter-spacing: -.01em; }
.feuille-tete .num { font-family: var(--f-mono); margin-top: 6px; color: #4D5D5A; }
.feuille-emetteur { text-align: right; line-height: 1.45; }
.feuille-emetteur b { font: 700 1.05rem var(--f-titre); }
.feuille-parties { display: grid; grid-template-columns: 1fr 1fr; gap: 24px; margin-bottom: 28px; }
.feuille h3 { font: 600 .72rem var(--f-texte); letter-spacing: .06em; text-transform: uppercase; color: #4D5D5A; margin-bottom: 4px; }
.feuille table { width: 100%; border-collapse: collapse; margin-bottom: 20px; }
.feuille th { text-align: left; font: 600 .74rem var(--f-texte); letter-spacing: .04em; text-transform: uppercase; color: #4D5D5A; padding: 8px 8px; border-bottom: 2px solid #1E2F2D; }
.feuille td { padding: 10px 8px; border-bottom: 1px solid #E1E4DA; vertical-align: top; }
.feuille td small { display: block; color: #4D5D5A; }
.feuille .n { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }
.feuille .totaux { margin-left: auto; width: 280px; }
.feuille .totaux dt { color: #4D5D5A; }
.feuille .totaux .total { border-color: #1E2F2D; color: #1E2F2D; }
.feuille-pied { margin-top: 30px; padding-top: 16px; border-top: 1px solid #E1E4DA; color: #4D5D5A; font-size: .84rem; line-height: 1.5; white-space: pre-wrap; }

/* ================= TABLEAU (KANBAN) ================= */
.tableau { display: flex; gap: 12px; height: 100%; overflow-x: auto; padding-bottom: 8px; align-items: stretch; }
.colonne { flex: 1 0 196px; max-width: 320px; display: flex; flex-direction: column; min-height: 0; background: var(--teinte); border-radius: var(--r-l); padding: 8px; transition: box-shadow .16s, background-color .16s; }
.colonne.survol { box-shadow: inset 0 0 0 2px var(--accent-trait); background: var(--accent-doux); }
.colonne-tete { padding: 6px 8px 10px; }
.colonne-tete h3 { font: 700 .95rem var(--f-titre); display: flex; align-items: center; gap: 8px; }
.colonne-tete h3 span { font: 600 .76rem var(--f-texte); color: var(--texte-2); background: var(--surface); border-radius: 999px; padding: 0 7px; line-height: 1.6; }
.colonne-tete p { font-size: .84rem; color: var(--texte-2); margin-top: 2px; }
.colonne-cartes { flex: 1; min-height: 60px; overflow-y: auto; display: flex; flex-direction: column; gap: 8px; }
.carte { position: relative; display: block; background: var(--surface); border-radius: var(--r-m); padding: 10px 12px; border: 1px solid var(--bord); cursor: grab; transition: box-shadow .16s, transform .16s var(--ease), border-color .16s; }
.carte:hover { box-shadow: var(--ombre); border-color: var(--bord-fort); }
.carte.actif { border-color: var(--texte); box-shadow: 0 0 0 1px var(--texte); }
.carte.glisse { opacity: .45; }
.carte b { display: block; font-weight: 600; line-height: 1.3; margin-bottom: 2px; }
.carte > span:not(.auto-pastille) { font-size: .86rem; color: var(--texte-2); display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.carte .avatar { width: 26px; height: 26px; font-size: .66rem; }
.carte-bas { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-top: 8px; }
.carte-bas .mono { font-weight: 500; color: var(--texte); }
.carte .auto-pastille { position: absolute; top: 10px; right: 10px; }
.colonne.gagne .colonne-tete h3 { color: var(--ok); }
.colonne.perdu .colonne-tete h3 { color: var(--danger); }
.page-pleine { height: 100%; }

/* ================= AGENDA ================= */
.cal { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); border: 1px solid var(--bord); border-radius: var(--r-l); overflow: hidden; background: var(--surface); }
.cal-nom { padding: 8px 10px; font: 600 .76rem var(--f-texte); letter-spacing: .05em; text-transform: uppercase; color: var(--texte-2); background: var(--teinte); border-bottom: 1px solid var(--bord); }
.cal-jour { min-height: 108px; padding: 6px; border-right: 1px solid var(--bord); border-bottom: 1px solid var(--bord); display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.cal-jour:nth-child(7n) { border-right: 0; }
.cal-jour.hors { background: color-mix(in srgb, var(--teinte) 55%, var(--surface)); }
.cal-jour.hors .cal-num { color: var(--texte-3); }
.cal-num { align-self: flex-start; border: 0; background: transparent; font: 600 .85rem var(--f-mono); padding: 1px 6px; border-radius: 999px; color: var(--texte-2); }
.cal-num:hover { background: var(--teinte); color: var(--texte); }
.cal-jour.auj .cal-num { background: var(--accent); color: var(--sur-accent); }
.cal-evt { display: block; padding: 2px 7px; border-radius: 6px; font-size: .8rem; font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; background: var(--info-fond); color: var(--info); }
.cal-evt.tache { background: var(--teinte); color: var(--texte); }
.cal-evt.tache.fait { text-decoration: line-through; color: var(--texte-3); }
.cal-evt.retard { background: var(--danger-fond); color: var(--danger); }
.cal-evt.actif, .cal-evt:hover { box-shadow: inset 0 0 0 1.5px currentColor; }
.cal-plus { font-size: .76rem; color: var(--texte-2); padding: 0 7px; }

/* ================= ACCUEIL & RAPPORTS ================= */
.accueil { display: grid; grid-template-columns: minmax(0, 1.25fr) minmax(0, 1fr); gap: 28px 36px; align-items: start; max-width: 1380px; }
.bloc { min-width: 0; }
.bloc + .bloc { margin-top: 28px; }
.bloc-tete { display: flex; align-items: baseline; gap: 10px; margin-bottom: 10px; }
.bloc-titre { font: 700 1.08rem var(--f-titre); flex: 1; }
.bloc-titre small { font: 500 .85rem var(--f-texte); color: var(--texte-2); margin-left: 6px; }
.bloc-lien { font-size: .87rem; font-weight: 600; text-decoration: underline; text-decoration-color: var(--bord-fort); text-underline-offset: 3px; }
.bloc-lien:hover { text-decoration-color: currentColor; }
.panneau { background: var(--surface); border: 1px solid var(--bord); border-radius: var(--r-l); }
.panneau.pad { padding: 16px 18px; }
.panneau .mini-liste { border: 0; border-radius: 0; }
.chiffres { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.chiffre { padding: 14px 18px; border-right: 1px solid var(--bord); min-width: 0; }
.chiffre:last-child { border-right: 0; }
.chiffre dt { font-size: .84rem; color: var(--texte-2); }
.chiffre dd { font: 700 1.5rem/1.25 var(--f-titre); letter-spacing: -.01em; white-space: nowrap; }
.chiffre small { display: block; font-size: .82rem; color: var(--texte-2); }
.jauge { height: 6px; border-radius: 3px; background: var(--serie-2); overflow: hidden; margin-top: 6px; }
.jauge i { display: block; height: 100%; border-radius: 3px; background: var(--serie); }

.graph { position: relative; }
.graph-barres { display: flex; align-items: flex-end; gap: 2%; height: 180px; padding-top: 18px; border-bottom: 1px solid var(--bord-fort); }
.graph-barres .barre { flex: 1; min-width: 0; height: 100%; display: flex; flex-direction: column; justify-content: flex-end; align-items: center; position: relative; }
.graph-barres .barre i { display: block; width: min(100%, 44px); border-radius: 4px 4px 0 0; background: var(--serie); min-height: 2px; transition: opacity .15s; }
.graph-barres .barre.zero i { background: var(--serie-2); }
.graph-barres .barre .val { font: 500 .72rem var(--f-mono); color: var(--texte-2); margin-bottom: 3px; white-space: nowrap; }
.graph-barres:hover .barre:not(:hover) i { opacity: .45; }
.graph-axe { display: flex; gap: 2%; margin-top: 5px; }
.graph-axe span { flex: 1; min-width: 0; text-align: center; font-size: .76rem; color: var(--texte-2); white-space: nowrap; overflow: hidden; }
.hbars { display: grid; grid-template-columns: minmax(90px, max-content) minmax(0, 1fr) max-content; gap: 9px 12px; align-items: center; }
.hbars .nom { font-size: .9rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 190px; }
.hbars .piste { height: 14px; border-radius: 0 4px 4px 0; background: transparent; }
.hbars .piste i { display: block; height: 100%; min-width: 2px; border-radius: 0 4px 4px 0; background: var(--serie); }
.hbars .v { font: 500 .84rem var(--f-mono); color: var(--texte-2); text-align: right; white-space: nowrap; }
.infobulle { position: fixed; z-index: 90; pointer-events: none; background: var(--nuit); color: var(--sur-nuit); padding: 6px 10px; border-radius: var(--r-s); font-size: .84rem; box-shadow: var(--ombre); max-width: 260px; }
.infobulle b { display: block; font-family: var(--f-mono); font-weight: 500; }
.rapports { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 20px; max-width: 1380px; }
.rapports .entier { grid-column: 1 / -1; }
.rapport h3 { font: 700 1.02rem var(--f-titre); }
.rapport > p { font-size: .87rem; color: var(--texte-2); margin: 2px 0 14px; }

table.donnees { width: 100%; border-collapse: collapse; font-size: .93rem; }
table.donnees th { text-align: left; font: 600 .76rem var(--f-texte); letter-spacing: .04em; text-transform: uppercase; color: var(--texte-2); padding: 6px 10px; border-bottom: 1px solid var(--bord-fort); }
table.donnees td { padding: 8px 10px; border-bottom: 1px solid var(--bord); }
table.donnees tr:last-child td { border-bottom: 0; }
table.donnees .n { text-align: right; font-family: var(--f-mono); font-variant-numeric: tabular-nums; white-space: nowrap; }

/* ================= AUTOMATISATIONS ================= */
.recette { display: flex; flex-direction: column; }
.recette-pas { position: relative; display: grid; grid-template-columns: 34px 1fr; gap: 12px; padding-bottom: 18px; }
.recette-pas::before { content: ""; position: absolute; left: 16px; top: 34px; bottom: 0; width: 3px; border-radius: 2px; background: var(--texte); }
.recette-pas:last-child::before { display: none; }
.recette-puce { width: 34px; height: 34px; border-radius: 50%; display: grid; place-items: center; background: var(--surface); border: 3px solid var(--texte); color: var(--texte); }
.recette-pas.quand .recette-puce { background: var(--accent); color: var(--sur-accent); }
.recette-pas small { font: 600 .74rem var(--f-texte); letter-spacing: .05em; text-transform: uppercase; color: var(--texte-2); }
.recette-pas p { font-weight: 600; font-size: 1.02rem; }
.recette-pas p + span { color: var(--texte-2); font-size: .9rem; }
.actions-edit { grid-column: 1 / -1; display: flex; flex-direction: column; gap: 10px; }
.action-edit { border: 1px solid var(--bord); border-radius: var(--r-m); padding: 12px; display: grid; grid-template-columns: 1fr 1fr; gap: 10px 12px; background: var(--fond); }
.action-edit .f-champ.large { grid-column: 1 / -1; }
.action-edit-tete { grid-column: 1 / -1; display: flex; align-items: center; gap: 8px; font-weight: 600; font-size: .9rem; }
.action-edit-tete .btn { margin-left: auto; }

/* ================= ÉTATS VIDES, TOASTS, DIALOGUES ================= */
.vide { display: flex; flex-direction: column; align-items: flex-start; gap: 8px; padding: 36px 8px; max-width: 46ch; color: var(--texte-2); }
.vide svg { color: var(--texte-3); }
.vide h3 { font: 700 1.1rem var(--f-titre); color: var(--texte); }
.vide .btn { margin-top: 6px; }
.vf-defile > .vide { margin: 8vh auto 0; }

.toasts { position: fixed; z-index: 80; right: 20px; bottom: 20px; display: flex; flex-direction: column; gap: 8px; align-items: flex-end; pointer-events: none; }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 420px; padding: 10px 14px; border-radius: var(--r-m); background: var(--nuit); color: var(--sur-nuit); box-shadow: var(--ombre-forte); font-size: .93rem; animation: toast-in .28s var(--ease); }
.toast.auto svg { color: var(--accent); }
.toast a, .toast button { color: var(--accent); font-weight: 600; background: none; border: 0; padding: 0; white-space: nowrap; }
.toast.sort { opacity: 0; transform: translateY(6px); transition: opacity .2s, transform .2s; }
@keyframes toast-in { from { opacity: 0; transform: translateY(10px); } }

dialog { border: 0; padding: 0; border-radius: var(--r-l); background: var(--surface); color: var(--texte); box-shadow: var(--ombre-forte); max-width: calc(100vw - 32px); }
dialog::backdrop { background: rgba(12, 18, 17, .5); }
dialog.confirm { width: 440px; padding: 22px; }
dialog.confirm h2 { font: 700 1.2rem var(--f-titre); margin-bottom: 6px; }
dialog.confirm p { color: var(--texte-2); }
dialog.confirm .form-actions { justify-content: flex-end; }
dialog.palette { width: 620px; margin-top: 12vh; overflow: hidden; }
.palette-champ { display: flex; align-items: center; gap: 10px; padding: 14px 16px; border-bottom: 1px solid var(--bord); }
.palette-champ input { flex: 1; border: 0; outline: 0; background: transparent; font-size: 1.1rem; }
.palette-liste { max-height: 52vh; overflow-y: auto; padding: 6px; }
.palette-liste h3 { font: 600 .72rem var(--f-texte); letter-spacing: .05em; text-transform: uppercase; color: var(--texte-2); padding: 10px 10px 4px; }
.palette-item { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--r-s); width: 100%; border: 0; background: transparent; text-align: left; }
.palette-item span { color: var(--texte-2); font-size: .87rem; margin-left: auto; white-space: nowrap; }
.palette-item svg { color: var(--texte-2); }
.palette-item.choisi { background: var(--accent-doux); }
.palette-pied { padding: 8px 16px; border-top: 1px solid var(--bord); font-size: .8rem; color: var(--texte-2); display: flex; gap: 16px; }
kbd { font: 500 .76rem var(--f-mono); padding: 1px 5px; border: 1px solid var(--bord-fort); border-radius: 4px; }

.bandeau { display: flex; gap: 10px; align-items: flex-start; padding: 10px 14px; border-radius: var(--r-m); background: var(--info-fond); color: var(--info); font-size: .9rem; margin-bottom: 16px; }
.bandeau.alerte { background: var(--alerte-fond); color: var(--alerte); }
.bandeau.ok { background: var(--ok-fond); color: var(--ok); }
.bandeau.danger { background: var(--danger-fond); color: var(--danger); }
.bandeau p { color: inherit; }

.couleurs { display: flex; gap: 10px; flex-wrap: wrap; }
.couleur { width: 40px; height: 40px; border-radius: 50%; border: 3px solid var(--surface); box-shadow: 0 0 0 1px var(--bord-fort); padding: 0; }
.couleur[aria-pressed="true"] { box-shadow: 0 0 0 2px var(--texte); }
.reglage-ligne { display: flex; align-items: center; gap: 10px; padding: 9px 12px; }
.reglage-ligne input[type="text"], .reglage-ligne input[type="number"] { min-height: 34px; padding: 5px 9px; border: 1px solid var(--bord-fort); border-radius: var(--r-s); background: var(--surface); min-width: 0; }
.reglage-ligne input[type="text"] { flex: 1; }
.reglage-ligne input[type="number"] { width: 76px; text-align: right; }
.reglage-ligne .muted { font-size: .84rem; }

/* ================= RECHERCHE PAR MOTS, GROS VOLUMES ================= */
mark { background: color-mix(in srgb, var(--accent) 45%, transparent); color: inherit; border-radius: 3px; padding: 0 1px; }
.extrait { display: block; margin-top: 1px; font-size: .8rem; font-weight: 400; color: var(--texte-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.extrait span { font: 600 .66rem var(--f-texte); letter-spacing: .05em; text-transform: uppercase; color: var(--texte-3); margin-right: 6px; }
.extrait span:empty { display: none; }
.liste-info { font-size: .84rem; color: var(--texte-2); padding: 0 8px 8px; }
.liste-suite { display: flex; align-items: center; flex-wrap: wrap; gap: 10px; padding: 14px 8px 4px; font-size: .84rem; color: var(--texte-2); }
.vl-ligne.filtres { flex-wrap: wrap; gap: 8px; }
select.filtre.actif { border-color: var(--texte); font-weight: 600; }
.puce { display: inline-flex; align-items: center; gap: 6px; min-height: 32px; padding: 3px 8px 3px 11px; border-radius: 999px; border: 1px solid var(--texte); background: var(--accent-doux); font-size: .87rem; font-weight: 600; }
.puce:hover { background: var(--teinte); }
.recherche-fiche { margin-top: 26px; }
.recherche-fiche + #zone-fiche > .section:first-child { margin-top: 18px; }
.voir-tout { margin-top: 8px; }
.colonne-reste { font-size: .82rem; color: var(--texte-2); padding: 4px 6px; }
.avec-icone { display: inline-flex; align-items: center; gap: 7px; }
.avec-icone svg { color: var(--texte-2); }
.apercu { max-width: 100%; max-height: 440px; border-radius: var(--r-m); border: 1px solid var(--bord); }
.champ-perso select { flex: none; }

.vl-corps.page-pleine { display: flex; flex-direction: column; overflow: hidden; height: auto; }
.page-pleine > .tableau { flex: 1; min-height: 0; height: auto; }
.grille { flex: 1; min-height: 0; display: flex; flex-direction: column; border: 1px solid var(--bord); border-radius: var(--r-l); background: var(--surface); overflow: hidden; }
.grille-defile { flex: 1; min-height: 0; overflow: auto; }
.grille-defile:focus-visible { outline-offset: -2px; }
.grille-tete, .grille-ligne { display: grid; grid-template-columns: var(--cols); width: 100%; min-width: var(--minl); align-items: center; }
.grille-tete { position: sticky; top: 0; z-index: 2; background: var(--teinte); border-bottom: 1px solid var(--bord-fort); }
.grille-col { display: flex; align-items: center; gap: 4px; min-width: 0; border: 0; background: transparent; padding: 10px 12px; font: 600 .74rem var(--f-texte); letter-spacing: .04em; text-transform: uppercase; color: var(--texte-2); text-align: left; white-space: nowrap; }
.grille-col:hover, .grille-col.actif { color: var(--texte); }
.grille-col.n { justify-content: flex-end; }
.grille-espace { position: relative; width: 100%; min-width: var(--minl); }
.grille-fenetre { position: absolute; top: 0; left: 0; right: 0; will-change: transform; }
.grille-ligne { height: 48px; border-bottom: 1px solid var(--bord); font-size: .93rem; }
.grille-ligne:hover { background: var(--teinte); }
.grille-ligne.actif { background: var(--accent-doux); }
.grille-ligne > span { padding: 0 12px; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; line-height: 1.3; }
.grille-ligne > span.n { text-align: right; }
.grille-ligne b { display: block; font-weight: 600; overflow: hidden; text-overflow: ellipsis; }
.grille-rien { padding: 8px 20px; }
.grille-pied { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; padding: 6px 8px 6px 14px; border-top: 1px solid var(--bord); font-size: .87rem; color: var(--texte-2); }
.grille-pied b { color: var(--texte); font-family: var(--f-mono); font-weight: 500; }

.relation { position: relative; }
.relation-liste { position: absolute; z-index: 30; top: calc(100% + 4px); left: 0; right: 0; max-height: 310px; overflow-y: auto; padding: 4px; background: var(--surface); border: 1px solid var(--bord-fort); border-radius: var(--r-m); box-shadow: var(--ombre-forte); }
.relation-liste button { display: block; width: 100%; padding: 8px 10px; border: 0; border-radius: 7px; background: transparent; text-align: left; font-size: .93rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.relation-liste button:hover, .relation-liste button.choisi { background: var(--accent-doux); }
.relation-liste p { padding: 8px 10px; font-size: .84rem; color: var(--texte-2); }

.palette-item .pi-corps { flex: 1; min-width: 0; }
.palette-item .pi-corps b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.palette-item > span { flex: none; max-width: 42%; overflow: hidden; text-overflow: ellipsis; }

@media (max-width: 860px) {
  .grille-ligne { font-size: .9rem; }
  .vl-ligne > .recherche { flex-basis: 100%; }
  .vl-corps.page-pleine { min-height: 70vh; }
}
@media print { .grille, .relation-liste { display: none !important; } }

/* ================= DIRECTION : rôles, délais, validation, actions en masse ================= */
button.rail-moi { width: 100%; border: 0; background: transparent; border-radius: var(--r-s); text-align: left; cursor: pointer; transition: background-color .16s; }
button.rail-moi:hover { background: rgba(255, 255, 255, .06); }
.rail-role { color: var(--accent); font-weight: 600; }
dialog.profils { width: 480px; }
dialog.profils .mini-liste { margin-top: 14px; }
dialog.profils button.mini { width: 100%; border: 0; background: transparent; text-align: left; }
dialog.profils button.mini:hover { background: var(--teinte); }
.hors-delai { color: var(--danger); font-weight: 600; }
.carte > span.hors-delai { color: var(--danger); font-weight: 600; font-size: .8rem; margin-top: 2px; }
.cellule-coche { display: grid; place-items: center; padding: 0 !important; height: 100%; cursor: pointer; }
.grille-col.cellule-coche { justify-content: center; padding: 8px 0; }
.cellule-coche .coche { pointer-events: none; }
.coche[aria-checked="true"] svg, .coche svg { display: block; }
.grille-ligne.coche-oui { background: var(--accent-doux); }
.masse-barre:empty { display: none; }
.masse-barre { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; padding: 8px 12px; background: var(--nuit); color: var(--sur-nuit); font-size: .9rem; }
.masse-barre b { margin-right: 6px; font-family: var(--f-mono); font-weight: 500; }
.masse-barre .btn.discret { color: var(--sur-nuit); }
.masse-barre .btn.discret:hover { background: rgba(255, 255, 255, .1); }
.table-defile { overflow-x: auto; }
.table-defile table.donnees { min-width: 860px; }
.table-defile td { vertical-align: middle; }
.table-defile .jauge { margin: 0 0 4px; }
.reglage-ligne select.filtre { flex: none; }

/* ================= FIABILITÉ ET PRISE EN MAIN ================= */
dialog.verrou { width: 500px; }
dialog.verrou::backdrop, dialog.assistant::backdrop { background: rgba(12, 18, 17, .72); }
dialog.assistant { width: 680px; max-height: calc(100dvh - 32px); overflow-y: auto; padding: 26px; }
dialog.assistant .form { max-width: none; }
dialog.assistant .form-actions { justify-content: flex-start; }
.premiers-pas { margin-bottom: 20px; max-width: 1380px; }
.premiers-pas ol { display: grid; gap: 8px; margin-top: 4px; }
.premiers-pas li { display: flex; align-items: center; gap: 10px; }
.premiers-pas li a { font-weight: 500; text-decoration: underline; text-decoration-color: var(--bord-fort); text-underline-offset: 3px; }
.premiers-pas li.fait a { color: var(--texte-2); text-decoration: line-through; }
.premiers-pas .coche { pointer-events: none; }
.plus-liste { max-width: 760px; }
.bandeau .btn { margin-left: 6px; vertical-align: middle; }
.reglage-ligne .mini-corps b { white-space: normal; }

/* ================= DOUBLONS, AIDE ================= */
.doublon { padding: 14px 16px; margin-bottom: 14px; max-width: 980px; }
.doublon .mini-liste { border: 0; }
.doublon .mini-corps b a { text-decoration: underline; text-decoration-color: var(--bord-fort); text-underline-offset: 3px; }
a.puce { text-decoration: none; }
.aide { max-width: 68ch; }
.aide p { margin: 0 0 12px; color: var(--texte); }
.aide ul { list-style: disc; padding-left: 20px; margin: 0 0 14px; display: grid; gap: 7px; }
.aide a:not(.mini) { text-decoration: underline; text-decoration-color: var(--bord-fort); text-underline-offset: 3px; }
.aide .mini-liste { margin: 4px 0 14px; }
.aide .mini kbd { flex: none; min-width: 92px; text-align: center; }
.vl-titre + .btn.icone { color: var(--texte-2); }

/* ================= ADAPTATION ================= */
@media (max-width: 1240px) {
  :root { --rail-l: 64px; }
  .rail { padding: 12px 8px 8px; align-items: stretch; }
  .rail-marque { justify-content: center; padding: 2px 0 12px; }
  .rail-marque div, .rail-chercher span, .rail-chercher kbd, .rail-groupe h2, .rail-lien span.nom, .rail-moi div { display: none; }
  .rail-chercher, .rail-lien, .rail-moi { justify-content: center; padding: 9px 0; position: relative; }
  .rail-compte { position: absolute; top: 2px; right: 4px; min-width: 16px; padding: 0 4px; font-size: .64rem; line-height: 16px; }
  .scene { grid-template-columns: minmax(280px, 340px) minmax(0, 1fr); }
  .accueil, .rapports { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 860px) {
  html { font-size: 16px; }
  .app { grid-template-columns: minmax(0, 1fr); grid-template-rows: auto minmax(0, 1fr); }
  .barre-mobile { display: flex; align-items: center; gap: 10px; background: var(--nuit); color: var(--sur-nuit); padding: 8px 12px; padding-top: max(8px, env(safe-area-inset-top)); }
  .barre-mobile b { font: 700 1.1rem var(--f-titre); flex: 1; }
  .barre-mobile .btn { background: transparent; border-color: var(--trait-nuit); color: var(--sur-nuit); }
  .rail { position: fixed; inset: 0 auto 0 0; width: 264px; z-index: 70; transform: translateX(-100%); transition: transform .24s var(--ease); --rail-l: 264px; padding: 14px 10px 10px; }
  .rail-marque { justify-content: flex-start; padding: 4px 8px 14px; }
  .rail-marque div, .rail-chercher span, .rail-groupe h2, .rail-lien span.nom, .rail-moi div { display: block; }
  .rail-chercher, .rail-lien, .rail-moi { justify-content: flex-start; padding: 9px 10px; }
  .rail-compte { position: static; }
  .app.menu-ouvert .rail { transform: none; box-shadow: var(--ombre-forte); }
  .voile { display: none; position: fixed; inset: 0; z-index: 65; background: rgba(12, 18, 17, .5); border: 0; }
  .app.menu-ouvert .voile { display: block; }
  .scene, .scene[data-mode="large-fiche"] { grid-template-columns: minmax(0, 1fr); }
  .scene[data-ouvert="oui"] .volet-liste { display: none; }
  .scene:not([data-ouvert="oui"]):not([data-mode="large"]) .volet-fiche { display: none; }
  .volet-liste { border-right: 0; }
  .vf-defile { padding: 16px 16px 40px; }
  .scene[data-mode^="large"] .vl-tete { padding: 14px 16px 10px; }
  .scene[data-mode^="large"] .vl-corps { padding: 0 16px 24px; }
  .fiche-retour { display: inline-flex; margin-bottom: 12px; }
  .vl-ligne { flex-wrap: wrap; }
  .vl-titre small { display: block; margin: 2px 0 0; }
  .form-grille { grid-template-columns: minmax(0, 1fr); }
  .feuille { padding: 22px 18px; }
  .feuille-tete, .feuille-parties { grid-template-columns: 1fr; flex-direction: column; }
  .feuille-emetteur { text-align: left; }
  .ligne-edit { grid-template-columns: minmax(0, 1fr) 56px 84px 34px; }
  .ligne-edit .tva { display: none; }
  .cal-jour { min-height: 74px; padding: 3px; }
  .cal-evt { font-size: .7rem; padding: 1px 4px; }
  .chiffre { border-right: 0; border-bottom: 1px solid var(--bord); }
  .toasts { left: 12px; right: 12px; bottom: 12px; align-items: stretch; }
  dialog.palette { margin-top: 6vh; }
}
@media (min-width: 861px) { .voile { display: none; } }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition-duration: .01ms !important; animation-duration: .01ms !important; }
}

/* ================= IMPRESSION : seule la feuille sort ================= */
@media print {
  body { height: auto; overflow: visible; background: #fff; }
  .rail, .barre-mobile, .volet-liste, .toasts, .fiche-actions, .fiche-tete, .fiche-retour, .section, .bandeau { display: none !important; }
  .app, .scene { display: block; height: auto; }
  .volet-fiche { display: block !important; }
  .vf-defile { overflow: visible; padding: 0; }
  .feuille { border: 0; box-shadow: none; padding: 0; max-width: none; }
  @page { margin: 16mm; }
}

/* Lien discret présenté comme un bouton (assistant de démarrage) */
button.lien { padding: 0; border: 0; background: none; color: inherit; font: inherit; font-weight: 600; text-decoration: underline; text-underline-offset: 2px; cursor: pointer; }
button.lien:hover { color: var(--texte); }
button.lien:focus-visible { outline: 2px solid var(--accent-trait); outline-offset: 2px; border-radius: 2px; }
