/* Supaflaire admin — feuille unique. Jetons : design/stitch/DESIGN.md (« Supaflaire Studio », 006).
   Aucune couleur hors des deux blocs de jetons ci-dessous (sombre = défaut, clair = dérivé). */

/* ── 1. Jetons ─────────────────────────────────────────────────────────────── */
:root {
  color-scheme: dark;
  /* surfaces, par ton (Level 0 → 3) */
  --color-bg: #0B0F17;
  --color-surface-1: #131B2A;
  --color-surface: #161F33;
  --color-surface-2: #1E293B;
  --color-surface-raised: #1E293B;
  --color-surface-active: #26334D;
  --color-border: #2A374A;
  --color-border-focus: #7C3AED;
  --border-accent: rgba(124, 58, 237, .35);
  /* texte */
  --color-text-primary: #F8FAFC;
  --color-text-secondary: #CBD5E1;
  --color-text-muted: #94A3B8;
  /* accent et sémantiques */
  --color-accent: #A78BFA;
  --color-accent-strong: #7C3AED;
  --color-accent-hover: #8B5CF6;
  --color-success: #10B981; --tint-success: rgba(16, 185, 129, .12); --on-tint-success: #34D399;
  --color-warning: #F59E0B; --tint-warning: rgba(245, 158, 11, .12); --on-tint-warning: #FBBF24;
  --color-danger: #EF4444; --tint-danger: rgba(239, 68, 68, .12); --on-tint-danger: #F87171;
  --color-info: #38BDF8; --tint-info: rgba(56, 189, 248, .12); --on-tint-info: #7DD3FC;
  --tint-accent: rgba(124, 58, 237, .16); --on-tint-accent: #C4B5FD;
  --tint-muted: rgba(148, 163, 184, .14);
  --color-on-warning: #1A0D02;
  --color-on-accent: #FFFFFF;
  /* élévation */
  --shadow: 0 4px 16px rgba(0, 0, 0, .24);
  --shadow-card: 0 4px 20px -2px rgba(0, 0, 0, .45);
  --shadow-brand: 0 2px 6px rgba(124, 58, 237, .35);
  --halo-accent: rgba(124, 58, 237, .14);
  /* typographie */
  --font-ui: Manrope, Inter, system-ui, sans-serif;
  --font-mono: "JetBrains Mono", ui-monospace, SFMono-Regular, monospace;
  --fs-xl: 32px; --lh-xl: 40px;
  --fs-lg: 24px; --lh-lg: 32px;
  --fs-md: 18px; --lh-md: 26px;
  --fs-body: 14px; --lh-body: 22px;
  --fs-sm: 13px; --lh-sm: 18px;
  --fs-label: 13px; --lh-label: 18px;
  --fs-label-sm: 11px; --lh-label-sm: 16px;
  --fs-code: 12px; --lh-code: 18px;
  /* rythme 4 pt, rayons, dimensions */
  --space-1: 4px; --space-2: 8px; --space-3: 12px; --space-4: 16px; --space-5: 20px;
  --space-6: 24px; --space-8: 32px; --space-10: 40px; --space-12: 48px; --space-16: 64px;
  --radius-xs: 4px; --radius-sm: 8px; --radius-md: 12px; --radius-lg: 16px; --radius-pill: 999px;
  --sidebar-width: 240px;
  --reading-width: 960px;
  --bottom-nav-h: calc(56px + env(safe-area-inset-bottom));
  --page-pad: 32px;
  --control-h: 40px;
  /* mouvement */
  --motion-fast: 150ms; --motion-normal: 200ms; --motion-slow: 300ms;
  --ease-enter: cubic-bezier(.2, 0, 0, 1); --ease-exit: ease-in;
}
[data-theme="light"] {
  color-scheme: light;
  --color-bg: #F6F7FB;
  --color-surface-1: #FFFFFF;
  --color-surface: #F1F3F8;
  --color-surface-2: #E9ECF4;
  --color-surface-raised: #E9ECF4;
  --color-surface-active: #DDE3F0;
  --color-border: #D3D9E6;
  --color-border-focus: #6D28D9;
  --border-accent: rgba(109, 40, 217, .35);
  --color-text-primary: #0F172A;
  --color-text-secondary: #334155;
  --color-text-muted: #526176; /* dérivé #64748B relevé : ≥ 4,5:1 sur chaque surface claire (axe) */
  --color-accent: #6D28D9;
  --color-accent-strong: #6D28D9;
  --color-accent-hover: #5B21B6;
  --color-success: #047857; --tint-success: rgba(4, 120, 87, .12); --on-tint-success: #065F46;
  --color-warning: #B45309; --tint-warning: rgba(180, 83, 9, .12); --on-tint-warning: #92400E;
  --color-danger: #B91C1C; --tint-danger: rgba(185, 28, 28, .12); --on-tint-danger: #991B1B;
  --color-info: #0369A1; --tint-info: rgba(3, 105, 161, .12); --on-tint-info: #075985;
  --tint-accent: rgba(109, 40, 217, .12); --on-tint-accent: #5B21B6;
  --tint-muted: rgba(100, 116, 139, .12);
  --color-on-warning: #FFFFFF;
  --shadow: 0 4px 16px rgba(15, 23, 42, .08);
  --shadow-card: 0 4px 20px -2px rgba(15, 23, 42, .12);
  --shadow-brand: 0 2px 6px rgba(109, 40, 217, .25);
  --halo-accent: rgba(109, 40, 217, .08);
}
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: .01ms !important; animation-iteration-count: 1 !important; transition-duration: .01ms !important; scroll-behavior: auto !important; }
}

/* ── 2. Base ───────────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body { font-family: var(--font-ui); font-size: var(--fs-body); line-height: var(--lh-body); color: var(--color-text-primary); background: var(--color-bg); -webkit-font-smoothing: antialiased; text-rendering: optimizeLegibility; }
a { color: var(--color-accent); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3, p { margin: 0; }
h1 { font-size: var(--fs-xl); line-height: var(--lh-xl); font-weight: 700; letter-spacing: -.02em; text-wrap: balance; }
h2 { font-size: var(--fs-lg); line-height: var(--lh-lg); font-weight: 700; letter-spacing: -.015em; }
h3 { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; letter-spacing: -.01em; }
code, pre, .mono, .hash, .path, .cmd { font-family: var(--font-mono); font-variant-numeric: tabular-nums; }
code { font-size: var(--fs-code); line-height: var(--lh-code); font-weight: 500; }
pre { margin: 0; white-space: pre-wrap; word-break: break-word; font-size: var(--fs-code); line-height: var(--lh-code); }
button, input, select, textarea { font: inherit; color: inherit; }
*:focus-visible { outline: 2px solid var(--color-border-focus); outline-offset: 2px; }
.small { font-size: var(--fs-sm); line-height: var(--lh-sm); }
.muted { color: var(--color-text-muted); }
.secondary { color: var(--color-text-secondary); }
.num { font-variant-numeric: tabular-nums; }
.eyebrow { font-size: var(--fs-label-sm); line-height: var(--lh-label-sm); font-weight: 600; letter-spacing: .06em; text-transform: uppercase; color: var(--color-text-muted); }
.eyebrow-mono { letter-spacing: .08em; }
.visually-hidden, .sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }
.tone-success { color: var(--color-success); }
.tone-warning { color: var(--color-warning); }
.tone-danger { color: var(--on-tint-danger); } /* texte : la teinte « on-tint » tient 4,5:1 sur les surfaces ; le rouge plein sert aux pastilles et bordures */
.tone-accent { color: var(--color-accent); }
.tone-muted { color: var(--color-text-muted); }

/* ── 3. Composants communs ─────────────────────────────────────────────────── */
.dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; flex: none; display: inline-block; box-shadow: 0 0 0 3px var(--tint-muted); }
.dot.tone-success { box-shadow: 0 0 0 3px var(--tint-success); }
.dot.tone-warning { box-shadow: 0 0 0 3px var(--tint-warning); }
.dot.tone-danger { box-shadow: 0 0 0 3px var(--tint-danger); }
.dot.tone-accent { box-shadow: 0 0 0 3px var(--tint-accent); }
.dot-square { border-radius: 2px; box-shadow: none !important; }
.badge, .pill { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px; min-height: 20px; border-radius: var(--radius-pill); font-size: var(--fs-label-sm); line-height: var(--lh-label-sm); font-weight: 600; letter-spacing: .02em; background: var(--tint-muted); color: var(--color-text-secondary); white-space: nowrap; }
.badge .dot { width: 6px; height: 6px; box-shadow: none; }
.badge.tone-success { background: var(--tint-success); color: var(--on-tint-success); }
.badge.tone-warning { background: var(--tint-warning); color: var(--on-tint-warning); }
.badge.tone-danger { background: var(--tint-danger); color: var(--on-tint-danger); }
.badge.tone-accent { background: var(--tint-accent); color: var(--on-tint-accent); }
.chip { display: inline-block; padding: 1px 7px; border-radius: var(--radius-xs); background: var(--color-surface-raised); color: var(--color-text-secondary); font-size: var(--fs-label-sm); line-height: var(--lh-label-sm); font-weight: 600; letter-spacing: .02em; }
.card { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.card-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); }
.card-title { font-size: var(--fs-md); line-height: var(--lh-md); font-weight: 600; letter-spacing: -.01em; }
details.card { display: block; padding: 0; }
details.card > summary { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) var(--space-4); cursor: pointer; list-style: none; border-radius: var(--radius-md); }
details.card > summary::-webkit-details-marker { display: none; }
details.card > summary::after { content: "▾"; color: var(--color-text-muted); font-size: var(--fs-sm); transition: transform var(--motion-fast); }
details.card[open] > summary::after { transform: rotate(180deg); }
details.card[open] > summary { border-bottom: 1px solid var(--color-border); border-radius: var(--radius-md) var(--radius-md) 0 0; }
details.card > summary:hover { background: var(--color-surface-raised); }
.flat-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; }
.flat-list > li { border-bottom: 1px solid var(--color-border); }
.flat-list > li:last-child { border-bottom: 0; }
.panel { background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; min-width: 0; }
.panel-head { display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); min-height: 48px; }
.panel-head .muted, .card-head .muted { color: var(--color-text-secondary); }
.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: var(--space-4); align-items: start; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: var(--space-4); }
.grid-8-4 { display: grid; grid-template-columns: minmax(0, 2fr) minmax(280px, 1fr); gap: var(--space-4); align-items: start; }
.page--narrow { max-width: var(--reading-width); }
.stack { display: flex; flex-direction: column; gap: var(--space-4); min-width: 0; }
.pills { display: flex; gap: 6px; flex-wrap: wrap; margin: 0; padding: 0; list-style: none; }
a.pill { min-height: 32px; padding: 4px 12px; border: 1px solid var(--color-border); background: transparent; color: var(--color-text-secondary); font-size: var(--fs-sm); letter-spacing: 0; transition: background var(--motion-fast), color var(--motion-fast); }
a.pill.is-active { background: var(--color-surface-active); color: var(--color-text-primary); border-color: var(--color-surface-active); }
a.pill:hover { text-decoration: none; color: var(--color-text-primary); background: var(--color-surface-raised); }
/* Boutons : primaire (violet), secondaire (par défaut : Level 3 + bordure), discret, destructif */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2); min-height: var(--control-h); padding: 0 var(--space-4); border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-surface-raised); color: var(--color-text-primary); font-weight: 600; cursor: pointer; white-space: nowrap; transition: background var(--motion-fast) var(--ease-enter), border-color var(--motion-fast) var(--ease-enter), color var(--motion-fast), transform var(--motion-fast); }
.btn:hover { background: var(--color-surface-active); text-decoration: none; }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .55; cursor: not-allowed; transform: none; }
.btn-secondary { background: var(--color-surface-raised); }
.btn-primary { background: var(--color-accent-strong); border-color: var(--color-accent-strong); color: var(--color-on-accent); }
.btn-primary:hover { background: var(--color-accent-hover); border-color: var(--color-accent-hover); }
.btn-warning { background: var(--color-warning); border-color: var(--color-warning); color: var(--color-on-warning); }
.btn-warning:hover { background: var(--color-warning); border-color: var(--color-warning); filter: brightness(1.06); }
.btn-ghost { background: transparent; border-color: transparent; color: var(--color-accent); }
.btn-ghost:hover { background: var(--tint-accent); }
.btn-danger { background: transparent; border-color: var(--tint-danger); color: var(--on-tint-danger); }
.btn-danger:hover { background: var(--tint-danger); border-color: var(--color-danger); }
.btn-compact { min-height: 32px; padding: 0 var(--space-3); font-size: var(--fs-sm); font-weight: 600; }
.btn-icon { width: 36px; min-height: 36px; padding: 0; }
.btn-block { width: 100%; }
.btn-link { background: none; border: 0; padding: 0; min-height: 44px; color: var(--color-accent); font: inherit; font-weight: 600; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; }
/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field-head { display: flex; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap; }
.field input[type="text"], .field input[type="email"], .field textarea, .invite-row input { min-height: var(--control-h); padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-primary); transition: border-color var(--motion-fast); }
.field input:hover, .field textarea:hover { border-color: var(--color-text-muted); }
.field textarea { resize: vertical; font-family: inherit; }
.field input.is-invalid { border-color: var(--color-danger); }
.field-error { color: var(--on-tint-danger); font-size: var(--fs-sm); }
/* Lignes de liste (services, projets de l'Accueil, tests…) */
.service-row { display: grid; grid-template-columns: 16px minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: 10px var(--space-4); min-height: 48px; }
.service-main { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.service-name { font-weight: 600; }
.service-detail { display: block; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; color: var(--color-text-secondary); }
.service-main code { align-self: flex-start; padding: 1px 6px; border-radius: var(--radius-xs); background: var(--color-bg); border: 1px solid var(--color-border); color: var(--color-text-secondary); }
.project-line { display: grid; grid-template-columns: 16px minmax(0, 1.2fr) minmax(0, 1fr) auto; gap: var(--space-3); align-items: center; padding: 10px var(--space-4); min-height: 48px; color: inherit; transition: background var(--motion-fast); }
.project-line:hover { text-decoration: none; background: var(--color-surface-raised); }
.project-line-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-line-meta, .project-line-count { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.project-line-count { text-align: right; }
.projects-card, .atelier-card { padding: 0; gap: 0; }
.projects-card > .card-head, .atelier-card > .card-title { padding: var(--space-3) var(--space-4); }
.projects-card > .card-head { border-bottom: 1px solid var(--color-border); min-height: 48px; }
.atelier-pills { padding: 0 var(--space-4) var(--space-4); }
.pill-meta { color: var(--color-text-muted); font-weight: 500; }
/* Bandeaux */
.next-step { display: flex; align-items: center; gap: var(--space-4); padding: var(--space-4) var(--space-5); border: 1px solid var(--border-accent); border-left: 3px solid var(--color-accent-strong); background: var(--color-surface-raised); border-radius: var(--radius-md); color: var(--color-text-primary); flex-wrap: wrap; }
.next-step.tone-danger { border-left-color: var(--color-danger); }
.next-step .eyebrow { color: var(--color-accent); }
.next-step.tone-danger .eyebrow { color: var(--on-tint-danger); }
.next-step-main { flex: 1 1 320px; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.next-step-text { font-weight: 600; font-size: 15px; line-height: 22px; text-wrap: pretty; }
.next-step > .btn { flex: none; }
.banner { display: flex; gap: var(--space-4); align-items: flex-start; padding: var(--space-4) var(--space-5); border: 1px solid var(--color-danger); background: var(--tint-danger); border-radius: var(--radius-md); flex-wrap: wrap; color: var(--color-text-primary); }
.banner.tone-warning { border-color: var(--color-warning); background: var(--tint-warning); }
.banner > .dot { margin-top: 7px; }
.banner-main { flex: 1; min-width: 260px; display: flex; flex-direction: column; gap: var(--space-1); }
.banner-title { font-weight: 600; }
.banner .muted { color: var(--color-text-secondary); }
.banner pre, .section-error pre { margin-top: var(--space-2); padding: 10px 12px; background: var(--color-bg); border: 1px solid var(--color-border); border-radius: var(--radius-sm); color: var(--color-text-secondary); max-height: 160px; overflow: auto; }
.empty-state { border: 1px dashed var(--color-border); border-radius: var(--radius-lg); padding: var(--space-12) var(--space-6); display: flex; flex-direction: column; align-items: center; text-align: center; gap: 10px; background: var(--color-surface-1); }
.empty-state h2 { max-width: 520px; text-wrap: balance; }
.empty-state p { max-width: 460px; color: var(--color-text-secondary); }
.live-dot { display: flex; align-items: center; gap: var(--space-2); }
.live-dot .dot { animation: blink 1s infinite; }
@keyframes blink { 0%, 100% { opacity: 1; } 50% { opacity: 0; } }
.section-empty, .section-error { padding: var(--space-4); color: var(--color-text-secondary); }
.section-error { display: flex; gap: var(--space-3); align-items: flex-start; color: var(--color-text-primary); }
.section-error > .dot { margin-top: 7px; }
/* Squelettes : mêmes rayons que les cartes remplacées */
.skeleton-wrap { display: flex; flex-direction: column; gap: var(--space-4); }
.skeleton { animation: shimmer 1.4s infinite; }
.sk-line { height: 10px; border-radius: var(--radius-xs); background: var(--color-surface-raised); }
.w-30 { width: 30%; } .w-40 { width: 40%; } .w-50 { width: 50%; } .w-55 { width: 55%; } .w-60 { width: 60%; } .w-70 { width: 70%; }
@keyframes shimmer { 0% { opacity: .5; } 50% { opacity: 1; } 100% { opacity: .5; } }
/* Toasts */
.toast-root { position: fixed; right: var(--space-4); bottom: var(--space-4); display: flex; flex-direction: column; gap: var(--space-2); max-width: 420px; z-index: 20; }
.toast { background: var(--color-surface-raised); border: 1px solid var(--color-border); border-left: 3px solid var(--color-accent-strong); border-radius: var(--radius-sm); padding: 10px 12px; box-shadow: var(--shadow); display: flex; gap: 10px; align-items: flex-start; animation: toastin var(--motion-slow) var(--ease-enter); }
.toast.tone-warning { border-left-color: var(--color-warning); }
.toast.tone-danger { border-left-color: var(--color-danger); }
.toast .tag { font-size: var(--fs-label-sm); line-height: var(--lh-label-sm); font-weight: 600; letter-spacing: .04em; text-transform: uppercase; color: var(--color-text-muted); flex: none; margin-top: 3px; }
@keyframes toastin { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }

/* ── 4. Coquille (barre latérale 240 px, en-tête mobile, barre inférieure, zone principale) ── */
.root { display: grid; grid-template-columns: var(--sidebar-width) minmax(0, 1fr); min-height: 100vh; }
.sidebar { display: flex; flex-direction: column; background: var(--color-surface-1); border-right: 1px solid var(--color-border); min-height: 0; position: sticky; top: 0; height: 100vh; }
.brand { display: flex; align-items: center; gap: 10px; padding: var(--space-4) var(--space-4) 14px; }
.brand img { width: 35px; height: auto; display: block; filter: drop-shadow(var(--shadow-brand)); }
.brand-text { display: flex; flex-direction: column; }
.brand-name { font-weight: 700; letter-spacing: -.01em; }
.nav { display: flex; flex-direction: column; gap: 2px; padding: 4px 10px 10px; }
.nav-item { position: relative; display: flex; align-items: center; gap: 10px; padding: 0 12px; height: var(--control-h); border-radius: var(--radius-sm); color: var(--color-text-secondary); font-weight: 500; transition: background var(--motion-fast) var(--ease-enter), color var(--motion-fast); }
.nav-item:hover { color: var(--color-text-primary); text-decoration: none; background: var(--color-surface-raised); }
.nav-item.is-active { background: var(--color-surface-raised); color: var(--color-accent); font-weight: 600; }
.nav-item.is-active::before { content: ""; position: absolute; left: 0; top: 10px; bottom: 10px; width: 3px; border-radius: 0 3px 3px 0; background: var(--color-accent-strong); }
.nav-count { margin-left: auto; min-width: 20px; text-align: center; font-size: var(--fs-label-sm); line-height: var(--lh-label-sm); font-weight: 600; color: var(--color-text-muted); font-variant-numeric: tabular-nums; }
.nav-count:not(:empty) { padding: 2px 6px; border-radius: var(--radius-pill); background: var(--tint-muted); }
.nav-item.is-active .nav-count { color: var(--color-accent); background: var(--tint-accent); }
.nav-count:has(.nav-badge) { padding: 0; background: transparent; }
.nav-badge { display: inline-flex; align-items: center; justify-content: center; min-width: 18px; height: 18px; padding: 0 5px; border-radius: var(--radius-pill); background: var(--color-warning); color: var(--color-on-warning); font-weight: 700; font-size: var(--fs-label-sm); line-height: 18px; }
.btn-new { width: calc(100% - 20px); margin: 0 10px 10px; border-style: dashed; background: transparent; font-weight: 500; color: var(--color-text-secondary); }
.btn-new:hover { border-color: var(--color-accent); color: var(--color-accent); background: var(--tint-accent); }
.side-foot { margin-top: auto; padding: var(--space-3) 14px var(--space-4); border-top: 1px solid var(--color-border); display: flex; flex-direction: column; gap: 10px; }
.state-pills { gap: 4px 6px; }
.pill-state { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 6px; border-radius: var(--radius-pill); background: var(--color-surface); border: 1px solid var(--color-border); font-size: var(--fs-label-sm); line-height: var(--lh-label-sm); font-weight: 600; color: var(--color-text-secondary); cursor: default; }
.pill-state .dot { width: 6px; height: 6px; box-shadow: none; }
.pill-state.tone-success .dot { color: var(--color-success); }
.pill-state.tone-warning .dot { color: var(--color-warning); }
.pill-state.tone-danger .dot { color: var(--color-danger); }
.pill-state.tone-muted .dot { color: var(--color-text-muted); }
.btn-theme { display: flex; justify-content: space-between; align-items: center; padding: 6px 10px; min-height: 32px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: transparent; color: var(--color-text-secondary); font-size: var(--fs-sm); font-weight: 500; cursor: pointer; }
.btn-theme span { color: var(--color-text-primary); font-weight: 600; }
.logout { display: flex; flex-direction: column; gap: 6px; }
.main { min-width: 0; min-height: 0; overflow: auto; padding: var(--space-6) var(--page-pad) var(--space-10); display: flex; flex-direction: column; gap: var(--space-6); container-type: inline-size; container-name: main; }
.main.page--narrow { width: 100%; }
.main.page--narrow > * { max-width: var(--reading-width); width: 100%; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; }
.page-head p { margin-top: var(--space-1); color: var(--color-text-secondary); max-width: 68ch; }
.page-head .muted { color: var(--color-text-secondary); }
.head-tools { display: flex; align-items: center; gap: var(--space-2); margin-bottom: var(--space-2); }
.head-action { display: flex; gap: var(--space-2); align-items: center; }
.project-select select { min-height: 32px; padding: 3px 28px 3px 10px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-primary); font-size: var(--fs-sm); font-weight: 600; font-family: var(--font-ui); }
/* Mobile (< 768 px) : en-tête compact + barre inférieure à 5 entrées ; masqués au-dessus (une seule navigation visible). */
.mob-head, .bottom-nav { display: none; }
.mob-head { position: sticky; top: 0; z-index: 9; align-items: center; gap: 10px; padding: 8px var(--space-4) 8px; background: var(--color-surface-1); border-bottom: 1px solid var(--color-border); }
.mob-head img { width: 28px; height: auto; filter: drop-shadow(var(--shadow-brand)); }
.mob-project { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-weight: 600; color: var(--color-text-secondary); }
.mob-head .btn-icon { width: 40px; min-height: 40px; }
.bottom-nav { position: fixed; left: 0; right: 0; bottom: 0; height: var(--bottom-nav-h); padding-bottom: env(safe-area-inset-bottom); background: var(--color-surface-1); border-top: 1px solid var(--color-border); z-index: 10; align-items: stretch; }
.bn-item { position: relative; flex: 1 1 0; min-width: 0; display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px; padding: 6px 2px; color: var(--color-text-muted); font-size: var(--fs-label-sm); line-height: var(--lh-label-sm); font-weight: 600; letter-spacing: .01em; list-style: none; cursor: pointer; transition: color var(--motion-fast); }
.bn-item::-webkit-details-marker { display: none; }
.bn-item::before { content: ""; width: 22px; height: 3px; border-radius: 3px; background: transparent; margin-bottom: 2px; transition: background var(--motion-fast); }
.bn-item.is-active { color: var(--color-accent); }
.bn-item.is-active::before { background: var(--color-accent-strong); }
.bn-item:hover { text-decoration: none; color: var(--color-text-primary); }
.bn-label { white-space: nowrap; }
@media (max-width: 400px) { .bn-item { font-size: 10px; letter-spacing: 0; padding-left: 0; padding-right: 0; } }
.bn-count { position: absolute; top: 4px; right: calc(50% - 22px); }
.bn-count:empty { display: none; }
.bn-count .nav-badge { min-width: 16px; height: 16px; line-height: 16px; font-size: 10px; }
.more-sheet { flex: 1 1 0; min-width: 0; display: flex; }
.more-sheet > summary { width: 100%; }
.more-panel { position: fixed; left: 8px; right: 8px; bottom: calc(var(--bottom-nav-h) + 8px); padding: 6px; background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); display: flex; flex-direction: column; z-index: 11; animation: sheetin var(--motion-normal) var(--ease-enter); }
@keyframes sheetin { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.more-link { display: flex; align-items: center; justify-content: space-between; gap: var(--space-2); min-height: 44px; padding: 0 var(--space-3); border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text-primary); font-weight: 500; text-align: left; cursor: pointer; width: 100%; }
.more-link:hover { background: var(--color-surface-active); text-decoration: none; }
.more-link.is-active { color: var(--color-accent); font-weight: 600; }
.more-link .bn-count:empty { display: none; }
.more-link .bn-count { position: static; }
.more-link [data-theme-label] { color: var(--color-text-secondary); }
.more-logout { display: contents; }
.more-logout .more-link { color: var(--on-tint-danger); }

/* Kanban (research R2) : rail à cliquets par défaut ; 5 colonnes quand la zone principale ≥ 1000 px ; accordéons < 768 px */
.kanban { position: relative; display: grid; grid-auto-flow: column; grid-auto-columns: minmax(240px, 1fr); gap: var(--space-3); align-items: stretch; overflow-x: auto; scroll-snap-type: x mandatory; padding-bottom: var(--space-2); }
.kanban[data-empty] { min-height: 360px; }
@container main (min-width: 1000px) {
  .kanban { grid-auto-flow: row; grid-template-columns: repeat(5, minmax(180px, 1fr)); overflow: visible; }
}
.kanban-col { display: flex; flex-direction: column; gap: 10px; min-width: 0; scroll-snap-align: start; padding: 10px; background: var(--color-surface-1); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.kanban-head { display: flex; align-items: center; gap: var(--space-2); padding: 0 2px; min-height: 24px; list-style: none; pointer-events: none; }
.kanban-head::-webkit-details-marker { display: none; }
.kanban-col-title { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kanban-count { margin-left: auto; }
.kanban-sub { padding: 0 2px; margin-top: -6px; min-height: 16px; }
.kanban-card { padding: 12px; gap: var(--space-2); transition: border-color var(--motion-fast), background var(--motion-fast), box-shadow var(--motion-fast); }
.kanban-card:hover { background: var(--color-surface-raised); box-shadow: var(--shadow-card); }
.kanban-title { font-size: 15px; line-height: 21px; }
.kanban-meta { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.kanban-progress { display: inline-flex; align-items: center; gap: 6px; margin: 0; }
.kanban-progress .dot { width: 6px; height: 6px; box-shadow: none; }
.kanban-foot { display: flex; flex-direction: column; gap: 6px; margin-top: 2px; }
.btn-step { width: 100%; justify-content: space-between; min-height: 36px; padding: 6px 10px; text-align: left; }
.preview-hint { margin: 12px 0 0; }
.kanban-drop { border: 1px dashed var(--color-border); border-radius: var(--radius-sm); min-height: 48px; opacity: .5; }
.kanban-empty { position: absolute; left: 50%; top: 50%; transform: translate(-50%, -50%); width: min(460px, 90%); border-radius: var(--radius-lg); padding: 26px 28px; text-align: center; align-items: center; box-shadow: var(--shadow); z-index: 1; }

/* Tableaux (Mises en ligne, Utilisateurs) : en-têtes label muted, lignes 48 px ; sous 768 px chaque cellule porte son en-tête (data-th) */
.table-wrap, .users-wrap { overflow-x: auto; }
.table, .users { width: 100%; border-collapse: collapse; }
.table th, .users th { text-align: left; padding: var(--space-2) var(--space-4); font-size: var(--fs-label); line-height: var(--lh-label); font-weight: 600; letter-spacing: .01em; color: var(--color-text-muted); border-bottom: 1px solid var(--color-border); white-space: nowrap; }
.table td, .users td { padding: 10px var(--space-4); height: 48px; border-bottom: 1px solid var(--color-border); vertical-align: middle; }
.table tr:last-child td, .users tr:last-child td { border-bottom: 0; }
.table-action, .users-action { text-align: right; white-space: nowrap; }
.deploy-name { display: block; font-weight: 600; }
.deploy-url { max-width: 320px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.deploy-section .panel-head { justify-content: flex-start; }


/* Responsive (coquille) : tablette garde la barre latérale ; < 768 px = en-tête + barre inférieure. */
@media (max-width: 1100px) {
  :root { --page-pad: 24px; }
}
@media (max-width: 1024px) {
  .grid-8-4 { grid-template-columns: minmax(0, 1fr); }
}
@media (max-width: 767px) {
  :root { --page-pad: 16px; --control-h: 44px; --fs-xl: 24px; --lh-xl: 32px; }
  .root { display: flex; flex-direction: column; }
  .sidebar { display: none; }
  .mob-head, .bottom-nav { display: flex; }
  .main { overflow: visible; gap: var(--space-4); padding-top: var(--space-4); padding-bottom: calc(var(--bottom-nav-h) + var(--space-4)); }
  .grid-2, .grid-3 { grid-template-columns: minmax(0, 1fr); }
  .page-head { flex-direction: column; align-items: stretch; }
  .head-action .btn { width: 100%; }
  .main button, .main select { min-height: 44px; }
  .btn-compact { min-height: 44px; }
  .table thead, .users thead { display: none; }
  .table, .table tbody, .table tr, .table td, .users, .users tbody, .users tr, .users td { display: block; }
  .table tr, .users tr { padding: 10px var(--space-4); border-bottom: 1px solid var(--color-border); display: flex; flex-wrap: wrap; gap: 6px 12px; align-items: center; }
  .table td, .users td { padding: 0; border: 0; height: auto; }
  .table td[data-th]::before { content: attr(data-th) " · "; color: var(--color-text-muted); font-size: var(--fs-sm); }
  .table td:first-child, .users-email { flex: 1 1 100%; }
  .table td:first-child::before { display: none; }
  .table-action, .users-action { flex: 1 1 100%; text-align: left; }
  .deploy-url { max-width: 100%; }
  .toast-root { left: 12px; right: 12px; bottom: calc(var(--bottom-nav-h) + 12px); max-width: none; }
  /* Kanban en accordéons : une colonne = un details ; l'en-tête redevient cliquable ; cartes empilées */
  .kanban { display: flex; flex-direction: column; gap: var(--space-2); overflow: visible; scroll-snap-type: none; }
  .kanban[data-empty] { min-height: 0; }
  .kanban-head { pointer-events: auto; cursor: pointer; min-height: 32px; }
  .kanban-head::after { content: "▾"; color: var(--color-text-muted); font-size: var(--fs-sm); margin-left: 4px; transition: transform var(--motion-fast); }
  .kanban-col[open] > .kanban-head::after { transform: rotate(180deg); }
  .kanban-col:not([open]) { gap: 0; }
  .kanban-drop { min-height: 24px; }
  .kanban-empty { position: static; transform: none; width: 100%; margin-top: var(--space-2); }
  .next-step > .btn { width: 100%; }
  .project-line { grid-template-columns: 16px minmax(0, 1fr) auto; row-gap: 2px; }
  .project-line-count { grid-row: 1; grid-column: 3; }
  .project-line-meta { grid-column: 2 / 4; }
}

/* ── 002 : écrans complémentaires ─────────────────────────────────────── */
.chips { display: flex; gap: 6px; flex-wrap: wrap; }
.chip-doc { display: inline-flex; align-items: center; gap: 6px; padding: 2px 8px 2px 2px; border: 1px solid var(--color-border); border-radius: var(--radius-pill); font-size: 12px; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.doc-type { display: inline-flex; align-items: center; justify-content: center; min-width: 30px; height: 22px; padding: 0 6px; border-radius: var(--radius-xs); background: var(--color-surface-raised); font-size: 12px; font-weight: 500; }

/* Projets */
.projects-grid { display: grid; grid-template-columns: minmax(0, 1.4fr) minmax(300px, 1fr); gap: var(--space-3); align-items: start; }
.project-head, .project-row { display: grid; grid-template-columns: minmax(0, 1.6fr) minmax(0, 1fr) minmax(0, .8fr) auto; gap: var(--space-3); align-items: center; padding: 10px var(--space-4); border-bottom: 1px solid var(--color-border); color: inherit; }
.project-head { padding: var(--space-2) var(--space-4); font-weight: 600; }
.sort-link { color: var(--color-text-muted); font-weight: 600; }
.project-row:hover { text-decoration: none; background: var(--color-surface-2); }
.project-row.is-selected { background: var(--color-surface-2); }
.project-main { display: flex; gap: 10px; align-items: center; min-width: 0; }
.project-main > .dot { flex: none; }
.project-row > span { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 1100px) { .projects-grid { grid-template-columns: minmax(0, 1fr); } } /* après la règle de base : la cascade compte */
.sheet { padding: 0; }
.sheet-head { display: flex; justify-content: space-between; gap: var(--space-3); padding: var(--space-4); border-bottom: 1px solid var(--color-border); align-items: flex-start; }
.sheet-dl { display: grid; grid-template-columns: auto minmax(0, 1fr); gap: 8px 16px; margin: 0; padding: var(--space-4); }
.sheet-dl dt { color: var(--color-text-muted); font-size: 12px; line-height: 20px; }
.sheet-dl dd { margin: 0; min-width: 0; overflow-wrap: anywhere; }
.segmented { display: inline-flex; border: 1px solid var(--color-border); border-radius: var(--radius-sm); overflow: hidden; }
.seg { display: inline-flex; align-items: center; gap: 6px; padding: 4px 10px; min-height: 32px; border: 0; background: transparent; color: var(--color-text-muted); cursor: pointer; font-size: 12px; font-weight: 500; }
.seg + .seg { border-left: 1px solid var(--color-border); }
.seg[aria-pressed="true"], .seg:has(input:checked) { background: var(--color-surface-raised); color: var(--color-text-primary); }
.seg input { margin: 0; }
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); padding: 0 var(--space-4) var(--space-4); }
.stat-n { font-size: 24px; line-height: 32px; font-weight: 700; }
.sheet-actions, .panel-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; align-items: center; padding: 0 var(--space-4) var(--space-4); }
.panel-actions { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--color-border); }

/* Nouveau projet */
.wizsteps { list-style: none; margin: 0; padding: 0; display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-3); }
.wiz-step { border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface); }
.wiz-step.state-current { border-color: var(--color-accent); }
.wiz-step.state-done { opacity: .85; }
.wiz-link { display: flex; gap: 10px; align-items: flex-start; padding: 12px 14px; color: inherit; }
a.wiz-link:hover { text-decoration: none; background: var(--color-surface-2); border-radius: var(--radius-md); }
.wiz-num { width: 24px; height: 24px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--color-surface-raised); font-size: 12px; flex: none; }
.state-current .wiz-num { background: var(--color-accent-strong); color: var(--color-on-accent); }
.state-done .wiz-num { background: var(--color-success); color: var(--color-on-accent); }
.wiz-title { font-weight: 600; }
.wiz-form { display: flex; flex-direction: column; gap: var(--space-4); }
.wiz-section { gap: var(--space-5); padding: var(--space-5); }
.tpl-card { position: relative; display: flex; flex-direction: column; gap: 6px; padding: 14px; border: 1px solid var(--color-border); border-radius: var(--radius-md); background: var(--color-surface-2); cursor: pointer; }
.tpl-card input { position: absolute; opacity: 0; width: 1px; height: 1px; }
.tpl-card.is-selected { border-color: var(--color-accent); background: var(--tint-accent); }
.tpl-card.is-selected::after { content: "✓"; position: absolute; top: 10px; right: 12px; color: var(--color-accent); font-weight: 700; }
.tpl-card.is-disabled { opacity: .6; cursor: not-allowed; }
.tpl-card:focus-within { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.tpl-name { font-weight: 600; display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.svc-block { border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 12px 14px 14px; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.svc-block legend { display: inline-flex; gap: 8px; align-items: center; padding: 0 6px; }
.rules-box { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-sm); padding: 10px 12px; display: flex; flex-direction: column; gap: 4px; }
.wiz-foot { display: flex; justify-content: space-between; align-items: center; gap: var(--space-3); flex-wrap: wrap; }
.wiz-foot-right { display: flex; align-items: center; gap: var(--space-3); margin-left: auto; }
.recap-cmd { padding: 12px 14px; background: var(--color-bg); color: var(--color-text-primary); border-radius: var(--radius-sm); font-size: 14px; overflow: auto; }
.recap-steps { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 6px; }

/* Détail */
.feature-head { display: flex; flex-direction: column; gap: var(--space-4); }
.feature-head-row { display: flex; justify-content: space-between; gap: var(--space-4); flex-wrap: wrap; align-items: flex-start; }
.feature-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.crumb { display: inline-block; margin-bottom: 4px; }
.feature-meta { margin-top: var(--space-2); }
/* Frise d'étapes : point + libellé, connecteur 1 px entre les points ; étape en cours en violet, terminée en vert */
.stepper { list-style: none; margin: 0; padding: var(--space-3) var(--space-2); display: grid; grid-template-columns: repeat(5, minmax(0, 1fr)); gap: var(--space-2); background: var(--color-surface-1); border: 1px solid var(--color-border); border-radius: var(--radius-md); }
.step { position: relative; display: flex; flex-direction: column; align-items: center; gap: var(--space-2); min-width: 0; text-align: center; padding: 0 var(--space-1); }
.step:not(:last-child)::after { content: ""; position: absolute; top: 7px; left: calc(50% + 12px); right: calc(-50% + 12px); height: 1px; background: var(--color-border); }
.step.state-done:not(:last-child)::after { background: var(--color-success); }
.step-dot { width: 14px; height: 14px; border-radius: 50%; border: 2px solid var(--color-border); background: var(--color-surface); flex: none; }
.state-done .step-dot { background: var(--color-success); border-color: var(--color-success); }
.state-active .step-dot { background: var(--color-accent-strong); border-color: var(--color-accent-strong); box-shadow: 0 0 0 4px var(--tint-accent); }
.state-next .step-dot { border-color: var(--color-accent); }
.state-active .step-title, .state-next .step-title { color: var(--color-accent); }
.state-todo .step-title { color: var(--color-text-secondary); }
.step-body { min-width: 0; max-width: 100%; }
.step-title { font-weight: 600; font-size: var(--fs-sm); line-height: var(--lh-sm); }
.feature-grid { align-items: start; }
.tabs { display: flex; gap: 4px; }
.tab { padding: 4px 10px; min-height: 32px; display: inline-flex; align-items: center; border-radius: var(--radius-sm); color: var(--color-text-muted); font-weight: 500; }
.tab.is-active { background: var(--color-surface-raised); color: var(--color-text-primary); }
.tab:hover { text-decoration: none; color: var(--color-text-primary); }
.tab-body { padding: var(--space-4); }
.tab-meta { margin-bottom: var(--space-3); }
.md { display: flex; flex-direction: column; gap: 10px; overflow-wrap: anywhere; }
.md h1 { font-size: 20px; line-height: 28px; }
.md h2 { font-size: 16px; line-height: 24px; margin-top: 8px; }
.md h3, .md h4 { font-size: 14px; line-height: 20px; }
.md ul, .md ol { margin: 0; padding-left: 20px; display: flex; flex-direction: column; gap: 4px; }
.md li.task-done, .md li.task-todo { list-style: none; margin-left: -20px; }
.md .task-box { font-family: var(--font-mono); font-size: 12px; margin-right: 4px; }
.md .task-done .task-box { color: var(--color-success); }
.md .task-todo .task-box { color: var(--color-warning); }
.md-code { padding: 10px 12px; background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-sm); font-size: 12px; line-height: 16px; overflow: auto; }
.md code { background: var(--color-surface-2); padding: 1px 4px; border-radius: 3px; }
.md table { border-collapse: collapse; width: 100%; font-size: 12px; }
.md th, .md td { border: 1px solid var(--color-border); padding: 6px 8px; text-align: left; vertical-align: top; }
.md blockquote { margin: 0; padding-left: 12px; border-left: 3px solid var(--color-border); color: var(--color-text-muted); }
.md hr { border: 0; border-top: 1px solid var(--color-border); }
.log-panel { background: var(--color-bg); color: var(--color-text-primary); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.log-head { display: flex; align-items: center; gap: 10px; padding: var(--space-3) var(--space-4); border-bottom: 1px solid var(--color-border); font-weight: 600; }
.log-head .muted { color: var(--color-text-muted); }
.log-body { padding: 10px 14px; display: flex; flex-direction: column; gap: 4px; font-size: 12px; line-height: 18px; max-height: 360px; overflow: auto; }
.log-line { display: grid; grid-template-columns: 82px minmax(0, 1fr); gap: 10px; }
.log-line.muted, .log-body .muted { color: var(--color-text-muted); }
.log-time { color: var(--color-text-muted); }
.test-row { display: flex; gap: 10px; align-items: center; padding: 8px var(--space-4); border-bottom: 1px solid var(--color-border); }
.diff-lines { padding: 10px var(--space-4); overflow: auto; }

/* Documents */
.drop-zone { border: 1px dashed var(--color-border); border-radius: var(--radius-lg); padding: var(--space-4) var(--space-5); display: flex; flex-direction: column; gap: 8px; }
.doc-head, .doc-row { display: grid; grid-template-columns: 40px minmax(0, 1.8fr) auto minmax(0, 1fr) auto auto; gap: var(--space-3); align-items: center; padding: 10px var(--space-4); border-bottom: 1px solid var(--color-border); }
.doc-head { padding: var(--space-2) var(--space-4); font-weight: 600; }
.doc-row:last-child { border-bottom: 0; }
.doc-main { min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* Réglages */
.env-row { display: grid; grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr) auto auto; gap: var(--space-3); align-items: center; padding: 10px var(--space-4); border-bottom: 1px solid var(--color-border); }
.env-row:last-child { border-bottom: 0; }
.rule-row { display: flex; gap: 10px; align-items: baseline; padding: 8px var(--space-4); border-bottom: 1px solid var(--color-border); }
.rule-row:last-child { border-bottom: 0; }
.mcp-card { border: 0; border-radius: 0; background: transparent; }
.mcp-card > summary { padding: var(--space-3) var(--space-4); }
.mcp-card[open] > summary { border-radius: 0; }
.mcp-card .label { font-weight: 600; }
.mcp-json { padding: 12px var(--space-4); max-height: 320px; overflow: auto; background: var(--color-bg); color: var(--color-text-secondary); }

@media (max-width: 767px) {
  .wizsteps { grid-template-columns: minmax(0, 1fr); }
  .stepper { grid-auto-flow: column; grid-template-columns: repeat(5, minmax(120px, 1fr)); overflow-x: auto; scroll-snap-type: x mandatory; }
  .step { scroll-snap-align: start; }
  .project-head, .doc-head { display: none; }
  .project-row, .doc-row, .env-row { display: flex; flex-wrap: wrap; gap: 6px 12px; }
  .project-row > .project-main, .doc-row > .doc-main, .env-row > div:first-child { flex: 1 1 100%; }
  .sheet-dl { grid-template-columns: minmax(0, 1fr); gap: 2px; }
  .sheet-dl dt { margin-top: 8px; }
  .log-line { grid-template-columns: minmax(0, 1fr); gap: 0; }
}

/* ── 004 : connexion (carte centrée sur un halo violet) et personne connectée ──────────────── */
.auth-root { display: block; min-height: 100vh; }
.auth-main { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: var(--space-4); min-height: 100vh; padding: var(--page-pad); background: radial-gradient(ellipse 60% 50% at 50% 35%, var(--halo-accent), transparent 70%); }
.auth-card { width: min(100%, 420px); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-8); display: flex; flex-direction: column; gap: var(--space-3); box-shadow: var(--shadow); }
.auth-brand { padding: 0; margin-bottom: var(--space-2); }
.auth-brand img { width: 47px; }
.auth-card h1 { font-size: var(--fs-lg); line-height: var(--lh-lg); }
.auth-promise { color: var(--color-text-secondary); margin-bottom: var(--space-2); }
.auth-form { display: flex; flex-direction: column; gap: var(--space-3); }
.auth-form .field input { min-height: var(--control-h); padding: 8px 12px; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-bg); color: var(--color-text-primary); font-size: 16px; }
.auth-form .field input.is-invalid { border-color: var(--color-danger); }
.auth-form .code-input { font-size: 24px; letter-spacing: 6px; text-align: center; }
.auth-help { color: var(--color-text-muted); margin-top: var(--space-1); text-wrap: pretty; }
.auth-notice { padding: 8px 12px; border-radius: var(--radius-sm); font-size: var(--fs-sm); background: var(--tint-muted); }
.auth-notice.tone-danger { background: var(--tint-danger); color: var(--on-tint-danger); }
.auth-notice.tone-warning { background: var(--tint-warning); color: var(--on-tint-warning); }
.auth-links { display: flex; flex-wrap: wrap; gap: var(--space-2) var(--space-4); align-items: center; justify-content: space-between; }
.inline-form { display: inline; }
.auth-theme { width: min(100%, 420px); }
.logout-email { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
@media (max-width: 767px) {
  .auth-main { justify-content: flex-start; padding-top: var(--space-6); min-height: 100vh; }
  .auth-card { padding: var(--space-5) var(--space-4); }
}
/* Utilisateurs */
.invite-form { padding: var(--space-3) var(--space-4) var(--space-4); }
.invite-row { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.invite-row input { flex: 1 1 260px; font-size: 16px; }
.users-email { word-break: break-all; }

/* ── 005 : chat par projet (mobile d'abord : fil qui défile, composer collant en bas) ─────── */
.chat { display: flex; flex-direction: column; gap: var(--space-3); min-width: 0; flex: 1; }
.chat-head-tools { flex-wrap: wrap; }
.chat-state { display: inline-flex; align-items: center; gap: 6px; padding: 2px 10px; border-radius: var(--radius-pill); font-size: 12px; line-height: 16px; font-weight: 600; background: var(--tint-muted); color: var(--color-text-muted); }
.chat-state::before { content: ""; width: 8px; height: 8px; border-radius: 50%; background: currentColor; }
.chat-state.is-idle { background: var(--tint-success); color: var(--on-tint-success); }
.chat-state.is-running { background: var(--tint-accent); color: var(--on-tint-accent); }
.chat-state.is-running::before { animation: chat-pulse 1.2s ease-in-out infinite; }
.chat-state.is-waiting_permission { background: var(--tint-warning); color: var(--on-tint-warning); }
@keyframes chat-pulse { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }
.btn-stop { border-color: var(--color-danger); color: var(--on-tint-danger); }
.btn-stop:hover { background: var(--tint-danger); }
.chat-unavailable { border-color: var(--color-warning); background: var(--tint-warning); }
.chat-feed-wrap { display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.chat-feed { display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.chat-more-wrap { display: flex; justify-content: center; }
.chat-empty { text-align: center; padding: var(--space-8) 0; }
.chat-when { font-size: var(--fs-label-sm); line-height: var(--lh-label-sm); color: var(--color-text-muted); margin-left: 8px; }
.chat-msg { align-self: flex-start; max-width: min(720px, 92%); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); padding: 10px 14px; overflow-wrap: anywhere; }
.chat-msg.is-mine { align-self: flex-end; background: var(--color-surface-raised); border-color: var(--border-accent); }
.chat-msg-head { display: flex; align-items: baseline; gap: 8px; margin-bottom: 4px; }
.chat-author { font-weight: 600; font-size: 12px; }
.chat-assistant { align-self: flex-start; max-width: min(760px, 96%); padding: 2px 4px; overflow-wrap: anywhere; }
.chat-assistant.is-streaming .chat-assistant-body::after { content: "▍"; color: var(--color-accent); animation: chat-pulse 1s steps(1) infinite; }
.chat-sys { align-self: center; text-align: center; font-size: 12px; line-height: 16px; color: var(--color-text-muted); padding: 2px 10px; }
.chat-sys.is-warn { color: var(--color-warning); }
.chat-sys.is-danger { color: var(--on-tint-danger); }
.chat-card { align-self: flex-start; width: min(760px, 100%); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-md); overflow: hidden; }
.chat-card > summary { display: flex; align-items: center; gap: var(--space-2); min-height: 40px; padding: 8px 14px; cursor: pointer; list-style: none; }
.chat-card > summary::-webkit-details-marker { display: none; }
.chat-card > summary::before { content: "▸"; color: var(--color-text-muted); font-size: 11px; transition: transform var(--motion-fast); }
.chat-card[open] > summary::before { transform: rotate(90deg); }
.chat-card-partial > summary::before { content: ""; }
.chat-card-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; }
.chat-card-title code { font-size: 12px; }
.chat-pill { font-size: 11px; line-height: 16px; font-weight: 600; padding: 1px 8px; border-radius: var(--radius-pill); background: var(--tint-muted); white-space: nowrap; }
.chat-pill.tone-ok { background: var(--tint-success); color: var(--on-tint-success); }
.chat-pill.tone-danger { background: var(--tint-danger); color: var(--on-tint-danger); }
.chat-card-body { border-top: 1px solid var(--color-border); padding: 10px 14px; display: flex; flex-direction: column; gap: 8px; }
.chat-pre { margin: 0; padding: 8px 10px; background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: var(--radius-sm); max-height: 240px; overflow: auto; white-space: pre-wrap; overflow-wrap: anywhere; color: var(--color-text-muted); }
.chat-card-result[data-ok="0"] .chat-pre { border-color: var(--color-danger); }
.chat-permission { align-self: stretch; max-width: 760px; background: var(--color-surface-raised); border: 1px solid var(--border-accent); border-left: 3px solid var(--color-warning); border-radius: var(--radius-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; overflow-wrap: anywhere; }
.chat-permission:not(.is-pending) { border-left-color: var(--color-border); border-color: var(--color-border); background: var(--color-surface); }
.chat-permission:focus { outline: 2px solid var(--color-accent); outline-offset: 2px; }
.chat-perm-title { font-weight: 600; }
.chat-perm-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
.chat-verdict { font-size: 13px; font-weight: 600; }
.chat-verdict.tone-ok { color: var(--color-success); }
/* 008 : cartes de fichiers remis (Fichier prêt · refus · supprimé) */
.file-card { align-self: stretch; max-width: 420px; background: var(--color-surface-raised); border: 1px solid var(--border-accent); border-left: 3px solid var(--color-success); border-radius: var(--radius-md); padding: 12px 14px; display: flex; flex-direction: column; gap: 6px; overflow-wrap: anywhere; min-width: 0; }
.file-card-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-2); }
.file-card-kicker { font-size: var(--fs-label-sm); line-height: var(--lh-label-sm); font-weight: 700; letter-spacing: .04em; text-transform: uppercase; color: var(--color-success); }
.file-card-head time { font-size: 12px; color: var(--color-text-muted); }
.file-card-preview { display: block; max-width: 100%; max-height: 220px; width: auto; border-radius: var(--radius-sm); border: 1px solid var(--color-border); background: var(--color-surface); object-fit: contain; }
.file-card-name { font-weight: 600; margin: 0; }
.file-card-meta { margin: 0; }
.file-card-text { margin: 0; font-size: 13px; line-height: 18px; }
.file-card-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; margin-top: 4px; }
.file-card-download { text-decoration: none; }
.file-card-removed { margin: 2px 0 0; }
.file-card.is-removed { border-left-color: var(--color-border); border-color: var(--color-border); background: var(--color-surface); }
.file-card.is-removed .file-card-kicker { color: var(--color-text-muted); }
.file-card.is-removed .file-card-name { color: var(--color-text-muted); text-decoration: line-through; }
.file-card.is-rejected { border-left-color: var(--color-warning); background: var(--color-surface); }
.file-card.is-rejected .file-card-kicker { color: var(--color-warning); }
/* Réglages : espace des fichiers par projet */
.fichiers-table th.num, .fichiers-table td.num { text-align: right; }
.fichiers-usage { display: flex; flex-direction: column; gap: 4px; min-width: 140px; }
.fichiers-bar { width: 100%; height: 6px; appearance: none; border: 0; border-radius: var(--radius-pill); background: var(--tint-muted); overflow: hidden; }
.fichiers-bar::-webkit-progress-bar { background: var(--tint-muted); border-radius: var(--radius-pill); }
.fichiers-bar::-webkit-progress-value { background: var(--color-accent); border-radius: var(--radius-pill); }
.fichiers-bar::-moz-progress-bar { background: var(--color-accent); border-radius: var(--radius-pill); }
.fichiers-table tr.is-full .fichiers-bar::-webkit-progress-value { background: var(--color-warning); }
.fichiers-table tr.is-full .fichiers-bar::-moz-progress-bar { background: var(--color-warning); }
.chat-connection { position: sticky; bottom: calc(96px + env(safe-area-inset-bottom)); align-self: center; padding: 4px 12px; border-radius: var(--radius-pill); background: var(--tint-warning); color: var(--on-tint-warning); font-size: 12px; font-weight: 600; z-index: 3; }
.chat-composer { position: sticky; bottom: 0; margin-top: auto; padding: 10px 0 calc(10px + env(safe-area-inset-bottom)); background: var(--color-bg); border-top: 1px solid var(--color-border); display: flex; flex-direction: column; gap: 4px; z-index: 4; }
/* 007 : une ligne [pastille Mode ▾][champ][micro][↑] ; le champ grandit seul (chat.js), le reste reste calé en bas. */
.chat-bar { display: grid; grid-template-columns: auto minmax(0, 1fr) auto auto; align-items: end; gap: var(--space-2); }
.chat-composer textarea { width: 100%; min-height: 44px; max-height: 40vh; resize: none; padding: 11px 14px; border-radius: 22px; border: 1px solid var(--color-border); background: var(--color-surface); color: var(--color-text-primary); font: inherit; line-height: 20px; transition: border-color var(--motion-fast); }
.chat-composer textarea:focus { outline: 2px solid var(--color-border-focus); outline-offset: 1px; border-color: var(--color-border-focus); }
.chat-composer textarea::placeholder { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } /* une ligne même quand le champ est étroit (375 px) */
.chat-composer textarea:disabled { opacity: .6; }
.chat-composer-foot { display: flex; align-items: center; gap: var(--space-2); min-height: 0; padding: 0 4px; }
.chat-hint { min-width: 0; overflow-wrap: anywhere; }
.chat-hint:empty, .dictee-interim:empty { display: none; }
.dictee-interim { color: var(--color-text-muted); font-style: italic; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.chat-mic, .chat-send { width: 44px; min-height: 44px; height: 44px; padding: 0; border-radius: 50%; flex: none; display: inline-flex; align-items: center; justify-content: center; }
.chat-send { font-size: 20px; line-height: 1; }
.chat-mic { position: relative; border: 1px solid var(--color-border); background: var(--color-surface-raised); color: var(--color-text-secondary); cursor: pointer; transition: background var(--motion-fast), color var(--motion-fast), border-color var(--motion-fast); }
.chat-mic:hover { background: var(--color-surface-active); color: var(--color-text-primary); }
.chat-mic-icon { width: 18px; height: 18px; display: block; background: currentColor; -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='2' width='6' height='12' rx='3'/%3E%3Cpath d='M5 10a7 7 0 0 0 14 0M12 17v4M8 21h8'/%3E%3C/svg%3E") center / contain no-repeat; mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='9' y='2' width='6' height='12' rx='3'/%3E%3Cpath d='M5 10a7 7 0 0 0 14 0M12 17v4M8 21h8'/%3E%3C/svg%3E") center / contain no-repeat; }
.chat-mic.is-listening { background: var(--tint-danger); border-color: var(--color-danger); color: var(--on-tint-danger); }
.chat-mic.is-listening::after { content: ""; position: absolute; inset: -1px; border-radius: 50%; border: 2px solid var(--color-danger); animation: mic-ring 1.4s ease-out infinite; }
@keyframes mic-ring { 0% { transform: scale(1); opacity: .8; } 100% { transform: scale(1.55); opacity: 0; } }
/* Pastille de mode : repos = vert calme ; « Tout automatique » = teinte d'alerte. Menu au-dessus, ancré à gauche. */
.mode-pill { position: relative; min-width: 0; }
.mode-pill-summary { list-style: none; display: inline-flex; align-items: center; gap: 7px; height: 44px; max-width: 100%; padding: 0 10px 0 12px; border-radius: var(--radius-pill); border: 1px solid var(--color-border); background: var(--color-surface-raised); color: var(--color-text-secondary); font-size: var(--fs-label); line-height: var(--lh-label); font-weight: 600; white-space: nowrap; cursor: pointer; user-select: none; transition: background var(--motion-fast), border-color var(--motion-fast), color var(--motion-fast); }
.mode-pill-summary::-webkit-details-marker { display: none; }
.mode-pill-summary:hover { background: var(--color-surface-active); color: var(--color-text-primary); }
.mode-pill-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--color-success); flex: none; }
.mode-pill-label { min-width: 0; overflow: hidden; text-overflow: ellipsis; }
.mode-pill-caret { font-size: 10px; opacity: .7; flex: none; transition: transform var(--motion-fast) var(--ease-enter); }
.mode-pill[open] .mode-pill-caret { transform: rotate(180deg); }
.mode-pill.is-bypass .mode-pill-summary { background: var(--tint-warning); border-color: var(--color-warning); color: var(--on-tint-warning); }
.mode-pill.is-bypass .mode-pill-dot { background: var(--color-warning); box-shadow: 0 0 0 3px var(--tint-warning); }
.mode-menu { position: absolute; left: 0; bottom: calc(100% + 8px); width: min(340px, calc(100vw - 2 * var(--page-pad))); background: var(--color-surface-raised); border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-card); padding: 6px; display: flex; flex-direction: column; gap: 2px; z-index: 6; animation: menu-in var(--motion-fast) var(--ease-enter); }
@keyframes menu-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.mode-item { position: relative; display: flex; flex-direction: column; align-items: flex-start; gap: 1px; width: 100%; padding: 8px 10px 8px 34px; border: 0; border-radius: var(--radius-sm); background: transparent; color: var(--color-text-primary); font: inherit; text-align: left; cursor: pointer; }
.mode-item:hover, .mode-item:focus-visible { background: var(--color-surface-active); }
.mode-item::before { content: ""; position: absolute; left: 11px; top: 12px; width: 14px; height: 14px; border-radius: 50%; border: 1.5px solid var(--color-text-muted); transition: border-color var(--motion-fast), background var(--motion-fast); }
.mode-item[aria-checked="true"]::before { border-color: var(--color-accent); background: radial-gradient(circle, var(--color-accent) 38%, transparent 44%); }
.mode-item.is-bypass[aria-checked="true"]::before { border-color: var(--color-warning); background: radial-gradient(circle, var(--color-warning) 38%, transparent 44%); }
.mode-item-title { font-weight: 600; font-size: var(--fs-body); line-height: var(--lh-body); }
.mode-item-hint { color: var(--color-text-muted); font-size: var(--fs-sm); line-height: var(--lh-sm); white-space: normal; }
.mode-warning { margin-top: 4px; padding: 10px 12px; border-radius: var(--radius-sm); background: var(--tint-warning); border: 1px solid var(--color-warning); display: flex; flex-direction: column; gap: 8px; }
.mode-warning-text { font-size: var(--fs-sm); line-height: var(--lh-sm); color: var(--color-text-primary); }
.mode-warning-actions { display: flex; gap: var(--space-2); flex-wrap: wrap; }
@media (max-width: 767px) {
  .chat-msg { max-width: 96%; }
  .chat-composer { bottom: var(--bottom-nav-h); margin-left: calc(-1 * var(--page-pad)); margin-right: calc(-1 * var(--page-pad)); padding: 10px var(--page-pad); }
  .chat-connection { bottom: calc(var(--bottom-nav-h) + 96px); }
  .chat-composer textarea { font-size: 16px; }
  .chat-bar { gap: 6px; }
  .mode-pill-summary { max-width: 40vw; padding: 0 8px 0 10px; }
  .mode-menu { width: min(340px, calc(100vw - 2 * var(--page-pad))); }
}
/* Les éléments du chat masqués par l'attribut hidden le restent malgré leur display propre (.inline-form, .card). */
.chat [hidden], .chat-head-tools [hidden] { display: none !important; }
