/* =====================================================================
   Tasksana — feuille de style
   Tokens de design + composants. Thème clair, accent indigo/corail.
   ===================================================================== */

:root {
  --bg: #f6f7f9;
  --surface: #ffffff;
  --surface-2: #fbfbfc;
  --border: #e7e7ec;
  --border-strong: #d6d6dd;
  --text: #1e1f21;
  --text-muted: #6b6f76;
  --text-faint: #9aa0a6;

  --primary: #4f46e5;
  --primary-hover: #4338ca;
  --primary-soft: #eef0fb;
  --coral: #f06a6a;
  --green: #1f9d55;
  --green-soft: #e3f5ea;
  --red: #e8384f;
  --red-soft: #fde8eb;
  --amber: #e08a00;
  --amber-soft: #fbeed0;

  --r-sm: 6px;
  --r: 10px;
  --r-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(16, 17, 26, 0.06);
  --shadow: 0 4px 14px rgba(16, 17, 26, 0.08);
  --shadow-lg: 0 12px 40px rgba(16, 17, 26, 0.18);

  --sidebar-w: 256px;
  --topbar-h: 56px;
  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  height: 100%;
}

body {
  font-family: var(--font);
  color: var(--text);
  background: var(--bg);
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, h4 { margin: 0; font-weight: 650; color: var(--text); }

.icon { width: 18px; height: 18px; flex: none; vertical-align: middle; }

/* ---------- Boutons -------------------------------------------------- */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  border: 1px solid transparent;
  border-radius: var(--r-sm);
  padding: 8px 14px;
  font-size: 14px;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  background: var(--surface);
  color: var(--text);
  transition: background .15s, border-color .15s, box-shadow .15s;
  text-decoration: none;
  line-height: 1;
}
.btn:hover { text-decoration: none; }
.btn .icon { width: 16px; height: 16px; }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-block { width: 100%; justify-content: center; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-ghost { background: transparent; border-color: var(--border-strong); color: var(--text); }
.btn-ghost:hover { background: var(--surface-2); }
.btn.danger, .danger { color: var(--red); }

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px; height: 32px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  border-radius: var(--r-sm);
  cursor: pointer;
  padding: 0;
}
.icon-btn:hover { background: rgba(0,0,0,.06); color: var(--text); }
.icon-btn.xs { width: 26px; height: 26px; }
.icon-btn.xs .icon { width: 15px; height: 15px; }
.icon-btn.danger:hover { background: var(--red-soft); color: var(--red); }

/* ---------- Mise en page applicative -------------------------------- */
.app-shell { display: flex; min-height: 100vh; }
.app-main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.app-content { padding: 24px 32px 64px; flex: 1; }

/* ---------- Barre latérale ------------------------------------------ */
.sidebar {
  width: var(--sidebar-w);
  flex: none;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 12px;
  gap: 4px;
  overflow-y: auto;
  height: 100vh;
  position: sticky;
  top: 0;
}
.sidebar-top { display: flex; align-items: center; justify-content: space-between; padding: 4px 6px 10px; }
.brand { display: flex; align-items: center; gap: 9px; font-weight: 750; font-size: 16px; color: var(--text); }
.brand:hover { text-decoration: none; }
.brand-mark {
  width: 28px; height: 28px;
  border-radius: 8px;
  background: var(--coral);
  color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 800;
}
.brand-mark.lg { width: 48px; height: 48px; border-radius: 12px; font-size: 22px; }
.sidebar-hide { display: none; }

.ws-switcher { margin-bottom: 6px; }
.ws-current {
  display: flex; align-items: center; gap: 9px;
  padding: 8px; border-radius: var(--r-sm); cursor: pointer;
  list-style: none;
}
.ws-current::-webkit-details-marker { display: none; }
.ws-current:hover { background: var(--surface-2); }
.ws-avatar {
  width: 26px; height: 26px; border-radius: 7px;
  background: var(--primary-soft); color: var(--primary);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; flex: none;
}
.ws-avatar.sm { width: 22px; height: 22px; font-size: 12px; }
.ws-avatar.has-color { color: #fff; }
/* Champ couleur d'espace (paramètres) : picker + case « par défaut ». */
.ws-color-field { display: flex; align-items: center; gap: 12px; }
.ws-emoji-select { font-size: 16px; }
.ws-name { font-weight: 650; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ws-caret { width: 16px; height: 16px; color: var(--text-muted); }

/* Bouton global « Créer une tâche » (sous le logo). */
.global-task-btn { width: 100%; justify-content: center; gap: 8px; margin-bottom: 10px; }
.global-task-btn .icon { width: 16px; height: 16px; }
.sidebar--rail .global-task-btn { width: 40px; height: 40px; padding: 0; margin-left: auto; margin-right: auto; }
.sidebar--rail .global-task-btn .nav-label { display: none; }
.mytask-ws { white-space: nowrap; flex: none; }

/* ---------- Suivi des tâches attribuées ------------------------------ */
.followup-stats { grid-template-columns: repeat(4, 1fr); }
.text-danger { color: var(--red); }
.badge-danger { background: var(--red-soft); color: var(--red); }
.followup-groups { display: flex; flex-direction: column; gap: 16px; }
.followup-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.followup-head-main { flex: 1; min-width: 0; }
.followup-name { font-weight: 700; font-size: 15px; }
.followup-progress { height: 6px; background: var(--surface-3); border-radius: 999px; margin-top: 6px; max-width: 320px; overflow: hidden; }
.followup-progress-bar { height: 100%; background: var(--green, #2bb673); border-radius: 999px; transition: width .3s; }
.followup-head-meta { display: flex; align-items: center; gap: 8px; flex: none; }
.followup-tasks { display: flex; flex-direction: column; }
.followup-task { display: flex; align-items: center; gap: 10px; padding: 9px 6px; border-top: 1px solid var(--border); cursor: pointer; }
.followup-task:hover { background: var(--surface-2); }
.followup-task.is-done .followup-title { text-decoration: line-through; color: var(--text-faint); }
.followup-check { width: 18px; height: 18px; border: 1.5px solid var(--border-strong); border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; flex: none; color: transparent; }
.followup-check .icon { width: 11px; height: 11px; }
.followup-check.done { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.followup-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 550; }
.followup-project { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-size: 13px; white-space: nowrap; }
.followup-ws { white-space: nowrap; }
.followup-due { font-size: 13px; color: var(--text-muted); white-space: nowrap; min-width: 64px; text-align: right; }
.followup-due.overdue { color: var(--red); font-weight: 650; }
@media (max-width: 900px) {
  .followup-stats { grid-template-columns: 1fr 1fr; }
  .followup-task { flex-wrap: wrap; }
}

/* Page « Nouvelle tâche » : pleine largeur, contenu à gauche, réglages à droite. */
.task-new-card { max-width: none; }
.task-new-title { font-size: 17px; font-weight: 600; padding: 12px 14px; }
.task-new-grid { display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 12px 36px; align-items: start; margin-top: 4px; }
.task-new-side { border-left: 1px solid var(--border); padding-left: 28px; position: sticky; top: 16px; }
.task-new-form .wysiwyg-editor { min-height: 240px; }
.task-new-actions { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 18px; }
@media (max-width: 980px) {
  .task-new-grid { grid-template-columns: 1fr; gap: 4px; }
  .task-new-side { border-left: none; padding-left: 0; position: static; }
}
.subtask-inputs { display: flex; flex-direction: column; gap: 8px; }
.subtask-inputs:not(:empty) { margin-bottom: 8px; }
.subtask-input-row { display: flex; gap: 8px; align-items: center; }
.subtask-input-row input { flex: 1; }

.sidebar-nav { display: flex; flex-direction: column; gap: 2px; margin-bottom: 8px; }
.nav-item {
  display: flex; align-items: center; gap: 11px;
  padding: 8px 10px; border-radius: var(--r-sm);
  color: var(--text); font-weight: 550;
}
.nav-item:hover { background: var(--surface-2); text-decoration: none; }
.nav-item.is-active { background: var(--primary-soft); color: var(--primary); }
.nav-item.is-active .icon { color: var(--primary); }
.nav-item .icon { color: var(--text-muted); }

.sidebar-section { margin-top: 8px; }
.sidebar-heading {
  display: flex; align-items: center; justify-content: space-between;
  gap: 6px; padding: 6px 10px;
  font-size: 12px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--text-faint);
}
.sidebar-heading .icon { width: 14px; height: 14px; }
.sidebar-heading > span { display: inline-flex; align-items: center; gap: 7px; }
.project-link {
  display: flex; align-items: center; gap: 9px;
  padding: 7px 10px; border-radius: var(--r-sm);
  color: var(--text); font-weight: 500;
}
.project-link:hover { background: var(--surface-2); text-decoration: none; }
.project-link-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-dot { width: 11px; height: 11px; border-radius: 4px; flex: none; }
.sidebar-empty, .sidebar-allprojects {
  display: flex; align-items: center; gap: 6px;
  padding: 7px 10px; color: var(--text-muted); font-size: 13px;
}
.sidebar-allprojects .icon { width: 14px; height: 14px; }
.sidebar-backdrop { display: none; }

/* ---------- Barre supérieure ---------------------------------------- */
.topbar {
  height: var(--topbar-h);
  display: flex; align-items: center; gap: 14px;
  padding: 0 24px;
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  position: sticky; top: 0; z-index: 30;
}
.sidebar-show { display: none; }
.search-box {
  flex: 1; max-width: 520px;
  display: flex; align-items: center; gap: 8px;
  background: var(--bg); border: 1px solid var(--border);
  border-radius: 999px; padding: 7px 14px;
}
.search-box:focus-within { border-color: var(--primary); background: #fff; }
.search-icon { width: 16px; height: 16px; color: var(--text-muted); }
.search-box input { flex: 1; border: none; background: transparent; outline: none; font-size: 14px; font-family: inherit; color: var(--text); }
.topbar-actions { display: flex; align-items: center; gap: 12px; margin-left: auto; }

/* ---------- Avatars -------------------------------------------------- */
.avatar {
  display: inline-flex; align-items: center; justify-content: center;
  border-radius: 50%; color: #fff; font-weight: 650; flex: none;
  background: var(--text-faint);
}
.avatar-sm { width: 26px; height: 26px; font-size: 11px; }
.avatar-md { width: 34px; height: 34px; font-size: 13px; }
.avatar-lg { width: 56px; height: 56px; font-size: 20px; }
.avatar-empty { background: transparent; border: 1.5px dashed var(--border-strong); color: var(--text-faint); }
.avatar-photo { object-fit: cover; background: var(--surface-2); }

/* ---------- Menus déroulants ---------------------------------------- */
.dropdown { position: relative; }
.dropdown > summary { list-style: none; cursor: pointer; }
.dropdown > summary::-webkit-details-marker { display: none; }
.dropdown-menu {
  position: absolute; z-index: 50; top: calc(100% + 6px); left: 0;
  min-width: 220px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  box-shadow: var(--shadow-lg);
  padding: 6px;
}
.dropdown-menu.dropdown-right { left: auto; right: 0; }
.dropdown-label { padding: 6px 10px; font-size: 11px; font-weight: 700; text-transform: uppercase; color: var(--text-faint); letter-spacing: .04em; }
.dropdown-item {
  display: flex; align-items: center; gap: 9px; width: 100%;
  padding: 8px 10px; border: none; background: transparent;
  border-radius: var(--r-sm); cursor: pointer; text-align: left;
  font-size: 14px; color: var(--text); font-family: inherit;
}
.dropdown-item:hover { background: var(--surface-2); text-decoration: none; }
.dropdown-item.is-active { background: var(--primary-soft); color: var(--primary); }
.dropdown-item .icon { width: 16px; height: 16px; color: var(--text-muted); }
.dropdown-item.danger .icon { color: var(--red); }
.dropdown-divider { height: 1px; background: var(--border); margin: 6px 4px; }
.dropdown-inline-form { display: flex; gap: 6px; padding: 6px; }
.dropdown-inline-form input { flex: 1; }

.user-summary { display: inline-flex; }
.user-card { padding: 8px 10px; }
.user-card-name { font-weight: 650; }
.user-card-email { color: var(--text-muted); font-size: 13px; }

/* ---------- Cartes & pages ------------------------------------------ */
.card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--r);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 18px;
}
.card-title { font-size: 15px; margin-bottom: 14px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.card-head .card-title { margin-bottom: 0; }
.card-link { font-size: 13px; font-weight: 600; }
.card-title .icon, .section-title .icon { width: 17px; height: 17px; color: var(--text-muted); vertical-align: -3px; }

.page-narrow { max-width: 720px; margin: 0 auto; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin-bottom: 20px; flex-wrap: wrap; }
.page-title { font-size: 22px; display: inline-flex; align-items: center; gap: 10px; }
.page-title .icon { width: 22px; height: 22px; color: var(--text-muted); }
.page-head-actions { display: flex; gap: 10px; align-items: center; }
.back-link { display: inline-flex; align-items: center; gap: 6px; color: var(--text-muted); font-weight: 600; font-size: 13px; margin-bottom: 6px; }
.back-link .icon { width: 16px; height: 16px; }
.section-title { font-size: 16px; display: flex; align-items: center; gap: 9px; margin-bottom: 14px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.subhead { font-size: 14px; margin: 18px 0 10px; }

.badge { display: inline-block; padding: 2px 9px; border-radius: 999px; font-size: 11px; font-weight: 700; }
.badge-muted { background: var(--bg); color: var(--text-muted); border: 1px solid var(--border); }
.badge-primary { background: var(--primary-soft); color: var(--primary); }
.badge-success { background: var(--green-soft); color: var(--green); }
.muted { color: var(--text-muted); }
.muted-link { color: var(--text-muted); font-size: 13px; }
.empty-hint { color: var(--text-muted); font-size: 14px; }

.empty-state {
  text-align: center; padding: 48px 24px; color: var(--text-muted);
  border: 1.5px dashed var(--border-strong); border-radius: var(--r-lg);
}
.empty-state .btn { margin-top: 14px; }
.empty-state.big { padding: 64px 24px; }
.empty-state.big h1 { font-size: 26px; margin: 16px 0 8px; }

/* ---------- Formulaires --------------------------------------------- */
.field { display: flex; flex-direction: column; gap: 6px; margin-bottom: 14px; }
.field-label { font-size: 13px; font-weight: 600; color: var(--text-muted); }
.field-hint { font-size: 12px; color: var(--text-faint); }
input[type=text], input[type=email], input[type=password], input[type=search],
input[type=date], textarea, select {
  width: 100%;
  border: 1px solid var(--border-strong);
  border-radius: var(--r-sm);
  padding: 9px 11px;
  font-size: 14px;
  font-family: inherit;
  color: var(--text);
  background: var(--surface);
  outline: none;
  transition: border-color .15s, box-shadow .15s;
}
input:focus, textarea:focus, select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-soft);
}
textarea { resize: vertical; }
.stacked-form { max-width: 480px; }
.form-row { display: flex; gap: 14px; flex-wrap: wrap; }
.form-row .field { flex: 1; min-width: 150px; }
.form-actions { display: flex; gap: 10px; align-items: center; margin-top: 8px; }
.inline-create { display: flex; gap: 10px; flex-wrap: wrap; }
.inline-create input { flex: 1; min-width: 200px; }
.inline-create.mt { margin-top: 12px; }
.form-foot { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; margin-top: 4px; }
.check-inline { display: inline-flex; align-items: center; gap: 8px; font-size: 14px; color: var(--text-muted); cursor: pointer; margin-bottom: 0; }
.check-inline input { width: auto; }
.admin-create-user { margin-top: 12px; }

.swatches { display: flex; gap: 8px; flex-wrap: wrap; }
.swatch { cursor: pointer; }
.swatch input { position: absolute; opacity: 0; width: 0; height: 0; }
.swatch-dot {
  display: block; width: 26px; height: 26px; border-radius: 50%;
  background: var(--c); border: 2px solid transparent; box-shadow: 0 0 0 2px transparent;
}
.swatch input:checked + .swatch-dot { box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--c); }
/* Pastille « couleur personnalisée » : un input color rond dans la rangée. */
.swatch-custom { display: inline-flex; }
.swatch-custom input[type=color] {
  width: 26px; height: 26px; padding: 0; border: 1px dashed var(--border-strong);
  border-radius: 50%; background: none; cursor: pointer; overflow: hidden;
}
.swatch-custom input[type=color]::-webkit-color-swatch-wrapper { padding: 2px; }
.swatch-custom input[type=color]::-webkit-color-swatch { border: none; border-radius: 50%; }
.swatch-custom input[type=radio]:checked + input[type=color] { border-style: solid; box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--primary); }

/* Sélecteur d'icône visuel (montre l'icône, pas son nom) */
.icon-picker { display: flex; gap: 8px; flex-wrap: wrap; }
.icon-opt { cursor: pointer; }
.icon-opt input { position: absolute; opacity: 0; width: 0; height: 0; }
.icon-opt-box {
  display: grid; place-items: center; width: 40px; height: 40px;
  border-radius: var(--r-sm); border: 1px solid var(--border-strong);
  background: var(--surface); color: var(--text-muted);
  transition: border-color .15s, color .15s, background .15s, box-shadow .15s;
}
.icon-opt-box .icon { width: 20px; height: 20px; }
.icon-opt:hover .icon-opt-box { border-color: var(--primary); color: var(--text); }
.icon-opt input:checked + .icon-opt-box {
  border-color: var(--primary); color: var(--primary);
  background: var(--primary-soft); box-shadow: 0 0 0 2px var(--primary-soft);
}
.icon-opt input:focus-visible + .icon-opt-box { box-shadow: 0 0 0 3px var(--primary-soft); }

/* Ajout rapide de tâche dans « Mes tâches » */
.mytask-add { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.mytask-add input[name="title"] { width: auto; min-width: 220px; flex: 1; }
.mytask-add select { width: auto; min-width: 150px; }
.mytask-add .btn { white-space: nowrap; }
@media (max-width: 640px) { .mytask-add { width: 100%; } .mytask-add input[name="title"] { min-width: 0; } }

/* ---------- Auth ----------------------------------------------------- */
.auth-shell { min-height: 100vh; display: flex; align-items: center; justify-content: center; padding: 24px; background: linear-gradient(160deg, #f3f1fb, #f6f7f9 60%); }
.auth-card { width: 100%; max-width: 420px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg); box-shadow: var(--shadow); padding: 32px; }
.auth-brand { text-align: center; margin-bottom: 18px; }
.auth-brand .brand-mark { margin: 0 auto 12px; }
.auth-brand h1 { font-size: 22px; }
.auth-tagline { color: var(--text-muted); margin: 6px 0 0; }
.auth-title { font-size: 18px; margin-bottom: 18px; text-align: center; }
.auth-form .btn { margin-top: 6px; }
.auth-switch { text-align: center; margin-top: 18px; color: var(--text-muted); }
.auth-info { color: var(--text-muted); text-align: center; margin-bottom: 18px; }
.invite-actions { display: flex; flex-direction: column; gap: 10px; }
.invite-card { text-align: center; }
.invite-card .brand-mark { margin: 0 auto 14px; }

/* ---------- Flash & toasts ------------------------------------------ */
.flash-stack { position: fixed; top: 14px; right: 18px; z-index: 100; display: flex; flex-direction: column; gap: 8px; max-width: min(560px, 90vw); }
.flash {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 12px 14px; border-radius: var(--r);
  box-shadow: var(--shadow); font-size: 14px;
  background: var(--surface); border: 1px solid var(--border);
}
.flash-text { flex: 1; word-break: break-word; }
.flash-success { border-left: 4px solid var(--green); }
.flash-error { border-left: 4px solid var(--red); }
.flash-close { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0; display: inline-flex; }
.flash-close .icon { width: 16px; height: 16px; }

.toast-stack { position: fixed; bottom: 18px; left: 50%; transform: translateX(-50%); z-index: 200; display: flex; flex-direction: column; gap: 8px; }
.toast { padding: 11px 18px; border-radius: var(--r); color: #fff; box-shadow: var(--shadow-lg); font-weight: 550; transition: opacity .25s, transform .25s; }
.toast-error { background: #2b2b30; }
.toast-success { background: var(--green); }
.toast-out { opacity: 0; transform: translateY(8px); }

/* ---------- Tâches : lignes, cartes --------------------------------- */
.task-check {
  width: 22px; height: 22px; flex: none;
  border: 1.6px solid var(--border-strong); border-radius: 50%;
  background: transparent; cursor: pointer; color: transparent;
  display: inline-flex; align-items: center; justify-content: center;
  transition: background .12s, border-color .12s, color .12s;
}
.task-check .icon { width: 13px; height: 13px; }
.task-check:hover { border-color: var(--green); color: var(--green); }
.task-check.sm { width: 18px; height: 18px; }
.is-completed .task-check { background: var(--green); border-color: var(--green); color: #fff; }

.task-row {
  display: flex; align-items: center; gap: 10px;
  padding: 9px 8px; border-bottom: 1px solid var(--border);
}
.task-row:hover { background: var(--surface-2); }
.task-title-btn { flex: 1; min-width: 0; text-align: left; background: none; border: none; cursor: pointer; font: inherit; color: var(--text); padding: 0; }
.task-title-text { display: inline-block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 100%; }
.is-completed .task-title-text, .is-completed .task-card-title, .is-completed .subtask-title, .is-completed .mytask-title { text-decoration: line-through; color: var(--text-faint); }
.task-row-tags { display: flex; gap: 5px; flex-wrap: wrap; }
.task-row-right { display: flex; align-items: center; gap: 10px; margin-left: auto; }

.task-meta-chip { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; color: var(--text-muted); }
.task-meta-chip .icon { width: 14px; height: 14px; }

.tag-pill {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 2px 9px; border-radius: 999px; font-size: 12px; font-weight: 600;
  color: color-mix(in srgb, var(--tag) 75%, #2a2a2a);
  background: color-mix(in srgb, var(--tag) 18%, #fff);
  border: 1px solid color-mix(in srgb, var(--tag) 35%, #fff);
}
.tag-pill.removable { padding-right: 5px; }
.tag-remove { border: none; background: none; cursor: pointer; color: inherit; font-size: 15px; line-height: 1; padding: 0 2px; }

.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 700; padding: 3px 9px; border-radius: 999px; max-width: 220px; }
.prio-custom { background: color-mix(in srgb, var(--tc) 16%, transparent); color: var(--tc); }
.prio-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--tc); flex: none; }
.prio-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.due { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); white-space: nowrap; }
.due .icon { width: 14px; height: 14px; }
.due.is-overdue { color: var(--red); }

/* Vue Liste */
.list-section { margin-bottom: 22px; }
.list-section-head { display: flex; align-items: center; gap: 8px; padding: 6px 4px; border-bottom: 2px solid var(--border); }
.list-section-toggle { background: none; border: none; cursor: pointer; color: var(--text-muted); padding: 0; display: inline-flex; }
.list-section-toggle .icon { transition: transform .15s; }
.list-section.is-collapsed .list-section-toggle .icon { transform: rotate(-90deg); }
.list-section.is-collapsed .list-section-tasks, .list-section.is-collapsed .quick-add { display: none; }
.list-section-name { font-size: 14px; }
.count-badge { font-size: 12px; font-weight: 700; color: var(--text-muted); background: var(--bg); border-radius: 999px; padding: 1px 8px; }
.section-menu { margin-left: auto; }

.quick-add { display: flex; align-items: center; gap: 8px; padding: 8px; border-bottom: 1px dashed var(--border); }
.quick-add-icon { width: 16px; height: 16px; color: var(--text-faint); }
.quick-add input { border: none; background: transparent; box-shadow: none; padding: 2px 0; }
.quick-add input:focus { box-shadow: none; }
.add-section { display: flex; gap: 8px; margin-top: 10px; max-width: 360px; }

/* Vue Tableau (Kanban) */
.board { display: flex; gap: 16px; align-items: flex-start; overflow-x: auto; padding-bottom: 16px; }
.board-column { width: 290px; flex: none; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-lg); padding: 12px; display: flex; flex-direction: column; gap: 10px; max-height: calc(100vh - 220px); }
.board-column-head { display: flex; align-items: center; gap: 8px; }
.board-column-name { font-weight: 650; font-size: 14px; }
.board-column-cards { display: flex; flex-direction: column; gap: 9px; overflow-y: auto; min-height: 24px; }
.task-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 11px 12px; box-shadow: var(--shadow-sm); cursor: grab; }
.task-card:hover { border-color: var(--border-strong); }
.card-ghost { opacity: .45; }
.task-card-head { display: flex; align-items: flex-start; gap: 8px; }
.task-card-title { flex: 1; text-align: left; background: none; border: none; cursor: pointer; font: inherit; font-weight: 550; color: var(--text); padding: 0; }
.task-card-tags { display: flex; gap: 5px; flex-wrap: wrap; margin: 9px 0 0 30px; }
.task-card-foot { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin: 10px 0 0 30px; }
.task-card-foot-left { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.board-quick-add input { background: var(--surface); border: 1px dashed var(--border-strong); }
.add-column { width: 290px; flex: none; }
.add-column input { background: rgba(255,255,255,.6); border: 1px dashed var(--border-strong); }

/* ---------- En-tête projet & onglets -------------------------------- */
.project-header { margin-bottom: 18px; }
.project-header-main { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.project-icon { display: inline-flex; align-items: center; justify-content: center; width: 30px; height: 30px; border-radius: 8px; color: #fff; }
.project-icon .icon { width: 17px; height: 17px; }
.project-icon.lg { width: 38px; height: 38px; border-radius: 10px; }
.project-icon.lg .icon { width: 20px; height: 20px; }
.project-header-name { font-size: 22px; }
.fav-btn { color: var(--text-faint); }
.fav-btn.is-fav { color: var(--amber); }
.fav-btn.is-fav .icon { fill: var(--amber); }
.project-menu { margin-left: auto; }
.project-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); }
.project-tab { display: inline-flex; align-items: center; gap: 7px; padding: 9px 14px; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.project-tab:hover { color: var(--text); text-decoration: none; }
.project-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.project-tab .icon { width: 16px; height: 16px; }

/* ---------- Tableau de bord ----------------------------------------- */
.dashboard-hero { margin-bottom: 22px; }
.dashboard-greeting { font-size: 28px; }
.dashboard-sub { color: var(--text-muted); margin: 4px 0 0; }
.dashboard-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 8px; }
.dashboard-section { margin-top: 14px; }
.project-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(220px, 1fr)); gap: 14px; }
.project-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; color: var(--text); transition: box-shadow .15s, transform .12s; }
.project-card:hover { box-shadow: var(--shadow); transform: translateY(-2px); text-decoration: none; }
.project-card-top { display: flex; align-items: center; justify-content: space-between; }
.project-card-name { font-weight: 650; font-size: 15px; }
.project-card-team { font-size: 12px; color: var(--text-muted); }
.project-card-progress { margin-top: auto; }
.progress-bar { height: 6px; background: var(--bg); border-radius: 999px; overflow: hidden; }
.progress-bar span { display: block; height: 100%; border-radius: 999px; }
.progress-text { font-size: 12px; color: var(--text-muted); }

.mini-task-list { list-style: none; margin: 0; padding: 0; }
.mini-task { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.mini-task:last-child { border-bottom: none; }
.mini-task-title { background: none; border: none; cursor: pointer; font: inherit; color: var(--text); text-align: left; padding: 0; flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mini-task-meta { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }

.activity-list { list-style: none; margin: 0; padding: 0; }
.activity-item { padding: 7px 0; border-bottom: 1px solid var(--border); font-size: 13px; color: var(--text-muted); }
.activity-item:last-child { border-bottom: none; }
.activity-actor { font-weight: 650; color: var(--text); }
.activity-target { color: var(--text); }
.activity-time { color: var(--text-faint); margin-left: 4px; }

/* ---------- My tasks / recherche ------------------------------------ */
.scope-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 16px; }
.scope-tab { padding: 9px 14px; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; }
.scope-tab:hover { color: var(--text); text-decoration: none; }
.scope-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.mytask-list { background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); overflow: hidden; }
.mytask-row { display: flex; align-items: center; gap: 12px; padding: 11px 14px; border-bottom: 1px solid var(--border); }
.mytask-row:last-child { border-bottom: none; }
.mytask-row:hover { background: var(--surface-2); }
.mytask-title { flex: 1; min-width: 0; background: none; border: none; cursor: pointer; font: inherit; color: var(--text); text-align: left; padding: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-chip { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); white-space: nowrap; }
.search-summary { color: var(--text-muted); margin-bottom: 18px; }
.search-block { margin-bottom: 24px; }
.search-projects { display: flex; flex-direction: column; gap: 8px; }
.search-project { display: inline-flex; align-items: center; gap: 9px; padding: 10px 12px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); color: var(--text); }
.search-project:hover { text-decoration: none; border-color: var(--border-strong); }

/* ---------- Tables / membres ---------------------------------------- */
.data-table { width: 100%; border-collapse: collapse; }
.data-table th { text-align: left; font-size: 12px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-faint); padding: 8px 10px; border-bottom: 1px solid var(--border); }
.data-table td { padding: 10px; border-bottom: 1px solid var(--border); vertical-align: middle; }
.cell-user { display: flex; align-items: center; gap: 10px; }
.cell-actions { text-align: right; }
.role-form select { width: auto; }
.members-layout { display: grid; grid-template-columns: 2fr 1fr; gap: 18px; align-items: start; }
.member-list { display: flex; flex-direction: column; gap: 4px; }
.member-row { display: flex; align-items: center; gap: 10px; padding: 6px 4px; }
.member-name { flex: 1; }
.member-add-select, .tag-add-select { margin-top: 10px; }
.invite-form { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; }
.invite-form input[type=email] { flex: 1; min-width: 200px; }
.invite-form select { width: auto; }
.invite-list, .team-list, .workspace-list { list-style: none; margin: 0; padding: 0; }
.invite-row { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding: 8px 0; border-bottom: 1px solid var(--border); }
.team-list li { padding: 6px 0; display: flex; gap: 8px; align-items: baseline; }
.workspace-row { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid var(--border); }
.workspace-info { flex: 1; display: flex; align-items: center; gap: 10px; }
.workspace-name { font-weight: 600; }
.workspace-actions { display: flex; align-items: center; gap: 8px; }

/* ---------- Profil --------------------------------------------------- */
.profile-head { display: flex; align-items: center; gap: 16px; margin-bottom: 20px; }
.profile-head .avatar-lg.avatar-photo { width: 56px; height: 56px; }
.profile-name { font-size: 18px; font-weight: 650; }
.profile-email { color: var(--text-muted); }
.profile-photo-form { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 8px; }
.profile-photo-form .btn { cursor: pointer; }

/* Lien vers une fiche de membre */
.user-link { color: var(--text); font-weight: 600; }
.user-link:hover { color: var(--primary); text-decoration: underline; }

/* Fiche d'un collègue */
.fiche-meta { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-top: 8px; }
.fiche-hours { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; color: var(--text-muted); }
.fiche-hours .icon { width: 15px; height: 15px; }
.fiche-bio { margin: 12px 0 0; color: var(--text); max-width: 60ch; }
.fiche-projects { display: flex; flex-wrap: wrap; gap: 8px; }
.fiche-page { width: 100%; }
.stat-grid--3 { grid-template-columns: repeat(3, 1fr); }
@media (max-width: 720px) { .stat-grid--3 { grid-template-columns: 1fr 1fr; } }

/* Présence / activité utilisateur */
.presence { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; }
.presence-dot { width: 8px; height: 8px; border-radius: 50%; flex: none; background: var(--text-faint); }
.presence-time { font-size: 11px; margin-top: 2px; }
.presence-online { color: var(--green); }
.presence-recent { color: var(--blue); }
.presence-away { color: var(--text-muted); }
.presence-inactive { color: var(--amber); }
.presence-dot.presence-online { background: var(--green); }
.presence-dot.presence-recent { background: var(--blue); }
.presence-dot.presence-away { background: var(--text-faint); }
.presence-dot.presence-inactive { background: var(--amber); }
.stat-num .presence-dot { display: inline-block; margin-right: 8px; vertical-align: middle; }
.stat-card--accent .presence-dot.presence-online { background: var(--on-primary); }

/* Temps d'activité par jour (fiche) */
.day-legend { display: flex; align-items: center; gap: 6px; font-size: 12px; color: var(--text-muted); margin-bottom: 14px; }
.lg-dot { width: 10px; height: 10px; border-radius: 3px; display: inline-block; }
.lg-dot.lg-active { background: var(--green); }
.lg-dot.lg-idle { background: var(--border-strong); margin-left: 10px; }
.day-activity { display: flex; flex-direction: column; gap: 10px; }
.dayrow { display: grid; grid-template-columns: 96px 1fr 210px; align-items: center; gap: 14px; }
.dayrow-date { font-size: 13px; color: var(--text-muted); white-space: nowrap; text-transform: capitalize; }
.dayrow-bar { display: flex; height: 14px; border-radius: 7px; overflow: hidden; background: var(--surface-2); }
.bar-active { background: var(--green); }
.bar-idle { background: var(--border-strong); }
.dayrow-vals { font-size: 12px; color: var(--text-muted); white-space: nowrap; text-align: right; }
.dayrow-vals .val-active { color: var(--green); font-weight: 650; }
.dayrow-vals .val-idle { color: var(--text); font-weight: 650; }
@media (max-width: 720px) {
  .dayrow { grid-template-columns: 72px 1fr; }
  .dayrow-vals { grid-column: 1 / -1; text-align: left; }
}

/* ---------- Aperçu projet ------------------------------------------- */
.overview-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; align-items: start; }
.overview-activity { grid-column: 1 / -1; }
.overview-desc { color: var(--text); }
.overview-meta { display: flex; gap: 28px; margin-top: 16px; }
.overview-meta-item { display: flex; flex-direction: column; gap: 4px; }
.meta-key { font-size: 12px; color: var(--text-faint); text-transform: uppercase; letter-spacing: .03em; }
.status-pill { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; font-weight: 700; padding: 4px 12px; border-radius: 999px; width: fit-content; background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.status-dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.team-desc { color: var(--text-muted); margin: -8px 0 18px; }

/* Statut sur les cartes de projet + pastille des onglets */
.pc-status { display: inline-flex; align-items: center; gap: 6px; font-size: 12px; font-weight: 600; color: var(--text-muted); margin-top: 2px; }
.pc-status .status-dot { width: 8px; height: 8px; }
.status-tab .tab-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; }

/* Gestion des statuts (paramètres de l'espace) */
.status-manage { display: flex; flex-direction: column; gap: 10px; margin: 14px 0; }
.status-row { display: flex; align-items: center; gap: 8px; }
.status-edit { display: flex; align-items: center; gap: 8px; flex: 1; margin: 0; }
.status-edit input[name="name"] { flex: 1; }
.status-add { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding-top: 12px; border-top: 1px solid var(--border); }
.status-add input[name="name"] { flex: 1; min-width: 180px; }
.status-row form { margin: 0; }
input[type=color] { width: 38px; height: 38px; padding: 2px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; flex: none; }

/* ---------- Étiquettes (gestion) ------------------------------------ */
.tag-form { display: flex; gap: 12px; align-items: center; flex-wrap: wrap; }
.tag-form input[type=text] { flex: 1; min-width: 180px; }
.tag-manage-list { list-style: none; margin: 0; padding: 0; }
.tag-manage-row { display: flex; align-items: center; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border); }
.tag-usage { color: var(--text-muted); font-size: 13px; margin-left: auto; }

/* ---------- Modale de tâche ----------------------------------------- */
/* Détail de tâche : panneau latéral droit façon Asana (grand, pleine hauteur). */
.modal-overlay { position: fixed; inset: 0; background: rgba(13,13,13,.5); display: flex; align-items: stretch; justify-content: flex-end; z-index: 300; }
.modal-dialog { width: min(920px, 96vw); height: 100vh; display: flex; }

/* ---------- Popup de confirmation ----------------------------------- */
.confirm-overlay { position: fixed; inset: 0; background: rgba(13,13,13,.55); display: flex; align-items: center; justify-content: center; z-index: 400; padding: 20px; }
.confirm-dialog {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-lg, 14px);
  box-shadow: 0 18px 50px rgba(0,0,0,.3); width: min(430px, 94vw);
  padding: 26px 26px 22px; text-align: center; animation: confirm-pop .16s ease-out;
}
@keyframes confirm-pop { from { opacity: 0; transform: scale(.94); } to { opacity: 1; transform: scale(1); } }
.confirm-icon { width: 46px; height: 46px; margin: 0 auto 12px; border-radius: 50%; background: var(--red-soft); color: var(--red); display: flex; align-items: center; justify-content: center; }
.confirm-icon svg { width: 24px; height: 24px; }
.confirm-title { font-size: 17px; margin: 0 0 6px; }
.confirm-message { color: var(--text-muted); font-size: 14px; margin: 0 0 20px; line-height: 1.5; }
.confirm-actions { display: flex; gap: 10px; justify-content: center; }
.btn-danger { background: var(--red); color: #fff; }
.btn-danger:hover { filter: brightness(.92); }
.task-modal { background: var(--surface); box-shadow: -24px 0 70px rgba(0,0,0,.45); display: flex; flex-direction: column; width: 100%; height: 100vh; animation: drawerIn .22s ease; }
@keyframes drawerIn { from { transform: translateX(36px); opacity: .5; } to { transform: none; opacity: 1; } }
.task-modal-bar { display: flex; align-items: center; justify-content: space-between; padding: 14px 20px; border-bottom: 1px solid var(--border); flex: none; }
.task-modal-bar-right { display: flex; align-items: center; gap: 8px; }
.task-modal-bar-right form { margin: 0; display: inline-flex; }
.task-complete-btn.is-completed { color: var(--green); }
.task-complete-btn.is-completed .icon { color: var(--green); }
.task-modal-body { padding: 24px 32px 40px; flex: 1; overflow-y: auto; }
.task-form-title { font-size: 20px; font-weight: 650; border: none; padding: 6px 0; margin-bottom: 8px; }
.task-form-title:focus { box-shadow: none; }
.task-form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; margin-bottom: 14px; }
.task-form-actions { display: flex; align-items: center; gap: 12px; }
.task-form-status { font-size: 13px; color: var(--green); font-weight: 600; }
.task-section { border-top: 1px solid var(--border); padding-top: 16px; margin-top: 18px; }
.task-section-title { font-size: 13px; text-transform: uppercase; letter-spacing: .03em; color: var(--text-muted); display: flex; align-items: center; gap: 8px; margin-bottom: 12px; }
.task-section-title .icon { width: 15px; height: 15px; }
.task-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-bottom: 10px; }
.subtasks { display: flex; flex-direction: column; }
.subtask-row { display: flex; align-items: center; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--border); }
.subtask-title { flex: 1; text-align: left; background: none; border: none; cursor: pointer; font: inherit; color: var(--text); padding: 0; }
.subtask-add { display: flex; gap: 8px; margin-top: 10px; }
.subtask-add input { flex: 1; }
.comments { display: flex; flex-direction: column; gap: 14px; margin-bottom: 12px; }
.comment { display: flex; gap: 10px; }
.comment-body { flex: 1; }
.comment-head { display: flex; align-items: baseline; gap: 8px; }
.comment-author { font-weight: 650; }
.comment-time { font-size: 12px; color: var(--text-faint); }
.comment-text { white-space: pre-wrap; }
.comment-add { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.comment-add textarea { width: 100%; }
.comment-add-foot { display: flex; align-items: center; gap: 12px; width: 100%; }
.comment-add-foot .btn { margin-left: auto; }
.att-input-label { display: inline-flex; align-items: center; gap: 6px; cursor: pointer; font-size: 13px; font-weight: 600; color: var(--text-muted); padding: 6px 10px; border: 1px solid var(--border-strong); border-radius: var(--r-sm); transition: border-color .15s, color .15s; }
.att-input-label:hover { border-color: var(--primary); color: var(--primary); }
.att-input-label .icon { width: 16px; height: 16px; }
.att-chosen { font-size: 12px; color: var(--text-faint); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 40%; }

/* Pièces jointes affichées dans un commentaire */
.comment-attachments { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.att-img { display: block; line-height: 0; border-radius: var(--r-sm); overflow: hidden; border: 1px solid var(--border); }
.att-img img { width: 96px; height: 96px; object-fit: cover; display: block; }
.att-file { display: inline-flex; align-items: center; gap: 7px; max-width: 240px; padding: 7px 11px; border: 1px solid var(--border); border-radius: var(--r-sm); background: var(--surface-2); color: var(--text); font-size: 13px; }
.att-file:hover { border-color: var(--primary); text-decoration: none; }
.att-file .icon { width: 16px; height: 16px; color: var(--text-muted); flex: none; }
.att-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Pièce jointe avec bouton de suppression (vignette/puce) */
.att-wrap { position: relative; display: inline-flex; }
.att-del {
  position: absolute; top: -6px; right: -6px; width: 18px; height: 18px;
  border-radius: 50%; border: 2px solid var(--surface); background: var(--red);
  color: #fff; font-size: 12px; line-height: 1; cursor: pointer; padding: 0;
  display: none; align-items: center; justify-content: center;
}
.att-wrap:hover .att-del { display: inline-flex; }
.task-attach { margin-top: 12px; }

/* Éditeur de description (WYSIWYG) */
.wysiwyg { border: 1px solid var(--border-strong); border-radius: var(--r-sm); background: var(--surface); overflow: hidden; }
.wysiwyg:focus-within { border-color: var(--primary); }
.wysiwyg-toolbar { display: flex; align-items: center; gap: 2px; padding: 5px 6px; border-bottom: 1px solid var(--border); background: var(--surface-2); flex-wrap: wrap; }
.wz-btn { min-width: 30px; height: 28px; padding: 0 8px; border: none; background: none; border-radius: var(--r-sm); cursor: pointer; color: var(--text-muted); font-size: 14px; font-family: inherit; display: inline-flex; align-items: center; justify-content: center; }
.wz-btn:hover { background: var(--surface-3); color: var(--text); }
.wz-btn .icon { width: 15px; height: 15px; }
.wz-sep { width: 1px; height: 18px; background: var(--border); margin: 0 4px; }
.wysiwyg-editor { min-height: 200px; max-height: 460px; overflow-y: auto; padding: 14px 16px; font-size: 14.5px; line-height: 1.6; color: var(--text); outline: none; }
.wysiwyg-editor:empty:before { content: attr(data-placeholder); color: var(--text-faint); pointer-events: none; }
.wysiwyg-editor p { margin: 0 0 8px; }
.wysiwyg-editor ul, .wysiwyg-editor ol { margin: 0 0 8px; padding-left: 22px; }
.wysiwyg-editor a { color: var(--primary); }
.wysiwyg-editor blockquote { border-left: 3px solid var(--border-strong); margin: 0 0 8px; padding-left: 12px; color: var(--text-muted); }
/* Filet de sécurité : jamais d'image plus large que l'éditeur. */
.wysiwyg-editor img { max-width: 100%; height: auto; border-radius: 6px; }

/* Dictée vocale : micro qui pulse pendant l'enregistrement. */
.wz-mic.is-recording { color: var(--red); animation: mic-pulse 1.2s ease-in-out infinite; }
@keyframes mic-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .4; } }

/* Collaborateurs de tâche : puces avatar + nom. */
.task-collabs { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 10px; }
.collab-chip { display: inline-flex; align-items: center; gap: 7px; padding: 4px 8px 4px 4px; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-pill); font-size: 13px; font-weight: 550; }
.collab-chip .tag-remove { margin-left: 2px; }

/* Pièce jointe vidéo : lecteur compact. */
.att-video { max-width: 320px; max-height: 200px; border-radius: 8px; border: 1px solid var(--border); background: #000; }

.task-page-card { padding: 0; }
/* Vue pleine page : la fiche n'est pas un tiroir (annule hauteur/animation/ombre). */
.task-page-card .task-modal { box-shadow: none; height: auto; width: 100%; animation: none; }
.task-page-card .task-modal-body { max-height: none; overflow: visible; flex: none; }

/* ---------- Page d'erreur ------------------------------------------- */
.error-page { display: flex; align-items: center; justify-content: center; min-height: 100vh; background: var(--bg); }
.error-box { text-align: center; }
.error-code { font-size: 72px; font-weight: 800; color: var(--primary); }
.error-message { font-size: 18px; color: var(--text-muted); margin: 8px 0 22px; }

/* ---------- Responsive ---------------------------------------------- */
@media (max-width: 980px) {
  .dashboard-grid, .overview-grid, .members-layout { grid-template-columns: 1fr; }
}
@media (max-width: 860px) {
  .sidebar {
    position: fixed; left: 0; top: 0; z-index: 60;
    transform: translateX(-100%); transition: transform .2s ease;
    box-shadow: var(--shadow-lg);
  }
  body.sidebar-open .sidebar { transform: translateX(0); }
  body.sidebar-open .sidebar-backdrop { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.35); z-index: 55; }
  .sidebar-show { display: inline-flex; }
  .sidebar-hide { display: inline-flex; }
  .app-content { padding: 18px 16px 56px; }
  .topbar { padding: 0 14px; }
  .task-form-grid { grid-template-columns: 1fr; }
  .btn-label { display: none; }
}

body.modal-open { overflow: hidden; }

/* =====================================================================
   THÈME « Lavande Studio » — surcharge de tokens + composants refondus.
   Déclaré en fin de fichier : ces :root écrasent les valeurs précédentes.
   ===================================================================== */
:root {
  /* Marque / primaire */
  --primary: #7c5cfc;
  --primary-hover: #6a47f5;
  --primary-soft: #efeafe;
  --primary-softer: #f6f3ff;
  --primary-grad: linear-gradient(135deg, #7c5cfc 0%, #9d7bff 100%);
  --primary-grad-hover: linear-gradient(135deg, #6a47f5 0%, #8e6bff 100%);

  /* Page & coquille flottante */
  --page-grad: linear-gradient(160deg, #efeafe 0%, #f6f4fd 38%, #fbfaff 100%);
  --surface-3: #f5f4fb;
  --rail-w: 76px;

  /* Rayons (plus doux) */
  --r-sm: 8px;
  --r: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;

  /* Ombres teintées violet */
  --shadow-sm: 0 1px 2px rgba(86, 60, 180, .06);
  --shadow: 0 8px 24px rgba(86, 60, 180, .10);
  --shadow-lg: 0 18px 50px rgba(40, 30, 90, .20);
  --shadow-card: 0 6px 18px rgba(86, 60, 180, .07);
  --shadow-card-hover: 0 14px 34px rgba(86, 60, 180, .16);
  --shadow-badge: 0 6px 14px rgba(60, 45, 130, .22);

  /* Pastilles d'échéance */
  --pill-soon-bg: #fbeed0; --pill-soon-fg: #9a6700;
  --pill-ok-bg: #e7efff;   --pill-ok-fg: #2f6fd0;
  --pill-late-bg: #fde8eb; --pill-late-fg: #d12c43;
  --pill-done-bg: #e3f5ea; --pill-done-fg: #1f8a4c;
  --pill-none-bg: #f0f0f6; --pill-none-fg: #6b6f76;
}

h1, h2, h3, h4 { letter-spacing: -.01em; }

/* --- Coquille flottante arrondie sur fond lavande -------------------- */
body { background: var(--page-grad); background-attachment: fixed; }
body.has-app .app-shell {
  background: #fff;
  margin: 16px;
  border-radius: 24px;
  overflow: hidden;
  box-shadow: 0 24px 70px rgba(86, 60, 180, .14), 0 4px 14px rgba(60, 40, 120, .06);
  min-height: calc(100vh - 32px);
}
@media (min-width: 1480px) {
  body.has-app .app-shell { max-width: 1440px; margin: 20px auto; }
}
.sidebar { border-right: none; background: #fbfaff; }
.topbar { background: transparent; border-bottom: none; height: 60px; padding: 0 28px; gap: 14px; }
.app-content { padding: 24px 28px 56px; }

/* --- Barre supérieure : cloche + chip utilisateur ------------------- */
.icon-btn { position: relative; }
.topbar-bell .notif-dot {
  position: absolute; top: 6px; right: 6px; width: 8px; height: 8px;
  background: var(--red); border-radius: 50%; border: 2px solid #fff;
}
.page-title .notif-dot {
  display: inline-block; width: 8px; height: 8px; vertical-align: middle;
  background: var(--red); border-radius: 50%; margin-left: 2px;
}
.user-chip {
  display: inline-flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px;
  border: 1px solid var(--border); border-radius: var(--r-pill); background: var(--surface); cursor: pointer;
}
.user-chip:hover { background: var(--surface-2); }
.user-chip-name { font-weight: 600; font-size: 13px; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.user-chip-caret { width: 15px; height: 15px; color: var(--text-muted); }
.search-box:focus-within { border-color: var(--primary); box-shadow: 0 0 0 3px var(--primary-soft); background: #fff; }

/* --- Boutons : pilule dégradée violette ---------------------------- */
.btn-primary { background: var(--primary-grad); color: #fff; border: none; box-shadow: 0 6px 16px rgba(124, 92, 252, .32); }
.btn-primary:hover { background: var(--primary-grad-hover); box-shadow: 0 8px 20px rgba(124, 92, 252, .40); }
.btn.btn-pill { border-radius: var(--r-pill); padding: 9px 18px; }

/* --- Barre latérale en rail d'icônes ------------------------------- */
.sidebar.sidebar--rail { width: var(--rail-w); flex: none; padding: 16px 0; gap: 6px; align-items: center; background: #fbfaff; overflow: visible; }
.sidebar--rail .brand-name,
.sidebar--rail .ws-name,
.sidebar--rail .ws-caret,
.sidebar--rail .nav-label,
.sidebar--rail .sidebar-section,
.sidebar--rail .sidebar-hide { display: none; }
.sidebar--rail .sidebar-top { justify-content: center; padding: 0 0 12px; }
.brand-mark--rail { width: 42px; height: 42px; border-radius: 14px; font-size: 20px; background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-badge); }
.sidebar--rail .sidebar-nav { gap: 6px; align-items: center; width: auto; }
.sidebar--rail .nav-item { position: relative; width: 44px; height: 44px; padding: 0; gap: 0; justify-content: center; border-radius: 14px; color: var(--text-faint); }
.sidebar--rail .nav-item .icon { width: 21px; height: 21px; color: inherit; }
.sidebar--rail .nav-item:hover { background: var(--primary-softer); color: var(--primary); }
.sidebar--rail .nav-item.is-active { background: var(--primary-grad); color: #fff; box-shadow: var(--shadow-badge); }
.sidebar--rail .nav-item.is-active .icon { color: #fff; }
.sidebar--rail .ws-switcher { margin-top: auto; }
.sidebar--rail .ws-current { padding: 0; justify-content: center; }
.sidebar--rail .ws-avatar { width: 40px; height: 40px; border-radius: 13px; font-size: 15px; background: linear-gradient(135deg, #5fd6a0, #2bb673); color: #fff; }
.sidebar--rail .ws-switcher .dropdown-menu { left: calc(100% + 10px); top: auto; bottom: 0; }

/* --- En-tête de page Projets + onglets de statut ------------------- */
.projects-head { margin-bottom: 8px; }
.status-tabs { display: flex; gap: 4px; flex-wrap: wrap; border-bottom: 1px solid var(--border); margin: 4px 0 22px; }
.status-tab { display: inline-flex; align-items: center; gap: 8px; padding: 10px 14px; color: var(--text-muted); font-weight: 600; border-bottom: 2px solid transparent; margin-bottom: -1px; white-space: nowrap; }
.status-tab:hover { color: var(--text); text-decoration: none; }
.status-tab.is-active { color: var(--primary); border-bottom-color: var(--primary); }
.status-tab .count-badge { font-size: 11px; font-weight: 700; padding: 3px 7px; border-radius: var(--r-pill); background: var(--surface-3); color: var(--text-muted); }
.status-tab.is-active .count-badge { background: var(--primary-soft); color: var(--primary); }
.status-tab:not(.is-active) .count-badge.on { background: #e3f5ea; color: #1f9d55; }
.status-tab:not(.is-active) .count-badge.at { background: #fbeed0; color: #e08a00; }
.status-tab:not(.is-active) .count-badge.off { background: #fde8eb; color: #e8384f; }

/* --- Disposition deux colonnes ------------------------------------- */
.projects-layout { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 24px; align-items: start; }
.projects-rail { display: flex; flex-direction: column; gap: 18px; position: sticky; top: 16px; }
@media (max-width: 1100px) {
  .projects-layout { grid-template-columns: 1fr; }
  .projects-rail { order: -1; position: static; flex-direction: row; flex-wrap: wrap; }
  .projects-rail .rail-card, .projects-rail .stat-grid { flex: 1; min-width: 240px; }
}

/* --- Carte projet enrichie ----------------------------------------- */
.project-card--rich { position: relative; align-items: center; text-align: center; gap: 0; padding: 22px 18px 16px; border-radius: var(--r-lg); box-shadow: var(--shadow-card); border: 1px solid var(--border); }
.project-card--rich:hover { box-shadow: var(--shadow-card-hover); transform: translateY(-3px); }
.card-archived { position: absolute; top: 12px; right: 12px; }
.pc-badge { width: 56px; height: 56px; border-radius: var(--r-lg); display: inline-flex; align-items: center; justify-content: center; color: #fff; box-shadow: var(--shadow-badge); margin-bottom: 12px; }
.pc-badge .icon { width: 26px; height: 26px; }
.pc-name { font-weight: 650; font-size: 15px; line-height: 1.25; }
.pc-team { font-size: 12px; color: var(--text-muted); margin-top: 2px; }
.pc-avatars { margin: 14px 0 16px; }
.pc-avatars .avatar-stack { justify-content: center; }
.pc-avatars .avatar-stack .avatar { border: 2px solid var(--surface); margin-left: -8px; box-shadow: 0 1px 2px rgba(31, 29, 43, .10); }
.pc-avatars .avatar-stack .avatar:first-child { margin-left: 0; }
.pc-avatars .avatar-more { background: var(--surface-3); color: var(--text-muted); font-weight: 700; }
.pc-progress { width: 100%; }
.pc-progress-head { display: flex; justify-content: space-between; font-size: 12px; color: var(--text-muted); font-weight: 600; margin-bottom: 6px; }
.pc-pct { color: var(--green); font-weight: 700; }
.project-card--rich .progress-bar { height: 7px; background: var(--surface-3); }
.project-card--rich .progress-bar span { background: linear-gradient(90deg, #34c97f, #1f9d55); }
.pc-foot { display: flex; align-items: center; gap: 12px; width: 100%; margin-top: 14px; padding-top: 13px; border-top: 1px solid var(--border); }
.pc-meta { display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600; color: var(--text-muted); }
.pc-meta .icon { width: 15px; height: 15px; }
.pc-meta--done { color: var(--green); }
.pc-pill { margin-left: auto; display: inline-flex; align-items: center; gap: 5px; padding: 4px 10px; border-radius: var(--r-pill); font-size: 11px; font-weight: 700; white-space: nowrap; }
.pc-pill .icon { width: 13px; height: 13px; }
.pc-pill.pill-soon { background: var(--pill-soon-bg); color: var(--pill-soon-fg); }
.pc-pill.pill-ok { background: var(--pill-ok-bg); color: var(--pill-ok-fg); }
.pc-pill.pill-late { background: var(--pill-late-bg); color: var(--pill-late-fg); }
.pc-pill.pill-done { background: var(--pill-done-bg); color: var(--pill-done-fg); }
.pc-pill.pill-none { background: var(--pill-none-bg); color: var(--pill-none-fg); }

/* --- Panneau de droite : anneau, activités, stats ------------------- */
.rail-card { margin-bottom: 0; padding: 18px; box-shadow: var(--shadow-card); }
.rail-title { font-size: 15px; font-weight: 650; margin-bottom: 14px; }
.donut-wrap { display: flex; flex-direction: column; align-items: center; gap: 16px; }
.donut { width: 132px; height: 132px; border-radius: 50%; position: relative; }
.donut-hole { position: absolute; inset: 26px; background: #fff; border-radius: 50%; display: grid; place-items: center; box-shadow: inset 0 0 0 1px var(--border); }
.donut-num { font-size: 22px; font-weight: 750; line-height: 1; }
.donut-sub { font-size: 11px; color: var(--text-muted); }
.donut-legend { list-style: none; margin: 0; padding: 0; width: 100%; display: flex; flex-direction: column; gap: 8px; }
.donut-legend li { display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--text-muted); }
.legend-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.legend-label { flex: 1; }
.legend-count { font-weight: 700; color: var(--text); }
.rail-activities { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 14px; }
.rail-activity { display: flex; gap: 10px; }
.rail-activity-body { flex: 1; min-width: 0; }
.rail-activity-text { font-size: 13px; line-height: 1.35; }
.rail-actor { font-weight: 650; }
.rail-activity-time { font-size: 11px; color: var(--text-faint); margin-top: 2px; }
.stat-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.stat-card { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); padding: 16px 14px; box-shadow: var(--shadow-card); }
.stat-num { font-size: 24px; font-weight: 750; line-height: 1; }
.stat-lbl { font-size: 12px; color: var(--text-muted); margin-top: 6px; font-weight: 550; }
.stat-card--accent { background: var(--primary-grad); border: none; color: #fff; box-shadow: 0 8px 20px rgba(124, 92, 252, .30); }
.stat-card--accent .stat-num { color: #fff; }
.stat-card--accent .stat-lbl { color: rgba(255, 255, 255, .85); }

/* --- Drawer mobile : ré-afficher les libellés du rail -------------- */
@media (max-width: 860px) {
  .sidebar.sidebar--rail { width: var(--sidebar-w); align-items: stretch; padding: 12px; }
  .sidebar--rail .brand-name,
  .sidebar--rail .ws-name,
  .sidebar--rail .ws-caret,
  .sidebar--rail .nav-label,
  .sidebar--rail .sidebar-section,
  .sidebar--rail .sidebar-hide { display: revert; }
  .sidebar--rail .nav-item { width: auto; height: auto; padding: 8px 10px; gap: 11px; justify-content: flex-start; }
  .sidebar--rail .sidebar-nav { align-items: stretch; }
  .sidebar--rail .ws-current { padding: 8px; justify-content: flex-start; }
}

/* =====================================================================
   Vue Calendrier
   ===================================================================== */
.cal-toolbar { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; }
.cal-month { font-size: 18px; text-transform: capitalize; min-width: 180px; text-align: center; }
.cal-today { margin-left: auto; }
.calendar { background: #fff; border: 1px solid var(--border); border-radius: var(--r-lg); overflow: hidden; box-shadow: var(--shadow-card); }
.cal-weekdays { display: grid; grid-template-columns: repeat(7, 1fr); background: var(--surface-2); border-bottom: 1px solid var(--border); }
.cal-weekday { padding: 10px; text-align: center; font-size: 12px; font-weight: 700; color: var(--text-muted); text-transform: uppercase; letter-spacing: .03em; }
.cal-grid { display: grid; grid-template-columns: repeat(7, 1fr); }
.cal-day { min-height: 112px; border-right: 1px solid var(--border); border-bottom: 1px solid var(--border); padding: 6px; display: flex; flex-direction: column; gap: 4px; }
.cal-day:nth-child(7n) { border-right: none; }
.cal-day.is-out { background: var(--surface-2); }
.cal-daynum { font-size: 12px; font-weight: 600; color: var(--text-muted); width: 24px; height: 24px; display: grid; place-items: center; border-radius: 50%; }
.cal-day.is-out .cal-daynum { color: var(--text-faint); }
.cal-day.is-today .cal-daynum { background: var(--primary-grad); color: #fff; }
.cal-tasks { display: flex; flex-direction: column; gap: 3px; }
.cal-task { display: block; width: 100%; text-align: left; border: none; background: var(--primary-softer); color: var(--text); border-left: 3px solid var(--primary); border-radius: 6px; padding: 3px 7px; font: inherit; font-size: 11px; cursor: pointer; overflow: hidden; }
.cal-task:hover { background: var(--primary-soft); }
.cal-task-text { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.cal-task.is-completed .cal-task-text { text-decoration: line-through; color: var(--text-faint); }
.cal-task.prio-edge-high { border-left-color: var(--red); background: var(--red-soft); }
.cal-task.prio-edge-medium { border-left-color: var(--amber); background: var(--amber-soft); }
.cal-task.prio-edge-low { border-left-color: #2f6fd0; background: #e7efff; }
.cal-task.prio-edge-none { border-left-color: var(--border-strong); background: var(--surface-2); }
.cal-more { font-size: 11px; color: var(--text-muted); padding: 1px 7px; }
@media (max-width: 640px) { .cal-day { min-height: 78px; } .cal-task { font-size: 10px; } }

/* =====================================================================
   Panneau d'administration
   ===================================================================== */
.admin-stats { display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px; margin-bottom: 18px; }
@media (max-width: 760px) { .admin-stats { grid-template-columns: 1fr 1fr; } }
.row-actions { display: inline-flex; align-items: center; gap: 8px; justify-content: flex-end; }
/* Gestion d'équipes : sous-menu + champ mot de passe avec générateur. */
.admin-nav { margin-bottom: 18px; }
.pw-generate { display: flex; gap: 8px; align-items: center; }
.pw-generate input { flex: 1; min-width: 0; }
.pw-generate .btn { flex: none; }
/* Modale « Modifier l'utilisateur » : grille des pôles. */
.ue-poles { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 8px 12px; }
/* Colonne « Pôles » : badges + sélecteur d'attribution compact. */
.pole-badges { display: flex; flex-wrap: wrap; gap: 4px; align-items: center; max-width: 320px; }
.pole-add-form select { width: auto; font-size: 12px; padding: 3px 6px; }

/* Gestion d'équipes : équipes regroupées par pôle. */
.admin-teams { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 14px; margin-top: 12px; }
.admin-teams-pole { border: 1px solid var(--border); border-radius: var(--r); padding: 12px 14px; }
.admin-teams-pole-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.admin-team-row { display: flex; align-items: center; gap: 8px; padding: 6px 0; border-top: 1px solid var(--border); }
.admin-team-link { font-weight: 600; flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.admin-team-row .row-actions { display: flex; align-items: center; gap: 6px; }
.admin-team-add { margin-top: 10px; }
.admin-team-add input { min-width: 0; }

.admin-projects { display: flex; flex-wrap: wrap; gap: 8px; }
.admin-project { display: inline-flex; align-items: center; gap: 8px; padding: 8px 12px; border: 1px solid var(--border); border-radius: var(--r); color: var(--text); font-size: 13px; }
.admin-project:hover { background: var(--surface-2); text-decoration: none; border-color: var(--border-strong); }
.admin-project-name { font-weight: 600; }

/* =====================================================================
   Mes tâches : sélecteur de vue + filtres en pastilles + tableau
   ===================================================================== */
.mytasks-tabs { margin-bottom: 18px; }
.filter-pills { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 20px; }
.filter-pill { padding: 6px 14px; border-radius: var(--r-pill); border: 1px solid var(--border); color: var(--text-muted); font-weight: 600; font-size: 13px; background: var(--surface); }
.filter-pill:hover { background: var(--surface-2); text-decoration: none; }
.filter-pill.is-active { background: var(--primary-soft); color: var(--primary); border-color: transparent; }

.mytasks-board .board-column { width: 264px; }
.mt-card { background: #fff; border: 1px solid var(--border); border-radius: var(--r); padding: 10px 12px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 8px; }
.mt-card:hover { border-color: var(--border-strong); }
.mt-card-top { display: flex; align-items: flex-start; gap: 8px; }
.mt-card-title { flex: 1; text-align: left; background: none; border: none; cursor: pointer; font: inherit; font-weight: 550; color: var(--text); padding: 0; }
.mt-card.is-completed .mt-card-title { text-decoration: line-through; color: var(--text-faint); }
.mt-card-meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; padding-left: 26px; }
.mt-col-empty { color: var(--text-faint); font-size: 12px; text-align: center; padding: 10px 4px; }

/* =====================================================================
   THÈMES — Midnight (sombre, défaut) + Clair, pilotés par html[data-theme].
   Déclarés en fin de fichier : surchargent tous les :root précédents.
   ===================================================================== */
:root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0b1120;
  --page-grad: linear-gradient(160deg, #0b1120 0%, #0f172a 55%, #0b1120 100%);
  --shell-bg: #0f1729;
  --sidebar-bg: #0c1322;
  --surface: #131c2e;
  --surface-2: #1a2438;
  --surface-3: #202c45;
  --border: #243049;
  --border-strong: #33415c;
  --text: #e6edf6;
  --text-muted: #9fb0c3;
  --text-faint: #6b7a90;

  --primary: #38bdf8;
  --primary-hover: #0ea5e9;
  --primary-soft: #15293f;
  --primary-softer: #122033;
  --primary-grad: linear-gradient(135deg, #2563eb 0%, #22d3ee 100%);
  --primary-grad-hover: linear-gradient(135deg, #1d4ed8 0%, #06b6d4 100%);

  --green: #34d399;  --green-soft: rgba(52, 211, 153, .16);
  --red: #f87171;    --red-soft: rgba(248, 113, 113, .16);
  --amber: #fbbf24;  --amber-soft: rgba(251, 191, 36, .16);
  --blue: #60a5fa;   --blue-soft: rgba(96, 165, 250, .16);

  --pill-soon-bg: rgba(251, 191, 36, .16); --pill-soon-fg: #fcd34d;
  --pill-ok-bg: rgba(96, 165, 250, .18);   --pill-ok-fg: #93c5fd;
  --pill-late-bg: rgba(248, 113, 113, .18);--pill-late-fg: #fca5a5;
  --pill-done-bg: rgba(52, 211, 153, .18); --pill-done-fg: #6ee7b7;
  --pill-none-bg: rgba(148, 163, 184, .14);--pill-none-fg: #9fb0c3;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, .45);
  --shadow: 0 10px 28px rgba(0, 0, 0, .5);
  --shadow-lg: 0 22px 55px rgba(0, 0, 0, .65);
  --shadow-card: 0 4px 14px rgba(0, 0, 0, .38);
  --shadow-card-hover: 0 14px 32px rgba(0, 0, 0, .55);
  --shadow-badge: 0 6px 14px rgba(0, 0, 0, .5);
  --coral: #f06a6a;
}

:root, :root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef2f7;
  --page-grad: linear-gradient(160deg, #eaf0f8 0%, #f4f7fb 55%, #fbfcfe 100%);
  --shell-bg: #ffffff;
  --sidebar-bg: #f7f9fc;
  --surface: #ffffff;
  --surface-2: #f5f7fb;
  --surface-3: #eef2f7;
  --border: #e4e9f1;
  --border-strong: #cfd8e4;
  --text: #0f172a;
  --text-muted: #5b6776;
  --text-faint: #94a3b8;

  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-soft: #e7effe;
  --primary-softer: #f1f6fe;
  --primary-grad: linear-gradient(135deg, #2563eb 0%, #38bdf8 100%);
  --primary-grad-hover: linear-gradient(135deg, #1d4ed8 0%, #0ea5e9 100%);

  --green: #1f9d55;  --green-soft: #e3f5ea;
  --red: #e8384f;    --red-soft: #fde8eb;
  --amber: #e08a00;  --amber-soft: #fbeed0;
  --blue: #2f6fd0;   --blue-soft: #e7efff;

  --pill-soon-bg: #fbeed0; --pill-soon-fg: #9a6700;
  --pill-ok-bg: #e7efff;   --pill-ok-fg: #2f6fd0;
  --pill-late-bg: #fde8eb; --pill-late-fg: #d12c43;
  --pill-done-bg: #e3f5ea; --pill-done-fg: #1f8a4c;
  --pill-none-bg: #eef1f6; --pill-none-fg: #5b6776;

  --shadow-sm: 0 1px 2px rgba(15, 23, 42, .06);
  --shadow: 0 8px 24px rgba(15, 23, 42, .10);
  --shadow-lg: 0 18px 50px rgba(15, 23, 42, .18);
  --shadow-card: 0 4px 14px rgba(15, 23, 42, .07);
  --shadow-card-hover: 0 14px 32px rgba(15, 23, 42, .14);
  --shadow-badge: 0 6px 14px rgba(37, 99, 235, .22);
  --coral: #f06a6a;
}

/* Surfaces autrefois codées en dur → tokens (valables dans les deux thèmes). */
body.has-app .app-shell { background: var(--shell-bg); box-shadow: var(--shadow-lg); border: 1px solid var(--border); }
.sidebar, .sidebar.sidebar--rail { background: var(--sidebar-bg); }
.calendar, .donut-hole, .stat-card, .mt-card { background: var(--surface); }
.auth-shell { background: var(--page-grad); }
.search-box { background: var(--surface-2); }
.cal-task.prio-edge-low { border-left-color: var(--blue); background: var(--blue-soft); }
.topbar-bell .notif-dot, .page-title .notif-dot { border-color: var(--shell-bg); }
.swatch input:checked + .swatch-dot { box-shadow: 0 0 0 2px var(--surface), 0 0 0 4px var(--c); }
.brand-mark, .brand-mark--rail { background: var(--primary-grad); }
.toast-error { background: var(--surface-3); color: var(--text); border: 1px solid var(--border); }
input::placeholder, textarea::placeholder { color: var(--text-faint); opacity: 1; }

/* Bascule de thème : afficher l'icône cible selon le thème courant. */
.theme-ic-sun, .theme-ic-moon { display: none; align-items: center; }
:root[data-theme="dark"] .theme-ic-sun { display: inline-flex; }
:root[data-theme="light"] .theme-ic-moon { display: inline-flex; }

/* =====================================================================
   Typographie auto-hébergée (CSP 'self') + Flat design
   ===================================================================== */
@font-face {
  font-family: 'Plus Jakarta Sans Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 200 800;
  src: url('/static/fonts/plus-jakarta-sans.woff2') format('woff2');
}
@font-face {
  font-family: 'Sora Variable';
  font-style: normal;
  font-display: swap;
  font-weight: 100 800;
  src: url('/static/fonts/sora.woff2') format('woff2');
}

:root {
  --font: 'Plus Jakarta Sans Variable', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Sora Variable', 'Plus Jakarta Sans Variable', -apple-system, sans-serif;
}

body { font-family: var(--font); }
h1, h2, h3, .page-title, .brand-name, .brand-mark,
.dashboard-greeting, .auth-brand h1, .card-title, .rail-title,
.pc-name, .stat-num, .donut-num, .project-header-name {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
}

/* Aplatissement : aplats de couleur, ombres minimales (les cartes s'appuient
   sur les bordures ; seules les couches flottantes gardent une légère ombre). */
:root[data-theme="dark"] {
  --page-grad: #0f1729;
  --primary-grad: #2563eb;
  --primary-grad-hover: #1d4ed8;
  --shadow-sm: none;
  --shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --shadow-card: none;
  --shadow-card-hover: none;
  --shadow-badge: none;
  --shadow-lg: 0 16px 40px rgba(0, 0, 0, .55);
}
:root, :root[data-theme="light"] {
  --page-grad: #eef1f6;
  --primary-grad: #2563eb;
  --primary-grad-hover: #1d4ed8;
  --shadow-sm: none;
  --shadow: 0 1px 2px rgba(15, 23, 42, .05);
  --shadow-card: none;
  --shadow-card-hover: none;
  --shadow-badge: none;
  --shadow-lg: 0 10px 30px rgba(15, 23, 42, .12);
}

body.has-app .app-shell { box-shadow: none; }
.btn-primary, .btn-primary:hover { box-shadow: none; }
.stat-card--accent { box-shadow: none; }
.project-card--rich .progress-bar span { background: var(--green); }
.project-card--rich:hover { transform: none; border-color: var(--primary); }
.project-card:hover { transform: none; }
.pc-badge { box-shadow: none; }

/* =====================================================================
   CHARTE « Dark & Électrique » — recolore les deux thèmes (sombre = défaut).
   Déclaré en dernier : surcharge les palettes précédentes.
   ===================================================================== */
:root, :root[data-theme="dark"] {
  color-scheme: dark;
  --bg: #0d0d0d;
  --page-grad: #0d0d0d;
  --shell-bg: #0d0d0d;
  --sidebar-bg: #0d0d0d;
  --surface: #161616;
  --surface-2: #1c1c1c;
  --surface-3: #242424;
  --border: #272727;
  --border-strong: #3a3a3a;
  --text: #ffffff;
  --text-muted: #a6a6a6;
  --text-faint: #6e6e6e;
  --primary: #00e56b;
  --primary-hover: #00c25c;
  --primary-soft: #11271b;
  --primary-softer: #0e1f16;
  --primary-grad: #00e56b;
  --primary-grad-hover: #00c25c;
  --on-primary: #0d0d0d;
  --green: #00e56b;  --green-soft: rgba(0, 229, 107, .16);
  --blue: #5ab4ff;   --blue-soft: rgba(90, 180, 255, .16);
  --red: #ff4d6a;    --red-soft: rgba(255, 77, 106, .16);
  --amber: #ffaa00;  --amber-soft: rgba(255, 170, 0, .16);
  --pill-soon-bg: rgba(255, 170, 0, .16);  --pill-soon-fg: #ffaa00;
  --pill-ok-bg: rgba(90, 180, 255, .16);   --pill-ok-fg: #5ab4ff;
  --pill-late-bg: rgba(255, 77, 106, .16); --pill-late-fg: #ff4d6a;
  --pill-done-bg: rgba(0, 229, 107, .16);  --pill-done-fg: #00e56b;
  --pill-none-bg: rgba(160, 160, 160, .14);--pill-none-fg: #a6a6a6;
}
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #eef4ec;
  --page-grad: linear-gradient(165deg, #e7f4ea 0%, #f1f8ef 42%, #ffffff 100%);
  --shell-bg: #ffffff;
  --sidebar-bg: #f7faf5;
  --surface: #ffffff;
  --surface-2: #f4f7f2;
  --surface-3: #ecf6e6;
  --border: #e6ebe2;
  --border-strong: #cfd8c9;
  --text: #0d0d0d;
  --text-muted: #5b6356;
  --text-faint: #97a08f;
  --primary: #0aa84f;
  --primary-hover: #08923f;
  --primary-soft: #e8ffd4;
  --primary-softer: #f2ffe6;
  --primary-grad: #00e56b;
  --primary-grad-hover: #00c25c;
  --on-primary: #0d0d0d;
  --green: #0a9d52;  --green-soft: #dcf7e3;
  --blue: #2a86d6;   --blue-soft: #e4f1ff;
  --red: #e0394f;    --red-soft: #ffe3e8;
  --amber: #b97e00;  --amber-soft: #fff0cf;
  --pill-soon-bg: #fff0cf; --pill-soon-fg: #9a6700;
  --pill-ok-bg: #e4f1ff;   --pill-ok-fg: #2a6fbf;
  --pill-late-bg: #ffe3e8; --pill-late-fg: #cf2740;
  --pill-done-bg: #dcf7e3; --pill-done-fg: #0a8f45;
  --pill-none-bg: #eef1ec; --pill-none-fg: #5b6356;
}

/* Texte foncé sur les aplats vert vif (boutons, badges accent, jour courant). */
.btn-primary, .btn-primary:hover { color: var(--on-primary); }
/* Réaffirme le fond vert vif de la carte accent (sinon écrasé par .stat-card → surface,
   ce qui rendait le texte foncé invisible). */
.stat-card--accent { background: var(--primary-grad); border: none; }
.stat-card--accent, .stat-card--accent .stat-num { color: var(--on-primary); }
.stat-card--accent .stat-lbl { color: rgba(13, 13, 13, .68); }
.cal-day.is-today .cal-daynum { color: var(--on-primary); }

/* Logo Publithings adaptatif (SVG noir → blanchi en sombre). */
.brand-logo { height: 22px; width: auto; display: block; }
:root[data-theme="dark"] .brand-logo { filter: brightness(0) invert(1); }

/* ---- Bandeau projet (façon référence) ---- */
.project-banner {
  border-radius: var(--r-lg);
  padding: 22px 24px 18px;
  margin-bottom: 16px;
  color: #fff;
  background: linear-gradient(120deg, var(--banner) 0%, color-mix(in srgb, var(--banner) 60%, #000) 100%);
  position: relative;
  /* Pas d'overflow:hidden — le border-radius arrondit déjà le dégradé, et
     overflow:hidden tronquait le menu déroulant « … » du projet. */
}
.project-banner .project-menu .dropdown-menu { z-index: 60; }
.project-banner-row { display: flex; align-items: center; gap: 12px; }
.banner-icon { background: rgba(255, 255, 255, .18) !important; color: #fff; }
.project-banner-name { font-size: 24px; color: #fff; flex: 1; min-width: 0; }
.banner-icon-btn { color: rgba(255, 255, 255, .85); }
.banner-icon-btn:hover { background: rgba(255, 255, 255, .18); color: #fff; }
.project-banner .fav-btn.is-fav .icon { fill: #fff; color: #fff; }
.project-banner-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 14px; }
.banner-pill { display: inline-flex; align-items: center; gap: 7px; padding: 5px 12px; border-radius: var(--r-pill); background: rgba(255, 255, 255, .16); color: #fff; font-size: 12px; font-weight: 600; }
.banner-pill .icon { width: 14px; height: 14px; }
.banner-status .dot { width: 8px; height: 8px; border-radius: 50%; background: #fff; }
.banner-status-on_track .dot { background: #00e56b; }
.banner-status-at_risk .dot { background: #ffaa00; }
.banner-status-off_track .dot { background: #ff4d6a; }
.banner-avatars { margin-left: auto; }
.banner-avatars .avatar { border: 2px solid rgba(255, 255, 255, .65); margin-left: -8px; }
.banner-avatars .avatar:first-child { margin-left: 0; }
.banner-avatars .avatar-more { background: rgba(255, 255, 255, .25); color: #fff; }

/* ---- Label en haut de carte (priorité / statut) ---- */
.task-card-toprow { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 10px; }
.tc-label { display: inline-flex; align-items: center; gap: 6px; font-size: 11px; font-weight: 700; padding: 3px 10px; border-radius: var(--r-pill); }
.tc-dot { width: 7px; height: 7px; border-radius: 50%; background: currentColor; }
.tc-label.tc-high { background: var(--red-soft); color: var(--red); }
.tc-label.tc-med { background: var(--amber-soft); color: var(--amber); }
.tc-label.tc-low { background: var(--blue-soft); color: var(--blue); }
.tc-label.tc-normal { background: var(--surface-3); color: var(--text-muted); }
.tc-label.tc-done { background: var(--green-soft); color: var(--green); }
.tc-label.tc-custom { background: color-mix(in srgb, var(--tc) 16%, transparent); color: var(--tc); max-width: 100%; }
.tc-label .tc-text { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Lien « Modifier les options » à côté d'un libellé de champ */
.field-edit-link { font-size: 12px; font-weight: 600; color: var(--primary); margin-left: 8px; }
.field-edit-link:hover { text-decoration: underline; }

/* ---- Connexion — split inspiré de la référence, charte « vert électrique » ---- */
.auth-shell { background: var(--page-grad); padding: 24px; }
.auth-split {
  width: 100%; max-width: 960px;
  display: grid; grid-template-columns: 1.05fr 1fr;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--shadow-lg);
}

/* Panneau de gauche : dégradé vert doux (mode clair) / vert profond (mode sombre). */
.auth-aside {
  position: relative; overflow: hidden;
  padding: 38px 34px;
  display: flex; flex-direction: column; gap: 18px;
  background: linear-gradient(158deg, #e9fff2 0%, #c6f6db 46%, #8fe9bb 100%);
  color: #143226;
}
:root[data-theme="dark"] .auth-aside {
  background: linear-gradient(158deg, #103021 0%, #0d0d0d 78%);
  color: #eafff3;
}
/* Forme organique décorative (façon « vague »). */
.auth-blob { position: absolute; top: -70px; right: -60px; width: 320px; height: 320px; fill: rgba(255, 255, 255, .5); pointer-events: none; }
:root[data-theme="dark"] .auth-blob { fill: rgba(0, 229, 107, .10); }

.auth-logo { height: 28px; width: auto; position: relative; z-index: 1; }
:root[data-theme="dark"] .auth-logo { filter: brightness(0) invert(1); }

.auth-aside-body { position: relative; z-index: 1; display: flex; flex-direction: column; gap: 14px; }
.auth-aside-title { font-size: 25px; line-height: 1.2; font-weight: 800; color: inherit; }
.auth-aside-text { color: inherit; opacity: .82; margin: 0; font-size: 14.5px; line-height: 1.55; max-width: 38ch; }
.auth-team { margin: 4px 0 0; }
.auth-team img { width: 100%; height: 188px; object-fit: cover; border-radius: 18px; display: block; box-shadow: 0 16px 34px rgba(10, 50, 30, .22); }
.auth-dots { display: flex; gap: 7px; justify-content: center; margin-top: 2px; }
.auth-dots span { width: 7px; height: 7px; border-radius: 50%; background: currentColor; opacity: .3; transition: width .2s; }
.auth-dots span.is-active { width: 22px; border-radius: 4px; opacity: 1; background: var(--primary); }
.auth-aside-foot { color: inherit; opacity: .55; font-size: 12px; position: relative; z-index: 1; margin-top: auto; }

/* Panneau de droite : formulaire. */
.auth-main { display: flex; align-items: center; justify-content: center; padding: 44px 40px; }
.auth-main-inner { width: 100%; max-width: 340px; }
.auth-h1 { font-size: 24px; }
.auth-sub { color: var(--text-muted); margin: 6px 0 24px; }
.auth-form .field { margin-bottom: 16px; }
.auth-form .btn { margin-top: 6px; }
.auth-switch { text-align: center; margin-top: 20px; color: var(--text-muted); font-size: 13.5px; }

/* Champ mot de passe avec bouton afficher/masquer. */
.field-pw { position: relative; display: block; }
.field-pw input { padding-right: 42px; }
.pw-toggle { position: absolute; right: 6px; top: 50%; transform: translateY(-50%); display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px; border: none; background: none; cursor: pointer; color: var(--text-faint); border-radius: var(--r-sm); }
.pw-toggle:hover { color: var(--text-muted); background: var(--surface-2); }
.pw-toggle .icon { width: 19px; height: 19px; }
.pw-ic-hide { display: none; }
.field-pw.pw-visible .pw-ic-show { display: none; }
.field-pw.pw-visible .pw-ic-hide { display: inline-flex; }

@media (max-width: 820px) {
  .auth-split { grid-template-columns: 1fr; max-width: 420px; }
  .auth-aside { display: none; }
}

