/* ==========================================================================
   Groupe VS — système graphique « Apple » (v20)
   Clarté, déférence, profondeur : neutres + un seul accent (Or Groupe VS).
   Thèmes : clair, sombre, automatique (body.mode-*). Fond animé facultatif (body.fond-anime) = verre.
   Ordre : jetons › base › structure › composants › tuiles › mouvement › mobile › ajouts.
   ========================================================================== */

/* ---------- 1. Jetons ---------- */
:root {
  /* Espacement (grille de 8, 4 pour l'ajustement fin) : 4 8 12 16 24 32 48 80 */
  --s1: 4px; --s2: 8px; --s3: 12px; --s4: 16px; --s5: 24px; --s6: 24px; --s8: 32px; --s10: 48px; --s12: 48px; --s16: 80px;
  /* Rayons : contrôles 8, cartes 12, grands panneaux 18, pilules 980 (boutons d'en-tête) */
  --r-sm: 8px; --r-md: 8px; --r-lg: 12px; --r-xl: 18px; --r-pill: 980px;
  /* Typographie : police système (SF sur les appareils Apple), Inter en repli */
  --body: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", "Helvetica Neue", Arial, sans-serif;
  --display: -apple-system, BlinkMacSystemFont, "SF Pro Display", "Inter", "Helvetica Neue", Arial, sans-serif;
  /* Échelle : caption 12, footnote 13, body 15, headline 17, title3 20, title2 22, title1 28, large title 34 */
  --t-xs: 12px; --t-sm: 12px; --t-md: 13px; --t-base: 15px; --t-lg: 17px; --t-xl: 20px; --t-2xl: 22px; --t-3xl: 28px; --t-4xl: 34px;
  /* Mouvement : 200–300 ms */
  --ease-in: cubic-bezier(.25, .1, .25, 1); --ease-out: cubic-bezier(.25, .1, .25, 1);
  --d-fast: 200ms; --d-med: 250ms; --d-slow: 300ms;
  --nav-w: 240px;
}

/* Clair (défaut) — les jetons vivent sur body pour suivre les classes mode-* et fond-* */
body {
  color-scheme: light;
  --bg: #FFFFFF; --bg-grouped: #F5F5F7;
  --surface: #FFFFFF; --surface-2: #FFFFFF; --surface-solid: #FFFFFF;
  --surface-hover: rgba(0, 0, 0, .04);
  --fill: rgba(118, 118, 128, .12); --fill-2: rgba(118, 118, 128, .08);
  --border: rgba(0, 0, 0, .10); --border-strong: rgba(0, 0, 0, .16);
  --card-line: transparent;
  --highlight: rgba(0, 0, 0, .03);
  --text: #1D1D1F; --text-muted: #6E6E73; --text-subtle: #86868B;
  --field: #FFFFFF;
  --shadow: 0 1px 2px rgba(0, 0, 0, .04), 0 4px 24px rgba(0, 0, 0, .06);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .14);
  --blur: none;
  --glass-blur: blur(20px) saturate(180%);
  --nav-bg: rgba(246, 246, 248, .8);
  --bar-bg: rgba(255, 255, 255, .72);
  --glass-bg: rgba(255, 255, 255, .78);
  --scrim: rgba(0, 0, 0, .3);
  --seg-on: #FFFFFF; --seg-shadow: 0 1px 3px rgba(0, 0, 0, .14), 0 0 1px rgba(0, 0, 0, .12);
  --bubble-other: #E9E9EB;
  --text-on-fill: #58585D;
  --lg-l: block; --lg-d: none; /* logo à afficher : variante sombre en clair */

  --accent: #C9900F; --accent-hover: #B8820C; --accent-fg: #1D1D1F;
  --accent-text: #8A6100; --accent-soft: rgba(201, 144, 15, .12); --accent-ring: rgba(201, 144, 15, .30);

  --danger: #D70015; --danger-fill: #FF3B30; --danger-soft: rgba(255, 59, 48, .12); --danger-solid: #D70015;
  --warning: #C93400; --warning-fill: #FF9500; --warning-soft: rgba(255, 149, 0, .12);
  --success: #1E7A35; --success-fill: #34C759; --success-soft: rgba(52, 199, 89, .12);
  --info: #0066CC; --info-soft: rgba(0, 113, 227, .10);
}

/* Sombre : choisi, ou imposé par un fond animé non clair */
body.mode-sombre:not(.fond-clair), body.fond-anime:not(.fond-clair) {
  color-scheme: dark;
  --bg: #000000; --bg-grouped: #000000;
  --surface: #1C1C1E; --surface-2: #2C2C2E; --surface-solid: #1C1C1E;
  --surface-hover: rgba(255, 255, 255, .06);
  --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .16);
  --border: rgba(255, 255, 255, .15); --border-strong: rgba(255, 255, 255, .24);
  --card-line: var(--border);
  --highlight: rgba(255, 255, 255, .06);
  --text: #F5F5F7; --text-muted: #A1A1A6; --text-subtle: #8E8E93;
  --field: #1C1C1E;
  --shadow: 0 4px 24px rgba(0, 0, 0, .4);
  --shadow-pop: 0 12px 40px rgba(0, 0, 0, .6);
  --nav-bg: rgba(28, 28, 30, .72);
  --bar-bg: rgba(22, 22, 23, .72);
  --glass-bg: rgba(44, 44, 46, .78);
  --scrim: rgba(0, 0, 0, .5);
  --seg-on: #636366; --seg-shadow: 0 1px 3px rgba(0, 0, 0, .4);
  --bubble-other: #2C2C2E;
  --text-on-fill: #A1A1A6;
  --lg-l: none; --lg-d: block;
  --accent: #E3A21F; --accent-hover: #F0B53C; --accent-fg: #1D1D1F;
  --accent-text: #F2C65E; --accent-soft: rgba(227, 162, 31, .16); --accent-ring: rgba(227, 162, 31, .35);
  --danger: #FF6961; --danger-fill: #FF453A; --danger-soft: rgba(255, 69, 58, .16);
  --warning: #FF9F0A; --warning-fill: #FF9F0A; --warning-soft: rgba(255, 159, 10, .16);
  --success: #30D158; --success-fill: #30D158; --success-soft: rgba(48, 209, 88, .16);
  --info: #4DA3FF; --info-soft: rgba(10, 132, 255, .16);
}
html:has(body.mode-sombre:not(.fond-clair)), html:has(body.fond-anime:not(.fond-clair)) { color-scheme: dark; }
@media (prefers-color-scheme: dark) {
  html:has(body.mode-auto:not(.fond-clair)) { color-scheme: dark; }
  body.mode-auto:not(.fond-clair) {
    color-scheme: dark;
    --bg: #000000; --bg-grouped: #000000;
    --surface: #1C1C1E; --surface-2: #2C2C2E; --surface-solid: #1C1C1E;
    --surface-hover: rgba(255, 255, 255, .06);
    --fill: rgba(118, 118, 128, .24); --fill-2: rgba(118, 118, 128, .16);
    --border: rgba(255, 255, 255, .15); --border-strong: rgba(255, 255, 255, .24);
    --card-line: var(--border);
    --highlight: rgba(255, 255, 255, .06);
    --text: #F5F5F7; --text-muted: #A1A1A6; --text-subtle: #8E8E93;
    --field: #1C1C1E;
    --shadow: 0 4px 24px rgba(0, 0, 0, .4);
    --shadow-pop: 0 12px 40px rgba(0, 0, 0, .6);
    --nav-bg: rgba(28, 28, 30, .72);
    --bar-bg: rgba(22, 22, 23, .72);
    --glass-bg: rgba(44, 44, 46, .78);
    --scrim: rgba(0, 0, 0, .5);
    --seg-on: #636366; --seg-shadow: 0 1px 3px rgba(0, 0, 0, .4);
    --bubble-other: #2C2C2E;
    --text-on-fill: #A1A1A6;
    --lg-l: none; --lg-d: block;
    --accent: #E3A21F; --accent-hover: #F0B53C; --accent-fg: #1D1D1F;
    --accent-text: #F2C65E; --accent-soft: rgba(227, 162, 31, .16); --accent-ring: rgba(227, 162, 31, .35);
    --danger: #FF6961; --danger-fill: #FF453A; --danger-soft: rgba(255, 69, 58, .16);
    --warning: #FF9F0A; --warning-fill: #FF9F0A; --warning-soft: rgba(255, 159, 10, .16);
    --success: #30D158; --success-fill: #30D158; --success-soft: rgba(48, 209, 88, .16);
    --info: #4DA3FF; --info-soft: rgba(10, 132, 255, .16);
  }
}

/* Verre : au-dessus d'un fond animé, cartes et barres deviennent translucides */
body.fond-anime {
  --surface: rgba(28, 28, 30, .58); --surface-2: rgba(58, 58, 60, .62); --surface-solid: rgba(36, 36, 38, .92);
  --blur: blur(20px) saturate(180%);
  --nav-bg: rgba(20, 20, 22, .55); --bar-bg: rgba(20, 20, 22, .5); --glass-bg: rgba(40, 40, 42, .72);
  --card-line: rgba(255, 255, 255, .16); --field: rgba(255, 255, 255, .08);
  --shadow: 0 8px 32px rgba(0, 0, 0, .28);
}
body.fond-anime.fond-clair {
  --surface: rgba(255, 255, 255, .62); --surface-2: rgba(255, 255, 255, .72); --surface-solid: rgba(255, 255, 255, .94);
  --nav-bg: rgba(255, 255, 255, .5); --bar-bg: rgba(255, 255, 255, .5); --glass-bg: rgba(255, 255, 255, .78);
  --card-line: rgba(255, 255, 255, .75); --field: rgba(255, 255, 255, .75);
  --border: rgba(0, 0, 0, .12);
  --shadow: 0 8px 32px rgba(0, 0, 0, .10);
}

/* Alias de l'ancien système, pour les pages qui les utilisent encore (évalués sur body et sur .uv) */
body, .uv {
  --ink: var(--text); --muted: var(--text-muted); --line: var(--border); --line-strong: var(--border-strong);
  --card: var(--surface); --soft: var(--surface-hover); --ground: var(--bg); --nav: var(--nav-bg);
  --accent-dark: var(--accent-text); --accent-tint: var(--accent-soft);
  --warn-bg: var(--warning-soft); --warn-ink: var(--warning);
}
body.nav-mini { --nav-w: 72px; }

/* ---------- 2. Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body { margin: 0; }
html { -webkit-text-size-adjust: 100%; }
body {
  font-family: var(--body); font-size: var(--t-base); line-height: 20px; color: var(--text);
  background: var(--bg-grouped); -webkit-font-smoothing: antialiased;
}
a { color: var(--accent-text); text-decoration: none; transition: color var(--d-fast) var(--ease-in), opacity var(--d-fast) var(--ease-in); }
a:hover { text-decoration: underline; text-underline-offset: 3px; }
h1, h2, h3, h4 { margin: 0; color: var(--text); font-family: var(--body); }
h1 { font-family: var(--display); font-weight: 700; font-size: var(--t-4xl); line-height: 41px; letter-spacing: -.02em; }
h2 { font-weight: 600; font-size: var(--t-lg); line-height: 22px; }
h3 { font-weight: 600; font-size: var(--t-base); line-height: 20px; }
p { margin: 0; }
button, input, select, textarea { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; border-radius: 4px; }
::selection { background: var(--accent-soft); }
.num, .tile-big, .nav-count, td.c, .due { font-variant-numeric: tabular-nums; }
.sub { color: var(--text-muted); font-size: var(--t-md); line-height: 18px; }
.hint { color: var(--text-muted); font-size: var(--t-base); line-height: 20px; }
.visually-hidden { position: absolute !important; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.eyebrow, .nav-label { font-size: var(--t-sm); line-height: 16px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-muted); }

/* Fond animé : seulement si choisi */
body.fond-anime { background: var(--bg1, #1B1A17); }
body:not(.fond-anime) .theme-bg { display: none; }

/* ---------- 3. Structure ---------- */
.shell { display: flex; min-height: 100vh; }
.main { flex: 1; min-width: 0; width: 100%; max-width: 1200px; margin: 0 auto; padding: 84px var(--s8) var(--s16); display: flex; flex-direction: column; gap: var(--s5); }
.head { display: flex; justify-content: space-between; align-items: flex-end; gap: var(--s5); flex-wrap: wrap; }
.head > div:first-child { display: flex; flex-direction: column; gap: var(--s1); }
.head p { color: var(--text-muted); font-size: var(--t-base); line-height: 20px; max-width: 70ch; }

/* Barre latérale façon macOS */
.nav {
  position: sticky; top: 0; height: 100vh; width: var(--nav-w); flex-shrink: 0; overflow-y: auto; overflow-x: hidden;
  display: flex; flex-direction: column; gap: var(--s4); padding: var(--s5) var(--s3) var(--s4);
  background: var(--nav-bg); color: var(--text); border-right: 1px solid var(--border);
  backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  transition: width var(--d-med) var(--ease-in); scrollbar-width: thin; z-index: 70;
}
.brand { display: flex; flex-direction: column; gap: var(--s2); padding: 0 var(--s3); text-decoration: none; color: inherit; }
.brand:hover { text-decoration: none; }
.brand-logo { width: 100%; max-width: 168px; height: auto; }
.logo-l { display: var(--lg-l); } .logo-d { display: var(--lg-d); }
.brand-logo.logo-vertical, .brand-logo.logo-holding, .brand-logo.logo-mono { max-width: 120px; }
.brand-logo.logo-carres { max-width: 52px; }
.brand-sub { font-size: var(--t-sm); line-height: 16px; color: var(--text-muted); }
.nav-links { display: flex; flex-direction: column; gap: 2px; }
.nav-links .nav-label { display: block; padding: var(--s4) var(--s3) var(--s1); font-size: var(--t-sm); letter-spacing: .02em; }
.nav-links a {
  position: relative; display: flex; align-items: center; gap: var(--s3); min-height: 36px; padding: 0 var(--s3);
  border-radius: var(--r-sm); color: var(--text); text-decoration: none; font-size: var(--t-base); line-height: 20px;
  transition: background var(--d-fast) var(--ease-in), color var(--d-fast) var(--ease-in);
}
.nav-links a:hover { background: var(--surface-hover); color: var(--text); }
.nav-links a.on { background: var(--accent-soft); color: var(--text); font-weight: 600; }
.nav-links a.nav-sub { min-height: 32px; font-size: var(--t-base); color: var(--text-muted); }
.nav-links a.nav-sub:hover, .nav-links a.nav-sub.on { color: var(--text); }
.nav .ico { width: 18px; height: 18px; flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.6; stroke-linecap: round; stroke-linejoin: round; color: var(--text-muted); }
.nav a.on .ico { color: var(--accent-text); }
.nav-text { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.nav-count {
  margin-left: auto; min-width: 20px; height: 20px; padding: 0 6px; border-radius: var(--r-pill);
  display: inline-flex; align-items: center; justify-content: center; font-size: var(--t-sm); font-weight: 600;
  background: var(--fill); color: var(--text-on-fill);
}
.nav-count[hidden] { display: none; }
.nav-count.nav-msg, .nav-count.nav-task.late { background: var(--danger-solid); color: #fff; }
.nav-block { padding: 0 var(--s3); display: flex; flex-direction: column; gap: var(--s1); font-size: var(--t-md); color: var(--text-muted); }
.nav-block strong { color: var(--text); font-weight: 500; }
.nav-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); border-top: 1px solid var(--border); }
.nav-toggle {
  align-self: flex-start; display: inline-flex; align-items: center; gap: var(--s2); height: 32px; padding: 0 var(--s3);
  border: 0; border-radius: var(--r-sm); background: transparent; color: var(--text-muted); font-size: var(--t-md);
}
.nav-toggle:hover { background: var(--surface-hover); color: var(--text); }
.nav-toggle .ico { transition: transform var(--d-med) var(--ease-in); }
.linkish { border: 0; background: none; padding: 0; color: var(--text-muted); text-decoration: underline; text-underline-offset: 3px; font-size: var(--t-md); }

/* Menu réduit (rail d'icônes), mémorisé par le navigateur */
body.nav-mini .nav { width: 72px; }
body.nav-mini .nav .nav-text, body.nav-mini .nav .brand-sub, body.nav-mini .nav .nav-label, body.nav-mini .nav .nav-block, body.nav-mini .nav .nav-toggle span { display: none; }
body.nav-mini .nav .brand-logo { max-width: 40px; }
body.nav-mini .nav-links a { justify-content: center; padding: 0; }
body.nav-mini .nav-links a .nav-count { position: absolute; top: 2px; right: 6px; min-width: 16px; height: 16px; font-size: var(--t-sm); padding: 0 4px; }
body.nav-mini .nav-toggle { align-self: center; }
body.nav-mini .nav-toggle .ico { transform: rotate(180deg); }

/* Barre du haut : fine, translucide, collée en haut de la zone de contenu */
.topbar {
  position: fixed; top: 0; left: var(--nav-w); right: 0; height: 52px; z-index: 60; display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s8);
  background: var(--bar-bg); border-bottom: 1px solid var(--border); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur);
  transition: left var(--d-med) var(--ease-in);
}
.topbar-title { font-size: var(--t-lg); line-height: 22px; font-weight: 600; color: var(--text); margin-right: auto; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-open { display: none; }
.search-btn {
  display: inline-flex; align-items: center; gap: var(--s2); height: 30px; padding: 0 var(--s2) 0 var(--s3); min-width: 240px; margin-left: auto;
  border: 0; border-radius: var(--r-sm); background: var(--fill); color: var(--text-on-fill); font-size: var(--t-base);
  transition: background var(--d-fast) var(--ease-in), color var(--d-fast) var(--ease-in);
}
.search-btn:hover { background: var(--border); color: var(--text); }
.search-btn .ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 1.8; }
.search-btn kbd, .cmdk kbd { margin-left: auto; padding: 1px 6px; border-radius: 6px; border: 1px solid var(--border-strong); font: 500 var(--t-sm)/16px var(--body); color: var(--text-muted); }

/* Carte du collaborateur (compacte) */
.user-chip { position: relative; }
.user-chip > summary {
  list-style: none; display: flex; align-items: center; gap: var(--s2); height: 40px; padding: 0 var(--s2) 0 var(--s1);
  border-radius: var(--r-sm); cursor: pointer; transition: background var(--d-fast) var(--ease-in);
}
.user-chip > summary::-webkit-details-marker { display: none; }
.user-chip > summary:hover, .user-chip[open] > summary { background: var(--surface-hover); }
.user-avatar {
  width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0;
  font-weight: 600; font-size: var(--t-sm); letter-spacing: .02em; background: var(--accent); color: var(--accent-fg);
}
.user-id { display: flex; flex-direction: column; line-height: 1.15; max-width: 200px; }
.user-name { font-weight: 600; font-size: var(--t-base); line-height: 18px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-role { font-size: var(--t-sm); line-height: 14px; color: var(--text-muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.user-caret { display: none; }
.user-menu {
  position: absolute; right: 0; top: calc(100% + var(--s2)); min-width: 248px; padding: var(--s2);
  display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: var(--r-lg);
  background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: var(--shadow-pop); animation: pop-in var(--d-med) var(--ease-in);
}
.user-menu a, .user-menu button { display: flex; align-items: center; min-height: 36px; padding: 0 var(--s3); border: 0; border-radius: var(--r-sm); background: none; color: var(--text); text-decoration: none; font-size: var(--t-base); text-align: left; width: 100%; }
.user-menu a:hover, .user-menu button:hover { background: var(--accent-soft); text-decoration: none; }
.user-menu .user-mail { padding: var(--s2) var(--s3); font-size: var(--t-md); color: var(--text-muted); border-bottom: 1px solid var(--border); margin-bottom: var(--s1); overflow-wrap: anywhere; }

/* ---------- 4. Composants ---------- */
/* Cartes : ombre seule en clair, filet en sombre */
.panel, .today-card, .table, .tile, .ged-filters, .quick-add, .chat-list, .chat-head, .chat-compose, .month, .ag-view, .grid-wrap, .uv-card, .ged-preview {
  background: var(--surface); border: 1px solid var(--card-line); border-radius: var(--r-lg); box-shadow: var(--shadow); color: var(--text);
  backdrop-filter: var(--blur); -webkit-backdrop-filter: var(--blur);
}
.panel, .today-card { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s4); }
.panel.wide { max-width: none; }
.today-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--s3); }
.today-head a { font-size: var(--t-base); }
.today-head a::after { content: ' ›'; }

/* Boutons : principal = or plein ; secondaire = teinté ; tertiaire = lien ; destructif = texte rouge */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--s2); height: 32px; padding: 0 var(--s4);
  border: 0; border-radius: var(--r-sm); background: var(--accent); color: var(--accent-fg);
  font-size: var(--t-base); font-weight: 600; line-height: 1; white-space: nowrap; text-decoration: none; cursor: pointer;
  transition: background var(--d-fast) var(--ease-in), color var(--d-fast) var(--ease-in), transform var(--d-fast) var(--ease-in), box-shadow var(--d-fast) var(--ease-in);
}
.btn:hover { background: var(--accent-hover); color: var(--accent-fg); text-decoration: none; }
.btn:active { transform: scale(.98); }
.btn:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }
.btn:disabled, .btn[aria-disabled=true] { opacity: .4; cursor: not-allowed; transform: none; }
.head .btn:not(.ghost):not(.small) { height: 36px; padding: 0 var(--s5); border-radius: var(--r-pill); }
.btn.ghost { background: var(--accent-soft); color: var(--accent-text); font-weight: 600; }
.btn.ghost:hover { background: var(--accent-ring); color: var(--accent-text); }
.btn.danger { background: var(--danger-soft); color: var(--danger); }
.btn.danger:hover { background: var(--danger-soft); color: var(--danger); filter: brightness(.95); }
.confirm .pop .btn.danger { background: var(--danger-solid); color: #fff; }
.btn.small { height: 28px; padding: 0 var(--s3); font-size: var(--t-md); }
.btn.icon { width: 32px; padding: 0; }
.text-btn { border: 0; background: none; padding: 0; color: var(--accent-text); font-size: var(--t-base); cursor: pointer; }
.text-btn:hover { text-decoration: underline; text-underline-offset: 3px; }
.text-btn.danger { color: var(--danger); }
.inline-form { display: flex; gap: var(--s2); align-items: center; flex-wrap: wrap; }

/* Champs */
.field { display: flex; flex-direction: column; gap: 6px; }
.field + .field { margin-top: var(--s2); }
.field label, label.lbl { font-size: var(--t-md); line-height: 16px; font-weight: 600; color: var(--text-muted); }
.input, select.input, textarea.input, input[type=file] {
  width: 100%; height: 36px; padding: 0 var(--s3); border: 1px solid var(--border-strong); border-radius: var(--r-sm);
  background: var(--field); color: var(--text); font-size: var(--t-base);
  transition: border-color var(--d-fast) var(--ease-in), box-shadow var(--d-fast) var(--ease-in);
}
textarea.input { height: auto; min-height: 88px; padding: var(--s2) var(--s3); line-height: 20px; resize: vertical; }
input[type=file] { height: auto; padding: var(--s2); }
.input::placeholder { color: var(--text-muted); opacity: 1; }
.input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 4px var(--accent-ring); }
.input:disabled { opacity: .5; }
.input.small { height: 32px; font-size: var(--t-base); }
select.input { appearance: none; padding-right: 32px; background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath d='M1.5 1.5 6 6l4.5-4.5' fill='none' stroke='%238E8E93' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E"); background-position: right 12px center; background-repeat: no-repeat; background-size: 10px 7px; }
select.input option { background: var(--surface-solid); color: var(--text); }
.check { display: flex; align-items: center; gap: var(--s2); font-size: var(--t-base); cursor: pointer; }
input[type=checkbox], input[type=radio] { accent-color: var(--accent); width: 16px; height: 16px; }

/* Contrôle segmenté façon iOS */
.seg { display: inline-flex; padding: 2px; gap: 0; border-radius: 9px; background: var(--fill); }
.seg a, .seg button { display: inline-flex; align-items: center; min-height: 28px; padding: 0 var(--s3); border: 0; border-radius: 7px; background: none; color: var(--text); font-size: var(--t-md); font-weight: 500; text-decoration: none; white-space: nowrap; transition: background var(--d-fast) var(--ease-in), box-shadow var(--d-fast) var(--ease-in); }
.seg a:hover, .seg button:hover { background: var(--surface-hover); text-decoration: none; color: var(--text); }
.seg a.on, .seg button.on, .seg a[aria-current] { background: var(--seg-on); color: var(--text); font-weight: 600; box-shadow: var(--seg-shadow); }

/* Tableaux */
.table { overflow: auto; padding: 0; }
.table table { width: 100%; border-collapse: collapse; font-size: var(--t-base); }
.table th { padding: var(--s3) var(--s4); text-align: left; font-size: var(--t-sm); line-height: 16px; font-weight: 600; color: var(--text-muted); background: transparent; border-bottom: 1px solid var(--border); white-space: nowrap; }
.table td { padding: var(--s2) var(--s4); height: 44px; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:first-child td { border-top: 0; }
.table tbody tr { transition: background var(--d-fast) var(--ease-in); }
.table tbody tr:hover { background: var(--surface-hover); }
.table .c { text-align: center; }
.table .cat-row td { background: var(--fill-2); font-weight: 600; }

/* Messages d'information */
.notice { display: flex; gap: var(--s3); align-items: center; padding: var(--s3) var(--s4); border-radius: var(--r-lg); background: var(--warning-soft); color: var(--text); font-size: var(--t-base); line-height: 20px; }
.notice.ok { background: var(--success-soft); }
.notice[role=alert]:not(.ok) { background: var(--danger-soft); }
.notice a { color: var(--text); font-weight: 600; text-decoration: underline; text-underline-offset: 3px; }

/* Pastilles de statut, priorité : texte coloré sur fond teinté, sans point */
.status, .prio, .pill { display: inline-flex; align-items: center; gap: 6px; height: 22px; padding: 0 var(--s2); border-radius: 6px; font-size: var(--t-sm); font-weight: 600; white-space: nowrap; background: var(--fill-2); color: var(--text-muted); }
.status.s-a_faire { color: var(--text-muted); }
.status.s-en_cours { color: var(--info); background: var(--info-soft); }
.status.s-en_attente { color: var(--warning); background: var(--warning-soft); }
.status.s-a_valider { color: var(--accent-text); background: var(--accent-soft); }
.status.s-terminee, .status.s-valide { color: var(--success); background: var(--success-soft); }
.status.s-annulee, .status.s-archive { color: var(--text-muted); text-decoration: line-through; }
.status.s-a_valider:is(.ged) { color: var(--warning); background: var(--warning-soft); }
.status.s-refuse { color: var(--danger); background: var(--danger-soft); }
.prio.p3 { color: var(--warning); background: var(--warning-soft); }
.prio.p4 { color: var(--danger); background: var(--danger-soft); }
.due { color: var(--text-muted); }
.due.today { color: var(--warning); font-weight: 600; }
.due.late { color: var(--danger); font-weight: 600; }

/* Barre de progression */
.progress { height: 4px; border-radius: var(--r-pill); background: var(--fill); overflow: hidden; }
.progress > i, .progress > span { display: block; height: 100%; border-radius: inherit; background: var(--accent); transition: width var(--d-slow) var(--ease-in); }

/* Confirmation dépliante */
.confirm { position: relative; display: inline-block; }
.confirm > summary { list-style: none; cursor: pointer; }
.confirm > summary::-webkit-details-marker { display: none; }
.confirm .pop { position: absolute; z-index: 40; right: 0; top: calc(100% + var(--s2)); width: 264px; padding: var(--s4); display: flex; flex-direction: column; gap: var(--s3); border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--surface-solid); color: var(--text); box-shadow: var(--shadow-pop); font-size: var(--t-base); animation: pop-in var(--d-med) var(--ease-in); }

/* Menu déroulant générique (details.menu) */
.menu { position: relative; display: inline-block; }
.menu > summary { list-style: none; }
.menu > summary::-webkit-details-marker { display: none; }
.menu .pop { position: absolute; z-index: 50; top: calc(100% + var(--s2)); left: 0; min-width: 248px; padding: var(--s2); display: flex; flex-direction: column; gap: 2px; border: 1px solid var(--border); border-radius: var(--r-lg); background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: var(--shadow-pop); animation: pop-in var(--d-med) var(--ease-in); }
.menu .pop.right { left: auto; right: 0; }
.menu .pop a { display: flex; align-items: center; min-height: 36px; padding: 0 var(--s3); border-radius: var(--r-sm); color: var(--text); text-decoration: none; }
.menu .pop a:hover { background: var(--accent-soft); text-decoration: none; }

/* État vide */
.empty { display: flex; flex-direction: column; align-items: center; gap: var(--s3); padding: var(--s12) var(--s5); text-align: center; color: var(--text-muted); }
.empty strong { font-size: var(--t-xl); line-height: 25px; font-weight: 600; color: var(--text); }

/* Chargement */
.skeleton { border-radius: var(--r-sm); background: linear-gradient(90deg, var(--fill-2) 0%, var(--fill) 50%, var(--fill-2) 100%); background-size: 200% 100%; animation: shimmer 1.4s linear infinite; }

/* Toast / bandeau d'annulation : pilule sombre centrée en bas */
.undo-bar, .toast {
  position: fixed; bottom: var(--s5); left: 50%; z-index: 120; display: flex; align-items: center; gap: var(--s4);
  padding: var(--s2) var(--s2) var(--s2) var(--s5); min-height: 48px; border-radius: var(--r-pill);
  background: rgba(44, 44, 46, .96); color: #F5F5F7; box-shadow: var(--shadow-pop);
  font-size: var(--t-base); transform: translateX(-50%); animation: toast-in var(--d-slow) var(--ease-in);
  transition: opacity var(--d-med) var(--ease-out), transform var(--d-med) var(--ease-out);
}
.undo-bar.gone, .toast.gone { opacity: 0; transform: translate(-50%, 12px); pointer-events: none; }
.undo-bar button, .toast button { height: 32px; padding: 0 var(--s4); border: 0; border-radius: var(--r-pill); background: #E3A21F; color: #1D1D1F; font-weight: 600; }
.undo-bar button:hover, .toast button:hover { background: #F0B53C; }
.undo-bar .undo-timer { width: 32px; height: 3px; border-radius: 3px; background: rgba(255, 255, 255, .2); overflow: hidden; }
.undo-bar .undo-timer i { display: block; height: 100%; background: #E3A21F; animation: drain 5s linear forwards; }

/* Volet latéral = « sheet » */
.drawer-scrim { position: fixed; inset: 0; z-index: 90; background: var(--scrim); opacity: 0; pointer-events: none; transition: opacity var(--d-med) var(--ease-in); }
.drawer {
  position: fixed; top: var(--s3); right: var(--s3); bottom: var(--s3); z-index: 100; width: min(560px, calc(100vw - 24px));
  display: flex; flex-direction: column; border: 1px solid var(--card-line); border-radius: var(--r-xl);
  background: var(--surface-solid); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: var(--shadow-pop); color: var(--text);
  transform: translateX(calc(100% + 24px)); transition: transform var(--d-slow) var(--ease-in); visibility: hidden;
}
body.drawer-on .drawer-scrim { opacity: 1; pointer-events: auto; }
body.drawer-on .drawer { transform: none; visibility: visible; }
body.drawer-on { overflow: hidden; }
.drawer-head { display: flex; align-items: flex-start; gap: var(--s3); padding: var(--s5) var(--s5) var(--s4); border-bottom: 1px solid var(--border); }
.drawer-head h2 { flex: 1; font-size: var(--t-2xl); font-weight: 700; line-height: 28px; letter-spacing: 0; }
.drawer-head .sub { margin-top: var(--s1); }
.drawer-close { width: 30px; height: 30px; flex-shrink: 0; display: grid; place-items: center; border: 0; border-radius: 50%; background: var(--fill); color: var(--text-muted); font-size: 18px; line-height: 1; transition: background var(--d-fast) var(--ease-in); }
.drawer-close:hover { background: var(--border-strong); color: var(--text); }
.drawer-body { flex: 1; overflow-y: auto; padding: var(--s5); display: flex; flex-direction: column; gap: var(--s5); }
.drawer-body .panel { padding: 0; background: none; border: 0; box-shadow: none; backdrop-filter: none; -webkit-backdrop-filter: none; }
.drawer-foot { display: flex; gap: var(--s2); flex-wrap: wrap; padding: var(--s4) var(--s5); border-top: 1px solid var(--border); }
.drawer-loading { padding: var(--s5); display: flex; flex-direction: column; gap: var(--s3); }
.drawer-loading .skeleton { height: 14px; }

/* Palette de recherche (Ctrl K) = Spotlight */
.cmdk { position: fixed; inset: 0; z-index: 200; display: flex; align-items: flex-start; justify-content: center; padding-top: 14vh; background: var(--scrim); }
.cmdk[hidden] { display: none; }
.cmdk-box { width: min(640px, calc(100vw - 32px)); overflow: hidden; border: 1px solid var(--border); border-radius: var(--r-xl); background: var(--glass-bg); backdrop-filter: var(--glass-blur); -webkit-backdrop-filter: var(--glass-blur); box-shadow: var(--shadow-pop); animation: pop-in var(--d-med) var(--ease-in); }
.cmdk-field { display: flex; align-items: center; gap: var(--s3); padding: 0 var(--s5); border-bottom: 1px solid var(--border); }
.cmdk-field .ico { width: 22px; height: 22px; stroke: var(--text-muted); fill: none; stroke-width: 1.8; flex-shrink: 0; }
.cmdk-input { flex: 1; height: 64px; border: 0; background: none; color: var(--text); font-size: var(--t-2xl); outline: none; }
.cmdk-input::placeholder { color: var(--text-muted); opacity: 1; }
.cmdk-list { list-style: none; margin: 0; padding: var(--s2); max-height: 52vh; overflow-y: auto; }
.cmdk-group { padding: var(--s3) var(--s3) var(--s1); font-size: var(--t-sm); line-height: 16px; font-weight: 600; letter-spacing: .02em; text-transform: uppercase; color: var(--text-muted); }
.cmdk-item { display: flex; align-items: center; gap: var(--s3); min-height: 40px; padding: 0 var(--s3); border-radius: var(--r-sm); color: var(--text); text-decoration: none; }
.cmdk-item:hover { text-decoration: none; }
.cmdk-item .ico { width: 18px; height: 18px; stroke: currentColor; fill: none; stroke-width: 1.6; color: var(--text-muted); }
.cmdk-item.sel, .cmdk-item:hover { background: var(--accent-soft); color: var(--text); }
.cmdk-item.sel .ico { stroke: var(--accent-text); color: var(--accent-text); }
.cmdk-hint { margin-left: auto; font-size: var(--t-md); color: var(--text-muted); }
.cmdk-empty { padding: var(--s8) var(--s5); text-align: center; color: var(--text-muted); }
.cmdk-foot { display: flex; gap: var(--s4); padding: var(--s2) var(--s5); border-top: 1px solid var(--border); font-size: var(--t-md); color: var(--text-muted); }

/* ---------- 5. Tâches : tuiles par société ---------- */
.tasks-page { gap: var(--s5); }
.tasks-page .tiles { display: grid; grid-template-columns: repeat(auto-fill, minmax(208px, 1fr)); gap: var(--s4); }
.tasks-page a.tile {
  --lvl: var(--text-muted);
  position: relative; display: flex; flex-direction: column; gap: 2px; min-height: 248px; padding: var(--s5) var(--s4) var(--s4);
  overflow: hidden; text-decoration: none; color: var(--text);
  transition: transform var(--d-med) var(--ease-in), box-shadow var(--d-med) var(--ease-in);
}
.tasks-page a.tile:hover { transform: translateY(-2px); box-shadow: var(--shadow-pop); color: var(--text); text-decoration: none; }
.tasks-page a.tile:focus-visible { outline: none; box-shadow: 0 0 0 4px var(--accent-ring); }
.tasks-page .tile.n-rouge { --lvl: var(--danger); } .tasks-page .tile.n-rouge .tile-lvl i { background: var(--danger-fill); }
.tasks-page .tile.n-orange { --lvl: var(--warning); } .tasks-page .tile.n-orange .tile-lvl i { background: var(--warning-fill); }
.tasks-page .tile.n-vert { --lvl: var(--success); } .tasks-page .tile.n-vert .tile-lvl i { background: var(--success-fill); }
.tasks-page .tile.n-gris .tile-lvl i { background: var(--text-subtle); }
.tasks-page .tile-name { font-size: var(--t-lg); line-height: 22px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.tasks-page .tile-lvl { display: inline-flex; align-items: center; gap: 6px; font-size: var(--t-md); line-height: 18px; font-weight: 500; color: var(--lvl); }
.tasks-page .tile-lvl i { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.tasks-page .tile-big { margin-top: var(--s3); font-size: var(--t-4xl); font-weight: 700; line-height: 38px; letter-spacing: -.02em; color: var(--text); }
.tasks-page .tile-cap { font-size: var(--t-md); line-height: 18px; color: var(--text-muted); }
.tasks-page .tile-lines { display: flex; flex-direction: column; gap: 2px; margin-top: var(--s3); font-size: var(--t-md); line-height: 18px; color: var(--text-muted); }
.tasks-page .tile-lines > * { display: flex; align-items: center; gap: var(--s2); }
.tasks-page .tile-lines b { order: 2; margin-left: auto; font-size: var(--t-md); font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; }
.tasks-page .tile-lines .hot, .tasks-page .tile-lines .hot b { color: var(--danger); }
.tasks-page .tile-lines .val b { color: var(--accent-text); }
.tasks-page .tile-prog { margin-top: auto; padding-top: var(--s3); display: flex; flex-direction: column; gap: 6px; }
.tasks-page .tile-prog small { font-size: var(--t-sm); color: var(--text-muted); }
.tasks-page .tile-recap { display: flex; align-items: center; gap: var(--s3); flex-wrap: wrap; color: var(--text-muted); }
.tasks-page .tile-recap strong { font-size: var(--t-xl); font-weight: 600; color: var(--text); }
.tasks-page .task-group-title { display: flex; align-items: center; gap: var(--s2); margin: var(--s2) 0 var(--s2); font-size: var(--t-lg); line-height: 22px; font-weight: 600; color: var(--text); }
.tasks-page .task-group-title.late { color: var(--danger); }
.tasks-page .task-title { font-weight: 600; color: var(--text); text-decoration: none; }
.tasks-page a.task-title:hover { color: var(--accent-text); text-decoration: none; }
.tasks-page .tk-actions { white-space: nowrap; text-align: right; }
.tasks-page .tk-actions form { display: inline-block; margin-left: var(--s1); }
.tasks-page .tk-actions .btn.small { opacity: .7; transition: opacity var(--d-fast) var(--ease-in); }
.tasks-page tr:hover .tk-actions .btn.small, .tasks-page .tk-actions .btn.small:focus-visible { opacity: 1; }
.task-check { width: 22px; height: 22px; border-radius: 50%; border: 1.5px solid var(--border-strong); background: none; padding: 0; display: inline-grid; place-items: center; font-size: 12px; color: #fff; transition: border-color var(--d-fast) var(--ease-in), background var(--d-fast) var(--ease-in); }
.task-check:hover { border-color: var(--accent); background: var(--accent-soft); }
.task-check.done { background: var(--success-fill); border-color: var(--success-fill); }
.task-row.closed .task-title { color: var(--text-muted); text-decoration: line-through; }

/* ---------- 6. Mouvement ---------- */
@keyframes pop-in { from { opacity: 0; transform: translateY(-4px) scale(.98); } }
@keyframes toast-in { from { opacity: 0; transform: translate(-50%, 16px); } }
@keyframes rise { from { opacity: 0; transform: translateY(8px); } }
@keyframes shimmer { to { background-position: -200% 0; } }
@keyframes drain { from { width: 100%; } to { width: 0; } }
.main { animation: rise var(--d-slow) var(--ease-in); }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 1ms !important; animation-delay: 0ms !important; transition-duration: 1ms !important; }
  .theme-bg i, .uv-bg i { animation: none !important; }
}

/* ---------- 7. Téléphone et tablette ---------- */
@media (max-width: 900px) {
  body, body.nav-mini { --nav-w: 0px; }
  .nav, body.nav-mini .nav { position: fixed; z-index: 110; left: 0; top: 0; width: 280px; transform: translateX(-100%); transition: transform var(--d-slow) var(--ease-in); background: var(--surface-solid); }
  body.fond-anime .nav { background: var(--glass-bg); }
  body.nav-shown .nav { transform: none; box-shadow: var(--shadow-pop); }
  body.nav-mini .nav .nav-text, body.nav-mini .nav .nav-label, body.nav-mini .nav .brand-sub, body.nav-mini .nav .nav-block { display: initial; }
  body.nav-mini .nav-links a { justify-content: flex-start; padding: 0 var(--s3); }
  body.nav-mini .nav .brand-logo { max-width: 168px; }
  .nav-links a { min-height: 44px; }
  .nav-toggle { display: none; }
  .nav-open { display: inline-grid; place-items: center; width: 44px; height: 44px; margin-left: -10px; border: 0; border-radius: var(--r-sm); background: none; color: var(--text); }
  .nav-open .ico { width: 22px; height: 22px; stroke: currentColor; fill: none; stroke-width: 1.8; }
  .topbar { left: 0; padding: 0 var(--s4); gap: var(--s2); }
  .search-btn { min-width: 0; width: 44px; height: 44px; padding: 0; justify-content: center; background: none; margin-left: auto; }
  .search-btn span, .search-btn kbd, .user-id, .user-caret { display: none; }
  .user-chip > summary { height: 44px; padding: 0 var(--s1); }
  .main { padding: 68px var(--s4) var(--s12); gap: var(--s4); }
  h1 { font-size: var(--t-3xl); line-height: 34px; }
  .btn { height: 44px; } .btn.small { height: 44px; } .head .btn:not(.ghost):not(.small) { height: 44px; }
  .input, select.input, input[type=file] { height: 44px; } .input.small { height: 44px; }
  .seg a, .seg button { min-height: 40px; }
  .tasks-page .tiles { grid-template-columns: repeat(2, 1fr); gap: var(--s3); }
  .tasks-page a.tile { min-height: 220px; padding: var(--s4) var(--s3) var(--s3); }
  .tasks-page .tk-actions .btn.small { opacity: 1; }
  .drawer { top: auto; left: 0; right: 0; bottom: 0; width: 100%; height: 92vh; border-radius: var(--r-xl) var(--r-xl) 0 0; transform: translateY(100%); }
  .user-menu a, .user-menu button { min-height: 44px; }
}

/* ---------- 8. Ajouts structure ---------- */
.nav-toggle { margin-top: auto; }
.user-menu .ico { width: 16px; height: 16px; margin-right: var(--s3); flex-shrink: 0; stroke: currentColor; fill: none; stroke-width: 1.7; stroke-linecap: round; stroke-linejoin: round; color: var(--text-muted); }
.user-menu form { display: contents; }
.search-btn .ico, .cmdk-field .ico, .cmdk-item .ico { stroke-linecap: round; stroke-linejoin: round; }
.drawer-close .ico { width: 16px; height: 16px; stroke: currentColor; fill: none; stroke-width: 2; stroke-linecap: round; }
.drawer:focus { outline: none; }
.drawer-body .task-layout { display: flex; flex-direction: column; gap: var(--s5); }
.drawer-body .task-main, .drawer-body .task-side { display: flex; flex-direction: column; gap: var(--s5); min-width: 0; }
.drawer-body .two { display: grid; grid-template-columns: 1fr 1fr; gap: var(--s3); }
.drawer-foot .menu .pop { top: auto; bottom: calc(100% + var(--s2)); }
.drawer-foot > form { display: contents; }
.drawer-foot .menu .pop.drawer-pop, .drawer-foot .menu form.pop { display: flex; flex-direction: column; gap: var(--s2); padding: var(--s3); }
.main > .head { position: relative; z-index: 20; } /* les menus déroulants passent au-dessus du contenu */
