/* =====================================================================================================================
   Autowork : la feuille du front de démonstration. Polices du système, aucune ressource externe, aucun build.
   L'accent vient du pack (--accent, posé par app.js) : boutons principaux, onglet et lien courants. L'or est réservé à
   ce qui attend une validation. Un statut se lit par la forme autant que par la couleur (.marque).
   1 Jetons · 2 Base · 3 Boutons · 4 Champs · 5 Coque · 6 Rail · 7 Centre · 8 Conversation · 9 Cartes et lignes
   10 Marques et pastilles · 11 Fiche · 12 Réglages, coûts · 13 Connexion · 14 Annonces · 15 Écrans plus étroits
   ===================================================================================================================== */

/* 1. Jetons ----------------------------------------------------------------------------------------------------------- */
:root {
  color-scheme: light;
  --police: -apple-system, BlinkMacSystemFont, "Segoe UI Variable Text", "Segoe UI", system-ui, Roboto, "Helvetica Neue",
            Arial, sans-serif;
  --mono: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;

  /* Neutres chauds. --doux reste lisible (AA) sur toutes les surfaces ; --bord-champ fait 3:1 (WCAG 1.4.11). */
  --fond: #f3f1ed; --surface: #fff; --surface-2: #f9f8f5; --surface-3: #ece9e3;
  --bord: #e1ddd5; --bord-fort: #cdc6ba; --bord-champ: #8c8477;
  --texte: #1d1b18; --texte-2: #46413a; --doux: #625c53; --pale: #7d776d;

  /* L'accent du métier (session.pack.accent) ; sans accent, une encre neutre. */
  --accent: #34312c; --sur-accent: #fff;
  --accent-fort: color-mix(in srgb, var(--accent) 78%, #000);
  --accent-pale: color-mix(in srgb, var(--accent) 9%, #fff);
  --accent-bord: color-mix(in srgb, var(--accent) 35%, #fff);

  /* L'or : « attend ta validation », jamais décoratif. Le texte sur l'or est l'encre. */
  --or: #d9ad2f; --or-fond: #fbf3da; --or-bord: #e7c867; --or-texte: #6f520c;

  /* Sens : vert à jour, orange à renouveler ou en retard, rouge expiré ou urgent. */
  --ok: #23703b; --ok-fond: #e9f4ec; --warn: #b0500e; --warn-fond: #fdf1e6; --warn-bord: #efc9a6;
  --alert: #b3261e; --alert-fond: #fcefed; --alert-bord: #f0c3bd;

  --t-xs: 12px; --t-s: 13px; --t-m: 14.5px; --t-l: 16px; --t-xl: 20px; --t-2xl: 24px;
  --e-1: 4px; --e-2: 8px; --e-3: 12px; --e-4: 16px; --e-5: 20px; --e-6: 24px; --e-8: 32px; --e-10: 40px;
  --r-1: 4px; --r-2: 6px; --r-3: 10px; --r-rond: 999px;
  --ombre-1: 0 1px 2px rgb(29 27 24 / 6%);
  --ombre-2: 0 1px 2px rgb(29 27 24 / 5%), 0 10px 24px -10px rgb(29 27 24 / 18%);
  --ombre-3: 0 18px 44px -12px rgb(29 27 24 / 34%);
  --voile: rgb(29 27 24 / 38%);
  --cible: 40px;
  --rail: 17rem; --fiche: clamp(24rem, 32vw, 34rem);
  --accent-texte: color-mix(in oklab, var(--accent) 88%, #000);
  --encre: #1d1b18; /* le texte sur l'or, en clair comme en sombre */

  /* Icônes de sens des messages (masques : elles prennent la couleur du texte). */
  --i-info: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='M12 11v6M12 7.5v.5'/%3E%3C/svg%3E");
  --i-ok: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='9'/%3E%3Cpath d='m8 12.5 3 3 5-6'/%3E%3C/svg%3E");
  --i-alerte: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M12 3.5 2.5 20h19z'/%3E%3Cpath d='M12 10v4.5M12 17.2v.3'/%3E%3C/svg%3E");
}

/* Thème sombre, automatique : seuls les jetons changent ; l'accent s'éclaircit quand il sert de texte. */
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fond: #161412; --surface: #1e1b18; --surface-2: #24201c; --surface-3: #2f2a25;
    --bord: #39332d; --bord-fort: #4c453d; --bord-champ: #8a8277;
    --texte: #f1ece5; --texte-2: #d6cec4; --doux: #aba398; --pale: #8d867c;
    --accent-texte: color-mix(in oklab, var(--accent) 45%, #fff);
    --accent-fort: color-mix(in srgb, var(--accent) 80%, #fff);
    --accent-pale: color-mix(in srgb, var(--accent) 24%, #1e1b18);
    --accent-bord: color-mix(in srgb, var(--accent) 55%, #1e1b18);
    --or-fond: #3a2f12; --or-bord: #8a6d22; --or-texte: #f0cc6a;
    --ok: #74c992; --ok-fond: #17301f; --warn: #f2a564; --warn-fond: #352312; --warn-bord: #6e4724;
    --alert: #ff8f82; --alert-fond: #3b1815; --alert-bord: #742c25;
    --ombre-1: none; --ombre-2: 0 10px 24px -10px rgb(0 0 0 / 60%); --ombre-3: 0 18px 44px -12px rgb(0 0 0 / 75%);
    --voile: rgb(0 0 0 / 55%);
    --org-mix: 22%; /* la teinte d'une marque à l'écran de connexion */
  }
}

/* 2. Base ------------------------------------------------------------------------------------------------------------- */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body { margin: 0; font: 400 var(--t-m)/1.5 var(--police); color: var(--texte); background: var(--fond);
       -webkit-font-smoothing: antialiased; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--texte); outline-offset: 2px; }
[tabindex="-1"]:focus { outline: none; }
::selection { background: var(--or-fond); }
h1 { margin: 0; font-size: var(--t-2xl); line-height: 1.2; font-weight: 700; letter-spacing: -.015em; text-wrap: balance; }
h2 { display: flex; align-items: center; gap: var(--e-2); margin: 0 0 var(--e-3); font-size: var(--t-l); font-weight: 650; }
h3 { margin: 0 0 var(--e-2); font-size: var(--t-m); font-weight: 650; }
h4 { margin: var(--e-4) 0 var(--e-1); color: var(--texte-2); font-size: var(--t-s); font-weight: 600; }
p { margin: 0 0 var(--e-2); }
a { color: var(--texte); text-decoration: underline; text-decoration-color: var(--bord-champ); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code { padding: 1px 5px; border-radius: var(--r-1); background: var(--surface-3); font: .9em var(--mono); }
small, .meta, .aide, .vide { color: var(--doux); }
.meta, .aide { font-size: var(--t-s); }
.vide { margin: 0; }
td, dd, time, .nombre, .compte, .pastille { font-variant-numeric: tabular-nums; }
.lecteur { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.evitement { position: absolute; top: -100px; left: var(--e-3); z-index: 50; padding: var(--e-2) var(--e-3);
             background: var(--surface); }
.evitement:focus { top: var(--e-3); }
.texte { white-space: pre-wrap; overflow-wrap: anywhere; }
.icone { width: 18px; height: 18px; flex: none; }
@media (pointer: coarse) { :root { --cible: 44px; } } /* au doigt, des cibles de 44 px */

/* 3. Boutons : .principal = l'action principale du bloc, à l'accent ; .secondaire = contour ; .discret = sans cadre.
   aria-busy : la requête est en route. */
button { display: inline-flex; align-items: center; justify-content: center; gap: var(--e-2); min-height: var(--cible);
  padding: 8px 16px; border: 1px solid var(--bord-fort); border-radius: var(--r-2); background: var(--surface);
  color: var(--texte); font: 600 var(--t-m)/1.2 var(--police); text-align: center; cursor: pointer;
  transition: background-color .15s, border-color .15s; }
button:where(:not(:disabled)):hover { border-color: var(--bord-champ); background: var(--surface-2); }
button.principal { border-color: transparent; background: var(--accent); color: var(--sur-accent); box-shadow: var(--ombre-1); }
button.principal:where(:not(:disabled)):hover { background: var(--accent-fort); color: var(--sur-accent); }
button.discret { border-color: transparent; background: transparent; color: var(--texte-2); }
button.discret:where(:not(:disabled)):hover { background: var(--surface-3); color: var(--texte); }
button.petit { padding: 6px 12px; font-size: var(--t-s); }
button.lien { min-height: 0; padding: 0; border: 0; background: none; color: var(--accent-texte); font-weight: 600;
  text-decoration: underline; text-underline-offset: 3px; }
button:disabled { opacity: .5; cursor: not-allowed; }
button[aria-busy="true"] { opacity: .8; cursor: progress; }
button[aria-busy="true"]::before, .tourne { content: ""; display: inline-block; flex: none; width: 14px; height: 14px;
  border: 2px solid currentColor; border-right-color: transparent; border-radius: 50%; animation: tourne .7s linear infinite; }
@keyframes tourne { to { transform: rotate(1turn); } }
.icone-seule { width: var(--cible); padding: 0; }
.icone-seule .icone { width: 20px; height: 20px; }
button .icone { margin-left: -2px; }
.icone-seule .icone, .rail .icone { margin-left: 0; }
.boutons { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); }

/* 4. Champs ----------------------------------------------------------------------------------------------------------- */
label { display: block; color: var(--texte-2); font-size: var(--t-s); font-weight: 550; }
input:not([type=checkbox]), select, textarea { display: block; width: 100%; min-height: var(--cible); margin-top: 4px;
  padding: 8px 10px; border: 1px solid var(--bord-champ); border-radius: var(--r-2); background: var(--surface);
  color: var(--texte); font: 400 var(--t-m)/1.4 var(--police); }
input:focus, select:focus, textarea:focus { border-color: var(--texte); outline: 2px solid var(--accent-bord); outline-offset: 0; }
input[readonly], textarea[readonly] { border-color: var(--bord); background: var(--surface-2); }
textarea { resize: vertical; }
input[type=checkbox] { flex: none; width: 20px; height: 20px; margin: 2px 0 0; accent-color: var(--accent); }
label.case { display: flex; gap: var(--e-3); align-items: flex-start; min-height: var(--cible); padding: var(--e-2) 0;
             color: var(--texte); font-size: var(--t-m); font-weight: 400; }

/* 5. Coque : trois colonnes pleine hauteur, chacune défile seule. -------------------------------------------------- */
.coque { display: grid; grid-template-columns: var(--rail) minmax(0, 1fr); height: 100vh; height: 100dvh; }
.avec-fiche .coque { grid-template-columns: var(--rail) minmax(0, 1fr) var(--fiche); }
.voile { position: fixed; inset: 0; z-index: 20; background: var(--voile); }

/* 6. Rail : sombre, teinté de l'accent du métier (brun pour le bâtiment, sarcelle pour l'immobilier). Ses textes
   secondaires sont teintés aussi, jamais gris ; l'or y garde son sens (ce qui attend une décision). ------------- */
.rail { --rail-fond: color-mix(in oklab, var(--accent) 24%, #0e0c0b);
  --rail-survol: color-mix(in oklab, var(--accent) 34%, #1c1814);
  --rail-actif: color-mix(in oklab, var(--accent) 48%, #241e19);
  --rail-texte: color-mix(in oklab, var(--accent) 6%, #f7f2ec);
  --rail-doux: color-mix(in oklab, var(--accent) 28%, #d8cdbf);
  --rail-bord: color-mix(in oklab, var(--accent) 30%, #3a332c);
  display: flex; flex-direction: column; gap: var(--e-3); min-height: 0; padding: var(--e-3) var(--e-2) var(--e-2);
  overflow-y: auto; background: var(--rail-fond); color: var(--rail-texte); color-scheme: dark; scrollbar-width: thin; }
.rail :focus-visible { outline-color: var(--rail-texte); }
.rail .icone { width: 18px; height: 18px; flex: none; }
@media (pointer: coarse) { :root { --cible: 44px; } } /* au doigt, des cibles de 44 px */
.rail button { border-color: transparent; background: transparent; color: var(--rail-texte); box-shadow: none; }
.rail button:where(:not(:disabled)):hover { border-color: transparent; background: var(--rail-survol); }
.rail-tete { display: flex; align-items: center; gap: var(--e-2); padding: 0 var(--e-1) var(--e-1); }
.symbole { display: inline-grid; flex: none; place-items: center; width: 28px; height: 28px; border-radius: 7px;
  background: var(--accent); color: var(--sur-accent); font-size: 14px; font-weight: 750; }
.rail .symbole { box-shadow: 0 0 0 1px var(--rail-bord); }
.symbole.a-marque { padding: 2px; background: none; box-shadow: none; }
.symbole.a-marque picture { display: contents; }
.symbole.a-marque img { width: 100%; height: 100%; object-fit: contain; }
.rail-org { display: grid; flex: 1; min-width: 0; line-height: 1.25; }
.rail-org strong, .rail-org span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-org span { color: var(--rail-doux); font-size: var(--t-xs); }
.rail-tete .fermer-rail { display: none; }
.rail-liste { display: grid; grid-template-columns: minmax(0, 1fr); gap: 1px; margin: 0; padding: 0; list-style: none; }
.rail-lien { display: flex; align-items: center; justify-content: flex-start; gap: 10px; width: 100%; min-height: var(--cible);
  padding: 6px var(--e-2); border-radius: var(--r-2); color: var(--rail-texte); font: 500 var(--t-m)/1.3 var(--police);
  text-align: left; text-decoration: none; }
.rail-lien:hover { background: var(--rail-survol); }
.rail-lien[aria-current="page"] { background: var(--rail-actif); font-weight: 650; }
.rail-lien.contexte:not([aria-current="page"]), .rail-lien[aria-current="true"] { background: var(--rail-survol); }
.rail-texte { display: grid; flex: 1; grid-template-columns: minmax(0, 1fr); min-width: 0; }
.rail-meta { color: var(--rail-doux); font-size: var(--t-xs); font-weight: 400; white-space: nowrap; }
.rail .pastille:not(.or) { background: color-mix(in oklab, var(--rail-texte) 16%, transparent); color: var(--rail-texte); }
.rail-section { display: flex; align-items: center; justify-content: space-between; padding-left: var(--e-2); }
.rail-section h2 { margin: 0; color: var(--rail-doux); font-size: var(--t-xs); font-weight: 650; letter-spacing: .07em;
                   text-transform: uppercase; }
.rail-dossiers { display: grid; gap: var(--e-1); }
.rail-filtres { display: flex; gap: var(--e-1); align-items: center; padding: 0 0 var(--e-1); }
.rail-recherche { position: relative; flex: 1; min-width: 0; margin: 0; color: var(--rail-doux); }
.rail-recherche .icone { position: absolute; top: 50%; left: 9px; width: 15px; height: 15px; transform: translateY(-50%); }
.rail-recherche input { min-height: 34px; margin: 0; padding: 6px 8px 6px 30px; border-color: var(--rail-bord);
  background: color-mix(in oklab, var(--rail-fond) 70%, #000); color: var(--rail-texte); font-size: var(--t-s); }
.rail-recherche input::placeholder { color: var(--rail-doux); }
.rail-recherche input:focus { border-color: var(--rail-texte); outline: none; }
.rail-bascule { display: flex; flex: none; padding: 2px; border: 1px solid var(--rail-bord); border-radius: var(--r-2); }
.rail-bascule button { min-height: 28px; padding: 2px 8px; border-radius: 4px; color: var(--rail-doux); font-size: var(--t-xs); }
.rail-bascule button[aria-pressed="true"] { background: var(--rail-actif); color: var(--rail-texte); }
.rail-dossier { position: relative; }
.rail-dossier > .rail-lien { padding-right: 30px; }
.rail-nom { display: flex; align-items: center; gap: var(--e-2); min-width: 0; }
.rail-nom .nom, .rail-sous .sous { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.rail-nom .nom { flex: 1; min-width: 0; }
.rail-sous { display: flex; gap: var(--e-2); justify-content: space-between; color: var(--rail-doux); font-size: var(--t-xs);
             font-weight: 400; }
.rail-sous .sous { min-width: 0; }
.rail-sous time { flex: none; font-variant-numeric: tabular-nums; }
.rail-sous time.retard { color: #ff9b8e; font-weight: 600; }
.rail .epingler { position: absolute; top: 4px; right: 2px; width: 26px; min-height: 26px; padding: 0; border-radius: 5px;
  color: var(--rail-doux); opacity: 0; }
.rail .epingler .icone { width: 14px; height: 14px; }
.rail-dossier:hover .epingler, .rail-dossier:focus-within .epingler, .rail .epingler[aria-pressed="true"] { opacity: 1; }
.rail .epingler[aria-pressed="true"] { color: var(--or); }
.rail .epingler[aria-pressed="true"] .icone { fill: currentColor; }
@media (pointer: coarse) { .rail .epingler { opacity: 1; } }
.rail-dossier:has(.epingler) .rail-nom { padding-right: 4px; }
.rail-conversations { margin: 2px 0 var(--e-1) var(--e-5); padding: 0 0 0 var(--e-2); border-left: 1px solid var(--rail-bord);
                      list-style: none; }
.rail-conversations .rail-lien { min-height: 32px; padding: 4px var(--e-2); color: var(--rail-doux); font-size: var(--t-s);
  font-weight: 400; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }
.rail-conversations .rail-lien[aria-current="page"] { color: var(--rail-texte); font-weight: 600; }
.rail-vide { margin: 0; padding: var(--e-1) var(--e-2); color: var(--rail-doux); font-size: var(--t-s); }
.rail-bas { margin-top: auto; padding-top: var(--e-2); border-top: 1px solid var(--rail-bord); }
.rail-utilisateur { display: flex; align-items: center; gap: var(--e-2); padding: var(--e-2) var(--e-1) 0;
                    border-top: 1px solid var(--rail-bord); }
.initiales { display: inline-grid; flex: none; place-items: center; width: 32px; height: 32px; border-radius: 50%;
  background: var(--rail-texte); color: var(--rail-fond); font-size: var(--t-xs); font-weight: 750; }
.creation { display: grid; gap: var(--e-3); margin: 0 0 var(--e-2); padding: var(--e-3); border: 1px solid var(--rail-bord);
            border-radius: var(--r-3); background: color-mix(in oklab, var(--rail-fond) 70%, #000); }
.creation label { color: var(--rail-doux); }
.creation input, .creation select { border-color: var(--rail-bord); background: var(--rail-fond); color: var(--rail-texte); }
.rail .creation button.principal { background: var(--accent); color: var(--sur-accent); }
.rail .creation button.secondaire { border-color: var(--rail-bord); }

/* 7. Centre : une colonne de lecture qui défile, la saisie en bas. ------------------------------------------------ */
.centre { display: flex; flex-direction: column; min-width: 0; min-height: 0; background: var(--surface); }
.barre-haut { display: none; }
.defile { flex: 1; min-height: 0; overflow-y: auto; }
.defile:focus { outline: none; }
.colonne { width: 100%; max-width: 46rem; margin: 0 auto; padding: 0 var(--e-6); }
.defile .colonne { padding-top: var(--e-6); padding-bottom: var(--e-8); }
.entete { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--e-3);
          margin: 0 0 var(--e-6); }
.sous-titre { margin: var(--e-1) 0 0; color: var(--doux); }
.partie { margin: 0 0 var(--e-8); }
.partie h2 [tabindex="-1"]:focus { outline: none; }
.compte { display: inline-flex; align-items: center; justify-content: center; min-width: 22px; height: 20px; padding: 0 7px;
          border-radius: var(--r-rond); background: var(--surface-3); color: var(--texte-2); font-size: var(--t-xs); font-weight: 700; }
.calme { margin: 0; padding: 10px var(--e-4); border: 1px dashed var(--bord-fort); border-radius: var(--r-3); color: var(--doux); }
.message { position: relative; margin: var(--e-2) 0; padding: 10px var(--e-4) 10px 40px; border: 1px solid var(--bord);
           border-radius: var(--r-3); background: var(--surface-2); }
.message::before { content: ""; position: absolute; top: 12px; left: 13px; width: 17px; height: 17px; background: currentColor;
  -webkit-mask: var(--i-info) center / contain no-repeat; mask: var(--i-info) center / contain no-repeat; }
.message.erreur::before, .message.attention::before { -webkit-mask-image: var(--i-alerte); mask-image: var(--i-alerte); }
.message.succes::before { -webkit-mask-image: var(--i-ok); mask-image: var(--i-ok); }
.message.erreur { border-color: var(--alert-bord); background: var(--alert-fond); color: var(--alert); }
.message.attention { border-color: var(--warn-bord); background: var(--warn-fond); color: var(--warn); }
.message.succes { border-color: color-mix(in srgb, var(--ok) 35%, var(--surface)); background: var(--ok-fond); color: var(--ok); }
.message:focus { outline: none; }
.conversations { margin: 0; padding: 0; list-style: none; }
.conversations li { display: flex; align-items: center; gap: var(--e-3); min-height: 44px; border-top: 1px solid var(--bord); }
.conversations li:last-child { border-bottom: 1px solid var(--bord); }
.conversations a { flex: 1; min-width: 0; padding: 10px 0; overflow: hidden; font-weight: 500; text-decoration: none;
                   text-overflow: ellipsis; white-space: nowrap; }
.conversations a:hover { text-decoration: underline; }
.conversations .meta { flex: none; }

.bas { flex: none; padding: var(--e-2) 0 calc(var(--e-3) + env(safe-area-inset-bottom)); background: var(--surface); }
.bas:empty { display: none; }
.composer { display: grid; padding: 6px 6px 6px 8px; border: 1px solid var(--bord-champ); border-radius: 14px;
            background: var(--surface); box-shadow: var(--ombre-2); }
.composer:focus-within { border-color: var(--texte); }
.composer textarea, .composer textarea:focus { min-height: var(--cible); max-height: 40vh; margin: 0; padding: 8px 6px;
  border: 0; outline: none; background: none; resize: none; field-sizing: content; }
.composer textarea:disabled { color: var(--doux); }
.composer-bas { display: flex; align-items: center; gap: var(--e-2); }
.composer-bas .depot { flex: none; }
.composer-bas .aide { flex: 1; margin: 0; font-size: var(--t-xs); text-align: right; }
.composer .envoyer { flex: none; width: 36px; min-height: 36px; height: 36px; padding: 0; border: 0; border-radius: 50%;
  background: var(--accent); color: var(--sur-accent); }
.composer .envoyer:where(:not(:disabled)):hover { background: var(--accent-fort); }
.composer .envoyer .icone { width: 18px; height: 18px; margin: 0; }
.composer .joindre { color: var(--texte-2); }
.apropos { display: flex; align-items: center; gap: var(--e-1); justify-self: start; max-width: 100%; margin: 2px 0 4px;
  padding: 0 2px 0 10px; border: 1px solid var(--accent-bord); border-radius: var(--r-rond); background: var(--accent-pale);
  font-size: var(--t-s); }
.apropos span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.apropos .icone-seule { width: 30px; min-height: 30px; border-radius: 50%; }
.apropos .icone-seule .icone { width: 15px; height: 15px; }
.occupe { margin: 0 0 var(--e-2); }

/* Le dépôt par glisser-déposer : un cadre sur le centre tant qu'un fichier le survole. */
.centre { position: relative; }
.zone-depot { position: absolute; inset: var(--e-3); z-index: 15; display: none; place-items: center; padding: var(--e-6);
  border: 2px dashed var(--accent); border-radius: var(--r-3); background: color-mix(in srgb, var(--accent-pale) 94%, transparent);
  font-size: var(--t-l); font-weight: 650; text-align: center; pointer-events: none; }
.depot-actif .zone-depot { display: grid; }

/* La tête d'un dossier : référence, nom, statut et faits, puis le feu et la frise des jalons. */
.tete-dossier { margin: 0 0 var(--e-6); }
.reference { margin: 0 0 var(--e-1); overflow: hidden; color: var(--doux); font-size: var(--t-s); text-overflow: ellipsis;
             white-space: nowrap; }
.tete-ligne { display: flex; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: var(--e-3); }
.faits { margin: var(--e-2) 0 0; color: var(--texte-2); font-size: var(--t-s); }
.faits .retard, .feu.rouge { color: var(--alert); }
.faits .retard { font-weight: 600; }
.coup-d-oeil { display: grid; gap: var(--e-4); margin-top: var(--e-4); padding: var(--e-3) var(--e-4) var(--e-4);
               border: 1px solid var(--bord); border-radius: var(--r-3); background: var(--surface-2); }
.feu { justify-self: start; margin: 0; padding: 3px 12px 3px 10px; border-radius: var(--r-rond); font-size: var(--t-s);
       font-weight: 600; }
.feu .marque .libelle { color: inherit; font-weight: inherit; }
.feu.rouge { background: var(--alert-fond); }
.feu.orange { background: var(--warn-fond); color: var(--warn); }
.feu.vert { background: var(--ok-fond); color: var(--ok); }
.frise-conteneur { container-type: inline-size; }
.frise { display: flex; margin: 0; padding: 0 0 12px; scrollbar-width: thin; overflow-x: auto; list-style: none; }
.frise li { position: relative; display: grid; flex: 1 1 0; justify-items: center; align-content: start; gap: 3px;
            min-width: 5.5rem; padding: 0 4px; font-size: var(--t-xs); line-height: 1.3; text-align: center; }
.frise li::before { content: ""; position: absolute; top: 6px; right: 50%; left: -50%; height: 2px; background: var(--bord-fort); }
.frise li:first-child::before { display: none; }
.frise li.atteint::before { background: var(--accent-texte); }
.frise .point { position: relative; z-index: 1; width: 14px; height: 14px; border: 2px solid var(--bord-champ); border-radius: 50%;
                background: var(--surface-2); }
.frise .atteint .point { border-color: var(--accent-texte); background: var(--accent-texte); }
.frise .prochain .point { border-color: var(--accent-texte); box-shadow: 0 0 0 3px var(--accent-pale); }
.frise .retard .point { border-color: var(--alert); }
.frise .jalon { color: var(--texte-2); }
.frise .prochain .jalon { color: var(--texte); font-weight: 650; }
.frise .quand { color: var(--doux); font-variant-numeric: tabular-nums; }
.frise .retard .quand { color: var(--alert); font-weight: 600; }
@container (max-width: 34rem) {
  .frise { flex-direction: column; overflow: visible; }
  .frise li { grid-template-columns: 14px minmax(0, 1fr) auto; justify-items: start; align-items: center; column-gap: var(--e-3);
              min-width: 0; padding: 5px 0; text-align: left; }
  .frise li::before { top: -50%; right: auto; bottom: 50%; left: 6px; width: 2px; height: auto; }
}

/* 8. Conversation : l'utilisateur en bulle, l'assistant en clair, ses cartes dessous. ------------------------------ */
.fil { display: grid; gap: var(--e-6); margin: 0; padding: 0; list-style: none; }
.tour { min-width: 0; overflow-wrap: anywhere; }
.tour.utilisateur { justify-self: end; max-width: 85%; }
.tour.utilisateur .meta { margin: var(--e-1) 0 0; text-align: right; }
.bulle { padding: 10px 14px; border-radius: var(--r-3) var(--r-3) var(--r-1) var(--r-3); background: var(--surface-3);
         white-space: pre-wrap; }
.reponse { line-height: 1.6; }
.reponse p { margin: 0 0 var(--e-3); white-space: pre-line; }
.reponse ul, .reponse ol { margin: 0 0 var(--e-3); padding-left: 1.4em; }
.reponse li + li { margin-top: 2px; }
.reponse .intertitre { margin-top: var(--e-4); font-weight: 650; }
.tour.assistant { display: grid; grid-template-columns: 28px minmax(0, 1fr); gap: var(--e-3); align-items: start; }
.tour-corps { min-width: 0; }
.tour.assistant .tour-corps > .reponse { padding-top: 3px; }
.point-matin { margin: 0 0 var(--e-6); }
.point-matin .tour-corps { margin: 3px 0 0; font-size: var(--t-l); }
.demarche { margin-top: var(--e-2); color: var(--doux); font-size: var(--t-s); }
.demarche summary { display: inline-flex; align-items: center; min-height: 32px; cursor: pointer; }
.demarche ul { margin: 0; padding-left: 1.2em; }
.entete-conversation { align-items: center; margin-bottom: var(--e-1); }
.ariane { display: flex; flex-wrap: wrap; align-items: baseline; gap: 4px var(--e-2); min-width: 0; }
.ariane a { color: var(--doux); font-size: var(--t-l); text-decoration: none; }
.ariane a:hover { color: var(--texte); text-decoration: underline; }
.ariane .separateur { color: var(--pale); }
.ariane h1 { font-size: var(--t-l); font-weight: 650; letter-spacing: 0; }
.ouverte-par { margin: 0 0 var(--e-6); }
.etat-attente { display: flex; align-items: center; gap: var(--e-2); margin: 0; font-weight: 550; }
.attente .meta { margin: var(--e-1) 0 0; }

/* 9. Cartes d'action et lignes à traiter ----------------------------------------------------------------------------- */
.carte { margin: var(--e-3) 0; padding: var(--e-3) var(--e-4); border: 1px solid var(--bord); border-radius: var(--r-3);
         background: var(--surface); box-shadow: var(--ombre-1); }
.partie > .carte:first-of-type { margin-top: 0; }
.carte.en_attente { border-color: var(--or-bord); box-shadow: inset 0 3px 0 var(--or), var(--ombre-1); }
.carte-tete { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); margin: 0 0 var(--e-2); }
.carte-tete h3 { margin: 0; font-size: var(--t-s); }
.carte-tete .a-valider, .carte-tete .badge { margin-left: auto; }
.badge { padding: 1px 8px; border-radius: var(--r-1); font-size: var(--t-xs); font-weight: 650; }
.badge.appliquee { background: var(--ok-fond); color: var(--ok); }
.badge.refusee { background: var(--surface-3); color: var(--doux); }
.changements { margin: 0 0 var(--e-2); padding: 0; border: 1px solid var(--bord); border-radius: var(--r-2); list-style: none; }
.changements li { display: grid; grid-template-columns: minmax(7rem, 2fr) minmax(0, 3fr); gap: 2px var(--e-3); padding: 6px 10px;
                  font-size: var(--t-s); }
.changements li:not(:has(.cible)) { display: block; }
.changements li + li { border-top: 1px solid var(--bord); }
.changements .cible { color: var(--doux); }
.changements.creation .valeurs > :not(.apres) { display: none; } /* un dossier à créer : rien n'y était avant */
.changements .avant { color: var(--doux); text-decoration: line-through; text-decoration-color: var(--pale); }
.source { margin: 0; color: var(--doux); font-size: var(--t-xs); }
.retouche { margin-top: var(--e-1); }
.retouche summary { display: inline-flex; align-items: center; min-height: 32px; color: var(--accent-texte); font-size: var(--t-s);
                    font-weight: 600; cursor: pointer; }
.retouche form { display: grid; gap: var(--e-2); justify-items: start; }
.retouche textarea { min-height: 3.5rem; }
.etat-carte { margin: 0; font-size: var(--t-s); font-weight: 550; }
.etat-carte:empty { display: none; }
.carte .boutons { margin-top: var(--e-2); }
.brouillon { display: grid; gap: var(--e-3); margin: 0 0 var(--e-3); }
.brouillon textarea { min-height: 10rem; }
.brouillon .aide { margin: 0; }

.lignes { margin: 0; padding: 0; list-style: none; }
.ligne { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2) var(--e-4); padding: var(--e-3) 0;
         border-top: 1px solid var(--bord); }
.lignes > .ligne:last-child { border-bottom: 1px solid var(--bord); }
.ligne .titre { display: grid; flex: 1 1 18rem; gap: 2px; min-width: 0; }
.ligne .boutons { flex: none; }
.ligne .erreur-carte { flex-basis: 100%; }
.ligne .erreur-carte:empty, .erreur-carte:empty { display: none; }
.suggestions { margin: 0; padding: 0; border: 1px solid var(--bord); border-radius: var(--r-3); background: var(--surface);
               list-style: none; }
.ligne-sugg { display: flex; flex-wrap: wrap; align-items: center; gap: 0 var(--e-1); padding-right: var(--e-1); }
.ligne-sugg + .ligne-sugg { border-top: 1px solid var(--bord); }
.sugg-ouvrir { flex: 1 1 10rem; justify-content: flex-start; gap: var(--e-3); min-width: 0; min-height: 48px; padding: 8px var(--e-3);
  border: 0; border-radius: var(--r-3) 0 0 var(--r-3); background: none; box-shadow: none; font-weight: 400; text-align: left; }
.sugg-ouvrir:where(:not(:disabled)):hover { background: var(--surface-2); }
.sugg-ouvrir .marque { flex: none; }
.sugg-texte { display: grid; min-width: 0; }
.sugg-titre { font-weight: 600; }
.sugg-texte .meta { font-size: var(--t-xs); }
.sugg-gestes { display: flex; flex: none; align-items: center; }
.sugg-gestes .icone-seule, .reporter summary { color: var(--doux); }
.reporter { position: relative; }
.reporter summary { display: inline-flex; align-items: center; justify-content: center; width: var(--cible); height: var(--cible);
                    border-radius: var(--r-2); list-style: none; cursor: pointer; }
.reporter summary::-webkit-details-marker { display: none; }
.reporter summary:hover { background: var(--surface-3); color: var(--texte); }
.reporter summary .icone { width: 20px; height: 20px; }
.reporter .menu { position: absolute; top: calc(100% + 4px); right: 0; z-index: 5; display: grid; min-width: 12rem; padding: 4px;
                  border: 1px solid var(--bord); border-radius: var(--r-3); background: var(--surface); box-shadow: var(--ombre-2); }
.reporter .menu button { justify-content: flex-start; }
.ligne-sugg.geste { gap: var(--e-3); padding: var(--e-2) var(--e-3); background: var(--surface-2); }
.ligne-sugg.geste .sugg-texte { flex: 1; }
.ligne-sugg .erreur-carte { flex-basis: 100%; padding: 0 var(--e-3); }
.lot { margin: 0 0 var(--e-4); }
.lot-liste { margin: 0; padding: 0; border: 1px solid var(--or-bord); border-radius: var(--r-3); background: var(--surface);
             box-shadow: inset 0 3px 0 var(--or); list-style: none; }
.lot-item { padding: var(--e-2) var(--e-4) var(--e-3); }
.lot-item + .lot-item { border-top: 1px solid var(--bord); }
.lot-item .case { min-height: 0; padding: var(--e-1) 0 var(--e-2); }
.lot-item > .discret { margin-top: var(--e-1); }
.lot-valider { position: sticky; bottom: var(--e-2); z-index: 2; width: 100%; margin-top: var(--e-2); }
.lot-valider:disabled { background: var(--surface-3); color: var(--doux); box-shadow: none; opacity: 1; }
.note .a-valider { justify-self: start; }

.a-l-envoi p { margin: 0 0 var(--e-1); font-size: var(--t-s); font-weight: 600; }
.a-l-envoi .changements { margin: 0; }
.changements .avant-document { color: var(--doux); }

/* Dépôt d'un document et boîte mail. */
.depot { display: inline-flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); }
.depot .message { margin: 0; padding: 6px 10px; font-size: var(--t-s); }
.documents-tete { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: var(--e-2); }
.documents-tete > .meta { margin: 0; }
.non-lu { color: var(--warn); }
.mail .objet { font-weight: 600; text-decoration: none; }
.mail .objet:hover { text-decoration: underline; }
.mail .resume { color: var(--texte-2); font-size: var(--t-s); }
.mail .demande { font-size: var(--t-s); }
.rangement { flex-wrap: nowrap; }
.rangement select { width: auto; min-width: 0; max-width: 16rem; margin: 0; }
.rangement-mail { margin: 0 0 var(--e-4); border-bottom: 1px solid var(--bord); }
.retour { margin: 0 0 var(--e-3); font-size: var(--t-s); }
.entetes-mail { margin: 0 0 var(--e-4); }
.texte-mail { margin: 0; padding: var(--e-4); border: 1px solid var(--bord); border-radius: var(--r-3); background: var(--surface-2);
  font: var(--t-m)/1.6 var(--police); white-space: pre-wrap; overflow-wrap: anywhere; }

/* 10. Marques et pastilles. .marque[data-ton] : ok plein, warn demi-plein, alert losange rouge, open contour,
   pending demi-plein encre, done gris barré. .a-valider et .pastille.or : l'or de la validation. ---------------- */
.marque { display: inline-flex; align-items: center; gap: 7px; }
.marque .forme { flex: none; width: 10px; height: 10px; border: 1.5px solid var(--texte); border-radius: 1px; }
.marque[data-ton="ok"] .forme { border-color: var(--ok); background: var(--ok); }
.marque[data-ton="warn"] .forme { border-color: var(--warn); background: linear-gradient(90deg, var(--warn) 50%, transparent 50%); }
.marque[data-ton="alert"] .forme { border-color: var(--alert); background: var(--alert); transform: rotate(45deg) scale(.9); }
.marque[data-ton="alert"] .libelle { color: var(--alert); font-weight: 550; }
.marque[data-ton="pending"] .forme { background: linear-gradient(90deg, var(--texte) 50%, transparent 50%); }
.marque[data-ton="done"] .forme { border-color: var(--pale); background: var(--pale); }
.marque[data-ton="done"] .libelle { color: var(--doux); text-decoration: line-through; }
.a-valider { display: inline-flex; align-items: center; height: 22px; padding: 0 8px; border-radius: var(--r-1);
             background: var(--or); color: var(--encre); font-size: var(--t-xs); font-weight: 700; }
.pastille { display: inline-flex; align-items: center; justify-content: center; flex: none; min-width: 22px; height: 20px;
  padding: 0 6px; border-radius: var(--r-1); background: var(--surface-3); color: var(--texte-2); font-size: var(--t-xs);
  font-weight: 700; }
.pastille.or { background: var(--or); color: var(--encre); }
.pastille.urgent { background: var(--alert-fond); color: var(--alert); font-weight: 600; }

/* 11. Fiche (panneau de droite) ------------------------------------------------------------------------------------- */
.droite { position: relative; display: flex; flex-direction: column; min-width: 0; min-height: 0;
          border-left: 1px solid var(--bord); background: var(--fond); }
.droite-tete { display: flex; flex: none; align-items: flex-start; justify-content: space-between; gap: var(--e-2);
               padding: var(--e-3) var(--e-2) var(--e-3) var(--e-4); border-bottom: 1px solid var(--bord); background: var(--surface-2); }
.tete-fiche { min-width: 0; }
.tete-fiche .reference { margin: 0; font-size: var(--t-xs); }
.tete-fiche h2 { margin: 2px 0; font-size: var(--t-l); }
.tete-fiche .statut { margin: 0; font-size: var(--t-s); }
.droite-outils { display: flex; flex: none; }
.poignee { position: absolute; top: 0; bottom: 0; left: -4px; z-index: 3; width: 8px; cursor: col-resize; touch-action: none; }
.poignee:hover, .poignee:focus-visible, .redimension .poignee { outline: none; background: var(--accent-bord); }
.redimension { cursor: col-resize; user-select: none; }
.fiche-large .coque { grid-template-columns: var(--rail) minmax(0, 1fr); }
.fiche-large .centre { display: none; }
.fiche-large .droite { border-left: 0; }
.droite-defile { flex: 1; min-height: 0; overflow-y: auto; }
.fiche { display: flex; flex-direction: column; min-height: 100%; }
.onglets { display: flex; flex-wrap: wrap; gap: 4px; padding: var(--e-2) var(--e-3); border-bottom: 1px solid var(--bord);
           background: var(--surface-2); }
.onglets [role="tab"] { flex: none; min-height: 34px; padding: 0 12px; border: 1px solid transparent; border-radius: var(--r-rond);
  background: none; color: var(--texte-2); font-size: var(--t-s); font-weight: 550; }
.onglets [role="tab"]:hover { background: var(--surface-3); }
.onglets [role="tab"][aria-selected="true"] { border-color: var(--accent); background: var(--accent); color: var(--sur-accent);
                                             font-weight: 650; }
@media (pointer: coarse) { .onglets [role="tab"] { min-height: var(--cible); } }
.panneau-onglet { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--e-4); padding: var(--e-4); }
.panneau-onglet:focus-visible { outline-offset: -2px; }
.bloc { min-width: 0; padding: var(--e-4); border: 1px solid var(--bord); border-radius: var(--r-3); background: var(--surface); }
.bloc h3 { color: var(--doux); font-size: var(--t-xs); letter-spacing: .06em; text-transform: uppercase; }
.champs { display: grid; gap: var(--e-3); margin: 0; }
.champs dt { color: var(--doux); font-size: var(--t-xs); }
.champs dd { margin: 2px 0 0; overflow-wrap: anywhere; }
.non-renseigne { color: var(--pale); }
.tableau { overflow-x: auto; }
.tableau:focus-visible { outline-offset: -2px; }
table { width: 100%; border-collapse: collapse; font-size: var(--t-s); }
th { padding: 6px var(--e-3) 6px 0; border-bottom: 1px solid var(--bord-fort); color: var(--doux); font-size: var(--t-xs);
     font-weight: 600; text-align: left; white-space: nowrap; }
td { padding: 8px var(--e-3) 8px 0; border-bottom: 1px solid var(--bord); vertical-align: top; }
/* Une liste plus large que la fiche défile de côté : les cases restent sur une ligne, sauf le texte libre. */
.bloc-liste td { white-space: nowrap; }
.bloc-liste td.long { min-width: 11rem; white-space: normal; }
.bloc-liste .tableau { max-height: min(70vh, 36rem); overflow: auto; }
.bloc-liste th { position: sticky; top: 0; z-index: 1; background: var(--surface); }
.liste-outils { display: flex; justify-content: flex-end; margin: -4px 0 var(--e-1); }
.filtrer .icone { width: 16px; height: 16px; }
.ral { display: inline-flex; align-items: center; gap: 6px; white-space: nowrap; }
.pastille-ral { flex: none; width: 16px; height: 12px; border-radius: 2px; box-shadow: inset 0 0 0 1px rgb(0 0 0 / 18%); }
table.planning th[scope="row"] { padding: 8px var(--e-3) 8px 0; border-bottom: 1px solid var(--bord); color: var(--texte);
  font-size: var(--t-s); font-weight: 400; white-space: normal; }
table.planning tr.prochain th, table.planning tr.prochain td { font-weight: 700; }
table.planning td { white-space: nowrap; }
table.planning td.retard { color: var(--alert); }
.ecart { color: var(--warn); font-weight: 650; }
.ecart.avance { color: var(--ok); }
.gantt { margin-top: var(--e-4); }
.phases { margin: 0; padding: 0; list-style: none; }
.phases li { display: grid; grid-template-columns: minmax(7rem, 36%) minmax(0, 1fr); align-items: center; column-gap: var(--e-2); }
.phase-nom { font-size: var(--t-xs); line-height: 1.25; }
.phase-nom small { display: block; }
.piste { position: relative; height: 32px; }
.piste .prevu { position: absolute; top: 8px; height: 16px; border: 2px solid var(--lot); border-radius: 3px; }
.piste .reel { position: absolute; top: 12px; height: 8px; border-radius: 2px; background: var(--lot); }
.piste .aujourdhui { position: absolute; top: 0; bottom: 0; border-left: 1.5px solid var(--alert); }
.gantt-bornes { display: flex; justify-content: space-between; margin: 2px 0 0 calc(36% + var(--e-2)); font-size: var(--t-xs); }
.legende { margin: var(--e-1) 0 0; font-size: var(--t-xs); }
.tableau-bord td { white-space: normal; }
.tableau-bord td small { display: block; color: var(--doux); }
.tableau-bord small.retard { color: var(--alert); font-weight: 600; }
th.nombre, td.nombre { text-align: right; }
tr.close td { color: var(--doux); }
.filtres { display: flex; flex-wrap: wrap; gap: var(--e-2) var(--e-3); margin: 0 0 var(--e-3); }
.filtres label { flex: 1 1 9rem; }
.pagination { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); margin-top: var(--e-2); }
.pagination .meta { flex: 1; margin: 0; }
.jalons, .pieces, .journal { margin: 0; padding: 0; list-style: none; }
.jalons li, .pieces li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 2px var(--e-3); padding: 8px 0;
                          border-bottom: 1px solid var(--bord); }
.jalons li:last-child, .pieces li:last-child { border-bottom: 0; }
.jalons .quand, .pieces .quand { color: var(--doux); font-size: var(--t-s); }
.jalons .sans-date .libelle { color: var(--doux); }
.pieces .quoi { display: grid; gap: 2px; min-width: 0; }
.pieces .quoi small { padding-left: 17px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pieces .expire > .quand, .pieces .manquant > .quand, .versions .expire .quand { color: var(--alert); font-weight: 550; }
.pieces .manquant > .quand { color: var(--texte); }
.pieces .bientot > .quand, .versions .bientot .quand { color: var(--warn); font-weight: 550; }
.versions { flex-basis: 100%; margin: 2px 0 0; padding: 0 0 0 17px; list-style: none; }
.versions li { display: flex; flex-wrap: wrap; justify-content: space-between; gap: 0 var(--e-3); padding: 2px 0; border: 0; }
.versions .quand { font-size: var(--t-xs); }
.bloc-documents > .meta strong { color: var(--texte); }
.groupe h4:first-child { margin-top: var(--e-3); }
.journal li { padding: var(--e-2) 0; border-bottom: 1px solid var(--bord); }
.journal li:last-child { border-bottom: 0; }
.journal p { margin: 0; }
.journal .changements { margin: var(--e-2) 0 0; }
.bloc-text .texte { margin: 0; }

/* 12. Réglages, coûts ----------------------------------------------------------------------------------------------- */
.regle { margin: 0 0 var(--e-3); padding: var(--e-4); border: 1px solid var(--bord); border-radius: var(--r-3); }
.regle h3 { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); }
.delais { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--e-3); margin-top: var(--e-3); }
.delais label { flex: 0 1 12rem; }
.cases { margin: 0 0 var(--e-3); padding: 0; list-style: none; }
.cases li + li { border-top: 1px solid var(--bord); }
.cases .message { display: block; margin: var(--e-1) 0 0; padding: 4px 8px; font-size: var(--t-s); }
.jauge-texte { font-size: var(--t-l); }
.jauge { height: 10px; overflow: hidden; border-radius: var(--r-rond); background: var(--surface-3); }
.jauge span { display: block; height: 100%; background: var(--accent); }
.jauge.haute span { background: var(--warn); }

/* 13. Connexion ---------------------------------------------------------------------------------------------------- */
.connexion { display: grid; min-height: 100vh; min-height: 100dvh; place-items: center; padding: var(--e-10) var(--e-4); }
.connexion-boite { width: 100%; max-width: 66rem; }
.nom-produit { margin: 0 0 var(--e-6); font-size: var(--t-l); font-weight: 750; letter-spacing: -.01em; }
.connexion .sous-titre { margin-bottom: var(--e-8); }
/* Une carte par marque, sa démonstration et son espace vide dessous ; --org est l'accent de son pack. */
.metiers { display: grid; grid-template-columns: repeat(auto-fit, minmax(17.5rem, 1fr)); gap: var(--e-4); margin: 0; padding: 0;
  list-style: none; }
.metier { --org-pale: color-mix(in srgb, var(--org, var(--accent)) var(--org-mix, 9%), var(--surface));
  display: flex; flex-direction: column; gap: var(--e-4); padding: var(--e-5); border: 1px solid var(--bord);
  border-radius: var(--r-3); background: var(--surface); box-shadow: inset 0 3px 0 var(--org, var(--bord-fort)), var(--ombre-1); }
.metier-tete { display: flex; align-items: center; gap: var(--e-4); }
.metier-tete h2 { margin: 0; font-size: var(--t-xl); line-height: 1.25; }
.metier-tete .meta { margin: 2px 0 0; }
.metier-logo { display: block; flex: none; width: 72px; height: 72px; padding: 12px; border-radius: 14px;
  background: var(--org-pale); }
.metier-logo img { display: block; width: 100%; height: 100%; object-fit: contain; }
.metier-logo.symbole { display: grid; place-items: center; background: var(--org, var(--accent)); color: #fff; font-size: 28px; }
.organisations { display: grid; gap: var(--e-2); margin: auto 0 0; padding: 0; list-style: none; }
.organisation { position: relative; display: grid; grid-template-columns: minmax(0, 1fr) auto; justify-content: stretch; justify-items: start;
  gap: 2px var(--e-3); width: 100%; min-height: 64px; padding: var(--e-3) var(--e-3) var(--e-3) var(--e-4); border-color: var(--bord);
  border-radius: var(--r-2); font-weight: 400; text-align: left; }
.organisation:where(:not(:disabled)):hover { border-color: var(--org, var(--bord-champ)); background: var(--org-pale); }
.organisation[aria-current="true"] { border-color: var(--org, var(--bord-champ)); background: var(--org-pale); }
.organisation .meta { grid-column: 1; }
.organisation .icone { grid-row: 1 / span 2; grid-column: 2; align-self: center; color: var(--doux); }
.organisation[aria-busy="true"]::before { position: absolute; right: var(--e-4); } /* à la place de la flèche */
.organisation[aria-busy="true"] .icone { visibility: hidden; }
.org-badge { padding: 1px 8px; border: 1px solid transparent; border-radius: var(--r-rond); background: var(--org-pale);
  color: var(--texte); font-size: var(--t-s); font-weight: 650; }
.org-badge.vide { border: 1px dashed var(--bord-fort); background: none; color: var(--texte-2); }

/* 14. Annonces : un bandeau en haut (en bas, il cacherait la saisie), quelques secondes. --------------------------------------------------------------- */
.annonce { position: fixed; top: var(--e-4); left: 50%; z-index: 40; display: flex; gap: var(--e-3); align-items: center;
  max-width: min(36rem, calc(100vw - 32px)); padding: 10px var(--e-4); border-radius: var(--r-3); background: var(--texte);
  color: var(--fond); box-shadow: var(--ombre-3); transform: translateX(-50%); }
.annonce:empty { display: none; }
.annonce a { color: inherit; font-weight: 650; text-decoration-color: currentColor; white-space: nowrap; }

/* 15. Écrans plus étroits. Sous 1280 px la fiche passe par-dessus ; sous 900 px une colonne, le rail en tiroir. --- */
@media (max-width: 1279px) {
  .avec-fiche .coque { grid-template-columns: var(--rail) minmax(0, 1fr); }
  .droite { position: fixed; top: 0; right: 0; bottom: 0; z-index: 25; width: min(34rem, 100vw); box-shadow: var(--ombre-3); }
}
@media (max-width: 899px) {
  .coque, .avec-fiche .coque { display: flex; flex-direction: column; }
  .centre { flex: 1; }
  .barre-haut { display: flex; flex: none; align-items: center; gap: var(--e-2); min-height: 52px; padding: var(--e-1) var(--e-3);
                border-bottom: 1px solid var(--bord); background: var(--surface-2); }
  .barre-titre { overflow: hidden; font-weight: 650; text-overflow: ellipsis; white-space: nowrap; }
  .rail { position: fixed; top: 0; bottom: 0; left: 0; z-index: 30; width: min(20rem, 88vw); box-shadow: var(--ombre-3);
          transform: translateX(-105%); visibility: hidden; transition: transform .2s, visibility .2s; }
  .rail-ouvert .rail { transform: none; visibility: visible; }
  .rail-tete .fermer-rail { display: inline-flex; }
  .droite { width: 100%; }
  .colonne { padding: 0 var(--e-4); }
  .defile .colonne { padding-top: var(--e-4); }
  .tour.utilisateur { max-width: 92%; }
  .ligne .boutons { flex: 1 1 100%; }
  .rangement { flex-wrap: wrap; }
  .rangement select { flex: 1 1 100%; max-width: none; }
  input:not([type=checkbox]), select, textarea { font-size: 16px; } /* iOS ne zoome pas sur un champ à 16 px */
  .composer-bas .aide { visibility: hidden; }
}
/* Sous 640 px, les tableaux de la fiche et du tableau de bord deviennent des cartes empilées, un libellé par case. */
@media (max-width: 639px) {
  .bloc-liste .tableau { max-height: none; }
  .bloc-liste table, .bloc-liste tbody, .bloc-liste tr, .bloc-liste td,
  .tableau-bord, .tableau-bord tbody, .tableau-bord tr, .tableau-bord td { display: block; width: 100%; }
  .bloc-liste thead, .tableau-bord thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); }
  .bloc-liste tr, .tableau-bord tr { padding: var(--e-2) 0; border-bottom: 1px solid var(--bord); }
  .bloc-liste td, .tableau-bord td { display: grid; grid-template-columns: 7.5rem minmax(0, 1fr); gap: var(--e-2); padding: 3px 0;
    border: 0; text-align: left; white-space: normal; }
  .bloc-liste td::before, .tableau-bord td::before { content: attr(data-libelle); color: var(--doux); font-size: var(--t-xs); }
  .changements li { grid-template-columns: minmax(0, 1fr); }
  .carte-import { padding: var(--e-4); }
  .lot-actions .boutons { flex: 1 1 100%; }
  .lot-actions .boutons button { flex: 1; }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation-duration: 2s !important; }
}

/* Réglages : l'interrupteur d'une règle et les savoir-faire. */
.regle-tete { display: flex; align-items: flex-start; justify-content: space-between; gap: var(--e-3); }
.regle-tete h3 { margin: 0; }
.regle.eteinte .delais, .regle.eteinte > .meta { opacity: .55; }
.pastille.ok { margin-left: var(--e-2); background: var(--ok-fond); color: var(--ok); font-weight: 600; }
.pastille.neutre { margin-left: var(--e-2); font-weight: 600; }
.savoir-faire { padding: var(--e-2) 0; border-bottom: 1px solid var(--bord); }
.savoir-faire summary { cursor: pointer; font-weight: 600; min-height: 32px; }

/* Lot E1 : la dictée dans le composer, les écrans de Clerk, les savoir-faire modifiables. */
.composer .micro { flex: none; color: var(--texte-2); }
.composer .micro[aria-pressed=true] { background: var(--alert-fond); color: var(--alert); }
.composer .micro[aria-pressed=true] .icone { animation: battement 1.2s ease-in-out infinite; }
@keyframes battement { 50% { opacity: .35; } }
.micro-etat { flex: 1; min-width: 0; font-size: var(--t-xs); color: var(--texte-2); }
.micro-etat:empty { display: none; }
.micro-etat:not(:empty) ~ .aide { display: none; }
.cadre-clerk { display: grid; justify-items: center; margin-bottom: var(--e-4); }
.savoir-faire-form { display: grid; gap: var(--e-3); margin-top: var(--e-2); }
.savoir-faire-form textarea { font-size: var(--t-s); }

/* Lot C : les contacts (onglets par rôle, pastille de suivi A/B/C, formulaire), et leur section dans la fiche. */
.roles-contacts { display: flex; flex-wrap: wrap; gap: 4px; margin: 0 0 var(--e-3); }
.onglet-role { display: inline-flex; align-items: center; min-height: 34px; padding: 0 12px; border: 1px solid var(--bord);
  border-radius: var(--r-rond); color: var(--texte-2); font-size: var(--t-s); font-weight: 600; text-decoration: none; }
.onglet-role:hover { background: var(--surface-3); }
.onglet-role[aria-current="page"] { border-color: var(--accent); background: var(--accent); color: var(--sur-accent); }
.recherche-contacts { max-width: 24rem; margin: 0 0 var(--e-3); }
.formulaire-contact { display: grid; gap: var(--e-3); max-width: 36rem; margin: 0 0 var(--e-6); padding: var(--e-4);
  border: 1px solid var(--bord); border-radius: var(--r-3); background: var(--surface); }
.pastille.suivi-A { background: var(--ok-fond); color: var(--ok); }
.pastille.suivi-B { background: var(--warn-fond); color: var(--warn); }
.pastille.suivi-C { background: var(--surface-3); color: var(--doux); }
.contact .pastille + .pastille { margin-left: var(--e-1); }
.bouton-lien { display: inline-flex; align-items: center; min-height: var(--cible); padding: 8px 16px;
  border: 1px solid var(--bord-fort); border-radius: var(--r-2); background: var(--surface); font-weight: 600;
  text-decoration: none; }
.contacts-lies { margin-top: var(--e-4); }
.contacts-lies h3 { margin-top: 0; }

/* Lot D : la visionneuse des fichiers d'un dossier (précédent, suivant, PDF assemblé, .zip), les pièces sensibles ou à
   confirmer dans la fiche, les alertes de la carte d'un brouillon. */
.visionneuse { width: min(1200px, 96vw); height: 92vh; padding: 0; border: 1px solid var(--bord); border-radius: var(--r-3);
  background: var(--surface); color: var(--texte); display: grid; grid-template: auto 1fr / 1fr 18rem; }
.visionneuse:not([open]) { display: none; }
.visionneuse::backdrop { background: rgb(0 0 0 / .45); }
.visionneuse-tete { grid-column: 1 / -1; display: flex; justify-content: space-between; align-items: center;
  gap: var(--e-3); padding: var(--e-3) var(--e-4); border-bottom: 1px solid var(--bord); }
.visionneuse-tete h2 { margin: 0; font-size: var(--t-m); overflow-wrap: anywhere; }
.visionneuse-tete .meta { margin: 0; }
.vue-fichier { min-height: 0; background: var(--surface-3); display: grid; place-items: center; overflow: auto; }
.vue-fichier iframe { width: 100%; height: 100%; border: 0; }
.vue-fichier img { max-width: 100%; max-height: 100%; object-fit: contain; }
.choix-fichiers { min-height: 0; overflow: auto; padding: var(--e-3); border-left: 1px solid var(--bord);
  display: flex; flex-direction: column; gap: var(--e-3); }
.liste-fichiers { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.liste-fichiers li { display: flex; align-items: center; gap: var(--e-1); }
.liste-fichiers li button { flex: 1; min-width: 0; justify-content: flex-start; text-align: left; overflow-wrap: anywhere; }
.liste-fichiers li[aria-current] button { font-weight: 700; color: var(--accent-texte); }
.liste-fichiers .groupe-fichiers { margin-top: var(--e-2); font-size: var(--t-xs); font-weight: 600; color: var(--doux); }
.choix-fichiers a[aria-disabled=true] { opacity: .5; pointer-events: none; }
.sensible { margin-left: var(--e-1); padding: 0 6px; border-radius: var(--r-rond); background: var(--warn-fond);
  color: var(--warn); font-size: var(--t-xs); }
.alertes-brouillon { list-style: none; margin: 0 0 var(--e-2); padding: 0; display: grid; gap: var(--e-1); }
@media (max-width: 760px) {
  .visionneuse { grid-template: auto 1fr auto / 1fr; }
  .choix-fichiers { border-left: 0; border-top: 1px solid var(--bord); max-height: 35vh; }
}

/* Lot A : les réglages de l'organisation (parcours de la boîte mail et de l'agenda, repris de domovo, liens utiles) et
   la page Agenda (semaine en grille horaire sur grand écran, en liste sur petit ; --de, --a en minutes depuis minuit). */
.repli { margin: var(--e-3) 0; }
.repli > summary, .partie details > summary { min-height: 32px; cursor: pointer; font-weight: 600; }
.parcours { margin: var(--e-4) 0 0; padding: 0; list-style: none; counter-reset: pas; }
.parcours > li { position: relative; margin: 0 0 var(--e-5); padding-left: 2.5rem; counter-increment: pas; }
.parcours > li::before { content: counter(pas); position: absolute; left: 0; top: 0; display: grid; place-items: center;
  width: 1.75rem; height: 1.75rem; border-radius: 50%; background: var(--accent-pale); color: var(--accent-texte);
  font-size: var(--t-s); font-weight: 650; }
.parcours > li > h3 { line-height: 1.75rem; }
.parcours ul { margin: 0 0 var(--e-3); padding-left: 1.1rem; }
.parcours label + label, .parcours label + .case { margin-top: var(--e-2); }
#lien-google { display: block; overflow-wrap: anywhere; }
.liens-utiles { margin-bottom: var(--e-3); }
.lien-utile { display: grid; grid-template-columns: minmax(8rem, 1fr) minmax(12rem, 2fr) auto; align-items: end; gap: var(--e-2);
  padding: var(--e-2) 0; }
a.bouton { display: inline-flex; align-items: center; justify-content: center; gap: var(--e-2); min-height: var(--cible);
  padding: 8px 16px; border: 1px solid var(--bord-fort); border-radius: var(--r-2); background: var(--surface);
  color: var(--texte); font-weight: 600; text-decoration: none; }
a.bouton:hover { border-color: var(--bord-champ); background: var(--surface-2); }
a.bouton.icone-seule { width: var(--cible); padding: 0; }

.ag-grille { --ligne: 3rem; display: grid; grid-template-columns: 3.5rem repeat(7, minmax(0, 1fr)); margin: var(--e-4) 0;
  border: 1px solid var(--bord); border-radius: var(--r-3); background: var(--surface); overflow: hidden; }
.ag-coin, .ag-jour, .ag-journees { border-bottom: 1px solid var(--bord); }
.ag-jour { display: grid; justify-items: center; padding: var(--e-2) 0; border-left: 1px solid var(--bord); font-size: var(--t-s); }
.ag-jour span { color: var(--doux); }
.ag-jour.jour-j strong { display: grid; place-items: center; width: 1.9rem; height: 1.9rem; border-radius: 50%;
  background: var(--accent); color: var(--sur-accent); }
.ag-coin.meta { display: grid; align-items: center; padding: 0 var(--e-1); font-size: var(--t-xs); }
.ag-journees { display: grid; gap: 2px; align-content: start; min-height: 1.8rem; padding: 2px; border-left: 1px solid var(--bord); }
.ag-rdv-journee { overflow: hidden; padding: 1px 6px; border-radius: var(--r-1); background: var(--accent-pale);
  color: var(--texte); font-size: var(--t-xs); white-space: nowrap; text-overflow: ellipsis; }
.ag-heures { position: relative; height: calc(var(--heures) * var(--ligne)); }
.ag-heures span { position: absolute; top: calc(var(--i) * var(--ligne)); right: var(--e-1); color: var(--doux);
  font-size: var(--t-xs); transform: translateY(-50%); }
.ag-heures span:first-child { transform: none; }
.ag-colonne { position: relative; height: calc(var(--heures) * var(--ligne)); border-left: 1px solid var(--bord);
  background: repeating-linear-gradient(to bottom, transparent 0 calc(var(--ligne) - 1px), var(--bord) 0 var(--ligne)); }
.ag-colonne.jour-j { background-color: var(--surface-2); }
.ag-rdv { position: absolute; top: calc((var(--de) - var(--premiere)) / 60 * var(--ligne));
  height: calc((var(--a) - var(--de)) / 60 * var(--ligne) - 2px); left: calc(var(--voie) / var(--voies) * 100% + 2px);
  width: calc(100% / var(--voies) - 4px); display: grid; align-content: start; overflow: hidden; padding: 2px 6px;
  border-left: 3px solid var(--accent); border-radius: var(--r-1); background: var(--accent-pale); color: var(--texte);
  font-size: var(--t-xs); line-height: 1.3; }
.ag-rdv strong { overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.ag-rdv span { color: var(--texte-2); }
.ag-rdv.court span { display: none; }
.ag-rdv.appli, .ag-rdv-journee.appli { border: 1px dashed var(--accent-bord); border-left: 3px solid var(--or); background: var(--or-fond); }
.ag-liste { display: none; }
.ag-jour-liste h3 { margin-top: var(--e-4); text-transform: capitalize; }
@media (max-width: 899px) {
  .ag-grille { display: none; }
  .ag-liste { display: block; }
  .lien-utile { grid-template-columns: 1fr; }
}

/* Lot B : les routines (horaire, texte, dernière exécution), l'historique, les choses à faire d'« Aujourd'hui ». */
.routine-horaire { display: flex; flex-wrap: wrap; align-items: flex-end; gap: var(--e-2); margin: var(--e-2) 0; }
.routine-horaire label { flex: 0 1 14rem; }
.routine-horaire .aide { flex-basis: 100%; margin: 0; }
.routine-texte textarea { width: 100%; font-family: inherit; }
.routine-texte summary { cursor: pointer; }
.routine-cr { display: block; margin-top: 2px; color: var(--texte); white-space: pre-line; }
.regle.eteinte .routine-horaire { opacity: .55; }
.a-faire-ajout { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); margin-top: var(--e-3); }
.a-faire-ajout input[type=text] { flex: 1 1 16rem; }
.a-faire-ajout [role=status] { flex-basis: 100%; }

/* Lot E2 : la page Import (listes, annonces, ébauches à cocher), le bandeau d'un mail suspect, la conservation. */
.carte-import { padding: var(--e-5) var(--e-6) var(--e-6); border: 1px solid var(--bord); border-radius: var(--r-3);
  background: var(--surface-2); }
.carte-import form { display: grid; gap: var(--e-5); }
h2:has(> .etape) { display: flex; align-items: center; gap: var(--e-2); }
.etape-bloc { display: grid; gap: var(--e-3); min-width: 0; margin: 0; padding: 0; border: 0; }
.etape-bloc legend { display: flex; align-items: center; gap: var(--e-2); margin-bottom: var(--e-3); padding: 0;
  font-weight: 650; }
.etape { display: inline-grid; flex: none; place-items: center; width: 24px; height: 24px; border-radius: 50%;
  background: var(--accent-pale); color: var(--accent-texte); font-size: var(--t-xs); font-weight: 750; }
.choix-genre { display: flex; flex-wrap: wrap; gap: var(--e-2); }
.choix-genre label { display: flex; align-items: center; gap: var(--e-2); min-height: var(--cible); padding: 6px 14px 6px 10px;
  border: 1px solid var(--bord-fort); border-radius: var(--r-rond); background: var(--surface); color: var(--texte);
  font-size: var(--t-m); font-weight: 550; cursor: pointer; }
.choix-genre label:has(:checked) { border-color: var(--accent); background: var(--accent-pale); }
.choix-genre input { display: inline-block; width: 18px; height: 18px; min-height: 0; margin: 0; padding: 0; accent-color: var(--accent); }
.import-choix { display: flex; flex-wrap: wrap; gap: var(--e-3); }
.import-choix label { flex: 0 1 20rem; }
.zone-fichier input[type=file] { min-height: 56px; padding: var(--e-3); border: 1px dashed var(--bord-champ); background: var(--surface);
  cursor: pointer; }
.zone-fichier input[type=file]:hover { border-color: var(--accent); }
.carte-import .aide { margin: 0; }
/* Les lignes lues : une case alignée à gauche, toute la ligne la coche ; ce qui reste à vérifier en orange. */
.lot-import { margin: 0 0 var(--e-5); border: 1px solid var(--bord); border-radius: var(--r-3); background: var(--surface); }
.lot-import > header { padding: var(--e-3) var(--e-4); border-bottom: 1px solid var(--bord); }
.lot-import h3 { margin: 0; font-size: var(--t-m); }
.lot-import header .meta { margin: 0; }
.ebauches { margin: 0; padding: 0; list-style: none; }
.ebauche + .ebauche { border-top: 1px solid var(--bord); }
.ebauche > label, .ebauche > div { display: grid; grid-template-columns: 20px 2rem minmax(0, 1fr) auto; gap: 2px var(--e-3);
  align-items: start; padding: var(--e-3) var(--e-4); color: var(--texte); font-size: var(--t-m); font-weight: 400; }
.ebauche > label { cursor: pointer; }
.ebauche > label:hover { background: var(--surface-2); }
.ebauche > label:has(:checked) { background: var(--accent-pale); }
.ebauche input[type=checkbox] { margin-top: 1px; }
.ebauche-n { padding-top: 1px; color: var(--pale); font-size: var(--t-s); font-variant-numeric: tabular-nums; text-align: right; }
.ebauche-corps { display: grid; gap: 2px; min-width: 0; overflow-wrap: anywhere; }
.incertitude, .refus { justify-self: start; margin-top: 2px; padding: 2px 8px; border-radius: var(--r-1); font-size: var(--t-s); }
.incertitude { background: var(--warn-fond); color: var(--warn); }
.refus { background: var(--alert-fond); color: var(--alert); }
.ebauche-statut .icone { width: 18px; height: 18px; color: var(--doux); }
.ebauche.creee .ebauche-statut .icone { color: var(--ok); }
.ebauche.creee .ebauche-corps { color: var(--doux); }
.ebauche-cree { color: var(--ok); font-size: var(--t-s); font-weight: 600; white-space: nowrap; }
.lot-actions { position: sticky; bottom: 0; z-index: 2; display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2) var(--e-3);
  padding: var(--e-3) var(--e-4); border-top: 1px solid var(--bord); border-radius: 0 0 var(--r-3) var(--r-3);
  background: var(--surface-2); }
.lot-compte { flex: 1; color: var(--doux); font-size: var(--t-s); }
.lot-actions .boutons { margin-left: auto; }
.lot-import > [role=status]:not(:empty) { padding: 0 var(--e-4) var(--e-2); }
.lots-finis summary { padding: var(--e-2) 0; color: var(--texte-2); font-weight: 600; cursor: pointer; }
.lots-finis[open] summary { margin-bottom: var(--e-3); }
.depot-documents { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); }
.depot-documents select { flex: 1 1 16rem; margin: 0; }
.message.suspect { display: flex; flex-wrap: wrap; align-items: center; gap: var(--e-2); margin: var(--e-2) 0; }
.message.suspect p { flex: 1 1 20rem; margin: 0; }
.conservation { display: grid; grid-template-columns: repeat(auto-fill, minmax(16rem, 1fr)); gap: var(--e-3); }
.conservation input { max-width: 8rem; }
