/* ═════════════════════════════════════════════════════════════════════════
   VELIA — Direction virtuelle (Marc, Sofia & Léo)
   Refonte 2026-07-21 : design « startup premium » (typo Space Grotesk/Inter,
   gradients d'accent par agent, surfaces verre, ombres teintées) + couche
   APP MOBILE (≤ 860px : app bar, tab bar basse, sidebar devenue tiroir —
   pilotée par public/mobile.js qui PROXIE les contrôles existants).

   RÈGLES STRUCTURELLES À NE JAMAIS CASSER (cf. CLAUDE.md) :
   - body[data-agent="…"] pilote les variables d'accent (bleu/teal/ambre) ;
   - .chat-form textarea / .chat-form button[type="submit"] : sélecteurs
     STRUCTURELS, jamais une liste d'ids par agent ;
   - les rétablissements [hidden] (.labo-form, .agent-panel, .sales-sync,
     .notif-panel, .attach-chips) car un display explicite écrase l'attribut ;
   - le plafond textarea 160px est DUPLIQUÉ en JS (wireChatInput) ;
   - l'offset -80 de jumpToReportStart suppose un .conv-header ~80px (desktop).
   ═════════════════════════════════════════════════════════════════════════ */

:root {
  --page: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #f6f7fa;
  --ink: #14161d;
  --ink-2: #474e5f;
  --muted: #7a8194;
  --hairline: #e8eaf0;
  --border: rgba(15, 23, 42, 0.08);

  /* Accent par défaut = Marc (bleu → indigo). Sofia/Léo surchargent via body[data-agent] */
  --accent: #2f5fe0;
  --accent-2: #6d5ef0;
  --accent-strong: #2450c4;
  --accent-soft: #e9eefc;
  --accent-ring: rgba(47, 95, 224, 0.25);
  --accent-grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --accent-glow: 0 8px 22px -8px color-mix(in srgb, var(--accent) 55%, transparent);

  --good: #12a150;
  --good-text: #0b7a3c;
  --good-soft: #e3f5ea;
  --warning: #d9880a;
  --warning-soft: #fcf1dc;
  --serious: #e0704a;
  --serious-soft: #fbe9e1;
  --critical: #d23b3b;
  --critical-soft: #fbe5e5;
  --navy: #222e46;

  --font: "Inter", -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  --font-display: "Space Grotesk", "Inter", -apple-system, sans-serif;

  --r-sm: 11px;
  --r: 16px;
  --r-lg: 20px;
  --shadow-sm: 0 1px 2px rgba(16, 24, 40, 0.05);
  --shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 8px 22px -8px rgba(16, 24, 40, 0.12);
  --shadow-lift: 0 2px 4px rgba(16, 24, 40, 0.06), 0 18px 40px -12px rgba(16, 24, 40, 0.18);

  --appbar-h: 58px;
  --tabbar-h: 60px;
}
body[data-agent="sofia"] {
  --accent: #0e9384;
  --accent-2: #0ea5c4;
  --accent-strong: #0b7568;
  --accent-soft: #e3f4f1;
  --accent-ring: rgba(14, 147, 132, 0.25);
}
body[data-agent="leo"] {
  --accent: #d97706;
  --accent-2: #ef5f2a;
  --accent-strong: #b45309;
  --accent-soft: #fdf0dd;
  --accent-ring: rgba(217, 119, 6, 0.25);
}

@media (prefers-color-scheme: dark) {
  :root {
    --page: #0b0d13;
    --surface: #14171f;
    --surface-2: #1b1f29;
    --ink: #f1f2f5;
    --ink-2: #b7bbc6;
    --muted: #848a99;
    --hairline: #252a36;
    --border: rgba(255, 255, 255, 0.08);

    --accent: #5b86f0;
    --accent-2: #8b7bf5;
    --accent-strong: #4a75e2;
    --accent-soft: #1b2540;
    --accent-ring: rgba(91, 134, 240, 0.35);
    --accent-glow: 0 8px 26px -8px color-mix(in srgb, var(--accent) 45%, transparent);

    --good: #2fbf6b;
    --good-text: #45cd7c;
    --good-soft: #14301f;
    --warning: #ecab35;
    --warning-soft: #33280f;
    --serious: #ec835a;
    --serious-soft: #392018;
    --critical: #e05656;
    --critical-soft: #3a1c1c;
    --navy: #34446b;

    --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.35);
    --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 10px 28px -8px rgba(0, 0, 0, 0.5);
    --shadow-lift: 0 2px 4px rgba(0, 0, 0, 0.4), 0 20px 44px -12px rgba(0, 0, 0, 0.6);
  }
  body[data-agent="sofia"] {
    --accent: #2fb8a6;
    --accent-2: #38bdd8;
    --accent-strong: #26a291;
    --accent-soft: #10312c;
    --accent-ring: rgba(47, 184, 166, 0.35);
  }
  body[data-agent="leo"] {
    --accent: #f0a13c;
    --accent-2: #f4783a;
    --accent-strong: #e08f27;
    --accent-soft: #382a12;
    --accent-ring: rgba(240, 161, 60, 0.35);
  }
}

/* Les tokens DÉRIVÉS de l'accent sont re-résolus au niveau du body : définis
   seulement sur :root, leurs var(--accent) seraient figés sur les couleurs de
   Marc (les custom properties résolvent leurs var() sur l'élément où elles
   sont déclarées — la surcharge body[data-agent] arrive trop bas). */
body {
  --accent-grad: linear-gradient(135deg, var(--accent), var(--accent-2));
  --accent-glow: 0 8px 22px -8px color-mix(in srgb, var(--accent) 52%, transparent);
}

/* ─── Base ─── */
* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  background:
    radial-gradient(1000px 640px at 88% -12%, color-mix(in srgb, var(--accent) 7%, transparent), transparent 62%),
    radial-gradient(820px 560px at -12% 108%, color-mix(in srgb, var(--accent-2) 5%, transparent), transparent 60%),
    var(--page);
  background-attachment: fixed;
  color: var(--ink);
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}
h1 {
  font-family: var(--font-display);
  font-size: 23px; margin: 0; letter-spacing: -0.02em; font-weight: 700;
}
button, input, select, textarea { font: inherit; }
button { cursor: pointer; }
::selection { background: var(--accent-soft); }

:is(button, input, select):focus-visible {
  outline: 3px solid var(--accent-ring);
  outline-offset: 1px;
  border-radius: var(--r-sm);
}

/* Barres de défilement discrètes */
* { scrollbar-width: thin; scrollbar-color: var(--hairline) transparent; }
*::-webkit-scrollbar { width: 8px; height: 8px; }
*::-webkit-scrollbar-thumb { background: var(--hairline); border-radius: 8px; }
*::-webkit-scrollbar-thumb:hover { background: var(--muted); }

/* ─── Layout ─── */
.layout { display: grid; grid-template-columns: 264px 1fr; min-height: 100vh; }

/* ─── Sidebar (desktop) — devient le TIROIR sur mobile (voir tout en bas) ─── */
.sidebar {
  background: color-mix(in srgb, var(--surface) 72%, transparent);
  -webkit-backdrop-filter: blur(18px);
  backdrop-filter: blur(18px);
  border-right: 1px solid var(--hairline);
  padding: 18px 16px;
  display: flex;
  flex-direction: column;
  gap: 18px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
}
@supports not (backdrop-filter: blur(18px)) { .sidebar { background: var(--surface); } }

/* Pastille de présence : TOUJOURS verte (l'agent est en ligne). L'humeur, c'est
   le badge (.mood-badge) et le halo de l'avatar — jamais cette pastille. */
.status-dot {
  position: absolute; right: -1px; bottom: -1px;
  width: 13px; height: 13px; border-radius: 50%;
  background: var(--good); border: 2.5px solid var(--surface);
  transition: background 0.3s;
}
.status-dot.lg { width: 18px; height: 18px; border-width: 3px; right: 1px; bottom: 1px; }

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-btn {
  position: relative;
  display: flex; align-items: center; gap: 11px;
  text-align: left; width: 100%;
  padding: 10px 12px; border: none; border-radius: var(--r-sm);
  background: transparent; color: var(--ink-2); font-weight: 550;
  transition: background 0.15s, color 0.15s;
}
.nav-btn span { font-size: 16px; }
.nav-btn:hover { background: var(--surface-2); color: var(--ink); }
.nav-btn.active { background: var(--accent-soft); color: var(--accent); font-weight: 700; }
.nav-btn.active::before {
  content: ""; position: absolute; left: -16px; top: 8px; bottom: 8px; width: 3px;
  border-radius: 0 3px 3px 0; background: var(--accent-grad);
}
.nav-btn em {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700;
  background: var(--accent-grad); color: #fff; border-radius: 20px; padding: 1px 7px; min-width: 18px; text-align: center;
}
.nav-btn em:empty { display: none; }
/* display explicite du badge → il écraserait l'attribut [hidden] : on le rétablit
   (même leçon que .labo-form[hidden] — les badges arrivent avec hidden + « 0 »). */
.nav-badge[hidden] { display: none; }
.home-btn {
  border: 1px solid var(--border);
  background: var(--surface);
  box-shadow: var(--shadow-sm);
  font-weight: 650;
}

.notif-toggle {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink-2);
  border-radius: var(--r-sm); padding: 10px 12px; text-align: left; display: flex; align-items: center; gap: 8px;
  transition: border-color 0.15s, color 0.15s;
}
.notif-toggle:hover { border-color: var(--muted); color: var(--ink); }
.notif-toggle em {
  margin-left: auto; font-style: normal; font-size: 11px; font-weight: 700;
  background: var(--critical); color: #fff; border-radius: 20px; padding: 1px 7px;
  animation: badge-pulse 2.4s ease-in-out infinite;
}
@keyframes badge-pulse { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.12); } }

.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 8px; }
.sidebar-foot select, #report-select {
  padding: 9px 10px; border-radius: var(--r-sm); border: 1px solid var(--border);
  background: var(--surface-2); color: var(--ink);
  transition: border-color 0.15s;
}
.sidebar-foot select:hover { border-color: var(--muted); }
#run-btn, #sales-run-btn, #leo-hunt-btn, #leo-outreach-btn, #leo-report-btn {
  background: var(--accent-grad);
  color: #fff; border: none; border-radius: var(--r-sm); padding: 11px; font-weight: 650;
  box-shadow: var(--accent-glow);
  transition: transform 0.15s, box-shadow 0.15s, opacity 0.15s, filter 0.15s;
}
#run-btn:hover:not(:disabled), #sales-run-btn:hover:not(:disabled),
#leo-hunt-btn:hover:not(:disabled), #leo-outreach-btn:hover:not(:disabled), #leo-report-btn:hover:not(:disabled) { transform: translateY(-1px); filter: brightness(1.06); }
#run-btn:active:not(:disabled), #sales-run-btn:active:not(:disabled),
#leo-hunt-btn:active:not(:disabled), #leo-outreach-btn:active:not(:disabled), #leo-report-btn:active:not(:disabled) { transform: translateY(0); }
#run-btn:disabled, #sales-run-btn:disabled,
#leo-hunt-btn:disabled, #leo-outreach-btn:disabled, #leo-report-btn:disabled { opacity: 0.55; cursor: wait; }

/* ─── Content ─── */
.content { padding: 26px 34px 60px; max-width: 1140px; width: 100%; margin: 0 auto; min-width: 0; }
.status-msg { color: var(--ink-2); }
.status-msg.error { color: var(--critical); }
.view { animation: view-in 0.28s cubic-bezier(.2, .8, .3, 1); }
@keyframes view-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.view-head { margin-bottom: 22px; }
.view-head p { margin: 6px 0 0; color: var(--ink-2); font-size: 14px; max-width: 62ch; }

/* ─── Portraits (photos générées, public/avatars/) ─── */
.marc-portrait { position: relative; flex-shrink: 0; width: 96px; height: 96px; }
.face-lg { display: block; border-radius: 50%; width: 96px; height: 96px; box-shadow: 0 4px 16px rgba(20, 28, 46, 0.3); }

.marc-avatar {
  display: block; border-radius: 50%; overflow: hidden; cursor: default;
  object-fit: cover; width: 100%; height: 100%;
  transition: box-shadow .3s ease, transform .2s ease;
}
/* Halo d'humeur autour du portrait (le détail est sur le badge .mood-badge) */
.marc-avatar.mood-confiant  { box-shadow: 0 0 0 2.5px var(--good-soft),    0 4px 16px rgba(20, 28, 46, 0.3); }
.marc-avatar.mood-vigilant  { box-shadow: 0 0 0 2.5px var(--warning-soft), 0 4px 16px rgba(20, 28, 46, 0.3); }
.marc-avatar.mood-preoccupe { box-shadow: 0 0 0 2.5px var(--serious-soft), 0 4px 16px rgba(20, 28, 46, 0.3); }
.marc-avatar.mood-alarme    { box-shadow: 0 0 0 2.5px var(--critical-soft), 0 4px 16px rgba(20, 28, 46, 0.3); }
.marc-avatar.is-thinking { animation: avatar-think 1.6s ease-in-out infinite; }
.marc-avatar.is-talking  { animation: avatar-talk .6s ease-in-out infinite; }
.marc-avatar.is-reacting { animation: avatar-react .5s ease; }
@keyframes avatar-think { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.12); } }
@keyframes avatar-talk  { 0%, 100% { transform: scale(1); } 50% { transform: scale(1.035); } }
@keyframes avatar-react { 0% { transform: scale(1); } 35% { transform: scale(1.07); } 100% { transform: scale(1); } }

.mood-badge {
  font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em;
  padding: 3px 10px; border-radius: 20px; background: var(--good-soft); color: var(--good-text);
  transition: background 0.3s, color 0.3s;
}
.mood-badge.mood-vigilant { background: var(--warning-soft); color: var(--warning); }
.mood-badge.mood-preoccupe { background: var(--serious-soft); color: var(--serious); }
.mood-badge.mood-alarme { background: var(--critical-soft); color: var(--critical); }

/* ─── Strip santé + objectifs (vue Chiffres) ─── */
.strip { display: grid; grid-template-columns: 224px 1fr; gap: 16px; margin-bottom: 18px; }
.health-card, .panel, .obj-mini {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--r); padding: 18px 20px; box-shadow: var(--shadow);
}
.health-label { display: block; font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .07em; font-weight: 700; }
.health-score { font-family: var(--font-display); font-size: 48px; font-weight: 700; line-height: 1.1; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.health-bar { height: 6px; border-radius: 4px; background: var(--hairline); overflow: hidden; margin-top: 8px; }
.health-bar-fill { height: 100%; border-radius: 4px; background: var(--good); transition: width .6s cubic-bezier(.2, .8, .3, 1); }

.obj-mini { display: grid; grid-template-columns: 1fr 1fr; gap: 14px 22px; align-content: center; }
.obj-item .obj-top { display: flex; justify-content: space-between; align-items: baseline; gap: 8px; }
.obj-item .obj-name { font-size: 12.5px; color: var(--ink-2); font-weight: 600; }
.obj-item .obj-val { font-size: 13px; font-variant-numeric: tabular-nums; }
.obj-item .obj-val b { font-size: 15px; }
.obj-track { height: 7px; border-radius: 5px; background: var(--hairline); overflow: hidden; margin-top: 6px; }
.obj-track > div { height: 100%; border-radius: 5px; transition: width .6s cubic-bezier(.2, .8, .3, 1); }
.st-atteint > div, .st-atteint .dot { background: var(--good); }
.st-en_bonne_voie > div, .st-en_bonne_voie .dot { background: #7cc00c; }
.st-a_risque > div, .st-a_risque .dot { background: var(--warning); }
.st-en_retard > div, .st-en_retard .dot { background: var(--critical); }
.st-inconnu > div { background: var(--muted); }

/* ─── KPI tiles ─── */
.kpi-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)); gap: 14px; margin-bottom: 18px; }
.kpi {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 15px 16px; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s, transform 0.2s, border-color 0.2s;
}
.kpi:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.kpi-label { font-size: 12px; color: var(--muted); font-weight: 550; }
.kpi-value { font-family: var(--font-display); font-size: 25px; font-weight: 700; margin: 3px 0; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.kpi-trend { font-size: 12px; font-weight: 650; }
.kpi-trend.good { color: var(--good-text); }
.kpi-trend.bad { color: var(--critical); }
.kpi-trend.neutral { color: var(--muted); }

/* ─── Panels ─── */
.panel { margin-bottom: 18px; }
.panel h2 { margin: 0 0 14px; font-size: 12px; color: var(--muted); font-weight: 700; text-transform: uppercase; letter-spacing: .08em; }
.two-col { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.two-col .panel { margin-bottom: 0; }

/* ─── Alerts ─── */
.alerts { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.alert { display: flex; gap: 10px; align-items: baseline; padding: 10px 12px; border-radius: var(--r-sm); border-left: 3px solid var(--muted); background: var(--surface-2); }
.alert .tag { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; white-space: nowrap; }
.alert.critique { border-left-color: var(--critical); } .alert.critique .tag { color: var(--critical); }
.alert.attention { border-left-color: var(--warning); } .alert.attention .tag { color: var(--warning); }
.alert.info { border-left-color: var(--accent); } .alert.info .tag { color: var(--accent); }
.alert-empty { color: var(--good-text); font-weight: 600; }

/* ─── Funnel ─── */
.funnel { display: flex; flex-direction: column; gap: 10px; }
.funnel-step { display: grid; grid-template-columns: 120px 1fr 64px; gap: 10px; align-items: center; }
.funnel-label { font-size: 13px; color: var(--ink-2); }
.funnel-bar { height: 20px; background: var(--hairline); border-radius: 7px; overflow: hidden; }
.funnel-bar-fill { height: 100%; background: var(--accent-grad); border-radius: 7px; transition: width .6s cubic-bezier(.2, .8, .3, 1); }
.funnel-value { font-variant-numeric: tabular-nums; font-weight: 650; text-align: right; font-size: 13.5px; }

/* ─── Tables ─── */
.table-wrap { overflow-x: auto; -webkit-overflow-scrolling: touch; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { padding: 9px 10px; text-align: left; border-bottom: 1px solid var(--hairline); }
th { color: var(--muted); font-weight: 650; font-size: 11px; text-transform: uppercase; letter-spacing: .05em; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
tbody tr { transition: background 0.12s; }
tbody tr:hover { background: var(--surface-2); }
tbody tr:last-child td { border-bottom: none; }
.report-meta { color: var(--muted); font-size: 12px; text-align: right; margin-top: 6px; }

/* ─── Verdicts par pub ─── */
.ad-name { font-weight: 600; }
.ads-note { color: var(--muted); font-size: 12px; margin: 10px 0 0; }
.verdict { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 9px; border-radius: 20px; cursor: default; }
.verdict.v-nourrir { background: var(--good-soft); color: var(--good-text); }
.verdict.v-garder { background: var(--accent-soft); color: var(--accent); }
.verdict.v-surveiller { background: var(--warning-soft); color: var(--warning); }
.verdict.v-couper { background: var(--critical-soft); color: var(--critical); }
.verdict.v-none { background: transparent; color: var(--muted); }
.ad-status { font-size: 12px; font-weight: 600; white-space: nowrap; }
.ad-status.live { color: var(--good-text); }
.ad-status.off { color: var(--muted); }

/* ─── Plan d'action ─── */
.plan-list { display: flex; flex-direction: column; gap: 14px; }
.mission {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 0; overflow: hidden; box-shadow: var(--shadow-sm);
  transition: box-shadow 0.2s;
}
.mission:hover { box-shadow: var(--shadow); }
.mission.done { opacity: .62; }
.mission-head { display: flex; gap: 14px; align-items: flex-start; padding: 16px 18px; cursor: pointer; }
.mission-order {
  flex-shrink: 0; width: 30px; height: 30px; border-radius: var(--r-sm);
  display: grid; place-items: center; font-weight: 800; font-size: 14px;
  background: var(--accent-grad); color: #fff;
}
.mission-main { flex: 1; min-width: 0; }
.mission-title { font-weight: 700; font-size: 15.5px; }
.mission.done .mission-title { text-decoration: line-through; }
.mission-meta { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 6px; }
.chip { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: 20px; background: var(--surface-2); border: 1px solid var(--border); color: var(--ink-2); }
.chip.prio-critique { background: var(--critical-soft); color: var(--critical); border-color: transparent; }
.chip.prio-haute { background: var(--warning-soft); color: var(--warning); border-color: transparent; }
.chip.prio-moyenne { background: var(--accent-soft); color: var(--accent); border-color: transparent; }
.chip.horizon { background: transparent; }
.mission-expand { color: var(--muted); font-size: 13px; flex-shrink: 0; }
.mission-body { padding: 0 18px 18px 62px; display: none; }
.mission.open .mission-body { display: block; }
.mission-steps { list-style: none; margin: 0 0 12px; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.mission-steps li { display: flex; gap: 10px; align-items: flex-start; }
.mission-steps input { margin-top: 3px; width: 16px; height: 16px; flex-shrink: 0; accent-color: var(--accent); }
.step-txt strong { display: block; font-size: 14px; }
.step-txt span { font-size: 13px; color: var(--ink-2); }
.mission-impact { font-size: 13px; color: var(--good-text); background: var(--surface-2); border-radius: 8px; padding: 8px 12px; }
.mission-impact b { color: var(--ink-2); }

/* ─── Bulles (base commune) + markdown rendu ─── */
.msg { max-width: 78%; padding: 11px 15px; border-radius: 16px; font-size: 15px; line-height: 1.5; white-space: pre-wrap; }
.msg.md { white-space: normal; overflow-wrap: break-word; }
.msg.md p { margin: 0 0 8px; }
.msg.md ul, .msg.md ol { margin: 0 0 8px; padding-left: 20px; }
.msg.md li { margin: 3px 0; }
.msg.md p:last-child, .msg.md ul:last-child, .msg.md ol:last-child { margin-bottom: 0; }
.msg.md .md-h { font-weight: 700; margin: 10px 0 6px; }
.msg.md .md-h:first-child { margin-top: 0; }
.msg.md code { background: var(--surface-2); border: 1px solid var(--border); padding: 1px 5px; border-radius: 5px; font-size: 13px; }
.msg.md a { color: var(--accent); }
.msg.user { align-self: flex-end; background: var(--accent-grad); color: #fff; border-bottom-right-radius: 5px; }
.msg.marc { align-self: flex-start; background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; box-shadow: var(--shadow-sm); }
.msg.marc.typing { color: var(--muted); font-style: italic; }

@keyframes typing-pulse { 0%, 100% { opacity: 0.55; } 50% { opacity: 1; } }

/* ─── Settings ─── */
.settings-form { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 18px; align-items: start; }
fieldset { border: 1px solid var(--border); border-radius: var(--r); padding: 18px 20px; background: var(--surface); box-shadow: var(--shadow); }
legend { font-weight: 700; font-size: 14px; padding: 0 6px; }
.settings-form label { display: block; font-size: 13px; color: var(--ink-2); margin-bottom: 14px; }
.settings-form label small { color: var(--muted); }
.settings-form input {
  display: block; width: 100%; margin-top: 5px; padding: 10px 12px; border-radius: var(--r-sm);
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
  transition: border-color 0.15s, box-shadow 0.15s;
}
.settings-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.field-hint { font-size: 12.5px; color: var(--accent); background: var(--accent-soft); padding: 8px 11px; border-radius: var(--r-sm); margin: 0; }
.settings-actions { grid-column: 1 / -1; display: flex; align-items: center; gap: 14px; }
.settings-actions button {
  background: var(--accent-grad); color: #fff; border: none;
  border-radius: var(--r-sm); padding: 12px 24px; font-weight: 650; box-shadow: var(--accent-glow);
  transition: transform 0.15s, filter 0.15s;
}
.settings-actions button:hover { transform: translateY(-1px); filter: brightness(1.06); }
.saved-msg { color: var(--good-text); font-weight: 600; font-size: 13px; }

/* ─── Notifications panel ─── */
.notif-panel {
  position: fixed; top: 0; right: 0; width: 380px; max-width: 92vw; height: 100vh; height: 100dvh;
  background: var(--surface); border-left: 1px solid var(--hairline); z-index: 80;
  box-shadow: -12px 0 40px rgba(0, 0, 0, 0.18); display: flex; flex-direction: column;
  animation: notif-in 0.24s cubic-bezier(.2, .8, .3, 1);
}
@keyframes notif-in { from { transform: translateX(28px); opacity: 0; } to { transform: none; opacity: 1; } }
.notif-panel[hidden] { display: none; }
.notif-head { display: flex; align-items: center; justify-content: space-between; padding: 18px 20px; border-bottom: 1px solid var(--hairline); }
.notif-head strong { font-family: var(--font-display); }
.notif-head button { border: none; background: transparent; font-size: 18px; color: var(--muted); border-radius: 8px; padding: 4px 10px; }
.notif-head button:hover { background: var(--surface-2); color: var(--ink); }
.notif-push { padding: 12px 14px; border-bottom: 1px solid var(--hairline); display: flex; flex-direction: column; gap: 8px; }
.notif-push[hidden] { display: none; }
.notif-push button {
  border: 1px solid var(--border); background: var(--surface-2); color: var(--ink);
  border-radius: 10px; padding: 9px 12px; font-weight: 600; font-size: 13px; cursor: pointer;
}
.notif-push button:hover { border-color: var(--accent); }
.notif-push button[hidden] { display: none; }
.notif-push-status { font-size: 12px; color: var(--muted); line-height: 1.45; }
.notif-push-status:empty { display: none; }
.notif-list { overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 12px; }
.notif { border: 1px solid var(--border); border-radius: var(--r-sm); padding: 13px 15px; border-left: 3px solid var(--muted); background: var(--surface); }
.notif.urgent { border-left-color: var(--critical); }
.notif.attention { border-left-color: var(--warning); }
.notif.info { border-left-color: var(--accent); }
.notif-when { font-size: 11px; color: var(--muted); text-transform: uppercase; letter-spacing: .04em; }
.notif-headline { font-weight: 600; margin: 4px 0 8px; }
.notif-action { font-size: 13px; background: var(--surface-2); border-radius: 8px; padding: 8px 10px; margin-top: 6px; }
.notif-action b { display: block; }
.notif-action span { color: var(--ink-2); }
.notif-empty { color: var(--muted); text-align: center; padding: 30px; }
.notif.expandable { cursor: pointer; }
.notif.expandable:hover { border-color: var(--muted); }
.notif-more { font-size: 12px; color: var(--accent); font-weight: 600; margin-top: 2px; }
.notif-detail { font-size: 13px; color: var(--ink-2); margin: 4px 0 6px; white-space: pre-wrap; line-height: 1.5; }

/* ═════════ Conversation (Marc, Sofia & Léo) ═════════ */
.conv-wrap { max-width: 780px; margin: 0 auto; }
.conv-header {
  display: flex; align-items: center; gap: 14px;
  padding: 10px 2px 14px; border-bottom: 1px solid var(--hairline); margin-bottom: 18px;
  position: sticky; top: 0; z-index: 5;
  background: color-mix(in srgb, var(--page) 78%, transparent);
  -webkit-backdrop-filter: blur(12px);
  backdrop-filter: blur(12px);
}
@supports not (backdrop-filter: blur(12px)) {
  .conv-header { background: var(--page); }
}
.conv-header .marc-portrait { width: 56px; height: 56px; flex-shrink: 0; }
.conv-header .face-lg { width: 56px; height: 56px; }
.conv-header .status-dot.lg { width: 15px; height: 15px; }
.conv-id { line-height: 1.3; }
.conv-id strong { font-family: var(--font-display); font-size: 18px; display: block; letter-spacing: -0.01em; }
.conv-status { font-size: 12.5px; color: var(--muted); }
.conv-header .mood-badge { margin-left: auto; }

.conv-thread { display: flex; flex-direction: column; gap: 13px; min-height: 42vh; padding-bottom: 8px; }
.conv-thread .msg {
  max-width: 82%; padding: 13px 17px; border-radius: var(--r-lg); font-size: 15.5px; line-height: 1.58; white-space: pre-wrap;
  animation: msg-in 0.24s cubic-bezier(.2, .8, .3, 1) backwards;
}
@keyframes msg-in { from { opacity: 0; transform: translateY(7px); } to { opacity: 1; transform: none; } }
.conv-thread .msg.marc {
  align-self: flex-start; background: var(--surface); border: 1px solid var(--border);
  border-bottom-left-radius: 6px; box-shadow: var(--shadow-sm);
}
.conv-thread .msg.user {
  align-self: flex-end; background: var(--accent-grad);
  color: #fff; border-bottom-right-radius: 6px; box-shadow: var(--accent-glow);
}
.conv-thread .msg.typing, .msg.marc.typing { color: var(--muted); font-style: italic; animation: typing-pulse 1.6s ease-in-out infinite; }

/* Bulles de travail autonome (l'agent a bossé pendant l'absence du gérant) */
.msg.autonome { border-left: 3px solid var(--accent); }
.msg.autonome::before {
  content: "🌙 pendant ton absence";
  display: block; font-size: 11px; font-weight: 700; text-transform: uppercase;
  letter-spacing: .04em; color: var(--muted); margin-bottom: 4px;
}

/* ─── Cartes dans le fil ─── */
.todo-card {
  align-self: flex-start; max-width: 90%;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r-lg); border-bottom-left-radius: 6px; padding: 16px 18px; box-shadow: var(--shadow-sm);
  animation: msg-in 0.24s cubic-bezier(.2, .8, .3, 1) backwards;
}
.todo-title { font-weight: 700; margin-bottom: 12px; font-size: 15.5px; }
.todo-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 11px; }
.todo-item { display: flex; gap: 11px; align-items: flex-start; }
.todo-item input { margin-top: 2px; width: 19px; height: 19px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.todo-txt { font-size: 15px; }
.todo-txt b { font-weight: 600; }
.todo-n { color: var(--muted); font-weight: 700; }
.todo-detail { color: var(--ink-2); font-size: 13.5px; font-style: normal; }
.todo-item.done .todo-txt { text-decoration: line-through; opacity: .55; }
.todo-more { margin-top: 13px; background: transparent; border: none; color: var(--accent); font-weight: 600; padding: 0; font-size: 13.5px; }
.todo-more:hover { text-decoration: underline; }

.mem-note {
  align-self: center; font-size: 12px; color: var(--muted); background: var(--surface-2);
  border: 1px dashed var(--border); border-radius: 20px; padding: 5px 14px;
  animation: msg-in 0.3s ease backwards;
}
.mem-note.todo-added { color: var(--accent); border-color: var(--accent); }

/* Carte créa (prompt IA prêt à coller) */
.crea-card {
  align-self: flex-start; max-width: 92%;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r-lg); border-bottom-left-radius: 6px; padding: 15px 17px; box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 8px;
  animation: msg-in 0.24s cubic-bezier(.2, .8, .3, 1) backwards;
}
.crea-head { display: flex; align-items: center; gap: 9px; }
.crea-n { font-weight: 700; font-size: 14.5px; }
.crea-fmt { font-size: 10.5px; font-weight: 700; letter-spacing: .05em; text-transform: uppercase; color: var(--accent); background: var(--surface-2); border: 1px solid var(--border); border-radius: 20px; padding: 2px 9px; }
.crea-concept { font-weight: 600; font-size: 15px; }
.crea-meta { font-size: 12.5px; color: var(--muted); }
.crea-label { font-size: 11.5px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; color: var(--ink-2); margin-top: 4px; }
.crea-dialogue { font-size: 14.5px; font-style: italic; background: var(--surface-2); border-radius: var(--r-sm); padding: 9px 12px; }
.crea-prompt { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.5; white-space: pre-wrap; word-break: break-word; background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 11px 13px; margin: 0; max-height: 320px; overflow-y: auto; }
.crea-copy { align-self: flex-start; background: var(--accent-grad); color: #fff; border: none; border-radius: 20px; padding: 7px 15px; font-size: 13px; font-weight: 600; cursor: pointer; transition: transform 0.15s, filter 0.15s; }
.crea-copy:hover { transform: translateY(-1px); filter: brightness(1.06); }
.crea-why { font-size: 12.5px; color: var(--muted); margin-top: 2px; }

/* ─── Onglet To-do : badge + vue liste ─── */
.nav-badge { display: inline-grid; place-items: center; min-width: 18px; height: 18px; padding: 0 5px; margin-left: 4px; border-radius: 9px; background: var(--accent-grad); color: #fff; font-size: 11px; font-weight: 700; font-style: normal; }
.todo-add { display: flex; gap: 10px; margin-bottom: 18px; }
.todo-add input { flex: 1; padding: 12px 16px; border-radius: var(--r-sm); border: 1px solid var(--border); background: var(--surface); color: var(--ink); transition: border-color 0.15s, box-shadow 0.15s; }
.todo-add input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.todo-add button { padding: 0 20px; border-radius: var(--r-sm); border: none; background: var(--accent-grad); color: #fff; font-weight: 650; cursor: pointer; box-shadow: var(--accent-glow); }
.todos-empty { color: var(--muted); font-size: 14px; padding: 8px 0; }
.todos-group-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 18px 0 8px; }
.todos-group-title:first-child { margin-top: 0; }
.todo-row { display: flex; align-items: flex-start; gap: 12px; padding: 13px 15px; background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm); margin-bottom: 8px; box-shadow: var(--shadow-sm); transition: box-shadow 0.15s; }
.todo-row:hover { box-shadow: var(--shadow); }
.todo-row input[type="checkbox"] { margin-top: 2px; width: 20px; height: 20px; accent-color: var(--accent); flex-shrink: 0; cursor: pointer; }
.todo-row-txt { flex: 1; }
.todo-row-txt b { font-weight: 600; font-size: 15px; }
.todo-row-txt em { display: block; font-style: normal; font-size: 13px; color: var(--muted); margin-top: 2px; }
.todo-row.done .todo-row-txt b { text-decoration: line-through; opacity: .55; }
.todo-del { background: transparent; border: none; color: var(--muted); font-size: 15px; cursor: pointer; padding: 2px 6px; border-radius: 6px; flex-shrink: 0; }
.todo-del:hover { color: var(--critical); background: var(--surface-2); }

/* ─── Formulaire de chat (posé en bas, translucide) ─── */
.chat-form {
  display: flex; flex-wrap: wrap; align-items: flex-end; gap: 10px; position: sticky; bottom: 0;
  background: color-mix(in srgb, var(--page) 82%, transparent);
  -webkit-backdrop-filter: blur(14px);
  backdrop-filter: blur(14px);
  padding: 12px 0 14px;
}
@supports not (backdrop-filter: blur(14px)) {
  .chat-form { background: var(--page); }
}
/* Sélecteurs STRUCTURELS (pas une liste d'ids) : tout agent avec un .chat-form est
   stylé d'office — Léo était resté brut car son id manquait dans l'ancienne liste. */
.chat-form textarea {
  flex: 1; padding: 13px 18px; border-radius: 24px; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink); box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, box-shadow 0.15s;
  /* textarea auto-extensible : la hauteur est pilotée en JS, plafonnée puis ça scrolle */
  font: inherit; font-size: 15px; line-height: 1.45;
  resize: none; overflow-y: auto; max-height: 160px;
}
.chat-form textarea:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.chat-form button[type="submit"] {
  width: 46px; height: 46px; border-radius: 50%;
  background: var(--accent-grad);
  color: #fff; border: none; font-size: 16px; flex-shrink: 0; display: grid; place-items: center;
  box-shadow: var(--accent-glow);
  transition: transform 0.15s, filter 0.15s, opacity 0.15s;
}
.chat-form button[type="submit"]:hover:not(:disabled) { transform: translateY(-1px) scale(1.04); filter: brightness(1.08); }
.chat-form button[type="submit"]:disabled { opacity: .5; }

/* ─── Pièces jointes du chat (📎, chips de prévisualisation, glisser-déposer) ─── */
.attach-btn {
  width: 46px; height: 46px; border-radius: 50%; border: 1px solid var(--border);
  background: var(--surface); color: var(--ink-2); font-size: 17px; flex-shrink: 0;
  display: grid; place-items: center; box-shadow: var(--shadow-sm);
  transition: border-color 0.15s, color 0.15s, transform 0.15s;
}
.attach-btn:hover { border-color: var(--accent); color: var(--accent); transform: translateY(-1px); }
.attach-chips { flex-basis: 100%; display: flex; flex-wrap: wrap; gap: 8px; padding-bottom: 2px; }
.attach-chips[hidden] { display: none; }
.attach-chip {
  display: inline-flex; align-items: center; gap: 7px; max-width: 240px;
  background: var(--surface); border: 1px solid var(--border); border-radius: 14px;
  padding: 4px 6px 4px 4px; font-size: 12px; box-shadow: var(--shadow-sm);
}
.attach-chip img { width: 34px; height: 34px; object-fit: cover; border-radius: 10px; }
.attach-chip .chip-icon { font-size: 17px; padding-left: 4px; }
.attach-chip .chip-name { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; color: var(--ink-2); }
.attach-chip button { border: none; background: transparent; color: var(--muted); font-size: 13px; padding: 2px 4px; cursor: pointer; }
.attach-chip button:hover { color: var(--critical); }
.chat-form.drag textarea { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }

/* Pièces jointes affichées DANS une bulle du fil */
.msg .msg-atts { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 8px; }
.msg .msg-atts img { max-width: 220px; max-height: 180px; border-radius: 10px; display: block; cursor: zoom-in; }
.msg .att-doc {
  display: inline-flex; align-items: center; gap: 6px; font-size: 12px;
  background: rgba(127, 127, 127, 0.14); border-radius: 10px; padding: 5px 9px;
}

/* ─── Agenda (RDV du gérant avec ses agents) ─── */
.agenda-list { display: flex; flex-direction: column; gap: 10px; max-width: 860px; }
.agenda-section-title { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: .05em; color: var(--muted); margin-top: 10px; }
.agenda-card {
  display: flex; align-items: center; gap: 12px; flex-wrap: wrap;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r-sm);
  border-left: 3px solid var(--muted); padding: 12px 14px; box-shadow: var(--shadow-sm);
}
.agenda-card.due { border-left-color: var(--warning); }
.agenda-card.fait { opacity: .55; }
.agenda-date { min-width: 96px; font-weight: 700; font-size: 13px; }
.agenda-agent { font-size: 12px; font-weight: 700; padding: 2px 10px; border-radius: 12px; background: var(--surface-2); }
/* Couleurs FIXES par agent (cette vue montre les 3 à la fois) */
.agenda-agent.marc { color: #2563eb; }
.agenda-agent.sofia { color: #0d9488; }
.agenda-agent.leo { color: #d97706; }
@media (prefers-color-scheme: dark) {
  .agenda-agent.marc { color: #5b86f0; }
  .agenda-agent.sofia { color: #2fb8a6; }
  .agenda-agent.leo { color: #f0a13c; }
}
.agenda-body { flex: 1; min-width: 200px; }
.agenda-sujet { font-weight: 600; }
.agenda-pourquoi { font-size: 12px; color: var(--ink-2); }
.agenda-actions { display: flex; gap: 6px; align-items: center; }
.agenda-empty { color: var(--muted); padding: 24px 4px; }

/* ─── Équipe : sélecteur d'agent ─── */
.team-label { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin-bottom: -8px; }
.agent-switch { display: flex; flex-direction: column; gap: 6px; }
.agent-pill {
  position: relative; display: flex; align-items: center; gap: 10px;
  padding: 8px 10px; border-radius: 14px; border: 1px solid transparent;
  background: transparent; text-align: left; width: 100%;
  transition: background .15s, border-color .15s, box-shadow .15s;
}
.agent-pill:hover { background: var(--surface-2); }
.agent-pill.active { background: var(--accent-soft); border-color: color-mix(in srgb, var(--accent) 45%, transparent); box-shadow: var(--shadow-sm); }
.agent-face { width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0; box-shadow: 0 1px 4px rgba(0, 0, 0, .18); object-fit: cover; }
.agent-pill.active .agent-face { box-shadow: 0 0 0 2px var(--accent), 0 1px 4px rgba(0, 0, 0, .18); }
.agent-id { display: flex; flex-direction: column; line-height: 1.2; min-width: 0; }
.agent-id strong { font-size: 15px; }
.agent-id small { font-size: 11px; color: var(--muted); }
.agent-pill .agent-dot { right: 6px; bottom: 4px; }
.agent-panel { display: flex; flex-direction: column; gap: 18px; }
.agent-panel[hidden] { display: none; }

/* ─── Sofia : carte priorités dans le fil ─── */
.sofia-priorities {
  align-self: flex-start; max-width: 92%;
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: 12px; padding: 12px 14px; box-shadow: var(--shadow-sm);
  animation: msg-in 0.24s cubic-bezier(.2, .8, .3, 1) backwards;
}
.sofia-priorities ul { margin: 8px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 6px; }
.sofia-priorities li { font-size: 14px; }

/* ─── Vue Commerciaux ─── */
.sales-sync {
  background: var(--accent-soft); color: var(--ink);
  border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r-sm); padding: 10px 14px; margin-bottom: 18px;
  font-size: 13.5px; line-height: 1.5;
}
.sales-sync[hidden] { display: none; }

.sales-strip { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 14px; margin-bottom: 20px; }
.sales-strip .kpi-val { display: block; font-family: var(--font-display); font-size: 24px; font-weight: 700; margin-top: 3px; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
.rep-cards { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }
.rep-card {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 16px 18px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 10px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.rep-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.rep-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; }
.rep-head strong { font-family: var(--font-display); font-size: 16px; }
.rep-verdict { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .03em; padding: 2px 9px; border-radius: 20px; }
.rep-verdict.v-excellent, .rep-verdict.v-bon { background: var(--good-soft); color: var(--good-text); }
.rep-verdict.v-moyen { background: var(--warning-soft); color: var(--warning); }
.rep-verdict.v-faible { background: var(--serious-soft); color: var(--serious); }
.rep-verdict.v-alerte { background: var(--critical-soft); color: var(--critical); }
.rep-kpi { font-size: 13px; color: var(--ink-2); font-weight: 600; background: var(--surface-2); border-radius: 8px; padding: 7px 10px; }
.rep-block span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; }
.rep-block.good span { color: var(--good-text); }
.rep-block.bad span { color: var(--critical); }
.rep-block ul { margin: 5px 0 0; padding-left: 18px; display: flex; flex-direction: column; gap: 4px; }
.rep-block li { font-size: 13.5px; line-height: 1.45; }
.rep-say { background: var(--accent-soft); border-radius: var(--r-sm); padding: 10px 12px; }
.rep-say span { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: .04em; color: var(--accent); }
.rep-say p { margin: 5px 0 0; font-size: 14px; line-height: 1.5; font-style: italic; }

/* ═════════ LE SIÈGE — plateau d'accueil (bâtiment, bureaux, open-space) ═════════
   Scène « bureau réaliste » en pur CSS : ciel des fenêtres piloté par l'heure de
   Paris (data-daypart sur #office), cloisons vitrées, écrans qui luisent. */

.office {
  --sky-a: #aecdf1; --sky-b: #dfeafa; --ambient: rgba(255, 255, 255, 0);
  border-radius: var(--r-lg);
  overflow: hidden;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lift);
  background: var(--surface);
}
.office[data-daypart="matin"] { --sky-a: #f6b26b; --sky-b: #fbe3c0; --ambient: rgba(246, 178, 107, 0.05); }
.office[data-daypart="jour"]  { --sky-a: #8fbcf0; --sky-b: #e3effc; --ambient: rgba(143, 188, 240, 0.04); }
.office[data-daypart="soir"]  { --sky-a: #d97b52; --sky-b: #6b5a8e; --ambient: rgba(217, 123, 82, 0.06); }
.office[data-daypart="nuit"]  { --sky-a: #1b2540; --sky-b: #33406b; --ambient: rgba(27, 37, 64, 0.10); }

.office-topbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 16px 22px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.06), rgba(0, 0, 0, 0.05)),
    linear-gradient(180deg, var(--navy), color-mix(in srgb, var(--navy) 82%, #000));
  color: #eef1f7;
}
.office-logo {
  font-family: var(--font-display);
  font-weight: 700; letter-spacing: 0.24em; font-size: 19px;
  background: linear-gradient(180deg, #fff, #b9c3d8);
  -webkit-background-clip: text; background-clip: text; color: transparent;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.35);
}
.office-sub { display: block; font-size: 11px; letter-spacing: 0.08em; text-transform: uppercase; color: #9daac4; }
.office-clock { text-align: right; line-height: 1.3; }
.office-clock b { font-family: var(--font-display); font-size: 21px; font-variant-numeric: tabular-nums; letter-spacing: 0.02em; }
.office-clock span { display: block; font-size: 11.5px; color: #b6c0d6; text-transform: capitalize; }
.office-daypart { margin-top: 1px; }

.office-floor {
  padding: 22px;
  display: flex; flex-direction: column; gap: 18px;
  background:
    linear-gradient(var(--ambient), var(--ambient)),
    radial-gradient(120% 60% at 50% 0%, color-mix(in srgb, var(--sky-b) 16%, transparent), transparent 60%),
    repeating-linear-gradient(90deg, transparent 0 118px, rgba(127, 127, 127, 0.06) 118px 120px),
    repeating-linear-gradient(0deg, transparent 0 118px, rgba(127, 127, 127, 0.05) 118px 120px),
    var(--surface-2);
}

.team-zone {
  position: relative;
  border: 1px solid color-mix(in srgb, var(--accent) 26%, var(--border));
  border-radius: var(--r-lg);
  padding: 16px;
  background:
    linear-gradient(165deg, rgba(255, 255, 255, 0.05), transparent 40%),
    color-mix(in srgb, var(--surface) 88%, transparent);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.05), var(--shadow);
}
.team-plaque {
  display: flex; align-items: center; justify-content: space-between; gap: 14px; flex-wrap: wrap;
  margin-bottom: 14px; padding: 10px 14px;
  border-radius: var(--r-sm);
  background: linear-gradient(180deg, color-mix(in srgb, var(--navy) 92%, #fff), var(--navy));
  color: #edf0f6;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.18), 0 2px 6px rgba(0, 0, 0, 0.18);
}
.team-plaque-etch b { display: block; letter-spacing: 0.12em; font-size: 13.5px; }
.team-plaque-etch span { display: block; font-size: 11px; color: #aab5cd; margin-top: 1px; }
.team-plaque-stats { display: flex; gap: 16px; }
.team-plaque-stats span { text-align: right; line-height: 1.2; }
.team-plaque-stats em { display: block; font-style: normal; font-size: 10px; text-transform: uppercase; letter-spacing: 0.06em; color: #9daac4; }
.team-plaque-stats b { font-size: 15px; font-variant-numeric: tabular-nums; }

.offices-row { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; }
@media (max-width: 1100px) and (min-width: 861px) { .offices-row { grid-template-columns: 1fr 1fr; } }
.office-room {
  position: relative; overflow: hidden; cursor: pointer;
  border: 1px solid var(--border); border-radius: var(--r);
  padding: 14px 16px 12px;
  background: linear-gradient(180deg, color-mix(in srgb, var(--sky-b) 7%, var(--surface)), var(--surface) 55%);
  box-shadow: var(--shadow-sm);
  transition: transform 0.18s, box-shadow 0.18s, border-color 0.18s;
}
.office-room:hover, .office-room:focus-visible {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
  border-color: color-mix(in srgb, var(--accent) 45%, var(--border));
}
.office-room:hover .room-enter, .office-room:focus-visible .room-enter { opacity: 1; transform: none; }
.room-window {
  position: absolute; top: 10px; right: 12px; width: 84px; height: 46px;
  border-radius: 6px; border: 2px solid color-mix(in srgb, var(--ink) 18%, transparent);
  background: linear-gradient(180deg, var(--sky-a), var(--sky-b));
  box-shadow: inset 0 0 8px rgba(255, 255, 255, 0.25);
}
.room-window::after {
  content: ""; position: absolute; inset: 0;
  background:
    linear-gradient(90deg, transparent calc(50% - 1px), rgba(0, 0, 0, 0.22) calc(50% - 1px) calc(50% + 1px), transparent calc(50% + 1px)),
    linear-gradient(120deg, rgba(255, 255, 255, 0.35) 8%, transparent 30%);
}
.office[data-daypart="nuit"] .room-window {
  box-shadow: inset 0 0 10px rgba(255, 255, 255, 0.06);
  background:
    radial-gradient(1.5px 1.5px at 20% 30%, #fff, transparent 60%),
    radial-gradient(1px 1px at 65% 20%, #fff, transparent 60%),
    radial-gradient(1.2px 1.2px at 82% 55%, #dfe6ff, transparent 60%),
    linear-gradient(180deg, var(--sky-a), var(--sky-b));
}
.room-door {
  display: inline-block; margin-bottom: 10px; padding: 3px 10px;
  border-radius: 5px; font-size: 10px; font-weight: 800; letter-spacing: 0.1em;
  color: color-mix(in srgb, var(--ink) 72%, transparent);
  background: linear-gradient(180deg, color-mix(in srgb, var(--ink) 9%, transparent), color-mix(in srgb, var(--ink) 4%, transparent));
  border: 1px solid var(--border);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.25);
}
.room-scene { display: flex; align-items: flex-end; gap: 14px; margin-bottom: 10px; }
.room-avatar { position: relative; width: 74px; height: 74px; flex-shrink: 0; }
.room-face { width: 74px; height: 74px; border-radius: 50%; display: block; box-shadow: 0 4px 12px rgba(16, 24, 40, 0.28); object-fit: cover; }
.room-avatar .status-dot { width: 15px; height: 15px; animation: presence-pulse 2.6s ease-in-out infinite; }
@keyframes presence-pulse { 0%, 100% { box-shadow: 0 0 0 0 rgba(18, 161, 80, 0.45); } 55% { box-shadow: 0 0 0 6px rgba(18, 161, 80, 0); } }
.room-screen {
  flex: 1; height: 52px; max-width: 190px;
  border-radius: 7px 7px 3px 3px; padding: 8px 9px 6px;
  display: flex; flex-direction: column; justify-content: center; gap: 5px;
  background: linear-gradient(180deg, #10131c, #1a1f2e);
  border: 2px solid color-mix(in srgb, var(--ink) 24%, transparent);
  border-bottom-width: 6px;
  box-shadow: 0 6px 14px -6px rgba(0, 0, 0, 0.4);
  animation: screen-glow 5.5s ease-in-out infinite;
}
.room-screen i { display: block; height: 6px; border-radius: 3px; background: var(--accent); opacity: 0.9; transition: width 0.6s cubic-bezier(.2, .8, .3, 1); }
.room-screen i + i { opacity: 0.45; }
@keyframes screen-glow { 0%, 100% { filter: brightness(1); } 50% { filter: brightness(1.18); } }
.room-plant { font-size: 22px; align-self: flex-end; filter: drop-shadow(0 3px 3px rgba(0, 0, 0, 0.18)); }
.room-id { line-height: 1.35; margin-bottom: 8px; }
.room-id strong { font-family: var(--font-display); font-size: 16.5px; display: flex; align-items: center; gap: 8px; }
.room-badge { font-style: normal; font-size: 11px; font-weight: 700; color: var(--critical); background: var(--critical-soft); border-radius: 20px; padding: 1px 8px; animation: badge-pulse 2.4s ease-in-out infinite; font-family: var(--font); }
.room-id > span { display: block; font-size: 12px; color: var(--muted); }
.room-status { display: block; font-style: normal; font-size: 12px; color: var(--ink-2); margin-top: 3px; }
.room-kpis { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; min-height: 20px; }
.room-kpi {
  display: inline-flex; align-items: baseline; gap: 6px;
  font-size: 12px; padding: 3px 9px; border-radius: 16px;
  background: var(--surface-2); border: 1px solid var(--border);
}
.room-kpi em { font-style: normal; color: var(--muted); font-size: 10.5px; text-transform: uppercase; letter-spacing: 0.04em; }
.room-kpi b { font-variant-numeric: tabular-nums; }
.room-enter {
  display: inline-block; font-size: 13px; font-weight: 650; color: var(--accent);
  opacity: 0.55; transform: translateX(-3px);
  transition: opacity 0.18s, transform 0.18s;
}
/* Sofia et Léo : leur pièce garde son accent (teal / ambre), quel que soit l'agent courant */
.room-sofia { --accent: #0e9384; --accent-strong: #0b7568; }
.room-leo { --accent: #d97706; --accent-strong: #b45309; }
@media (prefers-color-scheme: dark) {
  .room-sofia { --accent: #2fb8a6; --accent-strong: #26a291; }
  .room-leo { --accent: #f0a13c; --accent-strong: #e08f27; }
}

/* ── Vue Vivier (la pile de prospection de Léo) ── */
.vivier-filters { display: flex; gap: 10px; margin: 14px 0; flex-wrap: wrap; }
.vivier-filters select, .vivier-filters input {
  padding: 9px 12px; border: 1px solid var(--hairline); border-radius: var(--r-sm);
  background: var(--surface); color: var(--ink); font: inherit; font-size: 13.5px;
}
.vivier-filters input { flex: 1; min-width: 220px; }
.vivier-filters select:focus-visible, .vivier-filters input:focus-visible {
  outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring);
}
#vivier-table small { color: var(--muted); }

/* ── Open-space des commerciaux ── */
.openspace { margin-top: 14px; border-top: 1px dashed var(--hairline); padding-top: 12px; }
.openspace-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 10px; }
.openspace-head b { font-size: 12px; text-transform: uppercase; letter-spacing: 0.07em; color: var(--muted); }
.openspace-head span { font-size: 11.5px; color: var(--muted); }
.desk-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 10px; }
.desk {
  position: relative;
  border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 10px 12px 12px;
  background: linear-gradient(180deg, var(--surface), var(--surface-2));
  box-shadow: var(--shadow-sm);
  display: flex; flex-direction: column; gap: 4px;
  transition: transform 0.15s, box-shadow 0.15s;
}
.desk:hover { transform: translateY(-1px); box-shadow: var(--shadow); }
.desk-avatar {
  position: relative; width: 40px; height: 40px; border-radius: 50%;
  display: grid; place-items: center; font-size: 13px; font-weight: 800; color: #fff;
  background: linear-gradient(160deg, hsl(var(--hue, 210) 46% 52%), hsl(var(--hue, 210) 52% 38%));
  box-shadow: 0 2px 6px rgba(16, 24, 40, 0.25);
  margin-bottom: 2px;
}
.desk-dot {
  position: absolute; right: -2px; bottom: -2px; width: 11px; height: 11px; border-radius: 50%;
  background: var(--good); border: 2px solid var(--surface);
}
.desk.away .desk-dot { background: var(--muted); }
.desk b { font-size: 13.5px; line-height: 1.25; }
.desk-verdict { align-self: flex-start; font-size: 10px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.04em; padding: 1px 7px; border-radius: 14px; }
.desk-verdict.v-excellent, .desk-verdict.v-bon { background: var(--good-soft); color: var(--good-text); }
.desk-verdict.v-moyen { background: var(--warning-soft); color: var(--warning); }
.desk-verdict.v-faible { background: var(--serious-soft); color: var(--serious); }
.desk-verdict.v-alerte { background: var(--critical-soft); color: var(--critical); }
.desk-stats { font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; }
.desk-screen {
  height: 4px; border-radius: 2px; margin-top: 4px;
  background: linear-gradient(90deg, var(--accent), transparent 80%);
  opacity: 0.5; animation: screen-glow 6s ease-in-out infinite;
}
.desk.away .desk-screen { opacity: 0.15; animation: none; }
.desk-empty { color: var(--muted); font-size: 13px; grid-column: 1 / -1; margin: 4px 0; }

.team-doorplate {
  margin-top: 12px; font-size: 11.5px; color: var(--ink-2);
  border: 1px dashed var(--border); border-radius: var(--r-sm);
  padding: 7px 11px; background: color-mix(in srgb, var(--surface-2) 70%, transparent);
}

.team-zone.vacant {
  border-style: dashed;
  border-color: var(--hairline);
  background:
    repeating-linear-gradient(45deg, transparent 0 14px, rgba(127, 127, 127, 0.05) 14px 16px),
    color-mix(in srgb, var(--surface) 55%, transparent);
  box-shadow: none;
}
.vacant-inner { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; color: var(--muted); padding: 4px 2px; }
.vacant-icon { font-size: 24px; }
.vacant-inner b { color: var(--ink-2); }
.vacant-inner span:last-child { font-size: 12.5px; flex-basis: 100%; }
@media (min-width: 861px) { .vacant-inner span:last-child { flex-basis: auto; } }

/* ═════════ Labo — carnet d'expériences ═════════ */
#labo-strip .sales-stat {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  padding: 12px 14px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 2px;
}
#labo-strip .sales-stat b { font-family: var(--font-display); font-size: 24px; font-weight: 700; letter-spacing: -0.02em; font-variant-numeric: tabular-nums; }
#labo-strip .sales-stat span { color: var(--muted); font-size: 13px; }
#labo-strip .sales-stat.warn b { color: var(--warning); }
#labo-strip .sales-stat.good b { color: var(--good-text); }

.labo-new { margin: 4px 0 18px; }
.labo-add {
  background: var(--accent-grad); color: #fff; border: none; border-radius: var(--r-sm);
  padding: 9px 15px; font-size: 14px; font-weight: 600; cursor: pointer;
  box-shadow: var(--accent-glow);
  transition: transform 0.15s, filter 0.15s;
}
.labo-add:hover { transform: translateY(-1px); filter: brightness(1.06); }
.labo-ghost {
  background: transparent; color: var(--muted); border: 1px solid var(--border); border-radius: var(--r-sm);
  padding: 7px 13px; font-size: 13px; font-weight: 600; cursor: pointer; transition: color 0.15s, border-color 0.15s;
}
.labo-ghost:hover { color: var(--ink); border-color: var(--muted); }
.labo-del:hover { color: var(--critical); border-color: var(--critical); }

.labo-form { display: flex; flex-direction: column; gap: 10px; margin-top: 12px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r); padding: 16px; box-shadow: var(--shadow-sm); }
/* Une règle display: explicite l'emporterait sur l'attribut [hidden] du HTML — on le rétablit. */
.labo-form[hidden] { display: none; }
.labo-form-row { display: flex; gap: 10px; flex-wrap: wrap; }
.labo-form input, .labo-form select {
  flex: 1; min-width: 160px; padding: 10px 12px; font-size: 14px; color: var(--ink);
  background: var(--page); border: 1px solid var(--border); border-radius: var(--r-sm);
}
.labo-form input[type="number"] { flex: 0 0 90px; min-width: 0; }
.labo-form input:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-ring); }
.labo-form-actions { display: flex; gap: 10px; }

.labo-list { display: flex; flex-direction: column; gap: 12px; }
.labo-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--muted); border-radius: var(--r);
  padding: 14px 16px; box-shadow: var(--shadow-sm); display: flex; flex-direction: column; gap: 9px;
  transition: box-shadow 0.2s, transform 0.2s;
}
.labo-card:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.labo-card.labo-encours { border-left-color: var(--accent); }
.labo-card.labo-confirme { border-left-color: var(--good); }
.labo-card.labo-infirme { border-left-color: var(--critical); }
.labo-card.labo-due { border-left-color: var(--warning); background: var(--warning-soft); }

.labo-card-top { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.labo-status { font-size: 12px; font-weight: 700; padding: 3px 9px; border-radius: 999px; background: var(--accent-soft); color: var(--accent-strong); }
.labo-status.confirme { background: var(--good-soft); color: var(--good-text); }
.labo-status.infirme { background: var(--critical-soft); color: var(--critical); }
.labo-status.neutre { background: var(--hairline); color: var(--muted); }
.labo-echeance { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.labo-echeance.warn { color: var(--warning); }
.labo-verdict-line { font-size: 13px; color: var(--ink); }
.labo-verdict-line em { color: var(--muted); font-style: italic; }

.labo-hyp { font-size: 15px; font-weight: 650; color: var(--ink); line-height: 1.35; }
.labo-meta { display: flex; flex-wrap: wrap; gap: 6px; }
.labo-tag { font-size: 12px; color: var(--ink-2, var(--muted)); background: var(--page); border: 1px solid var(--border); border-radius: var(--r-sm); padding: 3px 9px; }
.labo-actions { display: flex; gap: 8px; margin-top: 2px; }

.labo-verdict-form { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 4px;
  padding: 10px; background: var(--page); border: 1px solid var(--border); border-radius: var(--r-sm); }
.labo-verdict-form select, .labo-verdict-form input {
  padding: 8px 10px; font-size: 13px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.labo-verdict-form input { flex: 1; min-width: 140px; }

/* ═════════ Comité de direction ═════════ */
.comite-table {
  margin: 16px 0; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--r);
  background: linear-gradient(180deg, var(--surface), var(--page)); box-shadow: var(--shadow-sm);
  cursor: pointer; transition: box-shadow 0.2s, transform 0.2s;
}
.comite-table:hover { box-shadow: var(--shadow); transform: translateY(-1px); }
.comite-table-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 8px; }
.comite-table-head b { font-size: 15px; }
.comite-run-btn {
  background: var(--navy); color: #fff; border: none; border-radius: var(--r-sm);
  padding: 8px 14px; font-size: 13px; font-weight: 600; cursor: pointer; transition: opacity 0.15s;
}
.comite-run-btn:hover { opacity: 0.88; }
.comite-run-btn:disabled { opacity: 0.6; cursor: default; }
.comite-empty { color: var(--muted); font-size: 13.5px; line-height: 1.5; }
.comite-last-sujet { font-weight: 650; font-size: 14.5px; margin-bottom: 6px; }
.comite-last-meta { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; font-size: 13px; color: var(--muted); }
.comite-pill { background: var(--accent-soft); color: var(--accent-strong); font-weight: 600; padding: 2px 9px; border-radius: 999px; }
.comite-see b { color: var(--ink); }
.comite-date { margin-left: auto; }
.comite-open { color: var(--accent); font-weight: 600; font-size: 13px; display: inline-block; margin-top: 8px; }

.comite-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; flex-wrap: wrap; }
.comite-head-actions { display: flex; gap: 10px; align-items: center; }
.comite-head-actions select {
  padding: 9px 12px; font-size: 13px; color: var(--ink); background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--r-sm);
}
.comite-sujet-bar { margin-bottom: 18px; }
.comite-trigger { font-size: 11.5px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted); font-weight: 700; }
.comite-sujet-bar h2 { margin: 4px 0 0; font-family: var(--font-display); font-size: 20px; line-height: 1.3; }

.comite-discussion { display: flex; flex-direction: column; gap: 12px; margin-bottom: 24px; }
.comite-msg { display: flex; gap: 12px; align-items: flex-start; }
.comite-face { width: 40px; height: 40px; border-radius: 50%; object-fit: cover; flex: 0 0 40px; border: 2px solid var(--border); }
.comite-bulle {
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--r);
  border-left: 3px solid var(--muted); padding: 10px 14px; box-shadow: var(--shadow-sm); flex: 1; min-width: 0;
}
.comite-bulle b { display: block; font-size: 13px; margin-bottom: 3px; }
.comite-bulle span { font-size: 14.5px; line-height: 1.5; color: var(--ink); }
/* Couleurs FIXES par agent (cette vue montre les 3 à la fois) */
.comite-msg.agent-marc .comite-bulle { border-left-color: #2f5fe0; }
.comite-msg.agent-marc .comite-bulle b { color: #2f5fe0; }
.comite-msg.agent-sofia .comite-bulle { border-left-color: #0e9384; }
.comite-msg.agent-sofia .comite-bulle b { color: #0e9384; }
.comite-msg.agent-leo .comite-bulle { border-left-color: #d97706; }
.comite-msg.agent-leo .comite-bulle b { color: #d97706; }
@media (prefers-color-scheme: dark) {
  .comite-msg.agent-marc .comite-bulle b { color: #5b86f0; }
  .comite-msg.agent-sofia .comite-bulle b { color: #2fb8a6; }
  .comite-msg.agent-leo .comite-bulle b { color: #f0a13c; }
}

.comite-decisions { margin-bottom: 22px; }
.comite-decisions h3 { font-size: 15px; margin: 0 0 12px; }
.comite-dec-card {
  background: var(--surface); border: 1px solid var(--border); border-left: 3px solid var(--accent);
  border-radius: var(--r); padding: 13px 15px; box-shadow: var(--shadow-sm); margin-bottom: 10px;
}
.comite-dec-card.agent-marc { border-left-color: #2f5fe0; }
.comite-dec-card.agent-sofia { border-left-color: #0e9384; }
.comite-dec-card.agent-leo { border-left-color: #d97706; }
.comite-dec-top { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 7px; flex-wrap: wrap; }
.comite-dec-agent { display: flex; align-items: center; gap: 7px; font-weight: 650; font-size: 13.5px; }
.comite-dec-agent img { width: 24px; height: 24px; border-radius: 50%; object-fit: cover; }
.comite-dec-btns { display: flex; gap: 8px; }
.comite-dec-titre { font-size: 15px; font-weight: 650; margin-bottom: 4px; }
.comite-dec-action { font-size: 13.5px; color: var(--muted); line-height: 1.45; }

.comite-synthese {
  background: var(--accent-soft); border: 1px solid var(--border); border-radius: var(--r); padding: 14px 16px;
}
.comite-synthese b { font-size: 13px; text-transform: uppercase; letter-spacing: 0.04em; color: var(--accent-strong); }
.comite-synthese p { margin: 6px 0 0; font-size: 14.5px; line-height: 1.5; }

/* ═════════ COQUE MOBILE — app bar, tab bar, tiroir (créés par mobile.js) ═════════
   Inertes sur desktop (display:none) ; la media query ≤ 860px les active. */
.m-appbar, .m-tabbar, .m-backdrop, .m-drawer-handle { display: none; }

/* ─── Mouvement réduit : on coupe les animations décoratives ─── */
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  .marc-avatar.is-thinking, .marc-avatar.is-talking, .marc-avatar.is-reacting,
  .conv-thread .msg, .conv-thread .msg.typing, .msg.marc.typing,
  .todo-card, .crea-card, .sofia-priorities, .mem-note, .view,
  .notif-panel, .notif-toggle em { animation: none; }
  .kpi:hover, .rep-card:hover, #run-btn:hover:not(:disabled), #sales-run-btn:hover:not(:disabled) { transform: none; }
  .room-screen, .desk-screen, .room-avatar .status-dot, .room-badge { animation: none; }
  .office-room:hover, .office-room:focus-visible, .desk:hover { transform: none; }
}

/* ═════════════════════════════════════════════════════════════════════════
   RESPONSIVE MOBILE (≤ 860px) — l'app devient une vraie app mobile :
   app bar fixe en haut, tab bar fixe en bas, la sidebar devient un TIROIR
   (bottom sheet) ouvert par « Menu » / l'avatar de l'app bar (mobile.js).
   ═════════════════════════════════════════════════════════════════════════ */
@media (max-width: 860px) {
  body {
    padding-top: calc(var(--appbar-h) + env(safe-area-inset-top, 0px));
    padding-bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
  }
  body.m-noscroll { overflow: hidden; }
  .layout { display: block; }

  /* ── App bar (haut) ── */
  .m-appbar {
    position: fixed; top: 0; left: 0; right: 0; z-index: 50;
    display: flex; align-items: center; justify-content: space-between; gap: 10px;
    height: calc(var(--appbar-h) + env(safe-area-inset-top, 0px));
    padding: env(safe-area-inset-top, 0px) 12px 0;
    background: color-mix(in srgb, var(--page) 80%, transparent);
    -webkit-backdrop-filter: blur(16px);
    backdrop-filter: blur(16px);
    border-bottom: 1px solid var(--hairline);
  }
  @supports not (backdrop-filter: blur(16px)) { .m-appbar { background: var(--page); } }
  .m-appbar-id {
    display: flex; align-items: center; gap: 10px; min-width: 0;
    background: transparent; border: none; padding: 6px; border-radius: var(--r-sm); text-align: left;
  }
  .m-appbar-face { width: 38px; height: 38px; border-radius: 50%; object-fit: cover; box-shadow: 0 0 0 2px var(--accent), 0 2px 6px rgba(0, 0, 0, 0.2); }
  .m-appbar-txt { display: flex; flex-direction: column; line-height: 1.25; min-width: 0; }
  .m-appbar-txt strong { font-family: var(--font-display); font-size: 16px; letter-spacing: -0.01em; }
  .m-appbar-txt small { font-size: 11.5px; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; max-width: 58vw; }
  .m-bell {
    position: relative; width: 42px; height: 42px; border-radius: 50%;
    border: 1px solid var(--border); background: var(--surface); font-size: 17px;
    display: grid; place-items: center; flex-shrink: 0;
  }
  .m-bell em {
    position: absolute; top: -3px; right: -3px;
    font-style: normal; font-size: 10px; font-weight: 700; color: #fff;
    background: var(--critical); border-radius: 12px; padding: 1px 5px; min-width: 16px; text-align: center;
  }

  /* ── Tab bar (bas) ── */
  .m-tabbar {
    position: fixed; bottom: 0; left: 0; right: 0; z-index: 50;
    display: flex; align-items: stretch;
    height: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px));
    padding: 0 4px env(safe-area-inset-bottom, 0px);
    background: color-mix(in srgb, var(--surface) 82%, transparent);
    -webkit-backdrop-filter: blur(18px);
    backdrop-filter: blur(18px);
    border-top: 1px solid var(--hairline);
  }
  @supports not (backdrop-filter: blur(18px)) { .m-tabbar { background: var(--surface); } }
  .m-tab {
    position: relative; flex: 1; min-width: 0;
    display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 2px;
    background: transparent; border: none; color: var(--muted); padding: 6px 2px;
    transition: color 0.15s, transform 0.1s;
  }
  .m-tab:active { transform: scale(0.94); }
  .m-tab-ic { font-size: 21px; line-height: 1; }
  .m-tab-lb { font-size: 10px; font-weight: 650; letter-spacing: 0.01em; max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  .m-tab.active { color: var(--accent); }
  .m-tab.active::before {
    content: ""; position: absolute; top: 0; left: 50%; transform: translateX(-50%);
    width: 30px; height: 3px; border-radius: 0 0 3px 3px; background: var(--accent-grad);
  }
  .m-tab-badge {
    position: absolute; top: 3px; left: calc(50% + 6px);
    font-style: normal; font-size: 9.5px; font-weight: 700; color: #fff;
    background: var(--accent-grad); border-radius: 10px; padding: 0 5px; min-width: 15px; text-align: center;
  }

  /* ── Le tiroir : la sidebar devient une bottom sheet ── */
  .m-backdrop {
    display: block; position: fixed; inset: 0; z-index: 60;
    background: rgba(10, 12, 18, 0.5);
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
    animation: backdrop-in 0.2s ease;
  }
  .m-backdrop[hidden] { display: none; }
  @keyframes backdrop-in { from { opacity: 0; } to { opacity: 1; } }
  .sidebar {
    position: fixed; left: 0; right: 0; bottom: 0; top: auto; z-index: 70;
    height: auto; max-height: min(84dvh, 84vh);
    overflow-y: auto; overscroll-behavior: contain;
    border-right: none; border-top: 1px solid var(--hairline);
    border-radius: 24px 24px 0 0;
    padding: 10px 18px calc(20px + env(safe-area-inset-bottom, 0px));
    background: var(--surface);
    box-shadow: 0 -18px 50px rgba(0, 0, 0, 0.3);
    transform: translateY(105%);
    transition: transform 0.3s cubic-bezier(.2, .8, .3, 1);
  }
  .sidebar.open { transform: none; }
  .m-drawer-handle {
    display: block; width: 44px; height: 5px; margin: 2px auto 6px;
    border: none; border-radius: 3px; background: var(--hairline); padding: 0;
  }
  /* Cibles tactiles confortables dans le tiroir */
  .nav-btn { padding: 13px 14px; }
  .nav-btn.active::before { display: none; }
  .agent-pill { padding: 10px 12px; }
  .notif-toggle { padding: 13px 14px; }
  .sidebar-foot select, #report-select { padding: 12px; }
  #run-btn, #sales-run-btn, #leo-hunt-btn, #leo-outreach-btn, #leo-report-btn { padding: 13px; }

  /* ── Contenu ── */
  .content { padding: 14px 14px 28px; }
  .view-head { margin-bottom: 16px; }
  .view-head h1 { font-size: 20px; }
  .status-msg { font-size: 13.5px; }

  /* ── Chat : plein écran, l'app bar remplace l'en-tête de conversation ── */
  .conv-header { display: none; }
  .conv-wrap { max-width: none; }
  .conv-thread { min-height: calc(100dvh - var(--appbar-h) - var(--tabbar-h) - 140px); }
  .conv-thread .msg { max-width: 88%; font-size: 15px; }
  /* Le formulaire colle AU-DESSUS de la tab bar */
  .chat-form { bottom: calc(var(--tabbar-h) + env(safe-area-inset-bottom, 0px)); padding: 10px 0; }
  .chat-form button[type="submit"], .attach-btn { width: 44px; height: 44px; }

  /* iOS zoome sur tout champ < 16px : on force 16px sur mobile */
  .chat-form textarea, .todo-add input, .vivier-filters input, .vivier-filters select,
  .settings-form input, .labo-form input, .labo-form select, .sidebar-foot select, #report-select,
  .labo-verdict-form input, .labo-verdict-form select, .comite-head-actions select { font-size: 16px; }

  /* ── Grilles & panneaux ── */
  .strip, .two-col, .obj-mini { grid-template-columns: 1fr; }
  .kpi-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .sales-strip { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .rep-cards { grid-template-columns: 1fr; }
  .settings-form { grid-template-columns: 1fr; }
  .kpi { padding: 12px 14px; }
  .kpi-value { font-size: 22px; }
  .health-card, .panel, .obj-mini { padding: 15px 16px; border-radius: var(--r); }
  .funnel-step { grid-template-columns: 92px 1fr 54px; }
  table { font-size: 13px; }
  th, td { padding: 8px 8px; }
  .mission-body { padding-left: 18px; }

  /* ── Notifications : feuille plein écran ── */
  .notif-panel { width: 100%; max-width: 100%; padding-top: env(safe-area-inset-top, 0px); }

  /* ── Le Siège ── */
  .office-topbar { padding: 12px 16px; }
  .office-logo { font-size: 16px; }
  .office-clock b { font-size: 17px; }
  .office-floor { padding: 12px; gap: 14px; }
  .offices-row { grid-template-columns: 1fr; }
  .team-zone { padding: 12px; }
  .team-plaque { flex-direction: column; align-items: flex-start; }
  .team-plaque-stats { align-self: stretch; justify-content: space-between; }
  .desk-grid { grid-template-columns: repeat(2, 1fr); }

  /* ── Comité / labo / agenda ── */
  .comite-head-actions { width: 100%; }
  .comite-head-actions select { flex: 1; min-width: 0; }
  .agenda-date { min-width: 0; }
}

/* Mouvement réduit — couche mobile. Placé EN FIN de fichier exprès : le bloc
   reduced-motion principal est avant le bloc ≤860px, donc ses annulations
   perdraient la cascade contre les transitions/animations mobiles. */
@media (prefers-reduced-motion: reduce) {
  .sidebar { transition: none; }
  .m-backdrop { animation: none; }
  .m-tab:active { transform: none; }
}
