/* Écran « Projets » : liste des projets, détail (tâches groupées par état, synthèse)
   et modale de création. Mêmes jetons que app.css ; aucun widget natif laissé nu. */

/* ── Liste ──────────────────────────────────────────────────────────────── */

.proj-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }

.proj-card { display: flex; flex-direction: column; gap: 12px; min-width: 0; padding: 18px;
  background: var(--card); border: 1px solid var(--line); text-align: left; color: inherit; font: inherit;
  cursor: pointer; transition: border-color .15s ease, background .15s ease; }
.proj-card:hover, .proj-card:focus-visible { border-color: rgba(59,217,219,.5); background: rgba(246,242,234,.06); outline: none; }
.proj-card.running { border-color: rgba(59,217,219,.45); background: rgba(59,217,219,.05); }

.proj-card-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.proj-name { display: flex; align-items: center; gap: 8px; min-width: 0; font-weight: 700; font-size: 15.5px; }
.proj-name .ico { color: var(--turq); flex: none; }
.proj-name span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.proj-state { flex: none; }

.proj-goal { font-size: 13.5px; line-height: 1.55; color: var(--sand); overflow-wrap: anywhere; }

.proj-members { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; min-width: 0; }
.proj-member { display: inline-flex; align-items: center; gap: 7px; max-width: 100%; min-width: 0;
  padding: 3px 9px 3px 3px; background: rgba(246,242,234,.05); border: 1px solid var(--line-strong); font-size: 12px; color: var(--sand); }
.proj-member .avatar { flex: none; }
.pm-name { font-weight: 600; color: var(--ivory); white-space: nowrap; }
.pm-part { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  padding-left: 7px; border-left: 1px solid var(--line-strong); color: var(--mute); }

.proj-progress { display: flex; flex-direction: column; gap: 6px; }
.proj-progress .progress { height: 5px; }
.proj-progress-text { font-size: 12px; line-height: 1.45; }
.proj-progress.compact { gap: 8px; }
.proj-progress.compact .progress { height: 6px; }
.proj-progress.compact .proj-progress-text { font-size: 12.5px; }

.proj-card-foot { margin-top: auto; font-size: 12px; line-height: 1.5; }

/* ── Détail ─────────────────────────────────────────────────────────────── */

.proj-screen { display: flex; flex-direction: column; gap: 18px; min-width: 0; }

.proj-head { display: flex; align-items: flex-start; flex-wrap: wrap; gap: 14px 20px; padding-bottom: 18px; border-bottom: 1px solid var(--line); }
.proj-back { flex: none; align-self: flex-start; }
.proj-head-main { flex: 1 1 260px; min-width: 0; display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.proj-head-title { min-width: 0; }
.proj-head-title .eyebrow { display: block; }
.proj-head-title .display { margin-top: 4px; font-size: 26px; overflow-wrap: anywhere; }
.proj-head-actions { flex: none; margin-top: 0; }
/* min-width: 100% force l'objectif sur sa propre ligne ; la mesure de lecture est bornée à l'intérieur. */
.proj-head-goal { flex: 1 1 100%; min-width: 100%; margin: 0; font-size: 14.5px; line-height: 1.6; color: var(--sand); overflow-wrap: anywhere; }
.proj-head-goal > span { display: block; max-width: 760px; }
.proj-head-members { flex: 1 1 100%; }

.proj-banner:empty { display: none; }
.proj-banner-in { display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border: 1px solid rgba(200,138,28,.4); border-left-width: 3px; background: rgba(200,138,28,.10);
  color: var(--ochre-light); font-size: 13px; font-weight: 700; }
.proj-banner-in .ico { flex: none; }

.proj-bar:empty { display: none; }

/* ── Tâches groupées par état ───────────────────────────────────────────── */

.proj-board { display: flex; flex-direction: column; gap: 26px; min-width: 0; }
.task-group { min-width: 0; }
.task-group-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; color: var(--mute); }
.task-group-head .h2 { color: var(--sand); }

/* Nom propre aux projets : « .task-list » appartient déjà aux listes de tâches d'app.css (panneau Tâches, plan). */
.task-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 12px; }

.task-card { display: flex; flex-direction: column; gap: 10px; min-width: 0; padding: 14px 16px;
  background: var(--card); border: 1px solid var(--line); border-left: 3px solid var(--tint, var(--turq)); }
.task-card.failed { border-color: rgba(255,158,138,.45); border-left-color: var(--danger); background: rgba(255,158,138,.05); }
.task-card.asks { border-color: rgba(200,138,28,.45); border-left-color: var(--ochre); background: rgba(200,138,28,.07); }

.task-top { display: flex; align-items: center; gap: 10px; min-width: 0; }
.task-who { flex: 1; min-width: 0; }
.task-agent { font-size: 13.5px; font-weight: 700; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.task-kind { font-size: 11px; letter-spacing: .12em; text-transform: uppercase; font-weight: 700; }

.task-state { flex: none; font-size: 11px; font-weight: 700; letter-spacing: .04em; padding: 3px 8px;
  background: rgba(246,242,234,.07); color: var(--sand); border: 1px solid var(--line-strong); }
.task-state-running { background: rgba(59,217,219,.16); color: var(--turq); border-color: rgba(59,217,219,.35); }
.task-state-done { background: rgba(59,217,219,.08); color: var(--turq-soft); border-color: rgba(59,217,219,.22); }
.task-state-blocked { background: rgba(200,138,28,.16); color: var(--ochre-light); border-color: rgba(200,138,28,.4); }
.task-state-review { background: rgba(183,196,240,.14); color: #B7C4F0; border-color: rgba(183,196,240,.35); }

.task-title { font-size: 14.5px; line-height: 1.5; color: var(--ivory); overflow-wrap: anywhere; }
.task-time { display: flex; align-items: center; gap: 7px; font-size: 12px; }

.task-reason { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px;
  background: rgba(200,138,28,.10); border-left: 3px solid var(--ochre); font-size: 12.5px; line-height: 1.5; color: var(--sand); overflow-wrap: anywhere; }
.task-reason .ico { color: var(--ochre-light); flex: none; margin-top: 2px; }

.task-summary { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.task-toggle { display: inline-flex; align-items: center; gap: 6px; padding: 4px 0; background: transparent; border: 0;
  color: var(--turq); font-size: 12.5px; font-weight: 700; cursor: pointer; }
.task-toggle:hover { color: var(--turq-soft); }
.task-toggle .ico { flex: none; }
.task-summary-text { width: 100%; padding: 10px 12px; background: rgba(8,12,28,.45); border: 1px solid var(--line); font-size: 13.5px; }

.task-error { display: flex; align-items: flex-start; gap: 8px; padding: 8px 10px;
  background: rgba(255,158,138,.10); border-left: 3px solid var(--danger); font-size: 12.5px; line-height: 1.5; color: var(--danger); overflow-wrap: anywhere; }
.task-error .ico { flex: none; margin-top: 2px; }

.task-answer { display: flex; flex-wrap: wrap; align-items: flex-end; gap: 8px; }
.task-answer-label { flex: 1 1 100%; font-size: 11px; letter-spacing: .14em; text-transform: uppercase; font-weight: 700; color: var(--ochre-light); }
.task-answer-input { flex: 1 1 200px; min-width: 0; padding: 9px 11px; resize: vertical; line-height: 1.5;
  background: rgba(246,242,234,.05); border: 1px solid var(--line-strong); color: var(--ivory); font-size: 13.5px; outline: none; }
.task-answer-input:focus { border-color: var(--turq); }
.task-answer .btn { flex: none; }

.task-actions { display: flex; flex-wrap: wrap; gap: 8px; }
.btn-relaunch { color: var(--turq); border-color: rgba(59,217,219,.4); }
.btn-relaunch:hover { color: var(--turq-soft); border-color: var(--turq); }

/* ── Synthèse ───────────────────────────────────────────────────────────── */

.proj-synth:empty { display: none; }
.proj-synthesis { padding: 22px 24px; background: rgba(59,217,219,.05); border: 1px solid rgba(59,217,219,.3); border-left-width: 3px; }
.proj-synthesis-head { display: flex; align-items: center; gap: 10px; margin-bottom: 12px; }
.proj-synthesis-head .ico { color: var(--turq); flex: none; }
.proj-synthesis-head .display { margin: 0; font-size: 22px; font-style: italic; color: var(--turq); }

/* ── Modale « Nouveau projet » ──────────────────────────────────────────── */

.project-modal { max-width: 600px; }
.project-modal .pk-hint { font-size: 12px; font-weight: 400; }
.project-modal textarea { min-height: 92px; }
/* Le formulaire est long : les boutons restent visibles pendant qu'on fait défiler.
   (En dessous de 861 px, app.css colle déjà les actions au bas de la feuille.) */
@media (min-width: 861px) {
  .project-modal { padding-bottom: 0; }
  .project-modal > .actions { position: sticky; bottom: 0; z-index: 1; margin: 0 -28px; padding: 14px 28px 20px;
    background: #16214A; border-top: 1px solid var(--line); }
}

.pk-section { display: flex; flex-direction: column; }
.pk-section-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px;
  font-size: 13px; font-weight: 600; color: var(--sand); margin-bottom: 6px; }
.pk-section-head .muted { font-weight: 400; font-size: 12px; }

.pk-list { max-height: 216px; overflow: auto; border: 1px solid var(--line-strong); }
.pk-row { display: flex; flex-direction: column; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); transition: background .15s ease; }
.pk-list > .pk-row:first-child { border-top: 0; }
.pk-row.on { background: rgba(59,217,219,.07); }

/* Case à cocher habillée : l'input natif reste focusable mais invisible. */
.pk-input { position: absolute; width: 1px; height: 1px; padding: 0; margin: 0; opacity: 0; pointer-events: none; }
.pk-pick { flex-direction: row !important; align-items: center; gap: 10px; min-width: 0; margin: 0;
  font-weight: 400 !important; cursor: pointer; }
.pk-box { flex: none; width: 18px; height: 18px; display: grid; place-items: center;
  border: 1px solid var(--line-strong); background: rgba(246,242,234,.05); transition: background .15s ease, border-color .15s ease; }
.pk-box .ico { color: var(--navy); opacity: 0; transition: opacity .12s ease; }
.pk-input:checked + .pk-box { background: var(--turq); border-color: var(--turq); }
.pk-input:checked + .pk-box .ico { opacity: 1; }
.pk-input:focus-visible + .pk-box { outline: 2px solid var(--turq); outline-offset: 2px; }
.pk-input:disabled + .pk-box { opacity: .35; }
.pk-pick:has(.pk-input:disabled) { opacity: .45; cursor: not-allowed; }

.pk-id { min-width: 0; display: block; }
.pk-name { display: block; font-size: 14px; font-weight: 600; color: var(--ivory); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.pk-role { display: block; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.pk-part { gap: 4px !important; margin: 0 0 0 28px; }
.pk-part-label { font-size: 11px; letter-spacing: .1em; text-transform: uppercase; font-weight: 700; color: var(--mute); }
.pk-part-label .muted { letter-spacing: 0; text-transform: none; font-weight: 400; }
.project-modal .pk-part-input { padding: 8px 11px; font-size: 13.5px; }

/* Choix « Qui relit ? » / « Qui rédige la synthèse ? » : pastilles, pas de liste déroulante native. */
.pk-chips { display: flex; flex-wrap: wrap; gap: 8px; }
.pk-chip { display: inline-flex; margin: 0; cursor: pointer; }
.pk-chip-in { display: inline-flex; align-items: center; gap: 8px; padding: 5px 12px 5px 5px;
  border: 1px solid var(--line-strong); background: rgba(246,242,234,.04); color: var(--sand);
  font-size: 13px; font-weight: 600; transition: border-color .15s ease, background .15s ease, color .15s ease; }
.pk-chip:hover .pk-chip-in { border-color: rgba(59,217,219,.5); color: var(--ivory); }
.pk-input:checked + .pk-chip-in { border-color: var(--turq); background: rgba(59,217,219,.14); color: var(--ivory); }
.pk-input:focus-visible + .pk-chip-in { outline: 2px solid var(--turq); outline-offset: 2px; }

/* ── Réactif ────────────────────────────────────────────────────────────── */

@media (max-width: 860px) {
  .proj-grid { grid-template-columns: minmax(0, 1fr); }
  .task-cards { grid-template-columns: minmax(0, 1fr); }
  .proj-head { padding-bottom: 14px; gap: 12px; }
  .proj-head-title .display { font-size: 22px; }
  .proj-head-actions .head-btn { min-height: 38px; }
  .proj-board { gap: 22px; }
  .proj-synthesis { padding: 18px 16px; }
  .task-toggle { min-height: 36px; }
  .pk-list { max-height: 46vh; }
}

@media (max-width: 560px) {
  .proj-card { padding: 16px 14px; }
  .proj-head-title .display { font-size: 20px; }
  .proj-head-actions { width: 100%; }
  .proj-head-actions .head-btn { flex: 1; justify-content: center; }
  .proj-synthesis-head .display { font-size: 19px; }
  .task-card { padding: 12px 13px; }
  .pm-part { display: none; }
  .task-answer .btn { width: 100%; }
}
