/* ══════════════════════════════════════════════════════════════════════
   MADAL ONE — charte graphique commune (v1, 2026-10-13)
   Couche chargée en dernier : elle redéfinit l'apparence des composants
   existants (menu, en-têtes, cartes, tableaux, formulaires, modales)
   sans toucher à la logique. Toutes les couleurs passent par les jetons.
   Activée par la classe .m1 sur <body>.
   ══════════════════════════════════════════════════════════════════════ */

:root {
  /* Marque — vert Madal actuel */
  --m1-brand: #0A3D1F;
  --m1-brand-700: #0F4D28;
  --m1-brand-600: #17663A;
  --m1-brand-900: #062814;
  --m1-accent: #22C55E;
  --m1-accent-soft: #E8F6EC;

  /* Neutres légèrement teintés de vert */
  --m1-bg: #F4F6F4;
  --m1-surface: #FFFFFF;
  --m1-surface-2: #F8FAF8;
  --m1-line: #E2E7E3;
  --m1-line-strong: #CDD5CF;
  --m1-text: #15211A;
  --m1-text-2: #3D4A42;
  --m1-muted: #66736B;

  /* États */
  --m1-ok: #15803D;      --m1-ok-bg: #E9F7EE;
  --m1-warn: #B45309;    --m1-warn-bg: #FEF5E6;
  --m1-danger: #B42318;  --m1-danger-bg: #FDEEEC;
  --m1-info: #1D4ED8;    --m1-info-bg: #EEF3FE;

  /* Formes */
  --m1-r-sm: 6px;
  --m1-r: 8px;
  --m1-r-lg: 12px;
  --m1-shadow-1: 0 1px 2px rgba(16, 32, 22, .05);
  --m1-shadow-2: 0 4px 16px rgba(16, 32, 22, .08);
  --m1-shadow-3: 0 24px 64px rgba(6, 20, 12, .22);
  --m1-ring: 0 0 0 3px rgba(34, 197, 94, .28);

  --m1-font: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --m1-mono: 'IBM Plex Mono', ui-monospace, Consolas, monospace;
}

/* ── Base ─────────────────────────────────────────────────────────────── */
body.m1 {
  background: var(--m1-bg);
  color: var(--m1-text);
  font-family: var(--m1-font);
  font-size: 14px;
  -webkit-font-smoothing: antialiased;
  font-feature-settings: "tnum" 1;   /* chiffres alignés partout */
}
.m1 :focus-visible { outline: none; box-shadow: var(--m1-ring); border-radius: var(--m1-r-sm); }
.m1 .mono, .m1 .num { font-family: var(--m1-font); font-variant-numeric: tabular-nums; }

/* ── Menu latéral ─────────────────────────────────────────────────────── */
.m1 .sidebar {
  background: var(--m1-brand);
  box-shadow: none;
  border-right: 1px solid var(--m1-brand-900);
}
.m1 .sb-logo { padding: 18px 16px 14px; border-bottom: 1px solid rgba(255,255,255,.08); }
.m1 .sb-logo:after { content: none; }
.m1 .sb-logo .brand { font-size: 15px; font-weight: 700; letter-spacing: .01em; }
.m1 .sb-logo .sub { font-family: var(--m1-font); font-size: 11px; letter-spacing: 0; opacity: .6; }

.m1 .sb-user {
  margin: 10px 10px 4px;
  padding: 10px;
  border-radius: var(--m1-r);
  background: rgba(255,255,255,.06);
  border: 1px solid rgba(255,255,255,.06);
  box-shadow: none;
}
.m1 .sb-avatar { border-radius: 8px; box-shadow: none; }
.m1 .sb-profile-badge { background: rgba(255,255,255,.12); border: 0; color: #fff; font-weight: 600; }

.m1 .nav-dept-grp { margin: 2px 0; }
.m1 .nav-dept-hdr { padding: 12px 12px 4px; margin: 0; border-radius: 0; background: none !important; }
.m1 .nav-dept-name {
  font-size: 11px; font-weight: 600; letter-spacing: .02em; text-transform: none;
  color: rgba(255,255,255,.5);
}
.m1 .nav-dept-pill { width: 6px; height: 6px; border-radius: 50%; box-shadow: none; }
.m1 .nav-dept-sep { background: rgba(255,255,255,.07); margin: 8px 12px; }
.m1 .nav-section, .m1 .nav-sub-title {
  font-size: 11px !important; letter-spacing: .02em !important; text-transform: none !important;
  font-weight: 500 !important; color: rgba(255,255,255,.42) !important;
}

.m1 .nav-item {
  margin: 1px 8px;
  padding: 7px 10px;
  gap: 10px;
  min-height: 34px;
  border-radius: var(--m1-r);
  border: 0;
  color: rgba(255,255,255,.74);
  font-size: 13px;
  background: none;
  box-shadow: none;
  transform: none !important;
}
.m1 .nav-item > span:not(.nav-icon):not([id]) { font-weight: 500; }
.m1 .nav-item:hover { background: rgba(255,255,255,.07); color: #fff; }
.m1 .nav-item.active {
  background: rgba(255,255,255,.12);
  color: #fff;
  box-shadow: inset 2px 0 0 var(--m1-accent);
}
.m1 .nav-item.active > span:not(.nav-icon):not([id]) { font-weight: 600; }
.m1 .nav-item.active:after { content: none; }
.m1 .nav-icon {
  width: 18px; height: 18px; min-width: 18px;
  background: none !important; border: 0; box-shadow: none;
  color: currentColor; opacity: .9;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 13px;
}
.m1 .nav-icon svg { width: 18px; height: 18px; }
.m1 .sb-espace { margin: 8px 10px 4px; border-radius: var(--m1-r); background: rgba(255,255,255,.06); }

/* ── Barre du haut ────────────────────────────────────────────────────── */
.m1 .topbar {
  height: 56px;
  padding: 0 28px;
  background: rgba(255,255,255,.92);
  backdrop-filter: saturate(1.4) blur(8px);
  border-bottom: 1px solid var(--m1-line);
  position: sticky; top: 0; z-index: 40;
}
.m1 .topbar h1 { font-size: 15px; font-weight: 600; color: var(--m1-text); letter-spacing: -.005em; }

/* ── En-tête de page : fini les bandeaux dégradés ─────────────────────── */
.m1 .finance-hero {
  background: none !important;
  color: var(--m1-text) !important;
  border: 0 !important;
  box-shadow: none !important;
  border-radius: 0 !important;
  padding: 4px 0 18px !important;
  margin: 0 0 18px !important;
  border-bottom: 1px solid var(--m1-line) !important;
}
.m1 .finance-hero:before, .m1 .finance-hero:after { content: none !important; }
.m1 .finance-hero-inner { align-items: flex-end; }
.m1 .finance-kicker {
  font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--m1-muted); opacity: 1; margin-bottom: 4px;
}
.m1 .finance-title { font-size: 22px; font-weight: 600; letter-spacing: -.015em; color: var(--m1-text); }
.m1 .finance-sub { font-size: 13px; color: var(--m1-muted); opacity: 1; margin-top: 4px; }
.m1 .finance-hero .btn:not(.btn-primary):not(.btn-success):not(.btn-danger) {
  background: var(--m1-surface); color: var(--m1-text); border-color: var(--m1-line-strong);
}
.m1 .finance-hero .btn:hover { transform: none; }

/* ── Cartes ───────────────────────────────────────────────────────────── */
.m1 .card, .m1 .stock-toolbar, .m1 .rpt-card, .m1 .m6-360-panel {
  background: var(--m1-surface);
  border: 1px solid var(--m1-line);
  border-radius: var(--m1-r-lg);
  box-shadow: var(--m1-shadow-1);
}
.m1 .card:before, .m1 .card:after { content: none; }
.m1 .card-title, .m1 .section-title, .m1 .rpt-card-title {
  font-size: 14px; font-weight: 600; letter-spacing: 0; text-transform: none; color: var(--m1-text);
}
.m1 .stock-toolbar-title { font-weight: 600; color: var(--m1-text); }

/* ── Indicateurs (KPI) ────────────────────────────────────────────────── */
.m1 .stat-card, .m1 .stock-stat-grid .stat-card, .m1 .rpt-kpi, .m1 .m6-360-kpi {
  background: var(--m1-surface);
  border: 1px solid var(--m1-line);
  border-radius: var(--m1-r-lg);
  box-shadow: var(--m1-shadow-1);
  padding: 16px 18px;
  overflow: visible;
}
.m1 .stat-card:before, .m1 .stat-card:after,
.m1 .stock-stat-grid .stat-card:before { content: none !important; }
.m1 .st-label, .m1 .rpt-kpi-label {
  font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none;
  color: var(--m1-muted); margin-bottom: 6px;
  display: flex; align-items: center; gap: 6px;
}
.m1 .st-val, .m1 .rpt-kpi-value {
  font-family: var(--m1-font);
  font-size: 24px; font-weight: 600; letter-spacing: -.02em;
  color: var(--m1-text);
  font-variant-numeric: tabular-nums;
}
.m1 .st-sub, .m1 .rpt-kpi-sub { font-size: 12px; color: var(--m1-muted); }
/* L'état se lit par un point coloré, pas par un gros chiffre coloré */
.m1 .st-rouge .st-val, .m1 .st-ambre .st-val, .m1 .st-vert .st-val { color: var(--m1-text); }
.m1 .st-rouge .st-label:before, .m1 .st-ambre .st-label:before, .m1 .st-vert .st-label:before {
  content: ""; width: 7px; height: 7px; border-radius: 50%; flex: none;
}
.m1 .st-rouge .st-label:before { background: var(--m1-danger); }
.m1 .st-ambre .st-label:before { background: #F59E0B; }
.m1 .st-vert .st-label:before { background: var(--m1-accent); }

/* ── Boutons ──────────────────────────────────────────────────────────── */
.m1 .btn {
  height: 36px;
  padding: 0 14px;
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border-radius: var(--m1-r);
  border: 1px solid var(--m1-line-strong);
  background: var(--m1-surface);
  color: var(--m1-text);
  font: 500 13px/1 var(--m1-font);
  box-shadow: var(--m1-shadow-1);
  transition: background .12s, border-color .12s, color .12s;
  transform: none !important;
  white-space: nowrap;
}
.m1 .btn:hover:not(:disabled) { background: var(--m1-surface-2); border-color: #B9C3BC; }
.m1 .btn-sm { height: 30px; padding: 0 10px; font-size: 12px; }
.m1 .btn-primary { background: var(--m1-brand); border-color: var(--m1-brand); color: #fff; }
.m1 .btn-primary:hover:not(:disabled) { background: var(--m1-brand-700); border-color: var(--m1-brand-700); }
.m1 .btn-success { background: var(--m1-brand-600); border-color: var(--m1-brand-600); color: #fff; }
.m1 .btn-success:hover:not(:disabled) { background: var(--m1-brand-700); border-color: var(--m1-brand-700); }
/* Actions secondaires (PDF, WhatsApp…) : sobres, l'icône porte la couleur */
.m1 .btn-pdf {
  background: var(--m1-surface); border-color: var(--m1-line-strong); color: var(--m1-text);
}
.m1 .btn-pdf:hover:not(:disabled) { color: var(--m1-danger); border-color: #E7B4AE; background: var(--m1-danger-bg); }
.m1 .btn-danger, .m1 .btn.st-rouge { background: var(--m1-surface); color: var(--m1-danger); border-color: #E7B4AE; }
.m1 .btn-danger:hover:not(:disabled), .m1 .btn.st-rouge:hover:not(:disabled) { background: var(--m1-danger-bg); }
.m1 .btn-ambre { background: var(--m1-surface); color: var(--m1-warn); border-color: #F1CF9B; }
.m1 .btn-icon { border-radius: var(--m1-r-sm); }

/* ── Badges de statut ─────────────────────────────────────────────────── */
.m1 .badge {
  display: inline-flex; align-items: center; gap: 5px;
  height: 22px; padding: 0 8px;
  border-radius: 6px;
  font: 500 11.5px/1 var(--m1-font);
  letter-spacing: 0; text-transform: none;
  border: 1px solid transparent;
}
.m1 .badge-green { background: var(--m1-ok-bg); color: var(--m1-ok); }
.m1 .badge-ambre { background: var(--m1-warn-bg); color: var(--m1-warn); }
.m1 .badge-rouge { background: var(--m1-danger-bg); color: var(--m1-danger); }
.m1 .badge-bleu { background: var(--m1-info-bg); color: var(--m1-info); }
.m1 .badge-gray { background: #EEF1EF; color: var(--m1-text-2); }

/* ── Formulaires ──────────────────────────────────────────────────────── */
.m1 .field label, .m1 .lbl {
  font-size: 12.5px; font-weight: 500; color: var(--m1-text-2); text-transform: none; letter-spacing: 0;
}
.m1 .field input, .m1 .field select, .m1 .field textarea,
.m1 .stock-filters input, .m1 .stock-filters select,
.m1 .modal input:not([type=checkbox]):not([type=radio]), .m1 .modal select, .m1 .modal textarea {
  height: 36px;
  border: 1px solid var(--m1-line-strong);
  border-radius: var(--m1-r);
  background: var(--m1-surface);
  color: var(--m1-text);
  font: 400 13.5px var(--m1-font);
  padding: 0 11px;
  box-shadow: inset 0 1px 1px rgba(16,32,22,.03);
}
.m1 .field textarea, .m1 .modal textarea { height: auto; padding: 8px 11px; }
.m1 .field input:focus, .m1 .field select:focus, .m1 .field textarea:focus,
.m1 .stock-filters input:focus, .m1 .stock-filters select:focus,
.m1 .modal input:focus, .m1 .modal select:focus, .m1 .modal textarea:focus {
  outline: none; border-color: var(--m1-brand-600); box-shadow: var(--m1-ring);
}

/* ── Tableaux ─────────────────────────────────────────────────────────── */
.m1 .tbl-wrap { border: 1px solid var(--m1-line); border-radius: var(--m1-r-lg); background: var(--m1-surface); }
.m1 table { border-collapse: separate; border-spacing: 0; }
.m1 .tbl-wrap table, .m1 .card table { width: 100%; }
.m1 .tbl-wrap th, .m1 .card th {
  position: sticky; top: 0; z-index: 1;
  background: var(--m1-surface-2);
  color: var(--m1-muted);
  font: 500 12px var(--m1-font);
  letter-spacing: 0; text-transform: none;
  text-align: left;
  padding: 10px 12px;
  border-bottom: 1px solid var(--m1-line);
}
.m1 .tbl-wrap td, .m1 .card td {
  padding: 10px 12px;
  border-bottom: 1px solid #EEF1EF;
  font-size: 13px;
  color: var(--m1-text);
  font-variant-numeric: tabular-nums;
}
.m1 .tbl-wrap tbody tr:hover td, .m1 .card tbody tr:hover td { background: #F6F9F7; }
.m1 .tbl-wrap tr:last-child td { border-bottom: 0; }

/* ── Listes en cartes (BR, BL, stock…) : lignes compactes ─────────────── */
.m1 .item-card, .m1 .stock-card-premium {
  border: 1px solid var(--m1-line);
  border-radius: var(--m1-r-lg);
  box-shadow: var(--m1-shadow-1);
  transform: none !important;
}
.m1 .item-card:before, .m1 .stock-card-premium:before { content: none !important; }
.m1 .item-card:hover, .m1 .stock-card-premium:hover { border-color: var(--m1-line-strong); box-shadow: var(--m1-shadow-2); }
.m1 .stock-card-premium.stock-low { box-shadow: inset 3px 0 0 var(--m1-danger), var(--m1-shadow-1); }
.m1 .stock-card-premium.stock-warn { box-shadow: inset 3px 0 0 #F59E0B, var(--m1-shadow-1); }

/* ── Messages ─────────────────────────────────────────────────────────── */
.m1 .alerte { border-radius: var(--m1-r); font-size: 13px; padding: 10px 12px; border: 1px solid transparent; }
.m1 .alerte.ok { background: var(--m1-ok-bg); color: var(--m1-ok); border-color: #BFE5CB; }
.m1 .alerte.err { background: var(--m1-danger-bg); color: var(--m1-danger); border-color: #F3C5BF; }
.m1 .alerte.warn { background: var(--m1-warn-bg); color: var(--m1-warn); border-color: #F5D9A8; }
.m1 .empty-state { color: var(--m1-muted); font-size: 13px; padding: 48px 20px; }
.m1 .empty-icon { filter: grayscale(1); opacity: .45; }

/* ── Modales ──────────────────────────────────────────────────────────── */
.m1 .modal-overlay { background: rgba(8, 20, 13, .45); backdrop-filter: blur(3px); }
.m1 .modal {
  border-radius: 14px;
  border: 1px solid var(--m1-line);
  box-shadow: var(--m1-shadow-3);
  padding: 0;
}
.m1 .modal > * { margin-left: 24px; margin-right: 24px; }
.m1 .modal > :first-child { margin-top: 22px; }
.m1 .modal > :last-child { margin-bottom: 20px; }
.m1 .modal-title { font-size: 17px; font-weight: 600; letter-spacing: -.01em; border-bottom: 1px solid var(--m1-line); padding-bottom: 14px; }
.m1 .modal-actions { border-top: 1px solid var(--m1-line); padding-top: 14px; }

/* ── Notifications (remplacent les fenêtres alert du navigateur) ─────── */
.m1-toasts {
  position: fixed; right: 20px; bottom: 20px; z-index: 20000;
  display: flex; flex-direction: column; gap: 8px; max-width: min(420px, calc(100vw - 32px));
}
.m1-toast {
  display: flex; gap: 10px; align-items: flex-start;
  background: var(--m1-surface); color: var(--m1-text);
  border: 1px solid var(--m1-line); border-left: 3px solid var(--m1-brand-600);
  border-radius: var(--m1-r); box-shadow: var(--m1-shadow-2);
  padding: 11px 12px; font: 400 13px/1.45 var(--m1-font);
  animation: m1-in .18s ease-out;
  white-space: pre-line;
}
.m1-toast.err { border-left-color: var(--m1-danger); }
.m1-toast.warn { border-left-color: #F59E0B; }
.m1-toast button { margin-left: auto; border: 0; background: none; color: var(--m1-muted); cursor: pointer; font-size: 16px; line-height: 1; }
@keyframes m1-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Tablette ─────────────────────────────────────────────────────────── */
@media (max-width: 1024px) {
  .m1 .topbar { padding: 0 16px; }
  .m1 .finance-title { font-size: 19px; }
}
@media (prefers-reduced-motion: reduce) {
  .m1 *, .m1-toast { animation: none !important; transition: none !important; }
}

/* ── Stock : tableau consolidé ────────────────────────────────────────── */
.m1 #stock-grid.stock-cards-grid { display: block; }
.m1 .stk-table th.r, .m1 .stk-table td.r { text-align: right; }
.m1 .stk-row { cursor: pointer; }
.m1 .stk-nom { font-weight: 600; color: var(--m1-text); }
.m1 .stk-seuil { font-size: 12px; color: var(--m1-muted); margin-top: 2px; }
.m1 .stk-qte { font-weight: 600; }
.m1 .stk-bar { height: 4px; width: 88px; margin: 6px 0 0 auto; border-radius: 4px; background: #EDF1EE; overflow: hidden; }
.m1 .stk-bar .stock-bar-fill { height: 100%; border-radius: 4px; background: var(--m1-brand-600); }
.m1 .stk-bar .stock-bar-fill.medium { background: #F59E0B; }
.m1 .stk-bar .stock-bar-fill.low { background: var(--m1-danger); }
.m1 .stk-val { font-weight: 600; }
.m1 .stk-go { width: 28px; color: var(--m1-muted); font-size: 18px; text-align: center; }
.m1 .stk-row:hover .stk-go { color: var(--m1-brand-600); }

/* ── Marque, recherche, pastille d'espace ─────────────────────────────── */
.m1 .m1-brand { display: flex; align-items: center; gap: 10px; }
.m1 .m1-brand-mark { width: 30px; height: 30px; border-radius: 8px; background: #fff; padding: 3px; object-fit: contain; }
.m1 .m1-search {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; min-width: 240px; padding: 0 8px 0 10px;
  border: 1px solid var(--m1-line); border-radius: var(--m1-r);
  background: var(--m1-surface-2); color: var(--m1-muted);
  font: 400 13px var(--m1-font); cursor: pointer;
}
.m1 .m1-search:hover { border-color: var(--m1-line-strong); color: var(--m1-text-2); }
.m1 .m1-search svg { width: 16px; height: 16px; }
.m1 .m1-search span { flex: 1; text-align: left; }
.m1 .m1-search kbd {
  font: 500 11px var(--m1-font); color: var(--m1-muted);
  border: 1px solid var(--m1-line); border-bottom-width: 2px; border-radius: 5px;
  padding: 1px 6px; background: var(--m1-surface);
}
.m1 .chip {
  font: 500 12px var(--m1-font); color: var(--m1-brand-600);
  background: var(--m1-accent-soft); border-radius: 6px; padding: 5px 10px;
}
.m1 .nav-item > span:not(.nav-icon):not([id]) { font-weight: 400 !important; }
.m1 .nav-item.active > span:not(.nav-icon):not([id]) { font-weight: 600 !important; }
@media (max-width: 1024px) { .m1 .m1-search { min-width: 0; } .m1 .m1-search span, .m1 .m1-search kbd { display: none; } }
/* Liserés colorés posés en ligne sur certaines cartes KPI */
.m1 .stat-card[style*="border-top"] { border-top: 1px solid var(--m1-line) !important; }
/* Bouton WhatsApp : vert sobre au lieu du vert fluo */
.m1 .btn[style*="25D366"], .m1 .btn[style*="25d366"] {
  background: var(--m1-surface) !important; color: #128C4A !important; border: 1px solid #BFE5CB !important;
}

/* ── Listes de documents en tableau (BC, BR, factures, BL…) ───────────── */
.m1 .m1-list { margin-top: 4px; }
.m1 .m1-list th.r, .m1 .m1-list td.r { text-align: right; }
.m1 .m1-row { cursor: pointer; }
.m1 .m1-row:focus-visible td { background: #EEF6F0; }
.m1 .m1-ref { font-weight: 600; color: var(--m1-text); letter-spacing: -.005em; white-space: nowrap; }
.m1 .m1-sub-ref { font-weight: 500; color: var(--m1-text-2); }
.m1 .m1-sub { font-size: 12px; color: var(--m1-muted); margin-top: 2px; }
.m1 .m1-strong { font-weight: 600; }
.m1 .m1-clip { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.m1 .m1-actions { text-align: right; white-space: nowrap; width: 1%; }
.m1 td.m1-actions > * { vertical-align: middle; }
.m1 td.m1-actions .btn { margin-right: 4px; }
.m1 .m1-act {
  width: 30px; height: 30px; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid transparent; border-radius: var(--m1-r-sm); background: none;
  color: var(--m1-muted); cursor: pointer; transition: background .12s, color .12s, border-color .12s;
}
.m1 .m1-act svg { width: 17px; height: 17px; }
.m1 .m1-act:hover { background: var(--m1-surface); border-color: var(--m1-line); color: var(--m1-text); }
.m1 .m1-act.danger:hover { color: var(--m1-danger); border-color: #F3C5BF; background: var(--m1-danger-bg); }
.m1 .m1-empty { text-align: center; color: var(--m1-muted); padding: 36px 16px !important; font-size: 13px; }
.m1 .m1-empty.err { color: var(--m1-danger); }
.m1 .m1-sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
/* La carte qui contient un tableau n'a pas besoin d'un second cadre */
.m1 .card > .tbl-wrap.m1-list { border-radius: var(--m1-r); }

/* Pagination */
.m1 [id^="pagination-"] { color: var(--m1-muted); font-size: 12.5px; gap: 4px !important; padding: 10px 0 0 !important; }
.m1 [id^="pagination-"] .btn { min-width: 30px; height: 30px; padding: 0 8px; }
.m1 [id^="pagination-"] .btn[style*="background:var(--vert)"] {
  background: var(--m1-brand) !important; color: #fff !important; border-color: var(--m1-brand) !important;
}

@media (max-width: 900px) {
  .m1 .m1-list table { min-width: 720px; }
}
.m1 .m1-list table, .m1 .stk-table table { table-layout: auto; }
/* Bouton d'action principal dans l'en-tête de la carte qui porte la liste */
.m1 .card:has(> .tbl-wrap.m1-list) { position: relative; }
.m1 .card:has(> .tbl-wrap.m1-list) > .card-title { min-height: 34px; display: flex; align-items: center; margin-bottom: 14px; }
.m1 .card:has(> .tbl-wrap.m1-list) > .btn-row { position: absolute; top: 16px; right: 18px; margin: 0 !important; }

/* Menu « … » des lignes */
.m1 .m1-menu-wrap { position: relative; display: inline-block; }
.m1 .m1-menu {
  position: fixed; z-index: 15000; min-width: 210px;
  display: flex; flex-direction: column; padding: 4px;
  background: var(--m1-surface); border: 1px solid var(--m1-line); border-radius: var(--m1-r);
  box-shadow: var(--m1-shadow-2);
}
.m1 .m1-menu[hidden] { display: none; }
.m1 .m1-menu-item {
  text-align: left; border: 0; background: none; cursor: pointer;
  padding: 8px 10px; border-radius: var(--m1-r-sm);
  font: 400 13px var(--m1-font); color: var(--m1-text);
}
.m1 .m1-menu-item:hover, .m1 .m1-menu-item:focus-visible { background: var(--m1-surface-2); box-shadow: none; }
.m1 .m1-menu-item.danger { color: var(--m1-danger); }
.m1 .m1-menu-item.danger:hover { background: var(--m1-danger-bg); }

/* Barres d'outils de filtres posées en ligne */
.m1 .section-header select, .m1 .section-header input[type=text], .m1 .section-header input[type=date] {
  height: 32px !important; border: 1px solid var(--m1-line-strong) !important; border-radius: var(--m1-r) !important;
  background: var(--m1-surface) !important; font: 400 13px var(--m1-font) !important; padding: 0 10px !important;
}
.m1 .section-header select:focus, .m1 .section-header input:focus { outline: none; border-color: var(--m1-brand-600) !important; box-shadow: var(--m1-ring); }

/* Suivi de règlement d'une facture */
.m1 .m1-paybar { height: 4px; width: 72px; background: #EDF1EE; border-radius: 4px; overflow: hidden; margin-top: 6px; }
.m1 .m1-paybar i { display: block; height: 100%; background: var(--m1-brand-600); border-radius: 4px; }
.m1 .m1-due { color: var(--m1-danger); font-weight: 600; }
.m1 .m1-chip { display: inline-block; font-size: 12px; color: var(--m1-text-2); background: #EEF1EF; border-radius: 5px; padding: 2px 7px; }
.m1 .m1-lock { display: inline-flex; vertical-align: -2px; margin-left: 5px; color: var(--m1-muted); }
.m1 .m1-lock svg { width: 13px; height: 13px; }
/* Boutons secondaires colorés en ligne (cyan, violet…) : ramenés à la charte */
.m1 .btn:not(.btn-primary):not(.btn-success):not(.btn-pdf)[style*="background:#"] {
  background: var(--m1-surface) !important; color: var(--m1-text) !important; border-color: var(--m1-line-strong) !important;
}
.m1 .m1-neg { color: var(--m1-danger); }
.m1 .tbl-wrap table { table-layout: auto; }
.m1 .tbl-wrap th.r, .m1 .tbl-wrap td.r { text-align: right; }
.m1-toast-ic { flex: none; display: inline-flex; color: var(--m1-brand-600); margin-top: 1px; }
.m1-toast-ic svg { width: 18px; height: 18px; }
.m1-toast.err .m1-toast-ic { color: var(--m1-danger); }
.m1-toast.warn .m1-toast-ic { color: #D97706; }

/* ── Fenêtre de confirmation (remplace confirm()) ─────────────────────── */
.m1-confirm-fond {
  position: fixed; inset: 0; z-index: 20050;
  background: rgba(8, 20, 13, .45); backdrop-filter: blur(3px);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: m1-in .14s ease-out;
}
.m1-confirm {
  width: 100%; max-width: 440px;
  background: var(--m1-surface); color: var(--m1-text);
  border: 1px solid var(--m1-line); border-radius: 14px; box-shadow: var(--m1-shadow-3);
  padding: 20px 20px 16px; font-family: var(--m1-font);
}
.m1-confirm-tete { display: flex; gap: 12px; align-items: flex-start; }
.m1-confirm-ic {
  flex: none; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--m1-ok-bg); color: var(--m1-brand-600);
}
.m1-confirm.danger .m1-confirm-ic { background: var(--m1-danger-bg); color: var(--m1-danger); }
.m1-confirm-ic svg { width: 20px; height: 20px; }
.m1-confirm-titre { font-size: 15.5px; font-weight: 600; line-height: 1.4; padding-top: 7px; }
.m1-confirm-corps {
  margin: 10px 0 0 48px; font-size: 13.5px; line-height: 1.55; color: var(--m1-text-2);
  white-space: pre-line;
}
.m1-confirm-pied { display: flex; justify-content: flex-end; gap: 8px; margin-top: 20px; }
.m1-confirm-pied button {
  height: 36px; padding: 0 16px; border-radius: var(--m1-r); cursor: pointer;
  font: 500 13.5px var(--m1-font); border: 1px solid var(--m1-line-strong);
}
.m1-confirm-non { background: var(--m1-surface); color: var(--m1-text); }
.m1-confirm-non:hover { background: var(--m1-surface-2); }
.m1-confirm-oui { background: var(--m1-brand); border-color: var(--m1-brand) !important; color: #fff; }
.m1-confirm-oui:hover { background: var(--m1-brand-700); }
.m1-confirm.danger .m1-confirm-oui { background: var(--m1-danger); border-color: var(--m1-danger) !important; }
.m1-confirm.danger .m1-confirm-oui:hover { background: #912018; }
.m1-confirm-pied button:focus-visible { outline: none; box-shadow: var(--m1-ring); }
@media (max-width: 520px) { .m1-confirm-corps { margin-left: 0; } .m1-confirm-pied button { flex: 1; } }

/* ── Tous les bandeaux dégradés → en-tête de page sobre ───────────────── */
.m1 .bl-hero, .m1 .m14-hero, .m1 .m14-dg-personal-hero, .m1 .m6-cockpit-hero,
.m1 .rpt-hero, .m1 .od-hero, .m1 .lettrage-hero, .m1 .bfr-hero {
  background: none !important; color: var(--m1-text) !important;
  border: 0 !important; border-bottom: 1px solid var(--m1-line) !important;
  border-radius: 0 !important; box-shadow: none !important;
  padding: 4px 0 18px !important; margin-bottom: 18px !important;
}
.m1 .bl-hero:before, .m1 .bl-hero:after, .m1 .m14-hero:before, .m1 .m14-hero:after,
.m1 .m14-dg-personal-hero:after, .m1 .m6-cockpit-hero:before, .m1 .m6-cockpit-hero:after,
.m1 .rpt-hero:before, .m1 .rpt-hero:after, .m1 .od-hero:before, .m1 .od-hero:after { content: none !important; }
.m1 .bl-hero *, .m1 .m14-hero *, .m1 .m14-dg-personal-hero *, .m1 .m6-cockpit-hero *, .m1 .rpt-hero *,
.m1 .lettrage-hero *, .m1 .bfr-hero * { color: inherit; }
.m1 .bl-hero h2, .m1 .m14-hero h2, .m1 .m6-cockpit-hero h2, .m1 .rpt-hero-title {
  font-size: 22px !important; font-weight: 600 !important; letter-spacing: -.015em; color: var(--m1-text) !important;
}
.m1 .bl-hero p, .m1 .m14-hero p, .m1 .m6-cockpit-hero p, .m1 .rpt-hero-sub {
  color: var(--m1-muted) !important; font-size: 13px; opacity: 1 !important;
}
.m1 .bl-kicker, .m1 .m14-kicker, .m1 .m6-kicker, .m1 .rpt-hero-eyebrow {
  font-size: 12px !important; font-weight: 500 !important; letter-spacing: 0 !important;
  text-transform: none !important; color: var(--m1-muted) !important;
}
.m1 .bl-hero .btn:not(.btn-primary), .m1 .m14-hero .btn:not(.btn-primary), .m1 .m6-cockpit-hero .btn:not(.btn-primary),
.m1 .rpt-hero .btn:not(.btn-primary), .m1 .m14-dg-personal-hero .btn:not(.btn-primary) {
  background: var(--m1-surface) !important; color: var(--m1-text) !important; border-color: var(--m1-line-strong) !important;
}

/* ── Indicateurs propres à certains écrans (BL, consulting) ───────────── */
.m1 .bl-kpi, .m1 .m6-kpi, .m1 .m6-360-kpi {
  border: 1px solid var(--m1-line) !important; border-radius: var(--m1-r-lg) !important;
  box-shadow: var(--m1-shadow-1) !important; background: var(--m1-surface) !important;
}
.m1 .bl-kpi:before, .m1 .m6-kpi:before, .m1 .m6-360-kpi:before { content: none !important; }
.m1 .bl-kpi .k, .m1 .m6-kpi .k {
  font-size: 12px; font-weight: 500; letter-spacing: 0; text-transform: none; color: var(--m1-muted);
}
.m1 .bl-kpi .v, .m1 .m6-kpi .v {
  font-family: var(--m1-font); font-weight: 600; letter-spacing: -.02em; color: var(--m1-text) !important;
}
.m1 .bl-hero .btn-primary, .m1 .m14-hero .btn-primary, .m1 .m14-dg-personal-hero .btn-primary,
.m1 .m6-cockpit-hero .btn-primary, .m1 .rpt-hero .btn-primary, .m1 .lettrage-hero .btn-primary,
.m1 .bfr-hero .btn-primary, .m1 .od-hero .btn-primary { color: #fff !important; }
/* Onglets de filtre (Tous / En cours / Facturés) : discrets */
.m1 .bl-tab, .m1 [class*="-filter-tab"], .m1 [class*="-seg"] button { font-weight: 500 !important; }

/* ── M8 : cartes « CA potentiel » (fond dégradé bleu/violet) → indicateurs standards ── */
.m1 .kpi-ca {
  background: var(--m1-surface) !important; color: var(--m1-text) !important;
  border: 1px solid var(--m1-line); border-radius: var(--m1-r-lg); box-shadow: var(--m1-shadow-1);
  padding: 16px 18px;
}
.m1 .kpi-ca .st-label, .m1 .kpi-ca .st-sub { color: var(--m1-muted) !important; }
.m1 .kpi-ca .st-val { color: var(--m1-text) !important; }
.m1 .kpi-ca .st-label:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--m1-accent); }
/* Raccourcis clavier dans le menu */
.m1 .nav-item kbd { font-family: var(--m1-font) !important; font-size: 10.5px !important; background: rgba(255,255,255,.1) !important; color: rgba(255,255,255,.7); }
.m1 .sb-user { font-size: 12px; opacity: 1; color: rgba(255,255,255,.75); }
.m1 .sb-user span { font-family: var(--m1-font); }

/* ── M8 : liste des prospects ─────────────────────────────────────────── */
.m1 .m8-ref { white-space: nowrap; }
.m1 .m8-nom { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.m1 .m8-tags { margin-top: 4px; display: flex; gap: 4px; flex-wrap: wrap; }
.m1 .m8-chaleur {
  display: inline-flex; align-items: center; gap: 5px; font-size: 11.5px; font-weight: 500;
  color: var(--m1-text-2); white-space: nowrap;
}
.m1 .m8-chaleur:before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #9AA5A0; }
.m1 .m8-chaleur.tres-chaud:before { background: #DC2626; }
.m1 .m8-chaleur.chaud:before { background: #F97316; }
.m1 .m8-chaleur.tiede:before { background: #F59E0B; }
.m1 .m8-chaleur.froid:before { background: #60A5FA; }
.m1 .m8-chaleur.glace:before { background: #C7D2DA; }
.m1 .m8-chaleur.conv:before { background: var(--m1-accent); }
.m1 .m8-fiche { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--m1-muted); white-space: nowrap; }
.m1 .m8-fiche-barre { width: 56px; height: 4px; background: #EDF1EE; border-radius: 4px; overflow: hidden; }
.m1 .m8-fiche-barre i { display: block; height: 100%; border-radius: 4px; }
.m1 #tbody-prospects tr { cursor: pointer; }

/* ══ Écran de connexion Madal One ═════════════════════════════════════════
   Proposition A validée (2026-10-15) : photo plein écran sous un voile vert,
   carte de connexion flottante à gauche, slogan en bas à droite.
   Les identifiants et le fonctionnement de la connexion sont inchangés. */
body.m1 #login-overlay {
  padding: 0 !important;
  background:
    linear-gradient(90deg, rgba(6,40,20,.93) 0%, rgba(10,61,31,.80) 36%, rgba(10,61,31,.18) 72%, rgba(10,61,31,0) 100%),
    #0A3D1F url('/assets/espaces-hero.jpg') 70% center / cover no-repeat !important;
}
body.m1 #login-overlay canvas { display: none !important; }
body.m1 #login-overlay .ml-wrap {
  width: 100vw !important; height: 100vh !important; max-height: none !important;
  display: block !important; position: relative; border-radius: 0 !important; box-shadow: none !important; background: transparent !important;
}
/* Calque de marque par-dessus la photo : logo en haut à gauche, slogan en bas à droite */
body.m1 #login-overlay .ml-left {
  position: absolute !important; inset: 0; width: auto !important; height: 100vh !important;
  background: transparent !important; background-image: none !important;
  color: #fff; overflow: hidden; padding: 0 !important; pointer-events: none;
}
body.m1 #login-overlay .ml-left:before { content: none; }
body.m1 #login-overlay .ml-left-inner {
  display: flex !important; flex-direction: column; height: 100%;
  position: relative; padding: clamp(32px, 6vh, 64px) clamp(32px, 4vw, 64px);
}
body.m1 #login-overlay .ml-logo-block { display: flex; align-items: center; gap: 12px; }
body.m1 #login-overlay .m1-login-mark { width: 40px; height: 40px; border-radius: 10px; background: #fff; padding: 4px; object-fit: contain; }
body.m1 #login-overlay .ml-logo-main { font: 700 18px var(--m1-font); letter-spacing: .01em; color: #fff; }
body.m1 #login-overlay .ml-logo-sub { font: 400 12.5px var(--m1-font); color: rgba(255,255,255,.62); letter-spacing: 0; text-transform: none; }
body.m1 #login-overlay .ml-slogan {
  position: absolute; right: clamp(24px, 4vw, 64px); bottom: clamp(24px, 6vh, 64px); margin: 0; padding: 18px 24px;
  text-align: right; background: rgba(6,40,20,.62); border: 1px solid rgba(255,255,255,.14); border-radius: 14px;
  backdrop-filter: blur(8px); -webkit-backdrop-filter: blur(8px);
}
body.m1 #login-overlay .ml-slogan-title {
  font: 600 clamp(26px, 2.6vw, 36px)/1.18 var(--m1-font); letter-spacing: -.02em; color: #fff; max-width: 17ch;
  margin-left: auto;
}
body.m1 #login-overlay .ml-slogan-sub, body.m1 #login-overlay .ml-features, body.m1 #login-overlay .m1-login-foot { display: none !important; }
body.m1 #login-overlay .ml-features {
  list-style: none; margin: 32px 0 0; padding: 22px 0 0; border-top: 1px solid rgba(255,255,255,.14);
  display: grid; gap: 11px;
}
body.m1 #login-overlay .ml-feat { display: flex; align-items: baseline; gap: 10px; }
body.m1 #login-overlay .ml-feat:before { content: ""; width: 6px; height: 6px; border-radius: 50%; background: var(--m1-accent); flex: none; transform: translateY(-2px); }
body.m1 #login-overlay .ml-feat-txt { font: 400 13.5px/1.45 var(--m1-font); color: rgba(255,255,255,.78); }
body.m1 #login-overlay .ml-feat-txt b { color: #fff; font-weight: 600; }
body.m1 #login-overlay .m1-login-foot { margin-top: auto; padding-top: 28px; font: 400 12px var(--m1-font); color: rgba(255,255,255,.5); }
body.m1 #login-overlay .ml-divline { display: none !important; }

/* ── Formulaire ── */
body.m1 #login-overlay .ml-right {
  position: relative; z-index: 1; display: flex !important; align-items: center; justify-content: flex-start;
  background: transparent !important; height: 100vh !important; padding: 24px 24px 24px clamp(24px, 8vw, 140px) !important;
}
body.m1 #login-overlay .ml-right:before, body.m1 #login-overlay .ml-right:after { display: none !important; }
body.m1 #login-overlay .ml-card {
  width: 100%; max-width: 400px !important; min-height: 0 !important;
  background: var(--m1-surface) !important; border: 1px solid var(--m1-line) !important;
  border-radius: 16px !important; box-shadow: 0 24px 64px rgba(0,0,0,.38) !important;
  padding: 36px 36px 28px !important; color: var(--m1-text) !important;
}
body.m1 #login-overlay .ml-lock-wrap { display: none !important; }
body.m1 #login-overlay .ml-welcome { font: 600 24px var(--m1-font) !important; letter-spacing: -.015em; color: var(--m1-text) !important; text-align: left !important; }
body.m1 #login-overlay .ml-welcome-sub { margin: 6px 0 26px !important; font: 400 14px var(--m1-font) !important; color: var(--m1-muted) !important; text-align: left !important; }
body.m1 #login-overlay .ml-field { margin-bottom: 16px !important; }
body.m1 #login-overlay .ml-field-lbl { display: block; margin-bottom: 6px !important; font: 500 13px var(--m1-font) !important; color: var(--m1-text-2) !important; text-transform: none !important; letter-spacing: 0 !important; }
body.m1 #login-overlay .ml-input-wrap { position: relative; }
body.m1 #login-overlay .ml-field-icon { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); stroke: var(--m1-muted) !important; }
body.m1 #login-overlay .ml-input-wrap input {
  width: 100%; height: 44px !important; padding: 0 44px 0 38px !important;
  border: 1px solid var(--m1-line-strong) !important; border-radius: var(--m1-r) !important;
  background: var(--m1-surface) !important; color: var(--m1-text) !important;
  font: 400 15px var(--m1-font) !important; box-shadow: none !important;
}
body.m1 #login-overlay .ml-input-wrap input::placeholder { color: #9AA5A0; }
body.m1 #login-overlay .ml-input-wrap input:focus { outline: none; border-color: var(--m1-brand-600) !important; box-shadow: var(--m1-ring) !important; }
body.m1 #login-overlay .ml-eye-btn { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); color: var(--m1-muted) !important; background: none !important; border: 0; width: 34px; height: 34px; border-radius: 6px; cursor: pointer; }
body.m1 #login-overlay .ml-eye-btn:hover { background: var(--m1-surface-2) !important; color: var(--m1-text) !important; }
body.m1 #login-overlay .ml-field-error { color: var(--m1-danger) !important; font-size: 12.5px !important; margin-top: 6px; }
body.m1 #login-overlay .ml-caps-warning { color: var(--m1-warn) !important; font-size: 12.5px !important; }
body.m1 #login-overlay .ml-opts { display: flex; align-items: center; justify-content: space-between; margin: 4px 0 22px !important; font: 400 13px var(--m1-font); color: var(--m1-text-2) !important; }
body.m1 #login-overlay .ml-remember { display: inline-flex; align-items: center; gap: 8px; color: var(--m1-text-2) !important; cursor: pointer; }
body.m1 #login-overlay .ml-remember input { width: 16px; height: 16px; accent-color: var(--m1-brand); }
body.m1 #login-overlay .ml-help-link { color: var(--m1-brand-600) !important; font-weight: 500; text-decoration: none; }
body.m1 #login-overlay .ml-help-link:hover { text-decoration: underline; }
body.m1 #login-overlay .ml-btn-primary {
  width: 100%; height: 46px !important; border-radius: var(--m1-r) !important;
  background: var(--m1-brand) !important; background-image: none !important; color: #fff !important;
  border: 0 !important; box-shadow: none !important; font: 600 15px var(--m1-font) !important;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; cursor: pointer; transform: none !important;
}
body.m1 #login-overlay .ml-btn-primary:hover { background: var(--m1-brand-700) !important; }
body.m1 #login-overlay .ml-btn-primary:focus-visible { outline: none; box-shadow: var(--m1-ring) !important; }
body.m1 #login-overlay .ml-secure-note {
  display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 18px !important;
  font: 400 12.5px var(--m1-font) !important; color: var(--m1-muted) !important;
}
body.m1 #login-overlay .ml-secure-note svg { stroke: var(--m1-brand-600) !important; }
body.m1 #login-overlay .ml-footer { margin-top: 18px !important; text-align: center; font: 400 12px var(--m1-font) !important; color: #9AA5A0 !important; }

/* ── Tablette et téléphone : une seule colonne, bandeau de marque réduit ── */
@media (max-width: 900px) {
  body.m1 #login-overlay { background:
    linear-gradient(180deg, rgba(6,40,20,.85), rgba(10,61,31,.6)),
    #0A3D1F url('/assets/espaces-hero.jpg') 70% center / cover no-repeat !important; overflow-y: auto; }
  body.m1 #login-overlay .ml-wrap { width: 100% !important; height: auto !important; min-height: 100vh !important; max-height: none !important; border-radius: 0 !important; }
  body.m1 #login-overlay .ml-left { display: block !important; height: auto !important; }
  body.m1 #login-overlay .ml-left-inner { padding: 20px 24px !important; }
  body.m1 #login-overlay .ml-slogan { display: none !important; }
  body.m1 #login-overlay .ml-right { height: auto !important; min-height: 100vh; justify-content: center; padding: 88px 16px 40px !important; align-items: flex-start; }
  body.m1 #login-overlay .ml-card { box-sizing: border-box; width: 100% !important; min-height: 0 !important; border-radius: 16px !important; padding: 28px 22px 22px !important; }
}
body.m1 #login-overlay .ml-features { grid-template-columns: 1fr !important; }
body.m1 #login-overlay .ml-footer { letter-spacing: 0 !important; }

/* ══ Tablette et téléphone ═══════════════════════════════════════════════
   ≤ 1100 px : le menu latéral devient un tiroir (bouton ☰), le contenu prend toute la largeur.
   Écran tactile : cibles de 44 px. ≤ 700 px : téléphone. */
.m1-burger { display: none; }
.m1-nav-fond { display: none; }

@media (max-width: 1100px) {
  .m1 .shell { display: block; }
  .m1 .sidebar {
    position: fixed !important; top: 0; left: 0; bottom: 0; z-index: 1200;
    width: min(300px, 86vw) !important; height: 100vh !important;
    transform: translateX(-102%); transition: none;
    box-shadow: none;
  }
  /* Animation activée seulement une fois la page prête : pas de glissement parasite au chargement */
  .m1.m1-tiroir-pret .sidebar { transition: transform .2s ease-out; }
  .m1.m1-nav-ouverte .sidebar { transform: none; box-shadow: var(--m1-shadow-3); }
  .m1 .m1-nav-fond {
    display: block; position: fixed; inset: 0; z-index: 1150;
    background: rgba(8, 20, 13, .42); opacity: 0; pointer-events: none; transition: opacity .2s;
  }
  .m1.m1-nav-ouverte .m1-nav-fond { opacity: 1; pointer-events: auto; }
  .m1 .main { width: 100%; min-width: 0; }
  .m1 .m1-burger {
    display: inline-flex; align-items: center; justify-content: center; flex: none;
    width: 40px; height: 40px; margin-right: 4px; border-radius: var(--m1-r);
    border: 1px solid var(--m1-line); background: var(--m1-surface); color: var(--m1-text); cursor: pointer;
  }
  .m1 .m1-burger svg { width: 20px; height: 20px; }
  .m1 .m1-burger:focus-visible { box-shadow: var(--m1-ring); }
  .m1 .topbar { gap: 8px; }
  .m1 .topbar h1 { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m1 .topbar .chip { display: none; }

  /* Le menu en tiroir garde ses libellés (annule le mode « icônes seules » des petits écrans) */
  .m1 .sidebar .sb-logo .brand, .m1 .sidebar .sb-logo .sub, .m1 .sidebar .nav-item > span:not(.nav-icon),
  .m1 .sidebar .sb-user, .m1 .sidebar .nav-section, .m1 .sidebar .nav-dept-name, .m1 .sidebar .nav-dept-arr { display: revert !important; }
  .m1 .sidebar .nav-item { justify-content: flex-start !important; padding: 7px 10px !important; }
  .m1 .sidebar .nav-dept-hdr { justify-content: flex-start !important; padding: 12px 12px 4px !important; }

  /* Indicateurs et grilles : 2 colonnes */
  .m1 .grid4, .m1 .stock-stat-grid, .m1 .bl-kpis, .m1 .acct-kpi-grid { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .m1 .grid3 { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; }
  .m1 .finance-hero-inner { flex-direction: column; align-items: flex-start !important; gap: 12px; }
  .m1 .finance-hero-actions, .m1 .bl-hero-actions { flex-wrap: wrap; }

  /* Tableaux : défilement horizontal, référence toujours visible */
  .m1 .tbl-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; overscroll-behavior-x: contain; }
  .m1 .m1-list table, .m1 .stk-table table { min-width: 760px; }
  .m1 .m1-list td:first-child, .m1 .m1-list th:first-child,
  .m1 .stk-table td:first-child, .m1 .stk-table th:first-child {
    position: sticky; left: 0; z-index: 2; background: var(--m1-surface);
    box-shadow: 1px 0 0 var(--m1-line);
  }
  .m1 .m1-list th:first-child, .m1 .stk-table th:first-child { background: var(--m1-surface-2); z-index: 3; }
  .m1 .m1-row:hover td:first-child { background: #F6F9F7; }

  /* Barres de filtres : retour à la ligne propre */
  .m1 .section-header, .m1 .stock-toolbar { flex-wrap: wrap; gap: 10px; }
  .m1 .stock-filters { flex-wrap: wrap; width: 100%; }
  .m1 .stock-filters > * { flex: 1 1 160px; }
}

/* Écran tactile : cibles assez grandes pour le doigt */
@media (pointer: coarse) {
  .m1 .btn { min-height: 40px; }
  .m1 .btn-sm { min-height: 36px; }
  .m1 .m1-act { width: 40px; height: 40px; }
  .m1 .nav-item { min-height: 44px; }
  .m1 .field input, .m1 .field select, .m1 .modal input:not([type=checkbox]):not([type=radio]), .m1 .modal select { height: 44px; font-size: 16px; }
  .m1 .m1-menu-item { padding: 12px 12px; font-size: 14px; }
  .m1 [id^="pagination-"] .btn { min-width: 40px; height: 40px; }
}

/* Téléphone */
@media (max-width: 700px) {
  .m1 .content { padding: 14px !important; }
  .m1 .topbar { padding: 0 12px; height: 56px; }
  .m1 .grid4, .m1 .grid3, .m1 .grid2, .m1 .stock-stat-grid, .m1 .bl-kpis { grid-template-columns: 1fr !important; }
  .m1 .finance-title, .m1 .bl-hero h2 { font-size: 19px !important; }
  /* Fenêtres en plein écran */
  .m1 .modal-overlay { padding: 0 !important; align-items: stretch; }
  .m1 .modal { max-width: none !important; width: 100% !important; max-height: 100vh !important; height: 100vh; border-radius: 0 !important; }
  .m1 .modal-actions { position: sticky; bottom: 0; background: var(--m1-surface); padding-bottom: 14px; }
  .m1 .modal-actions .btn { flex: 1; }
}

/* Mouvement réduit : pas d'animation du tiroir */
@media (prefers-reduced-motion: reduce) {
  .m1 .sidebar, .m1 .m1-nav-fond { transition: none !important; }
}

/* Téléphone : indicateurs sur 2 colonnes compactes, messages de tableau lisibles */
@media (max-width: 700px) {
  .m1 .grid4, .m1 .stock-stat-grid, .m1 .bl-kpis { grid-template-columns: repeat(2, minmax(0, 1fr)) !important; gap: 10px !important; }
  .m1 .stat-card, .m1 .bl-kpi { padding: 12px 14px !important; }
  .m1 .st-val, .m1 .bl-kpi .v { font-size: 19px !important; }
  .m1 .st-label { font-size: 11.5px; }
  .m1 .m1-empty { text-align: left !important; padding: 24px 16px !important; white-space: normal; }
}

/* Lettrage : historique avec annulation */
.m1 .let-hist-ligne { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 10px 0; border-bottom: 1px solid #EEF1EF; }
.m1 .let-hist-ligne:last-child { border-bottom: 0; }
.m1 .let-hist-ligne.annule .let-hist-txt { color: var(--m1-muted); }
.m1 .let-hist-ligne.annule strong { text-decoration: line-through; }
.m1 .let-hist-txt { min-width: 0; font-size: 13px; }
.m1 .let-hist-txt .badge { margin-left: 6px; }
.m1 .let-hist-sub { color: var(--m1-muted); font-size: 12px; margin-top: 2px; }

/* ══ Choix du département (après la connexion) ═══════════════════════════ */
body.m1 #espace-hub { background: var(--m1-bg); font-family: var(--m1-font); }
body.m1 #espace-hub .eh-top { background: var(--m1-brand); padding: 14px 32px; border-bottom: 1px solid var(--m1-brand-900); }
body.m1 #espace-hub .eh-logo { display: inline-flex; align-items: center; gap: 10px; font: 700 16px var(--m1-font); letter-spacing: .01em; color: #fff; }
body.m1 #espace-hub .m1-brand-mark { width: 30px; height: 30px; border-radius: 8px; background: #fff; padding: 3px; object-fit: contain; }
body.m1 #espace-hub .eh-user { font-size: 13px; color: rgba(255,255,255,.85); }
body.m1 #espace-hub .eh-profil { background: rgba(255,255,255,.12); border-radius: 6px; font-weight: 600; }
body.m1 #espace-hub .eh-logout { border-radius: var(--m1-r); border-color: rgba(255,255,255,.25); font: 500 13px var(--m1-font); }
/* Fini le grand bandeau photo : un en-tête de page sobre */
/* Fond des pages de travail — variante B validée (2026-10-15) : photo du 4e pont en filigrane
   très clair, fixe pendant le défilement ; tableaux et formulaires restent sur cartes blanches. */
body.m1 .main {
  background:
    linear-gradient(rgba(244,246,244,.85), rgba(244,246,244,.85)),
    var(--m1-bg) url('/assets/fond-pont-abidjan.jpg?v=2') 60% 40% / cover no-repeat fixed;
}
body.m1 .main .topbar { background: rgba(255,255,255,.92); }
@media print { body.m1 .main { background: none !important; } }

/* Proposition A validée (2026-10-15) : bandeau photo du 4e pont d'Abidjan, cartes posées dessus */
body.m1 #espace-hub .eh-top { position: absolute; top: 0; left: 0; right: 0; z-index: 2; background: rgba(6,40,20,.55); border-bottom: 0; backdrop-filter: blur(6px); }
body.m1 #espace-hub .eh-hero {
  min-height: 420px; padding-top: 64px; align-items: center;
  background: #0A3D1F url('/assets/fond-pont-abidjan.jpg?v=2') 55% 40% / cover no-repeat !important;
}
body.m1 #espace-hub .eh-hero::before { content: '' !important; background: linear-gradient(90deg, rgba(6,40,20,.82) 0%, rgba(10,61,31,.45) 34%, rgba(10,61,31,0) 62%) !important; }
body.m1 #espace-hub .eh-hero::after { content: '' !important; height: 110px; background: linear-gradient(to bottom, rgba(244,246,244,0), var(--m1-bg)) !important; }
body.m1 #espace-hub .eh-hero-texte { padding: 0 32px 90px; }
body.m1 #espace-hub .eh-surtitre { font-size: 13px; font-weight: 500; letter-spacing: 0; text-transform: none; color: rgba(255,255,255,.78); }
body.m1 #espace-hub .eh-titre { font-size: 34px; font-weight: 600; letter-spacing: -.02em; color: #fff; text-shadow: 0 2px 16px rgba(0,0,0,.35); }
body.m1 #espace-hub .eh-sous-titre { color: rgba(255,255,255,.92); font-size: 15px; max-width: 520px; text-shadow: 0 1px 10px rgba(0,0,0,.55); }
body.m1 #espace-hub .eh-main { margin-top: -110px; }
body.m1 #espace-hub .eh-grille { gap: 14px; }
/* Cartes : sans liseré coloré ; la couleur du département n'apparaît que sur l'icône */
body.m1 #espace-hub .eh-carte {
  border: 1px solid var(--m1-line) !important; border-radius: 14px !important;
  box-shadow: 0 12px 30px rgba(6,20,12,.16) !important; padding: 20px !important; transform: none !important;
  font-family: var(--m1-font); gap: 10px;
}
/* Dernier département utilisé : encadré vert */
body.m1 #espace-hub .eh-carte:has(.eh-dernier) { border-color: var(--m1-accent) !important; box-shadow: 0 0 0 3px var(--m1-accent-soft), 0 12px 30px rgba(6,20,12,.16) !important; }
body.m1 #espace-hub .eh-touche { font: 500 11px var(--m1-mono); border: 1px solid var(--m1-line-strong); border-radius: 4px; padding: 0 5px; color: var(--m1-muted); margin-right: 6px; }
body.m1 #espace-hub .eh-carte:hover:not(:disabled) { border-color: var(--m1-line-strong) !important; box-shadow: var(--m1-shadow-2) !important; }
body.m1 #espace-hub .eh-carte:focus-visible { box-shadow: var(--m1-ring) !important; }
body.m1 #espace-hub .eh-icone {
  width: 42px; height: 42px; border-radius: 10px; font-size: 20px;
  background: color-mix(in srgb, var(--eh-couleur) 12%, #fff); color: var(--eh-couleur);
}
body.m1 #espace-hub .eh-icone svg { width: 22px; height: 22px; }
body.m1 #espace-hub .eh-nom { font-size: 16px; font-weight: 600; color: var(--m1-text); }
body.m1 #espace-hub .eh-desc { font-size: 13px; color: var(--m1-muted); }
body.m1 #espace-hub .eh-pied { font-size: 13px; font-weight: 500; color: var(--m1-brand-600); padding-top: 6px; border-top: 1px solid #EEF1EF; }
body.m1 #espace-hub .eh-dernier { background: var(--m1-accent-soft); color: var(--m1-brand-600); font-weight: 600; font-size: 11px; }
@media (max-width: 700px) {
  body.m1 #espace-hub .eh-top { padding: 12px 16px; }
  body.m1 #espace-hub .eh-hero { min-height: 280px; padding-top: 72px; background-position: 70% 40% !important; }
  body.m1 #espace-hub .eh-hero-texte { padding: 0 16px 70px; }
  body.m1 #espace-hub .eh-titre { font-size: 24px; }
  body.m1 #espace-hub .eh-main { margin-top: -60px; }
  body.m1 #espace-hub .eh-touche { display: none; }
}

/* ── Portefeuille de chèques : onglets, fiche, pièces jointes, bordereaux (2026-10-19) ── */
.chq-onglets { display: inline-flex; border: 1px solid var(--m1-line-strong); border-radius: var(--m1-r); overflow: hidden; background: var(--m1-surface); }
.chq-onglets button { border: 0; background: transparent; padding: 0 12px; height: 30px; font: 500 12px var(--m1-font); color: var(--m1-text-2); cursor: pointer; }
.chq-onglets button + button { border-left: 1px solid var(--m1-line-strong); }
.chq-onglets button[aria-selected="true"] { background: var(--m1-brand); color: #fff; }
.chq-onglets button:focus-visible { outline: none; box-shadow: var(--m1-ring); }
.chq-fiche-tete { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 12px; }
.chq-kv { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px 16px; margin: 0 0 14px; padding: 12px; background: var(--m1-bg); border-radius: var(--m1-r); }
.chq-kv dt { font-size: 11px; color: var(--m1-muted); text-transform: uppercase; letter-spacing: .03em; }
.chq-kv dd { margin: 2px 0 0; font-size: 13px; color: var(--m1-text); overflow-wrap: anywhere; }
.chq-bloc { border-top: 1px solid var(--m1-line); padding-top: 12px; margin-top: 12px; }
.chq-bloc-titre { font-size: 13px; font-weight: 600; color: var(--m1-brand); margin-bottom: 8px; }
.chq-vide { font-size: 13px; color: var(--m1-muted); padding: 10px 12px; border: 1px dashed var(--m1-line-strong); border-radius: var(--m1-r); }
.chq-docs { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.chq-docs li { display: flex; align-items: center; gap: 12px; padding: 8px; border: 1px solid var(--m1-line); border-radius: var(--m1-r); background: var(--m1-surface); }
.chq-doc-vignette { flex: 0 0 64px; height: 44px; border-radius: var(--m1-r-sm); overflow: hidden; background: var(--m1-bg); display: flex; align-items: center; justify-content: center; }
.chq-doc-vignette img { width: 100%; height: 100%; object-fit: cover; }
.chq-doc-pdf { font: 600 11px var(--m1-mono); color: var(--m1-danger); }
.chq-doc-txt { flex: 1; min-width: 0; }
.chq-doc-txt .m1-sub { overflow-wrap: anywhere; }
.chq-empreinte { font-family: var(--m1-mono); font-size: 11px; }
.chq-doc-act { display: flex; gap: 4px; flex-wrap: wrap; justify-content: flex-end; }
.chq-depot { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin-top: 10px; }
.chq-rem-ligne { display: flex; justify-content: space-between; align-items: center; gap: 10px; flex-wrap: wrap; margin-bottom: 8px; }
.chq-histo { list-style: none; margin: 0; padding: 0 0 0 14px; border-left: 2px solid var(--m1-line); display: grid; gap: 8px; }
.chq-histo li { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; position: relative; }
.chq-histo li::before { content: ""; position: absolute; left: -20px; width: 10px; height: 10px; border-radius: 50%; background: var(--m1-surface); border: 2px solid var(--m1-accent); }
.chq-sel { width: 1%; text-align: center; }
.chq-sel input { width: 16px; height: 16px; cursor: pointer; }
.chq-rem-total { display: flex; justify-content: space-between; align-items: center; padding: 10px 12px; margin-top: 8px; background: var(--m1-accent-soft); border-radius: var(--m1-r); font-size: 13px; }
.chq-rem-total strong { font-size: 16px; color: var(--m1-brand); font-variant-numeric: tabular-nums; }
.chq-rem-ok { display: flex; gap: 12px; align-items: center; padding: 14px; background: var(--m1-ok-bg); border-radius: var(--m1-r); }
.chq-rem-ok-ico { width: 34px; height: 34px; border-radius: 50%; background: var(--m1-ok); color: #fff; display: flex; align-items: center; justify-content: center; font-weight: 700; }
.chq-etapes { margin: 12px 0 0; padding-left: 20px; font-size: 13px; color: var(--m1-text-2); display: grid; gap: 4px; }
@media (max-width: 700px) {
  .chq-kv { grid-template-columns: 1fr 1fr; }
  .chq-docs li { flex-wrap: wrap; }
  .chq-doc-act { width: 100%; justify-content: flex-start; }
  .chq-onglets { width: 100%; }
  .chq-onglets button { flex: 1; }
}
