:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --text: #f8fafc;
  --text-dim: #94a3b8;
  --primary: #38bdf8;
  --success: #4ade80;
  --warning: #facc15;
  --error: #f87171;
  --critical: #ef4444;
  --high: #f97316;
  --medium: #eab308;
  --low: #64748b;
  --border: #334155;
}
.light {
  --bg: #f8fafc;
  --surface: #ffffff;
  --surface-2: #e2e8f0;
  --text: #0f172a;
  --text-dim: #475569;
  --border: #cbd5e1;
}
* { box-sizing: border-box; }
body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
  transition: background 0.2s, color 0.2s;
}
.container { max-width: 1400px; margin: 0 auto; padding: 1rem; }
header {
  position: sticky; top: 0; z-index: 50;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 0;
}
.light header { background: rgba(248,250,252,0.85); }
header .inner { display: flex; align-items: center; justify-content: space-between; gap: 1rem; flex-wrap: wrap; }
header h1 { margin: 0; font-size: 1.4rem; color: var(--primary); }
header nav { display: flex; gap: 0.5rem; flex-wrap: wrap; }
header a {
  color: var(--text-dim); text-decoration: none; padding: 0.4rem 0.7rem; border-radius: 0.4rem;
  font-size: 0.85rem; border: 1px solid transparent;
}
header a:hover, header a.active { color: var(--primary); background: var(--surface); border-color: var(--border); }
.btn {
  background: var(--surface-2); color: var(--text); border: 1px solid var(--border); padding: 0.45rem 0.8rem;
  border-radius: 0.4rem; cursor: pointer; font-size: 0.85rem; display: inline-flex; align-items: center; gap: 0.35rem;
}
.btn:hover { background: var(--primary); color: #0f172a; }
.btn-primary { background: var(--primary); color: #0f172a; border-color: var(--primary); }
.btn-primary:hover { filter: brightness(1.1); }
.btn-sm { padding: 0.25rem 0.5rem; font-size: 0.75rem; }
.toolbar {
  display: flex; gap: 0.75rem; align-items: center; flex-wrap: wrap; margin: 1rem 0;
  padding: 0.75rem; background: var(--surface); border-radius: 0.6rem; border: 1px solid var(--border);
}
input, select {
  background: var(--bg); color: var(--text); border: 1px solid var(--border); padding: 0.45rem 0.7rem;
  border-radius: 0.4rem; font-size: 0.85rem; min-width: 160px;
}
input:focus, select:focus { outline: 2px solid var(--primary); }
.grid-stats {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 0.75rem; margin: 1rem 0;
}
.card-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem; padding: 1rem;
  text-align: center;
}
.card-stat .value { font-size: 1.8rem; font-weight: 700; }
.card-stat .label { font-size: 0.75rem; color: var(--text-dim); text-transform: uppercase; letter-spacing: 0.05em; }
table { width: 100%; border-collapse: collapse; margin-top: 0.5rem; font-size: 0.85rem; }
th, td { padding: 0.6rem 0.75rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: var(--surface-2); color: var(--text); font-weight: 600; position: sticky; top: 0; }
tr:hover { background: rgba(56,189,248,0.05); }
.badge {
  display: inline-flex; align-items: center; padding: 0.15rem 0.5rem; border-radius: 9999px;
  font-size: 0.7rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-CRITICAL { background: rgba(239,68,68,0.15); color: var(--critical); }
.badge-HIGH { background: rgba(249,115,22,0.15); color: var(--high); }
.badge-MEDIUM { background: rgba(234,179,8,0.15); color: var(--medium); }
.badge-LOW { background: rgba(100,116,139,0.15); color: var(--low); }
.badge-Terminé, .badge-Corrigée, .badge-Vérifiée, .badge-Fermée { background: rgba(74,222,128,0.15); color: var(--success); }
.badge-En-cours, [class~="En cours"] { background: rgba(56,189,248,0.15); color: var(--primary); }
.badge-Partiel { background: rgba(250,204,21,0.15); color: var(--warning); }
.badge-À-faire, [class~="À faire"], .badge-Non-commencée, [class~="Non commencée"], .badge-Manquante, [class~="Manquante"] { background: rgba(148,163,184,0.15); color: var(--text-dim); }
.badge-Recommandée { background: rgba(168,85,247,0.15); color: #c084fc; }
.section { background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem; padding: 1rem; margin: 1rem 0; }
.section h2 { margin-top: 0; font-size: 1.1rem; color: var(--primary); }
.expanded { background: var(--bg); border: 1px solid var(--border); border-radius: 0.4rem; padding: 0.75rem; margin-top: 0.5rem; }
.expanded p { margin: 0.3rem 0; }
.expanded .label { color: var(--text-dim); font-weight: 600; }
pre { background: var(--bg); padding: 0.6rem; border-radius: 0.4rem; overflow-x: auto; font-size: 0.78rem; border: 1px solid var(--border); }
.kanban { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 0.75rem; margin-top: 0.5rem; }
.kanban-col { background: var(--bg); border: 1px solid var(--border); border-radius: 0.5rem; padding: 0.5rem; min-height: 120px; }
.kanban-col h4 { margin: 0 0 0.5rem; font-size: 0.85rem; color: var(--text-dim); text-transform: uppercase; }
.kanban-item {
  background: var(--surface); border: 1px solid var(--border); border-radius: 0.4rem; padding: 0.5rem;
  margin-bottom: 0.4rem; cursor: grab; font-size: 0.8rem;
}
.kanban-item:hover { border-color: var(--primary); }
.hidden { display: none !important; }
.progress-bar { height: 8px; background: var(--bg); border-radius: 4px; overflow: hidden; margin-top: 0.5rem; }
.progress-bar > div { height: 100%; background: var(--success); transition: width 0.3s; }
.chart-container { display: flex; gap: 1rem; flex-wrap: wrap; }
.chart-box { flex: 1; min-width: 280px; background: var(--surface); border: 1px solid var(--border); border-radius: 0.6rem; padding: 1rem; }
.toast {
  position: fixed; bottom: 1rem; right: 1rem; background: var(--surface-2); color: var(--text);
  padding: 0.6rem 1rem; border-radius: 0.4rem; border: 1px solid var(--border); z-index: 100;
  transform: translateY(120%); transition: transform 0.3s;
}
.toast.show { transform: translateY(0); }
.loading { padding: 2rem; text-align: center; color: var(--text-dim); }
@media (max-width: 768px) {
  header .inner { flex-direction: column; align-items: flex-start; }
  table { font-size: 0.75rem; }
  th, td { padding: 0.4rem; }
}
