/* ================================================================
   OFT APP v4 — Thème Électrique
   Fond blanc · Vert #00e676 · Noir #0a0f0a · Raleway
   ================================================================ */
@import url('https://fonts.googleapis.com/css2?family=Raleway:wght@300;400;500;600;700;800;900&display=swap');

:root {
  --green:      #00e676;
  --green-dim:  #00c853;
  --green-glow: rgba(0,230,118,0.15);
  --black:      #0a0f0a;
  --bg:         #f4fdf7;
  --surface:    #ffffff;
  --surface2:   #f0fdf4;
  --border:     rgba(0,230,118,0.22);
  --text:       #0a1a0f;
  --text2:      #4a7a5a;
  --muted:      #7a9a82;
  --danger:     #ef4444;
  --warning:    #f59e0b;
  --info:       #0ea5e9;
  --purple:     #8b5cf6;
  --sidebar-w:  250px;
  --topbar-h:   58px;
  --radius:     10px;
  --radius-lg:  14px;
  --shadow:     0 2px 12px rgba(0,230,118,0.08);
  --shadow-lg:  0 8px 32px rgba(0,230,118,0.14);
  --font:       'Raleway', system-ui, sans-serif;
  --transition: 0.16s ease;
}

/* ── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html, body { height: 100%; }
html {
  font-size: var(--app-base-font-size, 14px);
}
body {
  font-family: var(--app-base-font-family, var(--font));
  font-size: 1rem;
  background: var(--bg);
  color: var(--text);
}
a { text-decoration: none; color: var(--green-dim); }
a:hover { color: var(--green); }

/* ── Layout ─────────────────────────────────────────────────── */
.app     { display: flex; height: 100vh; overflow: hidden; }
.main    { flex: 1; display: flex; flex-direction: column; overflow: hidden; min-width: 0; }
.content { flex: 1; overflow-y: auto; padding: 24px; }

/* ── Sidebar ─────────────────────────────────────────────────── */
.sidebar {
  width: var(--sidebar-w); background: var(--surface);
  border-right: 2px solid var(--green);
  display: flex; flex-direction: column; flex-shrink: 0;
  box-shadow: 4px 0 24px rgba(0,230,118,0.07); z-index: 100;
}
.sb-logo {
  padding: 18px 16px; border-bottom: 1px solid var(--border);
  display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.sb-logo-icon {
  width: 42px; height: 42px; background: var(--black);
  border-radius: 10px; border: 1.5px solid var(--green);
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 0 14px var(--green-glow); flex-shrink: 0;
}
.sb-logo-name { font-size: 13px; font-weight: 900; letter-spacing: 2px; text-transform: uppercase; color: var(--text); }
.sb-logo-ver  { font-size: 9px; color: var(--green-dim); font-weight: 700; letter-spacing: 1.5px; }
.sb-nav { flex: 1; padding: 10px 8px; overflow-y: auto; }
.sb-section {
  font-size: 9px; font-weight: 800; letter-spacing: 2px;
  text-transform: uppercase; color: var(--green-dim);
  padding: 12px 10px 4px;
}
.sb-item {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 12px; border-radius: 8px;
  color: var(--text2); font-size: 13px; font-weight: 500;
  cursor: pointer; transition: all var(--transition);
  border: 1px solid transparent; margin-bottom: 2px;
  text-decoration: none;
}
.sb-item svg { width: 16px; height: 16px; flex-shrink: 0; opacity: 0.65; transition: opacity var(--transition); }
.sb-item:hover { background: rgba(0,230,118,0.07); color: var(--text); border-color: var(--border); }
.sb-item:hover svg { opacity: 1; }
.sb-item.active {
  background: var(--black); color: var(--green); font-weight: 700;
  border-color: var(--green); box-shadow: 0 2px 14px rgba(0,230,118,0.2);
}
.sb-item.active svg { opacity: 1; color: var(--green); }
.sb-badge {
  margin-left: auto; background: var(--green); color: var(--black);
  font-size: 10px; font-weight: 900; border-radius: 10px;
  padding: 1px 7px; min-width: 20px; text-align: center;
}
.sb-bottom { padding: 12px; border-top: 1px solid var(--border); flex-shrink: 0; }
.sb-urgence-btn {
  width: 100%; padding: 10px;
  background: rgba(239,68,68,0.07); border: 1.5px solid rgba(239,68,68,0.3);
  color: #dc2626; border-radius: 8px; cursor: pointer;
  font-family: var(--font); font-size: 12px; font-weight: 700;
  display: flex; align-items: center; justify-content: center; gap: 8px;
  transition: all var(--transition); letter-spacing: 0.5px;
}
.sb-urgence-btn:hover { background: rgba(239,68,68,0.14); border-color: #ef4444; }
body.urgence .sb-urgence-btn { background: #ef4444; color: #fff; animation: pulse 1s infinite; }
@keyframes pulse { 0%,100%{opacity:1}50%{opacity:0.7} }

/* Fin contrat ≤48h — rouge électrique léger (texte / badges) */
@keyframes oft-electric-48h {
  0%, 100% {
    opacity: 1;
    text-shadow: 0 0 2px rgba(251, 113, 133, 0.4);
  }
  50% {
    opacity: 0.88;
    text-shadow: 0 0 8px rgba(244, 63, 94, 0.5), 0 0 14px rgba(248, 113, 113, 0.28);
  }
}
/* Variante encadrés / cartes KPI */
@keyframes oft-electric-48h-box {
  0%, 100% {
    box-shadow: 0 0 0 rgba(244, 63, 94, 0);
  }
  50% {
    box-shadow: 0 0 12px rgba(244, 63, 94, 0.22), inset 0 0 8px rgba(251, 113, 133, 0.06);
  }
}
.oft-fin-contrat-48h {
  animation: oft-electric-48h 1.65s ease-in-out infinite;
}
.oft-fin-contrat-48h-box {
  animation: oft-electric-48h-box 1.65s ease-in-out infinite;
}

/* ── Topbar ──────────────────────────────────────────────────── */
.topbar {
  height: var(--topbar-h); background: var(--surface);
  border-bottom: 2px solid var(--green);
  display: flex; align-items: center; padding: 0 24px; gap: 14px;
  flex-shrink: 0; box-shadow: 0 2px 16px rgba(0,230,118,0.08); z-index: 50;
}
.topbar-title  { font-size: 14px; font-weight: 900; text-transform: uppercase; letter-spacing: 1px; color: var(--text); flex: 0 1 auto; min-width: 0; }
.topbar-actions{ display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.oft-global-search-wrap { flex: 1 1 180px; min-width: 120px; max-width: 420px; }

/* ── Boutons ─────────────────────────────────────────────────── */
/* ══════════════════════════════════════════════════════════════
   BOUTONS — Miroir électrique · Typographie fine Syne / Space Grotesk
   Surface polie, reflet inversé, écriture condensée ultra-légère
   ══════════════════════════════════════════════════════════════ */

:root {
  --btn-font:    'Syne', 'Space Grotesk', 'Raleway', system-ui, sans-serif;
  --btn-green:   #00e676;
  --btn-green-b: #00ffa3;
  --btn-dark:    #050f08;
  --btn-text-on-dark: #001a09;
}

/* ── Base ──────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 22px;
  min-height: 40px;

  /* Typographie fine et innovante */
  font-family: var(--btn-font);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 2.4px;
  text-transform: uppercase;
  line-height: 1;

  border-radius: 10px;
  border: none;
  cursor: pointer;
  position: relative;
  overflow: hidden;
  text-decoration: none;
  white-space: nowrap;
  transition:
    transform 0.22s cubic-bezier(.34,1.56,.64,1),
    box-shadow 0.22s ease,
    filter 0.16s ease,
    color 0.16s ease;
  isolation: isolate;
  -webkit-font-smoothing: antialiased;
}

/* ── Demi-miroir haut : lumière tombante ───────────────────── */
.btn::before {
  content: '';
  position: absolute;
  inset: 0 0 50% 0;
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.17) 0%,
    rgba(255,255,255,0.05) 65%,
    transparent 100%
  );
  border-radius: inherit;
  border-bottom-left-radius: 0;
  border-bottom-right-radius: 0;
  pointer-events: none;
  z-index: 2;
  transition: background 0.22s ease;
}

/* ── Demi-miroir bas : reflet symétrique atténué ───────────── */
.btn::after {
  content: '';
  position: absolute;
  inset: 50% 0 0 0;
  background: linear-gradient(
    0deg,
    rgba(255,255,255,0.03) 0%,
    rgba(255,255,255,0.09) 55%,
    rgba(255,255,255,0.02) 100%
  );
  border-radius: inherit;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  /* Ligne miroir — suture lumineuse */
  border-top: 1px solid rgba(255,255,255,0.13);
  pointer-events: none;
  z-index: 2;
  transition: background 0.22s ease, border-top-color 0.22s ease;
}

.btn:hover::before {
  background: linear-gradient(
    180deg,
    rgba(255,255,255,0.26) 0%,
    rgba(255,255,255,0.09) 65%,
    transparent 100%
  );
}
.btn:hover::after {
  background: linear-gradient(
    0deg,
    rgba(255,255,255,0.06) 0%,
    rgba(255,255,255,0.15) 55%,
    rgba(255,255,255,0.03) 100%
  );
  border-top-color: rgba(255,255,255,0.2);
}

.btn > * { position: relative; z-index: 3; }
.btn svg { width: 14px; height: 14px; flex-shrink: 0; position: relative; z-index: 3; }

/* ── Tailles ───────────────────────────────────────────────── */
.btn-sm {
  padding: 0 14px;
  min-height: 30px;
  font-size: 9.5px;
  letter-spacing: 2px;
  border-radius: 8px;
}
.btn-lg {
  padding: 0 32px;
  min-height: 50px;
  font-size: 12px;
  letter-spacing: 3px;
  border-radius: 12px;
}

/* ══════════════════════════════════════════════════════════════
   VARIANTES
   ══════════════════════════════════════════════════════════════ */

/* ── PRIMARY — Miroir marbre noir · texte vert électrique ── */
.btn-primary {
  background: linear-gradient(
    180deg,
    #030c06 0%,
    #07220f 16%,
    #0b3a1a 33%,
    #093015 50%,   /* ← ligne miroir */
    #072810 52%,
    #041a0a 70%,
    #020c05 100%
  );
  color: #00e676;
  /* Texte gravé : léger relief de lumière + profondeur */
  text-shadow:
    0 0 8px  rgba(0,230,118,0.85),
    0 0 20px rgba(0,255,163,0.45),
    0 0 42px rgba(0,230,118,0.22),
    0  1px 0 rgba(0,255,163,0.15),
    0 -1px 0 rgba(0,0,0,0.6);
  box-shadow:
    0 0 0 1px  rgba(0,230,118,0.5),
    0 0 0 1.5px rgba(0,230,118,0.2),
    0 0 16px   rgba(0,230,118,0.22),
    0 6px 22px rgba(0,0,0,0.55),
    inset 0 1px 0 rgba(0,255,163,0.16),
    inset 0 -1px 0 rgba(0,0,0,0.45);
}
.btn-primary:hover {
  background: linear-gradient(
    180deg,
    #051508 0%,
    #0d4020 16%,
    #145830 33%,
    #104a28 50%,
    #0d3e22 52%,
    #092c18 70%,
    #040e06 100%
  );
  color: #00ffa3;
  text-shadow:
    0 0 12px rgba(0,255,163,1),
    0 0 28px rgba(0,230,118,0.85),
    0 0 55px rgba(0,255,163,0.45),
    0  1px 0 rgba(0,255,163,0.25),
    0 -1px 0 rgba(0,0,0,0.7);
  box-shadow:
    0 0 0 1px  rgba(0,255,163,0.75),
    0 0 0 2px  rgba(0,255,163,0.2),
    0 0 24px   rgba(0,230,118,0.5),
    0 0 55px   rgba(0,255,163,0.25),
    0 8px 28px rgba(0,0,0,0.6),
    inset 0 1px 0 rgba(0,255,163,0.25);
  transform: translateY(-2px) scale(1.02);
  filter: brightness(1.05);
}
.btn-primary:active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(0.92);
  box-shadow:
    0 0 0 1px rgba(0,230,118,0.6),
    0 0 12px rgba(0,230,118,0.3),
    inset 0 3px 10px rgba(0,0,0,0.6);
}

/* ── SECONDARY — Miroir verre laiteux · texte noir électrique ── */
.btn-secondary {
  background: linear-gradient(
    180deg,
    #ffffff 0%,
    #f2fff9 20%,
    #e4fff4 40%,
    #d8ffee 50%,   /* ligne miroir */
    #e4fff4 52%,
    #f2fff9 75%,
    #fdfffe 100%
  );
  color: #001a09;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.7),
    0 0 6px rgba(0,100,40,0.12);
  box-shadow:
    0 0 0 1px  rgba(0,230,118,0.3),
    0 2px 12px rgba(0,0,0,0.07),
    inset 0 1px 0 rgba(255,255,255,0.95),
    inset 0 -1px 0 rgba(0,160,70,0.07);
}
.btn-secondary:hover {
  background: linear-gradient(
    180deg,
    #edfff8 0%,
    #ccffe8 20%,
    #aaffd6 40%,
    #90ffca 50%,
    #aaffd6 52%,
    #ccffe8 75%,
    #edfff8 100%
  );
  color: #001209;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.8),
    0 0 10px rgba(0,180,80,0.4),
    0 0 22px rgba(0,230,118,0.18);
  box-shadow:
    0 0 0 1px  rgba(0,230,118,0.55),
    0 0 0 2px  rgba(0,230,118,0.1),
    0 0 18px   rgba(0,230,118,0.18),
    0 4px 16px rgba(0,0,0,0.09),
    inset 0 1px 0 rgba(255,255,255,0.98);
  transform: translateY(-1px) scale(1.014);
}
.btn-secondary:active {
  transform: translateY(1px) scale(0.988);
  filter: brightness(0.96);
}

/* ── DANGER / ALERTE — verre rouge translucide · néon ── */
.btn-danger,
.btn-alert {
  position: relative;
  overflow: hidden;
  isolation: isolate;
  background: linear-gradient(
    135deg,
    rgba(127, 29, 29, 0.42) 0%,
    rgba(185, 28, 28, 0.35) 22%,
    rgba(220, 38, 38, 0.38) 45%,
    rgba(153, 27, 27, 0.36) 52%,
    rgba(69, 10, 10, 0.48) 100%
  );
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  color: #fecaca;
  border: 1px solid rgba(254, 202, 202, 0.35);
  text-shadow:
    0 0 10px rgba(255, 80, 80, 0.95),
    0 0 26px rgba(248, 113, 113, 0.55),
    0 0 48px rgba(239, 68, 68, 0.35),
    0 1px 0 rgba(255, 255, 255, 0.12);
  box-shadow:
    0 0 0 1px rgba(239, 68, 68, 0.35),
    0 0 20px rgba(239, 68, 68, 0.22),
    0 4px 24px rgba(0, 0, 0, 0.35),
    inset 0 1px 0 rgba(255, 255, 255, 0.14),
    inset 0 -1px 0 rgba(0, 0, 0, 0.25);
}
.btn-danger:hover,
.btn-alert:hover {
  color: #fff;
  border-color: rgba(254, 202, 202, 0.55);
  background: linear-gradient(
    135deg,
    rgba(153, 27, 27, 0.52) 0%,
    rgba(220, 38, 38, 0.48) 30%,
    rgba(239, 68, 68, 0.42) 50%,
    rgba(185, 28, 28, 0.5) 100%
  );
  box-shadow:
    0 0 0 1px rgba(248, 113, 113, 0.55),
    0 0 28px rgba(239, 68, 68, 0.45),
    0 0 56px rgba(220, 38, 38, 0.2),
    0 8px 28px rgba(0, 0, 0, 0.4),
    inset 0 1px 0 rgba(255, 255, 255, 0.2);
  transform: translateY(-1px) scale(1.02);
  filter: brightness(1.06);
}
.btn-danger:active,
.btn-alert:active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(0.92);
}
/* Harmonise les reflets .btn génériques sur les variantes danger / alerte */
.btn.btn-danger::before,
.btn.btn-alert::before {
  background: linear-gradient(
    180deg,
    rgba(255, 255, 255, 0.14) 0%,
    rgba(255, 200, 200, 0.06) 35%,
    transparent 72%
  );
}
.btn.btn-danger::after,
.btn.btn-alert::after {
  border-top-color: rgba(255, 200, 200, 0.18);
  background: linear-gradient(
    0deg,
    rgba(255, 100, 100, 0.06) 0%,
    rgba(255, 255, 255, 0.04) 100%
  );
}

/* Overlays : formulaire en cours — pas de fermeture au clic fond */
.ov.oft-modal-locked,
.modal-overlay.oft-modal-locked {
  cursor: default;
}
.ov.oft-modal-locked .md,
.modal-overlay.oft-modal-locked .modal {
  position: relative;
  box-shadow:
    0 0 0 2px rgba(239, 68, 68, 0.2),
    0 0 40px rgba(239, 68, 68, 0.08),
    0 24px 64px rgba(0, 0, 0, 0.35);
}

/* ── SUCCESS — Miroir vert pur · texte noir gravé ── */
.btn-success {
  background: linear-gradient(
    180deg,
    #00a84a 0%,
    #00c85a 18%,
    #00e068 36%,
    #00c058 50%,
    #00aa4e 52%,
    #009040 70%,
    #006830 100%
  );
  color: #001a09;
  font-weight: 600;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.38),
    0 -1px 0 rgba(0,40,15,0.4),
    0 0 8px rgba(0,0,0,0.15);
  box-shadow:
    0 0 0 1px  rgba(0,200,83,0.6),
    0 0 16px   rgba(0,230,118,0.38),
    0 6px 20px rgba(0,0,0,0.28),
    inset 0 1px 0 rgba(255,255,255,0.4),
    inset 0 -1px 0 rgba(0,60,20,0.28);
}
.btn-success:hover {
  background: linear-gradient(
    180deg,
    #00bf54 0%,
    #00e468 18%,
    #00ff7a 36%,
    #00d862 50%,
    #00c056 52%,
    #00a044 70%,
    #007530 100%
  );
  color: #000c04;
  text-shadow:
    0 1px 0 rgba(255,255,255,0.5),
    0 -1px 0 rgba(0,30,10,0.3);
  box-shadow:
    0 0 0 1px  rgba(0,255,120,0.8),
    0 0 0 2px  rgba(0,255,120,0.15),
    0 0 28px   rgba(0,230,118,0.65),
    0 0 60px   rgba(0,255,136,0.3),
    0 8px 26px rgba(0,0,0,0.3),
    inset 0 1px 0 rgba(255,255,255,0.5);
  transform: translateY(-2px) scale(1.02);
}
.btn-success:active {
  transform: translateY(1px) scale(0.985);
  filter: brightness(0.9);
}

/* ── WARNING ───────────────────────────────────────────── */
.btn-warning {
  background: linear-gradient(180deg, #130a00 0%, #251400 18%, #362000 36%, #2c1900 50%, #231300 52%, #160c00 70%, #090400 100%);
  color: #ffca44;
  text-shadow: 0 0 8px rgba(255,180,0,0.85), 0 0 22px rgba(255,150,0,0.42), 0 1px 0 rgba(255,200,80,0.14), 0 -1px 0 rgba(0,0,0,0.6);
  box-shadow: 0 0 0 1px rgba(245,158,11,0.45), 0 6px 20px rgba(0,0,0,0.48), inset 0 1px 0 rgba(255,200,50,0.1);
}
.btn-warning:hover {
  background: linear-gradient(180deg, #1c0e00 0%, #341c00 18%, #4e2e00 36%, #402600 50%, #332000 52%, #201200 70%, #0d0600 100%);
  color: #ffd966;
  text-shadow: 0 0 14px rgba(255,210,0,1), 0 0 34px rgba(255,160,0,0.65), 0 1px 0 rgba(255,220,100,0.2), 0 -1px 0 rgba(0,0,0,0.7);
  box-shadow: 0 0 0 1px rgba(245,158,11,0.75), 0 0 24px rgba(245,158,11,0.45), 0 8px 26px rgba(0,0,0,0.52);
  transform: translateY(-1px) scale(1.015);
}

/* ── INFO ──────────────────────────────────────────────── */
.btn-info {
  background: linear-gradient(180deg, #000814 0%, #001020 18%, #001830 36%, #001228 50%, #000e20 52%, #000818 70%, #000410 100%);
  color: #52c0ff;
  text-shadow: 0 0 8px rgba(82,192,255,0.88), 0 0 22px rgba(14,165,233,0.42), 0 1px 0 rgba(100,200,255,0.14), 0 -1px 0 rgba(0,0,0,0.6);
  box-shadow: 0 0 0 1px rgba(14,165,233,0.45), 0 6px 20px rgba(0,0,0,0.48), inset 0 1px 0 rgba(82,192,255,0.1);
}
.btn-info:hover {
  background: linear-gradient(180deg, #000e1e 0%, #001830 18%, #002244 36%, #001c38 50%, #001630 52%, #000e22 70%, #000614 100%);
  color: #88d4ff;
  text-shadow: 0 0 14px rgba(82,192,255,1), 0 0 34px rgba(14,165,233,0.68), 0 1px 0 rgba(120,210,255,0.22), 0 -1px 0 rgba(0,0,0,0.7);
  box-shadow: 0 0 0 1px rgba(14,165,233,0.75), 0 0 24px rgba(14,165,233,0.45), 0 8px 26px rgba(0,0,0,0.5);
  transform: translateY(-1px) scale(1.015);
}
/* ── Animation glow pulsant btn-primary ─────────────────── */
@keyframes btn-glow-pulse {
  0%, 100% {
    box-shadow:
      0 0 0 1px   rgba(0,230,118,0.5),
      0 0 0 1.5px rgba(0,230,118,0.18),
      0 0 16px    rgba(0,230,118,0.22),
      0 6px 22px  rgba(0,0,0,0.55),
      inset 0 1px 0 rgba(0,255,163,0.16);
  }
  50% {
    box-shadow:
      0 0 0 1px   rgba(0,255,163,0.8),
      0 0 0 2px   rgba(0,255,163,0.18),
      0 0 28px    rgba(0,230,118,0.48),
      0 0 58px    rgba(0,255,163,0.22),
      0 6px 22px  rgba(0,0,0,0.55),
      inset 0 1px 0 rgba(0,255,163,0.24);
  }
}

/* Appliquer le pulse uniquement aux btn-primary dans le topbar et modales */
.topbar .btn-primary,
.modal-footer .btn-primary,
.sb-bottom .btn-primary {
  animation: btn-glow-pulse 2.8s ease-in-out infinite;
}
.topbar .btn-primary:hover,
.modal-footer .btn-primary:hover {
  animation: none;
}

/* ── Effet marbre : veine animée sur btn-primary ────────── */
@keyframes marble-shift {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ══════════════════════════════════════════════════════
   MODALS — styles manquants (fix v7.2)
══════════════════════════════════════════════════════ */
.modal-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.68);
  z-index: 1000;
  align-items: center;
  justify-content: center;
  padding: 20px;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
}
.modal-overlay.open {
  display: flex;
}
.modal {
  background: var(--surface);
  border-radius: 14px;
  border: 1px solid var(--border);
  width: 560px;
  max-width: 96vw;
  max-height: 92vh;
  overflow-y: auto;
  padding: 24px;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.7), 0 0 0 1px rgba(255,255,255,0.04);
  animation: modal-in 0.18s ease;
}
@keyframes modal-in {
  from { opacity: 0; transform: translateY(12px) scale(0.98); }
  to   { opacity: 1; transform: none; }
}
.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 20px;
}
.modal-title {
  font-size: 15px;
  font-weight: 800;
  letter-spacing: -0.3px;
}
.modal-close {
  cursor: pointer;
  opacity: 0.45;
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  transition: opacity 0.15s, background 0.15s;
}
.modal-close:hover {
  opacity: 1;
  background: rgba(255,255,255,0.07);
}
.modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border);
}
.modal--tache {
  width: min(92vw, 860px);
  max-width: 92vw;
}
.page-taches .tache-quill-editor .ql-toolbar {
  border-radius: 8px 8px 0 0;
  border-color: var(--border);
  font-family: inherit;
  background: var(--surface2);
}
.page-taches .tache-quill-editor .ql-container {
  border-radius: 0 0 8px 8px;
  border-color: var(--border);
  font-family: inherit;
  font-size: inherit;
  min-height: 130px;
  background: var(--surface);
}

/* ══════════════════════════════════════════════════════════════
   COMPOSANTS UI — Ajout v7.2 (card, form, badge, tabs, table…)
══════════════════════════════════════════════════════════════ */

/* ── Sidebar active state ────────────────────────────────────── */
.sb-item.active {
  background: rgba(0,230,118,0.12);
  color: var(--text);
  border-color: rgba(0,230,118,0.35);
  font-weight: 700;
}
.sb-item.active svg { opacity: 1; }

/* ── Card ─────────────────────────────────────────────────────── */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 20px;
  box-shadow: var(--shadow);
}
.mb-4 { margin-bottom: 16px; }

/* ── Badge ────────────────────────────────────────────────────── */
.badge {
  display: inline-flex; align-items: center;
  padding: 2px 9px; border-radius: 20px;
  font-size: 11px; font-weight: 700; letter-spacing: 0.3px;
  white-space: nowrap;
}
.badge-green  { background: rgba(0,230,118,.14); color: #00a152; border: 1px solid rgba(0,230,118,.3); }
.badge-blue   { background: rgba(59,130,246,.12); color: #1d4ed8; border: 1px solid rgba(59,130,246,.25); }
.badge-amber  { background: rgba(245,158,11,.12); color: #b45309; border: 1px solid rgba(245,158,11,.25); }
.badge-red    { background: rgba(239,68,68,.12);  color: #dc2626; border: 1px solid rgba(239,68,68,.25); }
.badge-gray   { background: rgba(100,116,139,.1); color: #475569; border: 1px solid rgba(100,116,139,.2); }
.badge-purple { background: rgba(139,92,246,.12); color: #7c3aed; border: 1px solid rgba(139,92,246,.25); }

/* ── Forms ────────────────────────────────────────────────────── */
.form-group {
  display: flex; flex-direction: column; gap: 5px;
  margin-bottom: 14px;
}
.form-group:last-child { margin-bottom: 0; }
.form-group label {
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted);
}
.form-row {
  display: grid; grid-template-columns: 1fr 1fr; gap: 14px;
  margin-bottom: 14px;
}
input[type="text"], input[type="number"], input[type="email"],
input[type="tel"], input[type="date"], input[type="password"],
input:not([type]), textarea, select {
  background: var(--surface2);
  border: 1.5px solid var(--border);
  border-radius: var(--radius);
  padding: 9px 12px;
  font-size: 13px; font-family: var(--font);
  color: var(--text);
  width: 100%;
  transition: border-color var(--transition), box-shadow var(--transition);
  outline: none;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--green);
  box-shadow: 0 0 0 3px rgba(0,230,118,0.12);
}
input::placeholder, textarea::placeholder {
  color: var(--muted); opacity: 0.7;
}
textarea { resize: vertical; min-height: 72px; }
select { cursor: pointer; }

/* ── Tabs ─────────────────────────────────────────────────────── */
.tabs {
  display: flex; gap: 4px;
  border-bottom: 2px solid var(--border);
  padding-bottom: 0;
}
.tab {
  padding: 8px 14px;
  font-size: 12px; font-weight: 600;
  color: var(--muted); cursor: pointer;
  border-radius: 8px 8px 0 0;
  transition: all var(--transition);
  border: 1px solid transparent;
  border-bottom: none;
  position: relative; bottom: -2px;
}
.tab:hover { color: var(--text); background: rgba(0,230,118,0.06); }
.tab.active {
  color: var(--text); font-weight: 800;
  background: var(--surface);
  border-color: var(--border);
  border-bottom-color: var(--surface);
}
.tab-pane { display: none; padding-top: 16px; }
.tab-pane.active { display: block; }

/* ── Metrics / Stats cards ────────────────────────────────────── */
.metric {
  background: var(--surface2);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 12px 14px;
}
.metric-label {
  font-size: 10px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 1px;
  color: var(--muted); margin-bottom: 4px;
}
.metric-value {
  font-size: 20px; font-weight: 800;
  color: var(--text); line-height: 1.2;
}

/* ── Grid helpers ─────────────────────────────────────────────── */
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.grid-3 { display: grid; grid-template-columns: repeat(3,1fr); gap: 14px; }
.flex   { display: flex; }
.gap-3  { gap: 12px; }
.gap-2  { gap: 8px; }

/* ── Tables ───────────────────────────────────────────────────── */
.table-wrap { overflow-x: auto; }
table {
  width: 100%; border-collapse: collapse;
  font-size: 13px;
}
thead th {
  padding: 10px 14px;
  font-size: 10px; font-weight: 800;
  text-transform: uppercase; letter-spacing: 0.8px;
  color: var(--muted);
  border-bottom: 2px solid var(--border);
  text-align: left; white-space: nowrap;
}
tbody td {
  padding: 11px 14px;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}
tbody tr:last-child td { border-bottom: none; }
tbody tr:hover td { background: rgba(0,230,118,0.04); }

/* ── Toast ────────────────────────────────────────────────────── */
#toast-container {
  position: fixed; top: 16px; right: 16px;
  z-index: 9999; display: flex; flex-direction: column; gap: 8px;
}
.toast {
  padding: 12px 18px; border-radius: 10px;
  font-size: 13px; font-weight: 600;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  animation: toast-in 0.22s ease;
  max-width: 360px;
}
@keyframes toast-in {
  from { opacity:0; transform: translateX(20px); }
  to   { opacity:1; transform: none; }
}
.toast-success { background: #00a152; color: #fff; }
.toast-warning { background: #b45309; color: #fff; }
.toast-error   { background: #dc2626; color: #fff; }
.toast-info    { background: #1d4ed8; color: #fff; }

/* ── Flash messages ───────────────────────────────────────────── */
.flash { padding: 12px 16px; border-radius: 8px; margin-bottom: 14px; font-size: 13px; font-weight: 600; }
.flash-success { background: rgba(0,230,118,.12); color: #00a152; border: 1px solid rgba(0,230,118,.3); }
.flash-warning { background: rgba(245,158,11,.12); color: #b45309; border: 1px solid rgba(245,158,11,.3); }
.flash-error   { background: rgba(239,68,68,.12);  color: #dc2626; border: 1px solid rgba(239,68,68,.3); }

/* ── Topbar sb-badge ─────────────────────────────────────────── */
.sb-badge {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 18px; height: 18px; border-radius: 9px;
  background: var(--danger); color: #fff;
  font-size: 10px; font-weight: 800; padding: 0 5px;
}

/* ── Primary color ────────────────────────────────────────────── */
.text-primary { color: var(--green-dim); }
var(--primary) { color: var(--green-dim); }

/* Alias --primary pour compatibilité templates */
:root { --primary: #00c853; }

/* ── Page Tâches (lisibilité & regroupement par échéance) ─────── */
.taches-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 12px;
}
.taches-toolbar__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  flex: 1;
  min-width: 0;
}
.taches-pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text2);
  transition: background 0.15s, border-color 0.15s, color 0.15s;
}
.taches-pill:hover {
  border-color: var(--green);
  color: var(--text);
}
.taches-pill.is-active {
  background: var(--black);
  color: var(--green);
  border-color: var(--green);
}
.taches-pill--danger:not(.is-active) {
  color: #b91c1c;
  border-color: rgba(239, 68, 68, 0.35);
}
.taches-pill--urgent:not(.is-active) { color: #dc2626; }
.taches-pill__count {
  font-size: 10px;
  font-weight: 800;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: 9px;
  background: rgba(239, 68, 68, 0.2);
  color: #dc2626;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.taches-pill.is-active .taches-pill__count {
  background: rgba(0, 230, 118, 0.2);
  color: var(--green);
}

.taches-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 12px;
  margin-bottom: 14px;
}

.taches-reading-lede {
  font-size: 13px;
  line-height: 1.55;
  color: var(--muted);
  margin: 0 0 20px;
  padding: 12px 14px;
  background: var(--surface2);
  border-radius: var(--radius);
  border-left: 3px solid var(--green);
  max-width: 100%;
}
.taches-reading-lede strong {
  color: var(--text2);
  font-weight: 700;
}
.page-taches .kpi-card--alert { border-color: rgba(239, 68, 68, 0.4); }
.page-taches .kpi-card--warn { border-color: rgba(245, 158, 11, 0.35); }

.taches-layout {
  display: grid;
  grid-template-columns: 1fr minmax(260px, min(400px, 30vw));
  gap: 20px 32px;
  align-items: start;
  width: 100%;
}
@media (max-width: 960px) {
  .taches-layout { grid-template-columns: 1fr; }
}

.taches-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--muted);
  margin-bottom: 14px;
}

.taches-bucket { margin-bottom: 20px; }
.taches-bucket__head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 10px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.taches-bucket__head-text {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}
.taches-bucket__hint {
  display: block;
  font-size: 12px;
  font-weight: 500;
  line-height: 1.4;
  color: var(--muted);
  letter-spacing: 0.01em;
}
.taches-bucket--danger .taches-bucket__head { border-bottom-color: rgba(239, 68, 68, 0.45); }
.taches-bucket--today .taches-bucket__head { border-bottom-color: rgba(245, 158, 11, 0.4); }
.taches-bucket--week .taches-bucket__head { border-bottom-color: rgba(14, 165, 233, 0.35); }
.taches-bucket__label {
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.04em;
}
.taches-bucket--danger .taches-bucket__label { color: #dc2626; }
.taches-bucket--today .taches-bucket__label { color: #b45309; }
.taches-bucket--week .taches-bucket__label { color: #0369a1; }
.taches-bucket--later .taches-bucket__label { color: var(--text2); }
.taches-bucket--nodate .taches-bucket__label { color: var(--muted); }
.taches-bucket__count {
  font-size: 11px;
  font-weight: 700;
  color: var(--muted);
  background: var(--surface2);
  padding: 2px 8px;
  border-radius: 999px;
}
.taches-bucket__list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.tache-card {
  background: var(--surface);
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  box-shadow: var(--shadow);
  overflow: hidden;
  border-left: 4px solid var(--tache-bar, var(--primary));
}
.tache-card--overdue {
  background: linear-gradient(135deg, rgba(239, 68, 68, 0.06) 0%, var(--surface) 48%);
  border-color: rgba(239, 68, 68, 0.28);
}
.tache-card__main {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  padding: 14px 16px 14px 14px;
}
.tache-card__body { flex: 1; min-width: 0; }
.tache-card__title {
  font-size: 1.0625rem;
  font-weight: 700;
  line-height: 1.38;
  letter-spacing: -0.01em;
  color: var(--text);
  margin-bottom: 6px;
}
.tache-card__detail {
  font-size: 0.9375rem;
  line-height: 1.62;
  color: var(--text2);
  margin-bottom: 12px;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 7.5em;
  overflow: hidden;
  display: -webkit-box;
  -webkit-line-clamp: 5;
  -webkit-box-orient: vertical;
}
.tache-card__detail--rich {
  display: block;
  max-height: none;
  overflow: visible;
  -webkit-line-clamp: unset;
  white-space: normal;
  word-break: break-word;
}
.tache-card__detail--rich p {
  margin: 0 0 0.5em;
}
.tache-card__detail--rich p:last-child {
  margin-bottom: 0;
}
.tache-card__detail--rich ul,
.tache-card__detail--rich ol {
  margin: 0.35em 0 0.55em 1.15em;
  padding-left: 0.25em;
}
.tache-card__detail--rich h1,
.tache-card__detail--rich h2,
.tache-card__detail--rich h3 {
  font-size: 1em;
  font-weight: 800;
  margin: 0.4em 0 0.25em;
  line-height: 1.3;
}
.tache-card__detail--rich h1 { font-size: 1.15em; }
.tache-card__detail--rich h2 { font-size: 1.08em; }
.tache-card__detail--rich .ql-size-small { font-size: 0.88em; }
.tache-card__detail--rich .ql-size-large { font-size: 1.12em; }
.tache-card__detail--rich .ql-size-huge { font-size: 1.28em; }
.tache-card__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
}
.tache-meta-chantier {
  max-width: 220px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.tache-card__actions {
  display: flex;
  flex-shrink: 0;
  gap: 4px;
  align-items: flex-start;
}
.tache-card--done .tache-card__title--done {
  text-decoration: line-through;
  color: var(--muted);
  font-weight: 600;
  font-size: 14px;
}
.tache-card--done .tache-card__main { padding: 12px 14px 12px 12px; }
.tache-card__sub {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}
.tache-card--compact .tache-card__title { font-size: 13px; }
.tache-card--compact .tache-card__main { padding: 10px 12px 10px 10px; }

.page-taches .taches-affectation-block {
  margin-top: 12px;
  padding: 12px 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  background: var(--surface2);
}
.page-taches .taches-affectation-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
  margin-bottom: 10px;
}
.page-taches .taches-label-hint {
  font-weight: 500;
  color: var(--muted);
  text-transform: none;
  letter-spacing: 0;
}

.taches-empty {
  text-align: center;
  padding: 28px 16px;
  color: var(--muted);
  font-size: 14px;
  border: 1px dashed var(--border);
  border-radius: var(--radius-lg);
  background: rgba(0, 230, 118, 0.03);
}
.taches-empty--celebrate {
  border-style: solid;
  background: var(--surface2);
}

.taches-done-details {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  overflow: hidden;
}
.taches-done-summary {
  list-style: none;
  cursor: pointer;
  padding: 14px 16px;
  font-size: 13px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text2);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  user-select: none;
}
.taches-done-summary::-webkit-details-marker { display: none; }
.taches-done-summary::after {
  content: '▾';
  font-size: 12px;
  color: var(--muted);
  transition: transform 0.15s;
}
.taches-done-details[open] .taches-done-summary::after {
  transform: rotate(-180deg);
}
.taches-done-summary__meta {
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
  color: var(--muted);
}
.taches-done-details .taches-bucket-list {
  padding: 0 12px 12px;
  max-height: min(52vh, 480px);
  overflow-y: auto;
}
.taches-bucket-list--compact {
  gap: 8px;
  display: flex;
  flex-direction: column;
}

.taches-select-chantier {
  width: 100%;
  padding: 8px 10px;
  border-radius: 8px;
  border: 1px solid var(--border);
  font-family: var(--font);
  font-size: 13px;
  background: var(--surface2);
  color: var(--text);
}

/* ── Accessibilité taille UI globale ───────────────────────────── */
/* Applique un facteur d'échelle sur les zones encore en px fixes. */
:root {
  --app-ui-scale: 1;
}

/* Zoom global de l'interface pour agrandir toutes les écritures,
   y compris celles définies en px dans les templates/modules. */
.app {
  zoom: var(--app-ui-scale);
}

/* Fallback hors moteur Chromium */
@supports not (zoom: 1) {
  .app {
    transform: scale(var(--app-ui-scale));
    transform-origin: top left;
    width: calc(100% / var(--app-ui-scale));
    height: calc(100% / var(--app-ui-scale));
  }
}

.sb-logo-name { font-size: calc(13px * var(--app-ui-scale)); }
.sb-logo-ver  { font-size: calc(9px * var(--app-ui-scale)); }
.sb-section   { font-size: calc(9px * var(--app-ui-scale)); }
.sb-item      { font-size: calc(13px * var(--app-ui-scale)); }

.topbar-title { font-size: calc(14px * var(--app-ui-scale)); }
#global-search { font-size: calc(13px * var(--app-ui-scale)) !important; }

.btn {
  font-size: calc(11px * var(--app-ui-scale));
  min-height: calc(40px * var(--app-ui-scale));
}
.btn-sm {
  font-size: calc(9.5px * var(--app-ui-scale));
  min-height: calc(30px * var(--app-ui-scale));
}
.btn-lg {
  font-size: calc(12px * var(--app-ui-scale));
  min-height: calc(50px * var(--app-ui-scale));
}

.badge { font-size: calc(11px * var(--app-ui-scale)); }
.form-group label { font-size: calc(11px * var(--app-ui-scale)); }
input[type="text"], input[type="number"], input[type="email"],
input[type="tel"], input[type="date"], input[type="password"],
input:not([type]), textarea, select {
  font-size: calc(13px * var(--app-ui-scale));
}

table { font-size: calc(13px * var(--app-ui-scale)); }
thead th { font-size: calc(10px * var(--app-ui-scale)); }
.flash, .toast { font-size: calc(13px * var(--app-ui-scale)); }
