/* ============================================================
   Notes de frais — feuille de style unique.
   Mobile d'abord ; tablette (≥ 760 px) en deux panneaux ; PC (≥ 1180 px) en trois.
   Toutes les classes sont préfixées `ndf-` pour cohabiter un jour dans Somapp.
   ============================================================ */
:root {
  color-scheme: light;
  --fond: #f4f6f9;
  --carte: #ffffff;
  --carte-2: #f8f9fb;
  --texte: #18212d;
  --texte-2: #4b5768;
  --doux: #6b7789;
  --bord: #e1e6ed;
  --bord-fort: #c9d1dc;
  --primaire: #1f3a5f;
  --primaire-2: #2a4d7c;
  --accent: #2a78d6;
  --accent-doux: #e7f0fc;
  --ok: #157a46;
  --ok-doux: #e3f4ea;
  --attention: #a86200;
  --attention-doux: #fff3dc;
  --danger: #c0352f;
  --danger-doux: #fde8e7;
  --surligne: #ffeb3b;          /* recherche : fond jaune… */
  --surligne-texte: #000000;    /* …texte noir */
  --ombre: 0 1px 2px rgba(16, 24, 40, .06), 0 1px 3px rgba(16, 24, 40, .08);
  --ombre-haute: 0 10px 30px rgba(16, 24, 40, .16);
  --rayon: 12px;
  --rayon-petit: 8px;
  --entete: 60px;
  --barre-mobile: 64px;
  --police: system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
  --mono: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  /* Graphiques (palette validée daltonisme, voir statistiques.js) */
  --viz-surface: #fcfcfb;
  --viz-serie-1: #2a78d6;
  --viz-serie-2: #eb6834;
  --viz-grille: #e7e8ea;
}
@media (prefers-color-scheme: dark) {
  :root {
    color-scheme: dark;
    --fond: #121418;
    --carte: #1b1e24;
    --carte-2: #22262d;
    --texte: #eceff3;
    --texte-2: #c2c8d1;
    --doux: #9aa3b0;
    --bord: #2d323a;
    --bord-fort: #3b414b;
    --primaire: #9cc3f5;
    --primaire-2: #b9d5f8;
    --accent: #5aa0ef;
    --accent-doux: #1e2e44;
    --ok: #4cc488;
    --ok-doux: #15301f;
    --attention: #f0b450;
    --attention-doux: #3a2c12;
    --danger: #f07a73;
    --danger-doux: #3d1d1b;
    --ombre: 0 1px 2px rgba(0, 0, 0, .4);
    --ombre-haute: 0 10px 30px rgba(0, 0, 0, .5);
    --viz-surface: #1a1a19;
    --viz-serie-1: #3987e5;
    --viz-serie-2: #d95926;
    --viz-grille: #2e2f31;
  }
}

* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body.ndf { overflow-x: hidden; }
body.ndf {
  margin: 0; font-family: var(--police); font-size: 15px; line-height: 1.45; color: var(--texte); background: var(--fond);
  padding-bottom: calc(var(--barre-mobile) + env(safe-area-inset-bottom));
}
@media (min-width: 760px) { body.ndf { padding-bottom: 0; } }
h1 { font-size: 1.5rem; margin: 0 0 .4rem; letter-spacing: -.01em; }
h2 { font-size: 1.05rem; margin: 0 0 .8rem; }
h3 { font-size: .85rem; margin: 0 0 .4rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
svg { width: 20px; height: 20px; flex: none; }
code, pre { font-family: var(--mono); font-size: .85em; }
[hidden] { display: none !important; }
:focus-visible { outline: 3px solid color-mix(in srgb, var(--accent) 55%, transparent); outline-offset: 2px; }

/* Surlignage des termes recherchés : fond jaune, texte noir, partout. */
mark, .ndf-surligne { background: var(--surligne); color: var(--surligne-texte); border-radius: 3px; padding: 0 1px; box-decoration-break: clone; -webkit-box-decoration-break: clone; }

/* ---------- En-tête ---------- */
.ndf-entete {
  position: sticky; top: 0; z-index: 40; height: var(--entete); display: flex; align-items: center; gap: 16px;
  padding: 0 16px; padding-top: env(safe-area-inset-top); background: var(--carte); border-bottom: 1px solid var(--bord);
}
.ndf-marque { display: flex; align-items: center; gap: 10px; font-weight: 700; color: var(--texte); white-space: nowrap; }
.ndf-marque:hover { text-decoration: none; }
.ndf-nav { display: none; gap: 2px; flex: 1; overflow-x: auto; }
.ndf-nav a { display: flex; align-items: center; gap: 6px; padding: 8px 11px; border-radius: 8px; color: var(--texte-2); white-space: nowrap; font-weight: 500; }
.ndf-nav a svg { width: 18px; height: 18px; }
.ndf-nav a:hover { background: var(--carte-2); text-decoration: none; }
.ndf-nav a.actif { background: var(--accent-doux); color: var(--accent); }
.ndf-entete-actions { display: flex; align-items: center; gap: 8px; margin-left: auto; }
.ndf-recherche-rapide { display: none; align-items: center; gap: 6px; background: var(--carte-2); border: 1px solid var(--bord); border-radius: 999px; padding: 0 12px; height: 38px; }
.ndf-recherche-rapide input { border: 0; background: transparent; outline: none; width: 200px; font: inherit; color: var(--texte); }
.ndf-recherche-rapide svg { color: var(--doux); width: 18px; }
@media (min-width: 1180px) { .ndf-nav { display: flex; } .ndf-recherche-rapide { display: flex; } }
@media (min-width: 760px) and (max-width: 1179px) { .ndf-nav { display: flex; } .ndf-nav a { padding: 8px; } .ndf-nav a { font-size: 0; gap: 0; } .ndf-nav a svg { width: 22px; height: 22px; } }
.ndf-icone-bouton {
  position: relative; display: inline-flex; align-items: center; justify-content: center; width: 40px; height: 40px;
  border-radius: 999px; border: 0; background: transparent; color: var(--texte-2); cursor: pointer; font: inherit;
}
.ndf-icone-bouton:hover { background: var(--carte-2); }
.ndf-avatar { background: var(--primaire); color: #fff; font-weight: 700; font-size: .85rem; text-transform: uppercase; }
@media (prefers-color-scheme: dark) { .ndf-avatar { color: #10161f; } }
.ndf-avatar:hover { background: var(--primaire-2); }
.ndf-pastille { position: absolute; top: 6px; right: 7px; width: 9px; height: 9px; border-radius: 50%; background: var(--danger); border: 2px solid var(--carte); }
.ndf-menu-compte { position: relative; }
.ndf-menu, .ndf-panneau-notifications {
  position: absolute; right: 0; top: calc(100% + 8px); background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon);
  box-shadow: var(--ombre-haute); min-width: 240px; padding: 6px; z-index: 60;
}
.ndf-panneau-notifications { right: 12px; top: calc(var(--entete) - 4px); width: min(380px, calc(100vw - 24px)); max-height: 70vh; overflow: auto; padding: 0; }
.ndf-panneau-tete { display: flex; justify-content: space-between; align-items: center; padding: 12px 14px; border-bottom: 1px solid var(--bord); }
.ndf-panneau-notifications ul { list-style: none; margin: 0; padding: 0; }
.ndf-panneau-notifications li a, .ndf-panneau-notifications li.ndf-vide { display: block; padding: 11px 14px; border-bottom: 1px solid var(--bord); color: var(--texte); }
.ndf-panneau-notifications li a:hover { background: var(--carte-2); text-decoration: none; }
.ndf-panneau-notifications li.non-lue a { background: var(--accent-doux); }
.ndf-panneau-notifications time { display: block; font-size: .78rem; color: var(--doux); }
.ndf-menu-tete { padding: 10px 12px; display: flex; flex-direction: column; border-bottom: 1px solid var(--bord); margin-bottom: 4px; }
.ndf-menu-tete span { color: var(--doux); font-size: .85rem; }
.ndf-menu a, .ndf-menu button { display: flex; align-items: center; gap: 10px; width: 100%; padding: 10px 12px; border-radius: 8px; color: var(--texte); background: none; border: 0; font: inherit; text-align: left; cursor: pointer; }
.ndf-menu a:hover, .ndf-menu button:hover { background: var(--carte-2); text-decoration: none; }
.ndf-menu form { margin: 0; border-top: 1px solid var(--bord); margin-top: 4px; padding-top: 4px; }
.ndf-menu button { color: var(--danger); }
@media (min-width: 760px) { .ndf-mobile-seul { display: none !important; } }

/* ---------- Barre mobile (bas) ---------- */
.ndf-barre-mobile {
  position: fixed; left: 0; right: 0; bottom: 0; z-index: 45; height: calc(var(--barre-mobile) + env(safe-area-inset-bottom));
  padding-bottom: env(safe-area-inset-bottom); display: grid; grid-template-columns: repeat(5, 1fr); align-items: center;
  background: var(--carte); border-top: 1px solid var(--bord);
}
.ndf-barre-mobile a { display: flex; flex-direction: column; align-items: center; gap: 2px; color: var(--doux); font-size: .7rem; font-weight: 600; padding: 6px 0; }
.ndf-barre-mobile a:hover { text-decoration: none; }
.ndf-barre-mobile a.actif { color: var(--accent); }
.ndf-barre-mobile svg { width: 23px; height: 23px; }
.ndf-barre-mobile .ndf-bouton-photo {
  width: 60px; height: 60px; margin: -26px auto 0; border-radius: 50%; background: var(--primaire); color: #fff; justify-content: center;
  box-shadow: 0 6px 16px rgba(31, 58, 95, .35); border: 4px solid var(--fond);
}
@media (prefers-color-scheme: dark) { .ndf-barre-mobile .ndf-bouton-photo { color: #10161f; } }
.ndf-barre-mobile .ndf-bouton-photo svg { width: 28px; height: 28px; }
@media (min-width: 760px) { .ndf-barre-mobile { display: none; } }

/* ---------- Mise en page ---------- */
.ndf-principal { max-width: 1440px; margin: 0 auto; padding: 18px 14px 32px; }
@media (min-width: 760px) { .ndf-principal { padding: 24px 24px 40px; } }
.ndf-carte { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 16px; box-shadow: var(--ombre); margin-bottom: 16px; }
.ndf-carte-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 10px; flex-wrap: wrap; }
.ndf-carte-tete h2 { margin: 0; }
.ndf-page-tete { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ndf-page-tete h1 { margin: 0; }
.ndf-outils { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }
.ndf-grille-2 { display: grid; gap: 12px 16px; grid-template-columns: 1fr; }
@media (min-width: 760px) { .ndf-grille-2 { grid-template-columns: 1fr 1fr; } }
.ndf-grille-stats { gap: 0 16px; }
.ndf-doux { color: var(--doux); }
.ndf-petit { font-size: .85rem; }
.ndf-vide { color: var(--doux); padding: 14px 4px; list-style: none; }
.ndf-num { text-align: right; font-variant-numeric: tabular-nums; white-space: nowrap; }
.ndf-ico { width: 18px; height: 18px; vertical-align: -3px; }
.ndf-lien { background: none; border: 0; color: var(--accent); cursor: pointer; font: inherit; padding: 0; }
.ndf-lien:hover { text-decoration: underline; }

/* ---------- Boutons ---------- */
.ndf-bouton {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 40px; padding: 8px 16px; border-radius: 10px;
  border: 1px solid var(--bord-fort); background: var(--carte); color: var(--texte); font: inherit; font-weight: 600; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s, transform .05s;
}
.ndf-bouton:hover { background: var(--carte-2); text-decoration: none; }
.ndf-bouton:active { transform: translateY(1px); }
.ndf-bouton:disabled { opacity: .55; cursor: not-allowed; }
.ndf-bouton-primaire { background: var(--primaire); border-color: var(--primaire); color: #fff; }
.ndf-bouton-primaire:hover { background: var(--primaire-2); border-color: var(--primaire-2); }
@media (prefers-color-scheme: dark) { .ndf-bouton-primaire { color: #0f1620; } }
.ndf-bouton-ok { background: var(--ok); border-color: var(--ok); color: #fff; }
.ndf-bouton-danger { color: var(--danger); border-color: color-mix(in srgb, var(--danger) 45%, var(--bord)); }
.ndf-bouton-danger:hover { background: var(--danger-doux); }
.ndf-bouton-fantome { border-color: transparent; background: transparent; }
.ndf-gros { min-height: 52px; padding: 12px 20px; font-size: 1rem; border-radius: 12px; }
.ndf-plein { width: 100%; }
.ndf-actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 6px; }

/* ---------- Formulaires ---------- */
.ndf-formulaire { display: flex; flex-direction: column; gap: 12px; }
.ndf-champ { display: flex; flex-direction: column; gap: 5px; min-width: 0; border: 0; padding: 0; margin: 0; }
.ndf-champ > span, .ndf-champ > legend { font-size: .82rem; font-weight: 600; color: var(--texte-2); }
.ndf-champ input, .ndf-champ select, .ndf-champ textarea, .ndf-outils select, .ndf-question input, .ndf-commentaire-form input, .ndf-copie input {
  width: 100%; min-height: 42px; padding: 8px 11px; border-radius: 9px; border: 1px solid var(--bord-fort); background: var(--carte);
  color: var(--texte); font: inherit; font-size: 16px; /* 16 px : pas de zoom automatique sur iPhone */
}
.ndf-outils select { width: auto; }
.ndf-champ textarea { resize: vertical; min-height: 64px; }
.ndf-champ input:focus, .ndf-champ select:focus, .ndf-champ textarea:focus { border-color: var(--accent); outline: none; box-shadow: 0 0 0 3px var(--accent-doux); }
.ndf-champ-double { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.ndf-champ.incertain input, .ndf-champ.incertain select { border-color: var(--attention); background: var(--attention-doux); }
.ndf-champ-montant input { font-weight: 700; font-size: 1.1rem; }
.ndf-tva { border: 1px solid var(--bord); border-radius: 10px; padding: 10px; display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin: 0; }
@media (min-width: 560px) { .ndf-tva { grid-template-columns: repeat(5, 1fr); } }
.ndf-tva legend { font-size: .82rem; font-weight: 600; color: var(--texte-2); padding: 0 4px; }
.ndf-plus-de-champs summary { cursor: pointer; color: var(--accent); font-weight: 600; padding: 4px 0; }
.ndf-plus-de-champs[open] summary { margin-bottom: 10px; }
.ndf-case { display: flex; align-items: center; gap: 8px; font-weight: 500; padding: 4px 0; }
.ndf-interrupteur { display: flex; align-items: center; gap: 10px; margin: 14px 0; cursor: pointer; }
.ndf-interrupteur input { width: 20px; height: 20px; accent-color: var(--accent); }
.ndf-code { letter-spacing: .4em; text-align: center; font-size: 1.4rem !important; font-variant-numeric: tabular-nums; }

/* ---------- Messages, badges, alertes ---------- */
.ndf-message { padding: 10px 14px; border-radius: 10px; margin: 8px 0; border: 1px solid transparent; }
.ndf-message-erreur { background: var(--danger-doux); color: var(--danger); border-color: color-mix(in srgb, var(--danger) 25%, transparent); }
.ndf-message-attention { background: var(--attention-doux); color: var(--attention); }
.ndf-message-ok { background: var(--ok-doux); color: var(--ok); }
.ndf-message-info { background: var(--accent-doux); color: var(--accent); }
.ndf-badge { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 999px; font-size: .76rem; font-weight: 700; white-space: nowrap; background: var(--carte-2); color: var(--texte-2); border: 1px solid var(--bord); }
.ndf-badge::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.ndf-badge-lecture { color: var(--accent); background: var(--accent-doux); border-color: transparent; }
.ndf-badge-lecture::before { animation: ndf-pulse 1.1s ease-in-out infinite; }
.ndf-badge-a_verifier { color: var(--attention); background: var(--attention-doux); border-color: transparent; }
.ndf-badge-prete { color: var(--texte-2); }
.ndf-badge-validee { color: var(--ok); background: var(--ok-doux); border-color: transparent; }
.ndf-badge-refusee { color: var(--danger); background: var(--danger-doux); border-color: transparent; }
.ndf-badge-ouvert { color: var(--texte-2); }
.ndf-badge-envoye { color: var(--accent); background: var(--accent-doux); border-color: transparent; }
.ndf-badge-valide { color: var(--ok); background: var(--ok-doux); border-color: transparent; }
@keyframes ndf-pulse { 50% { opacity: .25; } }
.ndf-alertes { display: flex; flex-direction: column; gap: 6px; margin-bottom: 12px; }
.ndf-alerte { display: flex; gap: 8px; align-items: flex-start; padding: 8px 12px; border-radius: 9px; font-size: .9rem; }
.ndf-alerte::before { content: "!"; flex: none; width: 18px; height: 18px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: .75rem; color: #fff; margin-top: 1px; }
.ndf-alerte-attention { background: var(--attention-doux); color: var(--attention); }
.ndf-alerte-attention::before { background: var(--attention); }
.ndf-alerte-info { background: var(--carte-2); color: var(--texte-2); }
.ndf-alerte-info::before { content: "i"; background: var(--doux); }

/* ---------- Toasts ---------- */
.ndf-toasts { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--barre-mobile) + 16px + env(safe-area-inset-bottom)); z-index: 100; display: flex; flex-direction: column; gap: 8px; width: min(440px, calc(100vw - 24px)); pointer-events: none; }
@media (min-width: 760px) { .ndf-toasts { bottom: 24px; } }
.ndf-toast { background: #18212d; color: #fff; padding: 12px 16px; border-radius: 10px; box-shadow: var(--ombre-haute); pointer-events: auto; animation: ndf-entree .18s ease-out; }
.ndf-toast-erreur { background: #9f2a25; }
.ndf-toast-ok { background: #126b3d; }
@keyframes ndf-entree { from { opacity: 0; transform: translateY(8px); } }

/* ---------- Connexion ---------- */
.ndf-connexion { min-height: 80vh; display: grid; place-items: center; }
.ndf-carte-connexion { width: min(420px, 100%); padding: 28px; text-align: center; }
.ndf-carte-connexion .ndf-formulaire { text-align: left; margin: 18px 0 10px; }

/* ---------- Accueil ---------- */
.ndf-bandeau { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; margin-bottom: 16px; }
.ndf-bandeau .ndf-gros { flex: 1 1 260px; max-width: 360px; }
@media (max-width: 759px) { .ndf-bandeau .ndf-gros { max-width: none; } }
.ndf-tuiles { display: grid; grid-template-columns: repeat(2, 1fr); gap: 12px; margin-bottom: 16px; }
@media (min-width: 900px) { .ndf-tuiles { grid-template-columns: repeat(4, 1fr); } }
.ndf-tuiles-compactes { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); }
.ndf-tuile { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px 16px; display: flex; flex-direction: column; gap: 2px; color: var(--texte); box-shadow: var(--ombre); min-width: 0; }
a.ndf-tuile:hover { border-color: var(--accent); text-decoration: none; }
.ndf-tuile-libelle { font-size: .82rem; color: var(--doux); font-weight: 600; }
.ndf-tuile-valeur { font-size: 1.55rem; font-weight: 700; font-variant-numeric: tabular-nums; letter-spacing: -.01em; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ndf-tuile-texte { font-size: 1.1rem; padding: 6px 0 4px; }
.ndf-tuile-sous { font-size: .82rem; color: var(--doux); }
.ndf-tuile-attention .ndf-tuile-valeur { color: var(--attention); }
.ndf-carte-direction .ndf-tuiles { margin-bottom: 0; }
.ndf-question { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.ndf-question input { flex: 1 1 220px; min-width: 0; }

/* Listes de dépenses (accueil) */
.ndf-liste-depenses { list-style: none; margin: 0; padding: 0; }
.ndf-liste-depenses li a > div { min-width: 0; }
.ndf-liste-depenses li a { display: grid; grid-template-columns: 44px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 9px 4px; border-bottom: 1px solid var(--bord); color: var(--texte); }
.ndf-liste-depenses li:last-child a { border-bottom: 0; }
.ndf-liste-depenses li a:hover { background: var(--carte-2); text-decoration: none; }
.ndf-vignette { width: 44px; height: 44px; border-radius: 8px; object-fit: cover; background: var(--carte-2); border: 1px solid var(--bord); display: grid; place-items: center; color: var(--doux); overflow: hidden; }
.ndf-vignette svg { width: 20px; }
.ndf-ligne-titre { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ndf-ligne-sous { font-size: .83rem; color: var(--doux); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ndf-montant { font-weight: 700; font-variant-numeric: tabular-nums; white-space: nowrap; text-align: right; }

/* ---------- Capture ---------- */
.ndf-capture { max-width: 900px; margin: 0 auto; }
.ndf-capture-actions { display: grid; grid-template-columns: 1fr; gap: 10px; margin: 16px 0 6px; }
@media (min-width: 560px) { .ndf-capture-actions { grid-template-columns: 1fr 1fr; } }
.ndf-capture-photo { font-size: 1.1rem; min-height: 64px; }
.ndf-depot { border: 2px dashed var(--bord-fort); border-radius: var(--rayon); padding: 28px 16px; text-align: center; background: var(--carte); margin-bottom: 16px; color: var(--texte-2); }
.ndf-depot svg { width: 34px; height: 34px; color: var(--doux); }
.ndf-depot.survol { border-color: var(--accent); background: var(--accent-doux); }
@media (max-width: 759px) { .ndf-depot { display: none; } }
.ndf-groupe-en-cours { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; padding: 10px 12px; border-radius: 10px; background: var(--accent-doux); margin-bottom: 12px; }
.ndf-groupe-en-cours span { flex: 1; font-weight: 600; }
.ndf-envois { list-style: none; margin: 0; padding: 0; }
.ndf-envoi { display: grid; grid-template-columns: 56px minmax(0, 1fr) auto; gap: 12px; align-items: center; padding: 10px 2px; border-bottom: 1px solid var(--bord); }
.ndf-envoi:last-child { border-bottom: 0; }
.ndf-envoi img, .ndf-envoi .ndf-vignette { width: 56px; height: 56px; border-radius: 8px; object-fit: cover; }
.ndf-progression { height: 4px; border-radius: 4px; background: var(--bord); overflow: hidden; margin-top: 6px; }
.ndf-progression > span { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s; }
.ndf-rafale { padding: 0; border: 0; width: 100vw; height: 100dvh; max-width: none; max-height: none; background: #000; }
.ndf-rafale::backdrop { background: #000; }
.ndf-rafale video { width: 100%; height: 100%; object-fit: cover; }
.ndf-rafale-cadre { position: absolute; inset: 8% 10% 22%; border: 2px solid rgba(255, 255, 255, .7); border-radius: 14px; box-shadow: 0 0 0 100vmax rgba(0, 0, 0, .25); pointer-events: none; }
.ndf-rafale-barre { position: absolute; left: 0; right: 0; bottom: 0; padding: 18px 20px calc(18px + env(safe-area-inset-bottom)); display: flex; align-items: center; justify-content: space-between; background: linear-gradient(transparent, rgba(0, 0, 0, .7)); }
.ndf-declencheur { width: 76px; height: 76px; border-radius: 50%; border: 5px solid #fff; background: rgba(255, 255, 255, .25); cursor: pointer; }
.ndf-declencheur:active { background: #fff; }
.ndf-rafale-compte { color: #fff; font-weight: 700; font-size: 1.2rem; min-width: 80px; text-align: right; }
.ndf-flash { animation: ndf-flash .25s; }
@keyframes ndf-flash { from { filter: brightness(3); } }

/* ---------- Recherche : barre, facettes, liste, aperçu ---------- */
.ndf-recherche-barre { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; position: sticky; top: calc(var(--entete) + 8px); z-index: 30; }
.ndf-champ-recherche { position: relative; flex: 1; min-width: 0; display: flex; align-items: center; background: var(--carte); border: 1px solid var(--bord-fort); border-radius: 12px; padding-left: 12px; box-shadow: var(--ombre); }
.ndf-champ-recherche:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-doux); }
.ndf-champ-recherche > svg { color: var(--doux); }
.ndf-champ-recherche input { flex: 1; border: 0; outline: none; background: transparent; color: var(--texte); font: inherit; font-size: 16px; height: 46px; padding: 0 10px; min-width: 0; }
.ndf-micro.ecoute { color: #fff; background: var(--danger); animation: ndf-pulse 1s infinite; }
@media (max-width: 759px) { .ndf-recherche-barre { gap: 6px; } .ndf-recherche-barre .ndf-bouton span { display: none; } .ndf-recherche-barre .ndf-bouton { padding: 8px 10px; flex: none; } .ndf-champ-recherche input { padding: 0 6px; } }
html { overflow-x: hidden; }
.ndf-suggestions { position: absolute; left: 0; right: 0; top: calc(100% + 6px); background: var(--carte); border: 1px solid var(--bord); border-radius: 12px; box-shadow: var(--ombre-haute); list-style: none; margin: 0; padding: 6px; z-index: 50; }
.ndf-suggestions li { padding: 9px 12px; border-radius: 8px; cursor: pointer; display: flex; gap: 8px; align-items: center; }
.ndf-suggestions li[aria-selected="true"], .ndf-suggestions li:hover { background: var(--carte-2); }
.ndf-suggestions li small { color: var(--doux); margin-left: auto; }
.ndf-recherche-corps { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
.ndf-facettes { display: none; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; box-shadow: var(--ombre); }
.ndf-facettes.ouvert { display: flex; flex-direction: column; gap: 12px; }
.ndf-facettes-tete { display: flex; justify-content: space-between; align-items: center; }
.ndf-facette ul { list-style: none; margin: 0; padding: 0; max-height: 240px; overflow: auto; }
.ndf-facette li button { display: flex; width: 100%; align-items: center; gap: 8px; padding: 6px 8px; border: 0; background: none; border-radius: 7px; cursor: pointer; font: inherit; color: var(--texte); text-align: left; }
.ndf-facette li button:hover { background: var(--carte-2); }
.ndf-facette li button.actif { background: var(--accent-doux); color: var(--accent); font-weight: 600; }
.ndf-facette li button span:first-child { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ndf-facette li button small { color: var(--doux); font-variant-numeric: tabular-nums; }
.ndf-resultats { min-width: 0; }
.ndf-resultats-tete { display: flex; justify-content: space-between; gap: 10px; flex-wrap: wrap; padding: 4px 4px 10px; color: var(--texte-2); font-size: .9rem; }
.ndf-resultats-tete strong { color: var(--texte); }
.ndf-liste-resultats { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ndf-resultat { display: grid; grid-template-columns: 64px minmax(0, 1fr) auto; gap: 12px; align-items: start; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 10px; cursor: pointer; box-shadow: var(--ombre); color: var(--texte); }
.ndf-resultat:hover { border-color: var(--bord-fort); text-decoration: none; }
.ndf-resultat.selectionne { border-color: var(--accent); box-shadow: 0 0 0 2px var(--accent-doux); }
.ndf-resultat .ndf-vignette { width: 64px; height: 64px; }
.ndf-resultat .ndf-vignette img { width: 100%; height: 100%; object-fit: cover; }
.ndf-resultat-corps { min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ndf-resultat-extrait { max-height: calc(2 * 1.45em + 8px); font-size: .83rem; color: var(--texte-2); background: var(--carte-2); border-radius: 6px; padding: 4px 8px; margin-top: 3px; overflow: hidden; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; }
.ndf-resultat-droite { display: flex; flex-direction: column; align-items: flex-end; gap: 6px; }
.ndf-resultat-droite .ndf-montant { font-size: 1.05rem; }
.ndf-apercu { display: none; }
@media (min-width: 760px) {
  .ndf-recherche-corps { grid-template-columns: minmax(0, 1fr) minmax(320px, 42%); }
  .ndf-apercu { display: block; position: sticky; top: calc(var(--entete) + 76px); max-height: calc(100vh - var(--entete) - 92px); overflow: auto; background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); box-shadow: var(--ombre); }
  .ndf-facettes { position: fixed; z-index: 55; top: calc(var(--entete) + 64px); left: 16px; width: 300px; max-height: calc(100vh - var(--entete) - 80px); overflow: auto; box-shadow: var(--ombre-haute); }
}
@media (min-width: 1180px) {
  .ndf-recherche-corps { grid-template-columns: 250px minmax(0, 1fr) minmax(360px, 40%); }
  .ndf-facettes { display: flex; flex-direction: column; gap: 12px; position: sticky; top: calc(var(--entete) + 76px); left: auto; width: auto; box-shadow: var(--ombre); max-height: calc(100vh - var(--entete) - 92px); }
  .ndf-filtres-bouton { display: none; }
}
@media (max-width: 759px) {
  .ndf-facettes.ouvert { position: fixed; inset: auto 0 0 0; z-index: 70; max-height: 80vh; overflow: auto; border-radius: 16px 16px 0 0; padding-bottom: calc(20px + env(safe-area-inset-bottom)); box-shadow: var(--ombre-haute); }
  .ndf-apercu.mobile-ouvert { display: block; position: fixed; inset: 0; z-index: 80; background: var(--carte); overflow: auto; padding-bottom: env(safe-area-inset-bottom); }
}
.ndf-apercu-vide { display: grid; place-items: center; text-align: center; padding: 60px 20px; color: var(--doux); }
.ndf-apercu-vide svg { width: 40px; height: 40px; }
.ndf-apercu-tete { display: flex; align-items: center; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--bord); position: sticky; top: 0; background: var(--carte); z-index: 2; }
.ndf-apercu-tete h2 { margin: 0; flex: 1; font-size: 1rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ndf-apercu-champs { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 4px 14px; padding: 12px 14px; font-size: .9rem; margin: 0; }
.ndf-apercu-champs dt { color: var(--doux); }
.ndf-apercu-champs dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.ndf-apercu .ndf-visionneuse { border-radius: 0; border-left: 0; border-right: 0; }
.ndf-apercu-fermer { display: none; }
@media (max-width: 759px) { .ndf-apercu-fermer { display: inline-flex; } }

/* Réponse à une question */
.ndf-reponse { background: var(--carte); border: 1px solid var(--accent); border-radius: var(--rayon); padding: 14px 16px; margin-bottom: 14px; box-shadow: var(--ombre); }
.ndf-reponse-phrase { font-size: 1.15rem; font-weight: 700; margin: 0 0 4px; }
.ndf-reponse-portee { color: var(--doux); font-size: .88rem; margin: 0 0 8px; }
.ndf-reponse table { margin-top: 8px; }
.ndf-reponse.chargement { border-color: var(--bord); color: var(--doux); }

/* ---------- Visionneuse d'image (zoom, rotation, surlignage posé sur la photo) ---------- */
.ndf-visionneuse { position: relative; background: #2a2f37; border-radius: var(--rayon); overflow: hidden; border: 1px solid var(--bord); user-select: none; }
.ndf-visionneuse-scene { position: relative; overflow: hidden; height: min(68vh, 760px); touch-action: none; cursor: grab; }
.ndf-apercu .ndf-visionneuse-scene { height: min(52vh, 600px); }
.ndf-visionneuse-scene.glisse { cursor: grabbing; }
.ndf-visionneuse-contenu { position: absolute; left: 0; top: 0; transform-origin: 0 0; will-change: transform; }
.ndf-visionneuse-contenu img { display: block; max-width: none; }
.ndf-calque { position: absolute; inset: 0; pointer-events: none; }
.ndf-calque span { position: absolute; background: rgba(255, 235, 59, .55); outline: 2px solid #ffeb3b; border-radius: 2px; mix-blend-mode: multiply; }
.ndf-visionneuse-outils { position: absolute; right: 8px; top: 8px; display: flex; gap: 6px; z-index: 3; }
.ndf-visionneuse-outils button, .ndf-visionneuse-outils a { width: 36px; height: 36px; border-radius: 9px; border: 0; background: rgba(20, 24, 30, .72); color: #fff; display: grid; place-items: center; cursor: pointer; }
.ndf-visionneuse-outils button:hover, .ndf-visionneuse-outils a:hover { background: rgba(20, 24, 30, .92); }
.ndf-visionneuse-pages { display: flex; gap: 6px; padding: 8px; background: #20242b; overflow-x: auto; }
.ndf-visionneuse-pages button { flex: none; width: 44px; height: 56px; padding: 0; border: 2px solid transparent; border-radius: 6px; overflow: hidden; background: #000; cursor: pointer; }
.ndf-visionneuse-pages button.actif { border-color: var(--surligne); }
.ndf-visionneuse-pages img { width: 100%; height: 100%; object-fit: cover; }
.ndf-visionneuse-info { position: absolute; left: 8px; bottom: 8px; z-index: 3; background: rgba(20, 24, 30, .78); color: #fff; font-size: .8rem; padding: 4px 9px; border-radius: 7px; }
.ndf-visionneuse-vide { display: grid; place-items: center; height: 260px; color: #aeb6c2; text-align: center; padding: 20px; }

/* ---------- Fiche dépense ---------- */
.ndf-fiche-tete { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.ndf-fiche-tete h1 { margin: 0; flex: 1 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.ndf-fiche-tete .ndf-lien { flex-basis: 100%; }
.ndf-fiche-corps { display: grid; grid-template-columns: 1fr; gap: 16px; align-items: start; }
@media (min-width: 960px) { .ndf-fiche-corps { grid-template-columns: minmax(0, 1fr) minmax(380px, 520px); } .ndf-fiche-image { position: sticky; top: calc(var(--entete) + 12px); } }
.ndf-fiche-lecture { margin-top: 8px; padding: 10px 12px; border-radius: 10px; background: var(--accent-doux); color: var(--accent); font-weight: 600; }
.ndf-texte-integral summary { cursor: pointer; font-weight: 600; }
.ndf-texte-integral pre { white-space: pre-wrap; word-break: break-word; max-height: 420px; overflow: auto; background: var(--carte-2); padding: 12px; border-radius: 8px; margin: 10px 0 6px; }
.ndf-decision { border-top: 1px solid var(--bord); padding-top: 12px; }
.ndf-commentaires { list-style: none; margin: 0 0 10px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.ndf-commentaires li { background: var(--carte-2); border-radius: 10px; padding: 8px 12px; }
.ndf-commentaires li small { color: var(--doux); display: block; }
.ndf-commentaire-form { display: flex; gap: 8px; }
.ndf-commentaire-form input { flex: 1; }

/* ---------- Tableaux ---------- */
.ndf-tableau-defilant { overflow-x: auto; -webkit-overflow-scrolling: touch; }
.ndf-table { width: 100%; border-collapse: collapse; font-size: .9rem; }
.ndf-table th { text-align: left; font-size: .76rem; text-transform: uppercase; letter-spacing: .04em; color: var(--doux); font-weight: 700; padding: 8px 10px; border-bottom: 1px solid var(--bord); white-space: nowrap; }
.ndf-table td { padding: 9px 10px; border-bottom: 1px solid var(--bord); vertical-align: middle; }
.ndf-table tr:last-child td { border-bottom: 0; }
.ndf-table tbody tr:hover td { background: var(--carte-2); }
.ndf-table input, .ndf-table select { min-height: 36px; padding: 5px 8px; border-radius: 7px; border: 1px solid var(--bord-fort); background: var(--carte); color: var(--texte); font: inherit; width: 100%; }
.ndf-table .ndf-actions { margin: 0; flex-wrap: nowrap; }
.ndf-table .ndf-bouton { min-height: 32px; padding: 4px 10px; font-size: .85rem; }

/* ---------- Mois ---------- */
.ndf-annee { display: inline-flex; align-items: center; gap: 4px; background: var(--carte); border: 1px solid var(--bord); border-radius: 999px; padding: 2px; }
.ndf-annee strong { min-width: 64px; text-align: center; font-variant-numeric: tabular-nums; }
.ndf-grille-mois { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 12px; margin-bottom: 16px; }
.ndf-mois { background: var(--carte); border: 1px solid var(--bord); border-radius: var(--rayon); padding: 14px; display: flex; flex-direction: column; gap: 8px; box-shadow: var(--ombre); }
.ndf-mois.courant { border-color: var(--accent); }
.ndf-mois.vide { opacity: .72; }
.ndf-mois-tete { display: flex; justify-content: space-between; align-items: center; gap: 8px; }
.ndf-mois-tete h3 { margin: 0; font-size: 1rem; color: var(--texte); text-transform: none; letter-spacing: 0; }
.ndf-mois-total { font-size: 1.4rem; font-weight: 700; font-variant-numeric: tabular-nums; }
.ndf-mois-detail { font-size: .83rem; color: var(--doux); display: flex; flex-wrap: wrap; gap: 4px 10px; }
.ndf-mois-detail .attention { color: var(--attention); font-weight: 600; }
.ndf-mois .ndf-actions { margin-top: auto; }
.ndf-mois .ndf-bouton { min-height: 34px; padding: 5px 11px; font-size: .86rem; }
.ndf-barre-categories { display: flex; height: 8px; border-radius: 4px; overflow: hidden; background: var(--carte-2); gap: 2px; }
.ndf-barre-categories span { display: block; height: 100%; }

/* ---------- Statistiques ---------- */
.ndf-graphique { position: relative; width: 100%; min-height: 120px; }
.ndf-graphique svg { width: 100%; height: auto; display: block; overflow: visible; }
.ndf-graphique.recharge, .recharge { opacity: .55; transition: opacity .15s; }
.ndf-legende { display: flex; gap: 14px; font-size: .82rem; color: var(--texte-2); margin-left: auto; }
.ndf-legende span { display: inline-flex; align-items: center; gap: 6px; }
.ndf-legende i { width: 12px; height: 12px; border-radius: 3px; display: inline-block; }
.ndf-barres-h { display: flex; flex-direction: column; gap: 8px; }
.ndf-barre-h { display: grid; grid-template-columns: minmax(90px, 34%) 1fr auto; gap: 10px; align-items: center; font-size: .88rem; }
.ndf-barre-h .libelle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--texte-2); }
.ndf-barre-h .piste { height: 14px; position: relative; }
.ndf-barre-h .piste span { position: absolute; left: 0; top: 0; bottom: 0; background: var(--viz-serie-1); border-radius: 0 4px 4px 0; min-width: 2px; }
.ndf-barre-h:hover .piste span { filter: brightness(1.12); }
.ndf-barre-h .valeur { font-variant-numeric: tabular-nums; font-weight: 600; white-space: nowrap; }
.ndf-infobulle { position: fixed; z-index: 120; pointer-events: none; background: var(--carte); color: var(--texte); border: 1px solid var(--bord); border-radius: 9px; box-shadow: var(--ombre-haute); padding: 8px 11px; font-size: .85rem; min-width: 150px; }
.ndf-infobulle strong { display: block; font-size: .95rem; }
.ndf-infobulle .cle { display: inline-block; width: 12px; height: 3px; border-radius: 2px; vertical-align: middle; margin-right: 6px; }
.ndf-infobulle div { display: flex; justify-content: space-between; gap: 14px; }
.ndf-liste-simple { list-style: none; margin: 0; padding: 0; }
.ndf-liste-simple li { padding: 8px 2px; border-bottom: 1px solid var(--bord); display: flex; justify-content: space-between; gap: 10px; }
.ndf-liste-simple li:last-child { border-bottom: 0; }
.viz-root .ndf-tableau-donnees { margin-top: 10px; }

/* ---------- Admin ---------- */
.ndf-onglets { display: flex; gap: 4px; overflow-x: auto; border-bottom: 1px solid var(--bord); margin-bottom: 16px; }
.ndf-onglets button { padding: 10px 14px; border: 0; background: none; font: inherit; font-weight: 600; color: var(--doux); cursor: pointer; border-bottom: 3px solid transparent; white-space: nowrap; }
.ndf-onglets button[aria-selected="true"] { color: var(--accent); border-bottom-color: var(--accent); }
.ndf-dialogue { border: 0; border-radius: 16px; padding: 22px; width: min(620px, calc(100vw - 24px)); background: var(--carte); color: var(--texte); box-shadow: var(--ombre-haute); }
.ndf-dialogue::backdrop { background: rgba(10, 15, 25, .5); }
.ndf-copie { display: flex; gap: 8px; margin: 12px 0; }
.ndf-definitions { display: grid; grid-template-columns: auto 1fr; gap: 6px 16px; margin: 0 0 14px; }
.ndf-definitions dt { color: var(--doux); }
.ndf-definitions dd { margin: 0; font-weight: 500; overflow-wrap: anywhere; }
.ndf-profil { max-width: 1100px; margin: 0 auto; }
.ndf-profil #p-2fa-qr { background: #fff; padding: 8px; border-radius: 10px; display: block; margin: 6px 0; }

/* Impression : seulement le contenu. */
@media print {
  .ndf-entete, .ndf-barre-mobile, .ndf-toasts, .ndf-actions { display: none !important; }
  body.ndf { background: #fff; padding: 0; }
  .ndf-carte { box-shadow: none; }
}
@media (prefers-reduced-motion: reduce) { * { animation: none !important; transition: none !important; } }
