/* Mésange — feuille de style du MVP.
   Deux zones : barre latérale de navigation, contenu principal. */

:root {
  --radius: 14px;
  /* Largeur de lecture : une colonne qui porte des paragraphes ne descend pas
     sous 80 caractères (CLAUDE.md, « Conventions de code »). Faute de place,
     les colonnes passent l'une sous l'autre plutôt que de rétrécir :
     `minmax(min(100%, var(--largeur-lecture)), 1fr)`. */
  --largeur-lecture: 80ch;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color-scheme: light;
}

/* ---------- Thème clair (par défaut) ---------- */

:root,
:root[data-theme="light"] {
  --champ-obligatoire: #7540c1;
  --champ-conseille: #146b77;
  --champ-facultatif: #595e69;
  --champ-erreur: #b12232;
  --bg: #f6f3ee;
  --surface: #fffaf3;
  --surface-alt: #ffffff;
  --border: #e5ddd2;
  --border-strong: #ddd4c9;
  --text: #211f1d;
  --text-soft: #6b6459;
  --accent: #1f2937;
  --accent-soft: #eef1f5;
  --todo: #b08968;
  --done: #2f6f4e;
  --warn-bg: #fff6e5;
  --warn-border: #e8d5b0;

  /* Pastilles d'état : le fond et le texte vont par paires.
     Les dissocier — un fond littéral ici, une variable là — laisse le fond
     inchangé quand le thème bascule. C'est ainsi que « Publication
     automatique » s'est retrouvé en vert pâle sur vert très pâle. */
  --done-bg: #e4f0e9;
  --done-fg: #2f6f4e;
  --todo-bg: #f6ecdf;
  --todo-fg: #7a5a34;
  --info-bg: #e8eef6;
  --info-fg: #3a5a80;
  --alerte-bg: #f2e6e6;
  --alerte-fg: #83504f;
  /* Texte posé sur un aplat de `--done`. Blanc en thème clair, sombre en
     thème sombre : l'aplat y est plus clair que le texte, pas l'inverse. */
  --sur-done: #ffffff;
  /* Une erreur de formulaire est le texte qu'il faut pouvoir lire : un rouge
     sombre sur fond sombre le rendait presque invisible. */
  --erreur: #a33333;
  --lien-doux: #3d6a9a;
  /* Séries des graphiques : 3:1 au moins sur la surface (WCAG 1.4.11),
     mesuré par apps/core/test_contrastes.py. */
  --graphe-serie-1: #3d6a9a;
  --graphe-serie-2: #2f6f4e;
  --graphe-serie-3: #9a5a12;
  --graphe-serie-4: #7a4f9a;
  --graphe-axe: #6b6459;
  --graphe-grille: #e5ddd2;
  color-scheme: light;
}

/* ---------- Thème sombre ---------- */

:root[data-theme="dark"] {
  --champ-obligatoire: #d3b3ff;
  --champ-conseille: #7fd8df;
  --champ-facultatif: #b9bfca;
  --champ-erreur: #ff9eaa;
  --bg: #16151a;
  --surface: #1d1c22;
  --surface-alt: #232228;
  --border: #33313a;
  --border-strong: #3f3d47;
  --text: #ece9e4;
  --text-soft: #9d978d;
  --accent: #e8e4dd;
  --accent-soft: #2b2a32;
  --todo: #c79a6d;
  --done: #6bbd91;
  --warn-bg: #2a2418;
  --warn-border: #4a3f28;

  --done-bg: #1e3a2b;
  --done-fg: #7fc79f;
  --todo-bg: #3a3125;
  --todo-fg: #d6b183;
  --info-bg: #23303f;
  --info-fg: #8fb4dc;
  --alerte-bg: #3b2a2a;
  --alerte-fg: #d59d9c;
  --sur-done: #16151a;
  --erreur: #e79b9a;
  --lien-doux: #8fb4dc;
  --graphe-serie-1: #8fb4dc;
  --graphe-serie-2: #7fc79f;
  --graphe-serie-3: #e0a868;
  --graphe-serie-4: #c3a2e0;
  --graphe-axe: #9d978d;
  --graphe-grille: #33313a;
  color-scheme: dark;
}

/* Le thème « système » suit la préférence du navigateur. */
@media (prefers-color-scheme: dark) {
  :root[data-theme="system"] {
    --champ-obligatoire: #d3b3ff;
  --champ-conseille: #7fd8df;
  --champ-facultatif: #b9bfca;
  --champ-erreur: #ff9eaa;
  --bg: #16151a;
    --surface: #1d1c22;
    --surface-alt: #232228;
    --border: #33313a;
    --border-strong: #3f3d47;
    --text: #ece9e4;
    --text-soft: #9d978d;
    --accent: #e8e4dd;
    --accent-soft: #2b2a32;
    --todo: #c79a6d;
    --done: #6bbd91;
    --warn-bg: #2a2418;
    --warn-border: #4a3f28;

    --done-bg: #1e3a2b;
    --done-fg: #7fc79f;
    --todo-bg: #3a3125;
    --todo-fg: #d6b183;
    --info-bg: #23303f;
    --info-fg: #8fb4dc;
    --alerte-bg: #3b2a2a;
    --alerte-fg: #d59d9c;
    --sur-done: #16151a;
    --erreur: #e79b9a;
    --lien-doux: #8fb4dc;
  --graphe-serie-1: #8fb4dc;
  --graphe-serie-2: #7fc79f;
  --graphe-serie-3: #e0a868;
  --graphe-serie-4: #c3a2e0;
  --graphe-axe: #9d978d;
  --graphe-grille: #33313a;
    color-scheme: dark;
  }
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  line-height: 1.55;
}

a { color: inherit; }

button, .button {
  max-width: 100%;
  border: 0;
  border-radius: 10px;
  padding: 9px 14px;
  background: var(--accent);
  color: var(--surface-alt);
  text-decoration: none;
  cursor: pointer;
  font-size: 0.9rem;
  font-family: inherit;
}

/* Action secondaire. Sans bordure, elle se lisait comme une simple mention :
   rien ne disait qu'on pouvait cliquer. Le contour la désigne comme un
   contrôle, tout en la laissant derrière l'action principale. */
button.ghost {
  background: transparent;
  color: var(--text);
  padding: 6px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
}

button.ghost:hover {
  background: var(--surface-alt);
  border-color: var(--text-soft);
}

/* ---------- Structure ---------- */

.shell {
  display: grid;
  grid-template-columns: 264px 1fr;
  min-height: 100vh;
}

.sidebar {
  background: var(--surface);
  border-right: 1px solid var(--border-strong);
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}

.brand {
  font-weight: 700;
  font-size: 1.15rem;
  text-decoration: none;
  letter-spacing: -0.01em;
}

.content { display: flex; flex-direction: column; min-width: 0; }

.content > header {
  padding: 14px 28px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  border-bottom: 1px solid var(--border-strong);
  background: var(--surface);
}

.header-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 14px;
  font-size: 0.88rem;
}

.header-actions form { margin: 0; }

/* Assez large pour lire ce qu'on tape, sans pousser les liens hors de l'en-tête. */
.recherche-entete input[type="search"] {
  width: 15rem;
  max-width: 40vw;
  padding: 5px 10px;
  font-size: 0.88rem;
}

.crumbs { color: var(--text-soft); font-size: 0.88rem; }
.crumbs strong { color: var(--text); }

/* Assez large pour deux colonnes de lecture côte à côte sur un grand écran —
   comparer deux versions d'un texte — sans étirer les lignes au-delà : chaque
   colonne reste bornée par la grille. */
main { padding: 28px; max-width: max(1180px, calc(2 * var(--largeur-lecture) + 72px)); width: 100%; }

/* ---------- Sélecteurs ---------- */

.selectors { display: grid; gap: 10px; }
.selectors label {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin-bottom: 3px;
}
.selectors select {
  width: 100%;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface-alt);
  font-family: inherit;
  font-size: 0.9rem;
}

/* ---------- Navigation ---------- */

/* Seul le menu de la barre latérale occupe la hauteur libre. Une règle sur
   tout `nav` étirait aussi la rangée d'onglets de la zone de contenu, qui
   prenait la moitié de l'écran au-dessus de la page. */
.sidebar nav { flex: 1; }

.nav-section { border-bottom: 1px solid var(--border); }

.nav-section > summary {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 9px 4px;
  cursor: pointer;
  font-size: 0.92rem;
  list-style: none;
}

.nav-section > summary::-webkit-details-marker { display: none; }
.nav-section > summary:hover { color: var(--todo); }

.nav-icon { width: 1.1em; text-align: center; opacity: 0.75; }
.nav-label { flex: 1; }
.nav-count {
  font-size: 0.72rem;
  color: var(--text-soft);
  background: var(--accent-soft);
  border-radius: 20px;
  padding: 1px 7px;
}

.nav-section ul {
  list-style: none;
  margin: 0 0 8px;
  padding: 0 0 0 26px;
}

.nav-section li a {
  display: block;
  padding: 4px 0;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text-soft);
}

.nav-section li a:hover { color: var(--text); }
.nav-section li a.current { color: var(--text); font-weight: 600; }
.nav-section li a.reste { font-size: 0.8rem; font-style: italic; opacity: 0.75; }

.nav-section li a.todo::before {
  content: "○";
  color: var(--todo);
  margin-right: 7px;
  font-size: 0.7rem;
}

.nav-section li a.done::before {
  content: "●";
  color: var(--done);
  margin-right: 7px;
  font-size: 0.7rem;
}

/* ---------- Pied de la barre latérale ---------- */

.sidebar-footer {
  font-size: 0.78rem;
  color: var(--text-soft);
  display: grid;
  gap: 6px;
}

.sidebar-footer a { text-decoration: none; font-weight: 500; }
.sidebar-footer a:hover { text-decoration: underline; }

.progress {
  height: 5px;
  background: var(--accent-soft);
  border-radius: 5px;
  overflow: hidden;
}

.progress-bar { height: 100%; background: var(--done); }

/* ---------- Composants ---------- */

.grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; }

.card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 20px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.04);
}

.card h2 { margin-top: 0; font-size: 1rem; }
.card p { color: var(--text-soft); font-size: 0.9rem; margin-bottom: 0; }

.notice {
  background: var(--warn-bg);
  border: 1px solid var(--warn-border);
  border-radius: var(--radius);
  padding: 14px 18px;
}

.messages {
  list-style: none;
  margin: 0;
  padding: 12px 28px 0;
  display: grid;
  gap: 8px;
}

.messages li {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--done);
  border-radius: 8px;
  padding: 9px 14px;
  font-size: 0.88rem;
}

.error { color: var(--erreur); }

.tag {
  display: inline-block;
  font-size: 0.72rem;
  padding: 2px 9px;
  border-radius: 20px;
  background: var(--accent-soft);
  color: var(--text-soft);
}

.tag.todo { background: var(--todo-bg); color: var(--todo-fg); }
.tag.done { background: var(--done-bg); color: var(--done-fg); }

/* ---------- Écran placeholder ---------- */

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  flex-wrap: wrap;
}

.screen-header h1 { margin: 0 0 6px; font-size: 1.5rem; }
.screen-header .meta { color: var(--text-soft); font-size: 0.88rem; }

.spec-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--largeur-lecture)), 1fr));
  gap: 16px;
  margin-top: 24px;
}

/* Cartes de chiffres, de comptes ou de listes courtes : exemptées de la
   largeur de lecture, elles peuvent se serrer. */
.spec-grid.donnees { grid-template-columns: repeat(auto-fit, minmax(min(100%, 260px), 1fr)); }

/* Une carte de grille ne s'élargit pas au-delà de sa colonne parce qu'un
   bouton ou une adresse refuse de passer à la ligne. */
.spec-grid > * { min-width: 0; }

.spec-grid h3 {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin: 0 0 10px;
}

.spec-grid ul { margin: 0; padding-left: 18px; font-size: 0.9rem; }
.spec-grid li { margin-bottom: 5px; }

.wireframe-frame {
  width: 100%;
  height: 640px;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: white;
  margin-top: 12px;
}

/* ---------- Plan du produit ---------- */

.map-section { margin-bottom: 32px; }
.map-section h2 { font-size: 1.05rem; display: flex; align-items: center; gap: 10px; }

table.screens { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
table.screens th {
  text-align: left;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  border-bottom: 1px solid var(--border-strong);
  padding: 6px 10px;
}
table.screens td { padding: 7px 10px; border-bottom: 1px solid var(--border); }
table.screens tr:hover td { background: var(--surface); }
table.screens code { font-size: 0.82rem; color: var(--text-soft); }

/* Réseaux retenus mais pas encore ouverts. Ils partagent le tableau des
   comptes — c'est le même sujet à un autre stade — mais doivent se distinguer
   au premier coup d'œil : rien n'y est encore connecté, et le geste attendu
   n'est pas le même.

   La distinction passe par un liseré et un fond à peine teinté, dérivé de la
   couleur du texte : un aplat opaque posait un rectangle blanc au milieu de
   lignes transparentes, et le tableau paraissait fait de deux tableaux. */
table.screens tr.a-connecter td:first-child {
  box-shadow: inset 3px 0 0 var(--todo);
}

table.screens tr.a-connecter .button {
  padding: 4px 10px;
  font-size: 0.8rem;
}

/* ---------- Formulaires ---------- */

.form p { margin: 0 0 16px; }

.form label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 4px;
}

.form input[type="text"],
.form input[type="number"],
.form textarea,
.form select {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.92rem;
  background: var(--surface-alt);
}

.form textarea { resize: vertical; }

.form .helptext {
  display: block;
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-top: 4px;
}

.form ul.errorlist {
  list-style: none;
  margin: 0 0 6px;
  padding: 0;
  color: var(--erreur);
  font-size: 0.82rem;
}

.form-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  margin-top: 6px;
  font-size: 0.88rem;
}

/* ---------- Fil de progression ---------- */

.steps {
  display: flex;
  flex-wrap: wrap;
  gap: 10px 8px;
  margin-top: 18px;
  font-size: 0.85rem;
}

.steps a {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 5px 13px;
  border: 1px solid var(--border);
  border-radius: 20px;
  text-decoration: none;
  color: var(--text-soft);
  background: var(--surface-alt);
}

.steps a:hover { color: var(--text); }
.steps a.current { background: var(--accent); border-color: var(--accent); color: var(--surface-alt); }

/* ---------- Listes de comptes ---------- */

.account-list { list-style: none; margin: 0; padding: 0; font-size: 0.9rem; }

.account-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 0;
  border-bottom: 1px solid var(--border);
}

.account-list li:last-child { border-bottom: 0; }
.account-list form { margin: 0; }

/* ---------- Statuts éditoriaux ---------- */

:root {
  --st-idea: #9a8c7a;
  --st-ai: #7a6fb0;
  --st-review: #c08a3e;
  --st-approved: #3d7a5a;
  --st-scheduled: #3d6a9a;
  --st-published: #2f6f4e;
  --st-failed: #a33;
  --st-archived: #9a9a9a;
}

.status-idea { --st: var(--st-idea); }
.status-ai_draft { --st: var(--st-ai); }
.status-human_review { --st: var(--st-review); }
.status-approved { --st: var(--st-approved); }
.status-scheduled { --st: var(--st-scheduled); }
.status-published { --st: var(--st-published); }
.status-failed { --st: var(--st-failed); }
.status-archived { --st: var(--st-archived); }

.status-tag {
  background: color-mix(in srgb, var(--st) 14%, transparent);
  color: var(--st);
}

/* ---------- Calendrier mensuel ---------- */

table.month { width: 100%; border-collapse: collapse; margin-top: 18px; table-layout: fixed; }

table.month th {
  text-align: left;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-strong);
}

table.month td {
  vertical-align: top;
  height: 108px;
  border: 1px solid var(--border);
  padding: 5px;
  background: var(--surface-alt);
}

table.month td.hors-mois { background: var(--bg); opacity: 0.55; }
table.month td.aujourdhui { box-shadow: inset 0 0 0 2px var(--accent); }

.day-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  color: var(--text-soft);
  margin-bottom: 4px;
}

.day-add {
  text-decoration: none;
  opacity: 0;
  font-weight: 700;
  padding: 0 4px;
}

td:hover .day-add, .week-day:hover .day-add { opacity: 0.6; }
.day-add:hover { opacity: 1 !important; }

/* ---------- Vignettes de contenu ---------- */

.chip {
  display: block;
  font-size: 0.74rem;
  text-decoration: none;
  padding: 3px 6px;
  margin-bottom: 3px;
  border-radius: 6px;
  border-left: 3px solid var(--st, var(--border-strong));
  background: color-mix(in srgb, var(--st, #999) 9%, transparent);
  overflow: hidden;
  white-space: nowrap;
  text-overflow: ellipsis;
}

.chip:hover { background: color-mix(in srgb, var(--st, #999) 20%, transparent); }
.chip-time { color: var(--text-soft); margin-right: 4px; }

/* ---------- Vue hebdomadaire ---------- */

.week {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 8px;
  margin-top: 18px;
}

.week-day {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px;
  min-height: 220px;
}

.week-day.aujourdhui { box-shadow: inset 0 0 0 2px var(--accent); }

.week-day-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.8rem;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}

/* ---------- Kanban ---------- */

.kanban {
  display: grid;
  grid-template-columns: repeat(6, minmax(170px, 1fr));
  gap: 12px;
  margin-top: 18px;
  overflow-x: auto;
}

.kanban-col h3 {
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-soft);
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0 0 10px;
}

.kanban-card {
  display: block;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-left: 3px solid var(--st, var(--border-strong));
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 8px;
  text-decoration: none;
  font-size: 0.82rem;
}

.kanban-card:hover { border-color: var(--st, var(--border-strong)); }
.kanban-card .meta { display: block; font-size: 0.74rem; margin-top: 5px; }
.kanban-card a { color: inherit; text-decoration: none; }
.kanban-card[data-statut-url] { cursor: grab; }
.kanban-zone { min-height: 60px; }
.kanban-passer { margin-top: 6px; font-size: 0.74rem; }
.kanban-passer summary { cursor: pointer; color: var(--text-soft); }
.kanban-passer form { margin-top: 4px; }
.kanban-passer textarea { width: 100%; max-width: 100%; box-sizing: border-box; font: inherit; }
.kanban-passer .button { max-width: 100%; white-space: normal; }

/* ---------- Actions de workflow ---------- */

.transition-form { margin-bottom: 10px; }
.transition-form textarea {
  width: 100%;
  margin-bottom: 6px;
  padding: 7px 9px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
}

.validation-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  flex-wrap: wrap;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--border);
}

.validation-actions form { display: flex; gap: 8px; align-items: center; margin: 0; }
.reject-form input[type="text"],
.reject-form textarea {
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.85rem;
  min-width: 220px;
}

/* ---------- Prévisualisation ---------- */

.post-preview {
  max-width: min(100%, var(--largeur-lecture));
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px;
  margin-top: 20px;
}

.post-head { display: flex; gap: 12px; align-items: center; margin-bottom: 14px; }

.avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: var(--accent-soft);
  display: grid;
  place-items: center;
  font-weight: 700;
  color: var(--text-soft);
}

.post-body { font-size: 1rem; line-height: 1.5; margin: 0; }
.post-tags { color: var(--lien-doux); font-size: 0.9rem; margin: 10px 0 0; }
.post-foot { margin: 14px 0 0; padding-top: 12px; border-top: 1px solid var(--border); font-size: 0.8rem; }

/* ---------- Génération IA ---------- */

.provider-list { list-style: none; margin: 0; padding: 0; font-size: 0.86rem; }
.provider-list li { display: flex; align-items: center; gap: 8px; padding: 5px 0; }

.dot { width: 8px; height: 8px; border-radius: 50%; flex: none; }
.dot.on { background: var(--done); }
.dot.off { background: var(--border-strong); }

pre.prompt {
  white-space: pre-wrap;
  word-break: break-word;
  font-size: 0.8rem;
  line-height: 1.6;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 12px 14px;
  max-height: 340px;
  overflow-y: auto;
  margin: 0;
}

/* ---------- Connexion ---------- */

.standalone {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

/* Le `main` général impose width:100% pour les écrans de l'application. Ici il
   étire la zone centrée sur toute la largeur, et la carte se colle à son bord
   gauche : c'est le `main` qui se retrouve centré, pas son contenu. */
.standalone > main {
  display: grid;
  justify-items: center;
  width: auto;
  max-width: 100%;
  padding: 0;
}

.login-card {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 20px;
  padding: 34px;
  width: min(420px, 100%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.06);
}

.login-card h1 { margin: 0; font-size: 1.5rem; }
.login-card .subtitle { color: var(--text-soft); margin-top: 4px; font-size: 0.9rem; }
.login-card input {
  width: 100%;
  padding: 9px 11px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.95rem;
}
.login-card button { width: 100%; margin-top: 8px; padding: 11px; }

/* ---------- Adaptatif ---------- */

@media (max-width: 900px) {
  .shell { grid-template-columns: 1fr; }
  .sidebar { position: static; height: auto; }
  main { padding: 20px; }
}

/* ---------- Fil conducteur de mise en route ---------- */

.parcours-liste {
  list-style: none;
  margin: 0;
  padding: 0;
  display: grid;
  gap: 7px;
  font-size: 0.88rem;
}

.parcours-liste li { display: flex; align-items: center; gap: 10px; color: var(--text-soft); }
.parcours-liste li a { text-decoration: none; }
.parcours-liste li.done { color: var(--done); }
.parcours-liste li.done a { text-decoration: line-through; opacity: 0.75; }
.parcours-liste li.current { color: var(--text); font-weight: 600; }

.puce {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  font-size: 0.7rem;
  flex: none;
  background: var(--accent-soft);
  color: var(--text-soft);
}

.parcours-liste li.done .puce { background: color-mix(in srgb, var(--done) 18%, transparent); color: var(--done); }
.parcours-liste li.current .puce { background: var(--accent); color: var(--surface-alt); }

/* ---------- Aperçu de créneaux ---------- */

.slots { font-size: 0.85rem; }
.slots li { padding: 5px 0; border-bottom: 1px solid var(--border); list-style: none; }
.slots li:last-child { border-bottom: 0; }


/* ---------- Sélecteurs avec bouton de création ---------- */

.selector-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 6px;
}

.plus {
  text-decoration: none;
  font-weight: 700;
  font-size: 0.95rem;
  line-height: 1;
  width: 20px;
  height: 20px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: var(--text-soft);
  background: var(--accent-soft);
}

.plus:hover { color: var(--text); background: var(--border); }

/* ---------- Lien vers l'assistant ---------- */

.assistant-link {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  border: 1px solid var(--border);
  text-decoration: none;
  font-size: 0.88rem;
  font-weight: 500;
}

.assistant-link:hover { border-color: var(--border-strong); }

/* ---------- Bascule de thème ---------- */

.theme-switch { display: flex; gap: 4px; }

.theme-switch button {
  background: transparent;
  border: 1px solid transparent;
  border-radius: 8px;
  padding: 3px 6px;
  font-size: 0.85rem;
  cursor: pointer;
  opacity: 0.55;
  color: inherit;
}

.theme-switch button:hover { opacity: 0.9; }
.theme-switch button.current {
  opacity: 1;
  border-color: var(--border-strong);
  background: var(--surface-alt);
}

/* ---------- Navigation de l'assistant ---------- */

.assistant-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 28px;
  padding-top: 18px;
  border-top: 1px solid var(--border);
  font-size: 0.9rem;
}

.assistant-nav a:not(.button) { text-decoration: none; color: var(--text-soft); }
.assistant-nav a:not(.button):hover { color: var(--text); }

/* ---------- Propositions de l'assistant IA ---------- */

.proposition { margin-bottom: 14px; }
.proposition.inchange { opacity: 0.65; }

.proposition-tete {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  margin-bottom: 12px;
  font-size: 0.95rem;
}

.proposition .etiquette {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin-bottom: 4px;
}

.proposition .avant p {
  margin: 0 0 14px;
  padding: 9px 12px;
  background: var(--bg);
  border-radius: 8px;
  font-size: 0.88rem;
  color: var(--text-soft);
}

.proposition textarea {
  width: 100%;
  padding: 9px 12px;
  border: 1px solid var(--border);
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  background: var(--surface-alt);
  color: var(--text);
  resize: vertical;
}

.assist-bouton {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 7px 12px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-alt);
  color: var(--text);
  text-decoration: none;
  font-size: 0.85rem;
}

.assist-bouton:hover { border-color: var(--accent); }

.card.connecte { border-color: color-mix(in srgb, var(--done) 40%, var(--border)); }

/* ---------- Pastilles de réseau ---------- */

.pastille {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: var(--pastille, var(--accent));
  color: #fff;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex: none;
  margin-right: 8px;
  vertical-align: middle;
}

.reseau-tete { display: flex; align-items: center; gap: 4px; }
.card.reseau h3 { text-transform: none; letter-spacing: 0; font-size: 1rem; color: var(--text); }

/* ---------- Blocs copiables ---------- */

.copie-bloc { margin-bottom: 14px; }

.copie-tete {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 10px;
}

.copie-bloc textarea {
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--border);
  border-radius: 9px;
  font-family: inherit;
  font-size: 0.92rem;
  line-height: 1.55;
  background: var(--bg);
  color: var(--text);
  resize: vertical;
}

.copier { border: 1px solid var(--border-strong); border-radius: 8px; }
.copier.copie-ok { color: var(--done); border-color: var(--done); }

.sous-groupe {
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-soft);
  margin: 20px 0 6px;
}

/* ---------- Recherche d'images ---------- */

.recherche-ligne { display: flex; gap: 10px; }
.recherche-ligne input { flex: 1; }

.grille-images {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 14px;
  margin-top: 20px;
}

.vignette {
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.vignette img {
  width: 100%;
  aspect-ratio: 4 / 3;
  object-fit: cover;
  display: block;
  background: var(--bg);
}

.vignette-pied {
  padding: 9px 11px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.78rem;
}

.vignette-pied button { width: 100%; padding: 6px; font-size: 0.82rem; }

/* ---------- Étapes franchies ---------- */

.parcours-liste li.done .puce {
  background: color-mix(in srgb, var(--done) 22%, transparent);
  color: var(--done);
  position: relative;
}

.parcours-liste li.done .puce .coche {
  position: absolute;
  right: -3px;
  bottom: -3px;
  font-size: 0.55rem;
  background: var(--done);
  color: var(--sur-done);
  border-radius: 50%;
  width: 11px;
  height: 11px;
  display: grid;
  place-items: center;
  line-height: 1;
}

/* Le vert pastel signale l'étape franchie sans effacer son numéro. */
.steps a.faite {
  background: color-mix(in srgb, var(--done) 14%, transparent);
  border-color: color-mix(in srgb, var(--done) 35%, var(--border));
  color: var(--done);
}

.steps a.faite.current {
  background: var(--done);
  border-color: var(--done);
  color: var(--sur-done);
}

/* ---------- Logos de marque ---------- */

.logo-reseau { vertical-align: middle; flex: none; }

.logo-pastille {
  display: inline-grid;
  place-items: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: color-mix(in srgb, var(--marque) 14%, transparent);
  color: var(--marque);
  flex: none;
  margin-right: 8px;
}

/* ---------- Sections repliables ---------- */

details.repli { margin-top: 10px; }

details.repli > summary {
  cursor: pointer;
  font-size: 0.85rem;
  color: var(--text-soft);
  list-style: none;
  padding: 4px 0;
}

details.repli > summary::-webkit-details-marker { display: none; }
details.repli > summary::before { content: "▸ "; }
details.repli[open] > summary::before { content: "▾ "; }
details.repli > summary:hover { color: var(--text); }
details.repli .contenu { padding: 8px 0 4px; font-size: 0.88rem; }

/* ---------- Fil d'un compte ---------- */

.post-fil { margin-bottom: 12px; }
.post-fil.depuis-flow { border-left: 3px solid var(--done); }

.post-fil-tete,
.post-fil-pied {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  font-size: 0.82rem;
}

.post-fil-pied {
  padding-top: 10px;
  border-top: 1px solid var(--border);
}

/* ---------- Raccourcis de la barre latérale ---------- */

.raccourcis { display: grid; gap: 4px; font-size: 0.85rem; }

.raccourcis a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: 8px;
  text-decoration: none;
  color: var(--text-soft);
}

.raccourcis a:hover { color: var(--text); background: var(--accent-soft); }

/* ---------- Feuille de route ---------- */

.chantier > summary {
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
  font-size: 1.02rem;
}

.chantier > summary::-webkit-details-marker { display: none; }
.chantier > summary::before { content: "▸"; color: var(--text-soft); }
.chantier[open] > summary::before { content: "▾"; }
.chantier > summary .tag { margin-left: auto; }
/* Le résumé passe à la ligne pour ses liens de contrôle : ils doivent rester
   lisibles chantier replié, sans être tassés contre le titre. */
.chantier > summary { flex-wrap: wrap; }
.chantier > summary .date-chantier { white-space: nowrap; }
.chantier > summary .controler { flex-basis: 100%; padding-left: 20px; font-size: 0.92rem; }

/* Un chantier terminé se replie, mais garde son décompte lisible. */
.chantier:not([open]) > summary { opacity: 0.72; }

.taches { list-style: none; margin: 10px 0 0; padding: 0; }

.taches li {
  display: flex;
  gap: 10px;
  padding: 7px 0;
  border-top: 1px solid var(--border);
  line-height: 1.45;
}

.taches li:first-child { border-top: 0; }

.taches .coche {
  flex: 0 0 1.1rem;
  text-align: center;
  color: var(--text-soft);
}

.taches li.fait .coche { color: var(--done); }
.taches li.fait > span:last-child > strong:first-child { font-weight: 500; }

/* États d'un écran : la couleur double l'étiquette, elle ne la remplace pas. */
.tag.etat-fait { background: var(--done-bg); color: var(--done-fg); }
.tag.etat-couvert { background: var(--info-bg); color: var(--info-fg); }
.tag.etat-prevu { background: var(--todo-bg); color: var(--todo-fg); }
.tag.etat-bloque { background: var(--alerte-bg); color: var(--alerte-fg); }
.tag.etat-abandonne { background: var(--accent-soft); color: var(--text-soft); }


/* Une alerte bloquante doit accrocher l'œil sans clignoter. */
.raccourcis a.alerte-vive { color: var(--erreur); font-weight: 500; }

/* ---------- Réseaux suggérés ---------- */

/* La décision se prend en haut de la tuile, juste sous le nom : ce qui suit
   n'est que l'argumentaire. Placée en bas, la case se lisait après coup. */
.tuile-decision {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 10px 0 4px;
  padding: 7px 10px;
  border: 1px solid var(--border-strong);
  border-radius: 9px;
  background: var(--surface-alt);
  font-size: 0.86rem;
  cursor: pointer;
}

.tuile-decision.retenue {
  border-style: dashed;
  color: var(--text-soft);
  cursor: default;
}

/* Les actions d'une ligne « à connecter » doivent s'aligner d'une ligne à
   l'autre : sans largeur commune, un libellé long décalait tout le tableau. */
table.screens tr.a-connecter .button {
  display: inline-block;
  padding: 5px 10px;
  font-size: 0.8rem;
  text-align: center;
  white-space: nowrap;
}

/* Colonnes du tableau des réseaux. Les largeurs fixes vont aux colonnes dont
   le contenu est borné — un état, un verbe — pour que la place restante
   revienne aux noms, qui sont les seuls à varier vraiment. */
/* Une adresse dans une liste de parcours : elle sert à être copiée, pas à
   être lue. Sans troncature elle poussait la liste hors de sa colonne, et le
   bouton de copie se retrouvait hors de l'écran. */
.parcours-liste code.adresse {
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
}

.parcours-liste li {
  overflow-wrap: anywhere;
}

/* Le bouton de copie porte l'adresse : la faire précéder du texte revient à
   afficher deux fois la même chose, dont une illisible. */
button.copier .adresse {
  display: inline-block;
  max-width: 22rem;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  vertical-align: bottom;
  font-family: inherit;
  opacity: 0.75;
}

/* Un en-tête de colonne qui ne porte que des boutons n'a rien à afficher,
   mais un lecteur d'écran annonce alors « colonne vide ». */
.sr-only {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip-path: inset(50%);
  white-space: nowrap;
}

/* Un seul fond pour toute la table, en-tête compris. Les lignes « à
   connecter » étaient les seules à en porter un : le tableau paraissait fait
   de deux tableaux, l'un posé sur le fond de page, l'autre sur un aplat. Elles
   se distinguent maintenant par le seul liseré, qui ne change pas la matière
   sous les autres lignes. */
table.reseaux {
  table-layout: fixed;
  /* `separate` avec un espacement nul rend le même rendu que `collapse` — les
     cellules ne portent qu'une bordure basse — mais laisse le cadre arrondir
     ses coins, ce que `collapse` interdit. */
  border-collapse: separate;
  border-spacing: 0;
  border: 1px solid var(--border);
  border-radius: 10px;
}

table.reseaux th,
table.reseaux td {
  background: var(--surface);
}

table.reseaux thead th:first-child { border-top-left-radius: 9px; }
table.reseaux thead th:last-child { border-top-right-radius: 9px; }
table.reseaux tbody tr:last-child td { border-bottom: 0; }
table.reseaux tbody tr:last-child td:first-child { border-bottom-left-radius: 9px; }
table.reseaux tbody tr:last-child td:last-child { border-bottom-right-radius: 9px; }

table.reseaux tr:hover td,
table.reseaux tr.a-connecter:hover td {
  background: var(--surface-alt);
}
table.reseaux th.col-compte { width: auto; }
table.reseaux th.col-reseau { width: 8.5rem; }
table.reseaux th.col-identite { width: 9rem; }
table.reseaux th.col-publication { width: 7.5rem; }
table.reseaux th.col-etat { width: 10.5rem; }
table.reseaux th.col-action { width: 9.5rem; }

/* Au milieu : les cellules n'ont pas le même nombre de lignes — un nom seul
   à côté d'un état sur deux lignes — et l'alignement haut faisait flotter les
   courtes en haut d'une rangée creuse. */
table.reseaux td { vertical-align: middle; }

/* Un état qui passe à la ligne double la hauteur d'une rangée sur deux, et le
   tableau cesse de se lire en diagonale. */
table.reseaux .tag { white-space: nowrap; }

table.reseaux td .meta { display: block; line-height: 1.35; }

/* Les noms de comptes sont parfois des adresses sans espace : sans césure,
   elles élargissent la colonne au détriment de toutes les autres. */
table.reseaux td:first-child { overflow-wrap: anywhere; }

/* ---------- Attente pendant un appel au modèle ---------- */

/* Le voile couvre la page pendant l'appel : il informe, et il empêche du même
   geste le second clic qui paierait l'appel une deuxième fois. */
.attente-ia {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: center;
  background: color-mix(in srgb, var(--bg) 80%, transparent);
  backdrop-filter: blur(2px);
}

.attente-ia-boite {
  background: var(--surface-alt);
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 24px 28px;
  width: min(420px, calc(100% - 32px));
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.12);
}

.attente-ia-titre { margin: 0 0 14px; font-weight: 600; }
.attente-ia .progress { height: 8px; }
.attente-ia-etat { margin: 10px 0 0; font-size: 0.88rem; }
.attente-ia-pourcent { font-weight: 600; }
.attente-ia-reste { color: var(--text-soft); }
.attente-ia-note { margin-top: 10px; font-size: 0.8rem; }

/* Sans historique, aucune durée n'est annoncée : la barre dit « ça travaille »
   sans prétendre savoir combien de temps. */
.attente-ia .progress-bar.indetermine {
  width: 35% !important;
  animation: attente-va-et-vient 1.4s ease-in-out infinite;
}

@keyframes attente-va-et-vient {
  0% { margin-left: 0; }
  50% { margin-left: 65%; }
  100% { margin-left: 0; }
}

/* Procédure de connexion : des étapes numérotées, aérées, à suivre en gardant
   un onglet ouvert sur la plateforme. */
.procedure { margin: 0; padding-left: 22px; }
.procedure li { margin-bottom: 10px; line-height: 1.6; }
.procedure li:last-child { margin-bottom: 0; }

/* ---------- Dialogue ---------- */

/* Pour ce qui ne tient pas dans une colonne : une démarche longue, une liste
   de conditions. La pleine largeur au moment où l'on en a besoin. */
.dialogue {
  width: min(680px, calc(100vw - 32px));
  border: 1px solid var(--border-strong);
  border-radius: 18px;
  padding: 24px 28px;
  background: var(--surface-alt);
  color: var(--text);
}

.dialogue::backdrop { background: rgba(0, 0, 0, 0.45); }

.dialogue-tete {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 16px;
}

.dialogue .procedure li { margin-bottom: 12px; }

/* Un dialogue qui porte des paragraphes à lire — des idées, leur
   justification — garde la largeur de lecture, marges comprises. */
.dialogue.dialogue-large { width: min(max(860px, calc(var(--largeur-lecture) + 64px)), calc(100vw - 32px)); }

/* Étapes d'un dialogue en deux temps : on voit où l'on en est, et l'on
   revient à l'étape précédente sans perdre ce qu'elle avait produit. */
.etapes-ia {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid var(--border);
}
.etapes-ia button {
  background: transparent;
  color: var(--text);
  border: 1px solid transparent;
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 0.85rem;
}
.etapes-ia button:not([disabled]):not(.current):hover { border-color: var(--border-strong); }
.etapes-ia button.current { background: var(--accent); color: var(--surface-alt); }
.etapes-ia button[disabled] { color: var(--text-soft); cursor: default; }

.socle-ia { margin: 8px 0 14px; padding-left: 20px; }
.socle-ia li { margin-bottom: 6px; }
.idee-campagne { display: block; cursor: pointer; }
.idee-campagne .proposition-tete { flex-wrap: wrap; margin-bottom: 8px; }
.idee-campagne .lecture { display: block; margin-top: 6px; max-width: var(--largeur-lecture); }
.idee-campagne:has(input:checked) { border-color: var(--accent); }

/* Un geste secondaire glissé dans une phrase : il se lit comme un lien, mais
   ouvre un dialogue — d'où le bouton, accessible au clavier. */
button.lien {
  background: none;
  border: 0;
  padding: 0;
  color: var(--lien-doux);
  text-decoration: underline;
  font-size: inherit;
}

/* Marque des liens sortants, posée par liens-externes.js. */
.lien-externe { opacity: 0.6; font-size: 0.85em; }

/* ---------- Champs à recopier dans un formulaire tiers ---------- */

.champs-support { display: grid; gap: 18px; margin-top: 18px; }

.champ-support label {
  display: block;
  font-size: 0.82rem;
  font-weight: 600;
  margin-bottom: 2px;
}

.champ-support .meta { margin: 0 0 6px; }

.champ-support-ligne {
  display: flex;
  gap: 8px;
  align-items: flex-start;
}

.champ-support-ligne input,
.champ-support-ligne textarea {
  flex: 1;
  padding: 8px 10px;
  border: 1px solid var(--border);
  border-radius: 9px;
  background: var(--surface);
  color: var(--text);
  font-family: inherit;
  font-size: 0.88rem;
}

.champ-support-ligne textarea {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem;
  line-height: 1.5;
}

.champ-support-ligne .copier { white-space: nowrap; }

/* Pannes connues d'un flux OAuth : symptôme en tête, cause et geste en
   dessous. Repliées par défaut — on ne les cherche qu'après un échec, et les
   déplier d'office ferait croire que la connexion est difficile. */
.pannes {
  margin: 10px 0 0;
}

.pannes dt {
  font-weight: 600;
  margin-top: 12px;
  color: var(--text);
}

.pannes dt:first-child {
  margin-top: 0;
}

.pannes dd {
  margin: 4px 0 0;
  padding-left: 12px;
  border-left: 2px solid var(--border);
  color: var(--text-soft);
}

/* Une anomalie détectée avant le départ : elle se distingue de la procédure,
   sans crier — c'est une correction à faire, pas une panne survenue. */
.anomalie {
  background: var(--alerte-bg);
  color: var(--alerte-fg);
  border-radius: 6px;
}

.anomalie strong,
.anomalie a {
  color: var(--alerte-fg);
}

/* Barre de progression d'un appel au modèle. Une jauge figée à zéro ferait
   croire à un blocage : quand le total est inconnu, la barre se déplace au
   lieu de se remplir, ce qui dit « ça travaille » sans mentir sur l'avancée. */
.jauge {
  position: relative;
  height: 10px;
  margin-top: 12px;
  border-radius: 999px;
  background: var(--accent-soft);
  overflow: hidden;
}

.jauge > span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: 999px;
  background: var(--done);
  transition: width 0.4s ease;
}

.jauge.indeterminee > span {
  width: 35%;
  animation: jauge-va-et-vient 1.4s ease-in-out infinite;
}

@keyframes jauge-va-et-vient {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(300%); }
}

@media (prefers-reduced-motion: reduce) {
  .jauge.indeterminee > span { animation: none; width: 100%; opacity: 0.4; }
  .jauge > span { transition: none; }
}

/* Tableau du planning : des champs de saisie dans les cellules, donc des
   largeurs qui doivent leur convenir plutôt qu'au texte qu'ils contiennent.
   `fixed` ferait déborder un select de son entête. */
table.planning { table-layout: auto; }

table.planning th,
table.planning td {
  background: var(--surface);
  vertical-align: middle;
}

table.planning tr.a-connecter td:first-child {
  box-shadow: inset 3px 0 0 var(--todo);
}

table.planning select,
table.planning input[type="datetime-local"] {
  width: 100%;
  max-width: 15rem;
  padding: 4px 6px;
  font-size: 0.84rem;
}

table.planning th.col-quand { width: 12rem; }
table.planning th.col-etat { width: 7rem; }
table.planning th.col-action { width: 11rem; }

/* Un `display:flex` sur une cellule la sort du calcul de hauteur de la ligne :
   le bouton flottait en haut d'une rangée plus haute que lui. L'aligner
   demande un conteneur *dans* la cellule, pas à sa place. */
table.planning td.actions > form,
table.planning td.actions > a,
table.planning td.actions > button {
  display: inline-block;
  vertical-align: middle;
}

table.planning td.actions {
  white-space: nowrap;
}

table.planning td.actions form { margin: 0; }

/* Une forme absente se voit dans la liste elle-même : sans cela, il faut
   comparer soixante lignes pour trouver les vides. */
table.planning select.manquant {
  border-color: var(--todo);
  color: var(--todo-fg);
  background: var(--todo-bg);
}

/* Un champ à valeurs multiples : des cases, en colonnes, pour qu'une liste de
   vingt réseaux tienne à l'écran sans faire défiler la page entière. */
.choix-multiples {
  list-style: none;
  margin: 6px 0 0;
  padding: 0;
  columns: 3 12rem;
  column-gap: 18px;
}

.choix-multiples li { break-inside: avoid; margin-bottom: 4px; }

.choix-multiples label {
  display: flex;
  gap: 6px;
  align-items: baseline;
  font-size: 0.86rem;
}

/* Saisie de chiffres relevés : des champs courts, alignés, pour recopier un
   tableau de bord sans chercher où l'on en est. */
.chiffres {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(10rem, 1fr));
  gap: 10px 16px;
  margin-top: 12px;
}

.chiffres label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.82rem;
  font-weight: 600;
}

.chiffres input { width: 100%; }

/* ---------- Flux de veille ---------- */

/* Des cartes plutôt qu'une liste de paragraphes : vingt titres alignés se
   ressemblent tous, et l'œil n'a rien pour accrocher. La grille s'adapte à la
   largeur sans média-requête — trois colonnes sur un écran large, une seule
   sur un téléphone. */
.grille-signaux {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(19rem, 1fr));
  gap: 16px;
  margin-top: 16px;
}

.signal {
  display: flex;
  flex-direction: column;
  overflow: hidden;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  border-radius: 12px;
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.signal:hover {
  border-color: var(--border-strong);
  transform: translateY(-1px);
}

/* Un signal déjà traité s'efface sans disparaître : il reste consultable,
   mais cesse de disputer l'attention à ce qui n'a pas été lu. */
.signal.traite { opacity: 0.62; }
.signal.traite:hover { opacity: 1; }

.signal-image {
  display: block;
  aspect-ratio: 16 / 9;
  overflow: hidden;
  background: var(--accent-soft);
}

.signal-image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.signal-corps {
  display: flex;
  flex: 1;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px 12px;
}

.signal-source {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: baseline;
  margin: 0;
  font-size: 0.78rem;
}

/* Le nom de la source, pas son logo : redistribuer une marque suppose une
   licence, et une pastille typographique se lit aussi bien. */
.pastille-source {
  padding: 1px 7px;
  border-radius: 999px;
  background: var(--accent-soft);
  color: var(--text-soft);
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.02em;
  white-space: nowrap;
}

.signal-titre {
  margin: 2px 0 0;
  font-size: 0.98rem;
  line-height: 1.32;
}

.signal-titre a { color: var(--text); text-decoration: none; }
.signal-titre a:hover { text-decoration: underline; }

.signal-extrait {
  margin: 0;
  color: var(--text-soft);
  font-size: 0.85rem;
  line-height: 1.45;
}

.signal-pied {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  align-items: center;
  margin: auto 0 0;
  padding-top: 10px;
}

.compteur,
.rang {
  padding: 1px 6px;
  border-radius: 4px;
  background: var(--accent-soft);
  color: var(--text-soft);
  font-size: 0.72rem;
  white-space: nowrap;
}

/* Le rang se lit dans son propre flux, jamais entre flux : le distinguer des
   compteurs bruts évite de croire qu'il les compare. */
.rang {
  background: transparent;
  border: 1px solid var(--border-strong);
}

.signal-actions {
  margin: 8px 0 0;
  font-size: 0.8rem;
}

/* Filtres du planning : une ligne de sélecteurs, qui passe à la ligne au lieu
   de déborder sur un écran étroit. */
.filtres-planning {
  display: flex;
  flex-wrap: wrap;
  gap: 14px 20px;
  align-items: flex-end;
  padding: 14px 16px;
}

.filtres-planning label {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 0.78rem;
  font-weight: 600;
}

.pagination {
  display: flex;
  gap: 16px;
  align-items: center;
  justify-content: center;
}

/* ---------- Composer multi-destinations ---------- */

.colonnes-declinaisons {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(min(100%, var(--largeur-lecture)), 1fr));
  gap: 16px;
  margin-top: 18px;
}
.colonnes-declinaisons textarea { width: 100%; }
.colonnes-declinaisons .post-preview { margin-top: 10px; max-width: none; }
.colonnes-declinaisons .post-body { white-space: pre-wrap; }
.compteur { font-size: 0.8rem; color: var(--text-soft); }
.compteur.depasse { color: var(--alerte-fg); font-weight: 700; }
.chip-groupe { font-size: 0.72rem; color: var(--lien-doux); white-space: nowrap; }
.kanban-card .chip-groupe { display: block; margin-top: 4px; }
.courbe-audience { color: var(--graphe-serie-1); display: block; margin-bottom: 4px; }

/* ---------- Graphiques (apps/analytics/graphiques.py) ----------
   Le SVG ne porte que des classes : toutes les couleurs viennent du thème. */

.graphe-bloc { margin: 12px 0 18px; max-width: 100%; }
.graphe { display: block; width: 100%; max-width: 760px; height: auto; overflow: visible; }
.graphe-grille { stroke: var(--graphe-grille); stroke-width: 1; }
.graphe-axe { stroke: var(--graphe-axe); stroke-width: 1.5; }
.graphe-graduation, .graphe-titre-axe { fill: var(--text-soft); font-size: 11px; }
.graphe-titre-axe { font-weight: 600; }
.graphe-ligne { fill: none; stroke-width: 2.5; stroke-linejoin: round; }
.graphe-ligne.graphe-serie-1 { stroke: var(--graphe-serie-1); }
.graphe-ligne.graphe-serie-2 { stroke: var(--graphe-serie-2); }
.graphe-ligne.graphe-serie-3 { stroke: var(--graphe-serie-3); }
.graphe-ligne.graphe-serie-4 { stroke: var(--graphe-serie-4); }
.graphe-barre.graphe-serie-1 { fill: var(--graphe-serie-1); }
.graphe-barre.graphe-serie-2 { fill: var(--graphe-serie-2); }
.graphe-barre.graphe-serie-3 { fill: var(--graphe-serie-3); }
.graphe-barre.graphe-serie-4 { fill: var(--graphe-serie-4); }
.graphe-legende { display: flex; flex-wrap: wrap; gap: 6px 18px; list-style: none; padding: 0; margin: 6px 0; font-size: 0.85rem; }
.graphe-legende li::before { content: ""; display: inline-block; width: 22px; height: 0; margin-right: 6px; vertical-align: middle; border-top: 3px solid; }
.graphe-legende-1::before { border-top-color: var(--graphe-serie-1) !important; }
.graphe-legende-2::before { border-top: 3px dashed var(--graphe-serie-2) !important; }
.graphe-legende-3::before { border-top: 3px dotted var(--graphe-serie-3) !important; }
.graphe-legende-4::before { border-top: 3px dashed var(--graphe-serie-4) !important; }
.graphe-valeurs summary { cursor: pointer; font-size: 0.85rem; color: var(--text-soft); }

/* ---------- Rapport imprimable ---------- */

@media print {
  .sidebar, .content > header, .ne-pas-imprimer, .messages { display: none !important; }
  .rapport { max-width: none; color: #000; }
  /* Le papier est blanc : un rapport imprimé depuis le thème sombre reprend
     la palette claire, graphiques compris (apps/analytics/graphiques.py). */
  :root[data-theme] {
    --bg: #f6f3ee;
    --surface: #fffaf3;
    --surface-alt: #ffffff;
    --border: #e5ddd2;
    --border-strong: #ddd4c9;
    --text: #211f1d;
    --text-soft: #6b6459;
    --accent: #1f2937;
    --accent-soft: #eef1f5;
    --todo: #b08968;
    --done: #2f6f4e;
    --warn-bg: #fff6e5;
    --warn-border: #e8d5b0;
    --done-bg: #e4f0e9;
    --done-fg: #2f6f4e;
    --todo-bg: #f6ecdf;
    --todo-fg: #7a5a34;
    --info-bg: #e8eef6;
    --info-fg: #3a5a80;
    --alerte-bg: #f2e6e6;
    --alerte-fg: #83504f;
    --sur-done: #ffffff;
    --erreur: #a33333;
    --lien-doux: #3d6a9a;
    --graphe-serie-1: #3d6a9a;
    --graphe-serie-2: #2f6f4e;
    --graphe-serie-3: #9a5a12;
    --graphe-serie-4: #7a4f9a;
    --graphe-axe: #6b6459;
    --graphe-grille: #e5ddd2;
    color-scheme: light;
  }
  .graphe { max-width: 100%; break-inside: avoid; }
  .rapport table { page-break-inside: avoid; }
  .rapport a { color: inherit; text-decoration: none; }
}

/* ---------- Glisser-déposer du calendrier ---------- */

/* La zone de dépôt occupe la case entière : viser une case vide ne doit pas
   exiger de trouver la ligne de texte qu'elle contient. */
.jour-depot { min-height: 64px; }
.week .jour-depot { min-height: 160px; }
.week-day .jour-vide { font-size: 0.78rem; margin-top: -160px; pointer-events: none; }
.chip[data-deplacer] { cursor: grab; }
.chip.sortable-ghost { opacity: 0.4; }
.calendrier-aide { font-size: 0.78rem; margin-top: 6px; }
.calendrier-retour {
  margin-top: 10px;
  padding: 6px 10px;
  border-radius: 6px;
  background: var(--surface-alt);
  border: 1px solid var(--border);
  font-size: 0.85rem;
}
.calendrier-retour.erreur { border-color: var(--erreur); color: var(--erreur); }

/* ---------- Vue jour ---------- */

.journee { margin-top: 18px; border-top: 1px solid var(--border); }
.creneau {
  display: grid;
  grid-template-columns: 72px 1fr;
  border-bottom: 1px solid var(--border);
}
.creneau-heure {
  font-size: 0.78rem;
  color: var(--text-soft);
  padding: 6px 8px;
  display: flex;
  justify-content: space-between;
}
.creneau:hover .day-add { opacity: 0.6; }
.journee .jour-depot { min-height: 34px; padding: 4px; }
.creneau-depot .chip { display: inline-block; max-width: 32ch; margin-right: 6px; }
.creneau.maintenant { box-shadow: inset 3px 0 0 var(--accent); }

/* ---------- Repères du calendrier : temps forts et journées ---------- */

.repere {
  display: block;
  font-size: 0.7rem;
  line-height: 1.3;
  margin-bottom: 3px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.repere-temps-fort { color: var(--accent); font-weight: 600; }
/* Une journée n'est qu'une proposition : plus discrète qu'un temps fort choisi. */
.repere-journee { color: var(--text-soft); font-style: italic; }
.repere-ajout {
  font-size: 0.68rem;
  padding: 0 4px;
  margin-left: 2px;
  border: none;
  background: none;
  color: var(--lien-doux, var(--accent));
  cursor: pointer;
  opacity: 0;
}
.repere-journee:hover .repere-ajout, .repere-ajout:focus { opacity: 1; }
.reperes-du-jour { margin-top: 12px; }
.reperes-du-jour .repere { display: inline-block; margin-right: 12px; font-size: 0.82rem; }
.reperes-du-jour .repere-ajout { opacity: 1; }

/* ---------- Heure suggérée à la programmation ---------- */

.horaire-suggere { margin: 6px 0 12px; }
.horaire-choix { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 6px; }
.horaire-choix button { font-size: 0.8rem; }

/* ---------- Fil de commentaires ---------- */

.fil-commentaires { list-style: none; padding: 0; margin: 0 0 12px; }
.commentaire { padding: 8px 0; border-bottom: 1px solid var(--border); }
.commentaire:last-child { border-bottom: none; }
.commentaire p { margin: 2px 0; }
.commentaire-systeme { color: var(--text-soft); }

/* Un formulaire court sur une ligne : un choix, puis les gestes qui en dépendent. */
.ligne-de-gestes {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: flex-end;
}

/* Contenu court prévu sur un dépôt d'archives : deux gestes côte à côte. */
.depot-gestes { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin-top: 8px; }
.depot-gestes form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; max-width: 100%; }

/* « Reprogrammer » une date passée, depuis l'atelier. */
.reprogrammer { display: flex; flex-wrap: wrap; gap: 6px 10px; align-items: center; margin: 8px 0 14px; }

/* ---------- Vignette d'un média, partout où il est mentionné ---------- */

.vignette { margin: 0 0 12px; max-width: 100%; }
.vignette-ouvrir {
  display: block;
  padding: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  background: var(--surface-alt);
  cursor: zoom-in;
  max-width: 100%;
}
.vignette-ouvrir img { display: block; max-width: 100%; max-height: 240px; border-radius: var(--radius); }
.vignette-compacte .vignette-ouvrir img { max-height: 72px; }
.vignette-grande { display: block; max-width: 100%; max-height: 75vh; margin: 0 auto; }
.vignette-icone { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; }
.vignette figcaption { display: flex; flex-wrap: wrap; gap: 2px 12px; margin-top: 6px; }
.dialogue:has(.vignette-grande) { width: min(1100px, calc(100vw - 32px)); }

/* Le bouton Canva et son explication tiennent dans leur carte : le libellé
   « Indisponible : aucune application… » débordait de l'atelier. */
.bouton-canva {
  display: inline-flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px 10px;
  max-width: 100%;
}
.bouton-canva .meta { flex: 1 1 20ch; min-width: 0; overflow-wrap: anywhere; }

/* ---------- Versions proposées par le modèle ---------- */

/* Côte à côte quand deux colonnes de lecture tiennent, l'une sous l'autre
   sinon. La taille de police est fixée ici pour que `ch` mesure le texte des
   versions, et non celui de la carte. */
.versions-proposees {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--largeur-lecture)), 1fr));
  gap: 12px;
  margin-top: 10px;
  font-size: 0.9rem;
}
.versions-proposees > * { min-width: 0; }
.version-proposee .orientation { margin: 0 0 8px; font-size: 0.92rem; }
.spec-grid > #atelier-texte:has(.versions-proposees) { grid-column: 1 / -1; }

/* Le sens ne tient pas à la couleur seule : souligné pour l'ajout, barré pour
   le retrait, dans les deux thèmes. */
#propositions ins {
  text-decoration: underline;
  text-decoration-thickness: 2px;
  background: var(--done-bg);
  color: var(--done-fg);
}
#propositions del {
  text-decoration: line-through;
  background: var(--alerte-bg);
  color: var(--alerte-fg);
}
.differences { margin-top: 8px; }

/* ---------- Menu par phases et onglets de la phase courante ---------- */
.menu-phases ul { list-style: none; margin: 8px 0 0; padding: 0; }
.menu-phases a {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 10px;
  border-radius: 9px;
  text-decoration: none;
  color: var(--text);
}
.menu-phases a:hover { background: var(--surface-alt); }
.menu-phases a.current { background: var(--accent-soft); font-weight: 600; }
.menu-phases .nav-label { flex: 1; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.menu-phases .nav-etapes, .menu-phases .tag { white-space: nowrap; }
.menu-phases .nav-etapes { font-size: 0.75rem; color: var(--text-soft); }
.raccourcis .nouvelle-idee { font-weight: 600; }

.onglets-phase {
  flex: none;
  display: flex;
  flex-wrap: wrap;
  gap: 12px 18px;
  /* Mêmes marges que l'en-tête : sinon les titres de groupe collent au bord. */
  padding: 10px 28px 12px;
  border-bottom: 1px solid var(--border);
}
/* Le titre appartient au groupe : il garde sa ligne quand les onglets se replient. */
.onglets-groupe {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  min-width: 0;
  max-width: 100%;
  gap: 10px 6px;
}
.onglets-titre {
  flex-basis: 100%;
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-soft);
  margin-right: 2px;
}
.onglets-phase a {
  display: block;
  min-width: 0;
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  text-decoration: none;
  color: var(--text);
  border: 1px solid transparent;
}
.onglets-phase a:hover { border-color: var(--border-strong); }
.onglets-phase a.current { background: var(--accent); color: var(--surface-alt); }
.onglet-menu { position: relative; min-width: 0; max-width: 100%; }
.onglet-menu > summary {
  max-width: 100%;
  white-space: normal;
  overflow-wrap: anywhere;
  list-style: none;
  cursor: pointer;
  padding: 4px 10px;
  border-radius: 999px;
  font-size: 0.85rem;
  border: 1px solid transparent;
}
.onglet-menu > summary::-webkit-details-marker { display: none; }
.onglet-menu > summary::after { content: " ▾"; color: var(--text-soft); }
.onglet-menu > summary:hover { border-color: var(--border-strong); }
.onglet-menu > summary.current { background: var(--accent); color: var(--surface-alt); }
.onglet-menu-liste {
  position: absolute;
  z-index: 20;
  top: calc(100% + 4px);
  left: 0;
  min-width: min(14rem, 100%);
  max-width: 100%;
  display: flex;
  flex-direction: column;
  padding: 6px;
  background: var(--surface);
  border: 1px solid var(--border-strong);
  border-radius: 10px;
  box-shadow: 0 6px 18px rgb(0 0 0 / 12%);
}
.onglet-menu-liste a { border-radius: 8px; }
@media print { .onglets-phase { display: none; } }

/* Les mentions écrites restent compréhensibles sans perception des couleurs. */
.champ { margin-block: 1rem; border-inline-start: 3px solid currentColor; padding-inline-start: .8rem; min-width: 0; }
.champ-obligatoire { color: var(--champ-obligatoire); }
.champ-conseille { color: var(--champ-conseille); }
.champ-facultatif { color: var(--champ-facultatif); }
.champ-mention { font-size: .85rem; font-weight: 600; }
.champ input, .champ textarea, .champ select, .champ .helptext { color: var(--text); }
.champ-erreur { color: var(--champ-erreur); }
.champ-erreur input, .champ-erreur textarea, .champ-erreur select { border: 2px solid var(--champ-erreur); }
.champs-legende { font-size: .9rem; }

.apercu-image { max-width: 100%; max-height: 24rem; object-fit: contain; }
.media-vignette { width: 6rem; height: 5rem; object-fit: contain; vertical-align: middle; margin: .4rem; }
.bouton-ia { border: 2px solid var(--champ-obligatoire); box-shadow: inset 0 0 0 1px var(--surface); }
.bouton-ia::before { content: "✦ "; }

/* Les colonnes de lecture se replient au lieu de réduire les paragraphes. */
.screen-header > div:first-child { flex: 1 1 var(--largeur-lecture); min-width: 0; }
.card, .form, fieldset { min-width: 0; overflow-wrap: anywhere; }
.form input, .form select, .form textarea { max-width: 100%; }
.form-actions, .header-actions { flex-wrap: wrap; max-width: 100%; }
.form-actions > *, .header-actions > *, button, a.button { max-width: 100%; white-space: normal; overflow-wrap: anywhere; }
/* Un libellé d'option long (un plan, une identité) élargissait la liste
   déroulante au-delà de l'écran : un champ ne dépasse jamais son conteneur. */
input, select, textarea { max-width: 100%; }
/* Une ligne de parcours est flexible : sans min-width, son texte et son
   bouton de copie refusaient de rétrécir et poussaient la page de côté. */
.parcours-liste li { flex-wrap: wrap; min-width: 0; }
.parcours-liste li > * { min-width: 0; max-width: 100%; }
button.copier .adresse { max-width: min(22rem, 100%); }
@media (max-width: 700px) {
  /* Un tableau de plusieurs colonnes défile dans son propre cadre plutôt que
     d'imposer un défilement horizontal à toute la page. */
  table.screens { display: block; overflow-x: auto; position: relative; }
  /* Puisque le tableau défile, ses cellules gardent leurs mots entiers au
     lieu de les couper lettre à lettre pour tenir dans l'écran. */
  table.screens th, table.screens td,
  table.reseaux td:first-child { overflow-wrap: normal; }
}
@media (max-width: 600px) {
  .spec-grid > [style*="grid-column:span 2"] { grid-column: 1 / -1 !important; }
  .content > header { flex-wrap: wrap; }
}

.tickets-colonnes { display: grid; grid-template-columns: repeat(auto-fit, minmax(min(100%, var(--largeur-lecture)), 1fr)); gap: 1rem; margin-block: 1rem; }

/* ---------- Tâches de préparation ---------- */

.liste-taches { list-style: none; padding: 0; margin: 10px 0 0; }
.liste-taches li { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: center; padding: 4px 0; border-bottom: 1px solid var(--border); }
.liste-taches .form-ligne { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin: 0; max-width: 100%; }
.liste-taches .erreur { color: var(--erreur); }
.chip-taches { font-size: 0.7rem; padding: 0 4px; border-radius: 6px; border: 1px solid var(--border); }
.chip-taches.restantes { border-color: var(--st, var(--border-strong)); }

/* Retour à la vue d'origine (calendrier, kanban, listes) et voisines. */
.retour-vue { display: flex; flex-wrap: wrap; gap: 8px 18px; align-items: baseline; justify-content: space-between; margin: 0 0 14px; max-width: 100%; }
.retour-vue-voisins { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }

/* Générer depuis un document : taille chiffrée, choix de la cible, relecture */
.taille-document { margin: 12px 0; padding: 10px 14px; border-left: 3px solid var(--line, #ccc); max-width: var(--largeur-lecture); }
.taille-document.alerte { border-left-color: var(--erreur); }
.taille-document .erreur, .relecture-document .erreur { color: var(--erreur); }
.choix-cible { display: block; margin: 6px 0; }
.choix-cible .meta { display: block; margin-left: 1.6em; }
.proposition-document { margin: 14px 0; max-width: 100%; }
.proposition-document textarea, .proposition-document input[type="text"] { width: 100%; max-width: var(--largeur-lecture); }
