/* ===== UI Magic (fixes v2) ===== */
.stats-footer{ position: fixed; bottom: 0; left: 0; right: 0; z-index: 60;
  background: linear-gradient(180deg, rgba(8,12,28,.72), rgba(6,10,22,.92));
  border-top: 1px solid rgba(255,255,255,.06); backdrop-filter: blur(8px);
  padding: .6rem .9rem 1rem; box-shadow: 0 -10px 30px rgba(0,0,0,.25); }
.stats-container{ max-width: 1200px; margin: 0 auto; }
.dept-grid{ display: grid; grid-template-columns: repeat(3, minmax(0,1fr)); grid-auto-rows: 64px; gap: .6rem .8rem; }
.dept-card{ position: relative; overflow: hidden; border-radius: 14px;
  background: linear-gradient(180deg, rgba(255,255,255,.06), rgba(255,255,255,.04));
  border: 1px solid rgba(255,255,255,.06); box-shadow: inset 0 1px 0 rgba(255,255,255,.06); }
.dept-progress{ position: absolute; inset: 0 0 0 auto; width: 0%; background: var(--c, #4f46e5);
  opacity: .85; transition: width .6s ease; }
.dept-content{ position: relative; z-index: 1; padding: .6rem .75rem;
  display: flex; align-items: center; justify-content: space-between;
  font-family: system-ui, -apple-system, Segoe UI, Roboto, sans-serif; color: #eaf0ff; }
.dept-name{ font-weight: 800; letter-spacing: .02em; }
.dept-numbers{ font-weight: 700; opacity: .95; }
.dept-sub{ font-weight: 600; opacity: .75; font-size: .85rem; }
.toast-stack{ position:fixed; left:12px; top:12px; z-index:80; display:grid; gap:.5rem; }
.toast{ background:#0b1020; color:#e5edff; border:1px solid rgba(255,255,255,.08); border-left:4px solid #6ca8ff;
  padding:.5rem .75rem; border-radius:12px; box-shadow:0 8px 24px rgba(0,0,0,.3); min-width:260px; max-width:380px; }
.toast .t-title{ font-weight:800; letter-spacing:.02em; }
.toast .t-meta{ opacity:.75; font-size:.85rem; }
.toast.ok{ border-left-color:#31d0aa; } .toast.warn{ border-left-color:#ffb020; } .toast.err{ border-left-color:#ff5c5c; }
.magic-wrap{ margin-top:.75rem; }


/* ==== MAGIC WATCHER ===================================================== */
.magic-watcher {
  --card-bg: rgba(17, 22, 40, .75);
  --card-bd: rgba(255, 255, 255, .06);
  --glow: 0 10px 30px rgba(90, 140, 255, .25);
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 14px;
  padding: 14px;
  margin: 12px auto 0;
  border: 1px solid var(--card-bd);
  border-radius: 16px;
  background: linear-gradient(180deg, rgba(255,255,255,.05), rgba(255,255,255,.03));
  box-shadow: var(--glow);
  backdrop-filter: blur(6px);
}

/* <= 720px: 1 colonne */
@media (max-width: 720px) {
  .magic-watcher { grid-template-columns: 1fr; }
}

/* Radar */
.mw-radar {
  position: relative;
  aspect-ratio: 1/1;
  border-radius: 999px;
  overflow: hidden;
  background:
    radial-gradient(transparent 55%, rgba(90,140,255,.18) 56% 100%),
    radial-gradient(circle at center, rgba(255,255,255,.06), transparent 60%),
    conic-gradient(from 0deg, rgba(90,140,255,.18), rgba(90,140,255,0) 25%);
  border: 1px solid var(--card-bd);
}
.mw-radar .sweep {
  position: absolute; inset: -25%;
  background: conic-gradient(from 0deg, rgba(120,255,180,.45), rgba(120,255,180,0) 40%);
  animation: sweep 2.8s linear infinite;
  mix-blend-mode: screen;
}
@keyframes sweep { to { transform: rotate(360deg); } }
.mw-radar .dot {
  position: absolute; width: 6px; height: 6px; border-radius: 999px;
  background: #7affb4;
  box-shadow: 0 0 10px 2px rgba(122,255,180,.65);
  opacity: .85;
}
.mw-radar .d1 { top: 22%; left: 64%; }
.mw-radar .d2 { top: 71%; left: 28%; }
.mw-radar .d3 { top: 48%; left: 78%; }

/* Logs */
.mw-right { min-height: 120px; display: flex; flex-direction: column; }
.mw-header {
  display:flex; align-items:center; justify-content:space-between;
  font: 700 .9rem/1.2 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  color: #dbe6ff; margin-bottom: 6px;
}
.mw-badges { display:flex; gap:8px; flex-wrap:wrap; }
.mw-badge {
  font: 700 .72rem/1 system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
  padding: 6px 8px; border-radius: 999px; border: 1px solid var(--card-bd);
  background: rgba(255,255,255,.06); color:#adbeff;
}
.mw-badge.ok { color:#7affb4; border-color: rgba(122,255,180,.35); }
.mw-badge.warn { color:#ffd37a; border-color: rgba(255,223,122,.35); }
.mw-badge.err { color:#ff8a8a; border-color: rgba(255,138,138,.35); }

.mw-logs {
  flex:1; min-height: 90px; max-height: 160px; overflow:auto;
  border:1px dashed var(--card-bd); border-radius: 12px; padding: 10px;
  background: var(--card-bg);
  color:#a9baff; font: 600 .78rem/1.35 ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}
.mw-logs .line { white-space: pre; opacity: .92; }
.mw-logs .line.dim { opacity: .6; }
.mw-logs .ts { color:#708cff; margin-right: 6px; }
.mw-logs .evt { color:#7affb4; margin: 0 6px; }


/* ==== MAGIC WATCHER — COMPACT (sans rien changer au HTML/JS) ========= */
/* On garde ton design, on réduit juste les volumes intelligemment. */

/* Par défaut, compact léger */
.magic-watcher{ gap:12px; padding:12px; }

/* ≤ 1024px : compaction douce */
@media (max-width: 1024px){
  .magic-watcher{
    grid-template-columns: 140px 1fr;
    gap: 12px;
    padding: 12px;
  }
  .mw-header{ font-size: .88rem; }
  .mw-badge{ transform: scale(.96); transform-origin: left center; }
  .mw-logs{ max-height: 140px; font-size: .76rem; }
}

/* ≤ 768px : compact franc (radar réduit, logs + petits) */
@media (max-width: 768px){
  .magic-watcher{
    grid-template-columns: 120px 1fr;
    gap: 10px;
    padding: 10px;
  }
  .mw-radar{ max-width: 120px; }
  .mw-badge{ transform: scale(.92); }
  .mw-logs{ max-height: 110px; font-size: .72rem; }
}

/* ≤ 480px : ultra compact & aéré */
@media (max-width: 480px){
  .magic-watcher{ padding: 8px; gap: 8px; }
  .mw-header{ font-size: .86rem; }
  .mw-badges{ gap:6px; }
  .mw-logs{ max-height: 100px; }
}

/* Accessibilité/perf */
@media (prefers-reduced-motion: reduce){
  .mw-radar .sweep{ animation: none; }
}
