/* HUBBY — Portail DN · design system v3
   Palette froide (slate) + accent orange CFDT #E7591C · thème clair / sombre
   Typographie : Montserrat · zéro ton chaud dans les fonds */

:root {
  /* Accent CFDT */
  --orange: #e7591c;
  --orange-vif: #f4682a;
  --orange-fonce: #c74811;
  --orange-pale: #fdeade;
  --orange-lueur: rgba(231, 89, 28, 0.3);

  /* Neutres froids (clair) */
  --fond: #f4f6fa;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --encre: #0f172a;
  --texte: #334155;
  --texte-2: #64748b;
  --trait: #e2e8f0;
  --trait-fort: #cbd5e1;

  /* Sidebar (bleu nuit, identique dans les 2 thèmes) */
  --nav-haut: #101b33;
  --nav-bas: #0b1428;
  --nav-texte: rgba(226, 232, 240, 0.68);
  --nav-bord: rgba(148, 163, 184, 0.12);

  /* Statuts */
  --bleu: #2563eb;      --bleu-pale: #e8eefc;
  --vert: #15803d;      --vert-pale: #e3f3e9;
  --rouge: #dc2626;     --rouge-pale: #fdeaea;
  --neutre: #64748b;    --neutre-pale: #eef2f6;
  --jaune-pale: #fdf3dc; --jaune: #92610a;

  --ease-out: cubic-bezier(0.23, 1, 0.32, 1);
  --ease-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
  --ombre: 0 1px 2px rgba(15, 23, 42, 0.05), 0 10px 30px -18px rgba(15, 23, 42, 0.22);
  --ombre-haute: 0 2px 6px rgba(15, 23, 42, 0.06), 0 22px 44px -20px rgba(15, 23, 42, 0.3);
  --ombre-orange: 0 8px 22px -8px var(--orange-lueur);
  --halo: radial-gradient(1100px 460px at 85% -180px, rgba(37, 99, 235, 0.06) 0%, rgba(37, 99, 235, 0) 65%);
}

[data-theme="sombre"] {
  --orange-pale: rgba(244, 104, 42, 0.16);
  --orange-lueur: rgba(231, 89, 28, 0.4);

  --fond: #0b1220;
  --surface: #121b2d;
  --surface-2: #182338;
  --encre: #f1f5f9;
  --texte: #cbd5e1;
  --texte-2: #8fa0b8;
  --trait: #223047;
  --trait-fort: #344863;

  --nav-haut: #0e1830;
  --nav-bas: #0a1122;
  --nav-bord: rgba(148, 163, 184, 0.1);

  --bleu: #7fabf7;      --bleu-pale: rgba(59, 130, 246, 0.17);
  --vert: #5cc283;      --vert-pale: rgba(34, 197, 94, 0.15);
  --rouge: #f08a84;     --rouge-pale: rgba(239, 68, 68, 0.16);
  --neutre: #97a7bd;    --neutre-pale: rgba(148, 163, 184, 0.14);
  --jaune-pale: rgba(217, 158, 41, 0.16); --jaune: #e3b45e;

  --ombre: 0 1px 2px rgba(0, 0, 0, 0.3), 0 12px 32px -18px rgba(0, 0, 0, 0.6);
  --ombre-haute: 0 2px 6px rgba(0, 0, 0, 0.35), 0 24px 48px -20px rgba(0, 0, 0, 0.7);
  --halo: radial-gradient(1100px 460px at 85% -180px, rgba(59, 130, 246, 0.08) 0%, rgba(59, 130, 246, 0) 65%);
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: "Montserrat", system-ui, -apple-system, "Segoe UI", sans-serif;
  font-size: 15px;
  line-height: 1.6;
  color: var(--texte);
  background: var(--halo), var(--fond);
  background-attachment: fixed;
  transition: background-color 250ms ease, color 250ms ease;
}
::selection { background: var(--orange-pale); color: var(--orange-fonce); }
[data-theme="sombre"] ::selection { color: var(--orange-vif); }
h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -0.025em; margin: 0; color: var(--encre); text-wrap: balance; }
h2 { font-size: 1.02rem; font-weight: 700; margin: 0 0 0.75rem; color: var(--encre); letter-spacing: -0.01em; }
h3 { font-size: 0.95rem; font-weight: 700; margin: 0 0 0.4rem; color: var(--encre); }
a { color: var(--orange-fonce); }
[data-theme="sombre"] a { color: var(--orange-vif); }
p { max-width: 72ch; }
small { color: var(--texte-2); }
.discret { color: var(--texte-2); }

/* --- Structure ------------------------------------------------------- */
.coquille { display: flex; min-height: 100dvh; }
.lateral {
  width: 260px; flex-shrink: 0;
  background:
    radial-gradient(420px 240px at 50% -70px, rgba(231, 89, 28, 0.14) 0%, rgba(231, 89, 28, 0) 70%),
    linear-gradient(180deg, var(--nav-haut) 0%, var(--nav-bas) 55%);
  border-right: 1px solid var(--nav-bord);
  display: flex; flex-direction: column;
  padding: 1.5rem 1rem;
  position: sticky; top: 0; height: 100dvh;
}
.contenu { flex: 1; padding: 2.6rem 3.2rem 2rem; min-width: 0; max-width: 1080px; display: flex; flex-direction: column; }
.contenu > *:last-child { margin-top: auto; }
.pied {
  margin-top: 3rem; padding-top: 1.2rem;
  border-top: 1px solid var(--trait);
  font-size: 0.78rem; color: var(--texte-2);
}

.marque { display: flex; gap: 0.7rem; align-items: center; text-decoration: none; margin: 0.2rem 0.35rem 2rem; }
.marque img {
  display: block; border-radius: 13px;
  background: rgba(255, 255, 255, 0.09); padding: 4px;
  transition: transform 240ms var(--ease-spring);
}
.marque:hover img { transform: rotate(-7deg) scale(1.08); }
.marque-texte { font-weight: 900; line-height: 1.12; color: #fff; font-size: 1.32rem; letter-spacing: 0.03em; }
.marque-texte small { display: block; font-weight: 600; font-size: 0.63rem; color: #f59e77; letter-spacing: 0.06em; text-transform: uppercase; }

.lateral nav { display: flex; flex-direction: column; gap: 0.25rem; }
.lateral nav a {
  display: flex; align-items: center; gap: 0.7rem;
  color: var(--nav-texte); text-decoration: none;
  padding: 0.66rem 0.9rem; border-radius: 11px;
  font-weight: 600; font-size: 0.9rem;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.lateral nav svg { width: 17px; height: 17px; fill: currentColor; opacity: 0.85; flex-shrink: 0; transition: transform 200ms var(--ease-spring); }
.lateral nav a:hover { background: rgba(148, 163, 184, 0.12); color: #fff; }
.lateral nav a:hover svg { transform: scale(1.1); }
.lateral nav a.actif {
  background: linear-gradient(135deg, var(--orange-vif), var(--orange));
  color: #fff;
  box-shadow: var(--ombre-orange), inset 0 1px 0 rgba(255, 255, 255, 0.22);
}
.lateral nav a.actif svg { opacity: 1; }

.lateral-pied { margin-top: auto; display: flex; flex-direction: column; gap: 0.6rem; }
.mode-simu {
  background: rgba(231, 89, 28, 0.15); color: #f5a87f;
  border: 1px solid rgba(231, 89, 28, 0.32);
  border-radius: 10px; padding: 0.45rem 0.65rem; margin: 0;
  font-weight: 600; font-size: 0.72rem; text-align: center;
}
.btn-theme {
  display: flex; align-items: center; gap: 0.55rem;
  width: 100%; border: 1px solid var(--nav-bord); border-radius: 11px;
  background: rgba(148, 163, 184, 0.07); color: var(--nav-texte);
  padding: 0.55rem 0.85rem; font: inherit; font-weight: 600; font-size: 0.82rem;
  cursor: pointer;
  transition: background-color 160ms var(--ease-out), color 160ms var(--ease-out);
}
.btn-theme:hover { background: rgba(148, 163, 184, 0.15); color: #fff; }
.btn-theme svg { width: 16px; height: 16px; flex-shrink: 0; }
.btn-theme .ic-lune { display: block; }
.btn-theme .ic-soleil { display: none; }
[data-theme="sombre"] .btn-theme .ic-lune { display: none; }
[data-theme="sombre"] .btn-theme .ic-soleil { display: block; }
.qui-carte {
  display: flex; align-items: center; gap: 0.65rem;
  padding: 0.7rem 0.6rem; border-radius: 13px;
  background: rgba(148, 163, 184, 0.07);
  border: 1px solid var(--nav-bord);
}
.qui-pastille {
  display: grid; place-items: center; flex-shrink: 0;
  width: 38px; height: 38px; border-radius: 12px;
  background: linear-gradient(135deg, var(--orange-vif), var(--orange-fonce));
  color: #fff; font-weight: 800;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.qui-infos { line-height: 1.3; min-width: 0; }
.qui-infos strong { display: block; font-size: 0.85rem; color: #fff; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.qui-infos a { font-size: 0.76rem; color: rgba(226, 232, 240, 0.5); }
.qui-infos a:hover { color: #f59e77; }
.qui-deconnexion { display: none; }  /* visible seulement sur mobile (voir @media) */

/* --- Entête de page ---------------------------------------------------- */
.entete { display: flex; justify-content: space-between; align-items: flex-start; gap: 1.5rem; margin-bottom: 1.7rem; }
.entete-sous { color: var(--texte-2); margin: 0.45rem 0 0; }
.entete-icone { flex-shrink: 0; filter: drop-shadow(0 10px 18px rgba(15, 23, 42, 0.18)); }
.entete-actions { display: flex; align-items: center; gap: 0.7rem; flex-shrink: 0; }
.fil { font-size: 0.82rem; color: var(--texte-2); margin: 0 0 0.5rem; font-weight: 600; }
.fil a { color: inherit; text-decoration: none; }
.fil a:hover { color: var(--orange-fonce); }
.entete-date {
  display: inline-block; font-size: 0.76rem; font-weight: 700;
  color: var(--orange); text-transform: uppercase; letter-spacing: 0.09em;
  margin: 0 0 0.35rem;
}

/* --- Boutons ------------------------------------------------------------ */
.bouton, button[type="submit"]:not(.btn-icone) {
  display: inline-block;
  background: linear-gradient(135deg, var(--orange-vif), var(--orange));
  color: #fff;
  border: 0; border-radius: 11px;
  padding: 0.66rem 1.3rem;
  font: inherit; font-weight: 700; font-size: 0.9rem;
  text-decoration: none; cursor: pointer;
  box-shadow: var(--ombre-orange), inset 0 1px 0 rgba(255, 255, 255, 0.25);
  transition: filter 160ms var(--ease-out), box-shadow 160ms var(--ease-out), transform 160ms var(--ease-out);
}
.bouton:hover, button[type="submit"]:not(.btn-icone):hover { filter: brightness(1.07); box-shadow: 0 10px 26px -8px var(--orange-lueur), inset 0 1px 0 rgba(255, 255, 255, 0.25); }
.bouton:active, button[type="submit"]:not(.btn-icone):active { transform: scale(0.97); }
.bouton:focus-visible, button:focus-visible, a:focus-visible {
  outline: 2px solid var(--orange); outline-offset: 2px;
}
button[disabled] { opacity: 0.6; cursor: progress; transform: none; }
.bouton-second {
  background: var(--surface); color: var(--encre);
  border: 1px solid var(--trait-fort); box-shadow: var(--ombre);
}
.bouton-second:hover { background: var(--orange-pale); border-color: var(--orange); color: var(--orange-fonce); filter: none; }
[data-theme="sombre"] .bouton-second:hover { color: var(--orange-vif); }
.lien-discret { font-size: 0.85rem; color: var(--texte-2); align-self: center; }

/* --- Aperçu chiffres (dashboard) ------------------------------------------ */
.apercu { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.8rem; margin-bottom: 1.4rem; }
.apercu-carte {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; gap: 0.15rem;
  background: var(--surface);
  border: 1px solid var(--trait); border-radius: 16px;
  padding: 1rem 1.15rem 0.9rem; text-decoration: none;
  box-shadow: var(--ombre);
  animation: apparition 400ms var(--ease-out) both; animation-delay: var(--retard, 0ms);
  transition: border-color 160ms var(--ease-out), box-shadow 160ms var(--ease-out);
}
a.apercu-carte { cursor: pointer; }
.apercu-carte::after {
  content: ""; position: absolute; inset: 0 0 auto;
  height: 3px; background: var(--accent-statut, var(--trait));
  opacity: 0; transition: opacity 160ms var(--ease-out);
}
.apercu-carte:hover { border-color: var(--trait-fort); box-shadow: var(--ombre-haute); }
.apercu-carte:hover::after { opacity: 1; }
.apercu-carte strong { font-size: 1.7rem; font-weight: 800; color: var(--encre); line-height: 1.1; font-variant-numeric: tabular-nums; letter-spacing: -0.02em; }
.apercu-carte span { display: flex; align-items: center; gap: 0.45rem; font-size: 0.78rem; font-weight: 600; color: var(--texte-2); }
.apercu-actif { border-color: var(--orange); }
.apercu-actif::after { opacity: 1; background: var(--orange); }
.puce { width: 8px; height: 8px; border-radius: 50%; display: inline-block; box-shadow: 0 0 0 3px color-mix(in srgb, currentColor 15%, transparent); }
.puce-en_attente { background: var(--neutre); color: var(--neutre); }
.puce-en_cours { background: var(--bleu); color: var(--bleu); }
.puce-termine { background: var(--vert); color: var(--vert); }
.puce-erreur { background: var(--rouge); color: var(--rouge); }

/* --- Filtres & recherche --------------------------------------------------- */
.filtres { display: flex; flex-wrap: wrap; gap: 0.6rem; margin-bottom: 1.3rem; align-items: center; }
.filtres select {
  font: inherit; font-size: 0.87rem; font-weight: 600; color: var(--encre);
  border: 1px solid var(--trait-fort); border-radius: 11px;
  background: var(--surface); padding: 0.5rem 0.75rem;
  box-shadow: var(--ombre); cursor: pointer;
  transition: border-color 140ms var(--ease-out);
}
.filtres select:hover { border-color: var(--orange); }
.case { display: flex; align-items: center; gap: 0.45rem; font-size: 0.87rem; color: var(--texte); font-weight: 600; cursor: pointer; }
.case input { accent-color: var(--orange); width: 15px; height: 15px; cursor: pointer; }
.recherche { position: relative; flex: 1; min-width: 220px; max-width: 340px; }
.recherche input {
  width: 100%; font: inherit; font-size: 0.88rem; color: var(--encre);
  border: 1px solid var(--trait-fort); border-radius: 11px;
  background: var(--surface); padding: 0.5rem 0.8rem 0.5rem 2.3rem;
  box-shadow: var(--ombre);
  transition: border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
.recherche input:focus-visible { outline: 0; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-pale); }
.recherche svg {
  position: absolute; left: 0.75rem; top: 50%; transform: translateY(-50%);
  width: 15px; height: 15px; fill: var(--texte-2); pointer-events: none;
}

/* --- Liste des demandes ---------------------------------------------------- */
.liste-demandes { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.6rem; }
.liste-demandes > li { animation: apparition 400ms var(--ease-out) both; animation-delay: var(--retard, 0ms); }
@keyframes apparition { from { opacity: 0; transform: translateY(9px); } }
.ligne {
  display: flex; align-items: center; gap: 1.05rem;
  background: var(--surface);
  border: 1px solid var(--trait); border-radius: 16px;
  padding: 0.9rem 1.2rem;
  text-decoration: none; color: inherit; cursor: pointer;
  box-shadow: var(--ombre);
  transition: border-color 180ms var(--ease-out), box-shadow 180ms var(--ease-out);
}
.ligne:hover { border-color: var(--orange); box-shadow: var(--ombre-haute); }
.ligne-icone {
  flex-shrink: 0; border-radius: 12px; padding: 5px;
  background: var(--surface-2);
  border: 1px solid var(--trait);
  transition: transform 220ms var(--ease-spring);
}
.ligne:hover .ligne-icone { transform: scale(1.07) rotate(-3deg); }
.ligne-corps { min-width: 0; flex: 1; display: flex; flex-direction: column; gap: 0.12rem; }
.ligne-titre { font-weight: 700; color: var(--encre); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-titre .version { font-style: normal; color: var(--bleu); font-weight: 700; font-size: 0.8rem; background: var(--bleu-pale); border-radius: 6px; padding: 0.05rem 0.4rem; }
.ligne-meta { font-size: 0.8rem; color: var(--texte-2); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ligne-meta b { font-weight: 700; }

/* --- Badges de statut --------------------------------------------------------- */
.badge {
  font-size: 0.76rem; font-weight: 700; flex-shrink: 0;
  padding: 0.32rem 0.75rem; border-radius: 999px; white-space: nowrap;
}
.badge-grand { font-size: 0.85rem; padding: 0.45rem 1rem; }
.badge-en_attente { background: var(--neutre-pale); color: var(--neutre); }
.badge-en_cours  { background: var(--bleu-pale); color: var(--bleu); }
.badge-termine   { background: var(--vert-pale); color: var(--vert); }
.badge-erreur    { background: var(--rouge-pale); color: var(--rouge); }
.badge-en_cours::before {
  content: ""; display: inline-block;
  width: 0.5em; height: 0.5em; margin-right: 0.45em;
  border-radius: 50%; background: currentColor;
  animation: pulsation 1.2s ease-in-out infinite;
}
@keyframes pulsation { 50% { opacity: 0.25; } }

/* --- Jalons (timeline de statut) ------------------------------------------------ */
.jalons {
  display: flex; align-items: flex-start;
  list-style: none; margin: 0 0 1.4rem; padding: 1.1rem 1.4rem;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 16px;
  box-shadow: var(--ombre);
}
.jalons li { flex: 1; position: relative; text-align: center; font-size: 0.78rem; font-weight: 700; color: var(--texte-2); }
.jalons li::before {
  content: ""; display: block; margin: 0 auto 0.45rem;
  width: 26px; height: 26px; border-radius: 50%;
  background: var(--surface-2); border: 2px solid var(--trait-fort);
  transition: all 200ms var(--ease-out);
}
.jalons li::after {
  content: ""; position: absolute; top: 12px; left: calc(-50% + 15px); right: calc(50% + 15px);
  height: 2px; border-radius: 2px; background: var(--trait-fort);
}
.jalons li:first-child::after { display: none; }
.jalons .fait { color: var(--vert); }
.jalons .fait::before {
  background: var(--vert); border-color: var(--vert);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath fill='%23fff' d='M8.2 13.4 4.8 10l-1.3 1.3 4.7 4.7 8.3-8.3-1.3-1.3z'/%3E%3C/svg%3E");
  background-size: 15px; background-position: center; background-repeat: no-repeat;
}
[data-theme="sombre"] .jalons .fait::before { background-color: #1d7a43; border-color: #1d7a43; }
.jalons .fait::after { background: var(--vert); }
.jalons .actif { color: var(--orange); }
.jalons .actif::before {
  background: var(--orange-pale); border-color: var(--orange);
  box-shadow: 0 0 0 5px color-mix(in srgb, var(--orange) 15%, transparent);
  animation: pulsation-jalon 1.6s ease-in-out infinite;
}
.jalons .actif::after { background: linear-gradient(90deg, var(--vert), var(--orange)); }
@keyframes pulsation-jalon { 50% { box-shadow: 0 0 0 9px color-mix(in srgb, var(--orange) 7%, transparent); } }
.jalons .rate { color: var(--rouge); }
.jalons .rate::before {
  background: var(--rouge-pale); border-color: var(--rouge);
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 20 20'%3E%3Cpath d='m6 6 8 8M14 6l-8 8' stroke='%23dc2626' stroke-width='2' stroke-linecap='round'/%3E%3C/svg%3E");
  background-size: 13px; background-position: center; background-repeat: no-repeat;
}
.jalons .rate::after { background: var(--rouge); }

/* --- Panneaux ------------------------------------------------------------------- */
.panneau {
  background: var(--surface);
  border: 1px solid var(--trait); border-radius: 16px;
  padding: 1.5rem 1.7rem; margin-bottom: 1.2rem;
  box-shadow: var(--ombre);
  animation: apparition 400ms var(--ease-out) both;
}
.panneau-resultat {
  border-color: color-mix(in srgb, var(--orange) 45%, var(--trait));
  background:
    radial-gradient(520px 130px at 10% 0%, var(--orange-pale) 0%, transparent 70%),
    var(--surface);
}
.panneau-attente {
  border-color: color-mix(in srgb, var(--bleu) 30%, var(--trait));
  background:
    radial-gradient(520px 130px at 10% 0%, var(--bleu-pale) 0%, transparent 70%),
    var(--surface);
}
.panneau-erreur {
  border-color: color-mix(in srgb, var(--rouge) 30%, var(--trait));
  background:
    radial-gradient(520px 130px at 10% 0%, var(--rouge-pale) 0%, transparent 70%),
    var(--surface);
}
.erreur-detail { color: var(--rouge); font-size: 0.9rem; word-break: break-word; }

.progression { height: 6px; border-radius: 3px; background: var(--bleu-pale); overflow: hidden; margin-top: 1rem; }
.progression span {
  display: block; height: 100%; width: 40%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--orange-vif), var(--orange));
  animation: navette 1.6s var(--ease-out) infinite alternate;
}
@keyframes navette { from { transform: translateX(-60%); } to { transform: translateX(230%); } }

.brief { margin: 0; display: grid; grid-template-columns: 150px 1fr; gap: 0.45rem 1.2rem; }
.brief dt { font-weight: 700; font-size: 0.83rem; color: var(--texte-2); padding-top: 0.1rem; }
.brief dd { margin: 0; white-space: pre-line; color: var(--encre); }

.refs { display: flex; flex-wrap: wrap; gap: 0.4rem; white-space: normal !important; }
.ref {
  font-size: 0.8rem; font-weight: 600; text-decoration: none;
  padding: 0.3rem 0.75rem; border-radius: 999px;
  border: 1px solid var(--trait-fort); color: var(--encre); background: var(--surface-2);
  transition: border-color 150ms var(--ease-out);
}
.ref:hover { border-color: var(--orange); color: var(--orange-fonce); }
.ref-accord { background: var(--orange-pale); border-color: color-mix(in srgb, var(--orange) 30%, var(--trait)); }
.ref-connaissance { background: var(--bleu-pale); border-color: color-mix(in srgb, var(--bleu) 25%, var(--trait)); }

/* --- Versions -------------------------------------------------------------------- */
.versions { display: flex; gap: 0.4rem; margin-bottom: 1.2rem; }
.versions a, .version-actif {
  padding: 0.34rem 0.9rem; border-radius: 999px;
  font-size: 0.85rem; font-weight: 700; text-decoration: none;
  border: 1px solid var(--trait-fort); background: var(--surface); color: var(--texte-2);
  box-shadow: var(--ombre);
  transition: border-color 150ms var(--ease-out), color 150ms var(--ease-out);
}
.versions a:hover { border-color: var(--orange); color: var(--orange-fonce); }
.version-actif {
  background: linear-gradient(135deg, var(--orange-vif), var(--orange));
  border-color: var(--orange); color: #fff;
  box-shadow: var(--ombre-orange);
}

/* --- Fichiers ---------------------------------------------------------------------- */
.fichier + .fichier { margin-top: 1rem; border-top: 1px solid var(--trait); padding-top: 1rem; }
.fichier-ligne { display: flex; align-items: center; gap: 0.8rem; flex-wrap: wrap; }
.fichier-nom { font-weight: 700; color: var(--encre); overflow-wrap: anywhere; }
.fichier-taille { color: var(--texte-2); font-size: 0.83rem; margin-right: auto; }
.apercu-pdf { width: 100%; height: 580px; border: 1px solid var(--trait); border-radius: 13px; margin-top: 1rem; box-shadow: var(--ombre); background: #fff; }
.apercu-audio { width: 100%; margin-top: 1rem; }

/* --- Choix d'outil ----------------------------------------------------------------- */
.choix-outils {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 1rem;
}
.choix-outils > li { animation: apparition 420ms var(--ease-out) both; animation-delay: var(--retard, 0ms); }
.choix-outils a {
  position: relative; overflow: hidden;
  display: flex; flex-direction: column; height: 100%;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 18px;
  padding: 1.5rem 1.5rem 1.3rem; text-decoration: none; color: inherit; cursor: pointer;
  box-shadow: var(--ombre);
  transition: border-color 190ms var(--ease-out), box-shadow 190ms var(--ease-out);
}
.choix-outils a::before {
  content: ""; position: absolute; inset: 0 0 auto; height: 4px;
  background: var(--accent, var(--orange));
  transform: scaleX(0); transform-origin: left;
  transition: transform 260ms var(--ease-out);
}
.choix-outils a:hover { border-color: var(--trait-fort); box-shadow: var(--ombre-haute); }
.choix-outils a:hover::before { transform: scaleX(1); }
.choix-outils a:hover img { transform: scale(1.08) rotate(-3deg); }
.choix-outils img {
  width: 72px; height: 72px; margin-bottom: 0.95rem;
  background: var(--surface-2);
  border: 1px solid var(--trait);
  border-radius: 18px; padding: 8px;
  transition: transform 240ms var(--ease-spring);
}
.choix-outils strong { font-size: 1.04rem; color: var(--encre); margin-bottom: 0.35rem; }
.choix-outils span { font-size: 0.86rem; color: var(--texte-2); flex: 1; }
.choix-outils em { font-style: normal; font-size: 0.78rem; font-weight: 700; color: var(--orange); margin-top: 0.85rem; }

/* --- Formulaires ------------------------------------------------------------------ */
.formulaire { max-width: 720px; }
.etape {
  background: var(--surface); border: 1px solid var(--trait); border-radius: 16px;
  padding: 1.6rem 1.8rem; margin-bottom: 1.1rem; box-shadow: var(--ombre);
  animation: apparition 400ms var(--ease-out) both;
}
.etape h2 { display: flex; align-items: center; gap: 0.6rem; margin-bottom: 1rem; }
.etape-num {
  display: grid; place-items: center; flex-shrink: 0;
  width: 27px; height: 27px; border-radius: 50%;
  background: linear-gradient(135deg, var(--orange-vif), var(--orange));
  color: #fff; font-size: 0.82rem; font-weight: 800;
  box-shadow: var(--ombre-orange);
}
.formulaire label, .formulaire-ligne label { display: block; font-weight: 700; font-size: 0.87rem; color: var(--encre); margin: 1rem 0 0.35rem; }
.etape label:first-of-type { margin-top: 0; }
.obligatoire { font-weight: 500; color: var(--texte-2); }
input[type="text"], input[type="search"], input[type="password"], input:not([type]), textarea, select {
  width: 100%; font: inherit; font-size: 0.95rem; color: var(--encre);
  border: 1px solid var(--trait-fort); border-radius: 11px;
  padding: 0.66rem 0.85rem; background: var(--surface);
  transition: border-color 140ms var(--ease-out), box-shadow 140ms var(--ease-out);
}
input:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 0; border-color: var(--orange); box-shadow: 0 0 0 3px var(--orange-pale);
}
textarea { resize: vertical; }
::placeholder { color: var(--texte-2); opacity: 0.75; }
.formulaire-actions { display: flex; gap: 1rem; margin-top: 1.3rem; }
.formulaire-ligne { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 1rem; align-items: end; }
.formulaire-ligne label { margin: 0 0 0.35rem; }
.formulaire-ligne .champ-large { grid-column: span 2; }
.note { font-size: 0.85rem; color: var(--texte-2); margin-top: 0.8rem; }

/* --- Dépôt de fichiers -------------------------------------------------------------- */
.depot {
  display: block; cursor: pointer;
  border: 2px dashed var(--trait-fort); border-radius: 14px;
  padding: 1.3rem 1.4rem; text-align: center;
  background: var(--surface-2);
  transition: border-color 160ms var(--ease-out), background-color 160ms var(--ease-out);
}
.depot:hover, .depot.depot-survol { border-color: var(--orange); background: var(--orange-pale); }
.depot input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.depot-texte { font-size: 0.9rem; color: var(--texte); }
.depot-texte strong { color: var(--orange-fonce); }
[data-theme="sombre"] .depot-texte strong { color: var(--orange-vif); }
.depot-texte small { color: var(--texte-2); }
.depot-compact { padding: 0.7rem 1rem; margin-top: 0.8rem; }
.depot-liste { list-style: none; margin: 0.6rem 0 0; padding: 0; display: flex; flex-direction: column; gap: 0.35rem; }
.depot-liste li {
  display: flex; align-items: center; gap: 0.6rem;
  font-size: 0.85rem; font-weight: 600; color: var(--encre);
  background: var(--surface-2); border: 1px solid var(--trait);
  border-radius: 10px; padding: 0.45rem 0.75rem;
  animation: apparition 260ms var(--ease-out);
}
.depot-liste .taille { color: var(--texte-2); font-weight: 500; margin-left: auto; }
.depot-liste button {
  border: 0; background: none; cursor: pointer; font: inherit;
  color: var(--rouge); font-weight: 700; font-size: 0.8rem; padding: 0.1rem 0.3rem;
}

/* --- Sélecteur base de connaissances -------------------------------------------------- */
.picker { border: 1px solid var(--trait); border-radius: 13px; margin-top: 0.9rem; background: var(--surface-2); }
.picker summary {
  cursor: pointer; padding: 0.8rem 1rem;
  font-weight: 700; font-size: 0.9rem; color: var(--encre);
  border-radius: 13px; list-style-position: inside;
  transition: color 140ms var(--ease-out);
}
.picker summary:hover { color: var(--orange-fonce); }
[data-theme="sombre"] .picker summary:hover { color: var(--orange-vif); }
.picker[open] summary { border-bottom: 1px solid var(--trait); }
.picker-recherche { margin: 0.8rem 0; }
.picker .picker-recherche { width: calc(100% - 2rem); margin: 0.8rem 1rem 0.2rem; }
.picker-groupes { padding: 0.5rem 1rem 0.9rem; max-height: 340px; overflow-y: auto; }
.picker-groupes fieldset { border: 0; margin: 0.4rem 0 0; padding: 0; }
.picker-groupes legend { font-weight: 800; font-size: 0.76rem; color: var(--orange); text-transform: uppercase; letter-spacing: 0.03em; padding: 0.4rem 0; }
.picker-item {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.34rem 0.3rem; border-radius: 8px;
  font-size: 0.87rem; font-weight: 500; color: var(--encre); cursor: pointer;
}
.picker-item:hover { background: var(--orange-pale); }
.picker-item input { accent-color: var(--orange); width: 15px; height: 15px; flex-shrink: 0; cursor: pointer; }
.picker-item span { flex: 1; }
.picker-item a { font-size: 0.78rem; visibility: hidden; }
.picker-item:hover a { visibility: visible; }
.picker-item.cache { display: none; }

/* --- Accords (page connaissances) ------------------------------------------------------ */
.accords-groupe { border-top: 1px solid var(--trait); padding: 0.4rem 0; }
.accords-groupe summary { cursor: pointer; font-weight: 700; color: var(--encre); padding: 0.5rem 0.2rem; }
.accords-groupe summary:hover { color: var(--orange-fonce); }
.accords-liste { list-style: none; margin: 0.2rem 0 0.6rem; padding: 0; }
.accords-liste li {
  display: flex; align-items: center; justify-content: space-between; gap: 1rem;
  padding: 0.42rem 0.6rem; border-radius: 8px; font-size: 0.9rem;
}
.accords-liste li:hover { background: var(--orange-pale); }
.accords-liste li.cache { display: none; }
.accords-liste a { font-size: 0.8rem; font-weight: 600; }
.accords-plat { columns: 2; column-gap: 1.6rem; margin-top: 0.6rem; }
.accords-plat li { break-inside: avoid; border-top: 1px solid var(--trait); }
@media (max-width: 640px) { .accords-plat { columns: 1; } }

/* --- KPI ---------------------------------------------------------------------------- */
.bandeau-info {
  background: var(--bleu-pale); color: var(--bleu);
  border: 1px solid color-mix(in srgb, var(--bleu) 25%, var(--trait));
  border-radius: 12px; padding: 0.75rem 1rem; margin: 0 0 1.2rem;
  font-size: 0.88rem; font-weight: 600; max-width: none;
}
.bandeau-info code { font-family: inherit; font-weight: 700; }
.th-part { width: 130px; }
.td-part small { display: block; color: var(--texte-2); }
.barre-part {
  display: block; height: 7px; border-radius: 4px;
  background: var(--neutre-pale); overflow: hidden; margin-bottom: 0.2rem;
}
.barre-part i {
  display: block; height: 100%; border-radius: 4px;
  background: linear-gradient(90deg, var(--orange-vif), var(--orange));
  animation: barre-pousse 700ms var(--ease-out) both;
}
@keyframes barre-pousse { from { transform: scaleX(0); transform-origin: left; } }

/* Graphique en barres horizontales (KPI) */
.graphe { display: flex; flex-direction: column; gap: 0.75rem; margin: 0.4rem 0 1rem; }
.graphe-ligne { display: grid; grid-template-columns: 170px 1fr 84px; gap: 0.9rem; align-items: center; }
.graphe-nom { font-size: 0.85rem; font-weight: 700; color: var(--encre); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.graphe-piste { height: 22px; border-radius: 7px; background: var(--surface-2); border: 1px solid var(--trait); overflow: hidden; }
.graphe-barre {
  display: block; height: 100%; border-radius: 6px;
  background: linear-gradient(90deg, var(--orange-vif), var(--orange-fonce));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.3);
  animation: barre-pousse 800ms var(--ease-out) both; animation-delay: var(--retard, 0ms);
}
.graphe-valeur { font-size: 0.83rem; font-weight: 700; color: var(--texte-2); font-variant-numeric: tabular-nums; text-align: right; }

/* --- Tables ----------------------------------------------------------------------- */
.table { width: 100%; border-collapse: collapse; font-size: 0.9rem; }
.table th { text-align: left; font-size: 0.74rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--texte-2); padding: 0.4rem 0.75rem 0.6rem 0; }
.table td { padding: 0.65rem 0.75rem 0.65rem 0; border-top: 1px solid var(--trait); vertical-align: middle; color: var(--texte); }
.table td strong { color: var(--encre); }
.table tbody tr { transition: background-color 130ms var(--ease-out); }
.table tbody tr:hover { background: var(--surface-2); }
.table .inactif td { opacity: 0.55; }
.td-actions { display: flex; gap: 0.4rem; flex-wrap: wrap; align-items: center; }
.td-actions .bouton { padding: 0.42rem 0.8rem; font-size: 0.8rem; }

/* --- Messages / historique ----------------------------------------------------------- */
.fil-messages { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 0.9rem; }
.fil-messages li { padding-left: 1rem; border-left: 3px solid var(--orange-pale); }
.fil-messages strong { color: var(--encre); }
.fil-messages time { font-size: 0.78rem; color: var(--texte-2); margin-left: 0.5rem; }
.fil-messages p { margin: 0.25rem 0 0; white-space: pre-line; }

/* --- États vides / alertes -------------------------------------------------------------- */
.vide {
  background: var(--surface); border: 1px dashed var(--trait-fort); border-radius: 16px;
  padding: 3.2rem 2rem; text-align: center;
  animation: apparition 400ms var(--ease-out) both;
}
.vide-compact { padding: 1.6rem 1.4rem; }
.vide p { margin-inline: auto; color: var(--texte-2); }
.vide .bouton { margin-top: 0.85rem; }
.vide img { margin-bottom: 0.6rem; filter: drop-shadow(0 10px 20px rgba(15, 23, 42, 0.15)); }
.alerte {
  background: var(--rouge-pale); color: var(--rouge);
  border: 1px solid color-mix(in srgb, var(--rouge) 25%, var(--trait));
  border-radius: 11px; padding: 0.7rem 1rem;
  font-size: 0.9rem; font-weight: 600; max-width: 720px;
  animation: secousse 400ms var(--ease-out);
}
@keyframes secousse { 20%, 60% { transform: translateX(-4px); } 40%, 80% { transform: translateX(4px); } }

/* --- Base de connaissances : rail de dossiers + cartes -------------------------------------- */
.kb { display: grid; grid-template-columns: 236px 1fr; gap: 1.4rem; align-items: start; margin-bottom: 1.2rem; }
.kb-rail {
  background: var(--surface); border: 1px solid var(--trait); border-radius: 16px;
  padding: 0.9rem 0.7rem; box-shadow: var(--ombre);
  position: sticky; top: 1.2rem;
}
.kb-rail-titre {
  margin: 0 0 0.5rem; padding: 0 0.55rem;
  font-size: 0.7rem; font-weight: 800; letter-spacing: 0.09em;
  text-transform: uppercase; color: var(--texte-2);
}
.kb-dossier {
  display: flex; align-items: center; gap: 0.55rem;
  padding: 0.54rem 0.68rem; border-radius: 10px;
  color: var(--texte); text-decoration: none; cursor: pointer;
  font-weight: 600; font-size: 0.87rem;
  transition: background-color 140ms var(--ease-out), color 140ms var(--ease-out);
}
.kb-dossier svg { width: 16px; height: 16px; fill: currentColor; opacity: 0.6; flex-shrink: 0; }
.kb-dossier:hover { background: var(--orange-pale); color: var(--orange-fonce); }
[data-theme="sombre"] .kb-dossier:hover { color: var(--orange-vif); }
.kb-actif {
  background: linear-gradient(135deg, var(--orange-vif), var(--orange));
  color: #fff !important; box-shadow: var(--ombre-orange);
}
.kb-actif svg { opacity: 1; }
.kb-actif .kb-nb { background: rgba(255, 255, 255, 0.25); color: #fff; }
.kb-dossier-nom { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.kb-nb {
  margin-left: auto; flex-shrink: 0;
  font-size: 0.72rem; font-weight: 700; font-variant-numeric: tabular-nums;
  background: var(--neutre-pale); color: var(--texte-2);
  border-radius: 999px; padding: 0.05rem 0.5rem;
}
.kb-nouveau {
  display: block; width: 100%; text-align: left;
  border: 0; background: none; cursor: pointer; font: inherit;
  padding: 0.5rem 0.65rem; border-radius: 10px;
  color: var(--orange); font-weight: 700; font-size: 0.85rem;
  transition: background-color 140ms var(--ease-out);
}
.kb-nouveau:hover { background: var(--orange-pale); }
.kb-rail-sep { border-top: 1px solid var(--trait); margin: 0.6rem 0.3rem; }
.kb-rail-actions { margin-top: 0.7rem; padding: 0.3rem 0.65rem 0; display: flex; flex-direction: column; gap: 0.3rem; border-top: 1px solid var(--trait); padding-top: 0.7rem; }

.kb-outils { display: flex; gap: 0.7rem; align-items: center; margin-bottom: 1rem; }
.kb-recherche { max-width: 420px; }

.kb-cartes {
  list-style: none; margin: 0; padding: 0;
  display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 0.95rem;
}
.kb-carte {
  display: flex; flex-direction: column; gap: 0.3rem;
  background: var(--surface); border: 1px solid var(--trait); border-radius: 16px;
  padding: 1.1rem 1.2rem 1.05rem;
  box-shadow: var(--ombre);
  animation: apparition 360ms var(--ease-out) both; animation-delay: var(--retard, 0ms);
  transition: border-color 170ms var(--ease-out), box-shadow 170ms var(--ease-out);
}
.kb-carte:hover { border-color: var(--trait-fort); box-shadow: var(--ombre-haute); }
.kb-carte-archivee { opacity: 0.72; }
.kb-carte-tete { display: flex; justify-content: space-between; align-items: center; margin-bottom: 0.35rem; }
.kb-ext {
  font-size: 0.66rem; font-weight: 800; letter-spacing: 0.05em;
  padding: 0.24rem 0.55rem; border-radius: 7px;
  background: var(--neutre-pale); color: var(--neutre); border: 1px solid var(--trait);
}
.kb-ext-pdf { background: var(--orange-pale); color: var(--orange-fonce); border-color: color-mix(in srgb, var(--orange) 30%, var(--trait)); }
[data-theme="sombre"] .kb-ext-pdf { color: var(--orange-vif); }
.kb-ext-docx, .kb-ext-doc { background: var(--bleu-pale); color: var(--bleu); border-color: color-mix(in srgb, var(--bleu) 25%, var(--trait)); }
.kb-ext-xlsx, .kb-ext-xls, .kb-ext-csv { background: var(--vert-pale); color: var(--vert); border-color: color-mix(in srgb, var(--vert) 25%, var(--trait)); }
.kb-ext-pptx { background: var(--jaune-pale); color: var(--jaune); border-color: color-mix(in srgb, var(--jaune) 25%, var(--trait)); }
.kb-carte-titre { color: var(--encre); font-size: 0.95rem; line-height: 1.35; overflow-wrap: anywhere; font-weight: 600; }
.kb-carte-meta { font-size: 0.76rem; color: var(--texte-2); }
.kb-chip {
  display: inline-block; font-size: 0.7rem; font-weight: 700;
  background: var(--neutre-pale); border: 1px solid var(--trait);
  border-radius: 999px; padding: 0.02rem 0.5rem; color: var(--texte-2);
}
.kb-carte-actions { display: flex; gap: 0.5rem; align-items: center; margin-top: 0.65rem; flex-wrap: wrap; }
.kb-carte-actions .bouton { padding: 0.4rem 0.8rem; font-size: 0.8rem; }
.panneau-accords { margin-top: 0.4rem; }

.lien-bouton {
  border: 0; background: none; cursor: pointer; font: inherit;
  padding: 0.15rem 0; text-align: left;
  color: var(--texte-2); font-weight: 600; font-size: 0.82rem;
  text-decoration: underline; text-underline-offset: 3px;
}
.lien-bouton:hover { color: var(--orange-fonce); }
.lien-danger { color: var(--rouge); }
.lien-danger:hover { color: var(--rouge); opacity: 0.8; }

/* --- Icônes & boutons d'action ------------------------------------------------------------------ */
.ic { width: 18px; height: 18px; fill: currentColor; flex-shrink: 0; vertical-align: -3px; }
.bouton .ic, button[type="submit"] .ic { width: 16px; height: 16px; vertical-align: -2.5px; margin-right: 0.35rem; }
h2 .ic { color: var(--orange); margin-right: 0.3rem; }
.btn-icone {
  display: inline-grid; place-items: center;
  width: 38px; height: 38px; border-radius: 11px;
  border: 1px solid var(--trait); background: var(--surface);
  color: var(--texte-2); cursor: pointer; text-decoration: none;
  box-shadow: var(--ombre);
  transition: color 130ms var(--ease-out), border-color 130ms var(--ease-out),
              background-color 130ms var(--ease-out);
}
.btn-icone:hover { color: var(--orange-fonce); border-color: var(--orange); background: var(--orange-pale); }
[data-theme="sombre"] .btn-icone:hover { color: var(--orange-vif); }
.btn-icone:active { transform: scale(0.94); }
.btn-icone-danger:hover { color: var(--rouge); border-color: var(--rouge); background: var(--rouge-pale); }
.forme-inline { display: contents; }
.bouton-rouge { background: linear-gradient(135deg, #e04b40, #c62b21); box-shadow: 0 8px 22px -8px rgba(220, 38, 38, 0.4); }
.bouton-rouge:hover { filter: brightness(1.08); }
.kb-poignee { color: var(--trait-fort); cursor: grab; margin-left: auto; margin-right: 0.4rem; display: none; }
.kb-carte[draggable=true] .kb-poignee { display: inline-flex; }
.kb-carte[draggable=true] { cursor: grab; }
.kb-glisse { opacity: 0.45; transform: scale(0.98); }
.kb-cible {
  background: var(--orange-pale) !important; color: var(--orange-fonce) !important;
  outline: 2px dashed var(--orange); outline-offset: -2px;
}
.glisser-en-cours .kb-dossier { transition: none; }
.kb-chip .ic { width: 11px; height: 11px; vertical-align: -1px; margin-right: 0.2rem; }
.kb-nouveau .ic { vertical-align: -4px; margin-right: 0.25rem; }
.tabbar { display: none; }

/* --- Modales ---------------------------------------------------------------------------------- */
.dlg {
  border: 0; border-radius: 20px; padding: 1.7rem 1.8rem;
  width: min(440px, calc(100vw - 2rem));
  background: var(--surface); color: var(--texte);
  border: 1px solid var(--trait);
  box-shadow: 0 8px 16px rgba(15, 23, 42, 0.08), 0 40px 90px -24px rgba(15, 23, 42, 0.45);
}
.dlg::backdrop { background: rgba(8, 13, 24, 0.55); backdrop-filter: blur(3px); }
.dlg[open] { animation: dlg-entree 220ms var(--ease-spring); }
@keyframes dlg-entree { from { opacity: 0; transform: scale(0.94) translateY(8px); } }
.dlg h2 { margin-bottom: 0.3rem; font-size: 1.1rem; }
.dlg label { display: block; font-weight: 700; font-size: 0.85rem; color: var(--encre); margin: 0.9rem 0 0.3rem; }
.dlg-actions { display: flex; justify-content: flex-end; gap: 0.6rem; margin-top: 1.3rem; }
.dlg-zone-basse {
  display: flex; justify-content: space-between; gap: 1rem; flex-wrap: wrap;
  border-top: 1px solid var(--trait); margin-top: 1.2rem; padding-top: 0.9rem;
}

/* --- Toasts -------------------------------------------------------------------------------------- */
.toasts { position: fixed; top: 1.1rem; right: 1.2rem; z-index: 60; display: flex; flex-direction: column; gap: 0.5rem; }
.toast {
  margin: 0; max-width: 380px;
  background: #101b33; color: #f1f5f9;
  font-size: 0.87rem; font-weight: 600;
  padding: 0.75rem 1.05rem; border-radius: 13px;
  border: 1px solid rgba(148, 163, 184, 0.18);
  box-shadow: 0 16px 40px -8px rgba(8, 13, 24, 0.55);
  animation: toast-entree 300ms var(--ease-spring);
  transition: opacity 300ms ease, transform 300ms ease;
}
@keyframes toast-entree { from { opacity: 0; transform: translateY(-10px) scale(0.96); } }
.toast-erreur { background: #b91c1c; border-color: rgba(255, 255, 255, 0.15); }
.toast-succes { background: #15803d; border-color: rgba(255, 255, 255, 0.15); }
.toast-masque { opacity: 0; transform: translateY(-6px); }

/* --- Base de connaissances : badges MD & reclassement -------------------------------------- */
.etiquette-md {
  display: inline-block;
  font-size: 0.68rem; font-weight: 800; letter-spacing: 0.04em;
  padding: 0.14rem 0.5rem; border-radius: 6px; text-decoration: none;
  background: var(--vert-pale); color: var(--vert); border: 1px solid color-mix(in srgb, var(--vert) 25%, var(--trait));
}
a.etiquette-md:hover { background: var(--vert); color: #fff; }
.etiquette-md-non { background: var(--neutre-pale); color: var(--neutre); border-color: var(--trait-fort); }
.doc-liens { display: flex; gap: 0.7rem; align-items: center; margin-top: 0.25rem; font-size: 0.8rem; }
.table-connaissances td small.discret { display: block; font-size: 0.76rem; }
.reclasser select { width: auto; max-width: 230px; font-size: 0.82rem; padding: 0.35rem 0.5rem; }
.bouton-danger:hover { background: var(--rouge-pale); border-color: var(--rouge); color: var(--rouge); }

/* --- Écran de connexion ------------------------------------------------------------------ */
.porte { min-height: 100dvh; display: flex; }
.porte-vitrine {
  position: relative; overflow: hidden;
  flex: 1.1;
  background:
    radial-gradient(720px 520px at 12% 108%, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0) 60%),
    radial-gradient(620px 460px at 96% -6%, rgba(16, 27, 51, 0.5) 0%, rgba(16, 27, 51, 0) 60%),
    linear-gradient(160deg, #f4682a 0%, #e7591c 46%, #b53f0e 100%);
  display: flex; flex-direction: column; justify-content: center;
  padding: 4rem 4.5rem; gap: 2rem;
}
.porte-vitrine::after {
  content: ""; position: absolute; width: 560px; height: 560px; border-radius: 50%;
  background: radial-gradient(circle, rgba(255, 255, 255, 0.13) 0%, rgba(255, 255, 255, 0) 65%);
  top: -220px; right: -160px; pointer-events: none;
  animation: derive 14s ease-in-out infinite alternate;
}
@keyframes derive { to { transform: translate(-60px, 70px) scale(1.12); } }
.porte-hubby { display: flex; align-items: center; gap: 1.1rem; position: relative; }
.porte-hubby img { filter: drop-shadow(0 16px 30px rgba(0, 0, 0, 0.28)); animation: flottement 5s ease-in-out infinite; }
@keyframes flottement { 50% { transform: translateY(-9px); } }
.porte-wordmark { color: #fff; font-size: 3rem; font-weight: 900; letter-spacing: 0.04em; text-shadow: 0 4px 24px rgba(0, 0, 0, 0.18); }
.porte-slogan {
  margin: 0; color: #fff; position: relative;
  font-size: clamp(2rem, 3.6vw, 3.2rem);
  font-weight: 900; line-height: 1.12; letter-spacing: -0.02em;
  text-wrap: balance;
  animation: apparition 700ms var(--ease-out) both 150ms;
}
.porte-mention { margin: 0; color: #fff; font-weight: 600; font-size: 0.95rem; opacity: 0.92; position: relative; animation: apparition 700ms var(--ease-out) both 300ms; }
.porte-acces {
  flex: 1; display: grid; place-items: center;
  background: var(--fond); padding: 2rem;
}
.porte-carte {
  width: min(420px, 100%);
  background: var(--surface); border: 1px solid var(--trait);
  border-radius: 22px; padding: 2.4rem 2.3rem;
  box-shadow: 0 2px 8px rgba(15, 23, 42, 0.05), 0 40px 80px -32px rgba(15, 23, 42, 0.35);
  animation: apparition 500ms var(--ease-out) both;
}
.porte-carte h1 { font-size: 1.55rem; }
.porte-logo-forme { width: min(240px, 80%); height: auto; margin-bottom: 1.3rem; }
[data-theme="sombre"] .porte-logo-forme { background: #fff; border-radius: 12px; padding: 0.6rem; }
.porte-sous { color: var(--texte-2); font-size: 0.92rem; margin: 0.5rem 0 1.6rem; }
.porte-carte label { display: block; font-weight: 700; font-size: 0.85rem; color: var(--encre); margin: 1.05rem 0 0.3rem; }
.porte-carte button { width: 100%; margin-top: 1.6rem; padding: 0.8rem; }
.porte-aide { font-size: 0.8rem; color: var(--texte-2); margin-top: 1.3rem; }

/* --- Divers -------------------------------------------------------------------------------- */
@media (max-width: 960px) {
  .porte { flex-direction: column; }
  .porte-vitrine { display: none; }
  .porte-acces { align-items: start; padding-top: 3.5rem; }
}
/* --- Mobile : priorité absolue (usage principal de la DN) --------------------------------------- */
@media (max-width: 860px) {
  .kb { grid-template-columns: 1fr; }
  .kb-rail { position: static; }
  .kb-cartes { grid-template-columns: 1fr; }
  .kb-poignee { display: none !important; }
  .coquille { flex-direction: column; }

  .lateral {
    width: 100%; height: auto; position: static;
    flex-direction: row; align-items: center; gap: 0.6rem;
    padding: 0.55rem 1rem;
    border-right: 0; border-bottom: 1px solid var(--nav-bord);
  }
  .marque { margin: 0; }
  .marque img { width: 36px; height: 36px; }
  .marque-texte { font-size: 1.05rem; }
  .marque-texte small { display: none; }
  .lateral nav { display: none; }
  .lateral-pied { margin: 0 0 0 auto; flex-direction: row; align-items: center; }
  .mode-simu { display: none; }
  .btn-theme { width: auto; padding: 0.5rem 0.6rem; border-radius: 10px; }
  .btn-theme span { display: none; }
  .qui-carte { border: 0; padding: 0; background: none; gap: 0.45rem; }
  .qui-pastille { width: 34px; height: 34px; }
  .qui-infos { display: none; }
  .qui-deconnexion {
    display: inline-grid; place-items: center;
    width: 40px; height: 40px; border-radius: 11px;
    color: var(--nav-texte); text-decoration: none;
    border: 1px solid var(--nav-bord); background: rgba(148, 163, 184, 0.1);
  }
  .qui-deconnexion .ic { width: 18px; height: 18px; }
  .qui-deconnexion:active { transform: scale(0.94); }

  .tabbar {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 50;
    background: color-mix(in srgb, var(--surface) 92%, transparent);
    backdrop-filter: blur(12px); -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid var(--trait);
    box-shadow: 0 -8px 28px -12px rgba(15, 23, 42, 0.3);
    padding: 0.3rem 0.4rem calc(0.3rem + env(safe-area-inset-bottom));
    justify-content: space-around;
  }
  .tabbar a {
    display: flex; flex-direction: column; align-items: center; gap: 0.15rem;
    min-width: 60px; padding: 0.35rem 0.5rem; border-radius: 12px;
    text-decoration: none; color: var(--texte-2);
    font-size: 0.66rem; font-weight: 700;
    transition: color 140ms var(--ease-out);
  }
  .tabbar a .ic { width: 21px; height: 21px; }
  .tabbar a:active { transform: scale(0.94); }
  .tab-actif { color: var(--orange); background: var(--orange-pale); }
  .tab-central { color: var(--orange); margin-top: -1.1rem; }
  .tab-central-rond {
    display: grid; place-items: center;
    width: 52px; height: 52px; border-radius: 50%;
    background: linear-gradient(135deg, var(--orange-vif), var(--orange));
    color: #fff;
    box-shadow: 0 8px 20px -4px rgba(231, 89, 28, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.3);
  }
  .tab-central-rond .ic { width: 22px; height: 22px; }
  .tab-central:active .tab-central-rond { transform: scale(0.94); }

  .contenu { padding: 1.3rem 1.1rem calc(6rem + env(safe-area-inset-bottom)); }
  .entete { flex-direction: column; gap: 0.8rem; }
  .entete-icone { display: none; }
  h1 { font-size: 1.5rem; }
  .brief { grid-template-columns: 1fr; gap: 0.1rem 0; }
  .brief dt { margin-top: 0.6rem; }
  .formulaire-ligne .champ-large { grid-column: span 1; }
  .apercu { grid-template-columns: repeat(2, 1fr); }
  .apercu-carte { padding: 0.7rem 0.9rem; }
  .apercu-carte strong { font-size: 1.4rem; }
  .ligne { padding: 0.75rem 0.9rem; gap: 0.7rem; }
  .ligne-icone { width: 40px; height: 40px; }
  .badge { font-size: 0.68rem; padding: 0.24rem 0.55rem; }
  .apercu-pdf { height: 420px; }
  .btn-icone { width: 44px; height: 44px; }
  input[type="text"], input[type="search"], input[type="password"],
  input:not([type]), textarea, select { font-size: 16px; }
  .toasts { left: 1rem; right: 1rem; top: 0.8rem; }
  .toast { max-width: none; }
  .recherche { max-width: none; }
  .jalons { padding: 0.9rem 0.6rem; }
  .jalons li { font-size: 0.68rem; }
  .graphe-ligne { grid-template-columns: 100px 1fr 70px; gap: 0.5rem; }
  .td-actions { flex-direction: column; align-items: stretch; }

  .dlg {
    width: 100vw; max-width: 100vw;
    margin: auto 0 0; border-radius: 22px 22px 0 0;
    padding: 1.4rem 1.3rem calc(1.4rem + env(safe-area-inset-bottom));
  }
  .dlg[open] { animation: sheet-entree 280ms var(--ease-out); }
  .dlg-actions { flex-direction: column-reverse; }
  .dlg-actions .bouton, .dlg-actions button { width: 100%; padding: 0.85rem; }
}
@keyframes sheet-entree { from { opacity: 0.6; transform: translateY(40%); } }

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