/* =============================================================================
   ATLA — THÈME NUIT (refonte du 26 sept. 2026, demande d'Ulrik)
   Noir profond, bleu électrique, blanc. Une seule palette pour tous les modules.
   Chargé en dernier. Tout est rattaché à html.nuit : retirer la classe « nuit »
   de <html> rétablit l'ancien thème sans rien casser.
   Les anciennes feuilles ont chacune leur jeu de couleurs (--gold, --cw-*,
   --vente-*, --sw-*, --ps-*) : on les fait toutes pointer vers les jetons ci-dessous.
   ============================================================================= */

html.nuit{
  /* Surfaces */
  --n-void:#020406; --n-bg:#05080c; --n-bg-2:#070b10;
  --n-panel:#0a1016; --n-panel-2:#0d151c; --n-raised:#111b24; --n-hover:#142130;
  /* Traits */
  --n-line:#15212b; --n-line-2:#1d2d3a; --n-line-3:#2a4152;
  /* Encre */
  --n-ink:#f4f8fb; --n-ink-2:#c9d5df; --n-muted:#8b9dac; --n-faint:#5b6c7a;
  /* Accents */
  --n-cyan:#6ee7f9; --n-blue:#3b9dff; --n-blue-2:#1f6bff; --n-accent:#6ee7f9; --n-accent-ink:#021219;
  --n-accent-soft:rgba(110,231,249,.10); --n-accent-line:rgba(110,231,249,.34); --n-glow:rgba(59,157,255,.30);
  --n-grad:linear-gradient(135deg,#7eecfb 0%,#3b9dff 100%);
  /* États */
  --n-green:#34d399; --n-amber:#fbbf24; --n-red:#ff5a6e; --n-violet:#a78bfa;
  /* Formes */
  --n-r-lg:16px; --n-r:12px; --n-r-sm:9px;
  --n-ease:cubic-bezier(.2,.8,.2,1);
  --n-shadow:0 1px 0 rgba(255,255,255,.035) inset,0 24px 48px -28px rgba(0,0,0,.9);
  --n-font:'Inter',-apple-system,BlinkMacSystemFont,'Segoe UI',Roboto,sans-serif;
  --n-display:'Montserrat','Inter',sans-serif;

  /* Anciens jetons globaux → nouvelle palette */
  --black:var(--n-bg); --off-black:var(--n-bg-2); --surface:var(--n-panel); --surface-2:var(--n-raised);
  --line:var(--n-line-2); --gold:var(--n-cyan); --gold-light:#9af0fc; --accent-dark:#34c6e6; --accent-ink:var(--n-accent-ink);
  --parchment:var(--n-ink); --gray-300:var(--n-ink-2); --gray-500:var(--n-muted); --gray-700:var(--n-faint);
  --field-line:var(--n-line-3); --radius:var(--n-r-sm); --radius-sm:8px;
  --green:#22b57c; --green-light:var(--n-green); --red:#e23d55; --red-light:var(--n-red);
  --amber:#e0a21c; --amber-light:var(--n-amber); --info:var(--n-blue); --info-light:#7fbcff;
  --wine:#e23d55; --wine-light:var(--n-red);
  /* Jetons des espaces de travail */
  --cw-panel:var(--n-panel); --cw-raised:var(--n-raised); --cw-line:var(--n-line-2); --cw-muted:var(--n-muted);
  --cw-ink:var(--n-ink); --cw-accent:var(--n-cyan); --cw-radius:var(--n-r-lg);
  color-scheme:dark;
}
html.nuit #clientsView{--vente-ink:var(--n-ink);--vente-muted:var(--n-muted);--vente-cyan:var(--n-cyan);--vente-panel:var(--n-panel);--vente-line:var(--n-line-2);}
html.nuit #soumissionView{--sw-muted:var(--n-muted);--sw-edge:var(--n-line-2);--sw-panel:var(--n-panel);--sw-ink:var(--n-ink);--sw-accent:var(--n-cyan);}
html.nuit .ps-dialog{--ps-bg:var(--n-bg-2);--ps-panel:var(--n-panel);--ps-line:var(--n-line-2);--ps-ink:var(--n-ink);--ps-muted:var(--n-muted);--ps-accent:var(--n-cyan);}

/* ---------- Base ---------------------------------------------------------- */
html.nuit body{
  font-family:var(--n-font)!important; font-size:14px; color:var(--n-ink-2);
  background:var(--n-bg)!important;
  -webkit-font-smoothing:antialiased; font-feature-settings:"cv11","ss01";
}
html.nuit .main-col{background:
    linear-gradient(rgba(110,231,249,.018) 1px,transparent 1px) 0 0/48px 48px,
    linear-gradient(90deg,rgba(110,231,249,.018) 1px,transparent 1px) 0 0/48px 48px;}
html.nuit button,html.nuit input,html.nuit select,html.nuit textarea{font-family:var(--n-font)!important;}
html.nuit :is(h1,h2,h3,.cw-hero h2,.sw-header h2,.vente-hero h2){font-family:var(--n-display)!important;color:var(--n-ink);}
html.nuit h3{letter-spacing:-.01em;}
html.nuit ::selection{background:rgba(110,231,249,.28);color:#fff;}
html.nuit :focus-visible{outline:2px solid var(--n-cyan)!important;outline-offset:2px!important;}
html.nuit .num,html.nuit .mt-amount,html.nuit td.num,html.nuit .stat-card .num{font-variant-numeric:tabular-nums;}
html.nuit *{scrollbar-width:thin;scrollbar-color:#1f3342 transparent;}
html.nuit ::-webkit-scrollbar{width:10px;height:10px;}
html.nuit ::-webkit-scrollbar-thumb{background:#1a2a37;border-radius:10px;border:2px solid transparent;background-clip:padding-box;}
html.nuit ::-webkit-scrollbar-thumb:hover{background:#27465a;background-clip:padding-box;}
html.nuit a{color:var(--n-cyan);}

/* Mouvement : court, sur action seulement. Réduit si le système le demande. */
html.nuit :is(button,a,input,select,textarea,.side-nav-btn,.client-card,.project-card,.stat-card,.cw-panel,.cw-shortcut,.vente-card,.st-partner,.st-mandat,.partner-card){
  transition-property:background-color,border-color,color,box-shadow,transform,opacity!important;
  transition-duration:.18s!important; transition-timing-function:var(--n-ease)!important;
}
/* Pas d’opacité : si une animation est suspendue, le contenu reste visible. */
@keyframes nuit-entree{from{transform:translateY(6px)}to{transform:none}}
/* Halo du fond sur une couche fixe composée par la carte graphique : l'ancien
   background-attachment:fixed forçait un repeint complet à chaque pixel de défilement. */
html.nuit body::before{content:"";position:fixed;inset:0;z-index:-1;pointer-events:none;contain:strict;
  background:radial-gradient(1200px 600px at 100% -10%,rgba(31,107,255,.11),transparent 60%),radial-gradient(900px 500px at -10% 110%,rgba(110,231,249,.05),transparent 60%);}
/* Pulsation des pastilles « en ligne » : un anneau qui grandit et s'efface (transform + opacity,
   sans repeint), de la couleur de la pastille, quel que soit son état. */
@keyframes nuit-pouls{0%{transform:scale(1);opacity:.55}70%,100%{transform:scale(2.6);opacity:0}}
html.nuit .container>[id$="View"]{animation:nuit-entree .26s var(--n-ease) both!important;}
@media (prefers-reduced-motion:reduce){
  html.nuit .container>[id$="View"]{animation:none!important;}
  html.nuit *{transition:none!important;}
}

/* ---------- Barre latérale ------------------------------------------------ */
html.nuit .sidebar{
  width:248px; background:linear-gradient(180deg,#060a0e,#030507)!important;
  border-right:1px solid var(--n-line)!important; box-shadow:1px 0 0 rgba(110,231,249,.05);
  padding:0!important;
}
html.nuit .sidebar-brand{padding:22px 20px 18px!important;border-bottom:1px solid var(--n-line)!important;}
html.nuit .sidebar-brand .tag{display:none!important;}
html.nuit .nv-marque{display:flex;align-items:center;gap:12px;margin-bottom:14px;}
html.nuit .nv-embleme{width:34px;height:34px;border-radius:9px;display:grid;place-items:center;background:linear-gradient(145deg,#0f1c26,#070d12);border:1px solid var(--n-line-3);box-shadow:inset 0 1px rgba(255,255,255,.06),0 0 18px rgba(59,157,255,.18);}
html.nuit .nv-embleme svg{width:18px;height:18px;color:var(--n-cyan);}
html.nuit .nv-mot{font-family:var(--n-display);font-weight:800;font-size:17px;letter-spacing:.34em;color:#fff;line-height:1;}
html.nuit .nv-sous{display:block;font-size:9px;letter-spacing:.32em;color:var(--n-cyan);margin-top:5px;font-weight:600;}
html.nuit .personne-chip{background:var(--n-panel-2)!important;border:1px solid var(--n-line-2)!important;color:var(--n-ink)!important;border-radius:999px!important;padding:6px 12px!important;font-size:12px!important;}
html.nuit .personne-chip .dot{background:var(--n-green)!important;}
html.nuit .sidebar-nav{padding:14px 12px!important;gap:2px!important;}
html.nuit .nv-groupe{display:block;font-size:9.5px;font-weight:700;letter-spacing:.2em;text-transform:uppercase;color:var(--n-faint);padding:14px 10px 6px;}
html.nuit .nv-groupe:first-child{padding-top:2px;}
html.nuit .side-nav-btn{
  display:flex!important;align-items:center;gap:12px;width:100%;
  padding:9px 12px!important;border:0!important;border-radius:10px!important;
  background:transparent!important;color:var(--n-muted)!important;
  font-size:13.5px!important;font-weight:500!important;letter-spacing:0!important;text-align:left;
  position:relative;box-shadow:none!important;transform:none!important;
}
html.nuit .side-nav-btn .nv-ic{width:18px;height:18px;flex:0 0 18px;color:var(--n-faint);}
html.nuit .side-nav-btn:hover{background:rgba(110,231,249,.05)!important;color:var(--n-ink)!important;}
html.nuit .side-nav-btn:hover .nv-ic{color:var(--n-ink-2);}
html.nuit .side-nav-btn.active{
  background:linear-gradient(90deg,rgba(110,231,249,.13),rgba(59,157,255,.04) 70%,transparent)!important;
  color:#fff!important;font-weight:600!important;
}
html.nuit .side-nav-btn.active .nv-ic{color:var(--n-cyan);filter:drop-shadow(0 0 6px rgba(110,231,249,.55));}
html.nuit .side-nav-btn.active::before{content:"";position:absolute;left:-12px;top:8px;bottom:8px;width:3px;border-radius:0 3px 3px 0;background:var(--n-grad);box-shadow:0 0 12px rgba(110,231,249,.7);}
html.nuit .sidebar-footer{border-top:1px solid var(--n-line)!important;padding:10px 12px 14px!important;}
html.nuit .sidebar-footer .side-nav-btn{font-size:12.5px!important;padding:7px 12px!important;}
/* Mode compact : icônes seules */
html.nuit .nv-replier{display:flex;align-items:center;justify-content:center;width:100%;margin-top:6px;padding:7px!important;background:transparent!important;border:1px dashed var(--n-line-2)!important;color:var(--n-faint)!important;border-radius:9px!important;font-size:11px!important;gap:8px;}
html.nuit .nv-replier:hover{color:var(--n-ink)!important;border-color:var(--n-line-3)!important;}
html.nuit .nv-replier svg{width:15px;height:15px;}
@media (min-width:901px){
  html.nuit.nv-compact .sidebar{width:76px;}
  html.nuit.nv-compact :is(.nv-lbl,.nv-groupe,.nv-mot,.nv-sous,.personne-chip){display:none!important;}
  html.nuit.nv-compact .nv-marque{justify-content:center;margin:0;}
  html.nuit.nv-compact .sidebar-brand{padding:18px 0!important;display:flex;justify-content:center;}
  html.nuit.nv-compact .side-nav-btn{justify-content:center;padding:11px 0!important;}
  html.nuit.nv-compact .nv-replier svg{transform:rotate(180deg);}
  html.nuit.nv-compact .side-nav-btn[data-titre]:hover::after{content:attr(data-titre);position:absolute;left:calc(100% + 12px);top:50%;transform:translateY(-50%);white-space:nowrap;background:#0d1720;border:1px solid var(--n-line-3);color:#fff;font-size:12px;padding:6px 10px;border-radius:8px;box-shadow:0 10px 30px rgba(0,0,0,.6);z-index:60;pointer-events:none;}
}

/* ---------- Barre du haut ------------------------------------------------- */
html.nuit .topbar{
  position:sticky;top:0;z-index:30;min-height:60px;
  background:rgba(4,7,10,.72)!important;backdrop-filter:blur(16px) saturate(140%);-webkit-backdrop-filter:blur(16px) saturate(140%);
  border-bottom:1px solid var(--n-line)!important;box-shadow:0 1px 0 rgba(110,231,249,.04);
}
html.nuit .cw-top-context{font-size:12px!important;color:var(--n-faint)!important;letter-spacing:.14em;text-transform:uppercase;}
html.nuit .cw-top-context strong{color:var(--n-ink)!important;letter-spacing:0;text-transform:none;font-size:13px;font-weight:600;}
html.nuit #rechercheGlobale{
  background:#070c11 url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%235b6c7a' stroke-width='2' stroke-linecap='round'%3E%3Ccircle cx='11' cy='11' r='7'/%3E%3Cpath d='m20 20-3.5-3.5'/%3E%3C/svg%3E") 12px 50%/15px no-repeat!important;
  border:1px solid var(--n-line-2)!important;border-radius:10px!important;padding:9px 12px 9px 36px!important;color:var(--n-ink)!important;min-width:260px;
}
html.nuit #rechercheGlobale:focus{border-color:var(--n-accent-line)!important;box-shadow:0 0 0 3px rgba(110,231,249,.12)!important;}
html.nuit #cwOpenNavigator kbd{background:#0d1720;border:1px solid var(--n-line-3);border-radius:5px;padding:1px 6px;font-size:10.5px;color:var(--n-ink-2);font-family:var(--n-font);}
html.nuit .sync-pill{background:transparent!important;border:1px solid var(--n-line-2)!important;border-radius:999px!important;color:var(--n-muted)!important;font-size:10.5px!important;letter-spacing:.12em!important;display:inline-flex!important;align-items:center;gap:7px;padding:5px 12px 5px 10px!important;white-space:nowrap;}
html.nuit .topbar :is(#backupReminder,#signatureAlert,#pendingAlert,#missingPunchAlert,#garantieAlert,#meteoAlert,#suiviPostChantierAlert,#infoExcavationAlert,#infoExcavationExpireeAlert,#entretienMachinerieAlert){
  border-radius:999px!important;padding:5px 11px!important;font-size:11px!important;font-weight:600!important;letter-spacing:.02em!important;
  background:rgba(251,191,36,.08)!important;border:1px solid rgba(251,191,36,.3)!important;color:#fcd98a!important;
}
html.nuit .user-chip{color:var(--n-muted)!important;font-size:12px!important;}

/* ---------- Contenu ------------------------------------------------------- */
html.nuit .container{padding:28px 36px 80px!important;}
html.nuit :is(.cw-hero,.sw-header){padding:10px 0 26px!important;border:0!important;}
html.nuit :is(.cw-eyebrow,.sw-eyebrow,.vente-hero .cw-eyebrow){
  font-family:var(--n-font)!important;font-size:10.5px!important;font-weight:700!important;letter-spacing:.24em!important;text-transform:uppercase;color:var(--n-cyan)!important;
  display:inline-flex;align-items:center;gap:10px;
}
html.nuit :is(.cw-eyebrow,.sw-eyebrow)::before{content:"";width:18px;height:2px;border-radius:2px;background:var(--n-grad);box-shadow:0 0 10px rgba(110,231,249,.6);}
html.nuit :is(.cw-hero h2,.sw-header h2,.vente-hero h2){font-size:clamp(30px,3.2vw,44px)!important;font-weight:800!important;letter-spacing:-.03em!important;line-height:1.05!important;color:#fff!important;margin:10px 0 0!important;}
html.nuit .vente-hero h2 span{color:var(--n-cyan)!important;}

/* Panneaux et cartes */
html.nuit :is(.cw-panel,.dash-bloc,.gestion-panel,.gestion-details,.kpi-card,.panel-card,.vente-hero,.vente-priorities>*,#swSuivi,.sw-overview){
  background:linear-gradient(180deg,rgba(255,255,255,.022),rgba(255,255,255,0) 38%),var(--n-panel)!important;
  border:1px solid var(--n-line-2)!important;border-radius:var(--n-r-lg)!important;box-shadow:var(--n-shadow)!important;
}
html.nuit .vente-hero{background:
  radial-gradient(600px 240px at 88% 0%,rgba(59,157,255,.14),transparent 70%),
  linear-gradient(180deg,rgba(255,255,255,.025),transparent 40%),var(--n-panel)!important;overflow:hidden;}
html.nuit .cw-panel-head h3,html.nuit .cw-panel h3{color:#fff;font-weight:700;}
html.nuit :is(.client-card,.project-card,.produit-card,.vente-card,.st-partner,.st-mandat,.cw-shortcut,.pipeline-card){
  background:linear-gradient(180deg,rgba(255,255,255,.02),transparent 45%),var(--n-panel-2)!important;
  border:1px solid var(--n-line-2)!important;border-radius:var(--n-r)!important;box-shadow:none!important;color:var(--n-ink-2)!important;
}
@media (hover:hover) and (pointer:fine){
  html.nuit :is(.client-card,.project-card,.vente-card,.st-partner,.st-mandat,.cw-shortcut,.pipeline-card,.stat-card.clickable,.kpi-card):hover{
    border-color:var(--n-accent-line)!important;transform:translateY(-2px)!important;
    box-shadow:0 0 0 1px rgba(110,231,249,.12),0 18px 40px -20px rgba(59,157,255,.45)!important;
  }
}
html.nuit :is(.client-card,.project-card) :is(h3,h4,.name,strong){color:#fff!important;}
html.nuit .client-card{opacity:1!important;filter:none!important;}

/* Indicateurs */
html.nuit .stat-card{
  background:linear-gradient(180deg,rgba(110,231,249,.05),transparent 55%),var(--n-panel)!important;
  border:1px solid var(--n-line-2)!important;border-radius:var(--n-r)!important;position:relative;overflow:hidden;box-shadow:var(--n-shadow)!important;
}
html.nuit .stat-card::before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--n-grad);opacity:.7;}
html.nuit .stat-card .num{font-family:var(--n-display)!important;font-weight:700!important;color:#fff!important;letter-spacing:-.02em;}
html.nuit .stat-card .label{color:var(--n-muted)!important;font-size:10.5px!important;letter-spacing:.14em!important;text-transform:uppercase;font-weight:600!important;}

/* Libellés de section */
html.nuit :is(.section-label,.section-title){color:var(--n-muted)!important;font-size:10.5px!important;font-weight:700!important;letter-spacing:.2em!important;text-transform:uppercase;border-color:var(--n-line)!important;}

/* Tableaux */
html.nuit :is(.montants-table,.cw-panel table,table.data){background:transparent!important;border:1px solid var(--n-line-2)!important;border-radius:var(--n-r)!important;border-collapse:separate!important;border-spacing:0;overflow:hidden;}
html.nuit table th{background:var(--n-panel-2)!important;color:var(--n-muted)!important;font-size:10.5px!important;font-weight:700!important;letter-spacing:.12em!important;text-transform:uppercase;border-bottom:1px solid var(--n-line-2)!important;padding:11px 14px!important;}
html.nuit table td{border-bottom:1px solid var(--n-line)!important;color:var(--n-ink-2);padding:11px 14px!important;}
html.nuit table tbody tr:last-child td{border-bottom:0!important;}
html.nuit table tbody tr:hover td{background:rgba(110,231,249,.035)!important;}
html.nuit table tbody tr:hover td:first-child{box-shadow:inset 2px 0 0 var(--n-cyan);}
html.nuit .montants-table .mt-total,html.nuit .montants-table tr.total td{color:#fff!important;font-weight:700!important;background:rgba(110,231,249,.05)!important;}
html.nuit .cw-table-wrap{border-radius:var(--n-r);}

/* Boutons */
html.nuit :is(.btn-primary,button.btn-primary,a.btn-primary){
  background:var(--n-grad)!important;color:var(--n-accent-ink)!important;border:0!important;border-radius:10px!important;
  font-weight:700!important;letter-spacing:.01em!important;box-shadow:0 0 0 1px rgba(126,236,251,.35) inset,0 10px 26px -12px var(--n-glow)!important;transform:none;
}
html.nuit :is(.btn-primary):hover{filter:brightness(1.08) saturate(1.05);box-shadow:0 0 0 1px rgba(126,236,251,.6) inset,0 14px 32px -12px rgba(59,157,255,.6)!important;transform:translateY(-1px)!important;}
html.nuit :is(.btn-primary):active{transform:translateY(0)!important;filter:brightness(.96);}
html.nuit :is(.btn-outline,.btn-ghost,.icon-btn):not(.nav-tab):not(.subtab-btn){
  background:rgba(255,255,255,.015)!important;border:1px solid var(--n-line-3)!important;color:var(--n-ink-2)!important;border-radius:10px!important;font-weight:600!important;box-shadow:none!important;
}
html.nuit .btn-ghost{border-color:transparent!important;background:transparent!important;color:var(--n-muted)!important;}
html.nuit :is(.btn-outline,.btn-ghost,.icon-btn):hover{border-color:var(--n-accent-line)!important;color:#fff!important;background:var(--n-accent-soft)!important;}
html.nuit .btn-danger{background:rgba(255,90,110,.06)!important;border:1px solid rgba(255,90,110,.4)!important;color:#ff9aa7!important;border-radius:10px!important;}
html.nuit .btn-danger:hover{background:rgba(255,90,110,.14)!important;color:#fff!important;}
html.nuit a:is(.btn-primary,.btn-outline,.btn-ghost,.btn-danger,.btn-small){text-decoration:none!important;}
html.nuit button:disabled{opacity:.45!important;cursor:not-allowed!important;transform:none!important;filter:none!important;}
html.nuit .close-x{width:34px;height:34px;display:grid;place-items:center;border-radius:9px!important;background:transparent!important;border:1px solid var(--n-line-2)!important;color:var(--n-muted)!important;}
html.nuit .close-x:hover{color:#fff!important;border-color:var(--n-accent-line)!important;background:var(--n-accent-soft)!important;}

/* Champs */
html.nuit :is(.field input,.field select,.field textarea,input[type="text"],input[type="search"],input[type="email"],input[type="tel"],input[type="number"],input[type="date"],input[type="time"],input[type="password"],input[type="url"],select,textarea):not(.nv-brut){
  background:#060a0e!important;border:1px solid var(--n-line-3)!important;color:var(--n-ink)!important;border-radius:10px!important;
  box-shadow:inset 0 1px 2px rgba(0,0,0,.5)!important;
}
html.nuit :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not(.nv-brut):hover{border-color:#36536a!important;}
html.nuit :is(input,select,textarea):not([type="checkbox"]):not([type="radio"]):not(.nv-brut):focus{
  border-color:var(--n-cyan)!important;box-shadow:0 0 0 3px rgba(110,231,249,.14),inset 0 1px 2px rgba(0,0,0,.5)!important;outline:none!important;
}
html.nuit ::placeholder{color:var(--n-faint)!important;opacity:1;}
html.nuit .field label,html.nuit label.st-field,html.nuit .vente-filters label{color:var(--n-muted)!important;font-size:10.5px!important;font-weight:700!important;letter-spacing:.12em!important;text-transform:uppercase;}
html.nuit input[type="checkbox"],html.nuit input[type="radio"]{accent-color:var(--n-cyan);}

/* Onglets */
html.nuit :is(.subtab-bar,.nav-tabs,.sw-nav,.vente-view-toggle){
  display:inline-flex!important;flex-wrap:wrap;gap:4px!important;padding:4px!important;
  background:#060a0e!important;border:1px solid var(--n-line-2)!important;border-radius:12px!important;box-shadow:inset 0 1px 2px rgba(0,0,0,.5);width:auto!important;max-width:100%;
}
html.nuit :is(.subtab-btn,.nav-tab,.sw-nav button,.vente-view-toggle button){
  background:transparent!important;border:0!important;border-radius:9px!important;color:var(--n-muted)!important;
  padding:9px 16px!important;font-weight:600!important;font-size:13px!important;box-shadow:none!important;position:relative;
}
html.nuit :is(.subtab-btn,.nav-tab,.sw-nav button,.vente-view-toggle button):hover{color:#fff!important;background:rgba(255,255,255,.03)!important;}
html.nuit :is(.subtab-btn.active,.nav-tab.active,.sw-nav button[aria-pressed="true"],.vente-view-toggle button.active){
  background:linear-gradient(180deg,#15232e,#0f1a23)!important;color:#fff!important;
  box-shadow:0 0 0 1px rgba(110,231,249,.28) inset,0 6px 18px -10px rgba(59,157,255,.6)!important;
}
html.nuit :is(.subtab-btn.active,.nav-tab.active,.sw-nav button[aria-pressed="true"])::after{content:"";position:absolute;left:16px;right:16px;bottom:3px;height:2px;border-radius:2px;background:var(--n-grad);box-shadow:0 0 8px rgba(110,231,249,.7);}

/* Fenêtres (anciennes superpositions et dialogues récents) */
html.nuit .overlay{background:rgba(1,3,5,.74)!important;backdrop-filter:blur(8px)!important;-webkit-backdrop-filter:blur(8px)!important;}
html.nuit :is(.overlay .panel,.st-dialog,.cw-document-dialog,.chiffrage-dialog,.db-dialog,.ps-dialog,#cwNavigator,dialog.nuit-dialog,dialog:not([class]):not([id]),.soum-review,.visite-photo-dialog){
  background:linear-gradient(180deg,rgba(255,255,255,.03),transparent 30%),#0a1117!important;
  border:1px solid var(--n-line-3)!important;border-radius:18px!important;color:var(--n-ink-2)!important;
  box-shadow:0 0 0 1px rgba(110,231,249,.06),0 40px 120px -20px rgba(0,0,0,.95),0 0 60px -30px rgba(59,157,255,.45)!important;
}
html.nuit :is(.st-dialog,.cw-document-dialog,.chiffrage-dialog,.db-dialog,.ps-dialog,#cwNavigator,dialog)::backdrop{background:rgba(1,3,5,.74);backdrop-filter:blur(8px);}
html.nuit .overlay.open .panel{animation:nuit-entree .22s var(--n-ease) both!important;}
html.nuit .panel-header{background:transparent!important;border-bottom:1px solid var(--n-line-2)!important;}
html.nuit .panel-header h2{font-family:var(--n-display)!important;color:#fff!important;font-weight:700!important;letter-spacing:-.01em!important;}

/* Pastilles et états */
html.nuit :is(.badge,.etape-tag,.affectation-chip,.employes-marqueur,.rent-etat,.partner-badge,.cw-badge){
  border-radius:999px!important;font-size:10.5px!important;font-weight:700!important;letter-spacing:.06em!important;padding:3px 9px!important;
  background:rgba(110,231,249,.08)!important;border:1px solid rgba(110,231,249,.25)!important;color:#bff6fd!important;
}
html.nuit :is(.empty-state,.vide,.rdv-empty,.calendrier-vide,.cw-empty,.dash-vide,.photos-empty){
  border:1px dashed var(--n-line-3)!important;background:rgba(255,255,255,.012)!important;color:var(--n-muted)!important;border-radius:var(--n-r)!important;
}
html.nuit .empty-state .big{color:var(--n-ink-2)!important;letter-spacing:0!important;text-transform:none!important;font-size:15px!important;}
html.nuit details>summary{cursor:pointer;color:var(--n-ink-2);}
html.nuit details>summary:hover{color:#fff;}
html.nuit mark.search-hit{background:rgba(110,231,249,.22)!important;color:#fff!important;}

/* Barre du bas (mobile) */
html.nuit .bottom-tabbar{background:rgba(4,7,10,.9)!important;backdrop-filter:blur(14px);border-top:1px solid var(--n-line)!important;}
html.nuit .bottom-tabbar button{color:var(--n-faint)!important;}
html.nuit .bottom-tabbar button .ic svg{width:21px;height:21px;}
html.nuit .bottom-tabbar button.active{color:#fff!important;background:transparent!important;}
html.nuit .bottom-tabbar button.active .ic{color:var(--n-cyan);filter:drop-shadow(0 0 6px rgba(110,231,249,.6));}

/* Bouton flottant et assistant */
html.nuit :is(#assistantFab,.quick-fab,#quickActionsWrap>button){background:var(--n-grad)!important;color:var(--n-accent-ink)!important;border:0!important;box-shadow:0 0 0 1px rgba(126,236,251,.4) inset,0 16px 36px -12px rgba(59,157,255,.7)!important;}

/* Écran d'accès et choix du rôle */
html.nuit :is(#roleGate,#authGate){background:radial-gradient(900px 500px at 50% -10%,rgba(31,107,255,.16),transparent 65%),var(--n-bg)!important;}
html.nuit .role-card{background:var(--n-panel)!important;border:1px solid var(--n-line-2)!important;border-radius:var(--n-r-lg)!important;color:var(--n-ink)!important;}
html.nuit .role-card:hover{border-color:var(--n-accent-line)!important;box-shadow:0 18px 40px -20px rgba(59,157,255,.5)!important;}

/* Icônes intégrées dans les boutons (remplacent les emojis) */
html.nuit .nv-i{width:15px;height:15px;vertical-align:-3px;margin-right:6px;flex:0 0 auto;}

@media (max-width:900px){
  html.nuit .container{padding:18px 16px 96px!important;}
  html.nuit .sidebar{width:min(300px,82vw);}
  html.nuit #rechercheGlobale{min-width:0;}
  html.nuit :is(.cw-hero h2,.sw-header h2,.vente-hero h2){font-size:30px!important;}
}

/* ---------- Ajustements après revue à l'écran ---------------------------- */
html.nuit .topbar{flex-wrap:nowrap!important;gap:10px!important;padding:10px 22px!important;}
html.nuit .topbar :is(#btnExport,#btnImportTrigger){background:transparent!important;border-color:var(--n-line-2)!important;color:var(--n-muted)!important;}
@media (max-width:1320px){html.nuit .topbar .user-chip{display:none!important;}}
@media (max-width:1180px){html.nuit .topbar :is(#btnExport,#btnImportTrigger){display:none!important;}html.nuit #rechercheGlobale{min-width:200px;}}
@media (min-width:901px){
  html.nuit :is(.field input,.field select,.field textarea,input[type="text"],input[type="search"],input[type="email"],input[type="tel"],input[type="number"],input[type="date"],input[type="time"],input[type="password"],select,textarea):not(.nv-brut){font-size:13.5px!important;}
}
/* Poids d'identifiant (« :not(#_) ») : passe devant la règle générale des champs et les surcharges locales
   du type « #clientsView .vente-filters select{background:…!important} », qui effaçaient la flèche. */
html.nuit :is(.field select,select):not(.nv-brut):not(#_){appearance:none;-webkit-appearance:none;padding-right:34px!important;
  background-image:url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%238b9dac' stroke-width='2' stroke-linecap='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E")!important;
  background-repeat:no-repeat!important;background-position:right 11px center!important;background-size:14px!important;}
html.nuit .sidebar-nav{overflow-y:auto;scrollbar-width:none;}
html.nuit .sidebar-nav::-webkit-scrollbar{display:none;}
/* Pied de la barre : une rangée d'icônes avec infobulles, pour laisser la place aux modules. */
@media (min-width:901px){
  html.nuit .sidebar-footer{display:flex!important;flex-direction:row!important;justify-content:space-between;align-items:center;gap:4px!important;padding:10px 12px!important;}
  html.nuit .sidebar-footer :is(.side-nav-btn,.nv-replier){width:38px!important;height:38px;flex:0 0 38px;justify-content:center;padding:0!important;margin:0!important;border:1px solid transparent!important;}
  html.nuit .sidebar-footer .nv-replier{border:1px solid var(--n-line-2)!important;}
  html.nuit .sidebar-footer .nv-lbl{display:none!important;}
  html.nuit .sidebar-footer :is(.side-nav-btn,.nv-replier):hover{border-color:var(--n-line-3)!important;}
  html.nuit .sidebar-footer :is(.side-nav-btn,.nv-replier):hover::after{content:attr(data-titre);position:absolute;bottom:calc(100% + 8px);left:50%;transform:translateX(-50%);white-space:nowrap;background:#0d1720;border:1px solid var(--n-line-3);color:#fff;font-size:11.5px;font-weight:500;padding:5px 9px;border-radius:7px;box-shadow:0 10px 30px rgba(0,0,0,.6);z-index:60;pointer-events:none;}
  html.nuit .sidebar-footer .nv-replier{position:relative;}
  html.nuit.nv-compact .sidebar-footer{flex-direction:column!important;}
  html.nuit.nv-compact .sidebar-footer :is(.side-nav-btn,.nv-replier):hover::after{bottom:auto;top:50%;left:calc(100% + 12px);transform:translateY(-50%);}
}
/* Icônes remplaçant les emojis */
.nv-sr{position:absolute!important;width:1px!important;height:1px!important;padding:0!important;margin:-1px!important;overflow:hidden!important;clip:rect(0,0,0,0)!important;white-space:nowrap!important;border:0!important;}
html.nuit .nv-i.nv-seul{margin:0;width:16px;height:16px;vertical-align:-3px;}
html.nuit .radio-icon .nv-i{margin:0 2px 0 0;color:var(--n-red);}
html.nuit .ic .nv-i{margin:0;width:14px;height:14px;color:var(--n-faint);}
html.nuit .role-card .ic .nv-i{width:34px;height:34px;color:var(--n-cyan);}
html.nuit #btnSidebarToggle .nv-i{margin:0;width:20px;height:20px;}
/* Rangées d'indicateurs : l'ancienne grille colorait l'espace entre les cartes. */
html.nuit .stats-row{background:transparent!important;border:0!important;gap:12px!important;margin:0 0 22px!important;}
/* Grille : une carte isolée sur la dernière ligne ne s'étire plus sur toute la largeur. */
html.nuit .stats-row{display:grid!important;grid-template-columns:repeat(auto-fit,minmax(130px,1fr));}
html.nuit .stats-row>.stat-card{min-width:0!important;}
html.nuit .stats-row>.stat-card{border-radius:var(--n-r)!important;}
html.nuit select{text-transform:none!important;letter-spacing:0!important;}

/* Soumissions : les outils insérés par le code se rangent à droite du titre. */
@media (min-width:1280px){
  html.nuit #soumissionView[style*="display: block"]{display:grid!important;grid-template-columns:minmax(0,1fr) auto auto auto;column-gap:8px;align-items:start;}
  html.nuit #soumissionView>*{grid-column:1/-1;}
  html.nuit #soumissionView>.sw-header{grid-row:1;grid-column:1;}
  html.nuit #soumissionView>:is(#cwChiffrage,#btnControleCatalogue,#btnComparerSoumissions){grid-row:1;grid-column:auto;margin:14px 0 0!important;white-space:nowrap;padding:8px 13px!important;font-size:12.5px!important;}
  html.nuit #soumissionView>.sw-nav{justify-self:start;}
}
html.nuit #soumissionView>:is(#cwChiffrage,#btnControleCatalogue,#btnComparerSoumissions){padding:8px 13px!important;font-size:12.5px!important;margin:0 6px 10px 0!important;}
html.nuit #soumissionView .sw-nav{justify-self:start;}
/* Accès rapide aux sections (Trésorerie) : pastilles, distinctes des onglets. */
html.nuit #comptaNavigation{display:flex;gap:8px;flex-wrap:wrap;}
html.nuit #comptaNavigation button{border-radius:999px!important;padding:7px 15px!important;font-size:12.5px!important;font-weight:600!important;background:transparent!important;border:1px solid var(--n-line-2)!important;color:var(--n-ink-2)!important;}
html.nuit #comptaNavigation button:hover{border-color:var(--n-accent-line)!important;color:#fff!important;background:var(--n-accent-soft)!important;}
/* Blocs repliables : chevron qui pivote à l'ouverture, au lieu du triangle par défaut. */
html.nuit details>summary{list-style:none;}
html.nuit details>summary::-webkit-details-marker{display:none;}
html.nuit details>summary::before{content:"";display:inline-block;width:7px;height:7px;margin:0 10px 2px 2px;border-right:1.8px solid var(--n-muted);border-bottom:1.8px solid var(--n-muted);transform:rotate(-45deg);transition:transform .18s var(--n-ease);vertical-align:middle;}
html.nuit details[open]>summary::before{transform:rotate(45deg);border-color:var(--n-cyan);}
html.nuit details>summary:hover::before{border-color:var(--n-ink);}
/* Pas de défilement horizontal de page : les tableaux larges défilent dans leur cadre. */
html.nuit .main-col{min-width:0;overflow-x:clip;}
html.nuit .container :is(.employes-kpi,.stat-card,.cw-panel){min-width:0;}
/* Marges intérieures uniformes des champs (certains modules les mettaient à zéro). */
html.nuit :is(input[type="text"],input[type="search"],input[type="email"],input[type="tel"],input[type="number"],input[type="date"],input[type="time"],input[type="password"],input[type="url"],textarea):not(.nv-brut):not(#rechercheGlobale){padding:9px 12px!important;}
html.nuit select:not(.nv-brut){padding:9px 34px 9px 12px!important;min-height:40px;}
/* Indicateurs du module Partenaires alignés sur les autres. */
html.nuit .st-stats>div{position:relative;overflow:hidden;background:linear-gradient(180deg,rgba(110,231,249,.05),transparent 55%),var(--n-panel)!important;border:1px solid var(--n-line-2)!important;border-radius:var(--n-r)!important;}
html.nuit .st-stats>div::before{content:"";position:absolute;left:0;right:0;top:0;height:2px;background:var(--n-grad);opacity:.7;}
html.nuit .st-stats strong{font-family:var(--n-display);color:#fff!important;}
html.nuit .st-stats span{text-transform:uppercase;letter-spacing:.12em;font-size:10.5px!important;font-weight:600;}
/* Barre du haut sur téléphone : menu + recherche pleine largeur. */
@media (max-width:900px){
  html.nuit .topbar{padding:10px 14px!important;gap:10px!important;}
  html.nuit .topbar #cwOpenNavigator,html.nuit .topbar .sync-pill,html.nuit .topbar .cw-top-context{display:none!important;}
  html.nuit .topbar #btnSidebarToggle{order:-1;flex:0 0 44px;height:44px;display:grid!important;place-items:center;padding:0!important;}
  html.nuit .topbar #rechercheGlobale{flex:1 1 auto;min-width:0!important;width:100%!important;}
  html.nuit .topbar :has(>#rechercheGlobale){flex:1 1 auto;min-width:0;}
}
@media (max-width:900px){
  html.nuit .sidebar{z-index:45!important;}
  html.nuit .sidebar-scrim{z-index:44!important;}
  html.nuit .sidebar-footer{display:flex!important;flex-direction:row!important;justify-content:space-between;gap:4px!important;padding:10px 14px calc(10px + env(safe-area-inset-bottom))!important;}
  html.nuit .sidebar-footer :is(.side-nav-btn,.nv-replier){width:44px!important;height:44px;flex:0 0 44px;justify-content:center;padding:0!important;margin:0!important;}
  html.nuit .sidebar-footer .nv-lbl{display:none!important;}
  html.nuit .sidebar-footer .nv-replier{display:none!important;}
}
html.nuit .main-col>footer,html.nuit .container+footer,html.nuit footer{color:var(--n-faint)!important;font-size:11px!important;letter-spacing:.14em;text-transform:uppercase;border-top:1px solid var(--n-line)!important;background:transparent!important;}

/* ---------- 2e passe : couleurs d'état codées en dur dans le HTML et le code ---------- */
/* Les attributs style="" portent encore les anciennes teintes : on les ramène aux jetons. */
html.nuit :is([style*="color:#e05555"],[style*="color: #e05555"],[style*="color:#d9534f"],[style*="color:#c0392b"],[style*="color:#e0304a"]){color:var(--n-red)!important;}
html.nuit :is([style*="border-color:#e05555"],[style*="border:1px solid #e05555"]){border-color:rgba(255,90,110,.45)!important;}
html.nuit :is([style*="color:#3fbf6a"],[style*="color: #3fbf6a"],[style*="color:#4caf50"],[style*="color:var(--green)"]){color:var(--n-green)!important;}
html.nuit :is([style*="color:#e8973a"],[style*="color:#d9832e"],[style*="color:var(--amber)"]){color:var(--n-amber)!important;}
html.nuit :is([style*="color:#4a90d9"],[style*="color:#5ab0e0"],[style*="color:#3fa8bf"]){color:#7fbcff!important;}
html.nuit [style*="color:#9a7fd1"]{color:var(--n-violet)!important;}
html.nuit [style*="font-style:italic"][style*="color:var(--gray-500)"]{font-style:normal!important;color:var(--n-faint)!important;}
/* Tableaux denses : moins d'air, dates et montants sur une ligne. */
html.nuit table th{padding:10px 12px!important;white-space:nowrap;}
html.nuit table td{padding:10px 12px!important;font-size:13px;}
html.nuit table td:first-child,html.nuit table td.num,html.nuit table td.mt-amount{white-space:nowrap;}
/* À faire : filtres ordonnés — recherche pleine largeur, 4 listes alignées, actions en rangée. */
html.nuit .gestion-panel{container-type:inline-size;}
html.nuit .gestion-controls{display:grid!important;grid-template-columns:repeat(2,minmax(0,1fr));gap:8px!important;}
@container (min-width:640px){html.nuit .gestion-controls{grid-template-columns:repeat(4,minmax(0,1fr));}}
html.nuit .gestion-controls>input{grid-column:1/-1;order:-1;}
html.nuit .gestion-controls>select{order:0;min-width:0;width:100%!important;}
html.nuit .gestion-controls>button{order:1;min-width:0;background:transparent!important;border-color:var(--n-line-2)!important;color:var(--n-muted)!important;font-size:12px!important;padding:8px 10px!important;}
html.nuit .gestion-controls>button:hover{color:#fff!important;border-color:var(--n-accent-line)!important;}
html.nuit .gestion-controls>button{width:100%;}

/* ---------- Animations (finition) ------------------------------------------
   Règle : jamais d'opacité ni de visibilité animées sur le contenu. Si une animation
   est suspendue (onglet en arrière-plan, capture), tout reste lisible. */
@keyframes nuit-monte{from{transform:translateY(10px)}to{transform:none}}
@keyframes nuit-trait{from{transform:scaleX(0)}to{transform:scaleX(1)}}
@keyframes nuit-barre{from{transform:scaleY(0)}to{transform:scaleY(1)}}
@keyframes nuit-zoom{from{transform:translateY(10px) scale(.985)}to{transform:none}}
@keyframes nuit-balaye{from{transform:translateX(-120%) skewX(-18deg)}to{transform:translateX(220%) skewX(-18deg)}}
@keyframes nuit-lueur{0%{box-shadow:0 0 0 0 rgba(110,231,249,.0)}40%{box-shadow:0 0 0 1px rgba(110,231,249,.35),0 0 28px -6px rgba(110,231,249,.35)}100%{box-shadow:var(--n-shadow)}}
@keyframes nuit-glisse{from{transform:translateX(-8px)}to{transform:none}}

/* Entrée de vue : les blocs principaux montent en cascade. */
html.nuit .container>[id$="View"]>:is(*):nth-child(-n+8){animation:nuit-monte .38s var(--n-ease) both!important;}
html.nuit .container>[id$="View"]>:nth-child(2){animation-delay:.03s!important;}
html.nuit .container>[id$="View"]>:nth-child(3){animation-delay:.06s!important;}
html.nuit .container>[id$="View"]>:nth-child(4){animation-delay:.09s!important;}
html.nuit .container>[id$="View"]>:nth-child(5){animation-delay:.12s!important;}
html.nuit .container>[id$="View"]>:nth-child(n+6){animation-delay:.15s!important;}
html.nuit :is(.stats-row>.stat-card,.st-stats>div,.vente-priorities>*){animation:nuit-monte .42s var(--n-ease) both!important;}
html.nuit :is(.stats-row>.stat-card,.st-stats>div,.vente-priorities>*):nth-child(2){animation-delay:.05s!important;}
html.nuit :is(.stats-row>.stat-card,.st-stats>div,.vente-priorities>*):nth-child(3){animation-delay:.1s!important;}
html.nuit :is(.stats-row>.stat-card,.st-stats>div,.vente-priorities>*):nth-child(n+4){animation-delay:.15s!important;}
/* Lueur brève des panneaux à l'arrivée d'une vue. */
html.nuit .container>[id$="View"] .cw-panel{animation:nuit-lueur .9s var(--n-ease) .1s 1!important;}

/* Menu : l'indicateur s'allume, les entrées glissent au premier affichage. */
html.nuit .side-nav-btn.active::before{animation:nuit-barre .28s var(--n-ease) both!important;transform-origin:center;}
html.nuit .sidebar-nav>.side-nav-btn{animation:nuit-glisse .35s var(--n-ease) both!important;}
html.nuit .sidebar-nav>.side-nav-btn:nth-of-type(n+4){animation-delay:.04s!important;}
html.nuit .sidebar-nav>.side-nav-btn:nth-of-type(n+7){animation-delay:.08s!important;}
html.nuit .side-nav-btn .nv-ic{transition:color .18s,transform .18s var(--n-ease),filter .18s!important;}
html.nuit .side-nav-btn:hover .nv-ic{transform:scale(1.08);}

/* Onglets : le trait de l'onglet actif se dessine. */
html.nuit :is(.subtab-btn.active,.nav-tab.active,.sw-nav button[aria-pressed="true"])::after{animation:nuit-trait .3s var(--n-ease) both!important;transform-origin:left;}

/* Bouton principal : reflet qui balaie au survol, enfoncement au clic. */
html.nuit :is(.btn-primary){position:relative;overflow:hidden;isolation:isolate;}
html.nuit :is(.btn-primary)::after{content:"";position:absolute;top:0;bottom:0;left:0;width:40%;background:linear-gradient(90deg,transparent,rgba(255,255,255,.55),transparent);transform:translateX(-120%) skewX(-18deg);pointer-events:none;z-index:1;}
@media (hover:hover) and (pointer:fine){html.nuit .btn-primary:hover::after{animation:nuit-balaye .7s var(--n-ease) 1!important;}}
html.nuit :is(button,.btn-primary,.btn-outline,.btn-ghost):active:not(:disabled){transform:translateY(1px) scale(.985)!important;}

/* Fenêtres : ouverture avec un léger zoom. */
html.nuit .overlay.open .panel,html.nuit :is(.st-dialog,.cw-document-dialog,.chiffrage-dialog,.db-dialog,.ps-dialog,#cwNavigator)[open]{animation:nuit-zoom .26s var(--n-ease) both!important;}

/* Cartes : l'icône flèche avance au survol. */
@media (hover:hover) and (pointer:fine){
  html.nuit :is(.cw-shortcut,.vente-card,.st-partner):hover :is(.arrow,span:last-child){transform:translate(2px,-2px);}
  html.nuit :is(.client-card,.project-card):hover{background:linear-gradient(180deg,rgba(110,231,249,.04),transparent 55%),var(--n-panel-2)!important;}
}
/* Pastille de synchronisation : respire doucement (seule animation continue). */
html.nuit :is(#syncDot,.personne-chip .dot){position:relative;animation:none!important;}
html.nuit :is(#syncDot,.personne-chip .dot)::after{content:"";position:absolute;inset:0;border-radius:50%;background:inherit;animation:nuit-pouls 2.8s ease-out infinite!important;pointer-events:none;}
/* Chiffres qui défilent (anim-nuit.mjs) : largeur stable pendant le compte. */
html.nuit .nuit-compte{font-variant-numeric:tabular-nums;}

@media (prefers-reduced-motion:reduce){
  html.nuit *,html.nuit *::before,html.nuit *::after{animation:none!important;transition:none!important;}
}
/* Libellés de cases à cocher et boutons radio : texte normal, pas le style des titres de champs. */
html.nuit label:has(> input[type="checkbox"]),html.nuit label:has(> input[type="radio"]){text-transform:none!important;letter-spacing:0!important;font-size:13px!important;font-weight:500!important;color:var(--n-ink-2)!important;}
/* Fenêtres créées sans classe par un module (ex. banque de temps) : titres, champs et boutons du thème. */
html.nuit dialog:not([class]):not([id]) h2{font-family:var(--n-display);color:#fff;font-size:20px;margin:0 0 6px;}
html.nuit dialog:not([class]):not([id]) h3{color:var(--n-muted);font-size:11px;letter-spacing:.14em;text-transform:uppercase;margin:14px 0 6px;}
html.nuit dialog:not([class]):not([id]) form{border-top-color:var(--n-line-2)!important;}
html.nuit dialog:not([class]):not([id]) label{display:grid;gap:6px;color:var(--n-ink-2);font-size:13px;}
html.nuit dialog:not([class]):not([id]) label input{width:100%;box-sizing:border-box;padding:9px 12px;}
html.nuit dialog:not([class]):not([id]) button:not([class]){background:rgba(255,255,255,.015);border:1px solid var(--n-line-3);color:var(--n-ink-2);border-radius:10px;padding:9px 16px;font-weight:600;cursor:pointer;}
html.nuit dialog:not([class]):not([id]) button:not([class]):hover{border-color:var(--n-accent-line);color:#fff;background:var(--n-accent-soft);}
html.nuit dialog:not([class]):not([id]) form button:not([class]){background:var(--n-grad);color:var(--n-accent-ink);border:0;font-weight:700;justify-self:start;}
html.nuit .soum-review button:not([class]){background:rgba(255,255,255,.015);border:1px solid var(--n-line-3);color:var(--n-ink-2);border-radius:10px;padding:9px 16px;font-weight:600;cursor:pointer;}
html.nuit .soum-review button:not([class]):hover{border-color:var(--n-accent-line);color:#fff;background:var(--n-accent-soft);}
/* Grilles de filtres : un champ sans libellé s'aligne sur les listes voisines au lieu de s'étirer sur la hauteur de la ligne. */
html.nuit :is(.chiffrage-grid,.cw-filter-grid)>:is(input,select){align-self:end;}
/* Restes clairs de l'ancien thème : pistes de barres, suggestions d'adresse, pastilles « inactif » et relance à venir. */
html.nuit :is(.pipeline-bar,.rentabilite-mini-bar){background:rgba(255,255,255,.07)!important;border-radius:3px!important;}
html.nuit .adresse-suggestions{background:var(--n-panel-2)!important;border:1px solid var(--n-line-3)!important;color:var(--n-ink)!important;border-radius:10px!important;box-shadow:0 18px 40px -12px rgba(0,0,0,.8);}
html.nuit .adresse-suggestions [role=option]{border-bottom-color:var(--n-line-2)!important;}
html.nuit .adresse-suggestions :is([role=option]:hover,[aria-selected=true]){background:var(--n-accent-soft)!important;color:#fff!important;}
html.nuit .badge-inactif{background:rgba(255,255,255,.04)!important;color:var(--n-muted)!important;border-color:var(--n-line-3)!important;}
html.nuit .relance-stamp.upcoming{background:rgba(255,255,255,.06)!important;color:var(--n-ink-2)!important;}
/* Téléphone : onglets segmentés sur une seule ligne qui défile, plus de retour à la ligne bancal ;
   le bouton « + Nouveau client » de l'en-tête Ventes double celui de la barre du haut. */
@media (max-width:900px){
  html.nuit :is(.subtab-bar,.nav-tabs,.sw-nav,.vente-view-toggle){display:flex!important;flex-wrap:nowrap!important;overflow-x:auto;scrollbar-width:none;-webkit-overflow-scrolling:touch;}
  html.nuit :is(.subtab-bar,.nav-tabs,.sw-nav,.vente-view-toggle)::-webkit-scrollbar{display:none;}
  html.nuit :is(.subtab-btn,.nav-tab,.sw-nav button,.vente-view-toggle button){flex:0 0 auto!important;white-space:nowrap!important;}
  html.nuit .vente-hero-side>.btn-primary{display:none!important;}
}
html.nuit :is(.nav-tabs,.subtab-bar)+.toolbar{margin-top:14px!important;}
html.nuit #affectationEntete:empty{display:none!important;}
/* Raccourcis clavier (nav-nuit.mjs) : indication discrète au survol d'un module, cachée
   en mode replié, sur tablette et sur téléphone ; fenêtre d'aide « ? ». */
html.nuit .side-nav-btn{position:relative;}
html.nuit .nv-kbd{position:absolute;right:10px;top:50%;margin-top:-9px;pointer-events:none;background:var(--n-panel);font:600 10.5px/1 var(--n-font);color:var(--n-faint);padding:3px 6px;border:1px solid var(--n-line-2);border-radius:6px;opacity:0;transform:translateX(-4px);transition:opacity .15s,transform .15s!important;}
@media (hover:hover) and (pointer:fine){html.nuit .side-nav-btn:is(:hover,:focus-visible) .nv-kbd{opacity:1;transform:none;}}
html.nuit.nv-compact .nv-kbd{display:none;}
@media (max-width:900px){html.nuit .nv-kbd{display:none;}}
html.nuit dialog.nuit-aide{width:min(460px,calc(100vw - 32px));padding:26px 28px;}
html.nuit .nuit-aide h2{font-size:18px;margin:0 0 18px;color:#fff;}
html.nuit .nuit-aide dl{display:grid;grid-template-columns:auto 1fr;gap:9px 16px;margin:0 0 22px;align-items:center;}
html.nuit .nuit-aide dt{margin:0;text-align:right;}
html.nuit .nuit-aide dd{margin:0;color:var(--n-ink-2);font-size:13.5px;}
html.nuit .nuit-aide kbd{display:inline-block;min-width:26px;text-align:center;font:700 11.5px/1 var(--n-font);color:var(--n-cyan);padding:5px 8px;border:1px solid var(--n-accent-line);border-bottom-width:2px;border-radius:7px;background:rgba(110,231,249,.06);}
/* Balayage lumineux au changement de module (nav-nuit.mjs). */
html.nuit .nuit-scan{position:fixed;top:0;left:0;right:0;height:2px;z-index:60;pointer-events:none;transform-origin:0 50%;transform:scaleX(0);opacity:0;
  background:linear-gradient(90deg,transparent,var(--n-cyan) 30%,#fff 50%,var(--n-blue) 70%,transparent);box-shadow:0 0 12px rgba(110,231,249,.8);}
html.nuit .nuit-scan.actif{animation:nuit-scan .55s var(--n-ease) forwards!important;}
@keyframes nuit-scan{0%{transform:scaleX(0);opacity:1}65%{transform:scaleX(1);opacity:1}100%{transform:scaleX(1);opacity:0}}
/* Date de l'accueil : majuscule au premier mot seulement (« Dimanche 27 septembre »). */
html.nuit .cw-date{text-transform:none!important;display:inline-block;}
html.nuit .cw-date::first-letter{text-transform:uppercase;}
html.nuit [data-action-coverage]:empty{display:none;}
html.nuit #metaEmptyState:has(> div:empty){display:none!important;}
/* Notifications (alertes-nuit.mjs) : remplacent les alert() natifs. */
html.nuit .nuit-alertes{position:fixed;inset:auto;top:18px;right:18px;left:auto;bottom:auto;margin:0;padding:0;border:0;background:transparent;overflow:visible;z-index:2147483000;
  display:flex;flex-direction:column;gap:10px;width:min(380px,calc(100vw - 36px));pointer-events:none;}
html.nuit .nuit-alertes:popover-open{display:flex;}
html.nuit .nuit-alerte{pointer-events:auto;display:flex;align-items:flex-start;gap:12px;padding:14px 14px 14px 16px;border-radius:12px;color:var(--n-ink);font-size:13.5px;line-height:1.45;
  background:linear-gradient(180deg,rgba(255,255,255,.03),transparent),#0b131a;border:1px solid var(--n-accent-line);border-left:3px solid var(--n-cyan);
  box-shadow:0 18px 50px -12px rgba(0,0,0,.9),0 0 30px -12px rgba(110,231,249,.45);animation:nuit-alerte-entree .22s var(--n-ease) both!important;}
html.nuit .nuit-alerte.erreur{border-color:rgba(255,90,110,.45);border-left-color:var(--n-red);box-shadow:0 18px 50px -12px rgba(0,0,0,.9),0 0 30px -12px rgba(255,90,110,.4);}
html.nuit .nuit-alerte.sortie{animation:nuit-alerte-sortie .18s ease-in forwards!important;}
html.nuit .nuit-alerte-texte{flex:1;white-space:pre-line;overflow-wrap:anywhere;}
html.nuit .nuit-alerte-fermer{flex:0 0 auto;width:26px;height:26px;display:grid;place-items:center;border:0!important;background:transparent!important;color:var(--n-muted)!important;font-size:18px;line-height:1;border-radius:7px;cursor:pointer;}
html.nuit .nuit-alerte-fermer:hover{color:#fff!important;background:rgba(255,255,255,.06)!important;}
@keyframes nuit-alerte-entree{from{transform:translateX(24px);opacity:0}to{transform:none;opacity:1}}
@keyframes nuit-alerte-sortie{to{transform:translateX(24px);opacity:0}}

/* Impression (Ctrl+P d'une page du CRM) : noir sur blanc, sans navigation ni boutons.
   Le « :not(#_) » donne le poids d'un identifiant pour passer devant les règles du thème nuit. */
@media print{
html.nuit, html.nuit body{background:#fff!important;color:#111!important;}
html.nuit body:not(#_) *{color:#111!important;background-color:transparent!important;background-image:none!important;box-shadow:none!important;text-shadow:none!important;filter:none!important;border-color:#c9d1d6!important;animation:none!important;transition:none!important;-webkit-text-fill-color:#111!important;}
html.nuit body:not(#_) :is(.sidebar,.sidebar-scrim,.topbar,.bottom-tabbar,#quickActionsWrap,.nuit-scan,.nuit-alertes,#facturesNumPanel,.subtab-bar,.nav-tabs,.cw-hero-actions,.btn-primary,.btn-outline,.btn-ghost,.close-x,.nv-kbd){display:none!important;}
html.nuit body:not(#_) :is(.main-col,.container){margin:0!important;padding:0!important;max-width:none!important;width:auto!important;}
html.nuit body:not(#_) :is(.cw-panel,.stat-card,.client-card,.project-card,table){break-inside:avoid;}
html.nuit body:not(#_) :is(a){text-decoration:none!important;}
html.nuit body::before{display:none!important;}
}
/* Cases, boutons radio, curseurs et barres de progression natifs à la couleur du thème. */
html.nuit{accent-color:var(--n-cyan);}
@media (max-width:900px){html.nuit :is(input[type="checkbox"],input[type="radio"]){min-width:18px;min-height:18px;}}
/* Encadré de procédure des impôts de paie : teinte or → cyan. */
html.nuit [style*="217,184,101"]{background:rgba(110,231,249,.06)!important;}
html.nuit .photos-empty{text-align:center;padding:18px 16px!important;}
/* Accueil « À faire » : boutons utilitaires plus fins ; listes sans texte coupé. */
html.nuit .gestion-controls>button{min-height:0!important;height:34px;font-weight:600!important;}
html.nuit .gestion-controls select:not(.nv-brut):not(#_){padding-left:11px!important;padding-right:26px!important;background-position:right 8px center!important;font-size:13px!important;text-overflow:ellipsis;}
/* Ordinateur : « + Nouveau client » de la barre du haut doublait celui de l'en-tête Ventes et s'écrasait
   sur trois lignes faute de place (le téléphone garde celui de la barre du haut, voir plus haut). */
@media (min-width:901px){html.nuit .topbar #btnNewClient{display:none!important;}}
html.nuit .topbar #btnNewClient{white-space:nowrap;}
/* Boutons d'en-tête de module : même hauteur et même taille de texte côte à côte. */
html.nuit .cw-hero-actions>:is(button,a){min-height:40px!important;font-size:13px!important;padding:0 16px!important;display:inline-flex;align-items:center;}
/* État vide de la liste des devis : message, pas un titre de page. */
html.nuit .sw-empty h3{font-family:var(--n-font)!important;font-size:15px!important;font-weight:600!important;color:var(--n-ink-2)!important;margin:0 0 14px!important;letter-spacing:0!important;}
html.nuit .sw-empty{text-align:center!important;}
/* Trésorerie : libellé sur deux lignes réservées, pour aligner les montants d'une même rangée. */
html.nuit .compta-metrics>details>summary{display:grid!important;grid-template-columns:12px 1fr;column-gap:8px;list-style:none;}
html.nuit .compta-metrics>details>summary::-webkit-details-marker{display:none;}
html.nuit .compta-metrics>details>summary::before{content:"";width:6px;height:6px;margin-top:6px;border-right:1.5px solid var(--n-muted);border-bottom:1.5px solid var(--n-muted);transform:rotate(-45deg);transition:transform .15s!important;}
html.nuit .compta-metrics>details[open]>summary::before{transform:rotate(45deg);}
html.nuit .compta-metrics>details>summary>span:first-child{min-height:3em;min-height:2lh;}
html.nuit .compta-metrics>details>summary>:not(span:first-child){grid-column:1/-1;}
/* Fil d'Ariane de la barre du haut : une seule ligne. */
html.nuit .topbar .cw-top-context{white-space:nowrap;flex:0 1 auto!important;min-width:0!important;}
html.nuit .topbar .cw-top-context>span{flex:0 0 auto;}
html.nuit .topbar .cw-top-context>strong{white-space:nowrap;overflow:hidden;text-overflow:ellipsis;max-width:240px;}
/* Champs d'une ligne : même hauteur partout (35 à 42 px selon le type auparavant). */
html.nuit :is(.field input,input[type="text"],input[type="search"],input[type="email"],input[type="tel"],input[type="number"],input[type="date"],input[type="time"],input[type="password"],input[type="url"],input[type="datetime-local"],input[type="month"],select):not(.nv-brut):not([multiple]):not([type="checkbox"]):not([type="radio"]):not([type="file"]):not([type="range"]):not([type="color"]){min-height:40px;box-sizing:border-box;line-height:20px;}
/* Lien d'appel sous un numéro de téléphone : petit bouton plutôt que lien souligné. */
html.nuit a.appel-direct{display:inline-flex;align-items:center;margin-top:8px;padding:6px 12px;border:1px solid var(--n-accent-line);border-radius:999px;color:var(--n-cyan)!important;text-decoration:none!important;font-size:12.5px;font-weight:600;background:rgba(110,231,249,.05);}
html.nuit a.appel-direct:hover{background:var(--n-accent-soft);color:#fff!important;}
html.nuit a.appel-direct[hidden]{display:none;}
html.nuit :is(input[type="date"],input[type="time"],input[type="datetime-local"],input[type="month"]):not(.nv-brut){height:40px;padding-top:0!important;padding-bottom:0!important;}
/* Fenêtres : un bouton suivi d'un libellé de champ ne lui colle plus. */
html.nuit .panel-body :is(button,.btn-outline,.btn-ghost)+label{margin-top:16px!important;}
/* Calendrier, vue semaine : les 7 jours tiennent dans la largeur (dimanche était coupé derrière un défilement). */
@media (min-width:901px){html.nuit .calendrier-grid{grid-template-columns:repeat(7,minmax(0,1fr))!important;}html.nuit .calendrier-day{min-width:0;}}
/* Calendrier : pas de fond gris derrière les cases (les cases ont leur cadre) ; rangées du mois égales. */
html.nuit .calendrier-grid{background:transparent!important;border:0!important;}
html.nuit .calendrier-grid>.calendrier-day{border:1px solid var(--n-line-2)!important;background:rgba(255,255,255,.018)!important;border-radius:10px!important;}
html.nuit .calendrier-grid>.calendrier-day.today{border-color:var(--n-accent-line)!important;background:rgba(110,231,249,.05)!important;}
html.nuit #calendrierMoisGrid>.calendrier-day{min-height:72px!important;height:auto!important;}
/* Liste des factures : montants alignés à droite, chiffres à chasse fixe (colonne 5 = « Montant TTC », factures-comptabilite.mjs). */
html.nuit #comptaSubtabFactures table.montants-table :is(th,td):nth-child(5){text-align:right!important;font-variant-numeric:tabular-nums;white-space:nowrap;}
/* Boutons-icônes (modifier, supprimer…) : carrés de 34 px, plus de capsules étirées à 44 px de haut. */
html.nuit .icon-btn:not(.nav-tab):not(.subtab-btn){width:34px;height:34px;min-height:0!important;min-width:34px;padding:0!important;display:inline-grid!important;place-items:center;vertical-align:middle;}
/* Ventes : les 4 colonnes du tableau se partagent la largeur (la 4e était coupée de 28 px) ;
   pastilles de statut sur plusieurs lignes plutôt que coupées au bord (ordinateur). */
@media (min-width:901px){
  html.nuit .vente-board>.vente-column{flex:1 1 0!important;min-width:240px!important;width:auto!important;max-width:none!important;}
  html.nuit .vente-stages{flex-wrap:wrap!important;overflow:visible!important;}
}
/* Téléphone : tableaux d'édition des fenêtres (produits du chantier…) défilent dans leur largeur, pas la fenêtre. */
@media (max-width:900px){html.nuit .panel-body table.depenses-editor{display:block;max-width:100%;overflow-x:auto;}}
/* Soumission : en-tête « Montant » aligné sur les montants (à droite) ; « Devis classés » ne colle plus au champ suivant. */
html.nuit #soumissionTotals th:last-child{text-align:right!important;}
html.nuit #swClasses{margin-bottom:16px!important;}
html.nuit .side-nav-btn[hidden]{display:none!important;}
/* Variables utilisées par d'autres feuilles sans être définies (contrôle « tokens fantômes » de verifier.sh). */
html.nuit #clientsView{--text:var(--n-ink-2);}
