/* Livana — Dashboard psychologue (desktop)
   Construit sur les tokens du design system Livana. */

:root {
  /* Neutres chauds */
  --bg: #fafaf7;
  --surface: #ffffff;
  --surface-2: #f4f3ee;
  --border: #e8e6df;
  --border-strong: #d8d5cc;
  --text: #1c1c1a;
  --text-2: #5a5a55;
  --text-3: #8a8a82;

  /* Accent sauge */
  --accent: oklch(0.62 0.07 175);
  --accent-soft: oklch(0.94 0.025 175);
  --accent-dark: oklch(0.42 0.06 175);

  --online: oklch(0.62 0.18 150);
  --online-soft: oklch(0.96 0.04 145);

  --danger: oklch(0.58 0.16 25);
  --danger-soft: oklch(0.95 0.03 25);
  --warn: oklch(0.62 0.13 75);
  --warn-soft: oklch(0.96 0.05 80);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 20px;
  --radius-pill: 999px;

  --shadow-sm: 0 1px 2px rgba(28,28,26,0.04), 0 1px 3px rgba(28,28,26,0.05);
  --shadow-md: 0 4px 12px -4px rgba(28,28,26,0.10), 0 2px 6px -2px rgba(28,28,26,0.06);
  --shadow-lg: 0 20px 48px -16px rgba(28,28,26,0.22), 0 8px 20px -8px rgba(28,28,26,0.12);

  --sidebar-w: 76px;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-display: 'Cormorant Garamond', Georgia, serif;
}

/* Accent themes (tweaks) */
.theme-sage      { --accent: oklch(0.62 0.07 175); --accent-soft: oklch(0.94 0.025 175); --accent-dark: oklch(0.42 0.06 175); }
.theme-rose      { --accent: oklch(0.62 0.09 25);  --accent-soft: oklch(0.95 0.03 25);   --accent-dark: oklch(0.44 0.08 25); }
.theme-lavender  { --accent: oklch(0.55 0.09 295); --accent-soft: oklch(0.95 0.025 295); --accent-dark: oklch(0.40 0.08 295); }
.theme-ocean     { --accent: oklch(0.56 0.10 235); --accent-soft: oklch(0.95 0.03 235);  --accent-dark: oklch(0.40 0.09 235); }
.theme-amber     { --accent: oklch(0.66 0.11 75);  --accent-soft: oklch(0.95 0.04 80);   --accent-dark: oklch(0.46 0.10 60); }
.theme-plum      { --accent: oklch(0.48 0.12 340); --accent-soft: oklch(0.95 0.035 340); --accent-dark: oklch(0.36 0.10 340); }

* { box-sizing: border-box; }
html, body { height: 100%; }
body {
  margin: 0;
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  font-size: 14px;
}
button { font-family: inherit; cursor: pointer; border: none; background: none; color: inherit; }
input, textarea { font-family: inherit; }
::selection { background: var(--accent-soft); }
#root { height: 100%; }

/* scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* ───────────────────────── App shell ───────────────────────── */
.app-shell { display: flex; height: 100vh; overflow: hidden; }

.sidebar {
  width: var(--sidebar-w);
  flex-shrink: 0;
  background: var(--surface);
  border-right: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  padding: 22px 16px 16px;
}
/* Slim icon-only rail sidebar */
.sidebar-rail { padding: 18px 0 16px; align-items: center; }
.sidebar-rail .sb-brand { padding: 0 0 12px; justify-content: center; }
.sb-orb-btn {
  display: flex; align-items: center; justify-content: center;
  width: 100%; padding: 0 0 14px; margin-bottom: 8px; position: relative;
  border-bottom: 1px solid var(--border);
}
.sb-orb {
  display: block;
  width: 22px; height: 22px; border-radius: 50%;
  background: radial-gradient(circle at 32% 30%, oklch(0.85 0.06 175), var(--accent));
  box-shadow: 0 3px 10px -3px oklch(0.62 0.07 175 / 0.55);
  transition: transform 0.14s ease;
}
.sb-item:hover .sb-orb { transform: scale(1.1); }
.sidebar-rail .sb-nav { display: flex; flex-direction: column; align-items: center; gap: 8px; width: 100%; }
.sidebar-rail .sb-item {
  width: 46px; height: 46px; padding: 0; border-radius: 13px;
  display: flex; align-items: center; justify-content: center; position: relative;
}
.sidebar-rail .sb-item .sb-ic { opacity: 1; }
.sidebar-rail .sb-item-badge {
  position: absolute; top: 4px; right: 4px; margin: 0;
  min-width: 16px; height: 16px; padding: 0 4px; font-size: 9.5px;
}
.sidebar-rail .sb-rail-icon {
  width: 42px; height: 42px; border-radius: 12px; color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; transition: background 0.14s ease, color 0.14s ease;
}
.sidebar-rail .sb-rail-icon:hover { background: var(--surface-2); color: var(--text); }
.sidebar-rail .sb-rail-avatar { width: 40px; height: 40px; font-size: 13px; margin-top: 8px; position: relative; }

/* rail tooltips */
.sidebar-rail [data-tip]::after {
  content: attr(data-tip); position: absolute; left: calc(100% + 12px); top: 50%; transform: translateY(-50%);
  background: var(--text); color: var(--bg); font-size: 12px; font-weight: 500; white-space: nowrap;
  padding: 6px 10px; border-radius: 8px; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity 0.13s ease; z-index: 60;
}
.sidebar-rail [data-tip]:hover::after { opacity: 1; }

.sb-brand {
  display: flex; align-items: center; gap: 11px;
  padding: 2px 8px 22px;
}
.sb-logo {
  width: 34px; height: 34px;
  border-radius: 10px;
  background: var(--accent);
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 2px 8px -2px oklch(0.62 0.07 175 / 0.5);
}
.sb-logo-img {
  background: transparent; box-shadow: none; border-radius: 8px;
  overflow: hidden;
}
.sb-logo-img img { width: 100%; height: 100%; object-fit: contain; }
.sidebar-rail .sb-logo-img { width: 40px; height: 40px; }
.sb-wordmark {
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 500;
  font-size: 26px;
  letter-spacing: -0.01em;
  color: var(--text);
  line-height: 1;
}
.sb-estab { font-size: 11px; color: var(--text-3); letter-spacing: 0.02em; margin-top: 1px; }

.sb-nav { display: flex; flex-direction: column; gap: 2px; }
.sb-nav-label {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3); padding: 14px 12px 6px;
}
.sb-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 12px; border-radius: 10px;
  font-size: 14px; font-weight: 500; color: var(--text-2);
  text-align: left; width: 100%;
  transition: background 0.14s ease, color 0.14s ease;
  position: relative;
}
.sb-item:hover { background: var(--surface-2); color: var(--text); }
.sb-item.active { background: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.sb-item .sb-ic { flex-shrink: 0; opacity: 0.9; }
.sb-item-badge {
  margin-left: auto;
  background: var(--accent); color: #fff;
  font-size: 11px; font-weight: 700;
  min-width: 20px; height: 20px; padding: 0 6px;
  border-radius: 999px;
  display: inline-flex; align-items: center; justify-content: center;
}
.sb-item.active .sb-item-badge { background: var(--accent-dark); }

.sb-spacer { flex: 1; }

/* SAV button in sidebar */
.sb-support {
  display: flex; align-items: center; gap: 11px;
  padding: 11px 12px; margin: 0 0 10px; border-radius: 12px;
  border: 1px solid var(--border); background: var(--surface); width: 100%; text-align: left;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.sb-support:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.sb-support-ic {
  width: 34px; height: 34px; border-radius: 9px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-dark);
  display: inline-flex; align-items: center; justify-content: center;
}
.sb-support-meta { flex: 1; min-width: 0; }
.sb-support-title { display: block; font-size: 13px; font-weight: 600; color: var(--text); }
.sb-support-sub { display: block; font-size: 11px; color: var(--text-3); }

/* SAV modal */
.sav-backdrop {
  position: fixed; inset: 0; z-index: 300; background: rgba(20,20,18,0.46);
  display: flex; align-items: center; justify-content: center; padding: 32px;
  backdrop-filter: blur(2px);
}
.sav-modal {
  width: min(440px, 96vw); height: min(620px, 88vh);
  background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); overflow: hidden;
  display: flex; flex-direction: column;
  animation: popIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.sav-head {
  display: flex; align-items: center; gap: 12px; padding: 16px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--accent-soft) 50%, var(--surface));
}
.sav-head-av {
  width: 40px; height: 40px; border-radius: 50%; flex-shrink: 0;
  background: var(--accent); color: #fff;
  display: inline-flex; align-items: center; justify-content: center;
}
.sav-head-greet { font-size: 11px; color: var(--text-3); }
.sav-head-title { font-size: 15px; font-weight: 600; display: flex; align-items: center; gap: 8px; }
.sav-online { display: inline-flex; align-items: center; gap: 5px; font-size: 11px; font-weight: 600; color: oklch(0.45 0.13 150); }
.sav-online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--online); animation: in-call-pulse 1.8s ease-in-out infinite; }
.sav-thread { flex: 1; overflow-y: auto; padding: 18px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.sav-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 9px; padding: 20px; }
.sav-empty-ic { width: 58px; height: 58px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: flex; align-items: center; justify-content: center; }
.sav-empty-title { font-size: 16px; font-weight: 600; }
.sav-empty-sub { font-size: 12.5px; color: var(--text-2); max-width: 280px; line-height: 1.5; }
.sav-msg { display: flex; gap: 9px; max-width: 86%; }
.sav-msg.user { align-self: flex-end; }
.sav-msg.assistant { align-self: flex-start; }
.sav-msg-av { width: 28px; height: 28px; border-radius: 50%; flex-shrink: 0; background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center; align-self: flex-end; }
.sav-bubble { padding: 10px 14px; border-radius: 15px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; }
.sav-msg.assistant .sav-bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 4px; }
.sav-msg.user .sav-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 4px; }
.sav-suggest { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 18px 12px; background: var(--surface-2); }
.sav-composer { padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.sav-hint { font-size: 10.5px; color: var(--text-3); text-align: center; margin-top: 8px; }

.sb-secure {
  display: flex; align-items: center; gap: 10px;
  padding: 11px 12px; margin: 8px 4px 12px;
  border-radius: 10px;
  background: var(--accent-soft);
  color: var(--accent-dark);
  font-size: 11.5px; line-height: 1.35;
}
.sb-secure svg { flex-shrink: 0; }

.sb-user {
  display: flex; align-items: center; gap: 11px;
  padding: 10px; border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.sb-logout {
  width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); background: transparent; transition: all 0.14s ease;
}
.sb-logout:hover { background: var(--danger-soft); color: var(--danger); }
.sb-avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
  font-weight: 600; font-size: 13px; flex-shrink: 0;
}
.sb-user-meta { min-width: 0; flex: 1; }
.sb-user-name { display: block; font-size: 13px; font-weight: 600; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.sb-user-role { display: block; font-size: 11px; color: var(--text-3); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ───────────────────────── Main ───────────────────────── */
.main { flex: 1; display: flex; flex-direction: column; min-width: 0; overflow: hidden; }

.topbar {
  height: 64px; flex-shrink: 0;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--bg) 80%, transparent);
  backdrop-filter: blur(8px);
  display: flex; align-items: center; gap: 16px;
  padding: 0 28px;
}
.topbar-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.topbar-sub { font-size: 12.5px; color: var(--text-3); margin-top: 1px; }
.topbar-search {
  margin-left: auto;
  display: flex; align-items: center; gap: 9px;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 15px;
  width: 280px; color: var(--text-3);
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.topbar-search:focus-within { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topbar-search input { flex: 1; border: none; outline: none; background: transparent; font-size: 13.5px; color: var(--text); }
.topbar-search input::placeholder { color: var(--text-3); }
.topbar-icon-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface);
  color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  position: relative; transition: all 0.15s ease;
}
.topbar-icon-btn:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent-soft); }
.topbar-icon-dot {
  position: absolute; top: 7px; right: 8px;
  width: 8px; height: 8px; border-radius: 50%;
  background: var(--danger); border: 2px solid var(--surface);
}

.scroll-area { flex: 1; overflow-y: auto; overflow-x: hidden; }
.page { padding: 28px; max-width: 1320px; margin: 0 auto; }
.page-wide { max-width: 100%; }

/* ───────────────────────── Generic bits ───────────────────────── */
.card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.section-title {
  font-size: 12px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3);
}
.eyebrow {
  font-size: 11px; font-weight: 600; letter-spacing: 0.08em; text-transform: uppercase;
  color: var(--text-3);
}
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
  padding: 10px 16px; border-radius: var(--radius);
  font-size: 13.5px; font-weight: 600;
  transition: transform 0.06s ease, background 0.15s ease, border-color 0.15s ease;
  white-space: nowrap;
}
.btn:active { transform: scale(0.98); }
.btn svg { width: 17px; height: 17px; }
.btn-sm svg { width: 16px; height: 16px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn:disabled:active { transform: none; }
.btn-primary { background: var(--text); color: var(--bg); }
.btn-primary:hover { background: #000; }
.btn-accent { background: var(--accent); color: #fff; }
.btn-accent:hover { background: var(--accent-dark); }
.btn-soft { background: var(--accent-soft); color: var(--accent-dark); }
.btn-soft:hover { background: color-mix(in oklch, var(--accent-soft) 70%, var(--accent) 30%); }
.btn-ghost { background: var(--surface); color: var(--text); border: 1px solid var(--border-strong); }
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: 7px 12px; font-size: 12.5px; border-radius: 10px; }

/* mood pill */
.mood-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 10px 4px 8px; border-radius: 999px;
  font-size: 12px; font-weight: 600; white-space: nowrap;
  background: var(--surface-2); color: var(--text-2);
}
.mood-pill .e { font-size: 13px; line-height: 1; }
.mood-pill.tinted { background: color-mix(in oklch, var(--mc) 16%, var(--surface)); color: color-mix(in oklch, var(--mc) 70%, var(--text)); }

.in-call-pill {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 3px 10px 3px 8px; border-radius: 999px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase;
  background: var(--online-soft); color: oklch(0.42 0.13 150);
  border: 1px solid oklch(0.86 0.07 145);
}
.in-call-dot {
  width: 6px; height: 6px; border-radius: 50%; background: var(--online);
  animation: in-call-pulse 1.6s ease-in-out infinite;
}
@keyframes in-call-pulse {
  0% { box-shadow: 0 0 0 0 oklch(0.62 0.18 150 / 0.55); }
  70% { box-shadow: 0 0 0 6px oklch(0.62 0.18 150 / 0); }
  100% { box-shadow: 0 0 0 0 oklch(0.62 0.18 150 / 0); }
}

.trend { display: inline-flex; align-items: center; gap: 3px; font-size: 12px; font-weight: 600; }
.trend.up { color: oklch(0.55 0.13 150); }
.trend.down { color: var(--danger); }
.trend.flat { color: var(--text-3); }
.info-tip { display: inline-flex; align-items: center; position: relative; color: var(--text-3); cursor: help; vertical-align: -2px; }
.info-tip:hover { color: var(--accent-dark); }
.info-tip::after {
  content: attr(data-tip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: var(--bg); font-size: 11px; font-weight: 500; white-space: nowrap;
  padding: 6px 9px; border-radius: 7px; box-shadow: var(--shadow-md);
  opacity: 0; pointer-events: none; transition: opacity 0.13s ease; z-index: 20;
}
.info-tip:hover::after { opacity: 1; }

/* avatars by mood ring */
.avatar {
  border-radius: 50%; background: var(--surface-2); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  font-weight: 600; flex-shrink: 0; letter-spacing: 0.01em;
}

/* ───────────────────────── Home ───────────────────────── */
/* Home — full-page chatbot */
.home-fullchat { display: flex; flex-direction: column; }
.home-fullchat .home-chat-main { flex: 1; min-height: 0; display: flex; }
.home-fullchat .home-chat-main .chat-shell { flex: 1; height: 100%; box-shadow: var(--shadow-md); }

/* Home — full-page chatbot: 4 KPI blocks on top, chat + vigilance below */
.page-home.home-fullchat {
  padding: 0; max-width: none; height: 100vh;
  display: flex; flex-direction: column;
}
.home-fullchat .home-fc-kpis {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 14px;
  padding: 18px 20px; flex-shrink: 0;
}
.home-fullchat .home-fc-body {
  flex: 1; min-height: 0;
  display: grid; grid-template-columns: 1fr 360px; gap: 0;
  border-top: 1px solid var(--border);
}
.home-fullchat .home-chat-main { min-width: 0; min-height: 0; display: flex; }
.home-fullchat .home-chat-main .chat-shell { flex: 1; height: 100%; box-shadow: none; border: none; border-radius: 0; }
.home-fullchat .home-vig-aside {
  border-left: 1px solid var(--border); background: var(--surface-2);
  overflow-y: auto; min-height: 0; padding: 16px;
}
.home-fullchat .home-vig-aside .vig-panel { background: var(--surface); }
@media (max-width: 1100px) {
  .page-home.home-fullchat { height: auto; min-height: 100%; }
  .home-fullchat .home-fc-kpis { grid-template-columns: 1fr 1fr; }
  .home-fullchat .home-fc-body { grid-template-columns: 1fr; }
  .home-fullchat .home-chat-main { min-height: 520px; }
  .home-fullchat .home-vig-aside { border-left: none; border-top: 1px solid var(--border); }
}

/* Points de vigilance */
.vig-panel { padding: 18px 20px; position: relative; }
.vig-locked .vig-head ~ * { filter: blur(6px); pointer-events: none; user-select: none; }
.apais-card.vig-locked { position: relative; }
.apais-card.vig-locked .panel-head, .apais-card.vig-locked .panel-head ~ * { filter: blur(6px); pointer-events: none; user-select: none; }
.apais-card.vig-locked .vig-gate { filter: none; }
.vig-locked .vig-head { filter: blur(5px); }
.vig-gate {
  position: absolute; inset: 0; z-index: 5;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 11px; padding: 24px;
}
.vig-gate-ic {
  width: 50px; height: 50px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-dark); box-shadow: var(--shadow-md);
}
.vig-gate-title { font-size: 15px; font-weight: 600; }
.vig-gate-sub { font-size: 12.5px; color: var(--text-2); max-width: 320px; line-height: 1.5; }
.vig-compact { padding: 0; border: none; box-shadow: none; background: transparent; }
.vig-compact .vig-list { grid-template-columns: 1fr; }
.vig-head { display: flex; align-items: center; gap: 12px; margin-bottom: 14px; }
.vig-orb {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C12 7 17 12 22 12 17 12 12 17 12 22 12 17 7 12 2 12 7 12 12 7 12 2Z' transform='translate(-0.6 3.4) scale(0.8)'/%3E%3Cpath d='M12 2C12 7 17 12 22 12 17 12 12 17 12 22 12 17 7 12 2 12 7 12 12 7 12 2Z' transform='translate(12.6 0.4) scale(0.46)'/%3E%3Cpath d='M12 2C12 7 17 12 22 12 17 12 12 17 12 22 12 17 7 12 2 12 7 12 12 7 12 2Z' transform='translate(15.3 14.8) scale(0.3)'/%3E%3C/svg%3E") center / 60% no-repeat,
    radial-gradient(circle at 32% 30%, oklch(0.85 0.06 175), var(--accent));
  box-shadow: 0 4px 12px -4px oklch(0.62 0.07 175 / 0.5); position: relative;
}
.vig-orb-ic { width: 36px; height: 36px; border-radius: 11px; flex-shrink: 0; background: var(--accent-soft); color: var(--accent-dark); display: inline-flex; align-items: center; justify-content: center; }
.vig-orb.pulsing::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--accent); animation: orbRipple 1.8s ease-out infinite;
}
.vig-title { font-size: 15px; font-weight: 600; letter-spacing: -0.005em; display: flex; align-items: center; gap: 8px; }
.vig-count {
  display: inline-flex; align-items: center; justify-content: center;
  min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px;
  background: var(--warn-soft); color: oklch(0.42 0.10 60); font-size: 11.5px; font-weight: 700;
}
.vig-sub { font-size: 12px; color: var(--text-3); margin-top: 1px; }
.vig-empty { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-2); padding: 4px 0; }
.vig-empty svg { color: var(--accent-dark); }

.vig-list { display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr)); gap: 12px; }
.vig-list-row {
  display: flex; gap: 12px; overflow-x: auto; padding-bottom: 6px;
  scroll-snap-type: x proximity; grid-template-columns: none;
}
.vig-list-row .vig-card { flex: 0 0 calc(50% - 6px); max-width: calc(50% - 6px); scroll-snap-align: start; }
.vig-row { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: stretch; min-width: 0; }
.vig-row > * { min-width: 0; }
.vig-row .vig-list-row .vig-card { flex: 0 0 100%; max-width: 100%; }
.vig-pager { display: flex; align-items: center; justify-content: center; gap: 14px; margin-top: 12px; }
.vig-pager-info { font-size: 12px; font-weight: 600; color: var(--text-2); font-variant-numeric: tabular-nums; }
.vig-nav-btn { width: 32px; height: 32px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: var(--surface-2); color: var(--text-2); transition: all 0.13s ease; }
.vig-nav-btn:hover:not(:disabled) { background: var(--accent-soft); color: var(--accent-dark); }
.vig-nav-btn:disabled { opacity: 0.3; cursor: not-allowed; }
@media (max-width: 980px) { .vig-row { grid-template-columns: 1fr; } }
.vig-chart { display: flex; flex-direction: column; gap: 10px; padding: 14px 16px; border: 1px solid var(--border); border-radius: var(--radius); background: var(--surface); }
.vig-chart-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 10px; }
.vig-chart-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.vig-chart-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.vig-chart .chart-svg { width: 100%; height: auto; }
.calls-evo { display: flex; flex-direction: column; gap: 14px; }
.calls-evo .panel-head { align-items: flex-start; }
.calls-evo-sub { display: block; font-size: 12px; color: var(--text-3); margin-top: 3px; }
.calls-evo-legend { display: flex; gap: 18px; margin: -4px 0 2px; }
.cel-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12px; color: var(--text-2); }
.cel-dot { width: 12px; height: 3px; border-radius: 2px; display: inline-block; }
.calls-evo-stats { display: flex; flex-direction: column; gap: 16px; flex-shrink: 0; }
.calls-evo-stat { display: flex; flex-direction: column; gap: 1px; }
.ces-val { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.ces-lbl { font-size: 11px; color: var(--text-3); }
.calls-evo-svg { flex: 1; min-width: 0; width: 100%; height: auto; }

/* Page Réponses ciblées */
.resp-page { position: relative; }
.resp-intro { display: flex; align-items: center; gap: 14px; margin-bottom: 18px; }
.resp-intro .vig-orb { width: 34px; height: 34px; flex-shrink: 0; }
.resp-intro-title { font-size: 17px; font-weight: 600; letter-spacing: -0.01em; }
.resp-intro-sub { font-size: 13px; color: var(--text-2); margin-top: 2px; max-width: 620px; line-height: 1.45; }
.resp-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(360px, 1fr)); gap: 16px; }
.resp-card { display: flex; flex-direction: column; gap: 14px; padding: 18px; }
.resp-card-head { display: flex; align-items: center; gap: 12px; }
.resp-card-id { flex: 1; min-width: 0; }
.resp-card-name { font-size: 15px; font-weight: 600; }
.resp-card-room { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.resp-qa-list { display: flex; flex-direction: column; gap: 12px; }
.resp-qa { padding-left: 12px; border-left: 2px solid var(--accent-soft); }
.resp-qa-q { font-size: 12.5px; font-weight: 600; color: var(--accent-dark); display: flex; align-items: center; gap: 6px; margin-bottom: 3px; }
.resp-qa-a { font-size: 13px; line-height: 1.5; color: var(--text); }
.resp-qa-when { font-size: 11px; color: var(--text-3); margin-top: 3px; }
.resp-card-foot { display: flex; gap: 8px; margin-top: auto; padding-top: 4px; }

/* Page Réponses ciblées — master / detail */
.resp2 { display: grid; grid-template-columns: 280px 1fr; gap: 16px; align-items: start; position: relative; }
.resp2-list { display: flex; flex-direction: column; gap: 4px; }
.resp2-list-head { display: flex; align-items: center; gap: 11px; padding: 4px 6px 12px; }
.resp2-list-head .vig-orb { width: 30px; height: 30px; flex-shrink: 0; }
.resp2-list-title { font-size: 14px; font-weight: 600; letter-spacing: -0.01em; }
.resp2-list-sub { font-size: 11.5px; color: var(--text-3); margin-top: 1px; }
.resp2-item { display: flex; align-items: center; gap: 11px; padding: 10px 12px; border-radius: 12px; text-align: left; width: 100%; transition: background 0.13s ease; }
.resp2-item:hover { background: var(--surface-2); }
.resp2-item.active { background: var(--accent-soft); }
.resp2-item-id { flex: 1; min-width: 0; display: flex; flex-direction: column; }
.resp2-item-name { font-size: 13.5px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.resp2-item.active .resp2-item-name { color: var(--accent-dark); }
.resp2-item-room { font-size: 11px; color: var(--text-3); }
.resp2-item-count { flex-shrink: 0; min-width: 22px; height: 22px; padding: 0 7px; border-radius: 999px; background: var(--surface-2); color: var(--text-2); font-size: 11.5px; font-weight: 700; display: inline-flex; align-items: center; justify-content: center; }
.resp2-item.active .resp2-item-count { background: var(--accent); color: #fff; }
.resp2-detail { padding: 22px 24px; display: flex; flex-direction: column; gap: 20px; }
.resp2-detail-head { display: flex; align-items: center; gap: 14px; padding-bottom: 18px; border-bottom: 1px solid var(--border); }
.resp2-detail-id { flex: 1; min-width: 0; }
.resp2-detail-name { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.resp2-detail-meta { font-size: 12.5px; color: var(--text-3); margin-top: 2px; }
.resp2-detail-actions { display: flex; gap: 8px; flex-shrink: 0; }
.resp2-qa-list { display: flex; flex-direction: column; gap: 18px; }
.resp2-qa { display: flex; flex-direction: column; gap: 5px; }
.resp2-qa-q { font-size: 13px; font-weight: 600; color: var(--accent-dark); }
.resp2-qa-a { font-size: 14px; line-height: 1.55; color: var(--text); }
.resp2-qa-when { font-size: 11px; color: var(--text-3); display: inline-flex; align-items: center; gap: 5px; margin-top: 1px; }
.resp2-detail-foot { margin-top: auto; padding-top: 18px; border-top: 1px solid var(--border); display: flex; }
@media (max-width: 880px) { .resp2 { grid-template-columns: 1fr; } }
.resp2-embed { margin-top: 6px; }
.resp2-embed .resp2-detail { border: 1px solid var(--border); box-shadow: none; background: var(--surface-2); }
.resp2-embed .resp2-detail-head { border-bottom-color: var(--border-strong); }
.resp2-embed .resp2-list { max-height: 360px; overflow-y: auto; padding-right: 4px; }
.resp2-embed .resp2-qa-list { gap: 14px; }
.resp2-more { align-self: flex-start; display: inline-flex; align-items: center; gap: 5px; font-size: 12.5px; font-weight: 600; color: var(--accent-dark); padding: 4px 0; }
.resp2-more:hover { color: var(--accent); }
.resp2-empty { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--text-2); padding: 12px; }
.resp2-empty svg { color: var(--accent-dark); }
.resp2-detail-empty { align-items: center; justify-content: center; text-align: center; gap: 12px; min-height: 320px; }
.resp2-done-ic { width: 60px; height: 60px; border-radius: 50%; background: var(--accent-soft); color: var(--accent-dark); display: inline-flex; align-items: center; justify-content: center; }
.resp2-done-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; }
.resp2-done-sub { font-size: 13px; color: var(--text-2); max-width: 360px; line-height: 1.5; }
.calls-evo-row { display: flex; align-items: center; gap: 24px; }
.calls-evo-seg { display: inline-flex; background: var(--surface-2); border: 1px solid var(--border); border-radius: 10px; padding: 3px; flex-shrink: 0; }
.calls-evo-seg button { padding: 6px 12px; font-size: 12px; font-weight: 600; color: var(--text-3); border-radius: 7px; transition: all 0.12s ease; }
.calls-evo-seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
@media (max-width: 880px) { .calls-evo-row { flex-direction: column; align-items: stretch; } .calls-evo-stats { flex-direction: row; justify-content: space-around; } }
@media (max-width: 880px) { .vig-split { grid-template-columns: 1fr; } }
.vig-list-row::-webkit-scrollbar { height: 8px; }
.vig-nav { display: flex; justify-content: center; gap: 10px; margin-top: 14px; }
.vig-nav-btn {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.14s ease;
}
.vig-nav-btn:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-dark); }
.vig-nav-btn:active { transform: scale(0.94); }
.vig-card {
  border: 1px solid var(--border); border-radius: var(--radius); padding: 14px;
  background: var(--surface); display: flex; flex-direction: column; gap: 11px;
  border-left: 3px solid var(--warn);
}
.vig-card.sev-high { border-left-color: var(--danger); background: color-mix(in oklch, var(--danger-soft) 30%, var(--surface)); }
.vig-card-top { display: flex; align-items: center; gap: 11px; }
.vig-card-id { flex: 1; min-width: 0; }
.vig-card-name { font-size: 14px; font-weight: 600; }
.vig-card-trend { font-size: 11.5px; color: var(--danger); display: flex; align-items: center; gap: 4px; margin-top: 2px; }
.vig-sev {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase;
  padding: 4px 9px; border-radius: 999px; flex-shrink: 0;
  background: var(--warn-soft); color: oklch(0.42 0.10 60);
}
.vig-sev.sev-high { background: var(--danger-soft); color: var(--danger); }
.vig-card-body { font-size: 12.5px; line-height: 1.5; }
.vig-reason { color: var(--text); }
.vig-lbl {
  display: inline-block; font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--text-3); margin-right: 7px;
}
.vig-suggestion {
  display: flex; align-items: flex-start; gap: 7px; margin-top: 9px; padding: 9px 11px;
  background: var(--accent-soft); color: var(--accent-dark); border-radius: var(--radius-sm); line-height: 1.45;
}
.vig-suggestion svg { flex-shrink: 0; margin-top: 1px; }
.vig-answers { margin-top: 11px; padding-top: 11px; border-top: 1px dashed var(--border); }
.vig-answers-h {
  display: flex; align-items: center; gap: 6px; margin-bottom: 8px;
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3);
}
.vig-answers-h svg { color: var(--accent-dark); }
.vig-qa { padding: 7px 10px; background: var(--surface-2); border-radius: var(--radius-sm); margin-bottom: 6px; }
.vig-qa:last-child { margin-bottom: 0; }
.vig-qa-q { font-size: 11.5px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.vig-qa-a { font-size: 12px; line-height: 1.45; color: var(--text-2); }
.vig-card-sub2 { font-size: 11.5px; color: var(--text-3); margin-top: 2px; }
.vig-by { display: inline-flex; align-items: center; gap: 6px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-dark); margin-bottom: 9px; }
.vig-by-orb { width: 12px; height: 12px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, oklch(0.85 0.06 175), var(--accent)); }
.vig-pill {
  font-size: 10.5px; font-weight: 700; letter-spacing: 0.02em;
  padding: 4px 9px; border-radius: 999px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-dark);
}
.vig-card-more {
  align-self: flex-start; font-size: 12px; font-weight: 600; color: var(--accent-dark);
  padding: 4px 0; margin-top: 2px;
}
.vig-card-more:hover { color: var(--accent); }
.vig-card-actions { display: flex; gap: 8px; }
.vig-done-btn { margin-left: auto; }
.vig-skel { display: flex; flex-direction: column; gap: 7px; }
.vig-skel span { height: 9px; border-radius: 4px; background: var(--surface-2); animation: vigPulse 1.3s ease-in-out infinite; }
.vig-skel span:nth-child(1) { width: 100%; }
.vig-skel span:nth-child(2) { width: 88%; }
.vig-skel span:nth-child(3) { width: 60%; }
@keyframes vigPulse { 0%,100% { opacity: 0.5; } 50% { opacity: 1; } }
.vig-more {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; margin-top: 12px; padding: 11px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  font-size: 13px; font-weight: 600; color: var(--accent-dark); background: var(--surface);
  transition: background 0.13s ease, border-color 0.13s ease;
}
.vig-more:hover { background: var(--accent-soft); border-color: var(--accent-soft); }

/* Configuration card buttons (resident profile) */
.cfg-card .panel-head { margin-bottom: 12px; }
.cfg-btns { display: flex; flex-direction: column; gap: 8px; }
.cfg-btn {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 13px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); transition: border-color 0.14s ease, background 0.14s ease;
}
.cfg-btn:hover { border-color: var(--border-strong); background: var(--surface-2); }
.cfg-btn-ic {
  width: 38px; height: 38px; border-radius: 10px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-dark);
}
.cfg-btn-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.cfg-btn-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.cfg-btn-sub { font-size: 11.5px; color: var(--text-3); }

/* Configuration modals */
.cfg-modal-backdrop {
  position: fixed; inset: 0; z-index: 320; background: rgba(20,20,18,0.5);
  display: flex; align-items: center; justify-content: center; padding: 32px;
  backdrop-filter: blur(2px);
}
.cfg-modal {
  width: min(620px, 95vw); max-height: 88vh; background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
  animation: popIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.cfg-modal-sm { width: min(500px, 95vw); }
.settings-tabs { padding: 0 24px; margin-bottom: 0; border-bottom: 1px solid var(--border); }
.settings-tabs .prof-tab { padding: 11px 14px; font-size: 13px; }
.pin-input { letter-spacing: 0.5em; font-size: 17px; text-align: center; font-weight: 600; }
.cfg-modal-lg { width: min(760px, 95vw); }
.q-choice { display: flex; flex-wrap: wrap; gap: 8px; }
.q-chip {
  padding: 8px 14px; border-radius: 999px; font-size: 13px; font-weight: 500;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: all 0.13s ease;
}
.q-chip:hover { border-color: var(--border-strong); }
.q-chip.active { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-dark); font-weight: 600; }
.q-block { border: 1px solid var(--border); border-radius: var(--radius); padding: 16px; display: flex; flex-direction: column; gap: 12px; background: var(--surface-2); }
.q-block-h { font-size: 12px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-dark); }
.q-block .cfg-input, .q-block .cfg-textarea { background: var(--surface); }
.cfg-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 20px 24px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--accent-soft) 40%, var(--surface));
}
.cfg-step { font-size: 11px; font-weight: 600; letter-spacing: 0.06em; text-transform: uppercase; color: var(--text-3); }
.cfg-modal-title { font-size: 18px; font-weight: 700; letter-spacing: -0.01em; margin-top: 4px; }
.cfg-head-right { display: flex; align-items: center; gap: 14px; }
.cfg-progress { display: flex; gap: 6px; }
.cfg-dot { width: 22px; height: 5px; border-radius: 999px; background: var(--border-strong); transition: background 0.16s ease; }
.cfg-dot.on { background: var(--accent); }
.cfg-modal-body { padding: 22px 24px; overflow-y: auto; display: flex; flex-direction: column; gap: 16px; }
.cfg-intro { font-size: 13px; line-height: 1.55; color: var(--text-2); margin: 0; }
.cfg-row.two { display: grid; grid-template-columns: 1fr 1fr; gap: 14px; }
.cfg-field { display: flex; flex-direction: column; gap: 5px; }
.cfg-field-narrow { max-width: 160px; }
.cfg-label { font-size: 12px; font-weight: 600; color: var(--text); }
.cfg-hint { font-size: 11.5px; color: var(--text-3); line-height: 1.4; }
.cfg-input, .cfg-textarea {
  width: 100%; padding: 11px 13px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 13.5px; color: var(--text); outline: none;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.cfg-input:focus, .cfg-textarea:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.cfg-textarea { resize: vertical; line-height: 1.5; font-family: inherit; }
.cfg-modal-actions {
  display: flex; align-items: center; justify-content: space-between; gap: 10px;
  padding: 16px 24px; border-top: 1px solid var(--border); background: var(--surface);
}
.cfg-actions-hint { font-size: 12px; color: var(--text-3); margin-left: auto; margin-right: 6px; }
.cfg-draft-btn { margin-left: auto; }
.cfg-actions-hint + .cfg-draft-btn { margin-left: 0; }
.draft-banner {
  display: flex; align-items: center; gap: 13px; width: 100%; text-align: left;
  padding: 14px 16px; margin-bottom: 16px; border-radius: var(--radius);
  border: 1px dashed var(--accent); background: var(--accent-soft);
  transition: background 0.14s ease;
}
.draft-banner:hover { background: color-mix(in oklch, var(--accent-soft) 70%, var(--accent) 30%); }
.draft-ic { width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0; background: var(--surface); color: var(--accent-dark); display: inline-flex; align-items: center; justify-content: center; }
.draft-tx { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 1px; }
.draft-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.draft-sub { font-size: 12px; color: var(--accent-dark); }
.draft-resume { display: inline-flex; align-items: center; gap: 4px; font-size: 12.5px; font-weight: 600; color: var(--accent-dark); flex-shrink: 0; }
.draft-del { width: 28px; height: 28px; border-radius: 8px; flex-shrink: 0; display: inline-flex; align-items: center; justify-content: center; color: var(--text-3); }
.draft-del:hover { background: var(--surface); color: var(--danger); }

/* Residents toolbar (add resident) */
.res-toolbar { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 18px; }
.res-toolbar-title { font-size: 20px; font-weight: 700; letter-spacing: -0.01em; margin: 0; }
.res-toolbar-sub { font-size: 13px; color: var(--text-3); margin: 3px 0 0; }

/* Add-resident recap + done */
.cfg-recap { display: flex; flex-direction: column; gap: 0; }
.cfg-recap-row { display: flex; gap: 14px; padding: 12px 0; border-top: 1px dashed var(--border); font-size: 13.5px; }
.cfg-recap-row:first-child { border-top: none; }
.cfg-recap-row .k { flex-shrink: 0; width: 110px; color: var(--text-3); font-weight: 600; }
.cfg-recap-row .v { color: var(--text); line-height: 1.5; }
.cfg-recap-note {
  display: flex; align-items: center; gap: 8px; margin-top: 14px;
  font-size: 12px; color: var(--accent-dark); background: var(--accent-soft);
  padding: 11px 13px; border-radius: var(--radius-sm);
}
.cfg-done { padding: 40px 32px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 12px; }
.cfg-done-ic {
  width: 64px; height: 64px; border-radius: 50%; margin-bottom: 4px;
  background: var(--online-soft); color: oklch(0.42 0.13 150);
  display: flex; align-items: center; justify-content: center;
}
.cfg-done-title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.cfg-done-sub { font-size: 13.5px; color: var(--text-2); line-height: 1.5; max-width: 320px; margin-bottom: 8px; }

/* Appels récents page */
.calls-filter {
  display: flex; align-items: center; gap: 10px; flex-wrap: wrap;
  padding: 11px 13px; margin-bottom: 14px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: var(--radius);
}
.calls-filter-field { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.calls-filter-field input {
  border: 1px solid var(--border); border-radius: 8px; padding: 6px 9px;
  font-size: 12.5px; color: var(--text); background: var(--surface); outline: none; font-family: inherit;
}
.calls-filter-field input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.calls-filter-clear {
  display: inline-flex; align-items: center; gap: 4px; font-size: 12px; font-weight: 600;
  color: var(--text-3); padding: 5px 8px; border-radius: 8px;
}
.calls-filter-clear:hover { background: var(--surface); color: var(--danger); }
.calls-filter-count { margin-left: auto; font-size: 12px; font-weight: 600; color: var(--text-3); }
.recentpage-list { display: flex; flex-direction: column; gap: 12px; max-width: 860px; margin: 0 auto; }
.recentpage-item {
  display: flex; align-items: flex-start; gap: 14px; padding: 16px 18px;
  text-align: left; width: 100%; cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.recentpage-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.recentpage-body { flex: 1; min-width: 0; }
.recentpage-head { display: flex; align-items: baseline; justify-content: space-between; gap: 12px; margin-bottom: 9px; }
.recentpage-name { font-size: 15px; font-weight: 600; }
.recentpage-when { font-size: 12px; color: var(--text-3); white-space: nowrap; font-variant-numeric: tabular-nums; }
.recentpage-flow { display: flex; align-items: center; gap: 8px; margin-bottom: 9px; flex-wrap: wrap; }
.recentpage-sum { font-size: 13px; line-height: 1.5; color: var(--text-2); }
.recentpage-sum.locked { filter: blur(5px); user-select: none; }
.is-unlocked .recentpage-sum.locked { filter: none; user-select: auto; }
.recentpage-item .res-open { margin-top: 4px; }
.chat-topbanner {
  display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px;
  padding: 16px 18px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--accent-soft) 30%, var(--surface));
  flex-shrink: 0; position: relative; z-index: 7;
}
.chat-topbanner .mini-stat { box-shadow: none; background: var(--surface); }

/* Home — compact ribbon + full-height chat */
.home-compact { display: flex; flex-direction: column; gap: 14px; }
.home-compact .home-kpi-ribbon { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; flex-shrink: 0; }
.mini-stat { display: flex; align-items: center; gap: 12px; padding: 12px 16px; }
.mini-stat-ic {
  width: 36px; height: 36px; border-radius: 10px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-dark);
  display: inline-flex; align-items: center; justify-content: center;
}
.mini-stat-body { min-width: 0; }
.mini-stat-val { font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.05; }
.mini-stat-label { font-size: 12px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.mini-stat-foot { margin-left: auto; font-size: 11.5px; white-space: nowrap; }
.home-chat-main { flex: 1; min-height: 0; display: flex; }
.home-chat-main .chat-shell { flex: 1; height: 100%; box-shadow: var(--shadow-md); }

/* Home — chatbot-forward layout */
.home-chatfwd { display: flex; flex-direction: column; gap: 14px; }
.home-kpi-ribbon { display: grid; grid-template-columns: repeat(3, 1fr); gap: 14px; flex-shrink: 0; }
.home-kpi-ribbon .stat-tile { padding: 14px 18px; }
.home-kpi-ribbon .stat-val { font-size: 26px; }
.home-chat-main { flex: 1; min-height: 0; display: flex; }
.home-chat-main .chat-shell { flex: 1; height: 100%; box-shadow: var(--shadow-md); }

/* Home — chatbot hero layout */
.page-home { height: calc(100vh - 64px - 56px); }
.home-hero { display: grid; grid-template-columns: 1fr 1.7fr; gap: 16px; height: 100%; align-items: stretch; }
.home-hero > * { min-width: 0; min-height: 0; }
.home-hero-rail { display: flex; flex-direction: column; gap: 14px; min-height: 0; }
.home-kpis { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; flex-shrink: 0; }
.home-kpis .stat-tile { padding: 15px 16px; }
.home-kpis .stat-val { font-size: 25px; }
.home-recent { flex: 1; display: flex; flex-direction: column; min-height: 0; }
.home-recent .recent-calls { display: flex; flex-direction: column; gap: 8px; overflow-y: auto; overflow-x: hidden; min-height: 0; }
.home-hero-chat { display: flex; min-height: 0; }
.home-hero-chat .chat-shell { flex: 1; height: 100%; box-shadow: var(--shadow-md); }

.home-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 16px; }
.stat-tile {
  padding: 18px 20px; display: flex; flex-direction: column; gap: 6px;
}
.stat-ic {
  width: 38px; height: 38px; border-radius: 11px;
  background: var(--accent-soft); color: var(--accent-dark);
  display: inline-flex; align-items: center; justify-content: center;
  margin-bottom: 4px;
}
.stat-val { font-size: 30px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.stat-label { font-size: 13px; color: var(--text-2); }
.stat-foot { font-size: 12px; color: var(--text-3); margin-top: 2px; display: flex; align-items: center; gap: 6px; }

.home-cols { display: grid; grid-template-columns: 1fr 1.5fr; gap: 16px; margin-top: 16px; align-items: start; }
.home-cols > * { min-width: 0; }
.home-assistant { margin-top: 16px; height: 620px; }
.home-assistant .chat-shell { height: 100%; }
.recent-calls-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }

/* Calls accepted/refused chart legend */
.calls-chart-legend { display: flex; align-items: center; gap: 18px; margin-bottom: 10px; }
.calls-chart-legend .ccl-item { display: inline-flex; align-items: center; gap: 7px; font-size: 12.5px; color: var(--text-2); }
.calls-chart-legend .ccl-item .dot { width: 11px; height: 11px; border-radius: 3px; }
.calls-chart-legend .ccl-item b { color: var(--text); font-weight: 700; }
.calls-chart-legend .ccl-rate {
  margin-left: auto; font-size: 12px; font-weight: 600;
  color: var(--accent-dark); background: var(--accent-soft);
  padding: 5px 11px; border-radius: 999px;
}
@media (max-width: 920px) { .recent-calls-grid { grid-template-columns: 1fr; } }

.panel { padding: 20px; }
.panel-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; }
.panel-head h3 { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.link-btn { font-size: 12.5px; font-weight: 600; color: var(--accent-dark); display: inline-flex; align-items: center; gap: 3px; }
.link-btn:hover { color: var(--accent); }

/* activity feed */
.feed { display: flex; flex-direction: column; }
.feed-row {
  display: flex; align-items: center; gap: 12px;
  padding: 12px 4px; border-top: 1px dashed var(--border);
  text-align: left; width: 100%; transition: background 0.12s ease;
  border-radius: 8px;
}
.feed-row:first-child { border-top: none; }
.feed-row:hover { background: var(--surface-2); }
.feed-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 16px; flex-shrink: 0;
  background: color-mix(in oklch, var(--mc) 15%, var(--surface));
}
.feed-body { flex: 1; min-width: 0; }
.feed-name { font-size: 13.5px; font-weight: 600; }
.feed-note { font-size: 12.5px; color: var(--text-2); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.feed-when { font-size: 11.5px; color: var(--text-3); white-space: nowrap; flex-shrink: 0; }

/* derniers appels (home) */
.recent-calls { display: flex; flex-direction: column; }
.recent-call {
  display: flex; align-items: flex-start; gap: 12px;
  padding: 13px 4px; border-top: 1px dashed var(--border);
  text-align: left; width: 100%; border-radius: 8px;
  transition: background 0.12s ease;
}
.recent-call:first-child { border-top: none; }
.recent-call:hover { background: var(--surface-2); }
.recent-call-body { flex: 1; min-width: 0; }
.recent-call-head { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; margin-bottom: 3px; flex-wrap: wrap; }
.recent-call-name { font-size: 13.5px; font-weight: 600; }
.recent-call-when { font-size: 11.5px; color: var(--text-3); white-space: nowrap; flex-shrink: 0; font-variant-numeric: tabular-nums; }
.recent-call-sum.locked { filter: blur(5px); user-select: none; }
.recent-call-sum {
  font-size: 12.5px; line-height: 1.45; color: var(--text-2);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}

/* ───────────────────────── Residents list ───────────────────────── */
.list-toolbar { display: flex; align-items: center; gap: 10px; margin-bottom: 18px; flex-wrap: wrap; }
.seg {
  display: inline-flex; background: var(--surface-2); border: 1px solid var(--border);
  border-radius: 10px; padding: 3px;
}
.seg button {
  padding: 7px 13px; font-size: 12.5px; font-weight: 600; color: var(--text-3);
  border-radius: 7px; transition: all 0.12s ease;
}
.seg button.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.chip-filter {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 14px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  transition: all 0.13s ease;
}
.chip-filter:hover { border-color: var(--border-strong); }
.chip-filter.active { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent-soft); }

.res-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(320px, 1fr)); gap: 16px; }

.res-card {
  padding: 18px; display: flex; flex-direction: column; gap: 14px;
  text-align: left; transition: border-color 0.15s ease, box-shadow 0.15s ease, transform 0.08s ease;
  cursor: pointer;
}
.res-card:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.res-card:active { transform: translateY(1px); }
.res-top { display: flex; align-items: flex-start; gap: 13px; }
.res-avatar { width: 48px; height: 48px; font-size: 15px; position: relative; }
.res-avatar .ring {
  position: absolute; inset: -3px; border-radius: 50%;
  border: 2px solid var(--mc); opacity: 0.7;
}
.res-id { flex: 1; min-width: 0; }
.res-name { font-size: 15.5px; font-weight: 600; letter-spacing: -0.01em; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.res-meta { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.res-cond { font-size: 12px; color: var(--text-2); margin-top: 8px; line-height: 1.4; }
.res-foot { display: flex; align-items: center; justify-content: space-between; gap: 10px; padding-top: 13px; border-top: 1px dashed var(--border); }
.res-foot-left { display: flex; align-items: center; gap: 8px; min-width: 0; }
.res-last { font-size: 11.5px; color: var(--text-3); }
.res-summary {
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical;
  overflow: hidden; line-height: 1.45; color: var(--text-2);
}
.res-open {
  width: 34px; height: 34px; border-radius: 50%;
  background: var(--surface-2); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all 0.14s ease; border: 1px solid var(--border);
}
.res-card:hover .res-open { background: var(--accent); color: #fff; border-color: var(--accent); }

/* sparkline mini */
.spark { display: block; }

/* table variant */
.res-table { width: 100%; border-collapse: collapse; }
.res-table thead th {
  text-align: left; font-size: 11px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase;
  color: var(--text-3); padding: 0 16px 12px; border-bottom: 1px solid var(--border);
}
.res-table tbody tr { cursor: pointer; transition: background 0.12s ease; }
.res-table tbody tr:hover { background: var(--surface-2); }
.res-table tbody td { padding: 13px 16px; border-bottom: 1px solid var(--border); font-size: 13.5px; }
.res-table .td-name { font-weight: 600; }
.layout-list .res-grid { grid-template-columns: 1fr; }

/* Logo Livana en tête de l'accueil — mobile uniquement (voir le bloc 720 px) */
.home-mlogo { display: none; }

/* Liste des résidents en version mobile : une ligne empilée par résident,
   pour lire toutes les données sans défilement horizontal. Le tableau à
   6 colonnes reste la version large (bascule à 720 px, plus bas). */
.res-mlist { display: none; }
.res-mrow {
  display: flex; flex-direction: column; gap: 12px;
  padding: 14px 16px; width: 100%; text-align: left;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px;
}
.res-mrow-head { display: flex; align-items: center; gap: 11px; }
.res-mrow-id { flex: 1; min-width: 0; }
.res-mrow-name {
  display: flex; align-items: center; gap: 7px; flex-wrap: wrap;
  font-size: 14.5px; font-weight: 600; color: var(--text);
}
.res-mrow-sub { font-size: 12px; color: var(--text-3); margin-top: 2px; }
.res-mrow-stats { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; }
.res-mstat {
  display: flex; flex-direction: column; gap: 3px;
  padding: 8px 10px; border-radius: 10px; background: var(--surface-2);
}
.res-mstat-lbl {
  font-size: 9.5px; font-weight: 700; letter-spacing: 0.04em;
  text-transform: uppercase; color: var(--text-3);
}
.res-mstat-val { font-size: 15px; font-weight: 600; color: var(--text); }

/* density */
.density-compact .res-card { padding: 14px; gap: 10px; }
.density-compact .page { padding: 20px; }
.density-compact .panel { padding: 16px; }

/* card style variants */
.cardstyle-photo .res-avatar { width: 52px; height: 52px; }
.cardstyle-minimal .res-avatar { display: none; }
.cardstyle-minimal .res-top { gap: 0; }

/* ───────────────────────── Resident profile ───────────────────────── */
.prof-head { display: flex; align-items: flex-start; gap: 18px; margin-bottom: 22px; }
.prof-head-stats { align-items: center; }
.prof-head-kpis { margin-left: auto; display: flex; gap: 10px; flex-shrink: 0; }
.prof-hk {
  text-align: center; padding: 11px 20px; border-radius: var(--radius);
  background: var(--surface); border: 1px solid var(--border); min-width: 92px;
}
.prof-hk-val { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.1; }
.prof-hk-lbl { font-size: 11px; color: var(--text-3); font-weight: 600; letter-spacing: 0.02em; margin-top: 4px; white-space: nowrap; }
@media (max-width: 720px) { .prof-head-kpis { display: none; } }
.prof-back {
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--border); background: var(--surface); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0;
  transition: all 0.14s ease;
}
.prof-back:hover { background: var(--surface-2); color: var(--text); }
.prof-avatar { width: 64px; height: 64px; font-size: 20px; position: relative; }
.prof-id { flex: 1; min-width: 0; }
.prof-name { font-size: 24px; font-weight: 700; letter-spacing: -0.02em; display: flex; align-items: center; gap: 12px; flex-wrap: wrap; }
.prof-sub { font-size: 13.5px; color: var(--text-2); margin-top: 4px; }
.prof-cond { display: inline-flex; align-items: center; gap: 7px; margin-top: 10px; font-size: 12.5px; color: var(--text-2); background: var(--surface-2); padding: 5px 11px; border-radius: 999px; }
.prof-actions { display: flex; gap: 8px; flex-shrink: 0; }

.prof-grid { display: grid; grid-template-columns: 2fr 1fr; gap: 16px; align-items: start; }

/* 3-tab profile layout */
.page-profile { display: flex; flex-direction: column; }
.prof-tabs { display: flex; gap: 4px; border-bottom: 1px solid var(--border); margin-bottom: 18px; }
.prof-tab {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 11px 16px; font-size: 13.5px; font-weight: 600; color: var(--text-3);
  border-bottom: 2px solid transparent; margin-bottom: -1px; transition: color 0.14s ease, border-color 0.14s ease;
}
.prof-tab:hover { color: var(--text); }
.prof-tab.active { color: var(--accent-dark); border-bottom-color: var(--accent); }
.prof-tab svg { opacity: 0.85; }
.prof-tabpane { min-height: 0; }
.prof-pane-chat { height: calc(100vh - 64px - 56px - 110px); min-height: 480px; display: flex; }
.prof-pane-chat .chat-shell { flex: 1; height: 100%; box-shadow: var(--shadow-md); }
.prof-pane-chat .chat-embed { height: 100% !important; min-height: 0 !important; position: static !important; }
.kpi-row-wide { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.call-list-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.cfg-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cfg-card-desc { font-size: 13px; line-height: 1.55; color: var(--text-2); margin: 0 0 14px; }

/* Profile tout-en-chat layout */
.page-fullchat { display: flex; flex-direction: column; height: calc(100vh - 64px); }
.page-fullchat .fullchat-wrap { flex: 1; min-height: 0; display: flex; margin-top: 4px; }
.page-fullchat .fullchat-wrap .chat-shell { flex: 1; height: 100%; border: 1px solid var(--border); border-radius: var(--radius); box-shadow: var(--shadow-sm); }
.fullchat-kpis {
  display: flex; align-items: center; gap: 22px;
  padding: 14px 22px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--accent-soft) 30%, var(--surface));
}
.fc-kpi { display: flex; flex-direction: column; gap: 1px; }
.fc-kpi-val { font-size: 20px; font-weight: 700; letter-spacing: -0.02em; line-height: 1; }
.fc-kpi-lbl { font-size: 11.5px; color: var(--text-2); }
.fc-kpi-action {
  margin-left: auto; display: inline-flex; align-items: center; gap: 7px;
  padding: 8px 13px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  transition: all 0.14s ease;
}
.fc-kpi-action:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-dark); }

.suivi-locked-wrap { position: relative; }
.suivi-locked-block { position: relative; margin-bottom: 16px; }
.suivi-locked-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.suivi-locked-grid .suivi-locked-block { margin-bottom: 0; }
@media (max-width: 900px) { .suivi-locked-grid { grid-template-columns: 1fr; } }
.suivi-locked-block.vig-locked .suivi-locked-content { filter: blur(6px); pointer-events: none; user-select: none; }
.suivi-locked-block .vig-gate { position: absolute; inset: 0; z-index: 5; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 11px; padding: 24px; }
.suivi-locked-wrap.vig-locked .suivi-locked-content { filter: blur(6px); pointer-events: none; user-select: none; }
.suivi-locked-content { display: flex; flex-direction: column; gap: 16px; }

/* Suivi ciblé (directives) */
.dir-wrap { display: flex; flex-direction: column; gap: 16px; }
.dir-intro { display: flex; align-items: flex-start; gap: 14px; padding: 18px 20px; }
.dir-intro-ic {
  width: 40px; height: 40px; border-radius: 11px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-dark);
  display: inline-flex; align-items: center; justify-content: center;
}
.dir-grid { display: grid; grid-template-columns: 1.4fr 1fr; gap: 16px; align-items: start; }
.dir-list { display: flex; flex-direction: column; gap: 10px; }
.dir-item { display: flex; align-items: flex-start; gap: 10px; }
.dir-num {
  width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; margin-top: 7px;
  background: var(--accent-soft); color: var(--accent-dark);
  display: inline-flex; align-items: center; justify-content: center;
  font-size: 12px; font-weight: 700;
}
.dir-input {
  flex: 1; padding: 9px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface); font-size: 13px; color: var(--text); outline: none; resize: vertical;
  line-height: 1.45; font-family: inherit; transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.dir-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.dir-del {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0; margin-top: 5px;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); transition: all 0.13s ease;
}
.dir-del:hover { background: var(--danger-soft); color: var(--danger); }
.dir-add { display: flex; gap: 8px; align-items: center; margin-top: 4px; padding-top: 12px; border-top: 1px dashed var(--border); }
.dir-add-input {
  flex: 1; padding: 10px 12px; border: 1px solid var(--border); border-radius: var(--radius-sm);
  background: var(--surface-2); font-size: 13px; color: var(--text); outline: none;
  transition: border-color 0.14s ease, background 0.14s ease;
}
.dir-add-input:focus { border-color: var(--accent); background: var(--surface); }
.dir-note {
  display: flex; align-items: flex-start; gap: 9px; padding: 12px 14px;
  background: var(--accent-soft); color: var(--accent-dark); border-radius: var(--radius);
  font-size: 12px; line-height: 1.45;
}
.dir-note svg { flex-shrink: 0; margin-top: 1px; }
.suivi-answers { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.suivi-qa { padding: 13px 15px; background: var(--surface-2); border-radius: var(--radius); }
.suivi-qa-q { display: flex; align-items: center; gap: 7px; font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.suivi-qa-q svg { color: var(--accent-dark); flex-shrink: 0; }
.suivi-qa-a { font-size: 13px; line-height: 1.5; color: var(--text-2); }
.suivi-qa-when { font-size: 11px; color: var(--text-3); margin-top: 7px; }
@media (max-width: 720px) { .suivi-answers { grid-template-columns: 1fr; } }
.suivi-q-list { margin: 0; padding-left: 22px; display: flex; flex-direction: column; gap: 9px; }
.suivi-q-list li { font-size: 13.5px; line-height: 1.5; color: var(--text); }
.suivi-q-list li::marker { color: var(--accent-dark); font-weight: 700; }
.suivi-q-sub { margin: 8px 0 14px; font-size: 12.5px; line-height: 1.5; color: var(--text-2); }
.suivi-q-list-cols { columns: 2; column-gap: 28px; }
.synthese-text { font-size: 13.5px; line-height: 1.6; color: var(--text); margin: 0; text-wrap: pretty; }
.apais-intro { font-size: 12px; color: var(--text-2); margin: 0 0 12px; line-height: 1.45; }
.apais-list { display: flex; flex-direction: column; gap: 8px; }
.apais-item {
  display: flex; align-items: flex-start; gap: 9px; font-size: 13px; line-height: 1.4; color: var(--text);
  padding: 9px 12px; background: var(--accent-soft); border-radius: var(--radius-sm);
}
.apais-ic {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
.apais-tx { flex: 1; min-width: 0; }
.apais-count {
  flex-shrink: 0; display: inline-flex; align-items: center; gap: 3px;
  font-size: 11px; font-weight: 700; color: var(--accent-dark);
  background: var(--surface); border-radius: 999px; padding: 3px 8px;
  font-variant-numeric: tabular-nums; align-self: center;
}
.apais-seen {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0; color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center; transition: background 0.12s ease, color 0.12s ease;
}
.apais-seen:hover { background: rgba(0,0,0,0.06); color: var(--text); }
.apais-seen-all {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 10px;
  font-size: 12.5px; font-weight: 600; color: var(--accent-dark);
  padding: 8px 13px; border-radius: 999px; background: var(--accent-soft); transition: background 0.13s ease;
}
.apais-seen-all:hover { background: color-mix(in oklch, var(--accent-soft) 70%, var(--accent) 30%); }
.apais-ic {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0; margin-top: 1px;
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center;
}
@media (max-width: 760px) { .suivi-q-list-cols { columns: 1; } }
.suivi-instr { margin-top: 14px; padding: 12px 14px; background: var(--surface-2); border-radius: var(--radius); font-size: 13px; line-height: 1.5; color: var(--text-2); }
.suivi-instr-lbl { display: block; font-size: 10.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); margin-bottom: 4px; }
.suivi-grid { display: flex; flex-direction: column; gap: 16px; align-items: stretch; }
.suivi-top { display: block; }
.suivi-top > * { min-width: 0; }
.suivi-side { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; min-width: 0; align-items: start; }
@media (max-width: 880px) { .suivi-side { grid-template-columns: 1fr; } }
.suivi-top .suivi-chat-card { display: flex; flex-direction: column; padding-bottom: 18px; }
.suivi-top .suivi-chat { flex: none; height: 520px; min-height: 0; }
@media (max-width: 880px) { .suivi-side { grid-template-columns: 1fr; } }
.suivi-chat-card { display: flex; flex-direction: column; }
.suivi-chat { height: 460px; display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 4px; }
.suivi-chat .chat-shell { flex: 1; height: 100%; min-height: 0; box-shadow: none; border: none; border-radius: var(--radius); }
.suivi-chat .chat-gpt .chat-thread { min-height: 0; }
.suivi-q-note { display: block; font-size: 12px; color: var(--text-3); margin-top: 3px; font-style: italic; }
.hist-list { display: flex; flex-direction: column; }
.hist-item { display: flex; gap: 14px; padding: 13px 0; border-top: 1px dashed var(--border); }
.hist-item:first-child { border-top: none; padding-top: 0; }
.hist-date { flex-shrink: 0; width: 56px; font-size: 11.5px; font-weight: 600; color: var(--accent-dark); padding-top: 1px; }
.hist-body { min-width: 0; }
.hist-q { font-size: 13px; font-weight: 600; color: var(--text); margin-bottom: 3px; }
.hist-a { font-size: 12.5px; line-height: 1.5; color: var(--text-2); }

/* Retour de Livana — timeline */
.rl-timeline { display: flex; flex-direction: column; }
.rl-entry { display: flex; gap: 14px; }
.rl-marker { display: flex; flex-direction: column; align-items: center; flex-shrink: 0; padding-top: 4px; }
.rl-dot { width: 11px; height: 11px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 4px var(--accent-soft); }
.rl-entry:not(:last-child) .rl-marker::after { content: ''; flex: 1; width: 2px; background: var(--border); margin: 6px 0 0; }
.rl-content { flex: 1; min-width: 0; padding-bottom: 18px; }
.rl-entry:last-child .rl-content { padding-bottom: 0; }
.rl-meta { margin-bottom: 4px; }
.rl-date { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--accent-dark); }
.rl-q { font-size: 13.5px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.rl-a { font-size: 12.5px; line-height: 1.55; color: var(--text-2); }
.rl-livana { display: inline-flex; align-items: center; gap: 5px; font-size: 10.5px; font-weight: 700; letter-spacing: 0.03em; text-transform: uppercase; color: var(--accent-dark); margin-right: 7px; vertical-align: 1px; }
.rl-orb { width: 11px; height: 11px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, oklch(0.85 0.06 175), var(--accent)); }
.rl-more {
  display: inline-flex; align-items: center; gap: 7px; margin-top: 14px;
  padding: 9px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--surface-2); color: var(--accent-dark); transition: background 0.13s ease;
}
.rl-more:hover { background: var(--accent-soft); }
.rl-actions { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.rl-ask {
  display: inline-flex; align-items: center; gap: 8px; margin-left: auto;
  padding: 9px 15px; border-radius: 999px; font-size: 12.5px; font-weight: 600;
  background: var(--accent); color: #fff; transition: background 0.13s ease;
}
.rl-ask:hover { background: var(--accent-dark); }
.rl-ask-orb { width: 13px; height: 13px; border-radius: 50%; background: radial-gradient(circle at 32% 30%, oklch(0.9 0.05 175), #fff); opacity: 0.92; }

/* Retour de Livana — Q&A bulles */
.rl-qa-list { display: flex; flex-direction: column; gap: 16px; }
.rl-qa { display: flex; flex-direction: column; gap: 8px; padding-bottom: 16px; border-bottom: 1px dashed var(--border); }
.rl-qa:last-child { padding-bottom: 0; border-bottom: none; }
.rl-qa-head { display: flex; align-items: center; }
.rl-qa-date { font-size: 11px; font-weight: 700; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-3); }
.rl-qa-q { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.45; }
.rl-qa-tag { display: inline-block; font-size: 9.5px; font-weight: 700; letter-spacing: 0.05em; text-transform: uppercase; color: var(--accent-dark); background: var(--accent-soft); padding: 3px 8px; border-radius: 999px; margin-right: 9px; vertical-align: 2px; }
.rl-qa-bubble { display: flex; align-items: flex-start; gap: 10px; background: var(--surface-2); border-radius: 4px 14px 14px 14px; padding: 12px 14px; }
.rl-qa-av { width: 24px; height: 24px; border-radius: 50%; flex-shrink: 0; background: radial-gradient(circle at 32% 30%, oklch(0.85 0.06 175), var(--accent)); }
.rl-qa-txt { font-size: 12.5px; line-height: 1.55; color: var(--text); }
.hist-report { margin-top: 18px; padding-top: 16px; border-top: 1px dashed var(--border); display: flex; flex-direction: column; }
.hist-report .cfg-label { margin-bottom: 8px; }
.hist-report-sent { display: inline-flex; align-items: center; gap: 8px; font-size: 13px; color: var(--accent-dark); background: var(--accent-soft); padding: 11px 13px; border-radius: var(--radius); }
.hist-report-sent svg { flex-shrink: 0; }
@media (max-width: 760px) { .suivi-grid { grid-template-columns: 1fr; } }
.suivi-chat-card { padding-bottom: 0; }
.suivi-chat { height: 460px; display: flex; border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden; margin-top: 4px; }
.suivi-chat .chat-shell { flex: 1; height: 100%; box-shadow: none; }
.dir-q-block { display: flex; flex-direction: column; gap: 6px; }
.ret-opts { display: flex; flex-direction: column; gap: 8px; }
.ret-opt {
  display: flex; align-items: center; gap: 12px; width: 100%; text-align: left;
  padding: 12px 14px; border-radius: var(--radius); border: 1px solid var(--border);
  background: var(--surface); transition: border-color 0.14s ease, background 0.14s ease;
}
.ret-opt:hover { border-color: var(--border-strong); }
.ret-opt.active { border-color: var(--accent); background: var(--accent-soft); }
.ret-opt-radio {
  width: 18px; height: 18px; border-radius: 50%; flex-shrink: 0;
  border: 2px solid var(--border-strong); transition: all 0.14s ease;
}
.ret-opt.active .ret-opt-radio { border-color: var(--accent); background: radial-gradient(circle, var(--accent) 0 5px, transparent 6px); }
.ret-opt-tx { display: flex; flex-direction: column; gap: 1px; }
.ret-opt-l { font-size: 14px; font-weight: 600; color: var(--text); }
.ret-opt-s { font-size: 11.5px; color: var(--accent-dark); font-weight: 600; }
.ret-danger { margin-top: 18px; padding-top: 16px; border-top: 1px solid var(--border); }
.ret-danger-solo { margin-top: 0; padding-top: 0; border-top: none; }
.ret-danger-head { display: flex; align-items: flex-start; gap: 11px; margin-bottom: 12px; }
.ret-danger-ic { width: 32px; height: 32px; border-radius: 9px; flex-shrink: 0; background: var(--danger-soft); color: var(--danger); display: inline-flex; align-items: center; justify-content: center; }
.ret-danger-title { font-size: 13.5px; font-weight: 600; color: var(--text); }
.ret-danger-sub { font-size: 11.5px; color: var(--text-3); margin-top: 2px; line-height: 1.4; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-danger:hover:not(:disabled) { background: oklch(0.50 0.16 25); }
.ret-danger-confirm { display: flex; flex-direction: column; gap: 9px; }
.ret-danger-warn { font-size: 12px; line-height: 1.45; color: var(--text-2); margin: 0; background: var(--danger-soft); padding: 10px 12px; border-radius: 10px; }
.ret-danger-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 2px; }
.ret-danger-done { display: flex; align-items: center; gap: 8px; font-size: 12.5px; color: var(--accent-dark); background: var(--accent-soft); padding: 11px 13px; border-radius: 10px; }
.dir-optional {
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase;
  color: var(--text-3); background: var(--surface-2); padding: 2px 8px; border-radius: 999px;
  margin-left: 8px; vertical-align: middle;
}
@media (max-width: 900px) { .dir-grid { grid-template-columns: 1fr; } }

/* Configuration éditable en ligne */
.cfg-cards-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: 16px; align-items: start; }
.cfg-card { display: flex; flex-direction: column; gap: 10px; padding: 20px; }
.cfg-card-ic {
  width: 42px; height: 42px; border-radius: 12px; flex-shrink: 0;
  background: var(--accent-soft); color: var(--accent-dark);
  display: inline-flex; align-items: center; justify-content: center; margin-bottom: 2px;
}
.cfg-card-title { margin: 0; font-size: 15px; font-weight: 600; }
.cfg-card-desc { font-size: 12.5px; line-height: 1.5; color: var(--text-2); margin: 0; flex: 1; }
.cfg-card-tags { display: flex; flex-wrap: wrap; gap: 6px; }
.cfg-card-list { margin: 0; padding: 0; list-style: none; display: flex; flex-direction: column; gap: 6px; }
.cfg-card-list li {
  font-size: 12px; line-height: 1.4; color: var(--text-2);
  padding: 7px 10px; background: var(--surface-2); border-radius: var(--radius-sm);
  display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.cfg-card-list .cfg-card-more { background: transparent; color: var(--text-3); font-weight: 600; padding: 2px 10px; }
.cfg-card-note {
  font-size: 12px; line-height: 1.45; color: var(--text-3); margin: 0;
  padding: 8px 10px; background: var(--surface-2); border-radius: var(--radius-sm);
}
.btn-block { width: 100%; margin-top: 4px; }
@media (max-width: 900px) { .cfg-cards-grid { grid-template-columns: 1fr; } }

/* Configuration Livana réelle du résident (lecture seule, source Firebase) */
.cfg-live { display: flex; flex-direction: column; gap: 16px; }
.cfg-bloc-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.cfg-bloc { display: flex; flex-direction: column; gap: 5px; min-width: 0; }
.cfg-bloc-large { grid-column: 1 / -1; }
.cfg-bloc-label {
  font-size: 11px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase;
  color: var(--text-3);
}
.cfg-bloc-val {
  font-size: 13.5px; line-height: 1.55; color: var(--text);
  padding: 10px 12px; background: var(--surface-2); border-radius: var(--radius-sm);
  white-space: pre-wrap; word-break: break-word;
}
.cfg-bloc-long { max-height: 260px; overflow-y: auto; }
.cfg-maj { font-size: 12px; color: var(--text-3); margin: 0; }
.cfg-vide { color: var(--text-3); font-style: italic; }
.cfg-bloc-input { width: 100%; font-size: 13.5px; line-height: 1.55; }
textarea.cfg-bloc-input { resize: vertical; }
.cfg-live-bar {
  display: flex; align-items: center; gap: 10px; justify-content: flex-end;
  flex-wrap: wrap;
}
.cfg-live-hint { font-size: 12.5px; color: var(--text-2); margin-right: auto; display: inline-flex; align-items: center; gap: 6px; }
.cfg-live-ok {
  font-size: 12.5px; font-weight: 600; color: var(--accent-dark);
  display: inline-flex; align-items: center; gap: 6px;
}
.cfg-live-err {
  font-size: 13px; color: oklch(0.45 0.12 25); padding: 10px 12px;
  background: oklch(0.97 0.02 25); border: 1px solid oklch(0.85 0.06 25);
  border-radius: var(--radius-sm);
}
@media (max-width: 900px) { .cfg-bloc-grid { grid-template-columns: 1fr; } }
.cfg-inline { display: flex; flex-direction: column; gap: 16px; }
.cfg-toolbar {
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 14px 18px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-sm);
}
.cfg-toolbar-title { margin: 0; font-size: 15px; font-weight: 600; letter-spacing: -0.005em; }
.cfg-toolbar-sub { font-size: 12px; color: var(--text-3); }
.cfg-toolbar-actions { display: flex; gap: 8px; }
.cfg-inline.is-locked .cfg-input,
.cfg-inline.is-locked .cfg-textarea,
.cfg-inline.is-locked .dir-input { cursor: default; }
.cfg-input:disabled, .cfg-textarea:disabled, .dir-input:disabled {
  background: var(--surface-2); color: var(--text); opacity: 1;
  border-color: transparent; -webkit-text-fill-color: var(--text);
}
.cfg-inline-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; align-items: start; }
.cfg-inline .card.panel { display: flex; flex-direction: column; gap: 14px; }
.cfg-inline .panel-head { margin-bottom: 0; }
.cfg-2col { display: grid; grid-template-columns: 1.25fr 1fr; gap: 16px; align-items: start; }
.cfg-2col .cfg-col { display: flex; flex-direction: column; gap: 16px; min-width: 0; }
@media (max-width: 900px) { .cfg-inline-grid { grid-template-columns: 1fr; } .cfg-2col { grid-template-columns: 1fr; } }
@media (max-width: 900px) {
  .kpi-row-wide { grid-template-columns: 1fr 1fr; }
  .call-list-grid { grid-template-columns: 1fr; }
  .cfg-grid { grid-template-columns: 1fr; }
}

.prof-tabpane .prof-grid-chat .prof-chat-col { height: calc(100vh - 64px - 56px - 64px); }

/* chat-hero variant — chat dominant, clinical data as a side rail */
.prof-grid-chat { grid-template-columns: 1.75fr 1fr; }
.prof-chat-col { position: sticky; top: 0; height: calc(100vh - 64px - 56px); min-height: 560px; display: flex; }
.prof-chat-col .chat-shell { flex: 1; height: 100%; box-shadow: var(--shadow-md); }
.prof-chat-col .chat-embed { height: 100% !important; min-height: 0 !important; position: static !important; }
.prof-rail { gap: 14px; }
.prof-rail .kpi-row { grid-template-columns: repeat(3, 1fr); gap: 10px; }
.kpi-row-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.prof-rail .kpi { padding: 13px 12px; }
.prof-rail .kpi-val { font-size: 20px; }
.prof-rail .panel { padding: 16px; }
.prof-rail h3 { font-size: 14px; }
.prof-col { display: flex; flex-direction: column; gap: 16px; }

.kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kpi {
  padding: 15px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius);
}
.kpi-label { font-size: 11.5px; color: var(--text-3); font-weight: 600; letter-spacing: 0.02em; }
.kpi-val { font-size: 23px; font-weight: 700; letter-spacing: -0.02em; margin-top: 6px; line-height: 1; }
.kpi-sub { font-size: 11.5px; color: var(--text-3); margin-top: 5px; }

/* mood chart */
.chart-wrap { position: relative; }
.chart-svg { width: 100%; height: auto; display: block; overflow: visible; }
.chart-legend { display: flex; flex-wrap: wrap; gap: 12px; margin-top: 14px; }
.chart-legend span { display: inline-flex; align-items: center; gap: 6px; font-size: 11.5px; color: var(--text-2); }
.chart-legend .dot { width: 9px; height: 9px; border-radius: 50%; }
/* Flèches indiquant les extrémités de l'échelle d'humeur */
.chart-legend .legend-arrow { font-weight: 700; color: var(--text-3); margin-left: -3px; }
.chart-modal-analyse { font-weight: 400; color: var(--text-3); font-size: 13px; }

/* Attente d'analyse d'humeur : silhouette des deux pastilles, sans valeur
   affichée (mieux vaut ne rien montrer qu'une humeur qui sera démentie). */
.mood-flow-attente { display: inline-flex; align-items: center; gap: 8px; }
.mood-flow-attente .mfa-pill {
  width: 78px; height: 24px; border-radius: 999px;
  background: var(--surface-2); animation: mfaPulse 1.4s ease-in-out infinite;
}
.mood-flow-attente .mfa-pill:last-child { animation-delay: 0.2s; }
.mood-flow-attente .mfa-arrow { color: var(--border-strong); display: inline-flex; }
@keyframes mfaPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }
.chart-tip {
  position: absolute; pointer-events: none; transform: translate(-50%, -120%);
  background: var(--text); color: var(--bg); padding: 6px 9px; border-radius: 8px;
  font-size: 11.5px; white-space: nowrap; box-shadow: var(--shadow-md); z-index: 5;
  opacity: 0; transition: opacity 0.12s ease;
}
.chart-tip.show { opacity: 1; }

/* topics */
.topic-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
.topic-h { display: flex; align-items: center; gap: 8px; font-size: 12.5px; font-weight: 600; margin-bottom: 11px; }
.topic-h .ic { width: 24px; height: 24px; border-radius: 7px; display: inline-flex; align-items: center; justify-content: center; }
.topic-h.calm .ic { background: var(--accent-soft); color: var(--accent-dark); }
.topic-h.trig .ic { background: var(--warn-soft); color: var(--warn); }
.topic-tags { display: flex; flex-wrap: wrap; gap: 7px; }
.topic-tag {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 12px; border-radius: 999px; font-size: 12.5px; font-weight: 500;
  background: var(--surface-2); color: var(--text);
}
.topic-tag.calm { background: var(--accent-soft); color: var(--accent-dark); }
.topic-tag.trig { background: var(--warn-soft); color: oklch(0.42 0.08 60); }
.topic-del {
  display: inline-flex; align-items: center; justify-content: center;
  width: 16px; height: 16px; border-radius: 50%; margin-left: 2px;
  background: rgba(0,0,0,0.07); color: inherit; transition: background 0.12s ease;
}
.topic-del:hover { background: rgba(0,0,0,0.16); }
.topic-add { display: flex; gap: 8px; margin-top: 12px; }
.topic-add input {
  flex: 1; min-width: 0; padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.topic-add input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topic-edit { display: flex; flex-direction: column; gap: 8px; }
.topic-slot { display: flex; align-items: center; gap: 9px; }
.topic-slot-num {
  width: 24px; height: 24px; border-radius: 7px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--accent-dark);
  font-size: 12px; font-weight: 700;
}
.topic-slot-num.add { background: var(--surface-2); color: var(--text-3); }
.topic-slot-input {
  flex: 1; min-width: 0; padding: 8px 12px; font-size: 13px;
  border: 1px solid var(--border); border-radius: 10px; background: var(--surface); color: var(--text); outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.topic-slot-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.topic-slot-del {
  width: 30px; height: 30px; border-radius: 8px; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--text-3); transition: background 0.12s ease, color 0.12s ease;
}
.topic-slot-del:hover { background: var(--danger-soft); color: var(--danger); }
.topic-slot-add { margin-top: 2px; }
.topic-count { font-size: 11.5px; font-weight: 600; color: var(--text-3); margin-left: 4px; }
.topic-limit { display: flex; align-items: center; gap: 7px; margin-top: 12px; font-size: 12px; color: var(--accent-dark); background: var(--accent-soft); padding: 8px 11px; border-radius: 10px; }

/* expand chart */
.chart-expand-btn {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 12px; font-weight: 600; color: var(--accent-dark);
  padding: 6px 11px; border-radius: 999px; background: var(--accent-soft);
  transition: background 0.13s ease;
}
.chart-expand-btn:hover { background: color-mix(in oklch, var(--accent-soft) 70%, var(--accent) 30%); }
.chart-expand-btn:disabled { opacity: 0.4; cursor: not-allowed; }
.chart-modal-backdrop {
  position: fixed; inset: 0; z-index: 300; background: rgba(20,20,18,0.5);
  display: flex; align-items: center; justify-content: center; padding: 40px;
  backdrop-filter: blur(2px);
}
.chart-modal {
  width: min(960px, 94vw); background: var(--surface);
  border-radius: var(--radius-lg); box-shadow: var(--shadow-lg);
  animation: popIn 0.22s cubic-bezier(0.22, 1, 0.36, 1); overflow: hidden;
}
.chart-modal-head {
  display: flex; align-items: flex-start; justify-content: space-between; gap: 12px;
  padding: 22px 26px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--accent-soft) 45%, var(--surface));
}
.chart-period { display: flex; gap: 4px; margin-left: auto; margin-right: 12px; background: var(--surface-2); border-radius: 10px; padding: 3px; align-self: center; }
.chart-period-btn { padding: 6px 12px; font-size: 12.5px; font-weight: 600; color: var(--text-3); border-radius: 7px; transition: all 0.12s ease; }
.chart-period-btn.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-sm); }
.chart-period-btn:hover:not(.active) { color: var(--text); }
.chart-modal-title { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; margin-top: 4px; }
.chart-modal-body { padding: 28px 30px 32px; }
.calls-modal { width: min(620px, 96vw); max-height: 86vh; display: flex; flex-direction: column; }
.calls-modal-body { padding: 18px 20px 22px; overflow-y: auto; }
.calls-modal-body .call-list { gap: 12px; }

.note-card {
  padding: 16px 18px; background: color-mix(in oklch, var(--accent-soft) 55%, var(--surface));
  border: 1px solid var(--accent-soft); border-radius: var(--radius);
  display: flex; gap: 12px; align-items: flex-start;
}
.note-card .q { font-size: 38px; line-height: 0.8; color: var(--accent); font-family: var(--font-display); font-style: italic; }
.note-card .body { font-size: 13.5px; line-height: 1.55; color: var(--text); }
.note-card .by { font-size: 11.5px; color: var(--text-3); margin-top: 8px; }

/* story */
.story { font-size: 13.5px; line-height: 1.6; color: var(--text-2); }
.info-list { display: flex; flex-direction: column; }
.info-row { display: flex; align-items: center; justify-content: space-between; padding: 11px 0; border-top: 1px dashed var(--border); font-size: 13px; }
.info-row:first-child { border-top: none; }
.info-row .k { color: var(--text-3); }
.info-row .v { font-weight: 600; }

/* call history list */
.call-list { display: flex; flex-direction: column; gap: 10px; }
.call-item {
  padding: 15px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius); text-align: left; width: 100%; cursor: pointer;
  transition: border-color 0.14s ease, box-shadow 0.14s ease;
}
.call-item:hover { border-color: var(--border-strong); box-shadow: var(--shadow-md); }
.call-item-head { display: flex; align-items: center; justify-content: space-between; gap: 10px; margin-bottom: 9px; }
.call-when { font-size: 12.5px; font-weight: 600; color: var(--text); }
.call-dur { font-size: 11.5px; color: var(--text-3); font-variant-numeric: tabular-nums; }
.call-mood-flow { display: inline-flex; align-items: center; gap: 7px; }
.call-arrow { color: var(--text-3); display: inline-flex; }
.call-summary { font-size: 13px; line-height: 1.5; color: var(--text-2); position: relative; }
.call-summary.locked { filter: blur(5px); user-select: none; }
.is-unlocked .call-summary.locked { filter: none; user-select: auto; }
.call-item-foot { display: flex; align-items: center; gap: 10px; margin-top: 11px; }
.call-more {
  display: flex; align-items: center; justify-content: center; gap: 6px;
  width: 100%; padding: 11px; margin-top: 2px;
  border: 1px dashed var(--border-strong); border-radius: var(--radius);
  font-size: 13px; font-weight: 600; color: var(--accent-dark); background: var(--surface);
  transition: background 0.13s ease, border-color 0.13s ease;
}
.call-more:hover { background: var(--accent-soft); border-color: var(--accent-soft); }
.lock-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 11px; font-weight: 600; color: var(--text-3);
}

/* ───────────────────────── Call panel (right drawer) ───────────────────────── */
.drawer-backdrop {
  position: fixed; inset: 0; background: rgba(20,20,18,0.36);
  z-index: 330;
}
.drawer {
  position: fixed; top: 0; right: 0; bottom: 0;
  width: min(560px, 94vw); background: var(--surface);
  z-index: 331; box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; overflow: hidden;
}
@keyframes slideInRight { from { transform: translateX(0); } to { transform: translateX(0); } }
.drawer-head {
  padding: 20px 22px; border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--accent-soft) 60%, var(--surface));
}
.drawer-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.drawer-close {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.14s ease;
}
.drawer-close:hover { background: var(--surface-2); color: var(--text); }
.drawer-top-actions { display: flex; align-items: center; gap: 8px; flex-shrink: 0; }
.drawer-del {
  width: 36px; height: 36px; border-radius: 50%; flex-shrink: 0;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-3);
  display: inline-flex; align-items: center; justify-content: center; transition: all 0.14s ease;
}
.drawer-del:hover { background: var(--danger-soft); border-color: var(--danger-soft); color: var(--danger); }
/* Barre de confirmation de suppression, épinglée en bas du tiroir */
.drawer-confirm {
  border-top: 1px solid var(--border); padding: 16px 22px;
  background: color-mix(in oklch, var(--danger-soft) 45%, var(--surface));
  display: flex; flex-direction: column; gap: 12px;
}
.drawer-confirm-txt { font-size: 13px; line-height: 1.5; color: var(--text); }
.drawer-confirm-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-danger { background: var(--danger); color: #fff; border: 1px solid var(--danger); }
.btn-danger:hover { filter: brightness(0.95); }
.btn-danger:disabled { opacity: 0.6; cursor: default; }
.drawer-name { font-size: 19px; font-weight: 700; letter-spacing: -0.01em; }
.drawer-when { font-size: 12.5px; color: var(--text-2); margin-top: 3px; font-variant-numeric: tabular-nums; }
.drawer-flow { display: flex; align-items: center; gap: 10px; margin-top: 14px; flex-wrap: wrap; }
.drawer-body { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 22px; }
.drawer-block { margin-bottom: 24px; }
.drawer-block:last-child { margin-bottom: 0; }
.drawer-block-h { display: flex; align-items: center; justify-content: space-between; margin-bottom: 11px; }
.drawer-block-h .eyebrow { margin: 0; }
.drawer-summary { font-size: 14px; line-height: 1.6; color: var(--text); }

/* transcript */
.transcript { display: flex; flex-direction: column; gap: 11px; }
.bubble { max-width: 86%; padding: 10px 14px; border-radius: 16px; font-size: 13.5px; line-height: 1.5; }
.bubble .who { font-size: 10px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase; margin-bottom: 4px; opacity: 0.65; }
.bubble.livana { background: var(--accent-soft); color: var(--accent-dark); border-bottom-left-radius: 4px; align-self: flex-start; }
.bubble.resident { background: var(--surface-2); color: var(--text); border-bottom-right-radius: 4px; align-self: flex-end; }

/* confidentiality lock overlay inside drawer */
.locked-zone { position: relative; }
.locked-zone.is-locked .lz-content { filter: blur(7px); pointer-events: none; user-select: none; }
.lz-gate {
  position: absolute; inset: 0; z-index: 4;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px; padding: 24px;
}
.lz-gate.hidden { display: none; }
.lz-lockic {
  width: 52px; height: 52px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-dark); box-shadow: var(--shadow-md);
}
.lz-title { font-size: 15px; font-weight: 600; }
.lz-sub { font-size: 12.5px; color: var(--text-2); max-width: 280px; line-height: 1.5; }

/* PIN modal */
.pin-modal-backdrop {
  position: fixed; inset: 0; background: rgba(20,20,18,0.5);
  z-index: 400; display: flex; align-items: center; justify-content: center;
  backdrop-filter: blur(2px);
}
.pin-modal {
  width: 340px; background: var(--surface); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: 28px 26px;
  text-align: center; animation: popIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
@keyframes popIn { from { transform: scale(0.96); } to { transform: scale(1); } }
.pin-ic {
  width: 56px; height: 56px; border-radius: 50%; margin: 0 auto 14px;
  background: var(--accent-soft); color: var(--accent-dark);
  display: flex; align-items: center; justify-content: center;
}
.pin-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.pin-sub { font-size: 12.5px; color: var(--text-2); margin-top: 6px; line-height: 1.5; }
.pin-inputs { display: flex; gap: 12px; justify-content: center; margin: 24px 0 6px; }
.pin-box {
  width: 56px; height: 64px; border-radius: 14px;
  border: 1.5px solid var(--border-strong); background: var(--surface-2);
  text-align: center; font-size: 26px; font-weight: 700; color: var(--text);
  outline: none; transition: border-color 0.14s ease, box-shadow 0.14s ease, background 0.14s ease;
  -webkit-text-security: disc;
}
.pin-box:focus { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.pin-box.filled { border-color: var(--accent); background: var(--surface); }
.pin-box.err { border-color: var(--danger); }
.pin-actions { margin-top: 14px; }
.pin-modal.shake { animation: shake 0.4s ease; }
@keyframes shake { 0%,100%{transform:translateX(0);} 20%,60%{transform:translateX(-8px);} 40%,80%{transform:translateX(8px);} }
.pin-pad { display: grid; grid-template-columns: repeat(3, 1fr); gap: 10px; }
.pin-key {
  height: 52px; border-radius: 12px; background: var(--surface-2);
  font-size: 19px; font-weight: 600; color: var(--text);
  transition: background 0.1s ease, transform 0.06s ease;
}
.pin-key:hover { background: var(--border); }
.pin-key:active { transform: scale(0.95); }
.pin-key.action { background: transparent; color: var(--text-3); font-size: 13px; font-weight: 600; }
.pin-key.action:hover { background: var(--surface-2); }
.pin-err { font-size: 12px; color: var(--danger); margin-top: 12px; height: 14px; }
.pin-hint { font-size: 11px; color: var(--text-3); margin-top: 14px; }

/* sensitive ribbon */
.sensitive-ribbon {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 5px 11px; border-radius: 999px;
  background: var(--warn-soft); color: oklch(0.40 0.08 55);
  font-size: 11px; font-weight: 600; letter-spacing: 0.01em;
}

/* ───────────────────────── Assistant IA ───────────────────────── */
.assistant-wrap { display: flex; flex-direction: column; height: 100%; }
.chat-shell {
  display: flex; flex-direction: column; background: var(--surface);
  border: 1px solid var(--border); border-radius: var(--radius); overflow: hidden;
  box-shadow: var(--shadow-sm); position: relative;
}
.chat-shell.is-locked > *:not(.chat-lock):not(.chat-topbanner) { filter: blur(6px); pointer-events: none; user-select: none; }
.chat-lock {
  position: absolute; inset: 0; z-index: 6;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  text-align: center; gap: 12px; padding: 28px;
  background: color-mix(in oklch, var(--surface) 55%, transparent);
}
.chat-lock-ic {
  width: 60px; height: 60px; border-radius: 50%;
  background: var(--surface); border: 1px solid var(--border);
  display: inline-flex; align-items: center; justify-content: center;
  color: var(--accent-dark); box-shadow: var(--shadow-md);
}
.chat-lock-title { font-size: 17px; font-weight: 700; letter-spacing: -0.01em; }
.chat-lock-sub { font-size: 13px; color: var(--text-2); max-width: 320px; line-height: 1.55; }
.chat-head {
  display: flex; align-items: center; gap: 12px; padding: 15px 18px;
  border-bottom: 1px solid var(--border);
  background: color-mix(in oklch, var(--accent-soft) 45%, var(--surface));
}
.chat-head-expand {
  flex-shrink: 0; width: 34px; height: 34px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-2);
  transition: background 0.14s ease, color 0.14s ease, border-color 0.14s ease;
}
.chat-head-expand:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-dark); }
.chat-fs-layer { position: fixed; inset: 0; z-index: 400; }
.chat-float-expand {
  position: absolute; top: 12px; right: 12px; z-index: 6;
  width: 32px; height: 32px; border-radius: 9px;
  display: inline-flex; align-items: center; justify-content: center;
  background: var(--surface); border: 1px solid var(--border); color: var(--text-3);
  transition: background 0.14s ease, color 0.14s ease;
}
.chat-float-expand:hover { background: var(--accent-soft); border-color: var(--accent-soft); color: var(--accent-dark); }
.chat-fs-backdrop {
  position: absolute; inset: 0; background: rgba(20,20,18,0.5);
  animation: fadeIn 0.18s ease;
}
.chat-shell.chat-fullscreen {
  position: absolute; inset: max(24px, 4vh) max(24px, 6vw); height: auto !important;
  border-radius: var(--radius-lg); overflow: hidden;
  box-shadow: var(--shadow-lg); border: 1px solid var(--border);
  animation: popIn 0.22s cubic-bezier(0.22, 1, 0.36, 1);
}
.chat-orb-spark { display: inline-flex; align-items: center; justify-content: center; flex-shrink: 0; color: var(--accent); }
.chat-orb {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C12 7 17 12 22 12 17 12 12 17 12 22 12 17 7 12 2 12 7 12 12 7 12 2Z' transform='translate(-0.6 3.4) scale(0.8)'/%3E%3Cpath d='M12 2C12 7 17 12 22 12 17 12 12 17 12 22 12 17 7 12 2 12 7 12 12 7 12 2Z' transform='translate(12.6 0.4) scale(0.46)'/%3E%3Cpath d='M12 2C12 7 17 12 22 12 17 12 12 17 12 22 12 17 7 12 2 12 7 12 12 7 12 2Z' transform='translate(15.3 14.8) scale(0.3)'/%3E%3C/svg%3E") center / 60% no-repeat,
    radial-gradient(circle at 32% 30%, oklch(0.85 0.06 175), var(--accent));
  box-shadow: 0 4px 14px -4px oklch(0.62 0.07 175 / 0.55);
  position: relative;
}
.chat-orb.pulsing::after {
  content: ''; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid var(--accent); animation: orbRipple 1.8s ease-out infinite;
}
@keyframes orbRipple { 0% { transform: scale(1); opacity: 0.6; } 100% { transform: scale(1.7); opacity: 0; } }
.chat-head-title { font-size: 14px; font-weight: 600; }
.chat-head-sub { font-size: 11.5px; color: var(--text-2); display: flex; align-items: center; gap: 6px; margin-top: 1px; }
.chat-head-sub .online-dot { width: 7px; height: 7px; border-radius: 50%; background: var(--online); }

.chat-context {
  display: flex; align-items: center; gap: 8px; margin-left: auto;
  background: var(--surface); border: 1px solid var(--border); border-radius: 999px;
  padding: 5px 6px 5px 12px; position: relative;
}
.chat-context-label { font-size: 11px; color: var(--text-3); }
.chat-context-pill {
  display: inline-flex; align-items: center; gap: 7px;
  padding: 4px 6px 4px 9px; border-radius: 999px;
  background: var(--accent-soft); color: var(--accent-dark);
  font-size: 12px; font-weight: 600;
}
.chat-context-pill .x { width: 16px; height: 16px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; background: rgba(0,0,0,0.06); }
.chat-context-pick {
  display: inline-flex; align-items: center; gap: 5px;
  font-size: 12px; font-weight: 600; color: var(--accent-dark);
  padding: 4px 8px; border-radius: 999px;
}
.chat-context-pick:hover { background: var(--accent-soft); }

.ctx-menu {
  position: absolute; top: calc(100% + 8px); right: 0; z-index: 30;
  width: 260px; max-height: 320px; overflow-y: auto;
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; box-shadow: var(--shadow-lg); padding: 6px;
}
.ctx-search { padding: 8px 10px; }
.ctx-search input { width: 100%; border: 1px solid var(--border); border-radius: 8px; padding: 8px 11px; font-size: 13px; outline: none; }
.ctx-search input:focus { border-color: var(--accent); }
.ctx-opt { display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: 8px; width: 100%; text-align: left; transition: background 0.1s ease; }
.ctx-opt:hover { background: var(--surface-2); }
.ctx-opt .nm { font-size: 13px; font-weight: 500; }
.ctx-opt .rm { font-size: 11px; color: var(--text-3); }

.chat-thread { flex: 1; overflow-y: auto; overflow-x: hidden; padding: 20px; display: flex; flex-direction: column; gap: 14px; background: var(--surface-2); min-width: 0; }
.chat-msg { display: flex; gap: 10px; max-width: 88%; }
.chat-msg.user { align-self: flex-end; flex-direction: row-reverse; }
.chat-msg.assistant { align-self: flex-start; }
.chat-msg-av {
  width: 30px; height: 30px; border-radius: 50%; flex-shrink: 0;
  display: inline-flex; align-items: center; justify-content: center; font-size: 12px; font-weight: 600;
}
.chat-msg.assistant .chat-msg-av { background:
    url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C12 7 17 12 22 12 17 12 12 17 12 22 12 17 7 12 2 12 7 12 12 7 12 2Z' transform='translate(-0.6 3.4) scale(0.8)'/%3E%3Cpath d='M12 2C12 7 17 12 22 12 17 12 12 17 12 22 12 17 7 12 2 12 7 12 12 7 12 2Z' transform='translate(12.6 0.4) scale(0.46)'/%3E%3Cpath d='M12 2C12 7 17 12 22 12 17 12 12 17 12 22 12 17 7 12 2 12 7 12 12 7 12 2Z' transform='translate(15.3 14.8) scale(0.3)'/%3E%3C/svg%3E") center / 62% no-repeat,
    radial-gradient(circle at 32% 30%, oklch(0.85 0.06 175), var(--accent)); color: #fff; }
.chat-msg.user .chat-msg-av { background: var(--accent-soft); color: var(--accent-dark); }
.chat-bubble {
  padding: 11px 15px; border-radius: 16px; font-size: 13.5px; line-height: 1.55;
  white-space: pre-wrap; word-wrap: break-word;
}
.chat-msg.assistant .chat-bubble { background: var(--surface); border: 1px solid var(--border); border-bottom-left-radius: 5px; color: var(--text); }
.chat-msg.user .chat-bubble { background: var(--accent); color: #fff; border-bottom-right-radius: 5px; }
.chat-bubble strong { font-weight: 700; }
.chat-bubble .insight {
  display: block; margin-top: 8px; padding-top: 8px; border-top: 1px solid var(--border);
  font-size: 12px; color: var(--text-3);
}
/* Écran d'attente pendant la reprise de session (« Rester connectée ») */
.session-restore {
  min-height: 100vh; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 18px; background: var(--bg);
}
.session-restore-logo { width: 132px; height: auto; opacity: 0.9; }
.session-restore-tx { font-size: 14px; color: var(--text-3); animation: sessionPulse 1.6s ease-in-out infinite; }
@keyframes sessionPulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.45; } }

/* Curseur affiché pendant que la réponse s'écrit au fil de l'eau */
.chat-caret {
  display: inline-block; width: 2px; height: 1em; margin-left: 2px;
  vertical-align: text-bottom; background: var(--accent);
  animation: chatCaret 1s steps(2) infinite;
}
@keyframes chatCaret { 0%, 50% { opacity: 1; } 50.01%, 100% { opacity: 0; } }

.typing { display: inline-flex; align-items: center; gap: 4px; padding: 14px 16px; }
.typing i { width: 6px; height: 6px; border-radius: 50%; background: var(--text-3); opacity: 0.4; animation: typingBounce 1.4s infinite ease-in-out; }
.typing i:nth-child(2) { animation-delay: 0.2s; }
.typing i:nth-child(3) { animation-delay: 0.4s; }
@keyframes typingBounce { 0%,60%,100% { opacity: 0.3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.chat-suggest { display: flex; flex-wrap: wrap; gap: 7px; padding: 0 20px 14px; background: var(--surface-2); }
.chat-suggest-h { width: 100%; font-size: 11px; font-weight: 600; letter-spacing: 0.05em; text-transform: uppercase; color: var(--text-3); margin-bottom: 2px; padding-top: 4px; }
.suggest-chip {
  background: var(--surface); border: 1px solid var(--border); color: var(--text);
  padding: 8px 13px; border-radius: 999px; font-size: 12.5px; transition: all 0.13s ease; text-align: left;
}
.suggest-chip:hover { background: var(--accent-soft); color: var(--accent-dark); border-color: var(--accent-soft); }

.chat-composer { padding: 12px 14px; border-top: 1px solid var(--border); background: var(--surface); }
.chat-composer-inner {
  display: flex; align-items: flex-end; gap: 8px;
  background: var(--surface-2); border: 1px solid var(--border); border-radius: 16px;
  padding: 6px 6px 6px 14px; transition: border-color 0.15s ease, background 0.15s ease;
}
.chat-composer-inner:focus-within { border-color: var(--accent); background: var(--surface); box-shadow: 0 0 0 3px var(--accent-soft); }
.chat-input { flex: 1; border: none; outline: none; background: transparent; resize: none; font-size: 13.5px; color: var(--text); line-height: 1.5; padding: 8px 0; max-height: 120px; }
.chat-send {
  width: 38px; height: 38px; border-radius: 12px; flex-shrink: 0;
  background: var(--accent); color: #fff; display: inline-flex; align-items: center; justify-content: center;
  transition: background 0.14s ease;
}
.chat-send:hover:not(:disabled) { background: var(--accent-dark); }
.chat-send:disabled { background: var(--border-strong); cursor: not-allowed; }
.chat-foot { font-size: 10.5px; color: var(--text-3); text-align: center; margin-top: 8px; display: flex; align-items: center; justify-content: center; gap: 6px; }

.chat-empty { flex: 1; display: flex; flex-direction: column; align-items: center; justify-content: center; text-align: center; gap: 10px; padding: 30px; color: var(--text-3); }
.chat-empty .orb { width: 60px; height: 60px; }
.chat-empty-title { font-size: 16px; font-weight: 600; color: var(--text); }
.chat-empty-sub { font-size: 13px; color: var(--text-2); max-width: 320px; line-height: 1.5; }

/* assistant visual variants */
.asst-flat .chat-thread { background: var(--surface); }
.asst-flat .chat-msg.assistant .chat-bubble { background: var(--surface-2); border-color: transparent; }
.asst-flat .chat-suggest { background: var(--surface); }
.asst-bubbleless .chat-msg.assistant .chat-bubble { background: transparent; border: none; padding-left: 0; padding-right: 0; }

/* assistant full-page */
.assistant-fullpage { height: 100%; display: flex; }
.assistant-fullpage .chat-shell {
  flex: 1; height: 100%; border: none; border-radius: 0; box-shadow: none;
}
.assistant-fullpage .chat-thread,
.assistant-fullpage .chat-suggest { padding-left: max(28px, 8vw); padding-right: max(28px, 8vw); }
.assistant-fullpage .chat-composer { padding-left: max(20px, 7.5vw); padding-right: max(20px, 7.5vw); }
.assistant-fullpage .chat-head { padding-left: max(18px, 8vw); padding-right: max(18px, 8vw); }
.assistant-fullpage .chat-msg { max-width: 760px; width: fit-content; }
.assistant-fullpage .chat-msg.user { margin-left: auto; }

/* ChatGPT-style assistant page */
.chat-gpt { background: var(--surface); }
.chat-gpt .chat-head { background: var(--surface); border-bottom: 1px solid var(--border); }
.chat-gpt .gpt-center { flex: 1; display: flex; align-items: center; justify-content: center; padding: 24px; min-height: 0; }
.chat-gpt .gpt-center-inner { width: 100%; max-width: 820px; display: flex; flex-direction: column; align-items: center; text-align: center; gap: 14px; }
.chat-gpt .gpt-title { font-size: 21px; font-weight: 700; letter-spacing: -0.015em; margin: 6px 0 0; }
.chat-gpt .gpt-sub { font-size: 14px; color: var(--text-2); max-width: 440px; line-height: 1.55; margin-bottom: 6px; }
.chat-gpt .gpt-center-inner .chat-composer { width: 100%; border-top: none; padding: 0; background: transparent; }
.chat-gpt .gpt-center-inner .chat-composer-inner { border-radius: 26px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow-md); }
.chat-gpt .gpt-center-inner .chat-suggest { justify-content: center; padding: 6px 0 0; background: transparent; max-width: 820px; margin: 0 auto; gap: 9px; }
.chat-gpt .gpt-center-inner .suggest-chip { font-size: 12px; padding: 7px 12px; color: var(--text-2); text-align: center; }
.chat-gpt .gpt-center-inner .suggest-chip:hover { color: var(--accent-dark); }
/* Bouton « Afficher plus » des suggestions du grand chat : réservé au
   tactile (mobile + tablette) — sur bureau toutes les questions s'affichent */
.suggest-more-tactile { display: none; }
@media (max-width: 1024px) {
  .chat-suggest:not(.chat-suggest-open) .suggest-chip:nth-of-type(n+2) { display: none; }
  .suggest-more-tactile { display: block; }
  /* Le texte d'invite du champ tient sur une seule ligne (coupé par des
     points de suspension plutôt que replié sur deux lignes tronquées) */
  .chat-input::placeholder { white-space: nowrap; text-overflow: ellipsis; overflow: hidden; }
}
.suggest-more {
  width: 100%; text-align: center; font-size: 11.5px; font-weight: 600;
  color: var(--accent-dark); padding: 6px; margin-top: 2px;
}
.suggest-more:hover { color: var(--accent); }
.chat-gpt .gpt-center-inner .chat-suggest-h { text-align: center; }

/* active conversation: centred column, composer pinned bottom */
.chat-gpt .chat-thread { background: var(--surface); padding: 28px 0; align-items: stretch; }
.chat-gpt .chat-thread .chat-msg { max-width: 720px; width: 100%; margin: 0 auto; padding: 0 24px; }
.chat-gpt .chat-thread .chat-msg.user { margin: 0 auto; flex-direction: row-reverse; }
.chat-gpt > .chat-composer { border-top: 1px solid var(--border); background: var(--surface); padding: 14px 24px 16px; }
.chat-gpt > .chat-composer .chat-composer-inner { max-width: 720px; margin: 0 auto; border-radius: 26px; padding: 8px 8px 8px 18px; box-shadow: var(--shadow-sm); }
.chat-gpt > .chat-composer .chat-foot { max-width: 720px; margin: 8px auto 0; }

/* embedded (in profile) chat fills the column but always fits the viewport */
.chat-embed { height: calc(100vh - 240px); min-height: 420px; position: sticky; top: 24px; }

/* ───────────────────────── Login ───────────────────────── */
.login-page { display: flex; height: 100vh; }
.login-aside {
  width: 46%; max-width: 620px; position: relative; overflow: hidden;
  background: #2a2722;
}
.login-aside img { width: 100%; height: 100%; object-fit: cover; opacity: 0.92; }
.login-aside-overlay {
  position: absolute; inset: 0;
  background: linear-gradient(180deg, rgba(28,28,26,0.15) 0%, rgba(28,28,26,0.78) 100%);
  display: flex; flex-direction: column; justify-content: flex-end; padding: 48px;
}
.login-aside-brand { font-family: var(--font-display); font-style: italic; font-weight: 500; font-size: 40px; color: #fff; letter-spacing: -0.01em; }
.login-aside-tag { font-size: 16px; color: rgba(255,255,255,0.82); margin-top: 12px; line-height: 1.5; max-width: 380px; }
.login-aside-foot { font-size: 11px; color: rgba(255,255,255,0.6); letter-spacing: 0.04em; margin-top: 28px; text-transform: uppercase; }

.login-main { flex: 1; display: flex; align-items: center; justify-content: center; padding: 40px; background: var(--bg); }
.login-box { width: 100%; max-width: 380px; }
/* En-tête de connexion centré ; les libellés du formulaire restent alignés
   à gauche, plus lisibles au-dessus de leur champ. */
.login-logo-row { display: flex; align-items: center; justify-content: center; gap: 11px; margin-bottom: 36px; }
.login-eyebrow, .login-title, .login-desc { text-align: center; }
.login-logo-img { height: 44px; width: auto; display: block; }
.login-eyebrow { font-size: 11px; font-weight: 600; letter-spacing: 0.1em; text-transform: uppercase; color: var(--accent-dark); }
.login-title { font-size: 26px; font-weight: 700; letter-spacing: -0.02em; margin: 6px 0 8px; }
.login-desc { font-size: 13.5px; color: var(--text-2); line-height: 1.5; }
.login-form { margin-top: 30px; display: flex; flex-direction: column; gap: 16px; }
.field { display: flex; flex-direction: column; gap: 7px; }
.field-label { font-size: 11.5px; font-weight: 600; letter-spacing: 0.04em; text-transform: uppercase; color: var(--text-2); }
.field-wrap { position: relative; display: flex; align-items: center; }
.field-wrap .lead-ic { position: absolute; left: 14px; color: var(--text-3); pointer-events: none; }
.field-input {
  width: 100%; padding: 13px 14px 13px 42px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius);
  font-size: 14.5px; color: var(--text); outline: none; transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.field-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.field-eye { position: absolute; right: 12px; color: var(--text-3); width: 30px; height: 30px; border-radius: 8px; display: inline-flex; align-items: center; justify-content: center; }
.field-eye:hover { background: var(--surface-2); color: var(--text-2); }
.login-row { display: flex; align-items: center; justify-content: space-between; }
.checkbox-row { display: flex; align-items: center; gap: 9px; font-size: 12.5px; color: var(--text-2); cursor: pointer; }
.checkbox-row input { width: 17px; height: 17px; accent-color: var(--accent); cursor: pointer; }
.forgot-link { font-size: 12.5px; font-weight: 600; color: var(--accent-dark); }
.forgot-link:hover { color: var(--accent); }
.login-submit { margin-top: 6px; padding: 14px; font-size: 14.5px; }
.login-rgpd {
  margin-top: 22px; padding: 13px 15px; border-radius: var(--radius);
  background: var(--surface-2); border: 1px solid var(--border);
  display: flex; gap: 11px; align-items: flex-start;
}
.login-rgpd .ic { color: var(--accent-dark); flex-shrink: 0; margin-top: 1px; }
.login-rgpd .tx { font-size: 11.5px; color: var(--text-2); line-height: 1.5; }
.login-rgpd .tx b { color: var(--text); font-weight: 600; }
.login-foot { margin-top: 28px; text-align: center; font-size: 11px; color: var(--text-3); letter-spacing: 0.04em; }

/* ───────────────────────── misc anims ───────────────────────── */
@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes fadeUp { from { transform: translateY(8px); } to { transform: translateY(0); } }
.fade-up { animation: fadeUp 0.3s ease; }

/* responsive */
@media (max-width: 1080px) {
  .prof-grid { grid-template-columns: 1fr; }
  .prof-chat-col { position: static; height: 600px; }
  .home-cols { grid-template-columns: 1fr; }
  .home-hero { grid-template-columns: 1fr; }
  .page-home { height: auto; }
  .home-hero-chat { height: 600px; }

  /* Connexion : le panneau photo passe en bandeau au-dessus du formulaire
     (il était simplement masqué, la page perdait toute son identité). */
  .login-page { flex-direction: column; height: auto; min-height: 100vh; }
  .login-aside { width: 100%; max-width: none; height: 210px; flex-shrink: 0; }
  .login-aside img { object-position: center 32%; }
  .login-aside-overlay { justify-content: flex-end; padding: 20px 24px; }
  .login-aside-brand { font-size: 28px; }
  .login-aside-tag { font-size: 13px; margin-top: 6px; max-width: 100%; }
  .login-aside-foot { display: none; }
  /* Le bandeau porte déjà le nom Livana : le logo du formulaire ferait
     doublon. Le bloc de connexion remonte donc juste sous la photo. */
  .login-logo-row { display: none; }
  .login-main { padding: 28px 20px 40px; align-items: flex-start; }
}
/* ── Navigation mobile (barre fixée en bas, remplace la sidebar) ── */
.mobile-nav { display: none; }
@media (max-width: 720px) {
  .sidebar { display: none; }
  /* Les 4 compteurs de l'accueil : deux par ligne plutôt qu'empilés */
  .home-grid { grid-template-columns: 1fr 1fr; }
  .kpi-row { grid-template-columns: 1fr 1fr; }

  .mobile-nav {
    display: flex; position: fixed; left: 0; right: 0; bottom: 0; z-index: 60;
    background: var(--surface); border-top: 1px solid var(--border);
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.05);
    padding: 4px 6px calc(4px + env(safe-area-inset-bottom, 0px));
  }
  .mnav-item {
    flex: 1; display: flex; flex-direction: column; align-items: center; gap: 2px;
    padding: 7px 2px 5px; border-radius: 10px; color: var(--text-3);
    transition: color 0.14s ease, background 0.14s ease;
  }
  .mnav-item.active { color: var(--accent-dark); background: var(--accent-soft); }
  .mnav-lbl { font-size: 10px; font-weight: 600; letter-spacing: 0.01em; }

  /* Laisse la place à la barre : le contenu ne finit jamais caché dessous */
  .scroll-area { padding-bottom: 84px; }

  /* Onglets de la fiche résident : défilement horizontal au doigt */
  .prof-tabs {
    overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none; flex-wrap: nowrap;
  }
  .prof-tabs::-webkit-scrollbar { display: none; }
  .prof-tab { flex-shrink: 0; white-space: nowrap; }

  /* Chat en grand : sur mobile, plein écran (les marges et coins arrondis
     du bureau gaspillent une place précieuse sur un petit écran) */
  .chat-shell.chat-fullscreen {
    inset: 0; border-radius: 0; border: none;
  }

  /* Bouton « Installer l'app » : au-dessus de la barre de navigation basse */
  #pwa-install { bottom: 84px !important; }

  /* Pages pleine largeur : sur un écran étroit, les marges latérales volent
     de la place au contenu. Les cartes débordent de la gouttière de la page
     grâce à des marges négatives et ne laissent qu'un filet de 4 px de chaque
     côté — juste assez pour que la fine bordure se détache. Le reste
     (titres, onglets, tuiles de KPI) garde la gouttière complète. */
  .page { padding: 20px 16px; }
  .page .card,
  .page .prof-chat-col > .chat-shell {
    /* La largeur explicite fonctionne dans tous les contextes (bloc, grille
       et colonne flex, où l'étirement ne s'applique pas aux marges négatives) */
    width: calc(100% + 24px);
    margin-left: -12px; margin-right: -12px;
    border: 1px solid var(--border);
    border-radius: 10px; box-shadow: none;
  }
  /* Le contenu des cartes respire sans gaspiller la largeur gagnée */
  .page .panel { padding: 18px 16px; }

  /* Les compteurs restent dans leur case de grille (pas de débordement
     pleine largeur) pour tenir deux par ligne ; padding réduit à cette taille */
  .home-grid .card { width: auto; margin-left: 0; margin-right: 0; padding: 16px; }
  .home-grid .stat-val { font-size: 26px; }

  /* Accueil : la barre latérale étant masquée, le logo prend sa place en tête */
  .home-mlogo { display: flex; justify-content: flex-start; margin-bottom: 18px; }
  .home-mlogo img { height: 38px; width: auto; }

  /* Résidents : la liste empilée remplace le tableau à 6 colonnes.
     Le conteneur s'efface (fond et bordure) pour laisser chaque résident
     former sa propre petite carte, légèrement détachée des voisines. */
  .res-tablewrap { display: none; }
  /* `.page .card` étant plus spécifique, l'override doit l'être aussi */
  .page .card.res-mlist {
    display: flex; flex-direction: column; gap: 10px;
    padding: 0; overflow: visible;
    background: transparent; border: none; border-radius: 0;
  }
  /* Titre et bouton l'un sous l'autre : côte à côte, le sous-titre
     se retrouvait écrasé sur trois lignes */
  .res-toolbar { flex-direction: column; align-items: stretch; gap: 12px; }
  .res-toolbar .btn { justify-content: center; }

  /* ── Modales de configuration (wizard d'ajout, réglages…) ──
     Sur un téléphone, l'en-tête et le pied de page ne tiennent pas sur une
     ligne : les points de progression et les boutons passaient hors écran. */
  .cfg-modal-backdrop { padding: 12px; }
  /* Le wizard occupe tout l'écran : 8 étapes de formulaire ont besoin de place */
  .cfg-modal-lg { width: 100%; max-width: 100%; height: 100%; max-height: 100%; }

  /* En-tête : titre et croix sur la première ligne, progression en dessous
     (`display: contents` sort les deux enfants du conteneur de droite pour
     qu'ils se placent librement dans l'en-tête). */
  .cfg-modal-head { flex-wrap: wrap; padding: 16px; }
  .cfg-head-right { display: contents; }
  .cfg-modal-head > div:first-child { flex: 1; min-width: 0; }
  .cfg-modal-head .drawer-close { order: 2; flex-shrink: 0; }
  .cfg-modal-head .cfg-progress { order: 3; flex: 1 1 100%; margin-top: 12px; }
  .cfg-modal-head .cfg-dot { flex: 1; width: auto; }

  .cfg-modal-body { padding: 18px 16px; }
  .cfg-row.two { grid-template-columns: 1fr; }

  /* Pied de page : le message d'aide passe au-dessus, les deux actions
     principales se partagent une ligne, le brouillon prend la sienne. */
  .cfg-modal-actions { flex-wrap: wrap; gap: 8px; padding: 12px 16px; }
  .cfg-actions-hint { order: -1; width: 100%; margin: 0; text-align: center; }
  .cfg-modal-actions > .btn { flex: 1 1 0; justify-content: center; white-space: nowrap; }
  .cfg-draft-btn, .cfg-actions-hint + .cfg-draft-btn { order: 3; flex: 1 1 100%; margin-left: 0; }

  /* En-têtes de graphiques : le titre au-dessus, le sélecteur de période
     en dessous (côte à côte, ils s'écrasaient mutuellement) */
  .calls-evo .panel-head { flex-direction: column; align-items: flex-start; gap: 10px; }
  .calls-evo-seg, .chart-period {
    max-width: 100%; overflow-x: auto; -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
  }
  .calls-evo-seg::-webkit-scrollbar, .chart-period::-webkit-scrollbar { display: none; }
  .calls-evo-seg button, .chart-period-btn { white-space: nowrap; flex-shrink: 0; }
}
