/* ================================================================
   Suivi Équipes — design system v2
   ================================================================ */

:root {
  --bg: #f1f5f9;
  --bg-alt: #e2e8f0;
  --surface: #ffffff;
  --surface-2: #f8fafc;
  --ink: #0f172a;
  --ink-2: #334155;
  --muted: #64748b;
  --muted-2: #94a3b8;
  --border: #e2e8f0;
  --border-strong: #cbd5e1;

  --primary: #2563eb;
  --primary-dark: #1d4ed8;
  --primary-soft: #dbeafe;

  --ok: #16a34a;
  --ok-soft: #dcfce7;
  --warn: #f59e0b;           /* ambre/jaune — réservé aux difficultés signalées */
  --warn-soft: #fef3c7;
  --danger: #dc2626;          /* rouge — retards et Critique */
  --danger-soft: #fee2e2;
  /* Palette sémaphore des priorités */
  --prio-critique: #dc2626;   /* rouge vif */
  --prio-critique-soft: #fee2e2;
  --prio-haute: #ea580c;      /* orange */
  --prio-haute-soft: #ffedd5;
  --prio-normale: #2563eb;    /* bleu */
  --prio-normale-soft: #dbeafe;
  --prio-basse: #94a3b8;      /* gris clair */
  --prio-basse-soft: #f1f5f9;
  --crit: #dc2626;            /* alias historique → rouge */
  --crit-soft: #fee2e2;

  --team-prod: #f59e0b;
  --team-prod-soft: #fef3c7;
  --team-dev: #3b82f6;
  --team-dev-soft: #dbeafe;
  --team-imp: #10b981;
  --team-imp-soft: #d1fae5;

  --radius: 14px;
  --radius-sm: 8px;
  --shadow-sm: 0 1px 2px rgba(15,23,42,.06);
  --shadow: 0 1px 3px rgba(15,23,42,.08), 0 4px 12px rgba(15,23,42,.04);
  --shadow-lg: 0 10px 25px rgba(15,23,42,.12), 0 4px 8px rgba(15,23,42,.06);

  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

* { box-sizing: border-box; }
[hidden] { display: none !important; }
html, body { margin: 0; padding: 0; font-family: var(--font); background: var(--bg); color: var(--ink); font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; }
button, input, select, textarea { font: inherit; color: inherit; font-family: var(--font); }

i[data-lucide] { width: 16px; height: 16px; stroke-width: 2; flex-shrink: 0; }

/* ================================================================
   Login
   ================================================================ */
.login-wrap {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 1rem;
  background: linear-gradient(135deg, #1e3a8a 0%, #0f172a 50%, #1e40af 100%);
}
.login-card {
  background: var(--surface);
  border-radius: 20px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
  box-shadow: 0 30px 60px rgba(0,0,0,.3);
}
.login-card h1 { margin: 0 0 .35rem; font-size: 1.7rem; font-weight: 800; }
.subtitle { margin: 0 0 1.75rem; color: var(--muted); font-size: .9rem; }
.login-card label { display: block; margin-bottom: 1rem; font-size: .8rem; font-weight: 500; color: var(--ink-2); }
.login-card input {
  display: block; width: 100%; margin-top: .4rem;
  padding: .8rem .9rem; border: 1.5px solid var(--border);
  border-radius: var(--radius-sm); background: var(--surface-2);
  transition: border-color .15s, box-shadow .15s;
}
.login-card input:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }
.login-card button {
  width: 100%; background: var(--primary); color: white; border: 0;
  padding: .9rem; border-radius: var(--radius-sm); cursor: pointer;
  font-weight: 600; font-size: .95rem;
  transition: background .15s, transform .05s;
}
.login-card button:hover { background: var(--primary-dark); }
.login-card button:active { transform: scale(.98); }
.error { color: var(--danger); font-size: .85rem; min-height: 1.2em; margin: .5rem 0 0; }

/* ================================================================
   Topbar
   ================================================================ */
.topbar {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: .75rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.25rem;
  position: sticky;
  top: 0;
  z-index: 20;
  box-shadow: var(--shadow-sm);
}
.brand {
  font-weight: 800;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink);
  font-size: 1rem;
}
.brand i[data-lucide] { color: var(--primary); width: 22px; height: 22px; }

.tabs {
  display: flex;
  gap: .25rem;
  flex: 1;
  overflow-x: auto;
  scrollbar-width: none;
}
.tabs::-webkit-scrollbar { display: none; }
.tabs button {
  border: 0;
  background: transparent;
  padding: .55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  color: var(--muted);
  white-space: nowrap;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: .4rem;
  transition: all .15s;
}
.tabs button:hover { background: var(--bg); color: var(--ink); }
.tabs button.active { background: var(--ink); color: white; }
.tabs button.active i[data-lucide] { color: white; }

.user-chip {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .9rem;
  font-weight: 500;
}
.user-chip .avatar-mini { width: 32px; height: 32px; border-radius: 50%; display: grid; place-items: center; color: white; font-size: .75rem; font-weight: 700; }
.user-chip button {
  border: 0;
  background: transparent;
  cursor: pointer;
  padding: .4rem;
  border-radius: var(--radius-sm);
  color: var(--muted);
  display: grid;
  place-items: center;
  transition: all .15s;
}
.user-chip button:hover { background: var(--danger-soft); color: var(--danger); }

/* ================================================================
   Layout
   ================================================================ */
main { padding: 1.5rem; max-width: 1500px; margin: 0 auto; }
.view { display: grid; gap: 1.25rem; }
.row { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; }
.flex-1 { flex: 1; }

.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
}
.card h3 {
  margin: 0 0 1.1rem;
  font-size: 1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
  color: var(--ink);
}
.card h3 .h-icon { width: 18px; height: 18px; color: var(--primary); }

/* ================================================================
   Stats
   ================================================================ */
.stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
}
.stat {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1.25rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  background: var(--surface);
}
.stat-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
}
.stat-icon i[data-lucide] { width: 22px; height: 22px; }
.stat-today .stat-icon { background: var(--primary-soft); color: var(--primary); }
.stat-late .stat-icon { background: var(--danger-soft); color: var(--danger); }
.stat-week .stat-icon { background: var(--warn-soft); color: var(--warn); }
.stat-done .stat-icon { background: var(--ok-soft); color: var(--ok); }

.stat-meta { min-width: 0; }
.stat-label {
  color: var(--muted);
  font-size: .72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
}
.stat-value { font-size: 2rem; font-weight: 800; line-height: 1.1; margin-top: .15rem; color: var(--ink); }
.stat-value.ok { color: var(--ok); }
.stat-value.danger { color: var(--danger); }
.stat-sub { color: var(--muted); font-size: .75rem; margin-top: .35rem; font-weight: 500; }
.stat-sub.ok { color: var(--ok); font-weight: 600; }
.stat-sub.danger { color: var(--danger); font-weight: 600; }
.stat-sub.warn { color: var(--warn); font-weight: 600; }

/* ---------- Dashboard sections (Mes tâches / Vue équipe) ---------- */
.dash-section { display: grid; gap: 1.25rem; }
.dash-section + .dash-section {
  margin-top: .5rem;
  padding-top: 1.5rem;
  border-top: 1px dashed var(--border);
}
.dash-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}
.dash-section-title {
  display: flex;
  align-items: center;
  gap: .9rem;
}
.dash-section-title > span,
.dash-section-title .section-icon-bubble {
  flex-shrink: 0;
}
.dash-section-title .section-icon-bubble {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, #dbeafe, #bfdbfe);
  color: var(--primary-dark);
  display: grid;
  place-items: center;
}
.dash-section-title .section-icon-bubble i[data-lucide] { width: 22px; height: 22px; }
.dash-section-title .avatar { width: 44px; height: 44px; font-size: 1rem; border-radius: 12px; }
.dash-section-title h2 {
  margin: 0;
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--ink);
  line-height: 1.2;
}
.dash-section-title p {
  margin: .15rem 0 0;
  font-size: .82rem;
  color: var(--muted);
}

#dash-team .section-icon-bubble {
  background: linear-gradient(135deg, #f3e8ff, #ddd6fe);
  color: #6b21a8;
}

/* Card head (title + inline selector or hint) */
.card-head {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 1rem;
}
.card-head h3 { margin: 0; }
.selector-inline {
  padding: .35rem .7rem;
  font-size: .82rem;
  color: var(--ink-2);
  font-weight: 500;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 7px;
  cursor: pointer;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .55rem center;
  padding-right: 1.8rem;
}
.selector-inline:hover { border-color: var(--border-strong); }

/* Overview (donut + histogram) */
#overview-card .overview-wrap {
  display: grid;
  grid-template-columns: 200px 180px 1fr;
  gap: 2rem;
  align-items: center;
}
@media (max-width: 1000px) {
  #overview-card .overview-wrap { grid-template-columns: 180px 1fr; }
  #donut-legend { grid-column: 2; }
  #sparkline-container { grid-column: 1 / -1; }
}
@media (max-width: 700px) {
  #overview-card .overview-wrap { grid-template-columns: 1fr; }
  #donut-legend { grid-column: 1; }
  #sparkline-container { grid-column: 1; }
}
.donut-wrap { position: relative; width: 170px; height: 170px; margin: 0 auto; }
.donut-center {
  position: absolute; inset: 0;
  display: grid; place-items: center;
  text-align: center;
  pointer-events: none;
}
.donut-total { font-size: 1.8rem; font-weight: 800; color: var(--ink); line-height: 1; }
.donut-label { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; margin-top: .2rem; }

.donut-legend { display: grid; gap: .55rem; align-self: center; }
.donut-legend .legend-item { display: flex; align-items: center; gap: .55rem; font-size: .88rem; }
.legend-dot { width: 12px; height: 12px; border-radius: 3px; flex-shrink: 0; }
.legend-name { color: var(--ink-2); flex: 1; font-weight: 500; }
.legend-val { color: var(--muted); font-weight: 600; font-variant-numeric: tabular-nums; }

.chart-sparkline {
  background: var(--surface-2);
  border-radius: var(--radius-sm);
  padding: 1rem 1.1rem;
  border: 1px solid var(--border);
}
.chart-sparkline .chart-title {
  font-size: .85rem; font-weight: 600; color: var(--ink-2);
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: .6rem;
}
.chart-sparkline .chart-trend {
  background: var(--surface);
  border: 1px solid var(--border);
  padding: .15rem .6rem;
  border-radius: 999px;
  font-size: .75rem;
  font-weight: 700;
}
.chart-sparkline .chart-trend.up { color: var(--ok); border-color: #a7f3d0; background: var(--ok-soft); }
.chart-sparkline .chart-trend.down { color: var(--danger); border-color: #fecaca; background: var(--danger-soft); }
.chart-sparkline .chart-trend.stable { color: var(--muted); }

/* ================================================================
   Toolbar
   ================================================================ */
.toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .6rem;
  background: var(--surface);
  padding: .85rem;
  border-radius: var(--radius);
  border: 1px solid var(--border);
  align-items: center;
  box-shadow: var(--shadow-sm);
}
.toolbar > input, .toolbar > select, .toolbar .search-wrap {
  padding: .55rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  font-size: .88rem;
  transition: border-color .15s, box-shadow .15s;
}
.toolbar select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2.5'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right .6rem center;
  padding-right: 1.8rem;
  cursor: pointer;
}
.toolbar > input:focus, .toolbar select:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); }

.search-wrap {
  display: flex;
  align-items: center;
  gap: .4rem;
  flex: 1;
  min-width: 180px;
  padding: 0 .75rem;
}
.search-wrap i[data-lucide] { color: var(--muted); width: 16px; height: 16px; }
.search-wrap input {
  border: 0;
  background: transparent;
  padding: .55rem 0;
  width: 100%;
  outline: none;
}

.toolbar button {
  padding: .55rem 1rem;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: all .15s;
}
.toolbar button.primary { background: var(--primary); color: white; }
.toolbar button.primary:hover { background: var(--primary-dark); }
.toolbar button.ghost { background: var(--surface-2); color: var(--ink-2); border: 1.5px solid var(--border); }
.toolbar button.ghost:hover { background: var(--bg); border-color: var(--border-strong); }

/* ================================================================
   Task cards
   ================================================================ */
.task-list { display: grid; gap: .6rem; }
.task-list.big { gap: .7rem; }

.task-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 3px solid var(--border);
  border-radius: var(--radius);
  padding: 1rem 1.2rem;
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 1rem;
  align-items: center;
  cursor: pointer;
  transition: all .15s;
}
.task-card:hover {
  box-shadow: var(--shadow);
  transform: translateY(-1px);
  border-color: var(--border-strong);
}
.task-card.prio-critique { border-left-color: var(--prio-critique); }
.task-card.prio-haute { border-left-color: var(--prio-haute); }
.task-card.prio-normale { border-left-color: var(--prio-normale); }
.task-card.prio-basse { border-left-color: var(--prio-basse); }
.task-card.done { opacity: .55; }
.task-card.done .task-title { text-decoration: line-through; }

.task-check {
  width: 24px;
  height: 24px;
  border: 2px solid var(--border-strong);
  border-radius: 50%;
  display: grid;
  place-items: center;
  cursor: pointer;
  flex-shrink: 0;
  transition: all .15s;
  background: var(--surface);
}
.task-check:hover { border-color: var(--primary); background: var(--primary-soft); }
.task-card.done .task-check { background: var(--ok); border-color: var(--ok); color: white; }
.task-card.done .task-check i[data-lucide] { width: 14px; height: 14px; color: white; }

.task-title { font-weight: 600; font-size: .95rem; margin: 0; color: var(--ink); }
.task-meta {
  font-size: .78rem;
  color: var(--muted);
  margin-top: .4rem;
  display: flex;
  gap: .8rem;
  flex-wrap: wrap;
  align-items: center;
}
.task-meta .meta-item {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
}
.task-meta .meta-item i[data-lucide] { width: 13px; height: 13px; }
.task-meta .late { color: var(--danger); font-weight: 600; }

.task-status-label {
  font-size: .75rem;
  font-weight: 600;
  color: var(--muted);
  background: var(--bg);
  padding: .25rem .7rem;
  border-radius: 999px;
}
.task-card.done .task-status-label { background: var(--ok-soft); color: var(--ok); }

/* ================================================================
   Badges — pleins, pas pastel
   ================================================================ */
.badge {
  display: inline-flex;
  align-items: center;
  gap: .3rem;
  padding: .22rem .6rem;
  border-radius: 5px;
  font-size: .68rem;
  font-weight: 600;
  letter-spacing: .02em;
  line-height: 1.3;
  border: 1px solid transparent;
  text-transform: none;
  font-variant: small-caps;
}
.badge i[data-lucide] { width: 11px; height: 11px; }

/* Team badges — pastel cohérents */
.badge.team-production { background: var(--team-prod-soft); color: #92400e; border-color: #fde68a; }
.badge.team-developpement { background: var(--team-dev-soft); color: #1e40af; border-color: #bfdbfe; }
.badge.team-implant { background: var(--team-imp-soft); color: #065f46; border-color: #a7f3d0; }

/* Priority badges — pastel homogène, la hiérarchie passe par la couleur */
.badge.prio-critique { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.badge.prio-haute { background: #fff7ed; color: #c2410c; border-color: #fed7aa; }
.badge.prio-normale { background: var(--prio-normale-soft); color: #1e3a8a; border-color: #bfdbfe; }
.badge.prio-basse { background: var(--prio-basse-soft); color: #475569; border-color: #e2e8f0; }

/* ================================================================
   Avatars
   ================================================================ */
.avatar {
  display: inline-grid;
  place-items: center;
  border-radius: 50%;
  color: white;
  font-weight: 700;
  flex-shrink: 0;
  user-select: none;
  text-transform: uppercase;
}
.avatar-xs { width: 22px; height: 22px; font-size: .65rem; }
.avatar-sm { width: 28px; height: 28px; font-size: .72rem; }
.avatar-md { width: 40px; height: 40px; font-size: .9rem; }
.avatar-lg { width: 56px; height: 56px; font-size: 1.15rem; }

/* ================================================================
   Modale
   ================================================================ */
.modal {
  position: fixed; inset: 0;
  background: rgba(15,23,42,.65);
  backdrop-filter: blur(4px);
  display: grid;
  place-items: center;
  padding: 1rem;
  z-index: 50;
  overflow-y: auto;
  animation: fade-in .15s;
}
@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}
.modal-inner {
  background: var(--surface);
  border-radius: var(--radius);
  width: 100%;
  max-width: 620px;
  padding: 1.8rem;
  position: relative;
  max-height: 92vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  animation: slide-up .2s;
}
@keyframes slide-up {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}
.modal .close {
  position: absolute;
  top: 1rem; right: 1rem;
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--ink-2);
  cursor: pointer;
  width: 38px; height: 38px;
  border-radius: 10px;
  display: grid;
  place-items: center;
  transition: all .15s;
  z-index: 2;
}
.modal .close i[data-lucide] { width: 22px; height: 22px; stroke-width: 2.5; }
.modal .close:hover {
  background: var(--danger);
  color: white;
  border-color: var(--danger);
  transform: rotate(90deg);
}
.modal h2 { margin: 0 0 1.2rem; font-size: 1.25rem; font-weight: 700; }
.modal label {
  display: block;
  margin-bottom: 1rem;
  font-size: .78rem;
  font-weight: 500;
  color: var(--ink-2);
}
.modal input, .modal select, .modal textarea {
  display: block;
  width: 100%;
  margin-top: .35rem;
  padding: .6rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color .15s, box-shadow .15s;
}
.modal input:focus, .modal select:focus, .modal textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
.modal textarea { min-height: 100px; resize: vertical; }
.modal .row2 { display: grid; grid-template-columns: 1fr 1fr; gap: .85rem; }
.modal .actions {
  display: flex;
  gap: .5rem;
  justify-content: flex-end;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border);
}
.modal .actions button {
  padding: .6rem 1.1rem;
  border-radius: var(--radius-sm);
  border: 0;
  cursor: pointer;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: all .15s;
}
.modal .actions .primary { background: var(--primary); color: white; }
.modal .actions .primary:hover { background: var(--primary-dark); }
.modal .actions .danger { background: var(--danger-soft); color: var(--danger); }
.modal .actions .danger:hover { background: #fecaca; }
.modal .actions .ghost { background: transparent; color: var(--muted); }
.modal .actions .ghost:hover { background: var(--bg); color: var(--ink); }

/* ================================================================
   Journal
   ================================================================ */
.journal {
  margin-top: 1.25rem;
  border-top: 1px solid var(--border);
  padding-top: 1.25rem;
}
.journal h4 {
  margin: 0 0 .65rem;
  font-size: .9rem;
  display: flex;
  align-items: center;
  gap: .35rem;
}
.journal-entry {
  background: var(--surface-2);
  padding: .75rem .9rem;
  border-radius: var(--radius-sm);
  margin-bottom: .5rem;
  font-size: .9rem;
  border-left: 3px solid var(--primary);
}
.journal-entry .meta {
  font-size: .7rem;
  color: var(--muted);
  margin-bottom: .3rem;
  display: flex;
  align-items: center;
  gap: .4rem;
}

/* ================================================================
   Bilan
   ================================================================ */
.bilan-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: .85rem;
  margin-bottom: 1.25rem;
}
.bilan-team {
  border-left: 4px solid var(--primary);
  padding-left: 1rem;
  margin-bottom: 1.25rem;
}
.bilan-team.team-production { border-color: var(--team-prod); }
.bilan-team.team-developpement { border-color: var(--team-dev); }
.bilan-team.team-implant { border-color: var(--team-imp); }
.bilan-team strong { font-weight: 700; }

.progress {
  height: 10px;
  background: var(--bg);
  border-radius: 999px;
  overflow: hidden;
  margin: .5rem 0;
  box-shadow: inset 0 1px 2px rgba(0,0,0,.05);
}
.progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--ok), #22c55e);
  transition: width .4s;
  border-radius: 999px;
}

/* ================================================================
   Planning / Gantt
   ================================================================ */
.gantt-grid {
  display: grid;
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  font-size: .8rem;
}
.gantt-grid > div { background: var(--surface); padding: .45rem .35rem; min-height: 36px; }
.gantt-head-label { font-weight: 700; background: var(--surface-2) !important; }
.gantt-day {
  background: var(--surface-2) !important;
  text-align: center;
  font-size: .7rem;
  color: var(--muted);
  line-height: 1.1;
  padding: .3rem 0 !important;
}
.gantt-day.today { background: var(--primary-soft) !important; color: var(--primary-dark); font-weight: 700; }
.gantt-day.weekend { background: var(--bg) !important; }
.gantt-day-num { font-size: .95rem; font-weight: 700; color: var(--ink); }

.gantt-team-row {
  background: var(--bg) !important;
  padding: .55rem .9rem !important;
  border-top: 3px solid var(--border);
  font-size: .85rem;
}
.gantt-team-row.team-production { border-top-color: var(--team-prod); }
.gantt-team-row.team-developpement { border-top-color: var(--team-dev); }
.gantt-team-row.team-implant { border-top-color: var(--team-imp); }

.gantt-person {
  background: var(--surface-2) !important;
  font-weight: 500;
  padding: .35rem .9rem !important;
  font-size: .8rem;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.gantt-cell { position: relative; padding: .2rem !important; min-height: 34px; }
.gantt-cell.today { background: #eff6ff !important; }
.gantt-cell.weekend { background: #fafbfc !important; }

.gantt-dot {
  font-size: .68rem;
  padding: 3px 6px;
  border-radius: 6px;
  color: white;
  background: var(--primary);
  cursor: pointer;
  line-height: 1.2;
  margin-bottom: 3px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,.1);
}
.gantt-dot.prio-critique { background: var(--prio-critique); }
.gantt-dot.prio-haute { background: var(--prio-haute); }
.gantt-dot.prio-normale { background: var(--prio-normale); }
.gantt-dot.prio-basse { background: var(--prio-basse); }
.gantt-dot.done { background: var(--ok) !important; text-decoration: line-through; opacity: .7; }
.gantt-dot.late { box-shadow: 0 0 0 2px var(--danger), 0 1px 2px rgba(0,0,0,.1); }

.gantt-legend {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: .85rem;
  font-size: .75rem;
  color: var(--muted);
}
.gantt-legend .swatch {
  display: inline-block;
  width: 14px; height: 14px;
  border-radius: 4px;
  vertical-align: middle;
  margin-right: 4px;
}
.gantt-legend .swatch.prio-critique { background: var(--prio-critique); }
.gantt-legend .swatch.prio-haute { background: var(--prio-haute); }
.gantt-legend .swatch.prio-normale { background: var(--prio-normale); }
.gantt-legend .swatch.prio-basse { background: var(--prio-basse); }
.gantt-legend .swatch.done { background: var(--ok); }
.gantt-legend .swatch.late { background: white; border: 2px solid var(--danger); }

/* ---------- Jours fériés ---------- */
.gantt-day.holiday, .gantt-cell.holiday,
.week-day-head.holiday, .week-cell.holiday {
  background: repeating-linear-gradient(45deg, rgba(217, 119, 6, .08), rgba(217, 119, 6, .08) 8px, rgba(255, 255, 255, .6) 8px, rgba(255, 255, 255, .6) 16px) !important;
  color: #92400e;
}
.gantt-day.holiday .gantt-day-num,
.week-day-head.holiday .week-day-num { color: #92400e; }
.gantt-day.holiday .gantt-day-mon,
.week-day-head.holiday .week-day-name { color: #92400e; font-weight: 700; font-size: .65rem; }

.holiday-banner {
  background: linear-gradient(90deg, #fef3c7 0%, #fefce8 100%);
  border-left: 4px solid var(--warn);
  padding: .9rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  display: flex;
  align-items: center;
  gap: .75rem;
  color: #92400e;
}
.holiday-banner i[data-lucide] { color: var(--warn); width: 22px; height: 22px; flex-shrink: 0; }
.holiday-banner strong { color: #92400e; display: block; font-size: .95rem; }

/* ---------- Planning — vue Jour ---------- */
.day-view { display: grid; gap: 1rem; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); }
.day-view-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
  grid-column: 1 / -1;
}
.day-view-head h2 { margin: 0; font-size: 1.3rem; font-weight: 700; text-transform: capitalize; }
.day-view-head .day-count { font-size: .85rem; color: var(--muted); }

.day-team {
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 5px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  min-height: 100px;
}
.day-team.team-production { border-left-color: var(--team-prod); }
.day-team.team-developpement { border-left-color: var(--team-dev); }
.day-team.team-implant { border-left-color: var(--team-imp); }
.day-team h4 {
  margin: 0 0 .85rem;
  font-size: .95rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.day-team .day-person-block { margin-bottom: .85rem; }
.day-team .day-person-head {
  display: flex;
  align-items: center;
  gap: .5rem;
  font-size: .85rem;
  font-weight: 600;
  color: var(--ink-2);
  margin-bottom: .45rem;
}
.day-team .day-person-tasks {
  display: grid;
  gap: .4rem;
  padding-left: .5rem;
  border-left: 2px solid var(--border);
  margin-left: .6rem;
}
.day-task {
  padding: .55rem .75rem;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border-left: 3px solid var(--border);
  cursor: pointer;
  transition: all .15s;
  font-size: .88rem;
}
.day-task:hover { background: var(--bg); transform: translateX(3px); }
.day-task.prio-critique { border-left-color: var(--prio-critique); }
.day-task.prio-haute { border-left-color: var(--prio-haute); }
.day-task.prio-normale { border-left-color: var(--prio-normale); }
.day-task.prio-basse { border-left-color: var(--prio-basse); }
.day-task.done { opacity: .55; text-decoration: line-through; }
.day-task-title { font-weight: 600; }
.day-task-meta {
  display: flex;
  gap: .5rem;
  margin-top: .25rem;
  font-size: .75rem;
  color: var(--muted);
  align-items: center;
  flex-wrap: wrap;
}

/* ---------- Planning — vue Semaine (enrichie) ---------- */
.week-view {
  display: grid;
  grid-template-columns: 180px repeat(7, 1fr);
  gap: 1px;
  background: var(--border);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  overflow-x: auto;
  min-width: 900px;
}
.week-view > div { background: var(--surface); padding: .6rem .5rem; min-height: 60px; }
.week-head-label { font-weight: 700; background: var(--surface-2) !important; padding: .8rem !important; display: flex; align-items: center; }
.week-day-head {
  background: var(--surface-2) !important;
  padding: .8rem !important;
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: .1rem;
}
.week-day-head.today { background: var(--primary-soft) !important; }
.week-day-head.weekend { background: var(--bg) !important; }
.week-day-name { font-size: .7rem; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; font-weight: 600; }
.week-day-num { font-size: 1.5rem; font-weight: 700; color: var(--ink); }
.week-day-head.today .week-day-num { color: var(--primary-dark); }

.week-team-row { grid-column: 1 / -1; background: var(--bg) !important; padding: .45rem .8rem !important; font-weight: 700; border-top: 2px solid var(--border); font-size: .82rem; }
.week-team-row.team-production { border-top-color: var(--team-prod); }
.week-team-row.team-developpement { border-top-color: var(--team-dev); }
.week-team-row.team-implant { border-top-color: var(--team-imp); }

.week-person-cell {
  background: var(--surface-2) !important;
  padding: .6rem .7rem !important;
  font-size: .85rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.week-cell { background: var(--surface); padding: .4rem !important; display: flex; flex-direction: column; gap: .3rem; }
.week-cell.today { background: #eff6ff !important; }
.week-cell.weekend { background: #fafbfc !important; }

.week-task {
  padding: .35rem .55rem;
  border-radius: 5px;
  background: var(--primary);
  color: white;
  font-size: .72rem;
  font-weight: 600;
  cursor: pointer;
  line-height: 1.25;
  box-shadow: 0 1px 2px rgba(0,0,0,.15);
  transition: transform .1s;
}
.week-task:hover { transform: translateY(-1px); box-shadow: 0 2px 4px rgba(0,0,0,.2); }
.week-task.prio-critique { background: var(--prio-critique); }
.week-task.prio-haute { background: var(--prio-haute); }
.week-task.prio-normale { background: var(--prio-normale); }
.week-task.prio-basse { background: var(--prio-basse); }
.week-task.done { background: var(--ok) !important; text-decoration: line-through; opacity: .75; }
.week-task.at-risk { box-shadow: 0 0 0 2px var(--danger), 0 1px 2px rgba(0,0,0,.15); }

/* ================================================================
   Équipe — grille collaborateurs
   ================================================================ */
.users-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: .85rem;
}
.user-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: all .15s;
  position: relative;
}
.user-card:hover { box-shadow: var(--shadow); border-color: var(--border-strong); }
.user-card-info { flex: 1; min-width: 0; }
.user-card-name {
  font-weight: 700;
  color: var(--ink);
  font-size: .95rem;
  margin-bottom: .15rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.user-card-email {
  font-size: .8rem;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: .45rem;
}
.user-card-tags {
  display: flex;
  gap: .35rem;
  flex-wrap: wrap;
}
.user-card-actions {
  display: flex;
  gap: .15rem;
  flex-shrink: 0;
}
.user-card-actions button {
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  padding: .5rem;
  border-radius: var(--radius-sm);
  display: grid;
  place-items: center;
  transition: all .15s;
}
.user-card-actions button:hover { background: var(--bg); color: var(--ink); }
.user-card-actions button.danger:hover { background: var(--danger-soft); color: var(--danger); }

.role-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .15rem .5rem;
  border-radius: 5px;
  font-size: .65rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.role-badge.manager { background: #fef3c7; color: #92400e; border: 1px solid #fde68a; }
.role-badge.member { background: #e0e7ff; color: #3730a3; border: 1px solid #c7d2fe; }
.role-badge i[data-lucide] { width: 10px; height: 10px; }

/* ================================================================
   Alertes de difficulté
   ================================================================ */
.chk-risk {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  padding: .55rem .75rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  cursor: pointer;
  font-size: .85rem;
  user-select: none;
  transition: all .15s;
}
.chk-risk:hover { border-color: var(--danger); }
.chk-risk input { margin: 0; accent-color: var(--danger); }
.chk-risk i[data-lucide] { color: var(--danger); }

.task-card.at-risk {
  background: linear-gradient(135deg, rgba(217, 119, 6, .06) 0%, var(--surface) 40%);
}

.risk-badge {
  display: inline-flex;
  align-items: center;
  gap: .25rem;
  padding: .18rem .55rem;
  background: var(--warn-soft);
  color: #92400e;
  font-size: .68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .04em;
  border-radius: 6px;
  border: 1px solid #fcd34d;
}
.risk-badge i[data-lucide] { width: 11px; height: 11px; }

.count-badge {
  display: inline-block;
  background: var(--warn);
  color: white;
  padding: .1rem .55rem;
  border-radius: 999px;
  font-size: .72rem;
  font-weight: 700;
  margin-left: .4rem;
  min-width: 22px;
  text-align: center;
}

.risk-banner {
  background: linear-gradient(90deg, #fef3c7 0%, #fefce8 100%);
  border-left: 4px solid var(--warn);
  padding: .9rem 1.1rem;
  border-radius: var(--radius-sm);
  margin-bottom: 1rem;
  display: flex;
  align-items: flex-start;
  gap: .7rem;
}
.risk-banner i[data-lucide] { color: var(--warn); width: 20px; height: 20px; flex-shrink: 0; margin-top: 2px; }
.risk-banner .risk-body { flex: 1; }
.risk-banner .risk-title { font-weight: 700; color: #92400e; margin-bottom: .25rem; display: flex; align-items: center; gap: .35rem; font-size: .9rem; }
.risk-banner .risk-reason { color: #78350f; font-size: .9rem; line-height: 1.5; }
.risk-banner .risk-meta { color: #92400e; font-size: .75rem; margin-top: .35rem; opacity: .7; }

.btn-risk {
  background: var(--warn-soft);
  color: #92400e;
  border: 1.5px solid #fde68a;
  padding: .55rem 1rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  font-weight: 600;
  font-size: .88rem;
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  transition: all .15s;
}
.btn-risk:hover { background: #fde68a; border-color: var(--warn); }
.btn-risk.resolve { background: var(--ok-soft); color: var(--ok); border-color: #a7f3d0; }
.btn-risk.resolve:hover { background: #bbf7d0; border-color: var(--ok); }

/* ================================================================
   Rapports (Chantier B)
   ================================================================ */
.seg {
  display: inline-flex;
  gap: 2px;
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 3px;
  border: 1.5px solid var(--border);
}
.seg button {
  padding: .45rem .9rem !important;
  border: 0;
  background: transparent;
  color: var(--muted);
  cursor: pointer;
  font-weight: 600;
  font-size: .85rem;
  border-radius: 6px;
  display: inline-flex;
  align-items: center;
  gap: .35rem;
  transition: all .15s;
}
.seg button.active {
  background: var(--surface);
  color: var(--ink);
  box-shadow: var(--shadow-sm);
}
.seg button i[data-lucide] { width: 14px; height: 14px; }

.custom-range {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: .85rem;
  color: var(--muted);
}
.custom-range input {
  padding: .45rem .6rem;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--surface-2);
}

.report-header {
  background: linear-gradient(135deg, var(--primary) 0%, #1e40af 100%);
  color: white;
  padding: 2rem;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
  display: flex;
  align-items: center;
  gap: 1.5rem;
  box-shadow: var(--shadow);
}
.report-header .avatar { border: 3px solid rgba(255,255,255,.3); }
.report-header-info h2 { margin: 0; font-size: 1.6rem; font-weight: 800; }
.report-header-info .subtitle { margin: .3rem 0 0; font-size: .95rem; color: rgba(255,255,255,.85); }
.report-period {
  margin-left: auto;
  background: rgba(255,255,255,.15);
  padding: .5rem 1rem;
  border-radius: 8px;
  font-size: .85rem;
  font-weight: 600;
}

.report-kpis {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: .85rem;
  margin-bottom: 1.25rem;
}
.kpi {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 1.1rem;
  text-align: center;
}
.kpi-label {
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .05em;
  font-weight: 600;
}
.kpi-value {
  font-size: 1.7rem;
  font-weight: 800;
  margin-top: .2rem;
  color: var(--ink);
  line-height: 1.1;
}
.kpi-value.ok { color: var(--ok); }
.kpi-value.warn { color: var(--warn); }
.kpi-value.danger { color: var(--danger); }

.hbar-chart {
  display: grid;
  gap: .5rem;
  margin-top: .75rem;
}
.hbar-row {
  display: grid;
  grid-template-columns: 130px 1fr 40px;
  gap: .75rem;
  align-items: center;
  font-size: .85rem;
}
.hbar-label { color: var(--muted); font-weight: 500; }
.hbar-track {
  background: var(--bg);
  height: 22px;
  border-radius: 6px;
  overflow: hidden;
  position: relative;
}
.hbar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #60a5fa);
  border-radius: 6px;
  transition: width .4s;
}
.hbar-fill.critique { background: linear-gradient(90deg, var(--prio-critique), #ef4444); }
.hbar-fill.haute { background: linear-gradient(90deg, var(--prio-haute), #fb923c); }
.hbar-fill.normale { background: linear-gradient(90deg, var(--prio-normale), #60a5fa); }
.hbar-fill.basse { background: linear-gradient(90deg, var(--prio-basse), #cbd5e1); }
.hbar-val { font-weight: 700; color: var(--ink); text-align: right; }

.members-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: .75rem;
}
.members-table th, .members-table td {
  padding: .7rem .85rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}
.members-table th {
  background: var(--surface-2);
  font-size: .72rem;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: .04em;
  font-weight: 700;
}
.members-table td { font-size: .88rem; }
.members-table td.num { text-align: center; font-weight: 700; }
.members-table .member-cell { display: flex; align-items: center; gap: .6rem; }

/* ================================================================
   Print styles — pour export PDF
   ================================================================ */
@media print {
  body { background: white; font-size: 11pt; }
  .topbar, .no-print, .manager-only.topbar, .tabs, .user-chip,
  #login, .modal, .toasts, footer { display: none !important; }
  main { padding: 0; max-width: 100%; }
  .view { display: block !important; }
  .view:not(#view-rapports) { display: none !important; }
  .card { box-shadow: none; border: 1px solid #ccc; break-inside: avoid; page-break-inside: avoid; }
  .report-header { background: #1e40af !important; -webkit-print-color-adjust: exact; print-color-adjust: exact; }
  .kpi, .hbar-fill, .badge, .avatar, .role-badge {
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
  .task-card { break-inside: avoid; }
  h3, .report-header { page-break-after: avoid; }
}

/* ================================================================
   Toasts
   ================================================================ */
.toasts {
  position: fixed;
  bottom: 1.25rem;
  right: 1.25rem;
  z-index: 60;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  pointer-events: none;
}
.toast {
  background: var(--ink);
  color: white;
  padding: .85rem 1.25rem;
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  font-size: .9rem;
  min-width: 240px;
  max-width: 400px;
  font-weight: 500;
  animation: toast-in .25s ease-out;
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: .5rem;
}
.toast.success { background: var(--ok); }
.toast.error { background: var(--danger); }
.toast.info { background: var(--primary); }
@keyframes toast-in {
  from { opacity: 0; transform: translateY(12px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ================================================================
   Hints & code
   ================================================================ */
code {
  background: var(--surface-2);
  padding: .25rem .5rem;
  border-radius: 5px;
  font-size: .85rem;
  word-break: break-all;
  display: inline-block;
  max-width: 100%;
  border: 1px solid var(--border);
  font-family: 'Menlo', 'Consolas', monospace;
}
.hint { color: var(--muted); font-size: .85rem; margin: .4rem 0 0; }

/* ================================================================
   Mobile
   ================================================================ */
@media (max-width: 768px) {
  main { padding: 1rem; }
  .topbar { flex-wrap: wrap; padding: .6rem .85rem; gap: .6rem; }
  .tabs { order: 3; width: 100%; }
  .tabs button { padding: .5rem .7rem; font-size: .85rem; }
  .tabs button i[data-lucide] { display: none; }
  .user-chip { margin-left: auto; }
  .user-chip #user-name { display: none; }
  .task-card { padding: .8rem 1rem; gap: .75rem; }
  .stat-value { font-size: 1.5rem; }
  .modal-inner { padding: 1.25rem; }
  .modal .row2 { grid-template-columns: 1fr; }
  .users-grid { grid-template-columns: 1fr; }
}

.manager-only { display: none; }
body.is-manager .manager-only { display: inherit; }
body.is-manager button.manager-only,
body.is-manager .tabs button.manager-only { display: inline-flex; }
