/* ==========================================================================
   TaskFlow — feuille de style
   Palette : vert forêt (encre et actions), jaune soleil (accent), bleu océan (information).
   Polices : Bricolage Grotesque (titres) + Instrument Sans (texte), embarquées.
   ========================================================================== */

@font-face { font-family: 'Bricolage'; font-weight: 200 800; font-display: swap; src: url(/fonts/bricolage-grotesque-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Bricolage'; font-weight: 200 800; font-display: swap; src: url(/fonts/bricolage-grotesque-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113; }
@font-face { font-family: 'Instrument'; font-weight: 400 700; font-display: swap; src: url(/fonts/instrument-sans-latin-wght-normal.woff2) format('woff2'); unicode-range: U+0000-00FF,U+0131,U+0152-0153,U+02BB-02BC,U+02C6,U+02DA,U+02DC,U+2000-206F,U+20AC,U+2122,U+2191,U+2193,U+2212,U+2215,U+FEFF,U+FFFD; }
@font-face { font-family: 'Instrument'; font-weight: 400 700; font-display: swap; src: url(/fonts/instrument-sans-latin-ext-wght-normal.woff2) format('woff2'); unicode-range: U+0100-02BA,U+02BD-02C5,U+02C7-02CC,U+02CE-02D7,U+02DD-02FF,U+1E00-1EFF,U+2020,U+20A0-20AB,U+20AD-20C0,U+2113; }

:root {
  --font-display: 'Bricolage', 'Segoe UI', system-ui, sans-serif;
  --font-body: 'Instrument', 'Segoe UI', system-ui, -apple-system, sans-serif;

  --green-900: #06382b;
  --green-700: #0b6b52;
  --green-600: #0f8366;
  --green-100: #d9efe7;
  --sun: #f7c948;
  --sun-ink: #6b4e00;
  --ocean: #1f5fa8;

  --bg: #eef2ef;
  --surface: #ffffff;
  --surface-2: #f5f8f6;
  --surface-3: #e8eeea;
  --ink: #12201a;
  --ink-2: #44524b;
  --ink-3: #78867f;
  --line: #dbe3de;
  --line-strong: #c3cfc8;
  --primary: var(--green-700);
  --primary-hover: #095a44;
  --primary-ink: #ffffff;
  --primary-soft: #dcf0e8;
  --danger: #c4342b;
  --danger-soft: #fbe4e1;
  --warn-soft: #fdf0c7;
  --warn-ink: #6b4e00;
  --ok: #178a53;
  --ok-soft: #d8f2e3;
  --info-soft: #dbe9f8;
  --info-ink: #174a84;
  --focus: #1f5fa8;

  --shadow-1: 0 1px 2px rgb(12 32 24 / .08), 0 0 0 1px rgb(12 32 24 / .03);
  --shadow-2: 0 6px 24px -6px rgb(12 32 24 / .22), 0 2px 6px rgb(12 32 24 / .08);
  --shadow-3: 0 24px 60px -12px rgb(6 24 18 / .45);

  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 16px;
  --topbar-h: 56px;
  --list-w: 296px;
}

:root[data-theme='dark'] {
  --bg: #0c1511;
  --surface: #15211b;
  --surface-2: #1b2a23;
  --surface-3: #22332b;
  --ink: #e7efea;
  --ink-2: #aebdb5;
  --ink-3: #7f9088;
  --line: #263a31;
  --line-strong: #34493f;
  --primary: #3fc39b;
  --primary-hover: #5ad3ad;
  --primary-ink: #04261c;
  --primary-soft: #17382d;
  --danger: #f0746b;
  --danger-soft: #3b1d1b;
  --warn-soft: #3b3112;
  --warn-ink: #f2d47a;
  --ok: #4cd08b;
  --ok-soft: #153a28;
  --info-soft: #14304f;
  --info-ink: #9cc6f2;
  --focus: #78b2ee;
  --green-100: #17382d;
  --shadow-1: 0 1px 2px rgb(0 0 0 / .4);
  --shadow-2: 0 8px 28px -6px rgb(0 0 0 / .6);
  --shadow-3: 0 24px 60px -12px rgb(0 0 0 / .7);
  color-scheme: dark;
}

*, *::before, *::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  font-family: var(--font-body);
  font-size: 15px;
  line-height: 1.45;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
body.has-modal { overflow: hidden; }
h1, h2, h3, h4 { font-family: var(--font-display); margin: 0; line-height: 1.15; letter-spacing: -0.01em; }
p { margin: 0; }
a { color: var(--primary); }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
[hidden] { display: none !important; }
:focus-visible { outline: 2px solid var(--focus); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--sun); color: #2b2100; }
.muted { color: var(--ink-3); }
.small { font-size: 13px; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.ic { width: 18px; height: 18px; flex: none; }
.grow { flex: 1; min-width: 0; }
.row { display: flex; align-items: center; gap: 8px; }
.nowrap { white-space: nowrap; }
code { font-family: ui-monospace, 'SF Mono', Menlo, Consolas, monospace; font-size: .88em; background: var(--surface-3); padding: 1px 5px; border-radius: 4px; }

/* ---------- Boutons & champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  min-height: 36px; padding: 0 14px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  font-weight: 600; font-size: 14px; text-decoration: none; transition: background .12s, border-color .12s, transform .06s;
}
.btn:hover { background: var(--surface-2); }
.btn:active { transform: translateY(1px); }
.btn[disabled] { opacity: .55; pointer-events: none; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: var(--primary-ink); }
.btn-primary:hover { background: var(--primary-hover); border-color: var(--primary-hover); }
.btn-danger { background: var(--danger); border-color: var(--danger); color: #fff; }
.btn-danger:hover { background: #a82a22; }
.btn-ghost { border-color: transparent; background: transparent; }
.btn-ghost:hover { background: var(--surface-3); }
.btn-sm { min-height: 30px; padding: 0 10px; font-size: 13px; }
.btn-block { width: 100%; }
.icon-btn {
  display: inline-grid; place-items: center; width: 34px; height: 34px; border-radius: var(--r-sm);
  border: 0; background: transparent; color: inherit; position: relative;
}
.icon-btn:hover { background: rgb(128 140 134 / .18); }
.icon-btn .badge { position: absolute; top: 2px; right: 1px; }

.input, select.input, textarea.input {
  width: 100%; min-height: 38px; padding: 8px 11px; border-radius: var(--r-sm);
  border: 1px solid var(--line-strong); background: var(--surface); color: var(--ink);
  transition: border-color .12s, box-shadow .12s;
}
textarea.input { resize: vertical; line-height: 1.45; }
.input:hover { border-color: var(--ink-3); }
.input:focus { outline: none; border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 28%, transparent); }
.input::placeholder { color: var(--ink-3); }
.field { display: grid; gap: 6px; margin-bottom: 14px; }
.field > span { font-size: 13px; font-weight: 600; color: var(--ink-2); }
.field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.hint { font-size: 13px; color: var(--ink-3); margin-top: -6px; margin-bottom: 14px; }
.check { display: flex; align-items: center; gap: 9px; cursor: pointer; }
.check input { width: 17px; height: 17px; accent-color: var(--primary); }
.error-box { padding: 10px 12px; border-radius: var(--r-sm); background: var(--danger-soft); color: var(--danger); font-size: 14px; margin-bottom: 14px; }
.info-box { padding: 10px 12px; border-radius: var(--r-sm); background: var(--info-soft); color: var(--info-ink); font-size: 14px; }
.warn-box { padding: 10px 12px; border-radius: var(--r-sm); background: var(--warn-soft); color: var(--warn-ink); font-size: 14px; }

/* ---------- Avatars, pastilles ---------- */
.avatar {
  display: inline-grid; place-items: center; width: 28px; height: 28px; border-radius: 50%;
  background: var(--c, #64748b); color: #fff; font-size: 11px; font-weight: 700; letter-spacing: .02em;
  border: 2px solid var(--surface); flex: none; font-family: var(--font-body);
}
.avatar.sm { width: 22px; height: 22px; font-size: 9.5px; border-width: 1.5px; }
.avatar.lg { width: 38px; height: 38px; font-size: 14px; }
.avatars { display: inline-flex; }
.avatars .avatar + .avatar { margin-left: -7px; }
.badge { min-width: 17px; height: 17px; padding: 0 5px; border-radius: 9px; background: var(--danger); color: #fff; font-size: 11px; font-weight: 700; display: inline-grid; place-items: center; line-height: 1; }
.chip {
  display: inline-flex; align-items: center; gap: 5px; height: 22px; padding: 0 8px; border-radius: 11px;
  font-size: 12px; font-weight: 600; background: var(--surface-3); color: var(--ink-2); white-space: nowrap;
}
.chip.ok { background: var(--ok-soft); color: var(--ok); }
.chip.warn { background: var(--warn-soft); color: var(--warn-ink); }
.chip.danger { background: var(--danger-soft); color: var(--danger); }
.chip.info { background: var(--info-soft); color: var(--info-ink); }
.chip .ic { width: 13px; height: 13px; }
.label-pill {
  display: inline-block; min-width: 38px; max-width: 100%; height: 8px; border-radius: 4px; background: var(--c); overflow: hidden;
}
.label-pill.named { height: 20px; padding: 0 8px; font-size: 12px; font-weight: 600; line-height: 20px; color: #fff; border-radius: 5px; text-shadow: 0 1px 0 rgb(0 0 0 / .18); white-space: nowrap; text-overflow: ellipsis; }

/* ---------- Écran de connexion ---------- */
.auth {
  min-height: 100vh; min-height: 100dvh; display: grid; grid-template-columns: minmax(0, 1.05fr) minmax(0, 1fr);
}
.auth-art {
  position: relative; overflow: hidden; color: #fff; padding: 48px clamp(28px, 5vw, 72px);
  background:
    radial-gradient(900px 500px at 85% 110%, rgb(247 201 72 / .30), transparent 60%),
    radial-gradient(700px 500px at -10% -10%, rgb(31 95 168 / .55), transparent 60%),
    linear-gradient(160deg, #0b6b52 0%, #06382b 100%);
  display: flex; flex-direction: column; justify-content: space-between; gap: 32px;
}
.brand { display: inline-flex; align-items: center; gap: 10px; font-family: var(--font-display); font-weight: 800; font-size: 22px; letter-spacing: -0.02em; text-decoration: none; color: inherit; }
.brand-mark { width: 30px; height: 30px; flex: none; }
.auth-art h1 { font-size: clamp(30px, 4.2vw, 52px); font-weight: 800; letter-spacing: -0.03em; max-width: 13ch; }
.auth-art .lead { font-size: 17px; max-width: 42ch; color: rgb(255 255 255 / .82); margin-top: 16px; }
.mini-board { display: flex; gap: 12px; align-items: flex-start; margin-top: 8px; transform: rotate(-3deg); transform-origin: left center; }
.mini-col { width: 140px; flex: none; background: rgb(255 255 255 / .14); border-radius: 10px; padding: 8px; display: grid; gap: 7px; }
.mini-col b { font-size: 12px; font-weight: 700; padding: 2px 4px 4px; }
.mini-card { background: #fff; color: #12201a; border-radius: 7px; padding: 8px 9px; font-size: 12px; font-weight: 600; box-shadow: 0 2px 6px rgb(0 0 0 / .18); }
.mini-card i { display: block; width: 30px; height: 5px; border-radius: 3px; margin-bottom: 6px; background: var(--c); }
.mini-col.drag .mini-card:first-of-type { transform: translateY(-6px) rotate(3deg); box-shadow: 0 10px 18px rgb(0 0 0 / .3); }
.auth-form-wrap { display: grid; place-items: center; padding: 32px 20px; background: var(--bg); }
.auth-card { width: 100%; max-width: 400px; }
.auth-card h2 { font-size: 28px; font-weight: 700; margin-bottom: 6px; }
.auth-card .sub { color: var(--ink-2); margin-bottom: 24px; }
.auth-switch { margin-top: 18px; text-align: center; color: var(--ink-2); font-size: 14px; }
.demo-box { margin-top: 20px; padding: 12px 14px; border-radius: var(--r-md); background: var(--primary-soft); font-size: 13.5px; color: var(--ink); display: grid; gap: 6px; }
.demo-box button { text-align: left; border: 0; background: transparent; padding: 4px 0; color: var(--primary); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.auth-theme { position: fixed; top: 12px; right: 12px; z-index: 5; }
@media (max-width: 860px) {
  .auth { grid-template-columns: 1fr; }
  .auth-art { padding: 24px 22px 28px; gap: 18px; }
  .auth-art h1 { font-size: 28px; max-width: none; }
  .auth-art .lead { font-size: 15px; margin-top: 10px; }
  .mini-board { display: none; }
}

/* ---------- Coque applicative ---------- */
.shell { min-height: 100vh; min-height: 100dvh; display: flex; flex-direction: column; }
.topbar {
  position: sticky; top: 0; z-index: 30; height: var(--topbar-h); display: flex; align-items: center; gap: 6px;
  padding: 0 14px; background: var(--green-900); color: #fff; box-shadow: 0 1px 0 rgb(255 255 255 / .06);
}
:root[data-theme='dark'] .topbar { background: #07130f; }
.topbar .brand { font-size: 19px; margin-right: 6px; }
.topbar .brand-mark { width: 26px; height: 26px; }
.topbar .icon-btn:hover { background: rgb(255 255 255 / .14); }
.nav-link {
  display: inline-flex; align-items: center; gap: 7px; height: 36px; padding: 0 12px; border-radius: var(--r-sm);
  color: rgb(255 255 255 / .86); text-decoration: none; font-weight: 600; font-size: 14px; border: 0; background: transparent;
}
.nav-link:hover { background: rgb(255 255 255 / .12); color: #fff; }
.nav-link.active { background: rgb(255 255 255 / .18); color: #fff; }
.topbar .spacer { flex: 1; }
.topbar .avatar { border-color: var(--green-900); width: 32px; height: 32px; font-size: 12px; }
.me-btn { border: 0; background: transparent; padding: 2px; border-radius: 50%; }
.me-btn:hover .avatar { box-shadow: 0 0 0 2px rgb(255 255 255 / .35); }
@media (max-width: 720px) {
  .nav-link span.lbl { display: none; }
  .nav-link { padding: 0 9px; }
  .topbar { padding: 0 8px; }
}

.top-banner {
  display: flex; align-items: center; gap: 10px; padding: 9px 14px; font-size: 13.5px; font-weight: 600;
  background: var(--warn-soft); color: var(--warn-ink);
}
.top-banner.info { background: var(--info-soft); color: var(--info-ink); }
.top-banner .ic { flex: none; }
.top-banner span.grow { flex: 1; font-weight: 500; }
.top-banner .btn { flex: none; }

.page { width: 100%; max-width: 1180px; margin: 0 auto; padding: 28px 20px 80px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; flex-wrap: wrap; margin-bottom: 22px; }
.page-head h1 { font-size: clamp(26px, 4vw, 34px); font-weight: 800; letter-spacing: -0.03em; }
.page-head p { color: var(--ink-2); margin-top: 4px; }
.section-title { font-size: 18px; font-weight: 700; margin: 30px 0 14px; display: flex; align-items: center; gap: 10px; }
.section-title .count { font-family: var(--font-body); font-size: 13px; color: var(--ink-3); font-weight: 600; }

/* ---------- Accueil : tableaux ---------- */
.board-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(250px, 1fr)); gap: 16px; }
.board-tile {
  position: relative; display: flex; flex-direction: column; justify-content: space-between; gap: 18px;
  min-height: 138px; padding: 16px; border-radius: var(--r-lg); color: #fff; text-decoration: none;
  background: var(--bg-img, var(--green-700)); box-shadow: var(--shadow-1); overflow: hidden; isolation: isolate;
  transition: transform .15s ease, box-shadow .15s ease;
}
.board-tile::after { content: ''; position: absolute; inset: 0; z-index: -1; background: linear-gradient(180deg, rgb(0 0 0 / 0) 30%, rgb(0 0 0 / .32)); }
.board-tile:hover { transform: translateY(-3px); box-shadow: var(--shadow-2); }
.board-tile h3 { font-size: 19px; font-weight: 700; text-shadow: 0 1px 2px rgb(0 0 0 / .25); }
.board-tile .meta { display: flex; align-items: center; justify-content: space-between; gap: 8px; font-size: 13px; }
.board-tile .method { display: inline-flex; align-items: center; gap: 5px; padding: 2px 9px; border-radius: 11px; background: rgb(255 255 255 / .22); font-weight: 600; font-size: 12px; }
.board-tile .progress { height: 5px; border-radius: 3px; background: rgb(255 255 255 / .28); overflow: hidden; margin-top: 8px; }
.board-tile .progress i { display: block; height: 100%; background: #fff; border-radius: 3px; }
.board-tile .avatar { border-color: rgb(0 0 0 / .25); }
.board-tile.new { background: var(--surface); color: var(--ink-2); border: 2px dashed var(--line-strong); box-shadow: none; align-items: center; justify-content: center; font-weight: 600; font-family: var(--font-body); cursor: pointer; }
.board-tile.new::after { display: none; }
.board-tile.new:hover { border-color: var(--primary); color: var(--primary); }
.board-tile.closed { filter: grayscale(.7) brightness(.85); }
.empty { text-align: center; padding: 48px 20px; color: var(--ink-2); display: grid; gap: 10px; justify-items: center; }
.empty h3 { font-size: 20px; color: var(--ink); }
.my-cards { display: grid; gap: 6px; max-height: 340px; overflow-y: auto; padding-right: 4px; scrollbar-width: thin; }
.my-card {
  display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-radius: var(--r-md); background: var(--surface);
  border: 1px solid var(--line); text-decoration: none; color: inherit; width: 100%; text-align: left;
}
.my-card:hover { border-color: var(--primary); }
.my-card .t { font-weight: 600; }

/* ---------- Fonds de tableau ---------- */
[data-bg='ocean'] { --bg-img: linear-gradient(135deg, #1f5fa8 0%, #0e3b73 100%); }
[data-bg='lagoon'] { --bg-img: linear-gradient(135deg, #0aa3a3 0%, #0b6b7a 100%); }
[data-bg='forest'] { --bg-img: linear-gradient(135deg, #198a5c 0%, #0b4a36 100%); }
[data-bg='aurora'] { --bg-img: radial-gradient(900px 500px at 100% 0, #3fc39b66, transparent 60%), linear-gradient(135deg, #5b3fa8 0%, #1a2e6b 100%); }
[data-bg='grape'] { --bg-img: linear-gradient(135deg, #8a3fb0 0%, #4a1f73 100%); }
[data-bg='rose'] { --bg-img: linear-gradient(135deg, #d94a7a 0%, #8f2350 100%); }
[data-bg='sunset'] { --bg-img: linear-gradient(135deg, #e8743b 0%, #b0307a 100%); }
[data-bg='sand'] { --bg-img: linear-gradient(135deg, #c7a36b 0%, #8d6b3a 100%); }
[data-bg='graphite'] { --bg-img: linear-gradient(135deg, #51606a 0%, #26313a 100%); }
[data-bg='dusk'] { --bg-img: linear-gradient(135deg, #243b6b 0%, #0f1a36 100%); }

/* ---------- Page tableau ---------- */
.board-page { flex: 1; display: flex; flex-direction: column; min-height: 0; background: var(--bg-img); position: relative; }
.board-page::before { content: ''; position: absolute; inset: 0; background: rgb(0 0 0 / .08); pointer-events: none; }
.board-bar {
  position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 10px 14px; flex-wrap: wrap;
  background: rgb(0 0 0 / .3); color: #fff;
}
.board-title {
  font-family: var(--font-display); font-weight: 800; font-size: 20px; letter-spacing: -0.02em; padding: 4px 9px; border-radius: var(--r-sm);
  background: transparent; border: 0; color: #fff; max-width: 40vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.board-title:hover { background: rgb(255 255 255 / .16); }
.bar-btn {
  display: inline-flex; align-items: center; gap: 6px; height: 32px; padding: 0 11px; border-radius: var(--r-sm);
  border: 0; background: rgb(255 255 255 / .16); color: #fff; font-weight: 600; font-size: 13.5px; text-decoration: none; white-space: nowrap;
}
.bar-btn:hover { background: rgb(255 255 255 / .28); }
.bar-btn.on { background: #fff; color: #12201a; }
.bar-btn .badge { margin-left: 2px; }
.view-tabs { display: inline-flex; padding: 3px; border-radius: 9px; background: rgb(0 0 0 / .25); gap: 2px; max-width: 100%; overflow-x: auto; scrollbar-width: none; }
.view-tabs::-webkit-scrollbar { display: none; }
.view-tab { display: inline-flex; align-items: center; gap: 6px; height: 28px; padding: 0 11px; border: 0; border-radius: 7px; background: transparent; color: rgb(255 255 255 / .85); font-weight: 600; font-size: 13.5px; white-space: nowrap; }
.view-tab:hover { background: rgb(255 255 255 / .14); }
.view-tab.on { background: #fff; color: #12201a; }
.view-tab .ic { width: 15px; height: 15px; }
.mini-members { display: inline-flex; margin-left: 4px; }
.mini-members .avatar { border-color: rgb(40 50 46); width: 28px; height: 28px; }
.mini-members .avatar + .avatar { margin-left: -6px; }
.filter-bar { position: relative; z-index: 2; display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: rgb(0 0 0 / .16); color: #fff; flex-wrap: wrap; font-size: 13px; }
.filter-bar .input { background: rgb(255 255 255 / .94); color: #12201a; min-height: 32px; width: 220px; }
.board-body { position: relative; z-index: 1; flex: 1; min-height: 0; display: flex; flex-direction: column; }
.role-note { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px; background: rgb(255 255 255 / .2); border-radius: 12px; font-size: 12.5px; font-weight: 600; }

/* ---------- Kanban ---------- */
.kanban {
  flex: 1; display: flex; align-items: flex-start; gap: 12px; padding: 14px 14px 22px; overflow-x: auto; overflow-y: hidden;
  scroll-snap-type: x proximity; -webkit-overflow-scrolling: touch; min-height: 0;
}
.list {
  width: var(--list-w); flex: none; max-height: 100%; display: flex; flex-direction: column; border-radius: 13px;
  background: color-mix(in srgb, var(--surface-2) 94%, transparent); box-shadow: var(--shadow-1); scroll-snap-align: start;
  border: 1px solid rgb(255 255 255 / .3); overflow: hidden;
}
:root[data-theme='dark'] .list { background: color-mix(in srgb, var(--surface) 94%, transparent); border-color: rgb(255 255 255 / .06); }
.list-cover { height: 40px; flex: none; background: var(--bg-img); }
.list-cover.color { background: var(--c); }
.list-cover.img { background-size: cover; background-position: center; }
[data-cover='sunrise'] { --bg-img: linear-gradient(135deg, #f7b733 0%, #fc4a1a 100%); }
[data-cover='citrus'] { --bg-img: linear-gradient(135deg, #f9d423 0%, #e65c00 100%); }
[data-cover='mint'] { --bg-img: linear-gradient(135deg, #43cea2 0%, #185a9d 100%); }
[data-cover='berry'] { --bg-img: linear-gradient(135deg, #cc2b5e 0%, #753a88 100%); }
[data-cover='sky'] { --bg-img: linear-gradient(135deg, #2193b0 0%, #6dd5ed 100%); }
[data-cover='slate'] { --bg-img: linear-gradient(135deg, #606c88 0%, #3f4c6b 100%); }
.list-head { display: flex; align-items: center; gap: 6px; padding: 10px 8px 6px 12px; cursor: grab; }
.list-title { flex: 1; min-width: 0; font-family: var(--font-display); font-size: 15.5px; font-weight: 700; padding: 3px 6px; margin-left: -6px; border: 0; background: transparent; text-align: left; border-radius: 5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink); }
.list-title:hover { background: var(--surface-3); }
.list-count { font-size: 12.5px; font-weight: 700; color: var(--ink-3); min-width: 22px; text-align: center; padding: 1px 6px; border-radius: 10px; background: var(--surface-3); }
.list-count.over { background: var(--danger-soft); color: var(--danger); }
.list-done-mark { color: var(--ok); display: inline-flex; }
.list-cards { flex: 1; overflow-y: auto; padding: 4px 8px 4px; display: flex; flex-direction: column; gap: 8px; min-height: 48px; scrollbar-width: thin; }
.list-foot { padding: 6px 8px 8px; }
.add-btn { display: flex; align-items: center; gap: 7px; width: 100%; padding: 8px 9px; border: 0; background: transparent; border-radius: var(--r-sm); color: var(--ink-2); font-weight: 600; font-size: 14px; text-align: left; }
.add-btn:hover { background: var(--surface-3); color: var(--ink); }
.add-list { width: var(--list-w); flex: none; }
.add-list .add-btn { background: rgb(255 255 255 / .22); color: #fff; border-radius: 13px; padding: 12px; }
.add-list .add-btn:hover { background: rgb(255 255 255 / .34); }
.composer { padding: 0 2px; display: grid; gap: 8px; }
.composer textarea { min-height: 62px; }
.composer .row { gap: 6px; }

.card {
  position: relative; background: var(--surface); border-radius: 9px; box-shadow: var(--shadow-1); border: 1px solid var(--line);
  cursor: pointer; overflow: hidden; transition: box-shadow .12s, border-color .12s; -webkit-tap-highlight-color: transparent;
  flex-shrink: 0;
}
.card:hover { border-color: var(--primary); box-shadow: 0 2px 8px rgb(12 32 24 / .14); }
.card.done .card-title { color: var(--ink-3); }
.card-cover { height: 34px; background: var(--c, var(--primary)); }
.card-cover.img { height: 120px; background-size: cover; background-position: center; }
.card-body { padding: 9px 11px 10px; display: grid; gap: 7px; }
.card-labels { display: flex; flex-wrap: wrap; gap: 4px; }
.card-title { font-weight: 600; font-size: 14.5px; line-height: 1.3; overflow-wrap: anywhere; }
.card-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 8px 10px; font-size: 12.5px; color: var(--ink-3); }
.card-meta .m { display: inline-flex; align-items: center; gap: 4px; }
.card-meta .m .ic { width: 14px; height: 14px; }
.card-meta .due { padding: 1px 7px; border-radius: 5px; font-weight: 600; background: transparent; }
.card-meta .due.soon { background: var(--warn-soft); color: var(--warn-ink); }
.card-meta .due.overdue { background: var(--danger-soft); color: var(--danger); }
.card-meta .due.done { background: var(--ok-soft); color: var(--ok); }
.card-meta .pts { margin-left: auto; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; display: grid; place-items: center; background: var(--surface-3); color: var(--ink-2); font-weight: 700; }
.card-meta .avatars { margin-left: auto; }
.card-meta .pts + .avatars { margin-left: 0; }
.card.fresh { animation: pop .35s ease-out; }
@keyframes pop { 0% { transform: scale(.96); opacity: .4; } 100% { transform: none; opacity: 1; } }
.sortable-ghost { opacity: .35; }
.sortable-ghost.card, .sortable-ghost.list { background: var(--primary-soft); border-style: dashed; }
.sortable-chosen { cursor: grabbing; }
.sortable-drag { box-shadow: var(--shadow-3) !important; transform: rotate(2.5deg); opacity: 1 !important; }
.list-cards.drop-over { background: color-mix(in srgb, var(--primary) 8%, transparent); }
.kanban.observer .list-head, .kanban.observer .card { cursor: default; }
.sprint-banner { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; padding: 8px 14px; background: rgb(0 0 0 / .18); color: #fff; font-size: 13.5px; }
.sprint-banner b { font-family: var(--font-display); font-size: 15px; }
.sprint-banner .pbar { flex: 0 1 160px; height: 6px; border-radius: 3px; background: rgb(255 255 255 / .25); overflow: hidden; }
.sprint-banner .pbar i { display: block; height: 100%; background: var(--sun); }
.sprint-banner select { background: rgb(255 255 255 / .94); color: #12201a; border: 0; border-radius: 6px; height: 28px; padding: 0 8px; font-weight: 600; }

@media (max-width: 720px) {
  :root { --list-w: min(84vw, 320px); }
  .kanban { padding: 10px 10px 20px; gap: 10px; }
  .board-title { max-width: 62vw; font-size: 18px; }
  .view-tab { padding: 0 9px; }
  .filter-bar .input { width: 100%; }
}

/* ---------- Panneaux « page » à l'intérieur d'un tableau ---------- */
.panel-wrap { flex: 1; overflow: auto; padding: 16px 14px 40px; }
.panel { background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-1); border: 1px solid var(--line); overflow: hidden; }
.panel + .panel { margin-top: 14px; }
.panel-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.panel-head h3 { font-size: 17px; font-weight: 700; }
.panel-head .sub { color: var(--ink-3); font-size: 13px; }
.panel-body { padding: 14px 16px; }

/* Backlog Scrum */
.sprint-block { border-bottom: 1px solid var(--line); }
.sprint-block:last-child { border-bottom: 0; }
.sprint-head { display: flex; align-items: center; gap: 10px; padding: 12px 16px; background: var(--surface-2); flex-wrap: wrap; }
.sprint-head h4 { font-size: 16px; font-weight: 700; }
.sprint-head .dates { color: var(--ink-3); font-size: 13px; }
.sprint-goal { padding: 0 16px 10px; background: var(--surface-2); font-size: 13.5px; color: var(--ink-2); }
.sprint-list { padding: 6px 10px 10px; min-height: 18px; display: grid; gap: 4px; align-content: start; }
.bl-row { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border: 1px solid var(--line); border-radius: var(--r-sm); background: var(--surface); cursor: pointer; }
.bl-row:hover { border-color: var(--primary); }
.bl-row .grip { color: var(--ink-3); cursor: grab; display: inline-flex; }
.bl-row .t { flex: 1; min-width: 0; font-weight: 600; overflow-wrap: anywhere; }
.bl-row.is-done .t { color: var(--ink-3); text-decoration: line-through; }
.bl-row .pts { min-width: 26px; height: 24px; padding: 0 7px; border-radius: 12px; display: grid; place-items: center; background: var(--surface-3); font-weight: 700; font-size: 12.5px; }
.sprint-empty { padding: 14px; text-align: center; color: var(--ink-3); font-size: 13.5px; border: 1.5px dashed var(--line-strong); border-radius: var(--r-sm); }
.sprint-sum { display: inline-flex; gap: 6px; }
.quick-add { display: flex; gap: 8px; padding: 0 10px 12px; }
.quick-add .input { flex: 1; }

/* Calendrier */
.cal-head { display: flex; align-items: center; gap: 8px; padding: 12px 16px; border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.cal-head h3 { font-size: 19px; min-width: 150px; text-transform: capitalize; }
.cal-grid { display: grid; grid-template-columns: repeat(7, minmax(0, 1fr)); }
.cal-dow { padding: 8px 6px; text-align: center; font-size: 12.5px; font-weight: 700; color: var(--ink-3); border-bottom: 1px solid var(--line); background: var(--surface-2); }
.cal-cell { min-height: 108px; padding: 5px; border-right: 1px solid var(--line); border-bottom: 1px solid var(--line); display: flex; flex-direction: column; gap: 3px; min-width: 0; background: var(--surface); }
.cal-cell:nth-child(7n) { border-right: 0; }
.cal-cell.out { background: var(--surface-2); }
.cal-cell.out .cal-num { color: var(--ink-3); opacity: .6; }
.cal-num { font-size: 12.5px; font-weight: 700; width: 24px; height: 24px; display: grid; place-items: center; border-radius: 12px; }
.cal-cell.today .cal-num { background: var(--primary); color: var(--primary-ink); }
.cal-ev { display: block; width: 100%; text-align: left; border: 0; padding: 2px 6px; border-radius: 4px; font-size: 12px; font-weight: 600; background: var(--info-soft); color: var(--info-ink); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; border-left: 3px solid var(--c, var(--ocean)); }
.cal-ev.done { background: var(--ok-soft); color: var(--ok); text-decoration: line-through; }
.cal-ev.overdue { background: var(--danger-soft); color: var(--danger); }
.cal-more { font-size: 11.5px; color: var(--ink-3); font-weight: 700; border: 0; background: transparent; text-align: left; padding: 0 4px; }
.cal-day-list { display: none; padding: 12px 16px 16px; border-top: 1px solid var(--line); }
@media (max-width: 720px) {
  .cal-cell { min-height: 54px; padding: 3px; align-items: center; cursor: pointer; }
  .cal-ev, .cal-more { display: none; }
  .cal-dots { display: flex; gap: 2px; flex-wrap: wrap; justify-content: center; }
  .cal-dots i { width: 6px; height: 6px; border-radius: 3px; background: var(--c, var(--ocean)); }
  .cal-cell.sel { background: var(--primary-soft); }
  .cal-day-list { display: block; }
}
@media (min-width: 721px) { .cal-dots { display: none; } }

/* Chronologie */
.tl-scroll { overflow: auto; max-height: calc(100vh - 220px); position: relative; }
.tl { position: relative; min-width: max-content; }
.tl-row { display: flex; align-items: stretch; border-bottom: 1px solid var(--line); height: 38px; }
.tl-label { position: sticky; left: 0; z-index: 3; width: 230px; flex: none; padding: 0 12px; display: flex; align-items: center; gap: 8px; background: var(--surface); border-right: 1px solid var(--line-strong); font-weight: 600; font-size: 13.5px; cursor: pointer; }
.tl-label span.t { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tl-label:hover { background: var(--surface-2); }
.tl-track { position: relative; flex: none; background-image: linear-gradient(90deg, var(--line) 1px, transparent 1px); }
.tl-head .tl-track { background: var(--surface-2); }
.tl-head .tl-label { background: var(--surface-2); cursor: default; }
.tl-head { height: 54px; position: sticky; top: 0; z-index: 4; }
.tl-month { position: absolute; top: 6px; font-size: 12px; font-weight: 700; color: var(--ink-2); padding-left: 6px; text-transform: capitalize; }
.tl-day { position: absolute; top: 34px; width: 0; font-size: 11px; line-height: 14px; color: var(--ink-3); }
.tl-day span { position: absolute; transform: translateX(-50%); }
.tl-bar { position: absolute; top: 7px; height: 24px; border-radius: 6px; background: var(--c, var(--primary)); color: #fff; font-size: 12px; font-weight: 600; padding: 0 8px; display: flex; align-items: center; white-space: nowrap; overflow: hidden; border: 0; box-shadow: var(--shadow-1); min-width: 14px; }
.tl-bar.done { opacity: .5; }
.tl-today { position: absolute; top: 0; bottom: 0; width: 2px; background: var(--danger); z-index: 2; pointer-events: none; }
.tl-today::before { content: 'Aujourd’hui'; position: absolute; top: 22px; left: 4px; font-size: 10.5px; font-weight: 700; color: var(--danger); background: var(--surface-2); padding: 0 3px; border-radius: 3px; }
@media (max-width: 720px) { .tl-label { width: 130px; } }

/* Table */
.tbl-wrap { overflow-x: auto; }
table.tbl { width: 100%; border-collapse: collapse; font-size: 14px; min-width: 760px; }
.tbl th { position: sticky; top: 0; text-align: left; padding: 9px 12px; background: var(--surface-2); border-bottom: 1px solid var(--line); font-size: 12.5px; font-weight: 700; color: var(--ink-2); white-space: nowrap; user-select: none; cursor: pointer; }
.tbl th:hover { color: var(--ink); }
.tbl td { padding: 9px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl tr.row-link { cursor: pointer; }
.tbl tr.row-link:hover td { background: var(--surface-2); }
.tbl td.t { font-weight: 600; min-width: 220px; }
.tbl .labels { display: flex; flex-wrap: wrap; gap: 3px; }

/* Tableau de bord */
.dash-grid { display: grid; grid-template-columns: repeat(12, minmax(0, 1fr)); gap: 14px; }
.dash-card { grid-column: span 6; padding: 16px; }
.dash-card.w4 { grid-column: span 4; }
.dash-card.w12 { grid-column: span 12; }
.dash-card h3 { font-size: 16px; margin-bottom: 14px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(140px, 1fr)); gap: 14px; margin-bottom: 14px; }
.kpi { padding: 14px 16px; }
.kpi .v { font-family: var(--font-display); font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.kpi .l { color: var(--ink-2); font-size: 13.5px; margin-top: 6px; }
.kpi.bad .v { color: var(--danger); }
.hbar { display: grid; gap: 9px; }
.hbar-row { display: grid; grid-template-columns: minmax(70px, 130px) 1fr 34px; align-items: center; gap: 10px; font-size: 13.5px; }
.hbar-row .n { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; }
.hbar-row .track { height: 14px; border-radius: 7px; background: var(--surface-3); overflow: hidden; }
.hbar-row .fill { display: block; height: 100%; border-radius: 7px; background: var(--c, var(--primary)); min-width: 3px; transition: width .4s ease; }
.hbar-row .v { text-align: right; font-weight: 700; color: var(--ink-2); }
.donut-wrap { display: flex; align-items: center; gap: 20px; flex-wrap: wrap; }
.donut { width: 140px; height: 140px; flex: none; }
.legend { display: grid; gap: 6px; font-size: 13.5px; }
.legend i { display: inline-block; width: 10px; height: 10px; border-radius: 3px; background: var(--c); margin-right: 8px; }
.chart-svg { width: 100%; height: auto; display: block; }
.chart-svg text { font-family: var(--font-body); font-size: 11px; fill: var(--ink-3); }
@media (max-width: 860px) { .dash-card, .dash-card.w4 { grid-column: span 12; } }

/* ---------- Tiroirs (membres, activité, réglages…) ---------- */
.drawer-wrap { position: fixed; inset: 0; z-index: 60; }
.drawer-backdrop { position: absolute; inset: 0; background: rgb(6 20 14 / .45); opacity: 0; transition: opacity .2s; }
.drawer { position: absolute; top: 0; right: 0; bottom: 0; width: min(420px, 100vw); background: var(--surface); box-shadow: var(--shadow-3); display: flex; flex-direction: column; transform: translateX(100%); transition: transform .22s cubic-bezier(.2,.8,.2,1); }
.drawer-wrap.in .drawer-backdrop { opacity: 1; }
.drawer-wrap.in .drawer { transform: none; }
.drawer-head { display: flex; align-items: center; gap: 8px; padding: 14px 16px; border-bottom: 1px solid var(--line); }
.drawer-head h2 { font-size: 19px; flex: 1; }
.drawer-body { flex: 1; overflow-y: auto; padding: 16px; }
.member-row { display: flex; align-items: center; gap: 12px; padding: 8px 0; }
.member-row .who { flex: 1; min-width: 0; }
.member-row .who b { display: block; }
.member-row .who span { font-size: 13px; color: var(--ink-3); }
.member-row select { width: auto; min-height: 32px; padding: 3px 8px; }
.act-item { display: flex; gap: 10px; padding: 9px 0; border-bottom: 1px solid var(--line); font-size: 14px; }
.act-item:last-child { border-bottom: 0; }
.act-item .when { font-size: 12.5px; color: var(--ink-3); }
.bg-grid { display: grid; grid-template-columns: repeat(5, 1fr); gap: 8px; }
.bg-swatch { aspect-ratio: 4/3; border-radius: 8px; border: 2px solid transparent; background: var(--bg-img); position: relative; padding: 0; }
.bg-swatch.on { border-color: var(--ink); }
.bg-swatch.on::after { content: ''; position: absolute; inset: 0; margin: auto; width: 18px; height: 18px; background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2312201a' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m5 12.5 4.5 4.5L19 7.5'/%3E%3C/svg%3E") center/70% no-repeat; border-radius: 50%; }
.settings-section { margin-bottom: 26px; }
.settings-section h3 { font-size: 15.5px; margin-bottom: 10px; }

.ai-cards { max-height: 260px; overflow-y: auto; border: 1px solid var(--line); border-radius: var(--r-md); padding: 4px 10px; }
.ai-card-row { display: flex; align-items: flex-start; gap: 9px; padding: 7px 0; border-bottom: 1px solid var(--line); }
.ai-card-row:last-child { border-bottom: 0; }
.ai-card-check { width: 17px; height: 17px; flex: none; margin-top: 7px; accent-color: var(--primary); }

/* ---------- Assistant IA : habillage dédié ---------- */
.ai-head { display: flex; align-items: center; gap: 14px; margin-bottom: 4px; }
.ai-badge {
  width: 46px; height: 46px; border-radius: 14px; flex: none; display: grid; place-items: center; color: #fff;
  background: linear-gradient(135deg, #0b6b52 0%, #14b89a 55%, #f7c948 130%); box-shadow: 0 4px 14px rgb(11 107 82 / .35);
}
.ai-head h2 { margin: 0; font-size: 20px; }
.ai-head p { margin: 2px 0 0; color: var(--ink-2); font-size: 13.5px; }

.ai-dropzone {
  display: flex; align-items: center; gap: 12px; width: 100%; padding: 14px 16px; border-radius: var(--r-md);
  border: 1.5px dashed var(--line-strong); background: var(--surface-2); cursor: pointer; text-align: left; transition: border-color .12s, background .12s;
}
.ai-dropzone:hover, .ai-dropzone.drag { border-color: var(--primary); background: var(--primary-soft); }
.ai-dropzone .ai-dz-ic { width: 36px; height: 36px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--surface-3); color: var(--primary); }
.ai-dropzone .nm { font-weight: 700; font-size: 13.5px; }
.ai-dropzone .sub { color: var(--ink-3); font-size: 12.5px; }

.ai-selfmind {
  display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1.5px solid var(--line);
  cursor: pointer; transition: border-color .12s, background .12s;
}
.ai-selfmind:has(input:checked) { border-color: var(--primary); background: var(--primary-soft); }
.ai-selfmind input { width: 17px; height: 17px; flex: none; accent-color: var(--primary); }
.ai-selfmind .ic-wrap { width: 34px; height: 34px; border-radius: 10px; flex: none; display: grid; place-items: center; background: var(--warn-soft); color: #9a6b00; }

.ai-loading { text-align: center; padding: 48px 24px 40px; }
.ai-loading .ai-badge { margin: 0 auto 20px; animation: ai-pulse 1.6s ease-in-out infinite; }
@keyframes ai-pulse { 0%, 100% { transform: scale(1); box-shadow: 0 4px 14px rgb(11 107 82 / .35); } 50% { transform: scale(1.08); box-shadow: 0 6px 22px rgb(11 107 82 / .5); } }
.ai-loading h3 { margin: 0 0 6px; font-size: 16.5px; min-height: 22px; }
.ai-loading p { margin: 0; color: var(--ink-3); font-size: 13px; }
.ai-progress { width: 100%; max-width: 260px; height: 6px; border-radius: 3px; background: var(--surface-3); overflow: hidden; margin: 18px auto 16px; }
.ai-progress i { display: block; width: 40%; height: 100%; border-radius: 3px; background: linear-gradient(90deg, #0b6b52, #14b89a); animation: ai-indeterminate 1.3s ease-in-out infinite; }
@keyframes ai-indeterminate { 0% { margin-left: -40%; } 100% { margin-left: 100%; } }

.ai-dup-warn { text-align: center; padding: 28px 10px 10px; }
.ai-dup-warn .ic-wrap { width: 52px; height: 52px; border-radius: 50%; margin: 0 auto 14px; display: grid; place-items: center; background: var(--warn-soft); color: #9a6b00; }
.rule { display: flex; align-items: flex-start; gap: 10px; padding: 10px 12px; border: 1px solid var(--line); border-radius: var(--r-md); margin-bottom: 8px; background: var(--surface-2); }
.rule.off { opacity: .55; }
.rule .txt { flex: 1; min-width: 0; font-size: 14px; }
.rule .txt b { display: block; }
.seg { display: inline-flex; border: 1px solid var(--line-strong); border-radius: var(--r-sm); overflow: hidden; }
.seg button { border: 0; background: var(--surface); padding: 6px 14px; font-weight: 600; font-size: 13.5px; }
.seg button + button { border-left: 1px solid var(--line-strong); }
.seg button.on { background: var(--primary); color: var(--primary-ink); }

/* ---------- Fenêtres modales ---------- */
.modal-wrap { position: fixed; inset: 0; z-index: 80; display: flex; align-items: flex-start; justify-content: center; padding: 4vh 12px; overflow-y: auto; opacity: 0; transition: opacity .16s; }
.modal-wrap.in { opacity: 1; }
.modal-backdrop { position: fixed; inset: 0; background: rgb(6 20 14 / .6); }
.modal { position: relative; width: 100%; max-width: 780px; background: var(--surface); border-radius: var(--r-lg); box-shadow: var(--shadow-3); margin: auto 0; transform: translateY(10px) scale(.985); transition: transform .18s cubic-bezier(.2,.8,.2,1); }
.modal-wrap.in .modal { transform: none; }
.modal-sm { max-width: 440px; }
.modal-md { max-width: 560px; }
.modal-lg { max-width: 940px; }
.dialog { padding: 22px; }
.dialog h2 { font-size: 21px; margin-bottom: 10px; }
.dialog p { color: var(--ink-2); margin-bottom: 14px; }
.dialog-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 8px; flex-wrap: wrap; }
.modal-close { position: absolute; top: 10px; right: 10px; z-index: 3; }
.theme-pick { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
@media (max-width: 720px) {
  .modal-wrap { padding: 0; align-items: flex-end; }
  .modal { border-radius: 18px 18px 0 0; margin: 0; max-height: 94dvh; overflow-y: auto; }
  .modal-sm { border-radius: 18px 18px 0 0; }
}

/* ---------- Fenêtre de carte ---------- */
.cd-cover { height: 72px; border-radius: var(--r-lg) var(--r-lg) 0 0; background: var(--c, var(--primary)); }
.cd-cover.img { height: 170px; background-size: cover; background-position: center; }
.cd { display: grid; grid-template-columns: minmax(0, 1fr) 200px; gap: 22px; padding: 22px; }
.cd-main { min-width: 0; }
.cd-side { display: grid; gap: 6px; align-content: start; }
.cd-side h4 { font-family: var(--font-body); font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin: 10px 0 2px; }
.side-btn { display: flex; align-items: center; gap: 9px; width: 100%; min-height: 34px; padding: 0 11px; border: 0; border-radius: var(--r-sm); background: var(--surface-3); color: var(--ink); font-weight: 600; font-size: 13.5px; text-align: left; text-decoration: none; }
.side-btn:hover { background: var(--line); }
.side-btn.danger:hover { background: var(--danger-soft); color: var(--danger); }
.cd-title { width: 100%; font-family: var(--font-display); font-weight: 800; font-size: 24px; letter-spacing: -0.02em; border: 2px solid transparent; background: transparent; padding: 4px 8px; margin: -4px -8px 4px; border-radius: var(--r-sm); resize: none; overflow: hidden; line-height: 1.2; }
.cd-title:hover { background: var(--surface-2); }
.cd-title:focus { outline: none; background: var(--surface); border-color: var(--focus); }
.cd-inlist { color: var(--ink-3); font-size: 13.5px; margin-bottom: 16px; }
.cd-inlist b { color: var(--ink-2); }
.cd-facts { display: flex; flex-wrap: wrap; gap: 18px; margin-bottom: 18px; }
.fact h5 { margin: 0 0 5px; font-family: var(--font-body); font-size: 12px; font-weight: 700; color: var(--ink-3); }
.fact .vals { display: flex; flex-wrap: wrap; gap: 5px; align-items: center; }
.fact .plus { width: 28px; height: 28px; border-radius: 50%; border: 0; background: var(--surface-3); display: inline-grid; place-items: center; }
.fact .plus:hover { background: var(--line); }
.cd-sec { margin-bottom: 22px; }
.cd-sec-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.cd-sec-head h3 { font-size: 17px; font-weight: 700; flex: 1; }
.cd-desc { padding: 10px 12px; border-radius: var(--r-md); background: var(--surface-2); min-height: 56px; cursor: text; overflow-wrap: anywhere; }
.cd-desc.empty-d { color: var(--ink-3); }
.progress-line { display: flex; align-items: center; gap: 10px; font-size: 12.5px; font-weight: 700; color: var(--ink-3); margin-bottom: 8px; }
.progress-line .pbar { flex: 1; height: 7px; background: var(--surface-3); border-radius: 4px; overflow: hidden; }
.progress-line .pbar i { display: block; height: 100%; background: var(--primary); transition: width .25s; }
.progress-line .pbar.full i { background: var(--ok); }
.cl { margin-bottom: 18px; }
.cl-head { display: flex; align-items: center; gap: 8px; margin-bottom: 6px; }
.cl-head h4 { flex: 1; font-size: 15px; }
.cl-item { display: flex; align-items: flex-start; gap: 10px; padding: 6px 4px; border-radius: 6px; }
.cl-item:hover { background: var(--surface-2); }
.cl-item input[type=checkbox] { width: 17px; height: 17px; margin-top: 2px; accent-color: var(--primary); flex: none; }
.cl-item .tx { flex: 1; min-width: 0; overflow-wrap: anywhere; cursor: text; }
.cl-item.done .tx { color: var(--ink-3); text-decoration: line-through; }
.cl-item .tools { display: inline-flex; align-items: center; gap: 4px; opacity: 0; }
.cl-item:hover .tools, .cl-item:focus-within .tools { opacity: 1; }
@media (hover: none) { .cl-item .tools { opacity: 1; } }
.cl-item .tools .icon-btn { width: 28px; height: 28px; }
.comment { display: flex; gap: 11px; margin-bottom: 14px; }
.comment .bubble { flex: 1; min-width: 0; }
.comment .by { font-size: 13.5px; margin-bottom: 3px; }
.comment .by b { margin-right: 6px; }
.comment .by span { color: var(--ink-3); font-size: 12.5px; }
.comment .txt { padding: 9px 12px; border-radius: 4px 12px 12px 12px; background: var(--surface-2); border: 1px solid var(--line); overflow-wrap: anywhere; }
.comment .tools { margin-top: 3px; font-size: 12.5px; }
.comment .tools button { border: 0; background: transparent; color: var(--ink-3); text-decoration: underline; padding: 0 6px 0 0; font-size: 12.5px; }
.mention { background: var(--info-soft); color: var(--info-ink); border-radius: 4px; padding: 0 3px; font-weight: 600; }
.bullet::before { content: '•'; margin-right: 8px; color: var(--ink-3); }
.bullet { display: inline-block; }
.att { display: flex; align-items: center; gap: 12px; padding: 8px; border-radius: var(--r-sm); }
.att:hover { background: var(--surface-2); }
.att-thumb { width: 64px; height: 46px; border-radius: 6px; background: var(--surface-3); display: grid; place-items: center; color: var(--ink-3); flex: none; overflow: hidden; background-size: cover; background-position: center; }
.att .nm { font-weight: 600; overflow-wrap: anywhere; }
.att .sub { font-size: 12.5px; color: var(--ink-3); }
.field-val { display: grid; gap: 4px; }
.cd-activity { font-size: 13.5px; color: var(--ink-2); }
.cd-activity .a { display: flex; gap: 8px; padding: 5px 0; align-items: flex-start; }
.cd-activity .a .when { color: var(--ink-3); font-size: 12px; }
@media (max-width: 720px) {
  .cd { grid-template-columns: 1fr; padding: 16px; gap: 16px; }
  .cd-side { grid-template-columns: 1fr 1fr; }
  .cd-side h4 { grid-column: 1 / -1; }
  .cd-title { font-size: 21px; }
}

/* ---------- Fenêtres flottantes ---------- */
.popover { position: fixed; z-index: 100; width: 300px; max-width: calc(100vw - 16px); background: var(--surface); border: 1px solid var(--line-strong); border-radius: var(--r-md); box-shadow: var(--shadow-2); padding: 10px; opacity: 0; transform: translateY(-4px); transition: opacity .12s, transform .12s; max-height: 78vh; overflow-y: auto; }
.popover.in { opacity: 1; transform: none; }
.popover.wide { width: 360px; }
.popover h4 { font-family: var(--font-body); font-size: 13px; text-align: center; color: var(--ink-2); margin: 2px 0 10px; font-weight: 700; }
.menu { display: grid; gap: 1px; }
.menu button, .menu a { display: flex; align-items: center; gap: 10px; width: 100%; padding: 8px 10px; border: 0; background: transparent; border-radius: 6px; text-align: left; color: var(--ink); text-decoration: none; font-size: 14px; font-weight: 500; }
.menu button:hover, .menu a:hover { background: var(--surface-3); }
.menu .danger { color: var(--danger); }
.menu hr { border: 0; border-top: 1px solid var(--line); margin: 5px 0; }
.opt { display: flex; align-items: center; gap: 10px; padding: 6px 4px; width: 100%; border: 0; background: transparent; border-radius: 6px; text-align: left; }
.opt:hover { background: var(--surface-3); }
.opt .sw { flex: 1; min-width: 0; height: 30px; border-radius: 5px; background: var(--c); color: #fff; font-weight: 600; font-size: 13.5px; padding: 0 10px; display: flex; align-items: center; overflow: hidden; white-space: nowrap; text-overflow: ellipsis; }
.opt .ck { width: 18px; color: var(--ink); display: inline-flex; }
.opt.person { padding: 6px 8px; }
.opt.person .nm { flex: 1; font-weight: 600; font-size: 14px; }
.color-grid { display: grid; grid-template-columns: repeat(6, 1fr); gap: 6px; margin: 8px 0; }
.color-grid button { aspect-ratio: 1; border-radius: 6px; border: 2px solid transparent; background: var(--c); }
.color-grid button.on { border-color: var(--ink); }
.notif { display: flex; gap: 10px; padding: 10px; border-radius: var(--r-sm); width: 100%; text-align: left; border: 0; background: transparent; }
.notif:hover { background: var(--surface-3); }
.notif.unread { background: var(--primary-soft); }
.notif .tx { font-size: 13.5px; line-height: 1.35; }
.notif .tx small { display: block; color: var(--ink-3); margin-top: 2px; }
.notif .dot { width: 8px; height: 8px; border-radius: 4px; background: var(--primary); margin-top: 6px; flex: none; }
.notif.read .dot { visibility: hidden; }
.mini-cal { width: 100%; }
.mini-cal .nav { display: flex; align-items: center; justify-content: space-between; margin-bottom: 6px; }
.mini-cal .nav b { text-transform: capitalize; font-family: var(--font-display); }
.mc-grid { display: grid; grid-template-columns: repeat(7, 1fr); gap: 2px; text-align: center; }
.mc-grid .dow { font-size: 11px; font-weight: 700; color: var(--ink-3); padding: 3px 0; }
.mc-grid button { height: 32px; border: 0; background: transparent; border-radius: 16px; font-size: 13px; }
.mc-grid button:hover { background: var(--surface-3); }
.mc-grid button.out { color: var(--ink-3); opacity: .55; }
.mc-grid button.today { font-weight: 800; color: var(--primary); }
.mc-grid button.sel { background: var(--primary); color: var(--primary-ink); }

/* ---------- Administration ---------- */
.admin-layout { display: grid; grid-template-columns: 220px minmax(0, 1fr); gap: 22px; align-items: start; }
.admin-nav { display: grid; gap: 3px; position: sticky; top: 76px; }
.admin-nav button { display: flex; align-items: center; gap: 10px; padding: 10px 12px; border: 0; border-radius: var(--r-sm); background: transparent; font-weight: 600; text-align: left; color: var(--ink-2); }
.admin-nav button:hover { background: var(--surface-3); }
.admin-nav button.on { background: var(--primary); color: var(--primary-ink); }
.card-box { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 20px; box-shadow: var(--shadow-1); }
.card-box + .card-box { margin-top: 16px; }
.card-box h2 { font-size: 20px; margin-bottom: 4px; }
.card-box > .sub { color: var(--ink-2); margin-bottom: 16px; }
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(130px, 1fr)); gap: 12px; }
.stat { padding: 14px; border-radius: var(--r-md); background: var(--surface-2); border: 1px solid var(--line); }
.stat b { font-family: var(--font-display); font-size: 28px; font-weight: 800; display: block; letter-spacing: -0.02em; }
.stat span { font-size: 13px; color: var(--ink-2); }
.driver-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr)); gap: 12px; }
.driver { text-align: left; padding: 14px; border-radius: var(--r-md); border: 2px solid var(--line); background: var(--surface); display: grid; gap: 6px; position: relative; }
.driver:hover { border-color: var(--line-strong); }
.driver.on { border-color: var(--primary); background: var(--primary-soft); }
.driver.sel { border-color: var(--focus); box-shadow: 0 0 0 3px color-mix(in srgb, var(--focus) 25%, transparent); }
.driver b { font-family: var(--font-display); font-size: 17px; }
.driver span { font-size: 13px; color: var(--ink-2); }
.driver .tag { position: absolute; top: 10px; right: 10px; }
.export-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(210px, 1fr)); gap: 10px; }
.export-btn { display: flex; align-items: center; gap: 12px; padding: 12px 14px; border-radius: var(--r-md); border: 1px solid var(--line-strong); background: var(--surface); text-align: left; text-decoration: none; color: inherit; }
.export-btn:hover { border-color: var(--primary); background: var(--primary-soft); }
.export-btn b { display: block; font-size: 14.5px; }
.export-btn span { font-size: 12.5px; color: var(--ink-3); }
.export-btn .ic { width: 22px; height: 22px; color: var(--primary); }
.tbl-simple { width: 100%; border-collapse: collapse; font-size: 14px; }
.tbl-simple th { text-align: left; font-size: 12.5px; color: var(--ink-3); padding: 8px 10px; border-bottom: 1px solid var(--line); }
.tbl-simple td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.tbl-simple tr:last-child td { border-bottom: 0; }
.scroll-x { overflow-x: auto; }
.stepper { display: grid; gap: 14px; }
.kv { display: grid; grid-template-columns: 150px 1fr; gap: 6px 14px; font-size: 14px; }
.kv dt { color: var(--ink-3); }
.kv dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 860px) {
  .admin-layout { grid-template-columns: 1fr; }
  .admin-nav { position: static; display: flex; overflow-x: auto; padding-bottom: 4px; }
  .admin-nav button { white-space: nowrap; }
  .kv { grid-template-columns: 1fr; }
}

/* ---------- Divers ---------- */
#toasts { position: fixed; bottom: 16px; left: 50%; transform: translateX(-50%); z-index: 200; display: grid; gap: 8px; justify-items: center; width: calc(100vw - 24px); max-width: 440px; pointer-events: none; }
.toast { display: flex; align-items: center; gap: 10px; padding: 11px 16px; border-radius: 10px; background: #12201a; color: #fff; box-shadow: var(--shadow-2); font-size: 14px; font-weight: 500; opacity: 0; transform: translateY(10px); transition: all .22s; pointer-events: auto; }
.toast.in { opacity: 1; transform: none; }
.toast.error { background: #8c241d; }
.toast.success .ic { color: #7ce2ae; }
:root[data-theme='dark'] .toast { background: #e7efea; color: #12201a; }
:root[data-theme='dark'] .toast.error { background: #f0746b; color: #2a0805; }
.loading { display: grid; place-items: center; min-height: 40vh; color: var(--ink-3); }
.spinner { width: 26px; height: 26px; border-radius: 50%; border: 3px solid var(--line-strong); border-top-color: var(--primary); animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.live-dot { width: 8px; height: 8px; border-radius: 4px; background: #7ce2ae; display: inline-block; box-shadow: 0 0 0 0 rgb(124 226 174 / .7); animation: live 2.2s infinite; }
@keyframes live { 70% { box-shadow: 0 0 0 7px rgb(124 226 174 / 0); } 100% { box-shadow: 0 0 0 0 rgb(124 226 174 / 0); } }
.offline-banner { background: var(--warn-soft); color: var(--warn-ink); text-align: center; padding: 6px 12px; font-size: 13.5px; font-weight: 600; }

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .001ms !important; animation-iteration-count: 1 !important; transition-duration: .001ms !important; scroll-behavior: auto !important; }
}
@media print {
  .topbar, .board-bar, .filter-bar, #toasts { display: none !important; }
}

/* Coque : tableau plein écran */
.main { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.shell.fixed { height: 100vh; height: 100dvh; overflow: hidden; }
.shell.fixed .main { overflow: hidden; }

/* Barre du tableau : libellés réduits en icônes quand la place manque */
@media (max-width: 1500px) { .lbl-d { display: none; } }
.board-bar .grow { min-width: 0; }

/* Les panneaux enfants d'une grille ne reçoivent pas la marge verticale des panneaux empilés */
.kpis .panel + .panel, .dash-grid .panel + .panel { margin-top: 0; }
