/* LIAMM — fond blanc, menu rouge #c00e5e, boutons rouges, vert pour ce qui est validé. */

/* Police : Plus Jakarta Sans si static/css/polices.css existe (créé par scripts/polices.sh),
   sinon la police du système. */

:root {
  --ink: #111827;
  --ink-2: #374151;
  --muted: #5b6472;
  --line: #e6e9ef;
  --line-2: #eef0f4;
  --field: #d5dae2;
  --bg: #ffffff;
  --bg-soft: #f6f7f9;
  --bg-head: #f8f9fb;
  /* Couleur de la marque (menu, boutons, liens) : rouge */
  --brand: #c00e5e;
  --brand-dark: #9a0b4b;
  /* Côté X43C (timeline, compteurs) : bleu */
  --x43c: #2b51ba;
  --x43c-bg: #eaf0fc;
  --x43c-ink: #2b51ba;
  /* Côté client : orange */
  --client: #ea6a12;
  --client-bg: #fff1e6;
  --client-ink: #b4480c;
  --client-line: #f4c7a5;
  /* Validé / terminé : vert franc */
  --validated: #4e9a1f;
  --validated-bg: #eaf5e0;
  --done: #4e9a1f;
  --done-bg: #eaf5e0;
  --done-ink: #2f6b0f;
  /* Étape en cours sur la timeline (clignote) */
  --pulse: #cbd5e1;
  --pulse-bg: #eef1f5;
  --todo: #d5dae2;
  --track: #e3e7ed;
  --neutral-bg: #f1f3f6;
  --danger: #b91c1c;
  --danger-bg: #fdecec;
  --danger-line: #f3c4c4;
  --radius: 14px;
  --radius-sm: 10px;
  --sidebar: 248px;
  /* Menu latéral : fond rouge, menus en gris très clair */
  --side-bg: #c00e5e;
  --side-ink: #f1f3f6;
  /* Pictos des compteurs : gris clair */
  --icon-bg: #f1f3f6;
  --side-icon: #4b5563;
  /* Date en retard */
  --late: #c00e5e;
}

* { box-sizing: border-box; }
html, body { margin: 0; }
body {
  background: var(--bg);
  color: var(--ink);
  font: 15px/1.55 "Plus Jakarta Sans", -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; }
h1 { font-size: 28px; line-height: 1.2; margin: 0; font-weight: 800; letter-spacing: -0.02em; }
h2 { font-size: 16px; margin: 0 0 14px; font-weight: 800; }
p { margin: 0 0 10px; }
svg { flex: none; }
.muted { color: var(--muted); }
.strong { font-weight: 700; text-decoration: none; }
.right { text-align: right; }
.req { color: var(--danger); }
:focus-visible { outline: 3px solid rgba(192, 14, 94, 0.35); outline-offset: 2px; }

/* Structure : menu rouge à gauche, contenu à droite */
.app { display: flex; min-height: 100vh; }
.sidebar {
  width: var(--sidebar); flex: none; background: var(--side-bg); color: var(--side-ink); border-right: 0;
  display: flex; flex-direction: column; gap: 4px; padding: 24px 16px;
  position: sticky; top: 0; height: 100vh; overflow-y: auto;
}
.app:has(> main.auth-page) .sidebar { display: none; }
.app > main { flex: 1; min-width: 0; }
.brand { display: flex; align-items: center; gap: 12px; padding: 4px 8px 28px; text-decoration: none; color: #fff; }
.brand img { width: 38px; height: 38px; display: block; }
.brand-text { display: flex; flex-direction: column; line-height: 1.1; }
.brand-mark { font-size: 19px; font-weight: 800; letter-spacing: 0.03em; }
.brand-name { font-size: 13px; font-weight: 500; color: rgba(255, 255, 255, 0.78); }
.nav { display: flex; flex-direction: column; gap: 4px; }
.nav a {
  display: flex; align-items: center; gap: 12px; padding: 11px 12px; border-radius: var(--radius-sm);
  color: var(--side-ink); text-decoration: none; font-size: 14px; font-weight: 500;
}
.nav a:hover { background: rgba(255, 255, 255, 0.14); color: #fff; }
.nav a.active { background: var(--icon-bg); color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }
.nav a.active svg { color: var(--brand); }
.nav svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.nav-count { margin-left: auto; font-size: 12px; font-weight: 800; background: #fff; color: var(--brand); padding: 1px 8px; border-radius: 99px; }
.nav a.active .nav-count { background: var(--brand); color: #fff; }
/* Bloc utilisateur en bas du menu : intégré au rouge, déconnexion en icône */
.usermenu {
  margin-top: auto; display: flex; flex-direction: row; align-items: center; gap: 8px;
  padding: 14px 6px 2px; border-top: 1px solid rgba(255, 255, 255, 0.22); background: none; border-radius: 0;
}
.user-chip { flex: 1; display: flex; align-items: center; gap: 11px; text-decoration: none; color: #fff; min-width: 0; padding: 6px; border-radius: var(--radius-sm); }
.user-chip:hover { background: rgba(255, 255, 255, 0.12); }
.user-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.user-name { font-size: 14px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-role { font-size: 12px; color: rgba(255, 255, 255, 0.75); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.avatar.avatar-user { width: 36px; height: 36px; background: #fff; color: var(--brand); font-size: 13px; }
.logout-form { margin: 0; display: flex; }
.logout {
  width: 36px; height: 36px; flex: none; display: flex; align-items: center; justify-content: center;
  background: none; border: 0; border-radius: var(--radius-sm); color: rgba(255, 255, 255, 0.85); cursor: pointer; padding: 0;
}
.logout:hover { background: rgba(255, 255, 255, 0.16); color: #fff; }
.logout svg { width: 19px; height: 19px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.avatar {
  width: 30px; height: 30px; border-radius: 50%; background: var(--neutral-bg); color: var(--ink-2);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11.5px; font-weight: 800; flex: none;
}
.avatar-light { width: 36px; height: 36px; background: var(--x43c-bg); color: var(--brand); font-size: 13px; }
.avatar-x43c { background: var(--x43c-bg); color: var(--x43c-ink); }
.avatar-client { background: var(--client-bg); color: var(--client-ink); }
.avatar-sm { width: 26px; height: 26px; font-size: 10.5px; }

/* Mise en page */
/* Le contenu occupe toute la largeur disponible (grands écrans compris). */
.container { width: 100%; max-width: none; padding: 36px 44px 64px; }
@media (min-width: 1800px) { .container { padding-left: 56px; padding-right: 56px; } }
.page-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 16px; margin-bottom: 24px; }
.page-head p { margin: 6px 0 0; }
.eyebrow { margin: 0 0 6px; font-size: 13px; color: var(--muted); }
.eyebrow a { text-decoration: none; color: var(--brand); font-weight: 700; }
.back { display: inline-flex; align-items: center; gap: 6px; color: var(--brand); text-decoration: none; font-size: 13.5px; font-weight: 700; margin-bottom: 16px; }
.back:hover { color: var(--brand-dark); }
.card { background: var(--bg); border: 1px solid var(--line); border-radius: var(--radius); padding: 22px 24px; margin-bottom: 20px; }
.card.narrow { max-width: 640px; }
.card-head { display: flex; justify-content: space-between; align-items: baseline; gap: 12px; }
.detail-grid { display: grid; grid-template-columns: minmax(0, 1fr) clamp(340px, 26vw, 480px); gap: 24px; align-items: start; }
.detail-side { position: sticky; top: 24px; }
aside.detail-side:not(.card) { position: static; }
.stack > * + * { margin-top: 12px; }
.actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

/* Boutons et liens */
.button {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: 42px;
  padding: 8px 18px; border: 1px solid var(--field); border-radius: var(--radius-sm); background: var(--bg);
  color: var(--ink); font: inherit; font-weight: 700; font-size: 14px; text-decoration: none; cursor: pointer; white-space: nowrap;
}
.button:hover { background: var(--bg-soft); }
.button.primary { background: var(--brand); border-color: var(--brand); color: #fff; }
.button.primary:hover { background: var(--brand-dark); border-color: var(--brand-dark); }
.button.success { background: var(--validated); border-color: var(--validated); color: #fff; }
.button.success:hover { filter: brightness(0.92); }
.button.wide { width: 100%; }
.button.small { min-height: 34px; padding: 5px 12px; font-size: 13px; }
.button svg { width: 18px; height: 18px; fill: none; stroke: currentColor; stroke-width: 2.4; stroke-linecap: round; stroke-linejoin: round; }
.link { color: var(--brand); font-size: 14px; font-weight: 600; }
.link:hover { color: var(--brand-dark); }
.link-button { background: none; border: 0; padding: 0; font: inherit; font-size: 14px; color: var(--muted); cursor: pointer; text-decoration: underline; }
.link-button:hover { color: var(--ink); }
form.inline { display: inline; margin-left: 10px; }

/* Formulaires */
.field label { display: block; font-size: 13px; font-weight: 700; color: var(--ink-2); margin-bottom: 6px; }
.field-check label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; }
input[type=text], input[type=email], input[type=password], input[type=search], input[type=date], input[type=number], select, textarea {
  width: 100%; min-height: 42px; padding: 9px 12px; border: 1px solid var(--field); border-radius: var(--radius-sm); background: var(--bg);
  font: inherit; font-size: 14px; color: var(--ink);
}
input:focus, select:focus, textarea:focus { outline: none; border-color: var(--brand); box-shadow: 0 0 0 3px rgba(192, 14, 94, 0.15); }
input[type=checkbox] { width: 16px; height: 16px; accent-color: var(--brand); }
textarea { resize: vertical; }
.help { font-size: 13px; color: var(--muted); margin: 6px 0 0; }
.error { font-size: 13px; color: var(--danger); margin: 6px 0 0; }
.has-error input, .has-error select, .has-error textarea { border-color: var(--danger); }
.field > div > div label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; margin: 6px 0; }
.field ul { list-style: none; padding: 0; margin: 0; }
.field ul li { margin: 4px 0; }
.field ul li label { display: flex; align-items: center; gap: 8px; font-weight: 500; font-size: 14px; margin: 0; }
.settings-form h2 { margin-top: 24px; }
.settings-form h2:first-of-type { margin-top: 0; }

/* Messages */
.messages { margin-bottom: 20px; }
.message { padding: 12px 16px; border-radius: var(--radius-sm); margin-bottom: 8px; font-size: 14px; font-weight: 600; border: 1px solid var(--line); background: var(--bg-soft); }
.message-success { background: var(--done-bg); border-color: #c9e6b0; color: var(--done-ink); }
.message-error { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger); }
.message-warning { background: var(--client-bg); border-color: var(--client-line); color: var(--client-ink); }

/* Statuts : pastille avec un point de couleur (bleu X43C, orange client, vert terminé) */
.pill {
  display: inline-flex; align-items: center; gap: 7px; padding: 4px 11px; border-radius: 999px;
  font-size: 12.5px; font-weight: 700; white-space: nowrap; background: var(--neutral-bg); color: #4b5563;
}
.pill::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: #9ca3af; flex: none; }
.pill-x43c { background: var(--x43c-bg); color: var(--x43c-ink); }
.pill-x43c::before { background: var(--x43c); }
.pill-client { background: var(--client-bg); color: var(--client-ink); }
.pill-client::before { background: var(--client); }
.pill-fini { background: var(--done-bg); color: var(--done-ink); }
.pill-fini::before { background: var(--validated); }
.pill-annule { background: var(--danger-bg); color: var(--danger); }
.pill-annule::before { background: var(--danger); }
.chip { display: inline-flex; align-items: center; padding: 4px 11px; border-radius: 999px; font-size: 12.5px; font-weight: 700; background: var(--neutral-bg); color: var(--ink-2); white-space: nowrap; }
.chip-danger { background: var(--danger-bg); color: var(--danger); }
.chip-late { background: #fbe7f0; color: var(--late); }
/* Priorité */
/* Priorités : P1 rouge (texte blanc), P2 et P3 gris */
.prio-haute { background: #c00e5e; color: #fff; }
.prio-normale, .prio-basse { background: var(--neutral-bg); color: var(--ink-2); }
/* Choix Oui / Non */
.yesno { display: inline-flex; gap: 4px; padding: 3px; background: #f2f4f7; border-radius: 8px; }
.yesno button { min-height: 30px; padding: 0 12px; border: 0; border-radius: 6px; background: transparent; font: inherit; font-size: 13px; font-weight: 600; color: #4b5563; cursor: pointer; }
.yesno button.active { background: #fff; color: var(--ink); font-weight: 800; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }
.owner { color: var(--ink-2); font-weight: 600; }
.task-person-name { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.tag { display: inline-block; font-size: 12px; font-weight: 600; padding: 1px 8px; border-radius: 6px; background: var(--client-bg); color: var(--client-ink); }
.banner { padding: 14px 18px; border-radius: var(--radius); margin-bottom: 20px; font-weight: 700; font-size: 14px; border: 1px solid transparent; }
.banner-x43c, .banner-neutre { background: var(--x43c-bg); color: var(--x43c-ink); }
.banner-client { background: var(--client-bg); color: var(--client-ink); border-color: var(--client-line); }
.banner-annule { background: var(--danger-bg); color: var(--danger); }
.banner-signal { background: var(--validated-bg); color: var(--done-ink); }
.tag-signal { background: var(--validated-bg); color: var(--done-ink); }

/* Compteurs en haut de la liste */
.stats { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat { display: flex; align-items: center; gap: 16px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); }
.stat-icon { width: 44px; height: 44px; border-radius: 12px; display: flex; align-items: center; justify-content: center; flex: none; }
.stat-icon svg { width: 22px; height: 22px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
/* Pictos : horloge sur fond gris (comme le menu) ; vert pour les tâches terminées */
.stat-icon { background: var(--icon-bg); color: var(--side-icon); }
.stat-done .stat-icon { background: var(--validated); color: #fff; }
.stat-body { display: flex; flex-direction: column; }
.stat-value { font-size: 28px; font-weight: 800; line-height: 1.1; }
.stat-label { font-size: 13px; color: var(--muted); }

/* Onglets et filtres */
.tabs { display: inline-flex; gap: 4px; padding: 4px; background: #f2f4f7; border-radius: var(--radius-sm); }
.tabs a { display: flex; align-items: center; min-height: 34px; padding: 0 14px; text-decoration: none; color: #4b5563; font-weight: 600; font-size: 13px; border-radius: 8px; }
.tabs a:hover { color: var(--ink); }
.tabs a.active { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }
.filters { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; margin-bottom: 20px; }
.filters input[type=search] { flex: 1 1 240px; width: auto; }
.filters select { width: auto; flex: 0 1 auto; }
/* Filtre à choix multiples (labels) */
.multi-select { position: relative; }
.multi-select summary {
  list-style: none; cursor: pointer; min-height: 42px; display: flex; align-items: center; gap: 8px;
  padding: 9px 34px 9px 12px; border: 1px solid var(--field); border-radius: var(--radius-sm); background: #fff; font-size: 14px; white-space: nowrap;
}
.multi-select summary::-webkit-details-marker { display: none; }
.multi-select summary::after { content: ""; position: absolute; right: 14px; top: 17px; width: 7px; height: 7px; border: solid var(--muted); border-width: 0 2px 2px 0; transform: rotate(45deg); }
.multi-select[open] summary { border-color: var(--brand); }
.multi-select-panel {
  position: absolute; z-index: 20; top: calc(100% + 6px); left: 0; min-width: 240px; max-height: 360px; overflow-y: auto;
  padding: 10px 12px; background: #fff; border: 1px solid var(--line); border-radius: var(--radius-sm); box-shadow: 0 10px 30px rgba(17, 24, 39, 0.12);
}
.multi-option { display: flex; align-items: center; gap: 8px; padding: 5px 0; font-size: 14px; cursor: pointer; }
.multi-group { margin: 8px 0 2px; font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.multi-group:first-child { margin-top: 0; }
.multi-select-panel .button { margin-top: 10px; width: 100%; }

/* Choix d'affichage Liste / Timeline */
.tabs-row { display: flex; justify-content: space-between; align-items: center; gap: 12px; margin-bottom: 16px; flex-wrap: wrap; }
.segmented { display: inline-flex; gap: 4px; padding: 4px; background: #f2f4f7; border-radius: var(--radius-sm); }
.segmented a { display: flex; align-items: center; min-height: 34px; padding: 0 14px; text-decoration: none; font-size: 13px; font-weight: 600; color: #4b5563; border-radius: 8px; }
.segmented a.active { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }

/* Vue Timeline : une carte par tâche, sur deux colonnes */
.task-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: 16px; }
.task-card { display: flex; flex-direction: column; gap: 18px; border: 1px solid var(--line); border-radius: var(--radius); padding: 18px 20px 16px; text-decoration: none; transition: border-color 0.15s, box-shadow 0.15s; }
.task-card:hover { border-color: #c9d3ea; box-shadow: 0 4px 16px rgba(43, 81, 186, 0.08); }
.task-card.needs-me { border-color: #c9d3ea; }
.task-card-head { display: flex; justify-content: space-between; gap: 12px; align-items: flex-start; font-size: 14px; }
.task-card-meta { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; justify-content: flex-end; font-size: 12.5px; flex: none; max-width: 55%; }
.task-card .task-title { white-space: normal; font-size: 15px; }
.timeline-compact .step::before { top: 10px; height: 3px; }
.timeline-compact .step .dot { width: 22px; height: 22px; border-width: 2px; margin-bottom: 7px; }
.timeline-compact .step-reached .dot::after { width: 5px; height: 9px; border-width: 0 2.5px 2.5px 0; }
.timeline-compact .step-current .dot { width: 22px; height: 22px; margin-top: 0; margin-bottom: 7px; }
.timeline-compact .step-label { font-size: 11.5px; font-weight: 500; line-height: 1.25; }
.timeline-compact .step-current .step-label { font-weight: 700; }
.timeline-compact .step-date { font-size: 11px; margin-top: 2px; }
.timeline-compact .step-current .step-date { color: var(--ink); font-weight: 700; }
.timeline-compact .step-current .step-date.overdue { color: var(--late); }

/* Label et progression */
.label-tag { display: inline-block; font-size: 11.5px; font-weight: 700; padding: 1px 8px; border-radius: 6px; background: var(--neutral-bg); color: var(--ink-2); margin-right: 6px; vertical-align: 1px; }
/* Barre de progression : le pourcentage à gauche, la barre à droite */
.progress { display: inline-flex; align-items: center; gap: 8px; }
.progress-value { min-width: 38px; text-align: right; font-size: 12.5px; font-weight: 800; color: var(--ink-2); font-variant-numeric: tabular-nums; }
.progress-track { display: block; width: 110px; height: 10px; border-radius: 999px; background: var(--line-2); overflow: hidden; }
.progress-fill { display: block; height: 100%; background: var(--validated); border-radius: 999px; }
.progress-compact { gap: 6px; }
.progress-compact .progress-value { min-width: 32px; font-size: 11px; }
.progress-compact .progress-track { width: 80px; height: 8px; }
.status-cell { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.progress-big { display: flex; flex-direction: column; gap: 14px; }
.progress-big .progress { display: flex; }
.progress-big .progress-track { flex: 1; width: auto; height: 14px; }
.progress-big .progress-value { font-size: 18px; min-width: 52px; text-align: left; color: var(--validated); }
.progress-form { display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 6px; margin: 0; }
.progress-form button {
  min-height: 36px; border: 1px solid var(--field); border-radius: 8px; background: #fff;
  font: inherit; font-size: 13px; font-weight: 600; color: var(--ink-2); cursor: pointer;
}
.progress-form button:hover { border-color: var(--validated); }
.progress-form button.active { background: var(--validated); border-color: var(--validated); color: #fff; font-weight: 800; }
.label-admin { list-style: none; margin: 0 0 12px; padding: 0; }
.label-admin li { padding: 8px 0; border-top: 1px solid var(--line-2); }
.label-admin li:first-child { border-top: 0; }
.label-row { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.label-row input[type=text] { width: 240px; }
/* Projets (fiche société) */
.projects-section { margin-bottom: 24px; }
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.project-card { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; border: 1px solid var(--line); border-radius: var(--radius); text-decoration: none; color: var(--ink); }
a.project-card:hover { border-color: #c9d3ea; box-shadow: 0 4px 16px rgba(43, 81, 186, 0.08); }
.project-card-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
.project-name { font-size: 16px; font-weight: 800; }
.project-dates { font-size: 12.5px; }
.project-counts { display: flex; flex-wrap: wrap; gap: 6px; }
.chip-done { background: var(--done-bg); color: var(--done-ink); }
/* Bouton qui ouvre un petit formulaire (sans changer de page) */
.popover { position: relative; }
.popover summary { list-style: none; }
.popover summary::-webkit-details-marker { display: none; }
.popover-panel {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 340px; padding: 18px;
  background: #fff; border: 1px solid var(--line); border-radius: var(--radius); box-shadow: 0 10px 30px rgba(17, 24, 39, 0.14);
}
.popover-wide { width: 420px; max-height: 78vh; overflow-y: auto; }
/* Utilisateurs */
.users-tabs { margin-bottom: 16px; flex-wrap: wrap; }
.tab-count { margin-left: 6px; font-size: 12px; color: var(--muted); font-weight: 700; }
.users-actions { white-space: nowrap; }
.users-actions form.inline { display: inline; margin-left: 10px; }
.info-block { margin-top: 14px; }
.info-label { display: flex; align-items: center; gap: 6px; margin: 12px 0 4px; font-size: 12.5px; font-weight: 700; color: var(--ink-2); }
.info-label .lock { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.internal-docs { margin-top: 12px; padding: 4px 14px 10px; background: var(--bg-soft); border-radius: 12px; }
.doc-list li { font-size: 13.5px; }
.chip-internal { background: var(--ink-2); color: #fff; }
.popover-or { margin: 4px 0 0; font-size: 12.5px; text-align: center; }
.card-head .popover summary { margin-bottom: 8px; }
.projects-section .card-head { margin-bottom: 12px; align-items: center; }
.projects-section .card-head h2 { margin: 0; }
.project-new-dates { display: flex; gap: 8px; }
.project-new-dates label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; font-weight: 700; color: var(--muted); flex: 1; }
.project-summary { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between; gap: 16px; }
.project-summary-main { display: flex; flex-direction: column; gap: 6px; }
.project-summary-main .progress-track { width: 240px; }
.project-archived { display: flex; align-items: center; gap: 8px; margin-top: 12px; padding: 12px 16px; border: 1px dashed var(--field); border-radius: 12px; font-size: 13.5px; color: var(--muted); text-decoration: none; }
.project-archived .link { margin-left: auto; }
.user-projects { font-size: 12.5px; }
.label-list { list-style: none; margin: 0 0 14px; padding: 0; }
.label-list li { display: flex; align-items: center; gap: 10px; padding: 8px 0; border-top: 1px solid var(--line-2); font-size: 13px; }
.label-list li:first-child { border-top: 0; }
.label-list form { margin-left: auto; }
.label-add-form { display: flex; gap: 8px; }
.label-add-form input { flex: 1; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.label-add { margin-top: 12px; padding-top: 12px; border-top: 1px solid var(--line); }

/* Liste des tâches */
.task-list { border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.task-row {
  display: grid; grid-template-columns: minmax(0, 2.6fr) minmax(0, 1.2fr) minmax(0, 0.7fr) minmax(0, 1.1fr) minmax(0, 0.9fr) minmax(0, 0.8fr); gap: 16px; align-items: center;
  padding: 14px 20px; border-top: 1px solid var(--line-2); text-decoration: none; font-size: 14px;
}
.task-row:first-child { border-top: 0; }
a.task-row:hover { background: var(--bg-soft); }
.task-row-head { font-size: 12px; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; background: var(--bg-head); padding-top: 12px; padding-bottom: 12px; }
/* Point rouge à droite du titre : tâche en retard (quelle que soit la personne assignée). */
.task-row.is-late .task-title::after { content: ""; display: inline-block; width: 7px; height: 7px; border-radius: 50%; background: var(--late); margin-left: 8px; vertical-align: 2px; }
.task-main { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.task-title { font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-client { color: var(--muted); font-size: 12.5px; }
/* Étape du projet : pastille discrète devant la société / le projet. */
.chip-stage { padding: 1px 8px; font-size: 11.5px; font-weight: 700; background: #fff; border: 1px solid var(--line); color: var(--ink-2); margin-right: 2px; vertical-align: 1px; }
/* Regroupement par étape ou par label : titre de chaque groupe. */
.task-group-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin: 0; padding: 10px 20px; font-size: 13.5px; font-weight: 700; color: var(--ink); background: var(--bg-head); border-top: 1px solid var(--line); }
.task-list .task-group-head + .task-row { border-top: 1px solid var(--line-2); }
.task-cards .task-group-head { padding: 8px 4px 0; background: none; border-top: 0; font-size: 15px; }
.task-cards .task-group-head:not(:first-child) { margin-top: 12px; }
.task-group-count { font-size: 12.5px; font-weight: 600; color: var(--muted); white-space: nowrap; }
.task-person { display: flex; align-items: center; gap: 8px; color: var(--ink); overflow: hidden; white-space: nowrap; min-width: 0; }
.task-person > span:last-child { overflow: hidden; text-overflow: ellipsis; }
.due { display: flex; flex-direction: column; gap: 1px; }
.due-date { font-weight: 600; font-size: 13.5px; }
.due-sub { font-size: 12px; color: var(--muted); }
.due.overdue .due-date, .due.overdue .due-sub { color: var(--late); }
.due.overdue .due-date { font-weight: 800; }
.prio { display: inline-block; width: 16px; height: 16px; line-height: 16px; text-align: center; border-radius: 4px; background: var(--danger-bg); color: var(--danger); font-size: 11px; font-weight: 800; margin-right: 6px; }
.overdue { color: var(--late); font-weight: 700; }
.pagination { display: flex; gap: 12px; align-items: center; justify-content: center; margin-top: 20px; }
.empty { text-align: center; padding: 64px 16px; border: 1px dashed var(--field); border-radius: var(--radius); color: var(--muted); }
.empty h1 { color: var(--ink); margin-bottom: 8px; }

/* Timeline façon suivi de colis */
.timeline-card { padding: 28px 24px 22px; }
.timeline { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(6, minmax(0, 1fr)); }
.step { position: relative; text-align: center; padding: 0 6px; }
.step::before {
  content: ""; position: absolute; top: 15px; left: -50%; width: 100%; height: 4px; background: var(--track); z-index: 0;
}
.step:first-child::before { display: none; }
.step .dot {
  position: relative; z-index: 1; display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px; margin: 0 auto 10px; border-radius: 50%; background: var(--bg); border: 2px solid var(--todo);
}
.step-label { display: block; font-weight: 500; font-size: 13.5px; color: #6b7280; }
.step-sub { display: block; font-size: 12px; color: var(--muted); }
.step-date { display: block; font-size: 12.5px; color: var(--muted); margin-top: 2px; }
.step-reached::before, .step-current::before, .step-skipped::before { background: var(--validated); }
.step-reached .dot { background: var(--validated); border-color: var(--validated); }
/* Coche blanche dans les étapes validées */
.step-reached .dot::after {
  content: ""; width: 8px; height: 14px; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg);
}
.step-reached .step-label { color: var(--ink-2); font-weight: 600; }
.step-skipped .dot { border-style: dashed; border-color: #cbd5e1; }
.step-current .step-label { color: var(--ink); font-weight: 800; }
.step-current .step-due { color: var(--ink); font-weight: 700; }
.step-current .step-due.overdue { color: var(--late); }
/* Étape en cours (sauf Terminée) : pastille gris clair qui clignote doucement. */
.step-current.side-x43c .dot,
.step-current.side-client .dot,
.step-current.side-neutre .dot {
  background: var(--pulse); border-color: var(--pulse);
  animation: pulse 1.6s ease-in-out infinite;
}
.step-current.side-x43c .dot::after,
.step-current.side-client .dot::after,
.step-current.side-neutre .dot::after { content: ""; width: 34%; height: 34%; border-radius: 50%; background: #fff; }
.step-current.side-fini .dot { background: var(--validated); border-color: var(--validated); box-shadow: 0 0 0 5px var(--validated-bg); }
.step-current.side-fini .dot::after {
  content: ""; width: 8px; height: 14px; border: solid #fff; border-width: 0 3px 3px 0; transform: translateY(-2px) rotate(45deg);
}
.step-current.side-x43c .step-sub { color: var(--x43c-ink); font-weight: 600; }
.step-current.side-client .step-sub { color: var(--client-ink); font-weight: 600; }
.step-current.side-fini .step-sub { color: var(--done-ink); font-weight: 600; }
@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(148, 163, 184, 0.7); }
  50% { box-shadow: 0 0 0 7px rgba(148, 163, 184, 0); }
}
/* Tâche en retard : l'étape en cours clignote en rouge #c00e5e. */
.step-current.is-late.side-x43c .dot,
.step-current.is-late.side-client .dot,
.step-current.is-late.side-neutre .dot { background: var(--late); border-color: var(--late); animation-name: pulse-late; }
@keyframes pulse-late {
  0%, 100% { box-shadow: 0 0 0 0 rgba(192, 14, 94, 0.55); }
  50% { box-shadow: 0 0 0 7px rgba(192, 14, 94, 0); }
}
@media (prefers-reduced-motion: reduce) {
  .step-current .dot { animation: none; }
}

/* Fiche tâche */
.task-head-meta { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 12px; }
.task-head-meta .muted { font-size: 13px; padding-left: 4px; }
.prose p { margin: 0 0 10px; color: var(--ink-2); line-height: 1.6; }
.card-action { border: 1.5px solid var(--client-line); box-shadow: 0 6px 20px rgba(234, 106, 18, 0.08); }
.card-action .pill { margin-bottom: 12px; }
.client-action + .client-action { margin-top: 18px; padding-top: 18px; border-top: 1px solid var(--line-2); }
.client-action label { font-size: 13px; font-weight: 700; color: var(--ink-2); }
.comment-form { margin-bottom: 24px; }
.history { list-style: none; margin: 0; padding: 0; }
.event { display: flex; gap: 12px; padding: 14px 0; border-top: 1px solid var(--line-2); }
.event .avatar { width: 34px; height: 34px; font-size: 12px; }
.event-body { flex: 1; min-width: 0; }
.event-head { display: flex; flex-wrap: wrap; gap: 4px 10px; align-items: baseline; font-size: 14px; }
.event-head .muted { font-size: 12.5px; }
.event-body > p { margin: 4px 0 0; font-size: 14px; color: var(--ink-2); }
.event-comment { margin-top: 8px; padding: 12px 14px; background: var(--bg-soft); border-radius: 12px; font-size: 14px; line-height: 1.5; }
.event-comment p:last-child { margin-bottom: 0; }
/* Modification directe sur la fiche */
.inline-form { margin: 0; }
.inline-title {
  width: 100%; font: inherit; font-size: inherit; font-weight: inherit; letter-spacing: inherit; color: inherit;
  border: 1px solid transparent; border-radius: 8px; padding: 2px 6px; margin-left: -7px; background: transparent; min-height: 0;
}
.inline-title:hover { border-color: var(--line); }
.inline-title:focus { border-color: var(--brand); background: #fff; }
.facts-edit { align-items: center; }
.facts-edit dd { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }
.facts-edit .inline-input { min-height: 34px; padding: 5px 8px; font-size: 13.5px; font-weight: 600; width: 190px; text-align: left; border-color: transparent; background-color: var(--bg-soft); }
.facts-edit .inline-input:hover { border-color: var(--field); }
.inline-note { font-size: 12px; }
.inline-new-label { display: flex; gap: 6px; margin-top: 6px; }
.inline-new-label input { width: 140px; min-height: 34px; padding: 5px 8px; font-size: 13px; }
.inline-description textarea { border-color: transparent; background: var(--bg-soft); line-height: 1.6; }
.inline-description textarea:hover { border-color: var(--field); }
.inline-save { margin-top: 8px; display: flex; justify-content: flex-end; }
.facts { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 12px 16px; font-size: 14px; }
.facts dt { color: var(--muted); }
.facts dd { margin: 0; font-weight: 700; text-align: right; }
.facts dd .muted { font-weight: 500; }
.facts dd .pill, .facts dd .label-tag { margin: 0; }

/* Tableaux et listes */
.table-card { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; margin-bottom: 20px; }
.table { width: 100%; border-collapse: collapse; font-size: 14px; }
.table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); background: var(--bg-head); padding: 12px 16px; font-weight: 700; }
.table td { padding: 13px 16px; border-top: 1px solid var(--line-2); }
.table td a { font-weight: 700; text-decoration: none; }
.table td a:hover { color: var(--brand); }
.simple-list { list-style: none; padding: 0; margin: 0; }
.simple-list li { padding: 11px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.simple-list li:first-child { border-top: 0; }
.simple-list a { text-decoration: none; font-weight: 700; margin-right: 6px; }
.simple-list a:hover { color: var(--brand); }
.people { list-style: none; margin: 0; padding: 0; }
.people li { display: flex; justify-content: space-between; gap: 12px; padding: 12px 0; border-top: 1px solid var(--line-2); font-size: 14px; }
.people li:first-child { border-top: 0; padding-top: 0; }
.people-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

/* Connexion */
.auth-page { min-height: 100vh; display: flex; flex-direction: column; align-items: center; justify-content: center; padding: 24px; background: var(--bg-soft); }
.auth-card { width: 100%; max-width: 420px; background: var(--bg); border: 1px solid var(--line); border-radius: 18px; padding: 36px; box-shadow: 0 10px 30px rgba(17, 24, 39, 0.06); }
.auth-card h1 { font-size: 22px; margin-bottom: 18px; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 26px; }
.auth-brand img { height: 40px; }
.auth-brand .brand-mark { font-size: 20px; color: var(--ink); }
.auth-brand .brand-name { font-size: 14px; color: var(--muted); }
.auth-foot { text-align: center; margin: 20px 0 0; }
.auth-page .messages { width: 100%; max-width: 420px; }

/* Double authentification */
.auth-card-wide { max-width: 540px; }
.setup-steps { padding-left: 20px; margin: 0 0 16px; font-size: 14px; }
.setup-steps li { margin-bottom: 12px; }
.qr { margin: 12px 0 4px; }
.qr img { display: block; border: 1px solid var(--line); border-radius: 8px; }
code.secret { display: inline-block; margin-top: 4px; font-size: 14px; letter-spacing: 0.05em; background: var(--bg-soft); padding: 4px 8px; border-radius: 6px; word-break: break-all; }
.recovery-codes { list-style: none; padding: 0; margin: 16px 0 20px; display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.recovery-codes code { display: block; text-align: center; font-size: 15px; letter-spacing: 0.06em; background: var(--bg-soft); border: 1px solid var(--line); border-radius: 6px; padding: 6px; }
.twofa-status { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }

/* Suppressions */
.button.danger { color: var(--danger); border-color: var(--danger-line); }
.button.danger:hover { background: var(--danger-bg); }
.danger-zone { border-color: var(--danger-line); }
.danger-zone ul { margin: 8px 0 12px; padding-left: 20px; font-size: 14px; }
.danger-inline { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.danger-inline .muted { font-size: 13px; }
.event-delete { margin-top: 4px; }
.event-delete .link-button { font-size: 12px; }
.page-head .actions form { display: inline; }

/* Écrans moyens */
@media (max-width: 1180px) {
  .container { padding: 28px 28px 56px; }
  .stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Tablette et téléphone : le menu devient une barre bleue en haut */
@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    width: auto; height: auto; position: sticky; top: 0; z-index: 10; overflow: visible;
    flex-direction: row; align-items: center; gap: 8px; padding: 10px 16px;
  }
  .brand { padding: 0; gap: 8px; }
  .brand img { width: 30px; height: 30px; }
  .brand-name { display: none; }
  .nav { flex-direction: row; flex: 1; overflow-x: auto; gap: 2px; scrollbar-width: none; }
  .nav a { padding: 8px 10px; white-space: nowrap; }
  .nav svg { display: none; }
  .nav-count { margin-left: 6px; }
  .usermenu { margin: 0; padding: 0; border: 0; gap: 2px; }
  .user-chip { flex: none; padding: 2px; }
  .user-text { display: none; }
  .avatar.avatar-user { width: 32px; height: 32px; font-size: 12px; }
  .detail-grid { grid-template-columns: 1fr; }
  .detail-side { position: static; }
  .task-row { grid-template-columns: 1fr auto; gap: 8px 12px; }
  .task-row-head { display: none; }
  .task-row > [data-label="Assignée à"], .task-row > [data-label="Progression"], .task-row > [data-label="Priorité"] { display: none; }
  .task-row > [data-label="Échéance"] { grid-column: 1 / -1; flex-direction: row; gap: 8px; }
}
@media (max-width: 640px) {
  .container { padding: 22px 16px 48px; }
  h1 { font-size: 24px; }
  .page-head { flex-direction: column; align-items: stretch; }
  .page-head .actions { justify-content: flex-start; }
  .stats { gap: 10px; }
  .stat { padding: 14px; gap: 12px; }
  .stat-icon { width: 36px; height: 36px; }
  .stat-value { font-size: 22px; }
  .card { padding: 18px; }
  .banner-client { font-size: 15px; }
  /* Timeline de la fiche : verticale */
  .timeline { grid-template-columns: 1fr; gap: 0; }
  .step { text-align: left; padding: 0 0 18px 42px; min-height: 44px; }
  .step::before { top: -18px; left: 12px; width: 3px; height: 30px; }
  .step .dot { position: absolute; left: 0; top: 0; margin: 0; width: 27px; height: 27px; }
  .step-reached .dot::after, .step-current.side-fini .dot::after { width: 6px; height: 11px; border-width: 0 2.5px 2.5px 0; }
}

/* Vue Timeline sur mobile : la frise reste horizontale, sans libellés */
@media (max-width: 640px) {
  .tabs-row { flex-wrap: wrap; }
  .task-card-head { flex-direction: column; gap: 8px; }
  .task-card-meta { justify-content: flex-start; max-width: none; }
  .timeline-compact { grid-template-columns: repeat(6, minmax(0, 1fr)); }
  .timeline-compact .step { text-align: center; padding: 0; min-height: 0; }
  .timeline-compact .step::before { top: 10px; left: -50%; width: 100%; height: 3px; }
  .timeline-compact .step .dot { position: relative; left: auto; top: auto; margin: 0 auto 4px; width: 22px; height: 22px; }
  .timeline-compact .step-label { display: none; }
}

/* Tâches internes X43C (jamais visibles par le client) */
.nav-count-alert { background: #fff; color: var(--brand); box-shadow: 0 0 0 2px #ffd166; }
.internal-stats { grid-template-columns: repeat(3, minmax(0, 1fr)); }
.stat-alert .stat-icon { background: var(--danger-bg); color: var(--danger); }
.stat-alert .stat-value { color: var(--danger); }
.internal-tabs { margin-bottom: 20px; flex-wrap: wrap; }
.tabs-sep { width: 1px; margin: 6px 4px; background: var(--line); }
.internal-card h2 { display: flex; align-items: center; gap: 8px; }
.internal-card h2 .lock { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.internal-list { list-style: none; padding: 0; margin: 0; }
.internal-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-top: 1px solid var(--line-2); }
.internal-row:first-child { border-top: 0; }
.internal-check-form, .internal-row > form { margin: 0; display: flex; }
.internal-check {
  width: 22px; height: 22px; flex: none; padding: 0; border: 2px solid #c3c9d4; border-radius: 6px; background: #fff;
  cursor: pointer; display: flex; align-items: center; justify-content: center; color: #fff;
}
.internal-check:hover { border-color: var(--done); }
.internal-check svg { width: 14px; height: 14px; fill: none; stroke: currentColor; stroke-width: 3; stroke-linecap: round; stroke-linejoin: round; }
.is-done .internal-check { background: var(--done); border-color: var(--done); }
.internal-body { flex: 1 1 auto; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.internal-title { font-size: 14px; font-weight: 600; overflow-wrap: anywhere; }
.is-done .internal-title { text-decoration: line-through; color: var(--muted); font-weight: 500; }
.internal-meta { font-size: 12.5px; }
.internal-meta a { color: var(--brand); text-decoration: none; font-weight: 600; }
.chip-today { background: var(--client-bg); color: var(--client-ink); }
.internal-delete { background: none; border: 0; padding: 4px; cursor: pointer; color: #9aa3b2; display: flex; border-radius: 6px; }
.internal-delete:hover { color: var(--danger); background: var(--danger-bg); }
.internal-delete svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 2; stroke-linecap: round; }
.internal-add { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line-2); }
.internal-add input[type=text] { flex: 1 1 220px; width: auto; }
.internal-add input[type=date], .internal-add select { flex: 0 1 auto; width: auto; }
.internal-done { margin-top: 12px; }
.internal-done summary { cursor: pointer; font-size: 13px; font-weight: 700; color: var(--muted); }
@media (max-width: 720px) {
  .internal-stats { grid-template-columns: 1fr; }
}

/* Rapport d'avancement (étape 4) */
.page-head .actions .report-period, .report-period { display: flex; align-items: center; gap: 8px; margin: 0; }
.report-period label { font-size: 13px; font-weight: 700; color: var(--muted); }
.report-period select { width: auto; }
.report-preview { max-width: 640px; font-size: 15px; line-height: 1.55; }
.report-lock { width: 18px; height: 18px; fill: none; stroke: var(--muted); stroke-width: 2; stroke-linecap: round; stroke-linejoin: round; }
.detail-side h2 .report-lock { vertical-align: -2px; }
.split-bar { display: flex; height: 10px; border-radius: 99px; overflow: hidden; background: var(--line-2); margin: 6px 0 10px; }
.split-x43c { background: var(--brand); }
.split-client { background: var(--client); }
.legend-dot { display: inline-block; width: 9px; height: 9px; border-radius: 50%; margin-right: 7px; }
.legend-x43c { background: var(--brand); }
.legend-client { background: var(--client); }
.report-to { font-size: 12.5px; overflow-wrap: anywhere; }
@media print {
  .sidebar, .no-print, .messages { display: none !important; }
  .container { padding: 0 !important; }
  .detail-grid { display: block; }
  .report-preview { border: 0; padding: 0; max-width: none; }
}

/* Import de tâches */
.import-errors { background: var(--danger-bg); color: var(--danger); }
.import-errors ul { margin: 8px 0 0; padding-left: 20px; }
.import-errors li { margin: 2px 0; }
.import-columns { margin: 0; font-size: 13px; }
.import-columns dt { font-weight: 700; margin-top: 10px; }
.import-columns dd { margin: 2px 0 0; color: var(--muted); }

/* Lien de suivi sans compte (lecture seule) */
.app:has(> main.share-page) .sidebar { display: none; }
.share-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 18px; }
.share-head .auth-brand { margin-bottom: 0; }
.share-foot { margin-top: 24px; text-align: center; }
.share-reveal { border: 2px solid var(--brand); background: #fff7fa; }
.share-reveal code { display: block; font-size: 13px; padding: 8px 10px; background: #fff; border: 1px solid var(--line); border-radius: 8px; overflow-wrap: anywhere; user-select: all; }
.share-pin { font-size: 26px; font-weight: 800; letter-spacing: 0.2em; }
.share-links li { display: flex; justify-content: space-between; gap: 10px; align-items: flex-start; }
.share-links .people-actions { display: flex; flex-direction: column; align-items: flex-end; gap: 4px; }

.user-options { font-size: 12px; }
.share-desc { font-size: 13.5px; color: var(--ink-2); margin: 4px 0 10px; line-height: 1.5; }

/* Tableau de bord X43C (graphiques SVG dessinés par le serveur) */
.dash-small { font-size: 12.5px; }
.segmented button { display: flex; align-items: center; min-height: 34px; padding: 0 14px; border: 0; background: none; font: inherit; font-size: 13px; font-weight: 600; color: #4b5563; border-radius: 8px; cursor: pointer; }
.segmented button.active { background: #fff; color: var(--ink); font-weight: 700; box-shadow: 0 1px 2px rgba(16, 24, 40, 0.12); }
.dash-kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 16px; margin-bottom: 20px; }
.dash-kpi { display: flex; flex-direction: column; gap: 6px; margin: 0; padding: 18px 20px; }
.dash-kpi-label { font-size: 13px; font-weight: 700; color: var(--muted); }
.dash-kpi-value { font-size: 30px; font-weight: 800; line-height: 1.1; }
.dash-kpi-value.is-late { color: var(--late); }
.dash-kpi-value.is-done { color: var(--done-ink); }
.dash-kpi-value.is-client { color: var(--client-ink); }
.dash-delta { color: var(--muted); font-weight: 700; }
.dash-delta.is-up, .dash-up { color: var(--done-ink); }
.dash-delta.is-down { color: var(--late); }
.dash-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 16px; }
.dash-grid-2 > .card { margin-bottom: 20px; }
.dash-card { display: flex; flex-direction: column; gap: 14px; }
.dash-card-head { display: flex; flex-direction: column; gap: 2px; }
.dash-card-head h2 { margin: 0; font-size: 16px; font-weight: 800; }
.dash-card-head-row { flex-direction: row; flex-wrap: wrap; align-items: flex-start; justify-content: space-between; gap: 12px; }
.dash-badges { display: flex; flex-wrap: wrap; gap: 8px; }
.dash-pie { display: flex; flex-wrap: wrap; align-items: center; gap: 22px; }
.dash-pie svg { flex: none; }
.dash-pie-labels text { font-size: 14px; font-weight: 800; text-anchor: middle; font-family: inherit; }
.dash-legend { flex: 1 1 160px; display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.dash-legend-row { display: flex; align-items: center; gap: 10px; }
.dash-legend-row.is-none .dash-legend-name { color: var(--muted); }
.dash-legend-name { flex: 1; font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.dash-legend-pct { font-weight: 800; width: 48px; text-align: right; }
.dash-swatch { display: inline-block; width: 12px; height: 12px; border-radius: 3px; flex: none; }
.dash-hint { margin: -8px 0 20px; color: var(--muted); }
.dash-chart { width: 100%; max-width: 560px; height: auto; display: block; margin: 0 auto; }
.dash-activity { align-items: start; }
.dash-activity .dash-card-head-row { flex-direction: column; }
.dash-activity .dash-badges .chip { font-size: 12px; }
.dash-activity .dash-legend-line { gap: 12px; font-size: 12px; }
.dash-axis { font-size: 11px; fill: var(--muted); font-family: inherit; }
.dash-axis line { stroke: #e4e6eb; }
.dash-axis { fill: #65676b; }
.dash-today { stroke: #8a8d91; stroke-width: 1.5; stroke-dasharray: 3 3; }
.dash-legend-line { display: flex; flex-wrap: wrap; gap: 18px; font-size: 12.5px; color: var(--ink-2); }
.dash-legend-line > span { display: flex; align-items: center; gap: 6px; }
.dash-line { display: inline-block; width: 18px; height: 3px; border-radius: 2px; }
.dash-line-dashed { height: 0; border-top: 2px dashed var(--muted); }
.dash-table-card { padding: 20px 0 0; }
.dash-table-card .dash-card-head { padding: 0 22px; }
.dash-table-wrap { overflow-x: auto; }
.dash-table { width: 100%; min-width: 980px; border-collapse: collapse; font-size: 13.5px; }
.dash-table th { background: var(--bg-head); color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: 0.04em; text-align: left; font-weight: 700; padding: 11px 12px; }
.dash-table td { padding: 14px 12px; border-top: 1px solid var(--line-2); vertical-align: middle; }
.dash-table th:first-child, .dash-table td:first-child { padding-left: 22px; }
.dash-table tr.is-selected td { background: #fdf3f8; }
.dash-project { font-weight: 700; color: var(--ink); text-decoration: none; }
.dash-project:hover { color: var(--brand); }
.dash-split { display: flex; width: 120px; height: 8px; border-radius: 99px; overflow: hidden; background: var(--line-2); margin-bottom: 4px; }

/* Pilotage des projets (tableau de bord) : sections titrées, cartes de même structure, gris / vert / rouge. */
.pilot { display: flex; flex-direction: column; gap: 32px; }
.pilot .is-late { color: var(--late); }
.pilot .is-good { color: var(--done-ink); }
.pilot-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 16px; padding-bottom: 20px; border-bottom: 1px solid var(--line); }
.pilot-head-text { display: flex; flex-direction: column; gap: 6px; min-width: 0; }
.pilot-head h1 { margin: 0; font-size: 28px; font-weight: 800; letter-spacing: -0.01em; }
.pilot-head p { margin: 0; font-size: 13.5px; }
.pilot-back { font-size: 13px; font-weight: 700; color: var(--brand); text-decoration: none; }
.pilot-head-actions { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; margin: 0; }
.pilot-head-actions select { width: auto; min-width: 200px; }
.pilot-select { display: flex; align-items: center; gap: 8px; margin: 0; }
.pilot-select label { font-size: 13px; font-weight: 700; color: var(--muted); }
.pilot-section { display: flex; flex-direction: column; gap: 14px; }
.pilot-section-title { margin: 0; font-size: 12px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; color: var(--muted); }
.pilot-section-row { display: flex; flex-wrap: wrap; align-items: baseline; justify-content: space-between; gap: 8px; font-size: 12.5px; }
.pilot-grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 20px; align-items: stretch; }
.pilot-card { border: 1px solid var(--line); border-radius: var(--radius); padding: 20px 22px; display: flex; flex-direction: column; gap: 16px; background: var(--bg); min-width: 0; }
.pilot-card-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; min-height: 24px; font-size: 12.5px; }
.pilot-card-head h3 { margin: 0; font-size: 15px; font-weight: 800; color: var(--ink); }
.pilot-figure { display: flex; align-items: baseline; gap: 8px; min-height: 44px; font-size: 13px; }
.pilot-figure-split { justify-content: space-between; }
.pilot-big { font-size: 40px; font-weight: 800; line-height: 1; }
.pilot-big.level-retard { color: var(--brand); }
.pilot-big.level-ok { color: var(--done-ink); }
.pilot-bar { display: flex; flex: 1; height: 12px; border-radius: 99px; background: var(--line-2); overflow: hidden; }
.pilot-bar > span { display: block; height: 100%; }
.pilot-bar .is-validated { background: var(--done); }
.pilot-bar .is-approval { background: #b9dca0; }
.pilot-bar .is-time { background: #c7ccd4; }
.pilot-gauge { position: relative; display: flex; height: 12px; }
.pilot-gauge .zone-ok { width: 25%; background: #dcefcf; border-radius: 99px 0 0 99px; }
.pilot-gauge .zone-watch { width: 25%; background: var(--line); }
.pilot-gauge .zone-late { width: 50%; background: #f6d0e0; border-radius: 0 99px 99px 0; }
.pilot-gauge-mark { position: absolute; top: -4px; width: 4px; height: 20px; margin-left: -2px; border-radius: 2px; background: var(--ink); }
.pilot-timebar { position: relative; height: 12px; border-radius: 99px; background: var(--line-2); }
.pilot-time { position: absolute; left: 0; top: 0; bottom: 0; background: #c7ccd4; border-radius: 99px 0 0 99px; }
.pilot-done { position: absolute; left: 0; top: 3px; height: 6px; background: var(--done); border-radius: 99px; }
.pilot-today { position: absolute; top: -4px; width: 2px; height: 20px; background: var(--ink); }
.pilot-dl { margin: 0; display: flex; flex-direction: column; gap: 8px; font-size: 13px; }
.pilot-dl > div { display: flex; justify-content: space-between; gap: 12px; }
.pilot-dl > div.is-total { padding-top: 8px; border-top: 1px solid var(--line-2); }
.pilot-dl dt { display: flex; align-items: center; gap: 8px; color: var(--ink-2); min-width: 0; }
.pilot-dl dt .muted { margin-left: -4px; }
.pilot-dl dd { margin: 0; font-weight: 700; white-space: nowrap; }
.pilot-swatch { display: inline-block; flex: none; width: 10px; height: 10px; border-radius: 3px; background: var(--line-2); border: 1px solid var(--field); box-sizing: border-box; }
.pilot-swatch.is-validated { background: var(--done); border-color: var(--done); }
.pilot-swatch.is-approval { background: #b9dca0; border-color: #b9dca0; }
.pilot-level { display: inline-flex; align-items: center; padding: 3px 11px; border-radius: 99px; font-size: 12.5px; font-weight: 800; white-space: nowrap; }
.pilot-level.level-ok { background: #dcefcf; color: var(--done-ink); }
.pilot-level.level-surveiller { background: var(--line); color: var(--ink-2); }
.pilot-level.level-retard { background: var(--brand); color: #fff; }
.pilot-level-text { font-size: 12.5px; font-weight: 700; color: var(--muted); }
.pilot-level-text.level-retard { color: var(--brand); }
.pilot-level-text.level-ok { color: var(--done-ink); }
.pilot-trend { font-weight: 800; }
.pilot-trend.is-worse { color: var(--brand); }
.pilot-trend.is-better { color: var(--done-ink); }
.pilot-card-link { margin-top: auto; font-size: 13px; font-weight: 700; color: var(--brand); text-decoration: none; }
.pilot-list { padding: 0; gap: 0; }
.pilot-list .pilot-card-head { padding: 18px 22px 14px; }
.pilot-count { display: inline-flex; justify-content: center; min-width: 24px; padding: 2px 9px; border-radius: 99px; background: var(--line-2); color: var(--ink-2); font-size: 12.5px; font-weight: 800; }
.pilot-count.is-alert { background: #fbe7f0; color: var(--brand); }
.pilot-list ul { list-style: none; margin: 0; padding: 0; }
.pilot-list li { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 11px 22px; border-top: 1px solid var(--line-2); }
.pilot-item-main { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.pilot-item-main a { font-weight: 700; color: var(--ink); text-decoration: none; }
.pilot-item-main a:hover { color: var(--brand); }
.pilot-item-sub { font-size: 12px; color: var(--muted); }
.pilot-item-side { display: flex; flex-direction: column; align-items: flex-end; white-space: nowrap; }
.pilot-item-days { font-size: 13px; font-weight: 800; color: var(--ink-2); }
.pilot-item-days.is-late { color: var(--late); }
.pilot-card-foot { margin: auto 0 0; padding: 12px 22px 16px; border-top: 1px solid var(--line-2); font-size: 12.5px; }
.pilot-card-foot a { color: var(--brand); font-weight: 700; }
.pilot-empty { margin: 0; padding: 14px 22px 18px; border-top: 1px solid var(--line-2); font-size: 13px; font-weight: 700; color: var(--done-ink); }
.pilot-table-wrap { border: 1px solid var(--line); border-radius: var(--radius); overflow-x: auto; }
.pilot-table { width: 100%; border-collapse: collapse; font-size: 13.5px; }
.pilot-table th, .pilot-table td { padding: 13px 12px; text-align: left; vertical-align: middle; border-top: 1px solid var(--line-2); }
.pilot-table thead th { background: var(--bg-head); color: var(--muted); font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; border-top: 0; }
.pilot-table th:first-child, .pilot-table td:first-child { padding-left: 22px; }
.pilot-table th:last-child, .pilot-table td:last-child { padding-right: 22px; }
.pilot-table tbody th { font-weight: 700; }
.pilot-table .num { text-align: right; }
.pilot-row-bar { display: flex; align-items: center; gap: 12px; max-width: 420px; }
.pilot-row-bar .pilot-bar { height: 10px; min-width: 80px; }
.pilot-row-bar strong { width: 46px; text-align: right; flex: none; }
.pilot-projects { min-width: 1000px; }
.pilot-projects tbody th a { display: block; color: var(--ink); text-decoration: none; }
.pilot-projects tbody th a:hover { color: var(--brand); }
.pilot-projects tbody th .muted, .pilot-projects td .dash-small { display: block; font-weight: 500; font-size: 12.5px; }
.pilot-index { display: inline-flex; align-items: center; gap: 8px; }
.pilot-stuck { display: block; color: var(--muted); }
.pilot-stuck strong { color: var(--ink); }
.pilot-legend { display: flex; flex-wrap: wrap; gap: 16px; font-size: 12.5px; color: var(--ink-2); }
.pilot-legend > span { display: inline-flex; align-items: center; gap: 6px; }
.pilot .dash-kpis, .pilot .dash-grid-2 > .card, .pilot .dash-card { margin-bottom: 0; }
.pilot .dash-grid-2 { margin-top: 0; }

/* Paramètres → Labels prédéfinis */
.preset-add { display: flex; gap: 10px; margin-bottom: 18px; }
.preset-add input { flex: 1; }
.preset-list { list-style: none; margin: 0 0 14px; padding: 0; border: 1px solid var(--line); border-radius: var(--radius-sm); }
.preset-list li { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--line-2); }
.preset-list li:first-child { border-top: 0; }
.preset-name { flex: 1; font-weight: 700; min-width: 0; }
.preset-actions { display: flex; align-items: center; gap: 6px; }
.preset-actions form { margin: 0; }
.preset-actions button[disabled] { opacity: 0.35; cursor: default; }

/* Graphique de tendance : fond de la projection, points du jour, « reste à faire ». */
.dash-proj-bg { fill: #f0f2f5; }
.dash-dot { fill: #ffffff; }
.dash-swatch-rest { background: #dce9fd; }

/* Temps passé (interne X43C) : fiche tâche, fiche projet, liste */
.time-total { font-size: 18px; font-weight: 800; }
.time-form { display: flex; flex-direction: column; gap: 10px; margin-bottom: 14px; }
.time-form label { display: flex; flex-direction: column; gap: 4px; font-size: 12.5px; font-weight: 700; color: var(--muted); }
.time-form-row { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(0, 1fr) minmax(0, 1fr); gap: 8px; }
.time-list { list-style: none; margin: 0; padding: 0; }
.time-list li { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; padding: 9px 0; border-top: 1px solid var(--line-2); font-size: 13.5px; }
.time-list form { margin: 0; }
.time-list-main { min-width: 0; }
.time-note { display: block; font-size: 12.5px; color: var(--ink-2); overflow-wrap: anywhere; }
.time-summary { display: flex; flex-wrap: wrap; align-items: baseline; gap: 12px; margin-bottom: 14px; }
.time-big { font-size: 28px; font-weight: 800; }
.time-breakdown { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 18px; }
.time-breakdown h3 { margin: 0 0 6px; font-size: 13px; font-weight: 800; color: var(--muted); text-transform: uppercase; letter-spacing: 0.04em; }
.task-time { color: var(--ink-2); font-weight: 600; }

/* ==========================================================================
   Mode sombre : classe « theme-dark » posée sur <html> (choix dans « Mon compte » :
   automatique, clair ou sombre ; voir le script en tête de templates/base.html).
   Fond gris très foncé, cartes un cran plus claires, couleurs de sens éclaircies pour rester lisibles.
   Menu latéral gris presque noir : le rouge X43C seulement sur l'élément actif et le compteur.
   Emails et rapport PDF : toujours en clair (non concernés).
   ========================================================================== */
.theme-dark {
  color-scheme: dark;
  --ink: #e7e9ee;
  --ink-2: #c2c7d0;
  --muted: #959ba6;
  --line: #2c3038;
  --line-2: #24272e;
  --field: #3a3f49;
  --bg: #1b1e24;
  --bg-soft: #23262e;
  --bg-head: #20232a;
  --brand: #c00e5e;
  --brand-dark: #d6246b;
  --x43c: #7c9cff;
  --x43c-bg: #1e2a4a;
  --x43c-ink: #9fb6ff;
  --client: #ff9a52;
  --client-bg: #3a2716;
  --client-ink: #ffb37a;
  --client-line: #6b4423;
  --validated: #4e9a1f;
  --validated-bg: #1d3320;
  --done: #5fb84a;
  --done-bg: #1d3320;
  --done-ink: #8fd67f;
  --pulse: #4a505b;
  --pulse-bg: #2a2e36;
  --todo: #3a3f49;
  --track: #2c3038;
  --neutral-bg: #2a2e36;
  --danger: #ff7b7b;
  --danger-bg: #3a1c1f;
  --danger-line: #6b2a2f;
  --side-bg: #0f1115;
  --side-ink: #aab0ba;
  --icon-bg: #22252c;
  --side-icon: #c2c7d0;
  --late: #ff6fa6;
}
.theme-dark body { background: #14161b; }

/* Menu latéral (variante B) */
.theme-dark .sidebar { border-right: 1px solid #24272e; }
.theme-dark .nav a:hover { background: rgba(255, 255, 255, 0.06); color: #fff; }
.theme-dark .nav a.active { background: #22252c; color: #fff; box-shadow: none; }
.theme-dark .nav a.active svg { color: #ff6fa6; }
.theme-dark .nav-count, .theme-dark .nav a.active .nav-count, .theme-dark .nav-count-alert { background: var(--brand); color: #fff; }
.theme-dark .brand-name, .theme-dark .user-role { color: #8a909b; }
.theme-dark .usermenu { border-top-color: rgba(255, 255, 255, 0.08); }
.theme-dark .avatar.avatar-user { background: var(--brand); color: #fff; }

/* Liens et textes en rouge : rose plus clair, lisible sur fond sombre (les boutons gardent le rouge X43C) */
.theme-dark .link, .theme-dark .back, .theme-dark .eyebrow a, .theme-dark .internal-meta a, .theme-dark .pilot-back,
.theme-dark .pilot-card-link, .theme-dark .pilot-card-foot a, .theme-dark .pilot-big.level-retard,
.theme-dark .pilot-level-text.level-retard, .theme-dark .pilot-trend.is-worse, .theme-dark .avatar-light { color: #ff6fa6; }
.theme-dark .table td a:hover, .theme-dark .simple-list a:hover, .theme-dark .dash-project:hover,
.theme-dark .pilot-item-main a:hover, .theme-dark .pilot-projects tbody th a:hover, .theme-dark .link:hover { color: #ff8fbb; }

/* Onglets, boutons Oui / Non, sélecteurs segmentés */
.theme-dark .tabs, .theme-dark .segmented, .theme-dark .yesno { background: #20232a; }
.theme-dark .tabs a, .theme-dark .segmented a, .theme-dark .segmented button, .theme-dark .yesno button { color: #c2c7d0; }
.theme-dark .tabs a.active, .theme-dark .segmented a.active, .theme-dark .segmented button.active, .theme-dark .yesno button.active {
  background: #2c3038; color: #fff; box-shadow: none;
}

/* Champs, menus déroulants, surfaces blanches codées en dur */
.theme-dark .multi-select summary, .theme-dark .multi-select-panel, .theme-dark .progress-form button,
.theme-dark .chip-stage, .theme-dark .inline-title:focus, .theme-dark .share-reveal code { background: var(--bg); }
.theme-dark .multi-select-panel { box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.theme-dark .pill:not(.pill-x43c):not(.pill-client):not(.pill-fini):not(.pill-annule) { color: #c2c7d0; }
.theme-dark .pill:not(.pill-x43c):not(.pill-client):not(.pill-fini):not(.pill-annule)::before { background: #8a909b; }
.theme-dark .popover-panel { background: var(--bg); box-shadow: 0 10px 30px rgba(0, 0, 0, 0.5); }
.theme-dark .internal-check { border-color: #4a505b; background: var(--bg); }
.theme-dark .is-done .internal-check { background: var(--done); border-color: var(--done); }
.theme-dark .chip-late, .theme-dark .pilot-count.is-alert { background: #3a1a29; color: #ff6fa6; }
.theme-dark .message-success { border-color: #2f5a2a; }
.theme-dark .task-card:hover, .theme-dark .task-card.needs-me, .theme-dark a.project-card:hover { border-color: #3a4a70; box-shadow: none; }
.theme-dark .step-label { color: #9aa1ab; }
.theme-dark .step-skipped .dot { border-color: #4a505b; }
.theme-dark .share-reveal { background: #2a1520; }
.theme-dark .internal-delete { color: #8a909b; }
.theme-dark input::placeholder, .theme-dark textarea::placeholder { color: #7d838e; }

/* Tableau de bord et graphiques */
.theme-dark .dash-axis line { stroke: #2c3038; }
.theme-dark .dash-axis { fill: #959ba6; }
.theme-dark .dash-today { stroke: #6b7280; }
.theme-dark .dash-proj-bg { fill: #20232a; }
.theme-dark .dash-dot { fill: #1b1e24; }
.theme-dark .dash-swatch-rest { background: #1e2a4a; }
.theme-dark .dash-table tr.is-selected td { background: #2a1520; }
.theme-dark .pilot-bar .is-approval, .theme-dark .pilot-swatch.is-approval { background: #3f7a36; border-color: #3f7a36; }
.theme-dark .pilot-bar .is-validated, .theme-dark .pilot-done { background: #6cc35a; }
.theme-dark .pilot-bar .is-time, .theme-dark .pilot-time { background: #4a505b; }
.theme-dark .pilot-gauge .zone-ok, .theme-dark .pilot-level.level-ok { background: #23402a; }
.theme-dark .pilot-gauge .zone-late { background: #4a1f33; }
