/* Interface de Sillon, identité « Champ » : une feuille, aucune ressource externe.
   Variables, base, composants, pages, puis la mise en page compacte des téléphones (< 640 px).
   Clair seulement. La couleur d'un statut suit `done` (status-open / status-done), jamais son nom. */

@font-face {
  font-family: "Bricolage Grotesque";
  src: url("fonts/bricolage-grotesque-latin.ad33cbc6d232.woff2") format("woff2");
  font-weight: 200 800;
  font-style: normal;
  font-display: swap;
}

:root {
  --bg: #fbf6ec;
  --field: #f2e8d5;
  --paper: #fffdf8;
  --ink: #2b2419;
  --muted: #6f624e;
  --line: #e3d5bb;
  --green: #2f5d3a;
  --green-dark: #244a2e;
  --green-soft: #dfe9dc;
  --wheat: #d98b2b;
  --wheat-soft: #f5e3c4;
  --wheat-ink: #8a5a14;
  --red: #9c3418;
  --red-soft: #f7d9d0;
  --blue: #35607f;
  --blue-soft: #dbe6ee;
  --shadow: 0 1px 0 var(--line);
  --lift: 0 1px 0 var(--line), 0 10px 24px -16px rgba(43, 36, 25, .45);
  --gutter: 24px;
  --mono: ui-monospace, "SF Mono", "Cascadia Mono", "DejaVu Sans Mono", Menlo, Consolas, monospace;
  color-scheme: light;
  font-family: "Bricolage Grotesque", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  font-size: 93.75%; /* 15 px par défaut, et suit la taille choisie dans le navigateur */
  line-height: 1.5;
  color: var(--ink);
  background: var(--bg);
}

/* ---- Base ---- */

* { box-sizing: border-box; }
body { margin: 0; background: var(--bg); }
h1, h2, h3, h4 { line-height: 1.15; }
h1 { font-size: 1.9rem; font-weight: 800; letter-spacing: -.02em; margin: 8px 0 14px; }
h2 { font-size: 1.15rem; font-weight: 650; letter-spacing: -.01em; margin: 28px 0 10px; }
h3 { font-size: 1rem; font-weight: 650; margin: 20px 0 8px; }
p { margin: 0 0 12px; }
a { color: var(--green); text-decoration-color: var(--wheat); text-decoration-thickness: 2px; text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
code, kbd, pre { font-family: var(--mono); font-size: .88em; }
pre code { font-size: inherit; }
time { font-variant-numeric: tabular-nums; }
:focus-visible { outline: 3px solid var(--green); outline-offset: 2px; }
.muted { color: var(--muted); }
.show-narrow { display: none; }

/* ---- En-tête global ---- */

.top { display: flex; flex-wrap: wrap; gap: 8px 16px; align-items: center; padding: 12px var(--gutter); border-bottom: 1px solid var(--line); }
.brand { display: flex; gap: 8px; align-items: center; flex: none; color: var(--ink); text-decoration: none; font-weight: 800; font-size: 1.25rem; letter-spacing: -.03em; }
.brand-mark { width: 20px; height: 15px; border-radius: 3px; flex: none; background: repeating-linear-gradient(90deg, var(--wheat) 0 3px, transparent 3px 6px); }
.crumbs { flex: 1; min-width: 0; display: flex; flex-wrap: wrap; align-items: center; gap: 0 6px; color: var(--muted); font-size: .93rem; }
/* Séparateur décoratif : le texte alternatif vide le garde hors du nom lu par les lecteurs d'écran. */
.crumbs > * + *::before { content: "›" / ""; display: inline-block; margin-right: 6px; color: var(--muted); text-decoration: none; }
.crumbs a { color: var(--muted); text-decoration: none; }
.crumbs a:hover { color: var(--green); text-decoration: underline; text-decoration-color: var(--wheat); }
.crumbs > :last-child { color: var(--ink); }
.who { display: flex; gap: 14px; align-items: center; color: var(--muted); font-size: .93rem; }
/* Recherche dans tous les espaces : un champ, validé par Entrée (formulaire GET, sans script). */
.recherche-globale { margin: 0; flex: 0 1 220px; min-width: 140px; }
.recherche-globale input { width: 100%; padding: 5px 10px; font-size: .93rem; }
.who form { margin: 0; }
.who .lien-agents { font-weight: 600; text-decoration: none; }
.who > span { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Menu du compte : un <details>, qui s'ouvre et se ferme sans script (les fiches n'en ont aucun). */
/* Le style commun des <details> (carte repliable des fiches : marge, fond, ombre) ne le concerne pas. */
.menu-compte { position: relative; margin: 0; padding: 0; border-radius: 0; background: none; box-shadow: none; }
.menu-compte > summary {
  display: flex; align-items: center; gap: 6px; padding: 4px 10px 4px 4px; border-radius: 999px;
  background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font-weight: 600;
  list-style: none; cursor: pointer;
}
.menu-compte > summary::-webkit-details-marker { display: none; }
.menu-compte > summary > .hide-narrow { max-width: 18ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.menu-compte[open] > summary { margin-bottom: 0; box-shadow: inset 0 0 0 1.5px var(--green); }
.initiale {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none;
  border-radius: 50%; background: var(--green-soft); color: var(--green); font-size: .87rem; font-weight: 700;
}
.menu-compte-panneau {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 20; width: 240px; box-sizing: border-box; padding: 6px;
  display: flex; flex-direction: column; gap: 2px; border-radius: 14px; background: var(--paper);
  box-shadow: 0 0 0 1px var(--line), 0 10px 28px rgba(43, 36, 25, .14); font-size: .93rem;
}
.menu-compte-panneau a { padding: 8px 12px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.menu-compte-panneau a:hover { background: var(--field); }
.menu-compte-panneau a.menu-secondaire { color: var(--green); }
.menu-compte-panneau hr { width: calc(100% - 12px); margin: 4px 6px; border: 0; border-top: 1px solid var(--line); }
.menu-intertitre { margin: 0; padding: 6px 12px 2px; color: var(--muted); font-size: .8rem; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; }
.menu-compte-panneau form { margin: 0; }
.menu-deconnexion, .menu-deconnexion:hover {
  width: 100%; justify-content: flex-start; padding: 8px 12px; border: 0; border-radius: 10px;
  background: none; color: var(--red); font-weight: 500;
}
.menu-deconnexion:hover { background: var(--red-soft); }
/* Sélecteur d'organisation (web/context.py) : un <details> sans script, comme le menu du compte. */
.selecteur-sep { color: var(--line); font-size: 1.45rem; font-weight: 300; line-height: 1; }
.selecteur-org { position: relative; flex: none; margin: 0; padding: 0; border-radius: 0; background: none; box-shadow: none; }
.selecteur-org > summary {
  display: flex; align-items: center; gap: 8px; padding: 4px 10px 4px 4px; border-radius: 10px;
  background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line); color: var(--ink); font-weight: 650;
  list-style: none; cursor: pointer;
}
.selecteur-org > summary::-webkit-details-marker { display: none; }
.selecteur-org > summary > .hide-narrow { max-width: 22ch; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.selecteur-org[open] > summary { margin-bottom: 0; box-shadow: inset 0 0 0 1.5px var(--green); }
.pastille-org {
  display: inline-flex; align-items: center; justify-content: center; width: 26px; height: 26px; flex: none;
  border-radius: 7px; font-size: .87rem; font-weight: 800;
}
.pastille-org.grande { width: 48px; height: 48px; border-radius: 12px; font-size: 1.45rem; }
.teinte-vert { background: var(--green-soft); color: var(--green); }
.teinte-ble { background: var(--wheat-soft); color: var(--wheat-ink); }
.teinte-bleu { background: var(--blue-soft); color: var(--blue); }
.teinte-neutre { background: var(--field); color: var(--muted); }
.selecteur-panneau {
  position: absolute; left: 0; top: calc(100% + 8px); z-index: 20; width: 330px; max-width: calc(100vw - 2 * var(--gutter));
  box-sizing: border-box; padding: 8px; display: flex; flex-direction: column; gap: 2px; border-radius: 14px;
  background: var(--paper); box-shadow: 0 0 0 1px var(--line), 0 10px 28px rgba(43, 36, 25, .14); font-size: .93rem;
}
.selecteur-panneau ul { list-style: none; margin: 0; padding: 0; display: grid; gap: 2px; }
.selecteur-panneau li a { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 10px; color: var(--ink); text-decoration: none; }
.selecteur-panneau li a:hover { background: var(--field); }
.selecteur-panneau li a[aria-current] { background: var(--field); }
.selecteur-panneau li .pastille-org { width: 30px; height: 30px; }
.selecteur-texte { flex-grow: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.3; }
.selecteur-nom { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
a[aria-current] .selecteur-nom { font-weight: 650; }
.selecteur-texte .muted { font-size: .83rem; }
.selecteur-panneau hr { width: calc(100% - 12px); margin: 6px; border: 0; border-top: 1px solid var(--line); }
.selecteur-panneau > a { display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: 10px; text-decoration: none; }
.selecteur-panneau > a:hover { background: var(--field); }
.selecteur-panneau > a.menu-secondaire { color: var(--green); font-weight: 600; }
.selecteur-panneau > a.menu-gerer { color: var(--muted); }
.selecteur-recherche { margin: 2px 2px 6px; }
.selecteur-recherche input { width: 100%; padding: 7px 10px; font-size: .93rem; }
/* Page Espaces d'une organisation : en-tête, carte « Nouvel espace », ligne « Ailleurs ». */
.org-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 24px; margin: 8px 0 18px; }
.org-id { display: flex; align-items: center; gap: 14px; }
.org-id p { margin: 0; font-size: .93rem; }
.org-id h1 { margin: 0; }
.org-liens { display: flex; gap: 16px; font-size: .93rem; font-weight: 600; }
.carte-nouvel-espace {
  box-sizing: border-box; height: 100%; min-height: 150px; display: flex; flex-direction: column; align-items: center;
  justify-content: center; gap: 6px; border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--line); color: var(--green);
  font-weight: 600; text-decoration: none; text-align: center; padding: 12px;
  background: repeating-linear-gradient(135deg, transparent 0 10px, rgba(227, 213, 187, .25) 10px 20px);
}
.carte-nouvel-espace:hover { background-color: var(--green-soft); }
.ailleurs { margin: 20px 0 0; font-size: .93rem; }
/* Onglet Configuration : une icône, nommée par aria-label ; marqué actif comme les autres onglets. */
.tabs a.onglet-icone { display: inline-flex; align-items: center; padding-inline: 12px; }

/* ---- Mise en page ---- */

main { max-width: 1200px; margin: 0 auto; padding: 20px var(--gutter) 56px; }

.space-head { display: flex; justify-content: space-between; align-items: flex-end; flex-wrap: wrap; gap: 12px 32px; }
.space-id { min-width: 0; }
.space-org { margin: 0; color: var(--muted); font-size: .93rem; }
.space-name { margin: 0; font-size: 2.2rem; }
.space-desc { margin: 6px 0 0; max-width: 64ch; color: var(--muted); }
.space-progress { min-width: 200px; text-align: right; color: var(--muted); font-size: .93rem; }
.space-progress .bar { margin-top: 6px; }
.progress-count { font-variant-numeric: tabular-nums; }

.bar { height: 8px; border-radius: 999px; overflow: hidden; background: repeating-linear-gradient(90deg, var(--line) 0 4px, var(--field) 4px 8px); }
.bar span { display: block; height: 100%; border-radius: 999px; background: var(--green); }

.space-action { flex: none; }
.tabs-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin: 18px 0 22px; }
.tabs { display: flex; flex-wrap: wrap; gap: 4px; }
.tabs a { padding: 6px 14px; border-radius: 999px; color: var(--muted); text-decoration: none; white-space: nowrap; }
.tabs a:hover { background: var(--field); color: var(--ink); }
.tabs a[aria-current="page"] { background: var(--green); color: var(--bg); font-weight: 600; }
/* Seconde barre de l'onglet Configuration : même composant, une teinte plus discrète — elle
   navigue à l'intérieur d'un onglet, elle ne choisit pas l'onglet. */
.sous-onglets { margin: -12px 0 22px; font-size: .93rem; }
.sous-onglets a[aria-current="page"] { background: var(--field); color: var(--ink); }

/* ---- Actions ---- */

button, .btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  padding: 9px 18px; border: 1.5px solid var(--green); border-radius: 999px;
  background: var(--green); color: var(--bg); font: inherit; font-weight: 600; line-height: 1.2;
  text-decoration: none; white-space: nowrap; cursor: pointer;
}
button:hover, .btn:hover { background: var(--green-dark); border-color: var(--green-dark); color: var(--bg); }
.btn-secondary { background: transparent; color: var(--green); }
.btn-secondary:hover { background: var(--green-soft); border-color: var(--green); color: var(--green); }
.btn-danger { background: transparent; border-color: var(--red); color: var(--red); }
.btn-danger:hover { background: var(--red-soft); border-color: var(--red); color: var(--red); }
button.link, button.link:hover {
  padding: 0; border: 0; border-radius: 0; background: none; color: var(--green); font-weight: inherit;
  text-decoration: underline; text-decoration-color: var(--wheat); text-decoration-thickness: 2px; text-underline-offset: 3px;
}
.actions { display: flex; flex-wrap: wrap; gap: 12px 18px; align-items: center; margin: 18px 0; }
.actions form { margin: 0; }
.more { display: inline-block; margin-top: 14px; font-weight: 600; }

/* ---- Pastilles ---- */

.prio, .status, .tag, .count {
  display: inline-flex; align-items: center; width: fit-content; max-width: 100%; padding: 1px 10px; border-radius: 999px;
  font-size: .8rem; font-weight: 600; line-height: 1.6; white-space: nowrap; letter-spacing: 0;
}
/* Libellés et noms de catégorie choisis par les utilisateurs (64 caractères) : ils passent à la ligne. */
.status, .tag { white-space: normal; overflow-wrap: anywhere; }
.prio-haute { background: var(--red-soft); color: var(--red); }
.prio-normale { background: var(--field); color: var(--muted); }
.prio-basse { background: var(--blue-soft); color: var(--blue); }
.status-open { background: var(--wheat-soft); color: var(--wheat-ink); }
.status-done { background: var(--green-soft); color: var(--green); }
.tag { box-shadow: inset 0 0 0 1px var(--line); color: var(--muted); font-weight: 500; }
/* Une déclaration d'auteur l'emporte sur le `[hidden] { display: none }` du navigateur :
   sans cette règle, tout ce qui porte `hidden` et une règle `display` resterait visible. */
[hidden] { display: none !important; }
/* Lien permanent vers /agents/. La pastille ci-dessous en est l'**état**, pas le chemin : en
   faire le seul point d'entrée rendait la page inatteignable dès que le compteur tombait à zéro,
   c'est-à-dire précisément quand on a le temps de la lire. */
.lien-agents { white-space: nowrap; }
/* Identifiant court d'une session : opaque, donc en monospace pour se comparer à l'œil. */
.session-courte { font-family: var(--mono); font-size: .8rem; color: var(--muted); }
/* Pastille « un agent vous attend » : la teinte d'une tâche ouverte, mais cliquable. */
.pastille-agents { text-decoration: none; white-space: nowrap; }
.pastille-agents:hover { background: var(--wheat); color: var(--bg); }
.count { background: var(--bg); color: var(--muted); font-weight: 500; padding: 0 8px; }
.dot { width: 9px; height: 9px; border-radius: 50%; flex: none; }
.dot-open { background: var(--wheat); }
.dot-done { background: var(--green); }

/* ---- Cartes, listes, vide, messages ---- */

.card { display: block; min-width: 0; padding: 14px 16px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.card > :last-child { margin-bottom: 0; }
a.card { color: var(--ink); text-decoration: none; transition: box-shadow .15s, transform .15s; }
a.card:hover { box-shadow: var(--lift); transform: translateY(-1px); }
.card-title { font-weight: 650; font-size: 1.05rem; }
a.card-title { color: var(--ink); text-decoration: none; }
a.card-title:hover { color: var(--green); text-decoration: underline; text-decoration-color: var(--wheat); }
li.card p { margin: 6px 0 0; }
.card .tag { margin-left: 4px; }

/* ---- Questions posées par les agents ---- */

.question { margin-bottom: 12px; }
fieldset.question, .question fieldset { margin: 0 0 12px; padding: 0; border: 0; min-width: 0; }
.question legend, .question-text { padding: 0; margin-bottom: 8px; font-weight: 650; overflow-wrap: anywhere; }
.question .options { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 6px; }
.question .options .help { margin: 2px 0 0 calc(1.05em + 8px); }
.question .options .chosen { font-weight: 650; color: var(--green); }
.question .recommande { background: var(--green-soft); color: var(--green); box-shadow: none; }
.question .withdraw { display: inline; }
.question blockquote { margin: 0 0 8px; padding-left: 12px; border-left: 3px solid var(--wheat); }
.question .by { margin: 8px 0 0; font-size: .87rem; }
.tag.questions { background: var(--wheat-soft); color: var(--wheat-ink); box-shadow: none; }
/* Échéance passée d'une tâche ouverte (tasks/deadlines.py) : la teinte d'alerte, la date reste à côté. */
.tag.en-retard { background: var(--red-soft); color: var(--red); box-shadow: none; }
/* Échéance et responsable d'une carte du Tableau, groupés : ils passent à la ligne ensemble. */
.reperes { display: inline-flex; flex-wrap: wrap; gap: 4px; }
.reperes .tag { white-space: nowrap; }
/* Responsable d'une tâche (un poste ou une personne) : un repère neutre, marqué d'une arobase ; le
   bleu est déjà la priorité basse. */
.tag.responsable { color: var(--ink); font-weight: 600; }
.tag.responsable::before { content: "@" / ""; margin-right: 1px; color: var(--muted); }
.tag.responsable .muted { margin-left: 4px; font-weight: 500; }
/* Espace d'origine d'une note liée venue d'un autre espace de l'organisation. */
.badge-espace { display: inline-flex; padding: 0 8px; border-radius: 999px; background: var(--blue-soft); color: var(--blue); font-size: .8rem; font-weight: 600; line-height: 1.6; white-space: nowrap; }
.questions-link { margin: 0 0 12px; font-weight: 650; }
/* Page Questions : une tâche par accordéon, une question par bande séparée d'un filet. Les
   accordéons imbriqués (précision, déjà répondues, modifier) n'ont pas l'habit de carte. */
details.question-group { margin: 0 0 12px; }
/* Un résumé en flex perd son triangle : le chevron le remplace, pour qu'on voie qu'il s'ouvre. */
.question-group > summary { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; list-style: none; }
.question-group > summary::-webkit-details-marker { display: none; }
.question-group > summary::before { content: "▸"; color: var(--green); }
.question-group[open] > summary::before { content: "▾"; }
/* Le legend d'un fieldset se pose sur sa bordure : flottant, il reste sous le filet. */
fieldset.question > legend { float: left; width: 100%; }
fieldset.question > legend + * { clear: both; }
.question-group > summary .card-title { margin-right: auto; }
.question-group .question, #questions .question { padding-top: 12px; border-top: 1px solid var(--line); }
.question details, details.answered-group {
  margin-top: 6px; padding: 0; border-radius: 0; background: none; box-shadow: none;
}
.question details > summary, details.answered-group > summary { font-weight: 500; color: var(--green); }
.question details.precision textarea { margin-top: 6px; }
.question textarea { min-height: 4em; }
details.answered-group { margin-top: 12px; }
/* Lu par les lecteurs d'écran, invisible à l'œil. */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }

.spaces, .notes, .categories, .member-list, .invitations { list-style: none; margin: 0; padding: 0; display: grid; gap: 12px; }
.spaces { grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); margin-bottom: 20px; }
.spaces .bar { margin-top: 12px; }
.shared { color: var(--muted); font-size: .87rem; }
.categories .archived { opacity: .65; }
.organizations { padding-left: 20px; }

.empty { margin: 0; padding: 12px 16px; border: 1.5px dashed var(--line); border-radius: 12px; color: var(--muted); }
.notice { max-width: 720px; margin: 0 0 18px; padding: 10px 14px; border-radius: 12px; background: var(--green-soft); color: var(--green); font-weight: 500; }
.notice-error { background: var(--red-soft); color: var(--red); }
.error { margin: 6px 0 0; color: var(--red); font-size: .93rem; }
ul.errorlist { list-style: none; margin: 6px 0; padding: 0; color: var(--red); font-size: .93rem; }

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

label { font-weight: 600; }
input[type="text"], input[type="email"], input[type="password"], input[type="search"],
input[type="number"], input[type="url"], input[type="date"], select, textarea {
  max-width: 100%; padding: 8px 12px; border: 1.5px solid var(--line); border-radius: 10px;
  background: var(--paper); color: var(--ink); font: inherit;
}
textarea { width: 100%; min-height: 8em; resize: vertical; line-height: 1.5; }
input:focus, select:focus, textarea:focus { border-color: var(--green); }
input[type="checkbox"], input[type="radio"] { width: 1.05em; height: 1.05em; margin: 0; accent-color: var(--green); flex: none; }
.field { margin-bottom: 18px; }
.field > label { display: block; margin-bottom: 6px; }
.field input:not([type="checkbox"]):not([type="radio"]), .field select, .field textarea { width: 100%; }
.help, .helptext { display: block; margin: 5px 0 14px; color: var(--muted); font-size: .87rem; font-weight: 400; }
/* Choix multiples : Django les rend en <div> (ou <ul> selon le widget). */
.field ul, .field > div { list-style: none; margin: 4px 0; padding: 0; display: grid; gap: 6px; }
.field ul label, .field > div label, label.checkbox { display: flex; gap: 8px; align-items: center; font-weight: 400; }
form p { margin: 0 0 16px; }
form p > label { display: block; margin-bottom: 6px; }
form p > input:not([type="checkbox"]):not([type="radio"]) { width: 100%; }
.card.edit, .edit { max-width: 640px; }
form.edit { margin-top: 20px; }
.card.edit { padding: 22px 24px; }
.edit h1, .edit h2 { margin-top: 0; }
.archive { max-width: 640px; margin-top: 24px; }

.search { display: flex; flex-wrap: wrap; gap: 8px; align-items: center; margin: 0 0 14px; }
.search input { flex: 1; min-width: 200px; }
.filters { display: flex; flex-wrap: wrap; gap: 6px; margin: 0 0 20px; }
.filters a { padding: 5px 14px; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow); color: var(--ink); text-decoration: none; }
.filters a:hover { background: var(--field); }
.filters a[aria-current="true"] { background: var(--green-soft); color: var(--green); font-weight: 600; box-shadow: none; }

/* ---- Tableau ---- */

.board { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 16px; align-items: start; }
.column { display: flex; flex-direction: column; gap: 8px; padding: 12px; border-radius: 16px; background: var(--field); }
.column h2 { display: flex; align-items: center; gap: 8px; margin: 2px 4px 4px; font-size: 1rem; }
.column h2 .count { margin-left: auto; }
.column .more { margin: 2px 4px; }
.task { display: flex; flex-direction: column; align-items: flex-start; gap: 6px; }
.members ul, ul.members { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 8px; }
.members li { padding: 4px 12px; border-radius: 999px; background: var(--paper); box-shadow: var(--shadow); }

/* ---- Fiches et contenu des agents ---- */

.sheet { max-width: 820px; }
.meta { display: flex; flex-wrap: wrap; gap: 6px 8px; align-items: center; margin: 0 0 16px; font-size: .93rem; }
.prose { padding: 6px 22px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); overflow-wrap: anywhere; }
.prose h1, .prose h2, .prose h3, .prose h4 { margin: 22px 0 8px; font-weight: 650; letter-spacing: -.01em; }
.prose h1 { font-size: 1.4rem; }
.prose h2 { font-size: 1.2rem; }
.prose h3, .prose h4 { font-size: 1.05rem; }
.prose p, .prose ul, .prose ol, .prose pre, .prose table, .prose blockquote { margin: 12px 0; }
.prose li + li { margin-top: 3px; }
.prose code { padding: 1px 5px; border-radius: 5px; background: var(--field); }
.prose pre { padding: 12px 14px; border-radius: 10px; background: var(--field); overflow-x: auto; }
.prose pre code { padding: 0; background: none; }
.prose blockquote { padding: 2px 0 2px 14px; border-left: 3px solid var(--wheat); color: var(--muted); }
.prose table { display: block; max-width: 100%; overflow-x: auto; border-collapse: collapse; }
.prose hr { border: 0; border-top: 1px solid var(--line); }
.feed .prose { padding: 0; border-radius: 0; background: none; box-shadow: none; }
.feed .prose > :first-child { margin-top: 0; }
.feed .prose > :last-child { margin-bottom: 0; }

.links { display: grid; grid-template-columns: repeat(auto-fit, minmax(240px, 1fr)); gap: 0 28px; }
.links ul { padding-left: 20px; }
.links li + li { margin-top: 4px; }

table { border-collapse: collapse; }
th, td { padding: 7px 12px 7px 0; border-bottom: 1px solid var(--line); text-align: left; vertical-align: top; }
th { color: var(--muted); font-size: .85rem; font-weight: 600; }
main > table { width: 100%; }
details { margin-top: 24px; padding: 12px 16px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); }
details > table { display: block; width: 100%; overflow-x: auto; font-size: .9rem; }
summary { cursor: pointer; font-weight: 600; }
details[open] > summary { margin-bottom: 10px; }

/* Journal d'une tâche, fil d'activité. */
.day { margin: 26px 0 10px; padding-bottom: 6px; border-bottom: 1px solid var(--line); color: var(--muted); font-size: 1rem; font-weight: 600; }
.feed { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 12px; }
.event { display: grid; grid-template-columns: 4.5em 1fr; gap: 12px; align-items: baseline; }
.sheet .event { grid-template-columns: 10em 1fr; }
.event time { white-space: nowrap; }
.event time { color: var(--muted); font-family: var(--mono); font-size: .8rem; }
.event > div { min-width: 0; overflow-wrap: anywhere; }
.feed-cards { gap: 8px; }
.feed-cards .event { padding: 10px 14px; border-radius: 12px; background: var(--paper); box-shadow: var(--shadow); }
/* Pastille des tâches terminées par un agent depuis la dernière visite, et leurs lignes dans l'Activité. */
.tag.nouveautes { background: var(--green-soft); color: var(--green); box-shadow: none; text-decoration: none; }
.spaces .tag.nouveautes { display: inline-block; margin: 6px 0 0; }
.nouveautes-compte {
  display: inline-block; min-width: 1.4em; margin-left: 4px; padding: 0 6px; border-radius: 999px;
  background: var(--green); color: var(--bg); font-size: .8rem; font-weight: 650; text-align: center;
}
.nouveautes-compte[hidden], .tag.nouveautes[hidden] { display: none; }
.feed-cards .event-new { box-shadow: inset 3px 0 0 var(--green), var(--shadow); }
.by { display: block; font-size: .85rem; }

/* ---- Authentification, consentement ---- */

main.auth { max-width: 440px; padding-top: 48px; }
main.auth-wide { max-width: 620px; }
main.auth::after {
  content: ""; display: block; height: 28px; margin-top: 48px; border-radius: 6px;
  background: repeating-linear-gradient(90deg, transparent 0 12px, var(--field) 12px 16px);
}
.auth-card { padding: 28px; border-radius: 20px; background: var(--paper); box-shadow: var(--lift); }
.auth-card h1 { margin-top: 0; font-size: 1.6rem; }
.auth-card form > button { width: 100%; margin-top: 4px; }
.auth-links { margin: 16px 0 0; text-align: center; color: var(--muted); font-size: .93rem; }
.qr svg { display: block; width: 220px; height: 220px; margin: 8px auto 16px; padding: 10px; border-radius: 12px; background: #fff; }
.secret { overflow-wrap: anywhere; }
.codes { padding: 14px 16px; border-radius: 12px; background: var(--field); font-size: 1.05rem; }

.consent fieldset { margin: 0 0 16px; padding: 0; border: 0; }
.consent legend { margin-bottom: 8px; padding: 0; font-weight: 600; }
.consent label { display: flex; gap: 8px; align-items: center; margin: 4px 0; font-weight: 400; }
.consent-spaces { margin: 6px 0 0 26px; }
.consent-actions { display: flex; gap: 10px; }
.consent-actions button { flex: 1; }

/* ---- Mon compte ---- */

.account-section { max-width: 720px; margin-bottom: 16px; }
.account-section h2 { margin-top: 0; }
.account-section ul { padding-left: 20px; }
.connections { display: block; overflow-x: auto; overflow-wrap: normal; }
.connections th, .connections td { vertical-align: middle; }
.connections form { margin: 0; }
.account-logout { margin-top: 24px; }

/* ---- Téléphone : chaque pixel au contenu ---- */

@media (max-width: 639px) {
  :root { font-size: 87.5%; --gutter: 12px; }
  /* Le bouton fixé en bas ne masque pas l'élément qui reçoit le focus clavier. */
  html { scroll-padding-bottom: 76px; }
  /* Sous 16 px, iOS Safari agrandit la page au focus d'un champ. */
  input, select, textarea { font-size: max(16px, 1rem); }
  /* Anneau de focus dessiné à l'intérieur : les rangées qui défilent ou tronquent le rogneraient. */
  .tabs a:focus-visible, .filters a:focus-visible, .crumbs a:focus-visible { outline-offset: -3px; }
  .hide-narrow { display: none !important; }
  .show-narrow { display: inline; }
  h1 { font-size: 1.4rem; margin: 4px 0 10px; }
  h2 { margin: 20px 0 8px; }

  /* Hauteur minimale, pas fixe : le champ de recherche et le menu du compte doivent y tenir. */
  .top { flex-wrap: nowrap; min-height: 38px; gap: 10px; padding: 4px var(--gutter); }
  .brand-name { display: none; }
  .crumbs { flex-wrap: nowrap; overflow: hidden; white-space: nowrap; font-size: .9rem; }
  .crumbs > * { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
  .crumbs > :not(:nth-last-child(-n+2)) { display: none; }
  .crumbs > :nth-last-child(2):not(:first-child)::before { display: none; }
  .who { flex: none; }
  /* Le lien et la pastille mènent au même endroit. Sur un écran étroit — et surtout sur les
     pages d'allauth, où « Se déconnecter » reste visible — les deux ne tiennent pas ensemble.
     La pastille l'emporte quand elle est là ; à zéro le lien reste, ce qui est tout l'intérêt
     de l'avoir ajouté : sans lui la page n'était joignable que pendant une attente. */
  .lien-agents:has(+ .pastille-agents:not([hidden])) { display: none; }
  .who a { font-weight: 600; text-decoration: none; }
  /* Sous 640 px, le nom quitte le bouton : l'initiale reste, dans une cible de 44 px. */
  /* Bouton compact à l'œil, cible tactile de 44 px par un pseudo-élément qui déborde. */
  .menu-compte > summary { position: relative; padding: 4px 8px 4px 4px; }
  .menu-compte > summary::before { content: ""; position: absolute; inset: -6px -2px; }
  .menu-compte-panneau a { font-weight: 500; }
  /* Sous 640 px, seule la pastille de l'organisation reste dans l'en-tête. */
  .selecteur-org > summary { position: relative; padding: 4px 6px 4px 4px; }
  .selecteur-org > summary::before { content: ""; position: absolute; inset: -6px -2px; }
  .selecteur-sep { display: none; }
  .org-head { flex-direction: column; align-items: flex-start; gap: 10px; }

  main { padding: 10px var(--gutter) 28px; }
  main.has-action { padding-bottom: 76px; }

  /* Nom et avancement sur une ligne ; la description, avec son lien « Modifier », sur le Tableau seulement. */
  .space-head { flex-wrap: nowrap; align-items: center; gap: 10px; }
  .space-org { display: none; }
  .space-id { flex: 1; }
  .space-desc { margin-top: 2px; font-size: .9rem; }
  .space-name { font-size: 1.36rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
  .space-progress { min-width: 0; flex: none; display: flex; align-items: center; gap: 6px; font-size: .8rem; }
  .space-progress .bar { width: 54px; height: 6px; margin: 0; }
  .tabs-row { margin: 8px 0 10px; }
  .tabs { flex-wrap: nowrap; gap: 2px; margin: 0 calc(-1 * var(--gutter)); padding: 0 var(--gutter); overflow-x: auto; scrollbar-width: none; }
  .tabs::-webkit-scrollbar { display: none; }
  .tabs a { padding: 4px 11px; font-size: .93rem; }
  .space-action {
    position: fixed; z-index: 10; left: var(--gutter); right: var(--gutter); bottom: 12px;
    background: var(--green); color: var(--bg); box-shadow: 0 10px 24px -10px rgba(43, 36, 25, .6);
  }
  .space-action:hover { background: var(--green-dark); color: var(--bg); }

  .card { padding: 10px 12px; border-radius: 12px; }
  a.card:hover { transform: none; }
  .card.edit { padding: 0; background: none; box-shadow: none; }
  .empty { padding: 8px 12px; }
  .notice { margin-bottom: 10px; padding: 8px 12px; }
  .filters { margin-bottom: 12px; flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
  .filters a { flex: none; padding: 4px 12px; }
  .spaces { grid-template-columns: 1fr; gap: 8px; }
  .search { flex-wrap: nowrap; margin-bottom: 10px; }
  .search input { min-width: 0; }
  .search button { padding: 8px 14px; }

  .board { grid-template-columns: 1fr; gap: 4px; }
  .column { gap: 5px; padding: 0; background: none; border-radius: 0; }
  .column h2 { margin: 10px 0 2px; color: var(--muted); font-size: .8rem; text-transform: uppercase; letter-spacing: .05em; }
  .column h2 .count { margin-left: 0; padding: 0; background: none; }
  .task { flex-direction: row; align-items: baseline; gap: 9px; padding: 8px 10px; border-radius: 10px; }
  /* Priorité en signe plutôt qu'en mot : une forme par niveau, pas seulement une couleur. */
  .task .prio { flex: none; width: 1em; padding: 0; justify-content: center; background: none; font-size: .75rem; }
  .task .prio::before { content: "●" / ""; }
  .task .prio-haute::before { content: "▲" / ""; }
  .task .prio-basse::before { content: "▼" / ""; }
  .task .prio-text { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
  .task .card-title { font-size: 1rem; }
  /* Échéance et responsable passent sous le titre, alignés sur lui (après le signe de priorité). */
  .task { flex-wrap: wrap; }
  .task .reperes { flex-basis: 100%; padding-left: calc(1em + 9px); }

  .meta { margin-bottom: 10px; font-size: .8rem; gap: 4px 6px; }
  .prose { padding: 2px 12px; border-radius: 12px; }
  .actions { gap: 18px; margin: 10px 0; }
  .actions button, .actions .btn {
    padding: 0; border: 0; border-radius: 0; background: none; color: var(--green);
    text-decoration: underline; text-decoration-color: var(--wheat); text-decoration-thickness: 2px; text-underline-offset: 3px;
  }
  .actions .btn-danger { color: var(--red); text-decoration-color: currentColor; }
  .actions button:hover, .actions .btn:hover { background: none; }
  /* Journal d'une fiche : l'heure, longue, passe sous l'entrée ; dans l'activité, elle reste à gauche. */
  .sheet .event { display: flex; flex-direction: column; gap: 2px; padding-left: 10px; border-left: 2px solid var(--line); }
  .sheet .event time { order: 2; font-size: .75rem; }
  .feed-cards { gap: 6px; }
  .feed-cards .event { grid-template-columns: 3.4em 1fr; gap: 8px; padding: 7px 10px; }
  details { padding: 10px 12px; }

  main.auth { padding-top: 20px; }
  main.auth::after { margin-top: 28px; }
  .auth-card { padding: 0; background: none; box-shadow: none; }

  /* Mon compte : une connexion par bloc plutôt qu'un tableau qui déborde. */
  .connections thead { display: none; }
  .connections tr { display: grid; grid-template-columns: 1fr auto; gap: 2px 12px; padding: 8px 0; border-top: 1px solid var(--line); }
  .connections td { padding: 0; border: 0; }
  .connections td:first-child { font-weight: 600; }
  .connections td:last-child { grid-column: 2; grid-row: 1 / span 3; align-self: center; }
  .connections td[data-label]::before { content: attr(data-label) " : "; color: var(--muted); }
}

/* Sommaire latéral d'une documentation longue (spec 2026-09-30) : deux colonnes, le sommaire collé
   au défilement. Sans script : la section courante est marquée par la page, pas par le défilement,
   donc aucun sous-titre ne l'est. Le chevron suit la section ouverte, il est décoratif. */
.doc-sommaire { display: grid; grid-template-columns: 248px minmax(0, 820px); gap: 32px; align-items: start; }
.sommaire { position: sticky; top: 16px; max-height: calc(100vh - 32px); overflow-y: auto; font-size: .93rem; }
.sommaire-titre { margin: 4px 0 14px; font-size: 16px; font-weight: 650; line-height: 1.25; overflow-wrap: anywhere; }
.sommaire-intertitre { margin: 0 0 6px; padding: 0 10px; color: var(--muted); font-size: .75rem; font-weight: 650; letter-spacing: .08em; text-transform: uppercase; }
.sommaire-liste, .sommaire-liste ul { list-style: none; margin: 0; padding: 0; }
.sommaire-liste a { display: flex; gap: 6px; align-items: baseline; padding: 5px 10px; border-radius: 8px; color: var(--ink); text-decoration: none; overflow-wrap: anywhere; }
.sommaire-liste a:hover { background: var(--field); }
.sommaire-liste a[aria-current="page"] { background: var(--field); font-weight: 650; }
.sommaire-liste .chevron { flex: none; width: 1ch; color: var(--muted); }
.sommaire-liste .sous-titres { margin: 2px 0 6px 18px; box-shadow: inset 1.5px 0 0 var(--line); }
.sommaire-liste .sous-titres a { padding: 3px 10px 3px 12px; color: var(--muted); font-size: .88rem; }
.sommaire-replie { display: none; }
.visually-hidden { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
@media (max-width: 639px) {
  /* Deux colonnes ne tiennent pas : le sommaire passe au-dessus du texte, replié. */
  .doc-sommaire { display: block; }
  .sommaire { display: none; }
  .sommaire-replie { display: block; margin: 0 0 14px; }
  .sommaire-replie > summary { font-weight: 650; }
  .sommaire-replie .sommaire-liste { margin-top: 8px; }
}

/* ---- Choix des notes liées d'une tâche (_linked_notes_field.html, notes-liees.js) ---- */

.notes-liees { display: flex; flex-direction: column; gap: 8px; margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.notes-liees legend { padding: 0; margin-bottom: 6px; font-weight: 650; }
.notes-liees legend .count { box-shadow: inset 0 0 0 1px var(--line); }
.pastilles { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: 6px; }
.pastilles:empty { display: none; }
/* Une pastille est une case cochée : la décocher retire le lien à l'enregistrement, sans script. */
.pastille { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px 3px 12px; border-radius: 999px; background: var(--green-soft); color: var(--green); font-size: .9rem; font-weight: 600; cursor: pointer; }
.pastille input { position: absolute; width: 1px; height: 1px; opacity: 0; }
.pastille:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
.pastille .badge-espace { background: var(--paper); }
.pastille .retirer { font-size: 1.1rem; line-height: 1; }
.pastille:has(input:not(:checked)) { background: var(--field); color: var(--muted); text-decoration: line-through; }
.pastille:has(input:not(:checked)) .retirer { display: none; }
.recherche-notes { display: flex; gap: 8px; }
.recherche-notes input { flex: 1; min-width: 0; }
.resultats-notes { max-height: 196px; overflow-y: auto; display: flex; flex-direction: column; gap: 6px; }
.resultat { display: flex; gap: 10px; align-items: center; padding: 8px 12px; border-radius: 10px; background: var(--field); font-weight: 500; cursor: pointer; }
.resultat-titre { flex: 1; min-width: 0; overflow-wrap: anywhere; }
.resultat .muted { font-size: .8rem; }
@media (max-width: 639px) {
  .resultat { flex-wrap: wrap; row-gap: 4px; }
  .resultat-titre { flex-basis: calc(100% - 30px); }
  .resultat .badge-espace { margin-left: 26px; }
  .resultat .badge-espace + .muted { margin-left: 0; }
  .resultat .resultat-titre + .muted { margin-left: 26px; }
}
mark { background: var(--wheat-soft); color: inherit; border-radius: 3px; }

/* ---- Statuts d'un espace : liste ordonnée, glisser-déposer (web/static/web/statuts.js) ---- */

.statuts-entete { display: flex; align-items: center; justify-content: space-between; gap: 16px; margin: 0 0 12px; }
.statuts-entete .btn { margin-left: auto; }
.statuts-entete p { margin: 0; font-size: .93rem; }
.statuts-entete .btn { flex: none; display: inline-flex; align-items: center; gap: 6px; }
.statuts { list-style: none; margin: 0 0 12px; padding: 0; display: grid; gap: 10px; max-width: 820px; }
.statut { display: flex; align-items: center; gap: 12px; padding: 12px 18px; border-radius: 14px; background: var(--paper); box-shadow: var(--shadow); }
.statuts.glisser .statut { padding-left: 8px; }
.statut-corps { flex-grow: 1; min-width: 0; }
.statut-corps p { margin: 2px 0 0; font-size: .93rem; }
.statut-titre { display: inline-flex; align-items: center; gap: 8px; font-size: 1.1rem; font-weight: 650; }
.statut .tag.nouvelles { flex: none; background: var(--field); box-shadow: none; }
.poignee { display: inline-flex; align-items: center; justify-content: center; flex: none; width: 32px; height: 44px; padding: 0; border: 0; border-radius: 8px; background: transparent; color: var(--muted); cursor: grab; }
.poignee:hover, .poignee:focus-visible { background: var(--field); color: var(--ink); }
.poignee[hidden] { display: none; }
.deplacer { display: flex; gap: 6px; flex: none; margin: 0; }
.deplacer button { padding: 4px 12px; font-size: .87rem; }
/* Avec le script et une souris, la poignée remplace Monter / Descendre ; au doigt, où le
   glisser-déposer natif n'est pas fiable, les boutons restent. */
@media (pointer: fine) { .statuts.glisser .deplacer { display: none; } }
@media (pointer: coarse) {
  .statuts.glisser .poignee, #aide-glisser { display: none; }
  .statuts.glisser .statut { padding-left: 18px; }
}
.statut.souleve { box-shadow: 0 0 0 2px var(--green), 0 14px 30px rgba(43, 36, 25, .18); opacity: .96; }
.marqueur { height: 0; margin: -3px 0; border-top: 3px solid var(--green); border-radius: 3px; position: relative; list-style: none; }
.marqueur::before { content: ""; position: absolute; left: -6px; top: -7px; width: 11px; height: 11px; border-radius: 50%; background: var(--green); }
.statuts-etat { min-height: 1.4em; margin: 0 0 20px; font-size: .87rem; }
.statuts-archives { margin: 0 0 10px; font-size: 1rem; font-weight: 650; color: var(--muted); }
.statuts.archives { margin-bottom: 28px; }
.statuts.archives .statut { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
.statuts.archives .statut-titre { color: var(--muted); font-size: 1.05rem; }
/* Nouveau statut : le formulaire, et à droite les colonnes du Tableau telles qu'elles seront. */
.statut-nouveau { display: grid; grid-template-columns: minmax(0, 640px) 340px; gap: 28px; align-items: start; }
.statut-nouveau .help strong { color: var(--ink); font-weight: 650; }
.choix-cartes { display: grid; gap: 8px; margin: 0 0 18px; padding: 0; border: 0; min-width: 0; }
.choix-cartes legend { padding: 0; margin-bottom: 6px; font-weight: 650; }
.choix-carte { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; border-radius: 12px; background: var(--paper); box-shadow: inset 0 0 0 1.5px var(--line); font-weight: 400; cursor: pointer; }
.choix-carte input { margin-top: 3px; }
.choix-carte:has(input:checked) { background: var(--green-soft); box-shadow: inset 0 0 0 2px var(--green); }
.choix-carte:has(input:focus-visible) { outline: 2px solid var(--green); outline-offset: 2px; }
.choix-titre { display: block; font-weight: 650; }
.choix-carte .muted { display: block; font-size: .87rem; }
.apercu-tableau { padding: 20px 22px; border-radius: 14px; box-shadow: inset 0 0 0 1.5px var(--line); }
.apercu-tableau h2 { margin: 0 0 4px; font-size: 1rem; font-weight: 650; }
.apercu-tableau p { margin: 0; font-size: .87rem; }
.apercu-tableau ol { list-style: none; margin: 14px 0; padding: 0; display: grid; gap: 8px; }
.apercu-tableau li { display: flex; align-items: center; gap: 6px; padding: 8px 12px; border-radius: 12px; background: var(--field); font-size: .93rem; font-weight: 650; overflow-wrap: anywhere; }
.apercu-tableau li.nouveau { background: var(--wheat-soft); box-shadow: inset 0 0 0 1.5px var(--wheat); }
.apercu-tableau li .tag { margin-left: auto; padding: 0; box-shadow: none; color: var(--wheat-ink); font-size: .8rem; font-weight: 600; }
@media (max-width: 639px) {
  .statuts-entete { flex-direction: column; align-items: stretch; }
  .statut-nouveau { grid-template-columns: 1fr; gap: 18px; }
  .statut { flex-wrap: wrap; padding: 10px 12px; }
  .deplacer { width: 100%; justify-content: flex-end; }
}
