/* ── Jetons du design Hypatie OS (validé le 7 octobre 2026) ──────────────────
   Source de vérité des couleurs, polices, rayons et ombres. Ce bloc est repris
   tel quel en tête de socle/ui/base.css ; chaque app ne change que --acc,
   --acc-soft et --acc-deep sur :root (Perso vert, Pro bleu, Agent violet). */
@import url('https://fonts.googleapis.com/css2?family=Bricolage+Grotesque:opsz,wght@12..96,500;12..96,600;12..96,700&family=Figtree:wght@400;500;600;700&display=swap');

:root {
  /* Fonds et texte (mode clair) */
  --bg: #F4F2EC;        /* lin : jamais blanc pur */
  --panel: #FFFFFF;
  --panel-2: #ECE9E1;
  --line: #DDD9CF;
  --text: #1E1C18;
  --muted: #6E6A60;

  /* Accents des apps (l'app active copie le sien dans --acc) */
  --perso: #2E7D5B; --perso-soft: #DCEDE3; --perso-deep: #2E7D5B;
  --pro:   #2E5BB5; --pro-soft:   #DEE6F6; --pro-deep:   #2E5BB5;
  --agent: #6A4BD8; --agent-soft: #E7E1F8; --agent-deep: #6A4BD8;
  --acc: var(--perso); --acc-soft: var(--perso-soft); --acc-deep: var(--perso-deep);

  /* États : toujours accompagnés d'une icône, jamais la couleur seule */
  --late: #C23B2A; --late-soft: #F6DDD9;   /* en retard, urgent, à relancer */
  --warn: #B86A17; --warn-soft: #F7E6D0;   /* à vérifier, dépassement probable */
  --wait: #1F7A8C; --wait-soft: #D8EBEF;   /* en attente d'une réponse */
  --ok:   #2E7D5B; --ok-soft:   #DCEDE3;   /* fait, série en cours */

  /* Formes */
  --radius: 12px; --radius-lg: 16px; --pill: 999px;
  --shadow: 0 1px 2px rgba(30, 28, 24, .05), 0 8px 24px rgba(30, 28, 24, .06);
  --shadow-float: 0 6px 20px rgba(30, 28, 24, .18);

  /* Typographie */
  --font: Figtree, ui-sans-serif, system-ui, -apple-system, "Segoe UI", sans-serif;
  --font-display: "Bricolage Grotesque", Figtree, sans-serif;
  --mono: ui-monospace, "SF Mono", "Cascadia Code", Consolas, monospace;
  --text-size: 15px; --line-height: 1.5;

  /* Espacements : 4 · 8 · 12 · 16 · 20 · 24 · 32 · 48 ; cible tactile ≥ 44 px */
  --tap: 44px;
  color-scheme: light;
}

/* Mode sombre : même qualité, mêmes contrastes */
@media (prefers-color-scheme: dark) {
  :root:not([data-theme="light"]) {
    --bg: #151412; --panel: #1E1C19; --panel-2: #27251F; --line: #34312A;
    --text: #EDEAE2; --muted: #9A958A;
    --perso: #5CB88E; --perso-soft: #1F3A2E; --pro: #7BA2EE; --pro-soft: #22304D;
    --agent: #A48CF2; --agent-soft: #2E2745;
    --late: #F08A7B; --late-soft: #4A2521; --warn: #E7A64E; --warn-soft: #47341A;
    --wait: #6CC2D4; --wait-soft: #1D3940; --ok: #5CB88E; --ok-soft: #1F3A2E;
    --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
    color-scheme: dark;
  }
}
:root[data-theme="dark"] {
  --bg: #151412; --panel: #1E1C19; --panel-2: #27251F; --line: #34312A;
  --text: #EDEAE2; --muted: #9A958A;
  --perso: #5CB88E; --perso-soft: #1F3A2E; --pro: #7BA2EE; --pro-soft: #22304D;
  --agent: #A48CF2; --agent-soft: #2E2745;
  --late: #F08A7B; --late-soft: #4A2521; --warn: #E7A64E; --warn-soft: #47341A;
  --wait: #6CC2D4; --wait-soft: #1D3940; --ok: #5CB88E; --ok-soft: #1F3A2E;
  --shadow: 0 1px 2px rgba(0, 0, 0, .3), 0 8px 24px rgba(0, 0, 0, .35);
  color-scheme: dark;
}
/* En sombre, les boutons pleins gardent l'accent profond du mode clair (texte blanc lisible). */

/* ══ Kit d'interface commun à toutes les apps ════════════════════════════════
   Ci-dessus : les jetons, copie exacte de design/tokens.css. Ci-dessous : la
   coque et les composants, repris des maquettes (design/maquettes/Main.dc.html).
   Une app ne fixe que --acc, --acc-soft et --acc-deep ; aucune autre couleur. */

/* Anciens noms, gardés le temps que l'Agent passe au nouveau design (étape 1.2). */
:root { --accent: var(--acc); --accent-soft: var(--acc-soft); --danger: var(--late); }

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }
body { background: var(--bg); color: var(--text); font: var(--text-size)/var(--line-height) var(--font); -webkit-font-smoothing: antialiased; }
a { color: var(--acc); text-decoration: none; }
a:hover { text-decoration: underline; text-underline-offset: 2px; }
button, input, textarea, select { font: inherit; color: inherit; }
[hidden] { display: none !important; }
h1, h2, h3, h4 { font-family: var(--font-display); letter-spacing: -.01em; margin: 0; }
h1 { font-size: 30px; font-weight: 600; line-height: 1.15; }
h3 { font-size: 16px; font-weight: 600; }
/* h2 = titre de section (comme .sec) : capitales espacées, atténué */
h2, .sec { font-family: var(--font); font-size: 12px; font-weight: 700; letter-spacing: .09em; text-transform: uppercase; color: var(--muted); margin: 24px 0 10px; display: flex; align-items: center; gap: 8px; }
.sec { margin: 0 0 10px; }
.sec .count, h2 .count { color: var(--text); }
.muted { color: var(--muted); }
.small { font-size: 13px; }
.spacer { flex: 1; }
.num { font-family: var(--font-display); font-weight: 700; font-variant-numeric: tabular-nums; line-height: 1.1; }
.ico { flex: none; display: inline-block; vertical-align: middle; }
:focus-visible { outline: 2px solid var(--acc); outline-offset: 2px; }

/* ── Coque : barre latérale (PC), barre d'onglets en bas (téléphone) ────────── */
.shell { display: flex; min-height: 100%; }
.sidebar { position: sticky; top: 0; height: 100vh; height: 100dvh; width: 240px; flex: none; display: flex; flex-direction: column; gap: 18px; padding: 20px 14px; background: var(--panel); border-right: 1px solid var(--line); overflow-y: auto; }
.brand { display: flex; align-items: center; gap: 10px; padding: 0 6px; font-family: var(--font-display); font-weight: 600; font-size: 17px; color: var(--text); }
.logo { display: inline-grid; place-items: center; width: 32px; height: 32px; border-radius: 10px; background: var(--acc-deep); color: #fff; font-family: var(--font-display); font-weight: 700; font-size: 17px; flex: none; }
.switcher { display: flex; }
.switcher a { flex: 1; text-align: center; }
.side-nav { display: flex; flex-direction: column; gap: 2px; }
/* Emplacement qu'une vue remplit (ex. fils de conversation de l'Agent) ; vide, il disparaît. */
.side-slot { flex: 1; min-height: 0; display: flex; flex-direction: column; gap: 10px; overflow-y: auto; }
.side-slot:empty { display: none; }
.side-slot:not(:empty) + .side-nav { border-top: 1px solid var(--line); padding-top: 10px; }
.side-slot:not(:empty) ~ .side-foot { margin-top: 0; }
.side-nav a, .side-nav button { display: flex; align-items: center; gap: 10px; padding: 9px 12px; border: 0; border-radius: 10px; background: transparent; color: var(--muted); font-weight: 500; text-align: left; cursor: pointer; text-decoration: none; }
.side-nav a:hover, .side-nav button:hover { background: var(--panel-2); color: var(--text); text-decoration: none; }
.side-nav a.on { background: var(--acc-soft); color: var(--acc); font-weight: 600; }
.side-nav .sep { height: 1px; background: var(--line); margin: 8px 10px; }
.side-foot { margin-top: auto; display: flex; flex-direction: column; gap: 2px; border-top: 1px solid var(--line); padding-top: 10px; }
.badge { margin-left: auto; min-width: 20px; padding: 1px 7px; border-radius: var(--pill); background: var(--acc-deep); color: #fff; font-size: 11px; font-weight: 600; text-align: center; line-height: 1.5; }
main#view { flex: 1; min-width: 0; }

.bottom-nav { display: none; }
@media (max-width: 720px) {
  .sidebar { display: none; }
  .shell { padding-bottom: calc(62px + env(safe-area-inset-bottom)); }
  .bottom-nav { position: fixed; z-index: 30; left: 0; right: 0; bottom: 0; display: grid; grid-auto-columns: minmax(0, 1fr); grid-auto-flow: column; padding: 8px 4px calc(8px + env(safe-area-inset-bottom)); background: var(--panel); border-top: 1px solid var(--line); }
  .bottom-nav a, .bottom-nav button { position: relative; display: flex; flex-direction: column; align-items: center; gap: 3px; min-height: var(--tap); padding: 0; border: 0; background: transparent; color: var(--muted); font-size: 10.5px; font-weight: 600; text-decoration: none; cursor: pointer; }
  .bottom-nav a.on { color: var(--acc); }
  .bottom-nav .badge { position: absolute; top: -4px; left: 50%; margin-left: 6px; }
  .bottom-nav .central { display: grid; place-items: center; width: 48px; height: 48px; margin-top: -26px; border-radius: 50%; background: var(--acc-deep); color: #fff; box-shadow: var(--shadow-float); }
}

/* Feuille « Plus » (téléphone) : autres onglets, changement d'app, thème, déconnexion */
.sheet-scrim { position: fixed; inset: 0; z-index: 40; background: rgba(0, 0, 0, .35); }
.sheet { position: fixed; z-index: 41; left: 0; right: 0; bottom: 0; max-height: 80vh; overflow-y: auto; padding: 10px 14px calc(18px + env(safe-area-inset-bottom)); border-radius: 20px 20px 0 0; background: var(--panel); box-shadow: var(--shadow-float); display: flex; flex-direction: column; gap: 12px; }
.sheet::before { content: ''; align-self: center; width: 40px; height: 4px; border-radius: 2px; background: var(--line); }

/* ── Pages ────────────────────────────────────────────────────────────────── */
.page { max-width: 1080px; margin: 0 auto; padding: 32px 36px 48px; display: flex; flex-direction: column; gap: 20px; }
.page-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.page-head .sub-title { color: var(--muted); }
@media (max-width: 720px) {
  .page { padding: 20px 16px 24px; gap: 16px; }
  h1 { font-size: 24px; }
}

/* ── Boutons ──────────────────────────────────────────────────────────────── */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 8px; height: 40px; padding: 0 16px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--panel); color: var(--text); font-weight: 600; white-space: nowrap; cursor: pointer; text-decoration: none; }
.btn:hover { background: var(--panel-2); text-decoration: none; }
.btn.primary { background: var(--acc-deep); border-color: var(--acc-deep); color: #fff; }
.btn.primary:hover { filter: brightness(1.08); }
.btn.soft { background: var(--acc-soft); border-color: transparent; color: var(--acc); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); }
.btn.danger { background: var(--late-soft); border-color: var(--late-soft); color: var(--late); }
.btn.sm { height: 32px; padding: 0 12px; font-size: 13.5px; }
.btn:disabled { opacity: .45; cursor: default; }
.icon-btn { display: inline-grid; place-items: center; width: 40px; height: 40px; flex: none; border-radius: 50%; border: 1px solid var(--line); background: var(--panel); color: var(--text); cursor: pointer; }
.icon-btn:hover { background: var(--panel-2); }
.icon-btn.flat { border-color: transparent; background: transparent; }
.icon-btn.primary { border-color: var(--acc-deep); background: var(--acc-deep); color: #fff; }
.icon-btn.sm { width: 32px; height: 32px; }
.fab { position: fixed; z-index: 25; right: 16px; bottom: calc(80px + env(safe-area-inset-bottom)); display: grid; place-items: center; width: 56px; height: 56px; border-radius: 50%; border: 0; background: var(--acc-deep); color: #fff; box-shadow: var(--shadow-float); cursor: pointer; }

/* ── Champs ───────────────────────────────────────────────────────────────── */
.input { width: 100%; min-height: 42px; border: 1px solid var(--line); background: var(--panel); border-radius: var(--radius); padding: 0 14px; color: var(--text); outline: none; }
textarea.input { padding: 10px 14px; resize: vertical; line-height: 1.5; }
select.input { padding-right: 8px; }
.input:focus { border-color: var(--acc); box-shadow: 0 0 0 3px var(--acc-soft); }
label.field { display: grid; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--muted); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
@media (max-width: 560px) { .grid2 { grid-template-columns: 1fr; } }
/* Saisie rapide en pilule : icône +, champ, micro, bouton */
.quick { display: flex; align-items: center; gap: 8px; min-height: 52px; padding: 0 6px 0 18px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--panel); box-shadow: var(--shadow); }
.quick:focus-within { border-color: var(--acc); }
.quick > .ico { color: var(--acc); }
.quick input { flex: 1; min-width: 0; height: 44px; border: 0; outline: 0; background: transparent; }
.quick .icon-btn { width: 40px; height: 40px; border: 0; background: var(--panel-2); }

/* ── Pastilles et puces ───────────────────────────────────────────────────── */
.pill { display: inline-flex; align-items: center; gap: 5px; height: 24px; padding: 0 9px; border-radius: var(--pill); background: var(--panel-2); color: var(--muted); font-size: 12.5px; font-weight: 600; white-space: nowrap; }
.pill .ico { width: 13px; height: 13px; }
.pill.late { background: var(--late-soft); color: var(--late); }
.pill.warn { background: var(--warn-soft); color: var(--warn); }
.pill.wait { background: var(--wait-soft); color: var(--wait); }
.pill.ok { background: var(--ok-soft); color: var(--ok); }
.pill.acc, .pill.accent { background: var(--acc-soft); color: var(--acc); }
.pill.pro { background: var(--pro-soft); color: var(--pro); }
.pill.perso { background: var(--perso-soft); color: var(--perso); }
.pill.agent { background: var(--agent-soft); color: var(--agent); }
.pill.danger { background: var(--late-soft); color: var(--late); }
.chip { display: inline-flex; align-items: center; gap: 6px; height: 30px; padding: 0 12px; border-radius: var(--pill); border: 1px solid var(--line); background: var(--panel); color: var(--muted); font-size: 13px; font-weight: 600; white-space: nowrap; cursor: pointer; }
.chip b { color: var(--text); }
.chip.on { border-color: var(--acc); background: var(--acc-soft); color: var(--acc); }
.chips { display: flex; flex-wrap: wrap; gap: 8px; }

/* ── Onglets ──────────────────────────────────────────────────────────────── */
/* Segmenté (Aujourd'hui / À venir / Toutes ; Perso / Pro / Agent) */
.tabs { display: inline-flex; gap: 2px; padding: 3px; border-radius: var(--pill); background: var(--panel-2); }
.tabs > a, .tabs > button, .tabs > span { padding: 6px 14px; border: 0; border-radius: var(--pill); background: transparent; color: var(--muted); font-size: 13.5px; font-weight: 600; cursor: pointer; text-decoration: none; white-space: nowrap; }
.tabs > .on { background: var(--panel); color: var(--text); box-shadow: 0 1px 2px rgba(0, 0, 0, .08); }
.tabs.acc > .on { color: var(--acc); }
/* Souligné (sous-sections d'une page : Poids / Calories / Sport) */
.sub { display: flex; gap: 22px; border-bottom: 1px solid var(--line); overflow-x: auto; scrollbar-width: none; }
.sub > a, .sub > button, .sub > span { padding: 8px 0; border: 0; background: transparent; color: var(--muted); font-weight: 600; font-size: 14.5px; white-space: nowrap; cursor: pointer; text-decoration: none; }
.sub > .on { color: var(--acc); border-bottom: 2px solid var(--acc); margin-bottom: -1px; }

/* ── Cartes, listes, indicateurs ──────────────────────────────────────────── */
.card { background: var(--panel); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 16px 18px; }
.card.flush { padding: 4px; }
.list { display: grid; gap: 8px; }
.row { display: flex; align-items: flex-start; gap: 10px; }
.kpis { display: grid; grid-template-columns: repeat(auto-fit, minmax(160px, 1fr)); gap: 14px; }
.kpi { display: flex; flex-direction: column; gap: 2px; }
.kpi > b, .kpi .num { font-family: var(--font-display); font-size: 28px; font-weight: 700; line-height: 1.1; font-variant-numeric: tabular-nums; }
.kpi > span { font-size: 12.5px; color: var(--muted); font-weight: 600; }
.kpi.alert-late { border-color: var(--late-soft); }
.kpi.alert-late > b { color: var(--late); }
.empty { text-align: center; color: var(--muted); padding: 40px 10px; }
.empty .big { margin-bottom: 6px; color: var(--acc); }
.empty .big .ico { width: 34px; height: 34px; }

/* Ligne de tâche : case ronde (bord selon priorité), titre, pastilles */
.task { display: flex; align-items: flex-start; gap: 12px; padding: 10px 12px; }
.task + .task { border-top: 1px solid var(--line); }
.check { flex: none; width: 22px; height: 22px; margin-top: 2px; padding: 0; border-radius: 50%; border: 2px solid var(--line); background: var(--panel); cursor: pointer; display: grid; place-items: center; color: #fff; }
.check.p1 { border-color: var(--pro); }
.check.p2 { border-color: var(--warn); }
.check.p3 { border-color: var(--late); }
.check.done { background: var(--ok); border-color: var(--ok); }
.task .body { flex: 1; min-width: 0; }
.task .title { font-weight: 500; overflow-wrap: anywhere; }
.task.done .title { text-decoration: line-through; color: var(--muted); }
.task .meta { display: flex; flex-wrap: wrap; gap: 6px; margin-top: 5px; }
@media (max-width: 720px) { .check { width: 24px; height: 24px; } }

/* Encart « À suivre » : en attente, à vérifier */
.follow { border-left: 4px solid var(--wait); background: color-mix(in srgb, var(--wait) 4%, var(--panel)); }

/* Encart d'alerte */
.alert { display: flex; gap: 12px; align-items: flex-start; padding: 14px 16px; border-radius: var(--radius-lg); background: var(--warn-soft); color: color-mix(in srgb, var(--warn) 55%, var(--text)); }
.alert > .ico { color: var(--warn); margin-top: 1px; }
.alert.late { background: var(--late-soft); color: color-mix(in srgb, var(--late) 55%, var(--text)); }
.alert.late > .ico { color: var(--late); }
.alert.info { background: var(--acc-soft); color: var(--text); }
.alert.info > .ico { color: var(--acc); }

/* Avancées : barre, anneau, courbe, série */
.progress-bar { height: 6px; border-radius: 3px; background: var(--panel-2); overflow: hidden; }
.progress-bar > i { display: block; height: 100%; border-radius: 3px; background: var(--acc); }
.progress-bar > i.warn { background: var(--warn); }
.progress-bar > i.late { background: var(--late); }
.ring { display: block; flex: none; }
.ring .track { stroke: var(--panel-2); }
.ring .value { stroke: var(--acc); }
.sparkline { display: block; width: 100%; }
.sparkline .line { stroke: var(--acc); }
.sparkline .area { fill: var(--acc); fill-opacity: .08; }
.streak { display: flex; gap: 3px; }
.streak > i { flex: 1; height: 6px; border-radius: 3px; background: var(--panel-2); }
.streak > i.on { background: var(--acc); }
.bars { display: flex; align-items: flex-end; gap: 6px; }
.bars > i { flex: 1; border-radius: 4px 4px 0 0; background: var(--acc-soft); }
.bars > i.on { background: var(--acc); }
.bars > i.late { background: var(--late); }

/* ── Conversation (agent) ─────────────────────────────────────────────────── */
.avatar { display: grid; place-items: center; width: 32px; height: 32px; flex: none; border-radius: 50%; background: linear-gradient(135deg, var(--agent-deep), var(--agent)); color: #fff; font-family: var(--font-display); font-weight: 700; }
.bubble-user { align-self: flex-end; max-width: 78%; padding: 10px 15px; border-radius: 18px 18px 5px 18px; background: var(--acc-deep); color: #fff; white-space: pre-wrap; overflow-wrap: anywhere; }
.step { display: inline-flex; align-items: center; gap: 5px; padding: 2px 10px; border: 1px solid var(--line); border-radius: var(--pill); background: var(--panel-2); color: var(--muted); font-size: 12.5px; }
.step > .ico { width: 12px; height: 12px; color: var(--ok); }
.step.err > .ico { color: var(--late); }
.composer-pill { display: flex; align-items: flex-end; gap: 4px; padding: 6px 6px 6px 16px; border: 1px solid var(--line); border-radius: 24px; background: var(--panel); box-shadow: var(--shadow); }
.composer-pill:focus-within { border-color: var(--acc); }

/* Texte riche (Markdown rendu) */
.md { line-height: 1.6; overflow-wrap: anywhere; }
.md > :first-child { margin-top: 0; }
.md > :last-child { margin-bottom: 0; }
.md p { margin: 0 0 .7em; }
.md h1, .md h2, .md h3, .md h4 { font-family: var(--font-display); font-size: 16px; font-weight: 600; text-transform: none; letter-spacing: 0; color: var(--text); margin: 1.1em 0 .4em; display: block; }
.md h1 { font-size: 19px; } .md h2 { font-size: 17px; }
.md ul, .md ol { margin: 0 0 .7em; padding-left: 1.35em; }
.md li { margin: .2em 0; }
.md li::marker { color: var(--acc); }
.md strong { font-weight: 700; }
.md a { text-decoration: underline; text-underline-offset: 2px; }
.md code { font: 13px var(--mono); background: var(--panel-2); padding: 1px 5px; border-radius: 5px; }
.md pre { background: var(--panel-2); border: 1px solid var(--line); border-radius: var(--radius); padding: 12px 14px; overflow-x: auto; }
.md pre code { background: none; padding: 0; }
.md blockquote { margin: 0 0 .7em; padding: 4px 14px; border-left: 3px solid var(--acc); color: var(--muted); }
.md hr { border: 0; border-top: 1px solid var(--line); margin: 1em 0; }
.md table { border-collapse: collapse; margin: 0 0 .7em; font-size: 14px; display: block; overflow-x: auto; max-width: 100%; }
.md th, .md td { border: 1px solid var(--line); padding: 6px 10px; text-align: left; vertical-align: top; overflow-wrap: normal; }
.md th { background: var(--panel-2); font-weight: 600; }

/* ── Vues de Cerveau (socle/ui/views) : tâches, notes, dictaphone, personnes ── */
.task-acts { display: flex; align-items: center; gap: 0; align-self: center; opacity: 0; transition: opacity .12s; }
.task:hover .task-acts, .task:focus-within .task-acts { opacity: 1; }
.lbl-btn { color: var(--muted); opacity: .5; }
.lbl-btn.on, .lbl-btn:hover { opacity: 1; color: var(--acc); }
.task .body { cursor: pointer; }
.group-head { display: flex; align-items: center; gap: 8px; margin: 0 0 8px; font-size: 16px; }
.group-head small { font-family: var(--font); font-size: 13px; font-weight: 600; color: var(--muted); }
.group-head.late { color: var(--late); } .group-head.warn { color: var(--warn); } .group-head.muted { color: var(--muted); }
.list-groups { display: flex; flex-direction: column; gap: 20px; }
.filters { display: flex; align-items: center; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.group-by { display: flex; align-items: center; gap: 8px; }
.group-by select { width: auto; min-height: 34px; }
@media (max-width: 720px) {
  .task-acts { opacity: 1; }
  .task-acts .lbl-btn:not(.on) { display: none; }
  .filters .chips { flex-wrap: nowrap; overflow-x: auto; scrollbar-width: none; }
}

/* Notes : liste à gauche, éditeur à droite (un seul des deux sur téléphone) */
.notes-split { display: grid; grid-template-columns: 300px 1fr; min-height: 100vh; min-height: 100dvh; }
.notes-list { border-right: 1px solid var(--line); background: var(--panel); display: flex; flex-direction: column; min-height: 0; }
.notes-list-head { display: flex; flex-direction: column; gap: 10px; padding: 24px 16px 12px; }
.notes-list-head h1 { font-size: 24px; }
#note-list { overflow-y: auto; padding: 0 8px 24px; display: flex; flex-direction: column; gap: 2px; }
.folder-head { display: flex; align-items: center; gap: 6px; margin: 12px 8px 4px; font-size: 11.5px; font-weight: 700; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.note-item { display: grid; gap: 2px; padding: 9px 10px; border-radius: 10px; color: var(--text); text-decoration: none; }
.note-item:hover { background: var(--panel-2); text-decoration: none; }
.note-item.on { background: var(--acc-soft); }
.note-item .t { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.note-item.on .t { color: var(--acc); }
.note-item .x { font-size: 13px; color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.note-item .m { font-size: 11.5px; color: var(--muted); }
.notes-editor { min-width: 0; display: flex; flex-direction: column; }
.editor-bar { position: sticky; top: 0; z-index: 5; display: flex; align-items: center; gap: 4px; padding: 8px 16px; background: var(--bg); border-bottom: 1px solid var(--line); flex-wrap: wrap; }
.md-tools { display: flex; gap: 2px; flex-wrap: wrap; }
.icon-btn.on { color: var(--acc); background: var(--acc-soft); border-color: transparent; }
.editor-inner { width: 100%; max-width: 760px; margin: 0 auto; padding: 24px 28px 64px; display: flex; flex-direction: column; gap: 10px; }
.title-input { border: 0; outline: 0; background: transparent; font-family: var(--font-display); font-size: 28px; font-weight: 600; color: var(--text); padding: 0; }
.meta-row { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; }
.meta-row input { border: 0; outline: 0; background: transparent; color: var(--muted); font-size: 13px; width: 160px; }
.md-input { width: 100%; border: 0; outline: 0; resize: none; background: transparent; color: var(--text); font: 15.5px/1.65 var(--font); padding: 0; }
.md input[type="checkbox"] { width: 16px; height: 16px; margin: 0 6px 0 0; accent-color: var(--acc); vertical-align: -2px; }
.md .wikilink { font-weight: 600; text-decoration: none; border-bottom: 1px dashed var(--acc); }
.md .tag { color: var(--acc); text-decoration: none; }
.backlinks { padding-top: 12px; border-top: 1px solid var(--line); display: flex; gap: 6px; flex-wrap: wrap; }
.notes-editor > .empty { margin: auto; }
.only-mobile { display: none !important; }
@media (max-width: 720px) {
  .only-mobile { display: inline-grid !important; }
  .notes-split { grid-template-columns: 1fr; min-height: 0; }
  .notes-split.has-note .notes-list, .notes-split:not(.has-note) .notes-editor { display: none; }
  .notes-list { border-right: 0; background: transparent; }
  .editor-inner { padding: 16px 16px 48px; }
  .title-input { font-size: 24px; }
}

/* Dictaphone */
.switch-row { display: flex; gap: 12px; align-items: flex-start; cursor: pointer; }
.switch-row input { width: 18px; height: 18px; margin-top: 2px; accent-color: var(--acc); }
.recorder { display: flex; flex-direction: column; align-items: center; gap: 10px; padding: 26px 18px; text-align: center; }
.rec-btn { display: grid; place-items: center; width: 84px; height: 84px; border: 0; border-radius: 50%; background: var(--acc-deep); color: #fff; box-shadow: var(--shadow-float); cursor: pointer; }
.rec-btn.on { background: var(--late); animation: pulse 1.4s ease-in-out infinite; }
@keyframes pulse { 50% { box-shadow: 0 0 0 10px color-mix(in srgb, var(--late) 20%, transparent); } }
.rec-time { font-size: 30px; }
.wave { width: 100%; max-width: 520px; height: 56px; }
.live-transcript { width: 100%; max-width: 620px; text-align: left; padding: 12px 14px; border-radius: var(--radius); background: var(--panel-2); min-height: 48px; }
.memo { display: flex; flex-direction: column; gap: 10px; }
.memo.is-open { border-color: var(--acc); }
.memo-head { display: flex; align-items: center; gap: 10px; color: var(--muted); flex-wrap: wrap; }
.memo-head input { flex: 1; min-width: 160px; border: 0; outline: 0; background: transparent; font-weight: 600; font-size: 15.5px; color: var(--text); }
.player { display: flex; align-items: center; gap: 10px; }
.player.off { color: var(--muted); }
.pl-bar { flex: 1; height: 6px; border-radius: 3px; background: var(--panel-2); cursor: pointer; overflow: hidden; }
.pl-fill { height: 100%; width: 0; background: var(--acc); }

/* Agenda */
.ag-day .ag-date { font-size: 16px; margin: 0 0 8px; display: flex; align-items: center; gap: 8px; }
.ag-day.today .ag-date { color: var(--acc); }
.ag-event + .ag-event { border-top: 1px solid var(--line); }
.ag-line { display: flex; align-items: center; gap: 14px; padding: 10px 12px; }
.ag-line .ag-time { width: 64px; flex: none; white-space: nowrap; font-family: var(--font-display); font-weight: 600; font-variant-numeric: tabular-nums; }
.ag-line .ag-bar { width: 3px; height: 36px; border-radius: 2px; flex: none; }
.ag-bar.cal-perso, .cal-dot.cal-perso { background: var(--perso); } .ag-bar.cal-maire, .cal-dot.cal-maire { background: var(--pro); }
.cal-dot { width: 9px; height: 9px; border-radius: 50%; display: inline-block; }
.ag-body { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.ag-body b { font-weight: 600; }
.ag-acts { display: flex; align-items: center; gap: 4px; }
.ag-tasks { margin: 0 12px 10px 92px; border-left: 2px solid var(--line); }
.ag-tasks .task { padding: 6px 10px; }
@media (max-width: 720px) { .ag-line { gap: 10px; } .ag-line .ag-time { width: 58px; font-size: 14px; } .ag-acts .lbl { display: none; } .ag-tasks { margin-left: 12px; } }

/* Personnes */
.people-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 12px; }
.person { display: flex; align-items: flex-start; gap: 12px; text-align: left; cursor: pointer; color: var(--text); font: inherit; }
.person:hover { border-color: var(--acc); }
.person-avatar { background: var(--acc-soft); color: var(--acc); font-size: 14px; }
.person-body { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.person-notes { color: var(--muted); display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }

/* Recherche */
.result { display: flex; gap: 12px; align-items: flex-start; padding: 12px 14px; color: var(--text); text-decoration: none; }
.result + .result { border-top: 1px solid var(--line); }
.result:hover { background: var(--panel-2); text-decoration: none; }
.result > .ico { color: var(--acc); margin-top: 2px; }
.result-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
mark { background: var(--warn-soft); color: inherit; border-radius: 3px; padding: 0 2px; }

/* Fenêtre « Confier à l'agent » (socle/ui/ask-agent.js) */
.ask-agent { --acc: var(--agent); --acc-soft: var(--agent-soft); --acc-deep: var(--agent-deep); }
.ask-head { display: flex; align-items: center; gap: 8px; color: var(--agent); }
.ask-head h3 { color: var(--text); }
.ask-q { align-self: flex-end; }
.ask-answer { display: flex; flex-direction: column; gap: 10px; min-height: 60px; }
.ask-answer .steps { display: flex; flex-wrap: wrap; gap: 6px; }
.ask-answer .notice { color: var(--warn); }
.typing { display: flex; gap: 5px; padding: 10px 0; }
.typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--acc); opacity: .3; animation: hos-blink 1.2s infinite; }
.typing span:nth-child(2) { animation-delay: .2s; }
.typing span:nth-child(3) { animation-delay: .4s; }
@keyframes hos-blink { 0%, 80%, 100% { opacity: .25; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

/* ── Notifications éphémères ──────────────────────────────────────────────── */
#toasts { position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%); display: grid; gap: 8px; z-index: 50; width: min(92vw, 420px); }
@media (max-width: 720px) { #toasts { bottom: calc(84px + env(safe-area-inset-bottom)); } }
/* Contraste inversé : sombre sur fond clair, clair sur fond sombre. */
.toast { display: flex; align-items: center; gap: 14px; padding: 12px 16px; border-radius: 14px; background: var(--text); color: var(--bg); box-shadow: var(--shadow-float); font-size: 14px; }
.toast button { margin-left: auto; border: 0; background: transparent; color: var(--agent-soft); font-weight: 600; cursor: pointer; }

/* ── Fenêtre modale (feuille en bas sur téléphone) ───────────────────────────── */
.modal-overlay { position: fixed; inset: 0; z-index: 45; display: grid; place-items: center; padding: 16px; background: rgba(0, 0, 0, .35); }
.modal { width: min(100%, 560px); max-height: 88vh; overflow-y: auto; display: flex; flex-direction: column; gap: 14px; padding: 22px; border-radius: var(--radius-lg); background: var(--panel); box-shadow: var(--shadow-float); }
.modal h3 { font-size: 18px; }
.modal .foot { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
@media (max-width: 720px) {
  .modal-overlay { place-items: end stretch; padding: 0; }
  .modal { width: 100%; max-height: 92vh; border-radius: 20px 20px 0 0; padding: 18px 16px calc(18px + env(safe-area-inset-bottom)); }
}

/* ── Connexion ────────────────────────────────────────────────────────────── */
.login { min-height: 100%; display: grid; place-items: center; padding: 16px; }
.login form { width: min(100%, 360px); display: grid; gap: 14px; padding: 28px 24px; }
.login .logo { width: 44px; height: 44px; border-radius: 13px; font-size: 22px; justify-self: center; }
.login h1 { text-align: center; font-size: 24px; }
