/* Adjoint IA Oltico · prototype responsive
   Mise en page : coque en flex (barre latérale | espace de travail | panneau discussion),
   vues pilotées par container queries sur <main>. Aucune couleur en dur hors des jetons. */

:root {
  /* Couleurs, clair */
  --bg: #ffffff;
  --bg-2: #f6f6f8;
  --surface: #ffffff;
  --surface-2: #f6f6f8;
  --tint: #f4f1fe;
  --tint-2: #f5f3ff;
  --grid: #ede9fe;
  --accent: #6d28d9;
  --accent-hover: #5b21b6;
  --accent-2: #8b5cf6;
  --accent-fg: #ffffff;
  --accent-soft-fg: #ede9fe;
  --accent-text: #6d28d9;
  --accent-text-strong: #5b21b6;
  --line-violet: #ddd6fe;
  --line-hover: #c4b5fd;
  --line: #ebe9f2;
  --line-soft: #f0eef5;
  --text: #111119;
  --text-2: #5b6170;
  --text-3: #6b7280;
  --text-on-tint: #3f3a52;
  --ok: #059669;
  --ok-text: #047857;
  --ok-bg: #ecfdf5;
  --ok-line: #a7f3d0;
  --danger: #dc2626;
  --danger-text: #b91c1c;
  --danger-bg: #fef2f2;
  --danger-line: #fecaca;
  --warn: #b45309;
  --warn-text: #92400e;
  --warn-bg: #fffbeb;
  --amber-bg: #fef3c7;
  --amber-line: #fcd34d;
  --amber-text: #78350f;
  --info-bg: #f3f4f6;
  --info-text: #374151;
  --blue-bg: #eff6ff;
  --blue-text: #1d4ed8;
  --teal-bg: #f0fdfa;
  --teal-text: #0f766e;
  --pink-bg: #fdf2f8;
  --pink-text: #9d174d;
  --rose-bg: #fff1f2;
  --rose-text: #9f1239;
  --stone-bg: #f5f5f4;
  --stone-text: #57534e;
  --slate-bg: #f1f5f9;
  --slate-text: #334155;
  --skeleton: #ebe8f3;
  --skeleton-hi: #f6f4fb;
  --scrim: rgba(17, 17, 25, 0.45);
  --toast-bg: #111119;
  --toast-fg: #ffffff;
  --toast-link: #c4b5fd;
  --switch-off: #c9c7d3;

  /* Typographie */
  --font-display: 'Schibsted Grotesk', 'Arial Narrow', system-ui, sans-serif;
  --font-body: 'Plus Jakarta Sans', 'Segoe UI', system-ui, sans-serif;
  --fs-xs: 12px;
  --fs-sm: 13px;
  --fs-base: 15px;
  --fs-md: 16px;
  --fs-lg: 18px;
  --fs-xl: 22px;
  --fs-2xl: clamp(26px, 1.4vw + 20px, 36px);
  --fs-num: 28px;

  /* Espacements, rayons, ombres */
  --s-1: 4px;
  --s-2: 8px;
  --s-3: 12px;
  --s-4: 16px;
  --s-5: 20px;
  --s-6: 24px;
  --s-7: 32px;
  --s-8: 40px;
  --r-sm: 8px;
  --r-md: 12px;
  --r-lg: 16px;
  --r-xl: 20px;
  --r-pill: 999px;
  --sh-1: 0 1px 2px rgba(17, 17, 25, 0.05);
  --sh-2: 0 10px 30px rgba(55, 20, 120, 0.08);
  --sh-3: 0 20px 50px rgba(17, 17, 25, 0.18);
  --sh-fab: 0 8px 24px rgba(109, 40, 217, 0.32), 0 2px 6px rgba(17, 17, 25, 0.12);

  /* Dimensions de la coque */
  --sidebar-w: 248px;
  --rail-w: 76px;
  --chat-w: 360px;
  --tabbar-h: 64px;
  --tap: 44px;
  --shell-max: 1600px;
}

@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #0f0f14; --bg-2: #0f0f14; --surface: #17171f; --surface-2: #1f1f2a; --tint: #2a2140; --tint-2: #221b36; --grid: #1f1b2e;
    --accent: #7c3aed; --accent-hover: #6d28d9; --accent-2: #a78bfa; --accent-fg: #ffffff; --accent-soft-fg: #ede9fe; --accent-text: #c4b5fd; --accent-text-strong: #ddd6fe;
    --line-violet: #4c3a7a; --line-hover: #6d5aa8; --line: #2a2a36; --line-soft: #22222c;
    --text: #ededf3; --text-2: #a9a9bd; --text-3: #9494a8; --text-on-tint: #ddd6fe;
    --ok: #34d399; --ok-text: #6ee7b7; --ok-bg: #0b2a20; --ok-line: #14532d;
    --danger: #f87171; --danger-text: #fca5a5; --danger-bg: #2a1215; --danger-line: #5c2328;
    --warn: #fbbf24; --warn-text: #fcd34d; --warn-bg: #2a1f08; --amber-bg: #3a2a0c; --amber-line: #6b4e12; --amber-text: #fde68a;
    --info-bg: #26262f; --info-text: #c9c9d6; --blue-bg: #172036; --blue-text: #93c5fd; --teal-bg: #0f2a28; --teal-text: #5eead4;
    --pink-bg: #2d1424; --pink-text: #f9a8d4; --rose-bg: #2d1418; --rose-text: #fda4af; --stone-bg: #24221f; --stone-text: #d6d3d1; --slate-bg: #1e2530; --slate-text: #cbd5e1;
    --skeleton: #24242f; --skeleton-hi: #2e2e3b; --scrim: rgba(0, 0, 0, 0.6); --toast-bg: #ededf3; --toast-fg: #111119; --toast-link: #6d28d9; --switch-off: #4a4a5a;
    --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4); --sh-2: 0 10px 30px rgba(0, 0, 0, 0.35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #0f0f14; --bg-2: #0f0f14; --surface: #17171f; --surface-2: #1f1f2a; --tint: #2a2140; --tint-2: #221b36; --grid: #1f1b2e;
  --accent: #7c3aed; --accent-hover: #6d28d9; --accent-2: #a78bfa; --accent-fg: #ffffff; --accent-soft-fg: #ede9fe; --accent-text: #c4b5fd; --accent-text-strong: #ddd6fe;
  --line-violet: #4c3a7a; --line-hover: #6d5aa8; --line: #2a2a36; --line-soft: #22222c;
  --text: #ededf3; --text-2: #a9a9bd; --text-3: #9494a8; --text-on-tint: #ddd6fe;
  --ok: #34d399; --ok-text: #6ee7b7; --ok-bg: #0b2a20; --ok-line: #14532d;
  --danger: #f87171; --danger-text: #fca5a5; --danger-bg: #2a1215; --danger-line: #5c2328;
  --warn: #fbbf24; --warn-text: #fcd34d; --warn-bg: #2a1f08; --amber-bg: #3a2a0c; --amber-line: #6b4e12; --amber-text: #fde68a;
  --info-bg: #26262f; --info-text: #c9c9d6; --blue-bg: #172036; --blue-text: #93c5fd; --teal-bg: #0f2a28; --teal-text: #5eead4;
  --pink-bg: #2d1424; --pink-text: #f9a8d4; --rose-bg: #2d1418; --rose-text: #fda4af; --stone-bg: #24221f; --stone-text: #d6d3d1; --slate-bg: #1e2530; --slate-text: #cbd5e1;
  --skeleton: #24242f; --skeleton-hi: #2e2e3b; --scrim: rgba(0, 0, 0, 0.6); --toast-bg: #ededf3; --toast-fg: #111119; --toast-link: #6d28d9; --switch-off: #4a4a5a;
  --sh-1: 0 1px 2px rgba(0, 0, 0, 0.4); --sh-2: 0 10px 30px rgba(0, 0, 0, 0.35);
  color-scheme: dark;
}

/* ---------- Base ---------- */
*, *::before, *::after { box-sizing: border-box; }
html, body, #app { height: 100%; }
body {
  margin: 0;
  background: var(--bg-2);
  color: var(--text);
  font-family: var(--font-body);
  font-size: var(--fs-base);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  overflow: hidden;
}
h1, h2, h3 { font-family: var(--font-display); margin: 0; letter-spacing: -0.015em; line-height: 1.15; text-wrap: balance; }
p { margin: 0; }
a { color: var(--accent-text); }
button, input, textarea, select { font: inherit; color: inherit; }
button { cursor: pointer; }
:focus-visible { outline: 2px solid var(--accent-2); outline-offset: 2px; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
.icon { width: 20px; height: 20px; flex-shrink: 0; fill: none; stroke: currentColor; stroke-width: 1.75; stroke-linecap: round; stroke-linejoin: round; }
.icon.sm { width: 14px; height: 14px; stroke-width: 2.1; }
.icon.xs { width: 12px; height: 12px; stroke-width: 2.3; }
.icon.lg { width: 24px; height: 24px; }
.num { font-variant-numeric: tabular-nums; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation-duration: 0.01ms !important; animation-iteration-count: 1 !important; transition-duration: 0.01ms !important; }
}

/* ---------- Coque ---------- */
.shell {
  height: 100%;
  max-width: var(--shell-max);
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  background: var(--bg-2);
  position: relative;
}
@media (min-width: 1601px) {
  body { background: var(--surface-2); }
  .shell { border-inline: 1px solid var(--line); }
}
.banner {
  flex-shrink: 0;
  display: flex; align-items: center; justify-content: center; gap: var(--s-2); flex-wrap: wrap;
  padding-block: 7px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  font-size: var(--fs-sm); font-weight: 700; text-align: center;
}
.banner.sim { background: var(--amber-bg); color: var(--amber-text); border-bottom: 1px solid var(--amber-line); padding-top: max(7px, env(safe-area-inset-top, 0px)); }
.banner.offline { background: var(--info-bg); color: var(--info-text); border-bottom: 1px solid var(--line); }
.banner.error { background: var(--danger-bg); color: var(--danger-text); border-bottom: 1px solid var(--danger-line); }
.banner .link { background: none; border: 0; color: inherit; text-decoration: underline; font-weight: 700; padding: 4px; min-height: 32px; }
.shell-row { flex: 1; min-height: 0; display: flex; }
.workspace { flex: 1; min-width: 0; display: flex; flex-direction: column; background: var(--bg-2); }
.main { flex: 1; min-height: 0; overflow-y: auto; overflow-x: hidden; container-type: inline-size; container-name: main; scroll-padding-bottom: 120px; }

/* Barre latérale */
.sidebar {
  width: var(--sidebar-w); flex-shrink: 0;
  background: var(--surface); border-right: 1px solid var(--line);
  display: flex; flex-direction: column; gap: var(--s-4);
  padding: var(--s-5) var(--s-4);
  overflow-y: auto;
}
.brand { display: flex; align-items: center; gap: 10px; min-height: 40px; padding: 0 6px; text-decoration: none; color: var(--text); }
.logo { width: 36px; height: 36px; border-radius: 10px; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; font-family: var(--font-display); font-weight: 800; font-size: 18px; flex-shrink: 0; }
.brand-text { display: flex; flex-direction: column; line-height: 1.15; }
.brand-text b { font-family: var(--font-display); font-size: 17px; }
.brand-text span { font-size: var(--fs-xs); color: var(--text-3); }
.nav-group { display: flex; flex-direction: column; gap: 2px; }
.nav-group-head { display: flex; align-items: center; justify-content: space-between; min-height: 28px; padding: 0 8px 0 12px; border: 0; background: none; color: var(--text-3); font-size: 11px; font-weight: 800; letter-spacing: 0.06em; text-transform: uppercase; }
.nav-group-head .icon { transition: transform .15s; }
.nav-group[data-collapsed="true"] .nav-group-head .icon { transform: rotate(-90deg); }
.nav-group[data-collapsed="true"] .nav-items { display: none; }
.nav-items { display: flex; flex-direction: column; gap: 2px; }
.nav-link { display: flex; align-items: center; gap: 12px; min-height: var(--tap); padding: 0 12px; border-radius: 10px; text-decoration: none; color: var(--text-2); font-weight: 500; position: relative; }
.nav-link:hover { background: var(--tint-2); color: var(--text); }
.nav-link[aria-current="page"] { background: var(--tint); color: var(--accent-text); font-weight: 700; }
.nav-label { flex: 1; }
.count { min-width: 22px; height: 22px; padding: 0 7px; border-radius: var(--r-pill); background: var(--line-soft); color: var(--text-2); font-size: var(--fs-xs); font-weight: 700; display: inline-flex; align-items: center; justify-content: center; font-variant-numeric: tabular-nums; }
.count.strong { background: var(--accent); color: var(--accent-fg); }
.count.danger { background: var(--danger); color: #ffffff; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: var(--s-2); }
.status-card { border: 1px solid var(--line); background: var(--surface-2); border-radius: var(--r-md); padding: var(--s-3); display: flex; flex-direction: column; gap: var(--s-2); font-size: var(--fs-sm); }
.profile { display: flex; align-items: center; gap: 10px; padding: 6px; }
.profile-text { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
.avatar { width: 36px; height: 36px; border-radius: 50%; display: grid; place-items: center; font-weight: 700; font-size: var(--fs-sm); flex-shrink: 0; background: var(--tint); color: var(--accent-text-strong); }
.avatar.lg { width: 52px; height: 52px; font-size: 17px; }
.dot { width: 8px; height: 8px; border-radius: 50%; display: inline-block; flex-shrink: 0; background: var(--ok); }
.dot.sorting { background: var(--accent-2); }
.dot.paused { background: var(--text-3); }
.sidebar .icon-btn.rail-toggle { display: none; }
.sidebar-scrim { display: none; }

/* Barre haute */
.topbar {
  flex-shrink: 0; display: flex; align-items: center; gap: var(--s-3);
  min-height: 64px; padding-block: 10px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  background: var(--surface); border-bottom: 1px solid var(--line);
}
.topbar .brand { display: none; padding: 0; }
.search { flex: 1; max-width: 560px; min-width: 0; display: flex; align-items: center; gap: 10px; height: var(--tap); padding: 0 12px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface-2); color: var(--text-3); }
.search input { flex: 1; min-width: 0; border: 0; background: transparent; outline: none; font-size: 14px; color: var(--text); }
.kbd { font-size: 11px; font-weight: 700; border: 1px solid var(--line); border-bottom-width: 2px; border-radius: 5px; padding: 1px 6px; color: var(--text-2); background: var(--surface); white-space: nowrap; }
.spacer { flex: 1; }
.status-pill { display: inline-flex; align-items: center; gap: 8px; min-height: 36px; padding: 0 14px; border-radius: var(--r-pill); font-size: var(--fs-sm); font-weight: 700; white-space: nowrap; background: var(--ok-bg); color: var(--ok-text); }
.status-pill.sorting { background: var(--tint); color: var(--accent-text-strong); }
.status-pill.paused { background: var(--info-bg); color: var(--info-text); }
.mini-progress { width: 56px; height: 4px; border-radius: 4px; background: var(--line-violet); overflow: hidden; }
.mini-progress span { display: block; height: 100%; background: var(--accent); }
.icon-btn { width: var(--tap); height: var(--tap); flex-shrink: 0; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--text); display: inline-grid; place-items: center; position: relative; text-decoration: none; }
.icon-btn:hover { border-color: var(--line-hover); }
.icon-btn[aria-pressed="true"] { background: var(--tint); color: var(--accent-text); border-color: var(--line-violet); }
.icon-btn .badge-dot { position: absolute; top: 9px; right: 10px; width: 8px; height: 8px; border-radius: 50%; background: var(--danger); border: 2px solid var(--surface); }

/* Panneau discussion */
.chatpanel { width: var(--chat-w); flex-shrink: 0; background: var(--surface); border-left: 1px solid var(--line); display: flex; flex-direction: column; min-height: 0; }
.chatpanel[hidden] { display: none; }

/* Barre d'onglets + bouton flottant */
.tabbar {
  display: none; flex-shrink: 0;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  background: var(--surface); border-top: 1px solid var(--line);
  padding-top: 6px; padding-bottom: max(8px, env(safe-area-inset-bottom, 0px));
  padding-left: env(safe-area-inset-left, 0px); padding-right: env(safe-area-inset-right, 0px);
}
.tab { display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 3px; min-height: 52px; text-decoration: none; color: var(--text-2); font-size: 11px; font-weight: 500; position: relative; }
.tab[aria-current="page"] { color: var(--accent-text); font-weight: 700; }
.tab .icon { width: 24px; height: 24px; }
.tab .count { position: absolute; top: 0; left: 50%; margin-left: 6px; min-width: 18px; height: 18px; padding: 0 5px; font-size: 11px; border: 2px solid var(--surface); }
.fab {
  display: none; position: fixed; z-index: 30;
  right: calc(16px + env(safe-area-inset-right, 0px));
  bottom: calc(var(--tabbar-h) + 28px + env(safe-area-inset-bottom, 0px));
  width: 60px; height: 60px; border-radius: 50%; border: 0;
  background: var(--accent); color: var(--accent-fg); box-shadow: var(--sh-fab);
  place-items: center; text-decoration: none;
}
.fab .icon { width: 28px; height: 28px; stroke-width: 1.8; }
.shell[data-route="valider"] .fab { bottom: calc(var(--tabbar-h) + 104px + env(safe-area-inset-bottom, 0px)); }

/* Téléphone */
@media (max-width: 639.98px) {
  .sidebar { display: none; }
  .chatpanel { display: none; }
  .tabbar { display: grid; }
  .fab { display: grid; }
  .topbar { min-height: 60px; padding-top: max(10px, env(safe-area-inset-top, 0px)); }
  .banner.sim ~ .shell-row .topbar { padding-top: 10px; }
  .topbar .brand { display: flex; }
  .topbar .search, .topbar .bell, .topbar .chat-toggle, .topbar .kbd { display: none; }
  .topbar .search-btn { display: inline-grid; }
  .status-pill { min-height: 32px; padding: 0 10px; font-size: var(--fs-xs); }
  body { font-size: var(--fs-md); }
  .shell[data-route="discussion"] .tabbar, .shell[data-route="discussion"] .fab, .shell[data-route="connexion"] .fab { display: none; }
}
.search-btn { display: none; }

/* Tablette */
@media (min-width: 640px) and (max-width: 1023.98px) {
  .sidebar { width: var(--rail-w); padding: var(--s-5) 14px; align-items: stretch; }
  .sidebar .brand-text, .sidebar .nav-label, .sidebar .nav-link .count:not(.strong), .sidebar .status-card, .sidebar .profile-text, .sidebar .nav-group-head { display: none; }
  .sidebar .nav-link { justify-content: center; padding: 0; }
  .sidebar .nav-link .count.strong { position: absolute; top: 4px; right: 4px; min-width: 18px; height: 18px; font-size: 11px; padding: 0 4px; }
  .sidebar .nav-group + .nav-group { border-top: 1px solid var(--line); padding-top: var(--s-2); }
  .sidebar .brand, .sidebar .profile { justify-content: center; padding: 0; }
  .sidebar .icon-btn.rail-toggle { display: inline-grid; align-self: center; }
  .shell[data-rail="open"] .sidebar {
    position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: var(--sidebar-w);
    padding-top: max(var(--s-5), env(safe-area-inset-top, 0px)); padding-left: max(var(--s-4), env(safe-area-inset-left, 0px));
    box-shadow: var(--sh-3); align-items: stretch;
  }
  .shell[data-rail="open"] .sidebar .brand-text, .shell[data-rail="open"] .sidebar .nav-label, .shell[data-rail="open"] .sidebar .nav-link .count, .shell[data-rail="open"] .sidebar .status-card, .shell[data-rail="open"] .sidebar .profile-text, .shell[data-rail="open"] .sidebar .nav-group-head { display: flex; }
  .shell[data-rail="open"] .sidebar .nav-link .count { display: inline-flex; position: static; }
  .shell[data-rail="open"] .sidebar .nav-link { justify-content: flex-start; padding: 0 12px; }
  .shell[data-rail="open"] .sidebar .brand, .shell[data-rail="open"] .sidebar .profile { justify-content: flex-start; padding: 0 6px; }
  .shell[data-rail="open"] .sidebar-scrim { display: block; position: fixed; inset: 0; z-index: 39; background: var(--scrim); border: 0; }
  .shell[data-rail="open"] .rail-placeholder { display: block; }
  .rail-placeholder { display: none; width: var(--rail-w); flex-shrink: 0; }
  .chatpanel { display: none; }
  .topbar .chat-toggle { display: none; }
  .fab { display: grid; bottom: calc(24px + env(safe-area-inset-bottom, 0px)); right: calc(24px + env(safe-area-inset-right, 0px)); }
  .shell[data-route="valider"] .fab { bottom: calc(100px + env(safe-area-inset-bottom, 0px)); }
  .shell[data-route="discussion"] .fab { display: none; }
}
@media (min-width: 1024px) {
  .rail-placeholder { display: none; }
  .fab { display: none; }
}

/* ---------- Mise en page des vues ---------- */
.page {
  max-width: 1200px; margin: 0 auto;
  padding-block: var(--s-6) 120px;
  padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: var(--s-5);
}
@container main (min-width: 640px) { .page { padding-left: 28px; padding-right: 28px; padding-bottom: 60px; } }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: var(--s-3); flex-wrap: wrap; }
.page-head h1 { font-size: var(--fs-2xl); font-weight: 800; }
.page-sub { color: var(--text-2); font-size: var(--fs-base); }
.section { display: flex; flex-direction: column; gap: var(--s-3); min-width: 0; }
.section-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--s-3); }
.section-head h2 { font-size: var(--fs-lg); font-weight: 700; }
.eyebrow { font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); }
.muted { color: var(--text-2); }
.small { font-size: var(--fs-sm); }
.grid-2 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-5); align-items: start; }
@container main (min-width: 760px) { .grid-2 { grid-template-columns: minmax(0, 1.5fr) minmax(0, 1fr); } }
.grid-2-even { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); align-items: start; }
@container main (min-width: 700px) { .grid-2-even { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
.grid-3 { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-4); align-items: start; }
@container main (min-width: 640px) { .grid-3 { grid-template-columns: repeat(2, minmax(0, 1fr)); } }
@container main (min-width: 980px) { .grid-3 { grid-template-columns: repeat(3, minmax(0, 1fr)); } }

/* Cartes et listes */
.card { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: var(--s-4); display: flex; flex-direction: column; gap: 10px; min-width: 0; }
.card.violet { border-color: var(--line-violet); }
.card.raised { box-shadow: var(--sh-2); border-color: var(--line-violet); }
.list { background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); display: flex; flex-direction: column; overflow: hidden; }
.list > * + * { border-top: 1px solid var(--line-soft); }
.row { display: flex; align-items: center; gap: var(--s-3); padding: 12px 14px; min-height: 52px; min-width: 0; }
.row-main { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.row-title { font-weight: 600; }
.row-sub { font-size: var(--fs-sm); color: var(--text-3); }
.time { font-family: var(--font-display); font-weight: 700; color: var(--accent-text); width: 50px; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.ellipsis { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.grid-bg { background-color: var(--tint-2); background-image: linear-gradient(var(--grid) 1px, transparent 1px), linear-gradient(90deg, var(--grid) 1px, transparent 1px); background-size: 22px 22px; }

/* Boutons */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; min-height: var(--tap); padding: 0 16px; border-radius: var(--r-md); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-weight: 700; font-size: 14px; text-decoration: none; white-space: nowrap; }
.btn:hover { border-color: var(--line-hover); }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.danger { color: var(--danger-text); }
.btn.danger-fill { background: var(--danger-bg); border-color: var(--danger-line); color: var(--danger-text); }
.btn.ok { background: var(--ok); border-color: var(--ok); color: #ffffff; }
.btn.ghost { border-color: transparent; background: transparent; color: var(--accent-text); }
.btn.big { min-height: 56px; border-radius: 14px; font-size: var(--fs-md); padding: 0 20px; }
.btn.block { width: 100%; }
.btn.sm { min-height: 36px; padding: 0 12px; font-size: var(--fs-sm); border-radius: 10px; }
.btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.btn-row { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.btn-row > .grow { flex: 1; }
.chip { display: inline-flex; align-items: center; gap: 6px; min-height: 38px; padding: 0 14px; border-radius: var(--r-pill); border: 1px solid var(--line); background: var(--surface); color: var(--text); font-size: 14px; font-weight: 600; white-space: nowrap; }
.chip[aria-pressed="true"], .chip[aria-selected="true"] { background: var(--text); border-color: var(--text); color: var(--bg); font-weight: 700; }
.chip.sm { min-height: 34px; padding: 0 10px; font-size: 13px; }
.chip .n { opacity: 0.75; font-size: var(--fs-xs); font-variant-numeric: tabular-nums; }
.chips { display: flex; gap: var(--s-2); flex-wrap: wrap; }
.chips.scroll { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; padding-bottom: 2px; }
.chips.scroll::-webkit-scrollbar { display: none; }
.seg { display: grid; grid-auto-flow: column; grid-auto-columns: minmax(0, 1fr); background: var(--surface-2); border: 1px solid var(--line); border-radius: var(--r-md); padding: 3px; gap: 2px; }
.seg button { min-height: 38px; min-width: 0; border: 0; border-radius: 9px; background: transparent; font-size: 13px; font-weight: 600; color: var(--text-2); padding: 0 8px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.seg button[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 700; box-shadow: var(--sh-1); }

/* Badges */
.badge { display: inline-flex; align-items: center; gap: 4px; font-size: var(--fs-xs); font-weight: 700; padding: 3px 8px; border-radius: 6px; white-space: nowrap; }
.pill { border-radius: var(--r-pill); }
.t-violet { background: var(--tint); color: var(--accent-text-strong); }
.t-blue { background: var(--blue-bg); color: var(--blue-text); }
.t-teal { background: var(--teal-bg); color: var(--teal-text); }
.t-slate { background: var(--slate-bg); color: var(--slate-text); }
.t-green { background: var(--ok-bg); color: var(--ok-text); }
.t-gray { background: var(--info-bg); color: var(--info-text); }
.t-stone { background: var(--stone-bg); color: var(--stone-text); }
.t-pink { background: var(--pink-bg); color: var(--pink-text); }
.t-rose { background: var(--rose-bg); color: var(--rose-text); }
.t-red { background: var(--danger-bg); color: var(--danger-text); }
.t-amber { background: var(--warn-bg); color: var(--warn-text); }
.t-amber-strong { background: var(--amber-bg); color: var(--amber-text); }
.conf { display: inline-flex; align-items: center; gap: 6px; font-size: var(--fs-xs); font-weight: 600; color: var(--text-2); }
.bars { display: inline-flex; align-items: flex-end; gap: 2px; }
.bars i { width: 3px; border-radius: 1px; background: var(--line-violet); display: block; }
.bars i:nth-child(1) { height: 6px; } .bars i:nth-child(2) { height: 9px; } .bars i:nth-child(3) { height: 12px; }
.bars i.on { background: var(--accent-2); }
.why { display: flex; gap: 8px; align-items: flex-start; font-size: 14px; color: var(--text-on-tint); background: var(--tint-2); border-radius: 10px; padding: 10px 12px; }
.why .icon { color: var(--accent-2); margin-top: 2px; }
.quote { background: var(--surface-2); border-radius: 10px; padding: 10px 12px; font-size: 14px; color: var(--text-2); }

/* Compteurs */
.counters { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: var(--s-3); }
@container main (min-width: 600px) { .counters { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.counter { text-align: left; text-decoration: none; color: var(--text); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 4px; min-height: 88px; }
.counter:hover { border-color: var(--line-hover); }
.counter b { font-family: var(--font-display); font-size: var(--fs-num); font-weight: 800; line-height: 1; font-variant-numeric: tabular-nums; display: flex; align-items: center; gap: 8px; }
.counter span { font-size: 14px; font-weight: 600; color: var(--text-2); }
.counter.primary { background: var(--accent); border-color: var(--accent); color: var(--accent-fg); }
.counter.primary span { color: var(--accent-soft-fg); }
.counter[aria-pressed="true"] { border-color: var(--line-hover); background: var(--tint-2); }
.c-red { color: var(--danger); } .c-green { color: var(--ok-text); } .c-violet { color: var(--accent-text); } .c-gray { color: var(--info-text); }

/* Aujourd'hui */
.hero { border: 1px solid var(--line-violet); border-radius: var(--r-xl); padding: var(--s-5); display: flex; flex-direction: column; gap: var(--s-4); }
.hero h1 { font-size: var(--fs-2xl); font-weight: 800; }
.summary { background: var(--surface); border: 1px solid var(--line-violet); border-radius: var(--r-lg); padding: var(--s-4); display: flex; gap: var(--s-3); align-items: flex-start; }
.summary p { flex: 1; font-size: var(--fs-md); line-height: 1.55; max-width: 66ch; }
.prio { flex-direction: row; align-items: flex-start; gap: var(--s-3); flex-wrap: wrap; }
.prio .row-main { gap: 3px; flex-basis: 200px; }
.prio .btn { align-self: center; }

/* À valider */
.approve { display: grid; grid-template-columns: minmax(0, 1fr); gap: 0; min-height: 100%; }
.approve-list { display: none; }
.approve-detail { min-width: 0; }
@container main (min-width: 760px) {
  .approve { grid-template-columns: minmax(280px, 360px) minmax(0, 1fr); height: 100%; }
  .approve-list { display: flex; flex-direction: column; border-right: 1px solid var(--line); background: var(--surface); min-height: 0; overflow-y: auto; }
  .approve-detail { overflow-y: auto; }
  .stack-only { display: none !important; }
}
.approve-list-head { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); border-bottom: 1px solid var(--line-soft); }
.approve-items { list-style: none; margin: 0; padding: var(--s-2); display: flex; flex-direction: column; gap: 4px; }
.approve-item { width: 100%; text-align: left; display: flex; gap: 12px; padding: 12px; border-radius: var(--r-md); border: 1px solid transparent; background: transparent; color: var(--text); }
.approve-item:hover { background: var(--surface-2); }
.approve-item[aria-current="true"] { background: var(--tint-2); border-color: var(--line-hover); }
.approve-item.done { opacity: 0.6; }
.type-ico { width: 34px; height: 34px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.bulk { display: flex; align-items: center; gap: 10px; background: var(--tint-2); border: 1px solid var(--line-violet); border-radius: var(--r-md); padding: 8px 10px 8px 12px; font-size: var(--fs-sm); font-weight: 600; color: var(--text-on-tint); }
.bulk span { flex: 1; }
.focus-wrap { max-width: 720px; margin: 0 auto; padding-block: var(--s-5) 140px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: var(--s-4); }
@container main (min-width: 760px) { .focus-wrap { padding-bottom: var(--s-7); } }
.progress { height: 4px; border-radius: 4px; background: var(--line-violet); overflow: hidden; }
.progress span { display: block; height: 100%; background: var(--accent); transition: width .3s; }
.action-card { background: var(--surface); border: 1px solid var(--line-violet); border-radius: var(--r-xl); box-shadow: var(--sh-2); padding: var(--s-4) var(--s-4) var(--s-5); display: flex; flex-direction: column; gap: 12px; touch-action: pan-y; position: relative; transition: transform .2s ease, opacity .2s ease; }
.action-card.dragging { transition: none; }
.action-card .stamp { position: absolute; top: 18px; padding: 4px 10px; border: 3px solid; border-radius: 8px; font-weight: 800; letter-spacing: 0.06em; font-size: 16px; opacity: 0; pointer-events: none; background: var(--surface); }
.action-card .stamp.yes { left: 18px; color: var(--ok-text); border-color: var(--ok); transform: rotate(-10deg); }
.action-card .stamp.no { right: 18px; color: var(--danger-text); border-color: var(--danger); transform: rotate(10deg); }
.card-top { display: flex; align-items: center; justify-content: space-between; gap: var(--s-2); flex-wrap: wrap; }
.kv { display: grid; grid-template-columns: max-content minmax(0, 1fr); gap: 6px 14px; font-size: 14px; margin: 0; }
.kv dt { color: var(--text-2); font-weight: 600; }
.kv dd { margin: 0; font-weight: 600; min-width: 0; overflow-wrap: anywhere; }
.draft { font-size: var(--fs-md); line-height: 1.6; white-space: pre-line; overflow-wrap: anywhere; }
textarea.field, input.field, select.field { width: 100%; border: 1.5px solid var(--line-hover); border-radius: var(--r-md); padding: 12px 14px; background: var(--surface); color: var(--text); font-size: var(--fs-md); line-height: 1.55; }
textarea.field { min-height: 180px; resize: vertical; }
input.field, select.field { min-height: var(--tap); padding-block: 0; }
.mini-list { list-style: none; margin: 0; padding: 0; border: 1px solid var(--line-soft); border-radius: var(--r-md); }
.mini-list li { display: flex; justify-content: space-between; gap: 12px; padding: 9px 12px; font-size: 14px; }
.mini-list li + li { border-top: 1px solid var(--line-soft); }
.actions-bar { position: sticky; bottom: 0; z-index: 2; display: flex; gap: var(--s-2); padding-block: var(--s-3); background: linear-gradient(to bottom, transparent, var(--bg-2) 30%); }
.actions-bar .btn { flex: 1; min-width: 0; padding: 0 10px; white-space: normal; line-height: 1.2; text-align: center; gap: 6px; }
@container main (max-width: 420px) { .actions-bar .btn:not(.primary) .icon { display: none; } }
.actions-bar .btn.primary { flex: 1.5; }
.swipe-hint { display: flex; justify-content: center; gap: 14px; font-size: var(--fs-xs); color: var(--text-3); }
@container main (min-width: 760px) { .swipe-hint { display: none; } }
.kbd-help { display: none; gap: 16px; justify-content: center; flex-wrap: wrap; font-size: var(--fs-xs); color: var(--text-2); }
@container main (min-width: 760px) { .kbd-help { display: flex; } }
.state-line { display: flex; align-items: center; gap: 6px; font-size: var(--fs-sm); font-weight: 700; }
.spinner { width: 14px; height: 14px; border-radius: 50%; border: 2.5px solid var(--line-violet); border-top-color: var(--accent); animation: spin .8s linear infinite; display: inline-block; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Boîte triée */
.inbox { display: grid; grid-template-columns: minmax(0, 1fr); height: 100%; }
.inbox-cats { display: none; }
.inbox-list { display: flex; flex-direction: column; min-height: 0; background: var(--surface); }
.inbox-detail { display: none; min-width: 0; overflow-y: auto; }
.inbox[data-detail="true"] .inbox-list { display: none; }
.inbox[data-detail="true"] .inbox-detail { display: block; }
@container main (min-width: 700px) {
  .inbox { grid-template-columns: minmax(300px, 380px) minmax(0, 1fr); }
  .inbox-list, .inbox[data-detail="true"] .inbox-list { display: flex; border-right: 1px solid var(--line); overflow-y: auto; }
  .inbox-detail { display: block; }
  .inbox-back { display: none !important; }
}
@container main (min-width: 820px) {
  .inbox { grid-template-columns: 180px minmax(260px, 320px) minmax(0, 1fr); }
  .inbox-cats { display: flex; flex-direction: column; gap: 2px; padding: var(--s-4) 10px; overflow-y: auto; border-right: 1px solid var(--line); }
  .inbox-chips-cats { display: none !important; }
}
.inbox-head { padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); border-bottom: 1px solid var(--line-soft); }
.cat-link { display: flex; align-items: center; gap: 10px; min-height: 38px; padding: 0 10px; border-radius: 9px; border: 0; background: transparent; color: var(--text-2); font-size: 14px; text-align: left; width: 100%; }
.cat-link[aria-pressed="true"] { background: var(--tint); color: var(--accent-text-strong); font-weight: 700; }
.cat-link .sw { width: 10px; height: 10px; border-radius: 3px; flex-shrink: 0; }
.cat-link .n { margin-left: auto; font-size: var(--fs-xs); color: var(--text-3); font-weight: 600; }
.mail-rows { list-style: none; margin: 0; padding: 0; }
.mail-row { display: flex; gap: 10px; padding: 12px 14px; border-bottom: 1px solid var(--line-soft); align-items: flex-start; }
.mail-row.unread { background: var(--tint-2); }
.mail-row[aria-current="true"] { box-shadow: inset 3px 0 0 var(--accent); background: var(--tint); }
.mail-row input[type="checkbox"] { width: 20px; height: 20px; accent-color: var(--accent); margin: 10px 0 0; flex-shrink: 0; }
.mail-open { flex: 1; min-width: 0; display: flex; gap: 10px; text-decoration: none; color: var(--text); background: none; border: 0; padding: 0; text-align: left; }
.av-wrap { position: relative; flex-shrink: 0; display: inline-block; line-height: 0; height: 36px; }
.src { position: absolute; right: -4px; bottom: -4px; width: 18px; height: 18px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line); display: grid; place-items: center; color: var(--text-2); }
.src.wa { color: var(--ok-text); }
.src .icon { width: 10px; height: 10px; stroke-width: 2.2; }
.mail-meta { display: flex; align-items: center; gap: 6px; min-width: 0; }
.mail-meta .from { flex: 1; min-width: 0; font-weight: 600; }
.mail-row.unread .from { font-weight: 800; }
.mail-tags { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 4px; }
.understood { background: var(--tint-2); border: 1px solid var(--line-violet); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; }
.mail-body { font-size: var(--fs-base); line-height: 1.65; max-width: 66ch; display: flex; flex-direction: column; gap: 10px; white-space: pre-line; }
.correct { background: var(--warn-bg); border: 1px solid var(--amber-line); border-radius: var(--r-lg); padding: 14px 16px; display: flex; flex-direction: column; gap: 10px; color: var(--text); }
.detail-pad { padding-block: var(--s-5) 120px; padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); display: flex; flex-direction: column; gap: var(--s-4); max-width: 820px; }
@container main (min-width: 700px) { .detail-pad { padding: var(--s-5) var(--s-6) var(--s-7); } }
.select-bar { display: flex; align-items: center; gap: 8px; padding: 8px 14px; background: var(--tint-2); border-bottom: 1px solid var(--line-violet); font-size: 14px; font-weight: 700; flex-wrap: wrap; }
.select-bar span { flex: 1; }

/* Relances */
.rel { display: grid; grid-template-columns: minmax(0, 1fr); height: 100%; }
.rel-detail { display: none; min-width: 0; }
.rel[data-detail="true"] .rel-list { display: none; }
.rel[data-detail="true"] .rel-detail { display: block; }
@container main (min-width: 820px) {
  .rel { grid-template-columns: minmax(0, 1fr) minmax(360px, 420px); }
  .rel-list, .rel[data-detail="true"] .rel-list { display: block; overflow-y: auto; }
  .rel-detail { display: block; overflow-y: auto; background: var(--surface); border-left: 1px solid var(--line); }
  .rel-back { display: none !important; }
}
.rel-cards { display: grid; grid-template-columns: minmax(0, 1fr); gap: var(--s-3); }
.rel-card { background: var(--surface); border: 1px solid var(--line); border-radius: 18px; padding: 14px; display: flex; flex-direction: column; gap: 10px; }
.rel-card[aria-current="true"] { border-color: var(--line-hover); box-shadow: var(--sh-2); }
.rel-card.replied { background: var(--ok-bg); border-color: var(--ok-line); }
.rel-who { display: flex; align-items: center; gap: 10px; text-decoration: none; color: var(--text); flex: 1; min-width: 0; background: none; border: 0; padding: 0; text-align: left; }
.frise { list-style: none; margin: 4px 0 0; padding: 0; display: flex; position: relative; }
.frise::before { content: ""; position: absolute; left: 12%; right: 12%; top: 6px; height: 2px; background: var(--line-violet); }
.frise li { flex: 1; display: flex; flex-direction: column; align-items: center; gap: 4px; text-align: center; position: relative; font-size: 11px; line-height: 1.25; color: var(--text-3); min-width: 0; }
.frise .pt { width: 14px; height: 14px; border-radius: 50%; background: var(--surface); }
.frise .done .pt { background: var(--accent); }
.frise .done { color: var(--text-2); font-weight: 600; }
.frise .now .pt { border: 3px solid var(--accent); }
.frise .now { color: var(--accent-text); font-weight: 800; }
.frise .next .pt { border: 2px dashed var(--text-3); }
.frise .late .pt { border: 3px solid var(--danger); }
.frise .late { color: var(--danger-text); font-weight: 800; }
.frise .reply .pt { background: var(--ok); }
.frise .reply { color: var(--ok-text); font-weight: 800; }
.rel-meta { display: flex; gap: 6px; flex-wrap: wrap; font-size: var(--fs-xs); font-weight: 600; }
.rel-meta span { background: var(--surface-2); border-radius: 6px; padding: 4px 8px; color: var(--text-2); }
.rel-foot { display: flex; align-items: center; gap: 8px; border-top: 1px solid var(--line-soft); padding-top: 10px; font-size: var(--fs-sm); flex-wrap: wrap; }
.rel-actions { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 6px; }
.go-all { display: flex; align-items: center; justify-content: center; gap: 10px; min-height: 60px; border-radius: var(--r-lg); border: 0; background: var(--accent); color: var(--accent-fg); text-align: left; box-shadow: 0 8px 24px rgba(109, 40, 217, 0.22); padding: 0 16px; width: 100%; }
.go-all span { display: flex; flex-direction: column; line-height: 1.25; }
.go-all b { font-size: var(--fs-md); }
.go-all small { font-size: var(--fs-xs); color: var(--accent-soft-fg); }
.timeline { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.timeline li { display: flex; gap: 10px; }
.bubble-in { background: var(--surface-2); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.bubble-out { background: var(--tint-2); border-radius: 12px; padding: 8px 12px; font-size: 14px; }
.ch-ico { width: 30px; height: 30px; border-radius: 50%; display: grid; place-items: center; flex-shrink: 0; }

/* Discussion */
.chat { display: flex; flex-direction: column; height: 100%; min-height: 0; }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--line); min-height: 64px; flex-shrink: 0; background: var(--surface); }
.chat-head b { font-family: var(--font-display); font-size: var(--fs-md); flex: 1; }
.chat-log { flex: 1; min-height: 0; overflow-y: auto; padding: var(--s-4); display: flex; flex-direction: column; gap: var(--s-3); }
.chat-inner { max-width: 760px; width: 100%; margin: 0 auto; display: flex; flex-direction: column; gap: var(--s-3); }
.msg-me { align-self: flex-end; max-width: 85%; background: var(--accent); color: var(--accent-fg); padding: 10px 14px; border-radius: 18px 18px 4px 18px; font-size: var(--fs-base); overflow-wrap: anywhere; }
.msg-bot { align-self: flex-start; max-width: 92%; display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.msg-bot .text { background: var(--surface); border: 1px solid var(--line); padding: 10px 14px; border-radius: 18px 18px 18px 4px; font-size: var(--fs-base); line-height: 1.5; }
.chatpanel .msg-bot .text { background: var(--surface-2); border-color: transparent; }
.typing { display: flex; align-items: center; gap: 10px; font-size: var(--fs-sm); color: var(--text-2); }
.typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--accent-2); display: inline-block; animation: blink 1.2s infinite; }
.typing i:nth-child(2) { animation-delay: .2s; } .typing i:nth-child(3) { animation-delay: .4s; }
@keyframes blink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }
.chat-foot { flex-shrink: 0; border-top: 1px solid var(--line); background: var(--surface); padding: 10px 12px; padding-bottom: max(10px, env(safe-area-inset-bottom, 0px)); display: flex; flex-direction: column; gap: 10px; }
.composer { display: flex; align-items: center; gap: 8px; border: 1.5px solid var(--line-hover); border-radius: 16px; padding: 6px 6px 6px 14px; background: var(--surface); max-width: 760px; width: 100%; margin: 0 auto; }
.composer input { flex: 1; min-width: 0; border: 0; outline: none; background: transparent; font-size: var(--fs-md); color: var(--text); min-height: 40px; }
.composer .icon-btn { border: 0; background: var(--tint); color: var(--accent-text); }
.composer .icon-btn.send { background: var(--accent); color: var(--accent-fg); }
.suggests { display: flex; gap: 6px; flex-wrap: wrap; max-width: 760px; width: 100%; margin: 0 auto; }
.suggests button { min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 1px solid var(--line-violet); background: var(--surface); color: var(--accent-text-strong); font-size: var(--fs-sm); font-weight: 600; }
.embed { background: var(--surface); border: 1px solid var(--line-violet); border-radius: 14px; padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.rec { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: var(--s-4); }
.wave { display: flex; align-items: center; gap: 3px; height: 44px; }
.wave i { width: 4px; border-radius: 2px; background: var(--accent); display: block; animation: wave 1s ease-in-out infinite; }
@keyframes wave { 0%, 100% { transform: scaleY(.5); } 50% { transform: scaleY(1); } }
.rec-btn { width: 76px; height: 76px; border-radius: 50%; border: 0; background: var(--accent); color: var(--accent-fg); display: grid; place-items: center; animation: pulse 1.4s infinite; }
@keyframes pulse { 0% { box-shadow: 0 0 0 0 rgba(109, 40, 217, .35); } 100% { box-shadow: 0 0 0 22px rgba(109, 40, 217, 0); } }

/* Règles, réglages */
.switch { width: 52px; height: 32px; border-radius: var(--r-pill); border: 0; background: var(--switch-off); position: relative; flex-shrink: 0; padding: 0; }
.switch::after { content: ""; position: absolute; top: 3px; left: 3px; width: 26px; height: 26px; border-radius: 50%; background: #ffffff; box-shadow: 0 1px 3px rgba(17, 17, 25, .25); transition: left .15s; }
.switch[aria-checked="true"] { background: var(--accent); }
.switch[aria-checked="true"]::after { left: 23px; }
.switch.warn[aria-checked="true"] { background: var(--warn); }
.rule { flex-direction: row; align-items: center; gap: var(--s-4); }
.rule.off { opacity: 0.65; }
.rule .row-main { gap: 4px; }
.setting-row { display: flex; align-items: center; justify-content: space-between; gap: var(--s-3); min-height: 52px; padding: 6px 14px; flex-wrap: wrap; }
.conn-ico { width: 40px; height: 40px; border-radius: 10px; display: grid; place-items: center; flex-shrink: 0; }
.bars-chart { display: flex; align-items: flex-end; gap: 4px; height: 56px; }
.bars-chart i { flex: 1; border-radius: 3px 3px 0 0; background: var(--line-hover); display: block; }
.bars-chart i.last { background: var(--accent); }

/* Plus */
.tiles { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 10px; }
@container main (min-width: 700px) { .tiles { grid-template-columns: repeat(4, minmax(0, 1fr)); } }
.tile { position: relative; min-height: 104px; padding: 12px; border-radius: var(--r-lg); border: 1px solid var(--line); background: var(--surface); text-decoration: none; color: var(--text); display: flex; flex-direction: column; justify-content: space-between; gap: 8px; font-weight: 700; font-size: 14px; }
.tile .ti { width: 40px; height: 40px; border-radius: 12px; background: var(--tint); color: var(--accent-text); display: grid; place-items: center; }
.tile.soon { border-style: dashed; color: var(--text-2); background: var(--surface-2); }
.tile.soon .ti { background: var(--info-bg); color: var(--text-3); }
.tile .tag { position: absolute; top: 10px; right: 10px; }

/* Connexion */
.login { min-height: 100%; display: grid; place-items: center; padding-block: var(--s-6); padding-left: max(16px, env(safe-area-inset-left, 0px)); padding-right: max(16px, env(safe-area-inset-right, 0px)); }
.login-card { width: 100%; max-width: 440px; background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-xl); overflow: hidden; box-shadow: var(--sh-2); }
.login-top { padding: var(--s-7) var(--s-6) var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); border-bottom: 1px solid var(--grid); }
.login-body { padding: var(--s-6); display: flex; flex-direction: column; gap: var(--s-4); }

/* Feuilles, dialogues, notifications */
.layer { position: fixed; inset: 0; z-index: 50; display: flex; align-items: flex-end; justify-content: center; }
.layer[hidden] { display: none; }
.scrim { position: absolute; inset: 0; background: var(--scrim); border: 0; }
.sheet {
  position: relative; width: 100%; max-width: 560px; max-height: 92%; overflow-y: auto;
  background: var(--surface); border-radius: 24px 24px 0 0;
  padding-top: 8px; padding-bottom: max(24px, env(safe-area-inset-bottom, 0px));
  padding-left: max(20px, env(safe-area-inset-left, 0px)); padding-right: max(20px, env(safe-area-inset-right, 0px));
  display: flex; flex-direction: column; gap: var(--s-4);
  animation: up .22s ease-out;
}
@media (min-width: 640px) {
  .layer { align-items: center; }
  .sheet { border-radius: var(--r-xl); padding: var(--s-6); box-shadow: var(--sh-3); }
  .sheet .grab { display: none; }
}
@keyframes up { from { transform: translateY(24px); opacity: 0; } to { transform: none; opacity: 1; } }
.grab { width: 40px; height: 5px; border-radius: 3px; background: var(--line-hover); align-self: center; }
.sheet h2 { font-size: var(--fs-xl); font-weight: 800; }
.choice { display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 0 14px; border-radius: var(--r-md); border: 1px solid var(--line); cursor: pointer; }
.choice input { width: 20px; height: 20px; accent-color: var(--accent); margin: 0; flex-shrink: 0; }
.choice:has(input:checked) { border-color: var(--line-hover); background: var(--tint-2); }
.slot-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px; }
.slot { min-height: 68px; border-radius: 14px; border: 1px solid var(--line); background: var(--surface); text-align: left; padding: 0 14px; display: flex; flex-direction: column; justify-content: center; gap: 2px; }
.slot[aria-checked="true"] { border: 2px solid var(--accent); background: var(--tint-2); }
.slot b { font-size: 15px; } .slot span { font-size: var(--fs-sm); color: var(--text-2); }
.toasts { position: fixed; z-index: 60; left: 50%; transform: translateX(-50%); bottom: calc(var(--tabbar-h) + 100px + env(safe-area-inset-bottom, 0px)); width: min(520px, calc(100% - 32px)); display: flex; flex-direction: column; gap: 8px; pointer-events: none; }
@media (min-width: 640px) { .toasts { bottom: calc(24px + env(safe-area-inset-bottom, 0px)); } }
.toast { pointer-events: auto; display: flex; align-items: center; gap: 12px; min-height: 52px; padding: 8px 8px 8px 14px; border-radius: 14px; background: var(--toast-bg); color: var(--toast-fg); box-shadow: var(--sh-3); font-size: 14px; font-weight: 600; animation: up .2s ease-out; }
.toast span { flex: 1; }
.toast button { background: none; border: 0; color: var(--toast-link); font-weight: 800; min-height: 40px; padding: 0 10px; }
.toast .ok-dot { width: 26px; height: 26px; border-radius: 50%; background: var(--ok); color: #ffffff; display: grid; place-items: center; flex-shrink: 0; }

/* Menu États du prototype */
.proto { position: relative; flex-shrink: 0; }
.proto.floating { position: fixed; z-index: 70; top: calc(12px + env(safe-area-inset-top, 0px)); right: calc(12px + env(safe-area-inset-right, 0px)); }
.proto > button { min-height: 36px; padding: 0 12px; border-radius: var(--r-pill); border: 1px dashed var(--text-3); background: var(--surface); color: var(--text-2); font-size: var(--fs-xs); font-weight: 800; letter-spacing: 0.04em; text-transform: uppercase; }
.proto-menu { position: absolute; z-index: 80; top: 44px; right: 0; width: min(260px, calc(100vw - 32px)); background: var(--surface); border: 1px solid var(--line); border-radius: var(--r-md); box-shadow: var(--sh-3); padding: 6px; display: flex; flex-direction: column; }
.proto-menu button { min-height: 40px; text-align: left; padding: 0 10px; border: 0; border-radius: 8px; background: none; font-size: 14px; display: flex; align-items: center; gap: 8px; }
.proto-menu button:hover { background: var(--surface-2); }
.proto-menu button[aria-checked="true"] { background: var(--tint); color: var(--accent-text-strong); font-weight: 700; }
.proto-menu p { font-size: var(--fs-xs); color: var(--text-3); padding: 6px 10px; }

/* États */
.skel { background: linear-gradient(90deg, var(--skeleton) 0, var(--skeleton-hi) 50%, var(--skeleton) 100%); background-size: 600px 100%; animation: sh 1.4s infinite linear; border-radius: 8px; display: block; }
@keyframes sh { from { background-position: -300px 0; } to { background-position: 300px 0; } }
.empty { border-radius: var(--r-xl); border: 1px solid var(--grid); padding: var(--s-8) var(--s-5); display: flex; flex-direction: column; align-items: center; text-align: center; gap: var(--s-3); }
.empty .bigcheck { width: 84px; height: 84px; border-radius: 50%; background: var(--surface); border: 1px solid var(--line-violet); display: grid; place-items: center; color: var(--ok); }
.empty h2 { font-size: var(--fs-xl); font-weight: 800; }
.empty p { max-width: 36ch; color: var(--text-2); }
.vol { background: var(--surface); border: 1px solid var(--line-violet); border-radius: var(--r-lg); padding: var(--s-4); display: flex; flex-direction: column; gap: 10px; }
.vol .progress { height: 10px; border-radius: 5px; }

/* Adjoint : sur téléphone, le bouton de discussion ne cache plus les cartes ni le bas des listes. */
@media (max-width: 639px) {
  .shell[data-route="valider"] .fab { display: none; }
  .main { padding-bottom: calc(96px + env(safe-area-inset-bottom, 0px)); }
}
