/* ProjectOS — écriture et collaboration : mentions, références de tâche et leur carte d'aperçu,
   éditeur Markdown (.mde-), cases cochables, notifications (.nt-), fil d'activité de la fiche
   (.feed-), suivi, échéance de la fiche. Voir ecrire.js, notifs.js, detail.js. */

/* --- Mentions et références ------------------------------------------------------------------- */
.mention {
  display: inline-block; padding: 0 6px; border-radius: 999px; font-weight: 600; font-size: .94em; line-height: 1.5;
  background: color-mix(in srgb, var(--p-normal) 14%, transparent); color: color-mix(in srgb, var(--p-normal) 70%, var(--ink));
  white-space: nowrap;
}
.mention.moi { background: var(--accent); color: var(--on-accent); }
a.md-ref {
  font-family: var(--f-mono); font-size: .9em; font-weight: 600; text-decoration: none; white-space: nowrap;
  color: var(--accent); border-bottom: 1px dashed color-mix(in srgb, var(--accent) 55%, transparent);
}
a.md-ref:hover { border-bottom-style: solid; }

.ref-card {
  position: fixed; z-index: 95; width: min(320px, calc(100vw - 16px)); padding: 10px 12px; border-radius: 10px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); box-shadow: var(--shadow);
  display: grid; gap: 6px; font-size: 13px; pointer-events: auto;
}
.ref-card-h { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ref-card-h .key { color: var(--ink); font-weight: 600; font-size: 12px; }
.ref-card-t { margin: 0; font-weight: 600; line-height: 1.35; overflow-wrap: anywhere; }
.ref-card-f { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.ref-card-who { display: inline-flex; align-items: center; gap: 6px; min-width: 0; }
.ref-card-err { margin: 0; }

/* Liste d'autocomplétion des mentions */
.mn-pop {
  position: fixed; z-index: 96; width: 260px; max-width: calc(100vw - 16px); max-height: 260px; overflow-y: auto;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 10px;
  box-shadow: var(--shadow); padding: 4px;
}
.mn-head { font-size: 11px; text-transform: uppercase; letter-spacing: .07em; font-weight: 600; color: var(--muted); padding: 4px 8px 2px; }
.mn-opt { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-radius: 7px; cursor: pointer; font-size: 13.5px; }
.mn-opt.actif { background: var(--accent-soft); }
.mn-l { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.mn-sub { font-size: 11.5px; color: var(--muted); }

/* --- Éditeur Markdown ----------------------------------------------------------------------------- */
.mde { container-type: inline-size; border: 1px solid var(--line); border-radius: 10px; background: var(--surface); }
.mde:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent); }
.mde-bar { display: flex; align-items: center; gap: 6px; padding: 4px 6px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.mde-tools { display: flex; align-items: center; gap: 2px; flex: 1 1 auto; flex-wrap: wrap; }
.mde-sp { flex: 1; }
.mde-b {
  min-width: 30px; height: 28px; padding: 0 6px; border: 0; background: transparent; border-radius: 6px; cursor: pointer;
  color: var(--muted); font-weight: 700; font-size: 13px;
}
.mde-b:hover { background: var(--surface-2); color: var(--ink); }
.mde-italique { font-style: italic; font-family: Georgia, serif; }
.mde-code { font-family: var(--f-mono); font-size: 11.5px; }
.mde-tabs { display: inline-flex; gap: 2px; background: var(--surface-2); border-radius: 7px; padding: 2px; }
.mde-tab { border: 0; background: transparent; border-radius: 5px; padding: 3px 9px; font-size: 12.5px; font-weight: 600; color: var(--muted); cursor: pointer; }
.mde-tab[aria-selected="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px #0002; }
.mde-panes { display: grid; }
.mde-ta.ctl { border: 0; border-radius: 0 0 10px 10px; box-shadow: none !important; font-family: var(--f-mono); font-size: 12.5px; min-height: 72px; resize: vertical; }
.mde.avec-apercu .mde-ta.ctl { min-height: 180px; }
.mde-view { padding: 10px 12px; min-width: 0; overflow-wrap: anywhere; }
.mde-preview { font-size: 13.5px; }
/* Étroit (mobile, fiche réduite) : onglets Écrire / Aperçu. */
.mde.avec-apercu[data-onglet="ecrire"] .mde-view { display: none; }
.mde.avec-apercu[data-onglet="apercu"] .mde-write { display: none; }
.mde.avec-apercu[data-onglet="apercu"] .mde-tools { visibility: hidden; }
/* Assez large : aperçu en direct côte à côte, sans onglets. */
@container (min-width: 520px) {
  .mde.avec-apercu .mde-tabs { display: none; }
  .mde.avec-apercu .mde-panes { grid-template-columns: minmax(0, 1fr) minmax(0, 1fr); }
  .mde.avec-apercu .mde-view, .mde.avec-apercu .mde-write { display: block !important; }
  .mde.avec-apercu .mde-tools { visibility: visible !important; }
  .mde.avec-apercu .mde-view { border-left: 1px solid var(--line); max-height: 520px; overflow-y: auto; }
  .mde.avec-apercu .mde-ta.ctl { border-radius: 0 0 0 10px; }
}

/* Cases à cocher cliquables de la description */
.markdown ul.md-tasks { list-style: none; padding-left: .2em; }
.md-cbl { display: inline-flex; align-items: flex-start; gap: 8px; cursor: pointer; }
.md-cb { margin: .3em 0 0; width: 15px; height: 15px; accent-color: var(--ok); flex: 0 0 auto; cursor: pointer; }
.md-cb:disabled { cursor: progress; }
.md-cb:checked + span { color: var(--muted); text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 60%, transparent); }

.pfx-sel.ctl { min-width: 0; width: auto; flex: 0 0 auto; font-family: var(--f-mono); font-size: 12px; padding-left: 7px; }

/* --- Fiche : suivi, échéance, blocage, sections ------------------------------------------------ */
.d-watch-g { display: inline-flex; align-items: center; gap: 0; margin-right: 4px; }
.d-watch { border-radius: 7px 0 0 7px; }
.d-watch.on { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 40%, var(--line)); color: var(--accent); }
.d-watchers { border: 1px solid var(--line); border-left: 0; border-radius: 0 7px 7px 0; padding: 3px 8px; font-variant-numeric: tabular-nums; }
.d-due { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; }
.d-due-qs { display: inline-flex; flex-wrap: wrap; gap: 2px; }
.d-due-q.on { color: var(--accent); background: var(--accent-soft); }
.d-banner.d-bloque {
  background: color-mix(in srgb, var(--p-urgent) 12%, var(--surface)); color: var(--ink); font-weight: 500;
  border: 1px solid color-mix(in srgb, var(--p-urgent) 40%, transparent); justify-content: space-between;
}
.d-bloque-t b { color: var(--p-urgent); }
.d-sec-tools { display: inline-flex; gap: 4px; align-items: center; }

/* --- Fil d'activité ------------------------------------------------------------------------------- */
.feed-seg button { padding: 4px 9px; font-size: 12.5px; }
.feed { list-style: none; margin: 0 0 12px; padding: 0 0 0 14px; display: grid; gap: 8px; position: relative; }
.feed::before { content: ""; position: absolute; left: 4px; top: 4px; bottom: 4px; width: 2px; background: var(--line); border-radius: 2px; }
.feed-e { display: grid; grid-template-columns: minmax(0, 1fr) auto; gap: 10px; align-items: baseline; font-size: 12.5px; position: relative; color: var(--muted); }
.feed-e .ev-txt { overflow-wrap: anywhere; }
.feed-e .ev-txt b { color: var(--ink); font-weight: 600; }
.ev-dot { position: absolute; left: -14px; top: .45em; width: 10px; height: 10px; border-radius: 50%; background: var(--surface); border: 2px solid var(--line); }
.ev-created .ev-dot { border-color: var(--ok); }
.feed-e .ev-v { color: var(--ink); font-weight: 600; }
.ev-old { color: var(--muted); }
.ev-src { margin-left: 6px; font-size: 11px; color: var(--muted); background: var(--surface-2); border-radius: 4px; padding: 0 5px; }
.ev-at { font-size: 11.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.feed-c { position: relative; }
.feed-c::before { content: ""; position: absolute; left: -14px; top: 14px; width: 10px; height: 10px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--surface); }
.feed-c .comment-h .ev-at { margin-left: auto; }
.feed-c.flash .comment { animation: refrow-nouveau 2.4s ease-out; border-color: var(--accent); }
.feed-c.gitlab .comment { border-left: 3px solid #fc6d26; }
.feed-c.gitlab::before { background: #fc6d26; }
.gl-tag {
  display: inline-flex; align-items: center; gap: 4px; font-size: 10.5px; font-weight: 700; letter-spacing: .04em; text-transform: uppercase;
  padding: 1px 6px; border-radius: 4px; background: color-mix(in srgb, #fc6d26 16%, transparent); color: color-mix(in srgb, #fc6d26 75%, var(--ink));
  margin-left: 6px;
}
.gl-ico { width: 22px; height: 22px; border-radius: 6px; background: #fc6d26; position: relative; flex: 0 0 auto; }
.gl-ico::after { content: ""; position: absolute; inset: 6px; background: #fff; clip-path: polygon(50% 100%, 0 30%, 18% 0, 32% 38%, 68% 38%, 82% 0, 100% 30%); }
.feed-more, .feed-wait, .feed-vide { list-style: none; }
.feed-new { display: grid; gap: 4px; }
.feed-new .inline-form { margin-top: 4px; }

/* --- Notifications (bandeau) ------------------------------------------------------------------- */
.notif { position: relative; }
.notif-btn {
  position: relative; width: 34px; height: 34px; border-radius: 9px; border: 1px solid #ffffff22; background: #ffffff10;
  color: var(--band-muted); cursor: pointer; display: grid; place-items: center; padding: 0;
}
.notif-btn:hover, .notif-btn[aria-expanded="true"] { color: var(--on-band); border-color: #ffffff44; }
.notif-btn.a-lire { color: var(--on-band); }
/* Cloche dessinée en CSS (pas d'image externe, pas d'emoji dépendant de la police). */
.nt-bell { width: 14px; height: 13px; border: 2px solid currentColor; border-bottom-width: 2px; border-radius: 7px 7px 2px 2px; position: relative; margin-top: -2px; }
.nt-bell::before { content: ""; position: absolute; left: -4px; right: -4px; bottom: -3px; height: 2px; background: currentColor; border-radius: 2px; }
.nt-bell::after { content: ""; position: absolute; left: 50%; bottom: -7px; width: 5px; height: 3px; margin-left: -2.5px; background: currentColor; border-radius: 0 0 3px 3px; }
.nt-badge {
  position: absolute; top: -5px; right: -6px; min-width: 18px; height: 18px; padding: 0 5px; border-radius: 999px;
  background: var(--accent); color: var(--on-accent); font-size: 10.5px; font-weight: 700; line-height: 18px; text-align: center;
  box-shadow: 0 0 0 2px var(--ink-band); font-variant-numeric: tabular-nums;
}
.nt-panel { width: min(420px, calc(100vw - 16px)); padding: 0; display: flex; flex-direction: column; max-height: min(640px, calc(100vh - 80px)); }
.nt-head { padding: 12px 14px 10px; border-bottom: 1px solid var(--line); display: grid; gap: 8px; }
.nt-head-l { display: flex; align-items: center; gap: 8px; }
.nt-head-l h2 { font-size: 16px; }
.nt-head-t { display: flex; align-items: center; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.nt-head-t .seg button { padding: 4px 10px; font-size: 12.5px; }
.nt-list { overflow-y: auto; padding: 4px; display: grid; gap: 1px; min-height: 60px; }
.nt-item { position: relative; display: flex; align-items: flex-start; gap: 2px; border-radius: 9px; }
.nt-item:hover { background: var(--surface-2); }
.nt-item.non-lue { background: color-mix(in srgb, var(--accent-soft) 55%, transparent); }
.nt-item.non-lue:hover { background: var(--accent-soft); }
.nt-dot { position: absolute; left: 5px; top: 18px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); }
.nt-main {
  flex: 1; min-width: 0; display: flex; gap: 10px; align-items: flex-start; text-align: left; border: 0; background: none;
  padding: 9px 6px 9px 16px; border-radius: 9px; cursor: pointer; color: var(--ink);
}
.nt-main:focus-visible { outline: 2px solid var(--accent); outline-offset: -2px; }
.nt-av { flex: 0 0 auto; padding-top: 1px; }
.nt-txt { display: grid; gap: 2px; min-width: 0; font-size: 13px; }
.nt-l1 b { font-weight: 600; }
.nt-item:not(.non-lue) .nt-l1 b { font-weight: 500; }
.nt-l2 { display: flex; gap: 6px; align-items: baseline; min-width: 0; }
.nt-tt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
/* Corps d'une ligne : le bouton (qui, quoi, tâche) puis l'extrait, hors du bouton (il peut contenir
   des liens). L'extrait s'aligne sur le texte du bouton (marge = retrait + avatar + écart). */
.nt-body { flex: 1; min-width: 0; display: grid; }
.nt-ex {
  margin: -4px 6px 9px 54px; padding: 4px 8px; border-left: 2px solid var(--line); color: var(--ink); font-size: 12.5px;
  line-height: 1.45; overflow-wrap: anywhere; cursor: pointer;
}
/* Pas de rognage : le serveur tronque déjà l'extrait proprement (environ 280 caractères, « … »,
   bloc de code refermé) ; un max-height couperait au milieu d'une ligne et cacherait des liens
   encore atteignables au clavier. Seul un très long mot de code défile dans son bloc. */
.nt-ex > * { margin: 0 0 2px; }
.nt-ex :is(h3, h4, h5, h6) { font-size: 1em; margin: 0; }
.nt-ex :is(ul, ol) { padding-left: 16px; }
.nt-ex pre { margin: 2px 0; padding: 3px 6px; font-size: 11.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.nt-ex .md-table { display: none; }
.nt-ex .mention { font-size: .92em; }
.nt-st { display: inline-flex; flex-wrap: wrap; align-items: center; gap: 4px 6px; }
.nt-st .pill { font-size: 11.5px; }
.nt-meta { display: flex; gap: 8px; align-items: center; font-size: 11.5px; color: var(--muted); }
.nt-mark {
  flex: 0 0 auto; width: 28px; height: 28px; margin: 8px 6px 0 0; border: 1px solid var(--line); border-radius: 7px;
  background: var(--surface); color: var(--muted); cursor: pointer; font-size: 13px;
}
.nt-mark:hover { color: var(--ok); border-color: var(--ok); }
.nt-vide { padding: 22px 16px; text-align: center; display: grid; gap: 6px; }
.nt-vide p { margin: 0; }
.nt-skel { display: flex; gap: 10px; padding: 10px 12px; align-items: center; }
.nt-foot { padding: 6px; border-top: 1px solid var(--line); text-align: center; }

@media (max-width: 640px) {
  /* La cloche prend sa place dans le bandeau : on resserre pour que les quatre onglets tiennent. */
  .band-in { gap: 6px; }
  .tab { padding: 5px 7px; }
  .notif-btn { width: 30px; height: 30px; }
  .notif { position: static; }
  .nt-panel { position: fixed; left: 8px; right: 8px; top: 58px; width: auto; max-height: calc(100vh - 70px); }
  .d-watch-t { display: none; }
  .d-watch { padding: 3px 8px; }
  .nt-head-t .btn { padding: 3px 6px; }
}
/* Téléphone : le logo (lien vers le backlog, doublé par l'onglet) laisse la place aux onglets. */
@media (max-width: 420px) {
  .band .brand { display: none; }
}

/* Origine des commentaires (comment.source) et des événements : Claude Code, ClickUp, CLI */
.ev-src.src-mcp { background: color-mix(in srgb, var(--p-normal) 14%, transparent); color: color-mix(in srgb, var(--p-normal) 70%, var(--ink)); }
.ev-src.src-import { background: color-mix(in srgb, var(--m4) 14%, transparent); color: color-mix(in srgb, var(--m4) 70%, var(--ink)); }
.comment-h .ev-src { font-weight: 600; }
.feed-c.src-mcp .comment { border-left: 3px solid color-mix(in srgb, var(--p-normal) 70%, transparent); }
