/* ProjectOS — styles partagés : jetons, bandeau, barre de filtres, composants, backlog, fiche.
   Système visuel repris de la page « Roadmap CampagneOS » (Bricolage Grotesque, Public Sans,
   JetBrains Mono ; bandeau sombre ; cartes à liseré ; pastilles mono). Les vues ajoutent leurs
   propres styles préfixés (.kb-, .rm-) dans kanban.css et roadmap.css. */

:root {
  --bg: #f5f6fa; --surface: #ffffff; --surface-2: #eceef5; --ink: #161a2e; --muted: #5b6180; --line: #dadeea;
  --accent: #c42452; --accent-soft: #fbe4ea; --ink-band: #1b2140; --on-band: #eef0fa; --band-muted: #a9b0d0;
  --ok: #1f7a5a; --ok-soft: #dcf2e8; --warn: #b26b00; --warn-soft: #fdf0d5;
  --on-accent: #ffffff; --warn-ink: #8f5600;
  --m1: #c42452; --m2: #d9731a; --m3: #2f6fd6; --m4: #8a3fc4; --m5: #0f8a83; --m6: #5d6b2a; --m7: #b5568f; --m8: #4a5478;
  --p-urgent: #d92d20; --p-high: #e07a10; --p-normal: #2f6fd6; --p-low: #8a90a8;
  --hover: #f0f1f7; --shadow: 0 1px 2px #10132a14, 0 8px 28px #10132a1f;
  --f-display: "Bricolage Grotesque", "Segoe UI", system-ui, sans-serif;
  --f-body: "Public Sans", "Segoe UI", system-ui, -apple-system, sans-serif;
  --f-mono: "JetBrains Mono", ui-monospace, Consolas, "SFMono-Regular", monospace;
  --chrome-h: 104px;
  --drawer-w: min(620px, 100vw);
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #10132a; --surface: #181c38; --surface-2: #21264a; --ink: #e9ebf7; --muted: #a2a8c8; --line: #2f3560;
    --accent: #ff5c86; --accent-soft: #3a1a2b; --ink-band: #0a0c1e; --on-band: #eef0fa; --band-muted: #8f96bd;
    --ok: #53d0a0; --ok-soft: #163a30; --warn: #f5b74a; --warn-soft: #3a2c12;
    --on-accent: #10132a; --warn-ink: #f5b74a;
    --m1: #ff5c86; --m2: #f59a4a; --m3: #6fa3ff; --m4: #b98af0; --m5: #3cc8bf; --m6: #a9bb5c; --m7: #e28bbd; --m8: #9aa6d6;
    --p-urgent: #ff6b5f; --p-high: #f59a4a; --p-normal: #6fa3ff; --p-low: #8f96bd;
    --hover: #1d2142; --shadow: 0 1px 2px #0006, 0 10px 32px #0008;
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #10132a; --surface: #181c38; --surface-2: #21264a; --ink: #e9ebf7; --muted: #a2a8c8; --line: #2f3560;
  --accent: #ff5c86; --accent-soft: #3a1a2b; --ink-band: #0a0c1e; --on-band: #eef0fa; --band-muted: #8f96bd;
  --ok: #53d0a0; --ok-soft: #163a30; --warn: #f5b74a; --warn-soft: #3a2c12;
  --on-accent: #10132a; --warn-ink: #f5b74a;
  --m1: #ff5c86; --m2: #f59a4a; --m3: #6fa3ff; --m4: #b98af0; --m5: #3cc8bf; --m6: #a9bb5c; --m7: #e28bbd; --m8: #9aa6d6;
  --p-urgent: #ff6b5f; --p-high: #f59a4a; --p-normal: #6fa3ff; --p-low: #8f96bd;
  --hover: #1d2142; --shadow: 0 1px 2px #0006, 0 10px 32px #0008;
  color-scheme: dark;
}

/* --- Base ---------------------------------------------------------------------------------- */
* { box-sizing: border-box; }
html, body { margin: 0; min-height: 100%; }
body {
  background: var(--bg); color: var(--ink);
  font-family: var(--f-body); font-size: 14px; line-height: 1.45;
  -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility;
}
h1, h2, h3, h4 { font-family: var(--f-display); margin: 0; text-wrap: balance; }
button, input, select, textarea { font: inherit; color: inherit; }
a { color: var(--accent); }
code, kbd, .mono { font-family: var(--f-mono); }
code { background: var(--surface-2); border-radius: 4px; padding: 1px 5px; font-size: 12px; }
kbd {
  font-size: 11px; padding: 0 5px; border-radius: 4px; border: 1px solid currentColor;
  opacity: .75; line-height: 16px; display: inline-block;
}
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
[hidden] { display: none !important; }
.muted { color: var(--muted); }
.small { font-size: 12px; }
.sr-only {
  position: absolute !important; width: 1px; height: 1px; padding: 0; margin: -1px;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
}
.skip {
  position: absolute; left: 12px; top: -48px; z-index: 100; background: var(--accent); color: var(--on-accent);
  padding: 8px 12px; border-radius: 8px; text-decoration: none; font-weight: 600;
}
.skip:focus { top: 8px; }

/* --- Boutons et contrôles ----------------------------------------------------------------------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 8px; padding: 6px 12px; font-weight: 600; font-size: 13.5px; cursor: pointer;
  text-decoration: none; white-space: nowrap; transition: background .12s, border-color .12s;
}
.btn:hover { border-color: var(--muted); }
.btn:disabled { opacity: .45; cursor: default; border-color: var(--line); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); }
.btn.primary:hover { filter: brightness(1.06); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover:not(:disabled) { background: var(--surface-2); color: var(--ink); }
.btn.small { padding: 3px 9px; font-size: 12.5px; border-radius: 7px; }
.btn.icon { width: 32px; height: 32px; padding: 0; font-size: 20px; line-height: 1; }
.btn.danger { color: var(--accent); }

.ctl {
  background: var(--surface); border: 1px solid var(--line); border-radius: 7px;
  padding: 5px 9px; min-height: 32px; font-size: 13.5px; color: var(--ink); min-width: 0; max-width: 100%;
}
.ctl:hover { border-color: color-mix(in srgb, var(--muted) 55%, var(--line)); }
.ctl:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.ctl.grow { flex: 1 1 200px; }
.ctl.num { width: 110px; }
select.ctl { padding-right: 26px; appearance: none; cursor: pointer;
  background: var(--surface) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a90a8' stroke-width='1.6'/%3E%3C/svg%3E") no-repeat right 9px center; }
textarea.ctl { width: 100%; resize: vertical; line-height: 1.5; }
.inline-form { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }

.seg { display: inline-flex; background: var(--surface-2); border-radius: 8px; padding: 3px; gap: 2px; }
.seg button { border: 0; background: transparent; padding: 5px 11px; border-radius: 6px; cursor: pointer;
  font-weight: 600; font-size: 13px; color: var(--muted); }
.seg button[aria-pressed="true"] { background: var(--surface); color: var(--ink); box-shadow: 0 1px 2px #0002; }

/* --- Pastilles, badges, avatars ----------------------------------------------------------------- */
.key { font-family: var(--f-mono); font-size: 11.5px; color: var(--muted); white-space: nowrap; letter-spacing: .01em; }
.pill {
  display: inline-flex; align-items: center; gap: 6px; max-width: 100%;
  padding: 2px 9px 2px 7px; border-radius: 999px; font-size: 12px; font-weight: 600; white-space: nowrap;
  background: color-mix(in srgb, var(--sc) 15%, transparent); color: var(--ink);
  overflow: hidden; text-overflow: ellipsis;
}
/* Texte dans un span : l'ellipse ne marche pas sur un nœud texte direct d'un conteneur flex. */
.pill-t { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.pill::before { content: ""; flex: 0 0 7px; width: 7px; height: 7px; border-radius: 50%; background: var(--sc); }
.pill.st-done::before { content: "✓"; background: none; color: var(--sc); width: auto; flex: 0 0 auto; font-size: 11px; height: auto; }
.prio { display: inline-flex; align-items: center; gap: 5px; font-size: 12px; font-weight: 600; white-space: nowrap; color: var(--muted); }
.prio::before { content: ""; width: 8px; height: 8px; border-radius: 2px; background: var(--pc); transform: rotate(45deg); }
.prio.urgent { --pc: var(--p-urgent); color: var(--p-urgent); }
.prio.high { --pc: var(--p-high); }
.prio.normal { --pc: var(--p-normal); }
.prio.low { --pc: var(--p-low); }
.badge {
  display: inline-flex; align-items: center; flex: 0 0 auto; font-size: 10.5px; font-weight: 700; letter-spacing: .04em;
  text-transform: uppercase; padding: 1px 6px; border-radius: 4px; background: var(--surface-2); color: var(--muted);
  white-space: nowrap;
}
.badge.maj { background: var(--accent-soft); color: var(--accent); }
.badge.warn { background: var(--warn-soft); color: var(--warn-ink); }
.avatar {
  --av: #5b6180;
  display: inline-grid; place-items: center; flex: 0 0 auto; width: 22px; height: 22px; border-radius: 50%;
  background: var(--av); color: #fff; font-size: 9.5px; font-weight: 700; letter-spacing: .02em;
  box-shadow: 0 0 0 2px var(--surface); user-select: none;
}
.avatar.lg { width: 30px; height: 30px; font-size: 11.5px; }
.avatar.more { background: var(--surface-2); color: var(--muted); }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -6px; }
.chip {
  display: inline-flex; align-items: center; gap: 6px; padding: 2px 4px 2px 9px; border-radius: 999px;
  background: var(--surface-2); font-size: 12.5px; font-weight: 500; max-width: 100%;
}
.chip.person { padding-left: 3px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.chip-x {
  border: 0; background: transparent; color: var(--muted); cursor: pointer; width: 20px; height: 20px;
  border-radius: 50%; display: inline-grid; place-items: center; font-size: 15px; line-height: 1; padding: 0;
}
.chip-x:hover { background: var(--accent-soft); color: var(--accent); }
.mdot {
  display: inline-block; width: 10px; height: 10px; border-radius: 50%; background: var(--mc);
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--mc) 20%, transparent); flex: 0 0 auto;
}
.mdot.vide { background: transparent; box-shadow: inset 0 0 0 1.5px var(--line); }
/* Plusieurs modules (US transverse) : pastilles serrées, « +n » au-delà. */
.mdots { display: inline-flex; align-items: center; gap: 5px; flex: 0 0 auto; }
.mdots-more { font-family: var(--f-mono); font-size: 10.5px; color: var(--muted); }
.progress {
  display: inline-block; position: relative; width: 56px; height: 6px; border-radius: 3px;
  background: var(--surface-2); overflow: hidden; flex: 0 0 auto; vertical-align: middle;
}
.progress > i { position: absolute; inset: 0 auto 0 0; width: var(--p, 0%); background: var(--ok); border-radius: 3px; }
.card {
  --mc: var(--accent);
  background: var(--surface); border: 1px solid var(--line); border-top: 4px solid var(--mc);
  border-radius: 12px; padding: 14px 16px; min-width: 0;
}
.empty { padding: 56px 20px; text-align: center; color: var(--muted); }
.empty b { display: block; font-family: var(--f-display); font-size: 19px; color: var(--ink); margin-bottom: 6px; }
.empty p { margin: 0 0 14px; }
.empty.erreur b { color: var(--accent); }
.construction { border: 1px dashed var(--line); border-radius: 12px; margin-top: 24px; }

.skeleton {
  display: block; height: 12px; border-radius: 6px;
  background: linear-gradient(90deg, var(--surface-2) 0%, color-mix(in srgb, var(--surface-2) 40%, var(--surface)) 50%, var(--surface-2) 100%);
  background-size: 200% 100%; animation: shimmer 1.3s linear infinite;
}
.skeleton.grow { flex: 1; }
@keyframes shimmer { from { background-position: 200% 0; } to { background-position: -200% 0; } }
.skeleton-list { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; margin-top: 64px; }
.skeleton-row { display: flex; align-items: center; gap: 16px; padding: 12px 16px; border-bottom: 1px solid var(--line);
  padding-left: calc(16px + (var(--i) % 3) * 20px); }

/* --- Bandeau ------------------------------------------------------------------------------------ */
.chrome { position: sticky; top: 0; z-index: 30; }
.band { background: var(--ink-band); color: var(--on-band); }
.band-in { display: flex; align-items: center; gap: 14px; height: 54px; padding: 0 max(16px, env(safe-area-inset-left)); }
.brand {
  display: inline-flex; align-items: center; gap: 9px; color: var(--on-band); text-decoration: none;
  font-family: var(--f-display); font-weight: 800; font-size: 19px; letter-spacing: -.02em; flex: 0 0 auto;
}
.brand-mark {
  width: 20px; height: 20px; border-radius: 6px; background: var(--accent); position: relative; flex: 0 0 auto;
}
.brand-mark::after {
  content: ""; position: absolute; inset: 6px; background: var(--ink-band); transform: rotate(45deg); border-radius: 1px;
}
.brand-lg { font-size: 24px; color: var(--ink); }
.brand-lg .brand-mark::after { background: var(--surface); }
.list-select {
  background: #ffffff12; color: var(--on-band); border: 1px solid #ffffff26; border-radius: 8px;
  padding: 5px 8px; font-size: 13px; max-width: 240px;
}
.list-select option { color: #161a2e; background: #fff; }
.tabs { display: flex; gap: 2px; background: #ffffff10; border-radius: 9px; padding: 3px; margin-left: 6px; }
.tab {
  display: inline-flex; align-items: center; gap: 7px; padding: 5px 13px; border-radius: 7px;
  color: var(--band-muted); text-decoration: none; font-weight: 600; font-size: 13.5px; white-space: nowrap;
}
.tab:hover { color: var(--on-band); background: #ffffff10; }
.tab[aria-current="page"] { background: var(--on-band); color: var(--ink-band); }
.tab[aria-current="page"] .tab-ico { color: var(--accent); }
.tab-ico { font-size: 12px; opacity: .9; }
.band :focus-visible { outline-color: var(--on-band); }
.band-sp { flex: 1; }
.search-btn {
  display: inline-flex; align-items: center; gap: 8px; background: #ffffff10; border: 1px solid #ffffff22;
  color: var(--band-muted); border-radius: 8px; padding: 5px 8px 5px 10px; cursor: pointer; font-size: 13px;
}
.search-btn:hover { color: var(--on-band); border-color: #ffffff44; }
.user { position: relative; }
.user-btn { border: 0; background: none; padding: 2px; border-radius: 50%; cursor: pointer; display: grid; }
.user-btn .avatar { box-shadow: 0 0 0 2px var(--ink-band), 0 0 0 3px #ffffff33; }
.menu {
  position: absolute; right: 0; top: calc(100% + 8px); z-index: 40; min-width: 250px;
  background: var(--surface); color: var(--ink); border: 1px solid var(--line); border-radius: 12px;
  box-shadow: var(--shadow); padding: 6px;
}
.menu-head { padding: 8px 10px 10px; display: grid; gap: 1px; border-bottom: 1px solid var(--line); margin-bottom: 4px; }
.menu-head span { font-size: 12px; color: var(--muted); overflow-wrap: anywhere; }
.menu-label { font-size: 11px; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); font-weight: 600; padding: 6px 10px 2px; }
.menu-item {
  display: flex; align-items: center; gap: 8px; width: 100%; border: 0; background: none; text-align: left;
  padding: 7px 10px; border-radius: 7px; cursor: pointer; font-size: 13.5px;
}
.menu-item:hover { background: var(--surface-2); }
/* Focus clavier net (le seul fond --surface-2 était presque invisible). */
.menu-item:focus-visible { background: var(--accent-soft); outline: 2px solid var(--accent); outline-offset: -2px; }
.menu-item .check { width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--line); flex: 0 0 auto; }
.menu-item[aria-checked="true"] .check { border: 4px solid var(--accent); }
.menu-sep { height: 1px; background: var(--line); margin: 4px 0; }

/* --- Barre de filtres ----------------------------------------------------------------------------- */
.filterbar {
  background: color-mix(in srgb, var(--bg) 92%, transparent); backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--line); padding: 9px max(16px, env(safe-area-inset-left));
}
.fbar-row { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; }
.fsearch {
  position: relative; flex: 1 1 240px; max-width: 340px; min-width: 180px; display: flex; align-items: center;
}
.fsearch-ico { position: absolute; left: 10px; color: var(--muted); font-size: 15px; pointer-events: none; }
.fsearch-input {
  width: 100%; padding: 6px 30px 6px 30px; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); color: var(--ink); font-size: 13.5px; min-height: 32px;
}
.fsearch-input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 22%, transparent); }
.fsearch-kbd { position: absolute; right: 9px; color: var(--muted); }
.fsearch-input:focus ~ .fsearch-kbd { display: none; }
.fsels { display: flex; flex-wrap: wrap; gap: 6px; }
.fsel {
  appearance: none; border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  border-radius: 999px; padding: 4px 26px 4px 11px; font-size: 13px; font-weight: 500; cursor: pointer; max-width: 210px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%238a90a8' stroke-width='1.6'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: right 10px center; min-height: 30px;
  text-overflow: ellipsis;
}
.fsel:hover { border-color: var(--muted); }
.fsel.actif { border-color: var(--accent); background-color: var(--accent-soft); color: var(--accent); font-weight: 700; }
.fsel option, .fsel optgroup { color: var(--ink); background: var(--surface); font-weight: 400; }
.fcheck { display: inline-flex; align-items: center; gap: 7px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.fcheck input { accent-color: var(--accent); width: 15px; height: 15px; margin: 0; }
.fchips { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; margin-top: 8px; }
.fchip {
  display: inline-flex; align-items: center; gap: 4px; background: var(--accent-soft); color: var(--accent);
  border-radius: 999px; padding: 2px 3px 2px 10px; font-size: 12.5px; font-weight: 600;
}
.fchip-x {
  border: 0; background: transparent; color: inherit; width: 20px; height: 20px; border-radius: 50%;
  cursor: pointer; font-size: 15px; line-height: 1; padding: 0;
}
.fchip-x:hover { background: color-mix(in srgb, var(--accent) 18%, transparent); }
.fchip-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--c); flex: 0 0 auto; box-shadow: 0 0 0 1.5px var(--surface); }

/* --- Vues --------------------------------------------------------------------------------------- */
.views { padding: 18px max(16px, env(safe-area-inset-right)) 64px max(16px, env(safe-area-inset-left)); outline: none;
  transition: margin-right .22s ease; }
.view-head { display: flex; flex-wrap: wrap; align-items: flex-end; justify-content: space-between; gap: 10px 20px; margin-bottom: 14px; }
.view-title { display: flex; align-items: baseline; flex-wrap: wrap; gap: 4px 14px; min-width: 0; }
.view-title h1 { font-size: clamp(22px, 2.6vw, 28px); font-weight: 700; letter-spacing: -.015em; }
.view-tools { display: flex; flex-wrap: wrap; gap: 6px; align-items: center; }
.loading { min-height: 50vh; }

/* --- Backlog ------------------------------------------------------------------------------------ */
.bl-count { margin: 0; color: var(--muted); font-size: 13px; font-variant-numeric: tabular-nums; }
.bl-new { background: var(--surface); border: 1px solid var(--line); border-radius: 12px; padding: 10px; margin: 0 0 12px; }
.bl-table {
  --cols: minmax(0, 1fr) 104px 150px 30px 36px 34px 84px 132px 58px;
  background: var(--surface); border: 1px solid var(--line); border-radius: 12px;
}
.bl-head, .bl-row { display: grid; grid-template-columns: var(--cols); column-gap: 10px; align-items: center; padding: 0 12px; }
.bl-head {
  position: sticky; top: var(--chrome-h); z-index: 3; background: var(--surface-2); border-bottom: 1px solid var(--line);
  border-radius: 12px 12px 0 0; min-height: 32px;
  font-size: 11px; font-weight: 600; letter-spacing: .07em; text-transform: uppercase; color: var(--muted);
}
.bl-head .c-main { padding-left: 26px; }
.bl-head .c-pts { text-align: right; }
.bl-tree { outline: none; }
.bl-row {
  min-height: 36px; border-bottom: 1px solid var(--line); cursor: pointer; position: relative;
  transition: background .08s;
}
.bl-row:last-child { border-bottom: 0; border-radius: 0 0 12px 12px; }
.bl-row:hover { background: var(--hover); }
.bl-row:focus { outline: none; }
.bl-row:focus-visible { box-shadow: inset 0 0 0 2px var(--accent); }
.bl-row.sel { background: var(--hover); }
.bl-row.sel::before { content: ""; position: absolute; left: 0; top: 4px; bottom: 4px; width: 3px; border-radius: 0 3px 3px 0; background: var(--accent); }
.bl-row.is-open { background: var(--accent-soft); }
.bl-row > span { min-width: 0; display: flex; align-items: center; gap: 6px; }
.c-main { padding-left: calc(var(--d, 0) * 22px); gap: 8px !important; }
.bl-tog {
  flex: 0 0 18px; width: 18px; height: 18px; display: grid; place-items: center; border-radius: 4px;
  color: var(--muted); font-size: 12px;
}
.bl-tog:hover { background: var(--surface-2); color: var(--ink); }
.bl-tog.vide::after { content: ""; width: 4px; height: 4px; border-radius: 50%; background: var(--line); }
.bl-row .key { flex: 0 0 88px; }
.bl-title { flex: 0 1 auto; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bl-kids { font-size: 11px; font-family: var(--f-mono); background: var(--surface-2); border-radius: 999px; padding: 0 6px; flex: 0 0 auto; }
.bl-row.lvl-epic { background: color-mix(in srgb, var(--surface-2) 45%, var(--surface)); min-height: 42px; }
.bl-row.lvl-epic:hover { background: var(--hover); }
.bl-row.lvl-epic.is-open { background: var(--accent-soft); }
.bl-row.lvl-epic .bl-title { font-family: var(--f-display); font-weight: 700; font-size: 15px; letter-spacing: -.005em; }
.bl-row.lvl-epic .key { color: var(--accent); font-weight: 600; }
.bl-row.lvl-us .bl-title { font-weight: 600; }
.bl-row.lvl-us .key, .bl-row.lvl-tt .key { color: color-mix(in srgb, var(--mc) 62%, var(--ink)); }
.bl-row.lvl-tt { font-size: 13.5px; }
.bl-row.fini .bl-title { color: var(--muted); }
.bl-row.fini.lvl-tt .bl-title { text-decoration: line-through; text-decoration-color: color-mix(in srgb, var(--muted) 50%, transparent); }
/* Ligne de contexte (ancêtre affiché pendant un filtrage) : titre atténué, sans baisser l'opacité
   de toute la ligne (les textes --muted deviendraient illisibles). */
.bl-row.ctx .bl-title { color: var(--muted); font-style: italic; }
.bl-row.ctx:hover .bl-title, .bl-row.ctx.sel .bl-title { color: var(--ink); }
.c-prog { gap: 7px !important; }
.prog-n { font-family: var(--f-mono); font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.vpill {
  font-size: 11.5px; font-weight: 600; padding: 2px 8px; border-radius: 999px; background: var(--surface-2);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%;
}
.vpill.herite { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line); font-weight: 500; }
.c-mod { justify-content: center; }
.c-mod.herite .mdot { opacity: .55; }
.fval { font-size: 12px; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; max-width: 100%; }
.c-pts { justify-content: flex-end; font-family: var(--f-mono); font-size: 12px; font-variant-numeric: tabular-nums; color: var(--muted); }
.lvl-epic .c-pts, .lvl-us .c-pts { color: var(--ink); }
.c-stat .pill { max-width: 100%; }
.bl-tree > .empty { border-radius: 0 0 12px 12px; }
/* Réordonnancement par bloc : poignée (survol, focus, sélection), indicateur d'insertion, cible « dans ». */
.bl-table { position: relative; }
.bl-grip {
  position: absolute; left: 0; top: 0; bottom: 0; width: 14px; display: grid; place-items: center;
  color: var(--muted); font-size: 12px; line-height: 1; cursor: grab; opacity: 0; touch-action: none; user-select: none;
  transition: opacity .1s;
}
.bl-row:hover .bl-grip, .bl-row:focus-visible .bl-grip, .bl-row.sel .bl-grip { opacity: 1; }
.bl-grip:hover { color: var(--ink); }
.bl-grip.off { cursor: not-allowed; }
.bl-row:hover .bl-grip.off, .bl-row.sel .bl-grip.off { opacity: .35; }
.bl-dnd, .bl-dnd .bl-row, .bl-dnd .bl-grip { cursor: grabbing; }
.bl-row.bl-dragging { opacity: .45; }
.bl-row.bl-into { box-shadow: inset 0 0 0 2px var(--accent); background: var(--accent-soft); }
.bl-drop {
  position: absolute; z-index: 4; pointer-events: none; height: 3px; border-radius: 3px; background: var(--accent);
  left: calc(12px + var(--d, 0) * 22px); right: 12px;
}
.bl-drop::before {
  content: ""; position: absolute; left: -4px; top: -3px; width: 9px; height: 9px; border-radius: 50%;
  background: var(--surface); border: 2px solid var(--accent); box-sizing: border-box;
}
.bl-notice { margin: 0 0 8px; font-size: 12.5px; }
@media (hover: none) { .bl-grip { opacity: .6; } }

/* --- Fiche tâche (panneau latéral) ------------------------------------------------------------- */
.scrim {
  position: fixed; inset: 0; z-index: 45; background: #0b0e23; opacity: 0; transition: opacity .2s;
}
.scrim.ouvert { opacity: .42; }
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0; z-index: 50; width: var(--drawer-w);
  background: var(--surface); border-left: 1px solid var(--line); box-shadow: var(--shadow);
  display: flex; flex-direction: column; transform: translateX(104%); transition: transform .22s cubic-bezier(.2, .7, .2, 1);
  outline: none;
}
.drawer.ouvert { transform: none; }
@media (min-width: 1200px) {
  :root { --drawer-w: min(600px, 44vw); }
  .scrim { display: none; }
  .drawer { top: var(--chrome-h); box-shadow: -12px 0 32px -18px #10132a40; }
  body.drawer-open .views { margin-right: var(--drawer-w); }
}
.d-top {
  display: flex; align-items: center; gap: 10px; padding: 8px 10px 8px 18px; border-bottom: 1px solid var(--line);
  min-height: 50px; flex: 0 0 auto;
}
.d-crumbs { display: flex; align-items: center; gap: 4px; min-width: 0; flex: 1; overflow: hidden; }
.crumb {
  display: inline-flex; align-items: center; gap: 6px; border: 0; background: none; padding: 3px 6px; border-radius: 6px;
  cursor: pointer; min-width: 0; max-width: 220px; font-size: 12.5px; color: var(--muted);
}
button.crumb:hover { background: var(--surface-2); color: var(--ink); }
.crumb-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb.courant { cursor: default; }
.crumb.courant .key { color: var(--ink); font-weight: 600; }
.crumb-sep { color: var(--line); flex: 0 0 auto; }
.d-actions { display: flex; align-items: center; gap: 2px; flex: 0 0 auto; }
.d-scroll { flex: 1; overflow-y: auto; padding: 18px 22px 40px; overscroll-behavior: contain; }
.d-head { border-left: 4px solid var(--mc, var(--accent)); padding-left: 14px; margin: 0 0 14px; }
.d-ids { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; margin-bottom: 4px; }
.d-ids .key { font-size: 12.5px; color: var(--ink); font-weight: 600; }
.lvl { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); }
.lvl-epic.lvl, .lvl.lvl-epic { color: var(--accent); }
.d-title { font-size: 22px; font-weight: 700; line-height: 1.2; letter-spacing: -.01em; }
.d-title-static { font-size: 22px; line-height: 1.2; margin: 4px 0; }
.d-title-input {
  display: block; width: calc(100% + 12px); margin-left: -6px; font: inherit; color: inherit; background: transparent;
  border: 1px solid transparent; border-radius: 8px; padding: 3px 6px; resize: none; overflow: hidden; line-height: 1.2;
}
.d-title-input:hover { border-color: var(--line); }
.d-title-input:focus { outline: none; border-color: var(--accent); background: var(--surface); }
.d-banner {
  display: flex; flex-wrap: wrap; align-items: center; gap: 8px 12px; margin: 8px 0; padding: 8px 12px;
  border-radius: 8px; background: var(--warn-soft); color: var(--warn-ink); font-weight: 600; font-size: 13px;
}
.d-status { display: flex; flex-wrap: wrap; gap: 5px; margin: 0 0 18px; }
.st-btn {
  display: inline-flex; align-items: center; gap: 6px; border: 1px solid var(--line); background: var(--surface);
  border-radius: 999px; padding: 3px 10px 3px 8px; font-size: 12.5px; font-weight: 600; cursor: pointer; color: var(--muted);
}
.st-btn i { width: 8px; height: 8px; border-radius: 50%; background: var(--sc); }
.st-btn:hover { border-color: var(--sc); color: var(--ink); }
.st-btn[aria-pressed="true"] { background: color-mix(in srgb, var(--sc) 18%, transparent); border-color: var(--sc); color: var(--ink); }
.d-props {
  display: grid; gap: 2px; padding: 10px 14px; border: 1px solid var(--line); border-radius: 12px; background: var(--bg);
}
.prop { display: grid; grid-template-columns: 112px minmax(0, 1fr); align-items: center; gap: 10px; min-height: 38px; padding: 2px 0; }
.prop + .prop { border-top: 1px dashed var(--line); }
.prop-l { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.prop-v { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 10px; min-width: 0; }
.prop-v > select.ctl { min-width: 180px; }
.prop-hint { font-size: 12px; color: var(--muted); }
.ctl-add { min-height: 26px; padding-top: 2px; padding-bottom: 2px; font-size: 12.5px; border-style: dashed; border-radius: 999px; }
.module-ctl { display: inline-flex; align-items: center; gap: 10px; }
.d-sec { margin-top: 24px; }
.d-sec-h { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.d-sec-h h3 { font-size: 15.5px; font-weight: 700; display: inline-flex; align-items: center; gap: 8px; }
.count {
  font-family: var(--f-mono); font-size: 11px; font-weight: 500; color: var(--muted); background: var(--surface-2);
  border-radius: 999px; padding: 1px 7px;
}
.sub-l { font-size: 11.5px; font-weight: 600; text-transform: uppercase; letter-spacing: .07em; color: var(--muted); margin: 8px 0 4px; }
.reflist { display: grid; gap: 1px; }
.refrow { display: flex; align-items: center; gap: 8px; padding: 3px 4px 3px 2px; border-radius: 8px; min-width: 0; }
.refrow:hover { background: var(--surface-2); }
.refrow-main {
  flex: 1; min-width: 0; display: flex; align-items: center; gap: 8px; border: 0; background: none; text-align: left;
  padding: 4px 6px; border-radius: 6px; cursor: pointer; color: var(--ink); text-decoration: none; font-size: 13.5px;
}
.refrow-t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; min-width: 0; }
.refrow.nouveau { animation: refrow-nouveau 2.4s ease-out; }
@keyframes refrow-nouveau { from { background: var(--accent-soft); } to { background: transparent; } }
.prop-v-ro { display: flex; align-items: center; gap: 8px; min-width: 0; }
.key-ro { font-size: 13px; font-weight: 600; color: var(--ink); }
.refrow .key { flex: 0 0 auto; }
.link-ico { color: var(--muted); }
.prog-inline { display: inline-flex; align-items: center; gap: 8px; color: var(--muted); }
.md-editor { font-family: var(--f-mono); font-size: 12.5px; min-height: 180px; }
.comments { display: grid; gap: 10px; margin-bottom: 10px; }
.comment { border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; background: var(--surface); }
.comment-h { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; font-size: 13px; }
.history { list-style: none; margin: 0; padding: 0; display: grid; gap: 6px; font-size: 12.5px; }
.event { display: grid; grid-template-columns: 92px minmax(0, 1fr); gap: 10px; }
.event-at { font-variant-numeric: tabular-nums; }
.event-diff s { color: var(--muted); }
.d-foot {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px 16px; margin-top: 28px; padding-top: 14px;
  border-top: 1px solid var(--line); font-size: 12.5px; color: var(--muted);
}
.d-foot .btn { margin-left: auto; }
.parent-ctl { display: flex; flex-wrap: wrap; align-items: center; gap: 6px 8px; min-width: 0; }
.parent-ctl .ctl { flex: 1 1 160px; }
.parent-ctl .prop-hint { flex-basis: 100%; }
.skeleton-view { margin-top: 0; }
.rm-skel { display: grid; gap: 18px; margin-top: 8px; }
.rm-skel-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.rm-skel-card { height: 220px; border-radius: 12px; }

/* --- Markdown ----------------------------------------------------------------------------------- */
.markdown { font-size: 14px; line-height: 1.6; overflow-wrap: anywhere; }
.markdown > :first-child { margin-top: 0; }
.markdown > :last-child { margin-bottom: 0; }
.markdown p { margin: 0 0 .7em; }
.markdown h3, .markdown h4, .markdown h5, .markdown h6 { font-size: 14.5px; margin: 1.1em 0 .4em; }
.markdown ul, .markdown ol { padding-left: 1.4em; margin: 0 0 .7em; }
.markdown li { margin: .15em 0; }
.markdown pre { background: var(--surface-2); border-radius: 8px; padding: 10px 12px; overflow-x: auto; font-size: 12.5px; }
.markdown pre code { background: none; padding: 0; }
.markdown blockquote { margin: 0 0 .7em; padding: 2px 12px; border-left: 3px solid var(--line); color: var(--muted); }
.markdown hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.md-table { overflow-x: auto; margin: 0 0 .8em; }
.markdown table { border-collapse: collapse; font-size: 13px; }
.markdown th, .markdown td { border: 1px solid var(--line); padding: 4px 8px; text-align: left; vertical-align: top; }
.markdown th { background: var(--surface-2); }
.md-check {
  display: inline-grid; place-items: center; width: 14px; height: 14px; border: 1.5px solid var(--line); border-radius: 3px;
  margin-right: 6px; vertical-align: -2px; font-size: 10px; font-weight: 700;
}
.md-check.fait { background: var(--ok); border-color: var(--ok); color: #fff; }

/* --- Toasts ------------------------------------------------------------------------------------- */
.toasts {
  position: fixed; left: 50%; bottom: max(18px, env(safe-area-inset-bottom)); transform: translateX(-50%);
  z-index: 80; display: flex; flex-direction: column; align-items: center; gap: 8px; width: min(520px, calc(100vw - 32px));
  pointer-events: none;
}
.toast {
  pointer-events: auto; display: flex; align-items: center; gap: 10px; max-width: 100%;
  background: var(--ink-band); color: var(--on-band); border-radius: 10px; padding: 9px 8px 9px 14px;
  border: 1px solid color-mix(in srgb, var(--on-band) 22%, transparent);
  box-shadow: var(--shadow); font-size: 13.5px; animation: toast-in .18s ease-out;
}
.toast.erreur { background: #9e1638; color: #fff; }
.toast.sortie { opacity: 0; transform: translateY(6px); transition: opacity .18s, transform .18s; }
.toast-msg { flex: 1; min-width: 0; }
.toast-action {
  display: inline-flex; align-items: center; gap: 7px; border: 0; background: #ffffff1f; color: #fff; font-weight: 700;
  border-radius: 6px; padding: 4px 10px; cursor: pointer; white-space: nowrap;
}
.toast-kbd { font-size: 10px; font-weight: 600; opacity: .7; }
.toast-action:hover { background: #ffffff33; }
.toast-close { border: 0; background: none; color: inherit; opacity: .7; cursor: pointer; font-size: 17px; width: 26px; height: 26px; border-radius: 6px; }
.toast-close:hover { opacity: 1; background: #ffffff1a; }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* --- Connexion ---------------------------------------------------------------------------------- */
.login {
  min-height: 100vh; display: grid; place-items: center; padding: 24px 16px;
  background: radial-gradient(1200px 500px at 50% -10%, color-mix(in srgb, var(--accent) 18%, transparent), transparent), var(--ink-band);
}
.login-card {
  width: min(440px, 100%); background: var(--surface); border-radius: 16px; padding: 28px; display: grid; gap: 14px;
  box-shadow: var(--shadow); border-top: 4px solid var(--accent);
}
.login-card h1 { font-size: 22px; }
.login-card p { margin: 0; color: var(--muted); }
.login-card .ctl { min-height: 40px; font-family: var(--f-mono); }
.login-card .btn { min-height: 40px; }
.login-error { color: var(--accent) !important; font-weight: 600; }

/* --- Responsive --------------------------------------------------------------------------------- */
@media (max-width: 1100px) {
  .bl-table { --cols: minmax(0, 1fr) 96px 124px 26px 34px 32px 26px 118px 50px; }
  .bl-head .c-prio { font-size: 0; }
  .c-prio .prio { font-size: 0; gap: 0; }
}
@media (max-width: 900px) {
  .band-in { gap: 10px; }
  .search-btn-t, .search-btn kbd { display: none; }
  .tabs { margin-left: 0; }
  .tab { padding: 5px 10px; }
  .fsearch { max-width: none; flex-basis: 100%; }
  .bl-table { --cols: minmax(0, 1fr) 84px 24px 112px 46px; }
  .c-ver, .c-champ, .c-pts, .c-prio { display: none !important; }
  .bl-row .key { flex-basis: 78px; }
  .c-main { padding-left: calc(var(--d, 0) * 14px); }
  .bl-drop { left: calc(12px + var(--d, 0) * 14px); }
  .views { padding-top: 14px; }
  .prop { grid-template-columns: 96px minmax(0, 1fr); }
}
@media (max-width: 640px) {
  .brand-t { display: none; }
  /* Onglets réduits à leur icône (le titre reste lu par les lecteurs d'écran) : rien n'est coupé. */
  .tabs { flex: 0 1 auto; min-width: 0; }
  .tab { padding: 5px 11px; }
  .tab-ico { font-size: 15px; opacity: 1; }
  .tab-t {
    position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0;
  }
  .list-select { max-width: 38vw; }
  .band-sp { display: none; }
  .search-btn { margin-left: auto; }
  .bl-table { --cols: minmax(0, 1fr) 98px; }
  .c-prog, .c-mod, .c-who { display: none !important; }
  .bl-head { display: none; }
  .bl-row { padding: 0 8px; column-gap: 6px; }
  .bl-row .key { flex-basis: auto; }
  .bl-drop { left: calc(8px + var(--d, 0) * 14px); }
  .fsels { flex-wrap: nowrap; overflow-x: auto; max-width: 100%; padding-bottom: 2px; scrollbar-width: thin; }
  .fsel { flex: 0 0 auto; }
  .d-scroll { padding: 14px 16px 40px; }
  .d-top { padding-left: 12px; }
  .d-copy-t { display: none; }
  .prop { grid-template-columns: 1fr; gap: 4px; padding: 6px 0; }
  .prop-v > select.ctl { min-width: 0; flex: 1; }
}
/* Pointeur grossier (doigt) : la poignée, seul déclencheur du glisser tactile, fait au moins
   24 × 24 px (WCAG 2.2, 2.5.8) ; la ligne s'écarte d'autant pour que la poignée ne recouvre pas
   le bouton de dépliage. Placé après les règles de largeur pour les surcharger. */
@media (pointer: coarse) {
  .bl-grip { width: 28px; font-size: 14px; }
  .bl-row { padding-left: 30px; }
  .bl-drop { left: calc(30px + var(--d, 0) * 22px); }
}
@media (pointer: coarse) and (max-width: 900px) {
  .bl-drop { left: calc(30px + var(--d, 0) * 14px); }
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { transition: none !important; animation: none !important; }
}

/* Identifiant permanent de la fiche (#12), copiable */
.d-id { border: 1px dashed var(--line); background: none; color: var(--muted); border-radius: 5px; padding: 0 6px; font-size: 12px; cursor: pointer; }
.d-id:hover, .d-id:focus-visible { color: var(--ink); border-style: solid; border-color: var(--muted); }
