/* Identité visuelle « Lin · Épuré » : gris chauds, terracotta réservée au conseil,
   police Inter intégrée à l'application (même rendu sur Windows et sur Mac).
   Icônes : Lucide (licence ISC, voir icones.css). Police : Inter (licence SIL OFL).
   Voir LICENCES-TIERS.txt. */

@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-latin-wght-normal.woff2') format('woff2');
  font-weight: 100 900;
  font-style: normal;
  font-display: block;
}
@font-face {
  font-family: 'Inter';
  src: url('fonts/inter-latin-wght-italic.woff2') format('woff2');
  font-weight: 100 900;
  font-style: italic;
  font-display: block;
}

:root {
  --bg: #F7F6F3;
  --surface: #FFFFFF;
  --surface-2: #EFEDE9;
  --text: #262422;
  --muted: #74706A;
  --border: #E6E3DD;
  --border-strong: #D9D5CE;
  --ink: #2A2724;
  --accent: #B8603E;
  --accent-soft: #F1ECE7;
  --good: #5E7A62;
  --warn-bg: #F6F0E4;
  --warn-line: #EAD9B9;
  --warn-text: #765726;
  --error-bg: #F6EAE7;
  --error-line: #EBCFC8;
  --error-text: #94392B;
  --danger: #B5463A;
  --live: #E2715A;
  --shadow: 0 1px 2px rgba(40, 32, 24, 0.04), 0 6px 18px rgba(40, 32, 24, 0.05);
  --focus: #E2DDD5;
  color-scheme: light;
  --icon-check: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='3.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 6 9 17l-5-5'/%3E%3C/svg%3E");
  --icon-chevron: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2374706A' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  height: 100%;
  overflow: hidden; /* seul le contenu (main) défile, jamais la fenêtre */
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;
  font-size: 14px;
  line-height: 1.45;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }
.grow { flex: 1; }
.sr { position: absolute; width: 1px; height: 1px; overflow: hidden; clip-path: inset(50%); white-space: nowrap; }
.stack { display: flex; flex-direction: column; gap: 12px; }
.stack:empty { display: none; }

/* ---------- Icônes ---------- */
.ico {
  display: inline-block;
  flex: none;
  width: 18px;
  height: 18px;
  background: currentColor;
  -webkit-mask: var(--ico) center / contain no-repeat;
  mask: var(--ico) center / contain no-repeat;
}
.i-target { --ico: var(--i-target); }
.i-book { --ico: var(--i-book-open); }
.i-gear { --ico: var(--i-settings); }
.i-back { --ico: var(--i-arrow-left); }
.i-send { --ico: var(--i-arrow-up); }
.i-copy { --ico: var(--i-copy); }
.i-plus { --ico: var(--i-plus); }
.i-more { --ico: var(--i-ellipsis); }
.i-ext { --ico: var(--i-arrow-up-right); }
.i-monitor { --ico: var(--i-monitor); }
.i-phone { --ico: var(--i-smartphone); }
.i-mic { --ico: var(--i-mic); }
.i-reset { --ico: var(--i-rotate-ccw); }
.i-check { --ico: var(--i-check); }
.i-spark { --ico: var(--i-sparkles); }
.i-down { --ico: var(--i-chevron-down); }
.i-notes { --ico: var(--i-notebook-pen); }
.i-folder { --ico: var(--i-folder-open); }
.i-trash { --ico: var(--i-trash-2); }
.i-file-plus { --ico: var(--i-file-plus); }
.i-lock { --ico: var(--i-lock); }
.i-lock-open { --ico: var(--i-lock-open); }
.i-globe { --ico: var(--i-globe); }
.i-x { --ico: var(--i-x); }
.i-up { --ico: var(--i-chevron-up); }
.i-clock { --ico: var(--i-clock); }
.i-history { --ico: var(--i-history); }
.i-mail { --ico: var(--i-mail); }

/* ---------- En-tête : où j'en suis · crédit · accès aux sections ---------- */
.hdr { display: flex; align-items: center; gap: 4px; padding: 10px 12px 8px 14px; min-height: 52px; }
.hdr .credits, .hdr .iconbar { flex: none; }
.hdr .grow { min-width: 0; }
body.sous-page .hdr .credits { display: none; }
.status { flex: 0 1 auto; min-width: 0; display: flex; align-items: center; gap: 8px; font-size: 14px; font-weight: 650; letter-spacing: -0.01em; white-space: nowrap; font-variant-numeric: tabular-nums; }
.status .dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: none; }
.status.live .dot { background: var(--live); animation: live-pulse 1.6s ease-in-out infinite; }
.status.live { color: var(--text); }
.back {
  display: flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 14px;
  font-weight: 650;
  letter-spacing: -0.01em;
  color: var(--text);
  background: none;
  border: 0;
  padding: 4px 4px 4px 0;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex: 0 1 auto;
  min-width: 0;
}
.back span { overflow: hidden; text-overflow: ellipsis; }
.back .ico { width: 17px; height: 17px; color: var(--muted); }
.back:hover .ico { color: var(--text); }

/* Crédit restant */
.credits {
  font: inherit;
  font-size: 11.5px;
  color: var(--muted);
  background: var(--surface);
  border: 0;
  border-radius: 999px;
  padding: 5px 9px;
  box-shadow: 0 0 0 1px var(--border);
  cursor: pointer;
  display: flex;
  align-items: baseline;
  gap: 4px;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}
.credits:hover, .credits[aria-expanded="true"] { box-shadow: 0 0 0 1px var(--border-strong); color: var(--text); }
.credits .credit-value { color: var(--text); font-weight: 650; }
.credits.empty .credit, .credits.empty .credit-sep { display: none; }
.credits:not(.empty) .credits-empty { display: none; }
.credit[data-level="low"] .credit-value { color: #A56A12; }
.credit[data-level="critical"] .credit-value { color: var(--danger); }

/* Barre d'icônes : épingle, Entraînement, Fiches, Réglages */
.iconbar { display: flex; align-items: center; gap: 2px; padding: 2px; border-radius: 999px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.iconbar .sep { width: 1px; height: 16px; background: var(--border); margin: 0 2px; }
.ib {
  position: relative;
  width: 26px;
  height: 26px;
  border: 0;
  padding: 0;
  background: none;
  border-radius: 999px;
  display: grid;
  place-items: center;
  color: var(--muted);
  cursor: pointer;
}
.ib .ico { width: 16px; height: 16px; }
.ib:hover { color: var(--text); background: #F7F6F3; }
.ib.on { background: var(--surface-2); color: var(--text); }
.ib.boxed { width: 34px; height: 34px; background: var(--surface); box-shadow: 0 0 0 1px var(--border); }
.ib.boxed:hover { box-shadow: 0 0 0 1px var(--border-strong); }
.ib-dot { position: absolute; top: 4px; right: 4px; width: 7px; height: 7px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 2px var(--surface); }
/* « Toujours visible » : l'épingle (le texte reste lu par les lecteurs d'écran) */
.pin input { position: absolute; inset: 0; width: 100%; height: 100%; margin: 0; opacity: 0; cursor: pointer; }
.pin::before {
  content: '';
  width: 16px;
  height: 16px;
  background: currentColor;
  -webkit-mask: var(--i-pin) center / contain no-repeat;
  mask: var(--i-pin) center / contain no-repeat;
}
.pin:has(input:checked) { background: var(--surface-2); color: var(--text); }
.pin:has(input:focus-visible) { outline: 3px solid var(--focus); }

/* ---------- Petite fenêtre « crédit » ---------- */
.popover {
  position: fixed;
  right: 12px;
  top: 52px;
  width: 300px;
  background: var(--surface);
  border-radius: 18px;
  box-shadow: 0 0 0 1px var(--border), 0 18px 40px rgba(40, 32, 24, 0.16);
  padding: 14px 16px 12px;
  z-index: 20;
}
.pop-title { margin: 0 0 6px; font-size: 13px; font-weight: 650; }
.pop-title span { color: var(--muted); font-weight: 500; }
.cp { padding: 10px 0 6px; border-top: 1px solid var(--border); }
.cp-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 7px; }
.cp-head b { font-weight: 650; }
.cp-head small { color: var(--muted); font-size: 12px; margin-left: 5px; }
.cp-val { font-weight: 650; font-variant-numeric: tabular-nums; }
.cp[data-level="low"] .cp-val { color: #A56A12; }
.cp[data-level="critical"] .cp-val { color: var(--danger); }
.cp-edit { display: flex; align-items: center; gap: 10px; }
.cp-edit input { flex: 1; min-width: 0; padding: 7px 11px; font-size: 13px; }
.cp-edit a { display: inline-flex; align-items: center; gap: 2px; font-size: 12px; color: var(--muted); white-space: nowrap; }
.cp-edit a .ico { width: 13px; height: 13px; }
.cp-msg { margin: 5px 0 0; font-size: 12px; color: var(--muted); }
.cp-msg:empty { display: none; }
.cp.invalid .cp-msg { color: var(--error-text); }
.cp.saved .cp-msg { color: var(--good); }
.pop-foot { margin: 6px 0 0; font-size: 11.5px; color: var(--muted); }

/* ---------- Écrans ---------- */
main { flex: 1; min-height: 0; overflow-y: auto; }
.panel { display: none; padding: 4px 16px 16px; }
.panel.active { display: flex; flex-direction: column; gap: 12px; min-height: 100%; }
.panel > * { flex: none; }
h2 { font-size: 14px; font-weight: 650; letter-spacing: -0.005em; margin: 0; }
code { background: var(--surface-2); padding: 1px 5px; border-radius: 5px; font-size: 0.92em; }
a { color: var(--text); text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
a:hover { text-decoration-color: currentColor; }
.card { background: var(--surface); border-radius: 22px; box-shadow: 0 0 0 1px var(--border); padding: 14px 16px; }
.lbl { display: block; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 7px; }
.fine { font-size: 12px; color: var(--muted); margin: 0; text-align: center; }
.full { width: 100%; justify-content: center; }

/* ---------- Boutons ---------- */
.btn, .btn-primary, .btn-link { font: inherit; cursor: pointer; }
.btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 7px 15px;
  font-size: 13px;
  font-weight: 600;
}
.btn:hover { background: #FBFAF8; border-color: var(--border-strong); }
.btn .ico, .btn-primary .ico { width: 15px; height: 15px; }
.btn-primary {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  background: var(--ink);
  color: #fff;
  border: 1px solid var(--ink);
  border-radius: 999px;
  padding: 7px 16px;
  font-size: 13px;
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(40, 32, 24, 0.16);
}
.btn-primary:hover { background: #3A3632; border-color: #3A3632; }
.btn-primary.big { padding: 13px 22px; font-size: 15px; gap: 10px; white-space: nowrap; }
.btn-primary.big .ico { width: 18px; height: 18px; }
.btn-link {
  background: none;
  border: 0;
  color: var(--text);
  padding: 0;
  font-weight: 600;
  text-decoration: underline;
  text-underline-offset: 3px;
  text-decoration-color: var(--border-strong);
}
.btn-link:hover { text-decoration-color: currentColor; }
button:disabled { opacity: 0.5; cursor: default; box-shadow: none; }
button:focus-visible, .chip:focus-visible, summary:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }
@keyframes live-pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(226, 113, 90, 0.55); }
  50% { box-shadow: 0 0 0 5px rgba(226, 113, 90, 0); }
}

/* ---------- Messages ---------- */
.notice { padding: 10px 14px; border-radius: 14px; font-size: 13px; }
.notice.warn { background: var(--warn-bg); color: var(--warn-text); box-shadow: 0 0 0 1px var(--warn-line); }
.notice.error { background: var(--error-bg); color: var(--error-text); box-shadow: 0 0 0 1px var(--error-line); }
.notice.info { background: var(--surface); color: var(--text); box-shadow: 0 0 0 1px var(--border); }
.notice a { color: inherit; font-weight: 600; }
.notice .notice-title { font-weight: 650; }
.notice .notice-actions { display: flex; gap: 8px; margin-top: 8px; flex-wrap: wrap; }

/* ---------- Écran d'appel : trois temps ---------- */
#panel-appel[data-state="prep"] :is(.when-live, .when-done, .when-call),
#panel-appel[data-state="live"] :is(.when-prep, .when-done),
#panel-appel[data-state="done"] :is(.when-prep, .when-live) { display: none !important; }
/* Pendant et après l'appel, l'écran tient dans la fenêtre : seule la conversation
   défile, et le conseil ne bouge jamais. */
#panel-appel.active:not([data-state="prep"]) { height: 100%; }
#panel-appel > .transcript { flex: 1 1 0px; min-height: 100px; overflow-y: auto; }

/* 1. Préparer */
.prep .segmented { margin-bottom: 14px; }
/* Types d'appel de l'utilisateur : noms libres, coupés proprement s'ils sont longs */
.segmented.calltypes { margin-bottom: 8px; flex-wrap: wrap; border-radius: 18px; }
.segmented.calltypes button { flex: 1 1 auto; min-width: 0; display: block; overflow: hidden; text-overflow: ellipsis; padding: 6px 10px; }
/* « Contact venu de » : une puce discrète qui ouvre un petit menu */
.prov-line { margin: 0 0 14px; }
.prov-line .typechip { gap: 5px; background: none; padding: 3px 6px 3px 2px; font-weight: 500; }
.prov-line .typechip b { color: var(--text); font-weight: 650; }
.prov-line .menu { min-width: 220px; }
.prov-other { padding: 4px 4px 2px; border-top: 1px solid var(--border); margin-top: 4px; }
.prov-other input { width: 100%; font-size: 13px; padding: 7px 10px; border-radius: 9px; }
.notes-head { display: flex; justify-content: space-between; align-items: baseline; }
.notes-head .clear { font: inherit; font-size: 12px; color: var(--muted); background: none; border: 0; padding: 0; cursor: pointer; text-decoration: underline; text-decoration-color: var(--border-strong); text-underline-offset: 3px; }
.prep textarea { width: 100%; resize: vertical; font-size: 13.5px; line-height: 1.45; min-height: 150px; }

/* 2. Écouter */
.callbar { display: flex; align-items: center; gap: 14px; }
.btn-primary.stop { padding: 10px 16px; font-size: 14px; gap: 9px; }
.btn-primary.stop .sq { width: 10px; height: 10px; border-radius: 2.5px; background: #fff; }
.meters { flex: 1; display: flex; flex-direction: column; gap: 7px; min-width: 0; }
.meter { display: flex; align-items: center; gap: 7px; font-size: 12px; color: var(--muted); }
.meter-name { width: 46px; font-weight: 550; }
.meter-bar { flex: 1; height: 7px; background: var(--surface-2); border-radius: 999px; overflow: hidden; }
.meter-fill { display: block; height: 100%; width: 0; background: #4A4641; border-radius: 999px; transition: width 0.15s; }
.meter-dot { width: 8px; height: 8px; border-radius: 50%; background: var(--border-strong); flex: none; }
.meter-dot[data-state="connecting"] { background: #C9A15A; }
.meter-dot[data-state="ready"] { background: #6F9A78; }
.meter-dot[data-state="error"] { background: var(--danger); }
.meter.speaking .meter-name { color: var(--text); font-weight: 650; }
.notes-live { background: var(--surface); border-radius: 14px; box-shadow: 0 0 0 1px var(--border); }
.notes-live summary { display: flex; align-items: center; gap: 9px; padding: 9px 13px; font-size: 13px; color: var(--muted); cursor: pointer; list-style: none; }
.notes-live summary::-webkit-details-marker { display: none; }
.notes-live summary .ico { width: 15px; height: 15px; }
.notes-live summary .t { flex: 1; min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.notes-live[open] summary .t { white-space: normal; color: var(--text); }
.notes-live textarea { display: block; width: calc(100% - 20px); margin: 0 10px 10px; resize: vertical; min-height: 90px; font-size: 13px; }
.notes-live[open] summary .t { display: none; }
.notes-live[open] summary::after { content: 'Notes sur le prospect'; flex: 1; font-weight: 600; color: var(--text); }
.ask2 { position: relative; display: flex; }
.ask2 input { flex: 1; border-radius: 999px; padding: 9px 46px 9px 16px; }
.send {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  border: 0;
  padding: 0;
  display: grid;
  place-items: center;
  background: var(--ink);
  color: #fff;
  cursor: pointer;
}
.send .ico { width: 15px; height: 15px; }
.send:disabled { background: var(--surface-2); color: var(--muted); opacity: 1; }

/* 3. Conclure */
.done { display: flex; flex-direction: column; gap: 12px; }
.done-title { margin: 0; font-size: 15px; font-weight: 650; letter-spacing: -0.01em; }
.done-sub { margin: 2px 0 0; font-size: 12.5px; color: var(--muted); }
.done-sub:empty { display: none; }
.actions { display: flex; gap: 8px; flex-wrap: wrap; }

/* Après l'appel : résumé, mail de suivi, idées pour les fiches */
#panel-appel.active[data-state="done"] { height: auto; }
#panel-appel[data-state="done"] > .transcript { flex: none; overflow: visible; }
.section-label { margin: 4px 4px -4px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.aftercall { display: flex; flex-direction: column; gap: 12px; }
.aftercall:empty { display: none; }
.ac-wait { display: flex; align-items: center; gap: 10px; margin: 0; padding: 12px 16px; font-size: 13px; color: var(--muted); background: var(--surface); border-radius: 18px; box-shadow: 0 0 0 1px var(--border); }
.ac-wait .spinner { width: 16px; height: 16px; border-width: 2px; flex: none; }
.ac-card { display: flex; flex-direction: column; gap: 10px; }
.ac-card h3 { margin: 0; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.ac-summary { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 7px 12px; font-size: 13.5px; }
.ac-summary dt { color: var(--muted); font-weight: 550; }
.ac-summary dd { margin: 0; white-space: pre-wrap; }
.ac-subject { margin: 0; font-size: 13.5px; font-weight: 600; }
.ac-subject span { color: var(--muted); font-weight: 500; }
.ac-body { margin: 0; padding: 12px 14px; font-size: 13.5px; line-height: 1.5; white-space: pre-wrap; background: var(--bg); border-radius: 14px; user-select: text; }
.ac-msg { margin: 0; font-size: 12px; color: var(--muted); }
.ac-msg:empty { display: none; }
.ac-tips { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 10px; }
.ac-tip { display: flex; flex-direction: column; gap: 6px; padding: 12px 14px; border-radius: 14px; background: var(--bg); }
.ac-tip-kind { margin: 0; font-size: 12px; font-weight: 650; color: var(--accent); }
.ac-tip-title { margin: 0; font-size: 13.5px; font-weight: 600; }
.ac-tip-text { margin: 0; font-size: 13.5px; white-space: pre-wrap; }
.ac-tip-fiche { margin: 0; font-size: 12px; color: var(--muted); }
.ac-tip .actions { margin-top: 2px; }
.ac-tip .btn, .ac-tip .btn-primary { padding-top: 6px; padding-bottom: 6px; font-size: 13px; }
.ac-tip-done { margin: 0; font-size: 12.5px; font-weight: 600; color: var(--good); }
.ac-tip.ignored { opacity: 0.55; }
.ac-tip.ignored .ac-tip-done { color: var(--muted); }

/* Historique */
#hist-search { width: 100%; }
.files.hist li { flex-direction: column; align-items: stretch; gap: 2px; }
.hist-top { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; }
.hist-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.hist-date { flex: none; font-size: 12px; color: var(--muted); font-weight: 500; }
.hist-meta, .hist-excerpt { font-size: 12.5px; color: var(--muted); font-weight: 400; }
.hist-excerpt { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
#hist-detail .transcript { padding: 0; }

/* ---------- Le conseil ---------- */
.advice {
  position: relative;
  overflow: hidden;
  background: var(--surface);
  border-radius: 24px;
  box-shadow: 0 0 0 1px var(--border), 0 12px 30px rgba(40, 32, 24, 0.07);
  padding: 18px 20px 18px 24px;
}
/* Repère terracotta : la seule couleur vive de l'écran */
.advice::after {
  content: '';
  position: absolute;
  left: 0;
  top: 22px;
  bottom: 22px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: var(--accent);
}
.advice-head { display: flex; justify-content: space-between; gap: 8px; align-items: baseline; }
.advice-situation { font-size: 11px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.advice-status { font-size: 12px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }
.advice-say { font-size: 19.5px; line-height: 1.42; font-weight: 600; letter-spacing: -0.015em; margin: 10px 0 0; }
.advice-tip { background: var(--bg); color: var(--muted); border-radius: 14px; padding: 9px 13px; font-size: 13px; margin: 12px 0 0; }
.advice-tip:empty { display: none; }
.advice.thinking::after { background: #C9A15A; }
.advice.thinking::before {
  content: '';
  position: absolute;
  top: 0;
  left: -40%;
  width: 40%;
  height: 3px;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
  animation: advice-progress 0.9s linear infinite;
}
@keyframes advice-progress {
  from { left: -40%; }
  to { left: 100%; }
}
@media (prefers-reduced-motion: reduce) {
  .advice.thinking::before { animation: none; left: 0; width: 100%; }
  .status.live .dot { animation: none; }
}
/* Le client parle depuis ce conseil : il est grisé, la nouvelle réponse arrive */
.advice.stale .advice-say,
.advice.stale .advice-tip,
.advice.stale .advice-situation { opacity: 0.4; transition: opacity 0.2s; }
.advice.stale::after { background: var(--border-strong); }
.advice.error::after { background: var(--danger); }

/* Bloquer une réponse : un clic sur la carte la garde à l'écran, un second
   clic la libère. Les nouvelles réponses attendent derrière (« Nouvelle réponse »). */
.advice { cursor: pointer; }
.advice-meta { display: inline-flex; align-items: center; gap: 8px; flex: none; }
.advice-lock { display: inline-flex; align-items: center; gap: 5px; margin: -4px -6px -4px 0; padding: 4px 6px; border: 0; border-radius: 999px; background: transparent; color: var(--muted); font: inherit; font-size: 11.5px; font-weight: 650; cursor: pointer; }
.advice-lock .ico { width: 14px; height: 14px; opacity: 0.5; transition: opacity 0.15s; }
.advice:hover .advice-lock .ico, .advice-lock:focus-visible .ico { opacity: 1; }
.advice-lock-label { display: none; }
.advice-new { display: none; align-items: center; gap: 6px; font-size: 11.5px; font-weight: 650; color: var(--text); background: var(--accent-soft); padding: 2px 9px; border-radius: 999px; white-space: nowrap; }
.advice-new::before { content: ''; width: 6px; height: 6px; border-radius: 50%; background: var(--accent); }
.advice.pinned { box-shadow: 0 0 0 2px var(--ink), 0 12px 30px rgba(40, 32, 24, 0.07); }
.advice.pinned .advice-status { display: none; }
.advice.pinned .advice-lock { color: var(--ink); background: var(--surface-2); }
.advice.pinned .advice-lock .ico { --ico: var(--i-lock); opacity: 1; }
.advice.pinned .advice-lock-label { display: inline; }
.advice.pinned.has-pending .advice-new { display: inline-flex; }
/* La pastille suffit quand une réponse attend : le cadenas fermé dit déjà « bloquée ». */
.advice.pinned.has-pending .advice-lock-label { display: none; }

/* Astuce montrée une fois, posée sur le champ « Demander un conseil » */
.pin-tip { position: absolute; left: 0; right: 0; top: 0; min-height: 100%; z-index: 3; margin: 0; display: flex; align-items: center; gap: 10px; padding: 6px 6px 6px 14px; border-radius: 19px; background: var(--ink); color: #FFFFFF; font-size: 12.5px; line-height: 1.3; box-shadow: 0 8px 20px -10px rgba(40, 32, 24, 0.5); }
.pin-tip::before { content: ''; position: absolute; top: -6px; left: 30px; border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 6px solid var(--ink); }
.pin-tip span { flex: 1; }
.pin-tip button { flex: none; font: inherit; font-size: 12.5px; font-weight: 650; color: var(--ink); background: #FFFFFF; border: 0; border-radius: 999px; padding: 5px 12px; cursor: pointer; }
.version { font-size: 12px; color: var(--muted); text-align: center; margin: 0; }

/* ---------- Champs ---------- */
input[type="text"], input[type="password"], input[type="email"], input[type="search"], select, textarea {
  font: inherit;
  color: var(--text);
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 8px 12px;
}
input::placeholder, textarea::placeholder { color: #A39E96; }
input:focus, select:focus, textarea:focus { outline: 3px solid #ECE8E2; border-color: #B9B3AA; }
select {
  appearance: none;
  padding-right: 34px;
  background: var(--surface) var(--icon-chevron) right 12px center / 14px no-repeat;
  cursor: pointer;
}
/* Interrupteurs (dessinés par l'application : identiques partout) */
input.switch {
  appearance: none;
  position: relative;
  flex: none;
  width: 36px;
  height: 21px;
  margin: 0;
  border-radius: 999px;
  background: var(--border-strong);
  cursor: pointer;
  transition: background 0.15s;
}
input.switch::before {
  content: '';
  position: absolute;
  top: 2.5px;
  left: 2.5px;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.25);
  transition: transform 0.15s;
}
input.switch:checked { background: var(--ink); }
input.switch:checked::before { transform: translateX(15px); }
input.switch:focus-visible { outline: 3px solid var(--focus); outline-offset: 1px; }

/* Choix en pilules (type d'appel, source, réglages) */
.segmented {
  display: flex;
  background: var(--surface-2);
  border-radius: 999px;
  padding: 4px;
  gap: 4px;
}
.segmented button {
  flex: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  border: 0;
  background: none;
  color: var(--muted);
  padding: 6px 4px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
}
.segmented button .ico { width: 15px; height: 15px; }
.segmented button:hover { color: var(--text); }
.segmented button[aria-checked="true"] { background: var(--surface); color: var(--text); font-weight: 650; box-shadow: 0 1px 3px rgba(40, 32, 24, 0.08); }

/* ---------- Conversation (en bulles) ---------- */
.transcript { list-style: none; margin: 0; padding: 2px 2px 6px; display: flex; flex-direction: column; gap: 8px; }
.transcript > li { flex: none; }
.transcript li {
  max-width: 86%;
  border-radius: 18px;
  padding: 8px 13px;
  font-size: 13.5px;
  line-height: 1.42;
}
.transcript li.them, .transcript li.unknown { align-self: flex-start; background: var(--surface); box-shadow: 0 0 0 1px var(--border); border-bottom-left-radius: 6px; }
.transcript li.me { align-self: flex-end; background: #ECEAE6; border-bottom-right-radius: 6px; }
.transcript li.empty { align-self: stretch; max-width: none; color: var(--muted); background: none; box-shadow: none; border: 1.5px dashed var(--border); border-radius: 16px; text-align: center; }
.transcript .who { display: block; font-size: 10.5px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); margin: 0 0 2px; }
.transcript .partial { color: var(--muted); font-style: italic; }

/* ---------- Menus « … » et type d'appel ---------- */
.menu-wrap { position: relative; }
.menu {
  position: absolute;
  right: 0;
  top: calc(100% + 6px);
  min-width: 210px;
  background: var(--surface);
  border-radius: 14px;
  box-shadow: 0 0 0 1px var(--border), 0 16px 34px rgba(40, 32, 24, 0.14);
  padding: 6px;
  z-index: 15;
}
.menu.left { left: 0; right: auto; min-width: 170px; }
.menu button {
  display: flex;
  width: 100%;
  align-items: center;
  gap: 9px;
  font: inherit;
  font-size: 13px;
  border: 0;
  background: none;
  padding: 8px 10px;
  border-radius: 9px;
  color: var(--text);
  text-align: left;
  cursor: pointer;
}
.menu button:hover { background: var(--surface-2); }
.menu button[aria-checked="true"] { font-weight: 650; }
.menu button[aria-checked="true"]::after { content: ''; margin-left: auto; width: 14px; height: 14px; background: currentColor; -webkit-mask: var(--i-check) center / contain no-repeat; mask: var(--i-check) center / contain no-repeat; }
.menu .ico { width: 15px; height: 15px; color: var(--muted); }
.menu button.danger { color: var(--danger); }
.menu button.danger .ico { color: var(--danger); }

/* ---------- Entraînement : comme une messagerie ---------- */
#panel-entrainement.active { height: 100%; }
#panel-entrainement > .transcript { flex: 1 1 0px; min-height: 60px; overflow-y: auto; justify-content: flex-end; }
#panel-entrainement > .transcript > li:first-child { margin-top: auto; }
.tline { display: flex; align-items: center; gap: 8px; }
.typechip { display: inline-flex; align-items: center; gap: 4px; font: inherit; font-size: 12px; font-weight: 600; color: var(--muted); background: var(--surface-2); border: 0; border-radius: 999px; padding: 5px 9px 5px 12px; cursor: pointer; }
.typechip:hover { color: var(--text); }
.typechip .ico { width: 13px; height: 13px; }
.suggest {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
  --fade-l: 0%;
  --fade-r: 88%;
  -webkit-mask-image: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 var(--fade-r), transparent);
  mask-image: linear-gradient(90deg, transparent, #000 var(--fade-l), #000 var(--fade-r), transparent);
  padding-bottom: 2px;
}
.suggest::-webkit-scrollbar { display: none; }
.suggest.scrolled { --fade-l: 10%; }
.suggest.at-end { --fade-r: 100%; }
.chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  flex: none;
  font: inherit;
  font-size: 12.5px;
  font-weight: 550;
  background: var(--surface-2);
  color: var(--text);
  border: 0;
  border-radius: 999px;
  padding: 6px 12px;
  cursor: pointer;
  white-space: nowrap;
}
.chip:hover { background: #E6E3DD; }
.chip .ico { width: 13px; height: 13px; }
.composer { display: flex; align-items: center; gap: 8px; background: var(--surface); border-radius: 999px; box-shadow: 0 0 0 1px var(--border); padding: 4px; }
.composer:focus-within { box-shadow: 0 0 0 1px #B9B3AA, 0 0 0 4px #ECE8E2; }
.composer input { flex: 1; min-width: 0; border: 0; padding: 7px 4px; background: none; border-radius: 0; }
.composer input:focus { outline: none; }
.composer .send { position: static; transform: none; flex: none; }
.speaker { display: flex; background: var(--surface-2); border-radius: 999px; padding: 3px; gap: 2px; flex: none; }
.speaker button { font: inherit; font-size: 12px; font-weight: 600; border: 0; background: none; color: var(--muted); border-radius: 999px; padding: 5px 11px; cursor: pointer; }
.speaker button[aria-checked="true"] { background: var(--surface); color: var(--text); box-shadow: 0 1px 2px rgba(40, 32, 24, 0.1); }

/* ---------- Fiches ---------- */
.bar { display: flex; align-items: center; gap: 8px; }
.files { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 8px; }
.files li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  background: var(--surface);
  border-radius: 16px;
  box-shadow: 0 0 0 1px var(--border);
  padding: 11px 14px;
  font-weight: 550;
  cursor: pointer;
}
.files li:hover { box-shadow: 0 0 0 1px var(--border-strong), var(--shadow); }
.files li.none { cursor: default; color: var(--muted); font-weight: 400; }
.files .tag { font-size: 11px; font-weight: 650; color: var(--warn-text); background: var(--warn-bg); border-radius: 999px; padding: 2px 8px; white-space: nowrap; }
.files .tag.soft { color: var(--muted); background: var(--surface-2); font-weight: 600; }
#panel-fichiers.active { height: 100%; }
#file-edit-view:not(.hidden) { flex: 1 1 auto; min-height: 0; }
.title-input { flex: 1; min-width: 0; font-size: 15px !important; font-weight: 650; }
.saved-state { font-size: 12px; color: var(--muted); white-space: nowrap; }
#file-content {
  flex: 1 1 auto;
  min-height: 260px;
  width: 100%;
  font-family: Consolas, 'Cascadia Mono', ui-monospace, monospace;
  font-size: 13px;
  line-height: 1.5;
  resize: none;
}

/* ---------- Réglages : groupes, enregistrement automatique ---------- */
#panel-reglages.active { gap: 18px; padding-bottom: 20px; }
.group h3 { margin: 0 0 8px 4px; font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.rows { background: var(--surface); border-radius: 18px; box-shadow: 0 0 0 1px var(--border); }
.r { display: flex; align-items: center; gap: 12px; padding: 10px 14px; border-top: 1px solid var(--border); min-height: 48px; }
.r:first-child { border-top: 0; }
.r > span { flex: 1; min-width: 0; font-size: 13.5px; font-weight: 550; }
.r > span small { display: block; color: var(--muted); font-size: 12px; font-weight: 400; }
.r > input[type="text"] { width: 52%; padding: 7px 10px; font-size: 13px; text-align: right; border-color: transparent; background: transparent; }
.r > input[type="text"]:hover { border-color: var(--border); }
.r > input[type="text"]:focus { text-align: left; background: var(--surface); }
.r > select { width: 52%; padding: 7px 32px 7px 10px; font-size: 13px; }
.r > .segmented { padding: 3px; flex: none; }
.r > .segmented button { font-size: 12px; padding: 5px 10px; flex: none; }
.r.col { flex-direction: column; align-items: stretch; gap: 8px; }
.r.col > input, .r.col > textarea { width: 100%; font-size: 13px; }
.r.col > textarea { resize: vertical; }
.key-state { font-size: 12px; color: var(--muted); }
.key-state.ok { color: var(--good); font-weight: 550; }
.key-state.warn { color: var(--warn-text); }
.key-state .btn-link { font-size: 12px; margin-left: 6px; }
.group-foot { margin: 8px 4px 0; font-size: 12px; color: var(--muted); }
.group-foot .btn-link { font-size: 12px; font-weight: 500; color: var(--muted); }
/* Réglages > Types d'appel : nom, but, réordonner, supprimer */
.ct-row { gap: 6px; }
.ct-head { display: flex; align-items: center; gap: 6px; }
.ct-head .ct-name { flex: 1; min-width: 0; font-weight: 600; font-size: 13.5px; }
.ct-tools { display: flex; gap: 2px; flex: none; }
.ct-tools .ib:disabled { opacity: 0.3; cursor: default; }
.ct-goal { width: 100%; font-size: 12.5px; resize: vertical; min-height: 44px; max-height: 140px; field-sizing: content; }
.group-foot .btn-link:disabled { opacity: 0.45; cursor: default; text-decoration: none; }
.autosave { display: flex; align-items: center; gap: 5px; justify-content: center; font-size: 12px; color: var(--muted); margin: 0; transition: color 0.2s; }
.autosave .ico { width: 13px; height: 13px; color: var(--good); }
.autosave.flash { color: var(--good); font-weight: 600; }

/* Réglages > Tester comme un nouvel utilisateur */
.test-open-row > .btn { align-self: flex-start; }
.group-foot:empty { display: none; }

/* Version test : bandeau discret tout en haut */
.test-banner { flex: none; display: flex; align-items: center; gap: 10px; padding: 6px 12px 6px 14px; background: var(--warn-bg); color: var(--warn-text); box-shadow: inset 0 -1px 0 var(--warn-line); font-size: 12px; line-height: 1.35; }
.test-banner > span { flex: 1; min-width: 0; }
.test-banner .btn-link { flex: none; font-size: 12px; font-weight: 600; color: inherit; }

/* ---------- Premier lancement ---------- */
body.onboarding .credits, body.onboarding .iconbar, body.onboarding .status .dot { display: none; }
#panel-bienvenue.active, #panel-connexion.active { justify-content: center; padding-bottom: 28px; }
.onboard { padding: 22px 20px; display: flex; flex-direction: column; gap: 14px; }
.onboard h1 { margin: 0; font-size: 22px; font-weight: 700; letter-spacing: -0.02em; }
.onboard p { margin: 0; color: var(--muted); font-size: 13.5px; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field > span { font-weight: 600; }
.field small { font-weight: 400; color: var(--muted); }
.field-foot { display: flex; justify-content: space-between; gap: 8px; font-size: 12px; min-height: 17px; }
.field-foot a { display: inline-flex; align-items: center; gap: 2px; color: var(--muted); white-space: nowrap; }
.field-foot a .ico { width: 12px; height: 12px; }

/* ---------- Configuration : présenter son activité ---------- */
/* Une seule carte, une étape visible à la fois (sources, questions, attente, résumé). */
#panel-config.active { justify-content: flex-start; padding-bottom: 20px; }
.setup { padding: 20px 18px 16px; display: flex; flex-direction: column; gap: 12px; }
.setup .step { display: none; flex-direction: column; gap: 12px; }
#panel-config[data-step="sources"] .step[data-for="sources"],
#panel-config[data-step="questions"] .step[data-for="questions"],
#panel-config[data-step="wait"] .step[data-for="wait"],
#panel-config[data-step="summary"] .step[data-for="summary"] { display: flex; }
.setup h1 { margin: 0; font-size: 21px; font-weight: 700; letter-spacing: -0.02em; line-height: 1.25; }
.kicker { margin: 0; font-size: 11px; font-weight: 650; letter-spacing: 0.07em; text-transform: uppercase; color: var(--muted); }
.setup-lead { margin: -4px 0 2px; color: var(--muted); font-size: 13.5px; }
.src { border-radius: 16px; box-shadow: 0 0 0 1px var(--border); padding: 12px 14px; display: flex; flex-direction: column; gap: 8px; align-items: flex-start; }
.src.done { box-shadow: 0 0 0 1.5px var(--good); }
.src-head { display: flex; align-items: center; gap: 8px; width: 100%; }
.src-head .ico { width: 16px; height: 16px; color: var(--muted); }
.src-head b { font-weight: 650; }
.src-state { margin-left: auto; font-size: 12px; color: var(--muted); text-align: right; }
.src.done .src-state { color: var(--good); font-weight: 600; }
.src-help { margin: -2px 0 0; font-size: 12.5px; color: var(--muted); }
.src-row { display: flex; gap: 8px; width: 100%; }
.src-row input { flex: 1; min-width: 0; }
.docs { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; width: 100%; }
.docs:empty { display: none; }
.docs li { display: flex; align-items: center; gap: 8px; background: var(--surface-2); border-radius: 10px; padding: 6px 6px 6px 10px; font-size: 12.5px; }
.docs li span { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.docs li button { flex: none; width: 24px; height: 24px; border: 0; border-radius: 50%; background: transparent; display: grid; place-items: center; cursor: pointer; color: var(--muted); }
.docs li button:hover { background: #E3DFD8; color: var(--text); }
.docs li .ico { width: 13px; height: 13px; }
.setup .later { align-self: center; font-size: 12.5px; font-weight: 500; color: var(--muted); margin-top: 2px; }
#iv-answer { width: 100%; resize: vertical; min-height: 120px; font-size: 14px; line-height: 1.5; }
.iv-partial { margin: -6px 2px 0; min-height: 18px; font-size: 12.5px; color: var(--muted); font-style: italic; }
.iv-actions { display: flex; align-items: center; gap: 10px; }
.iv-actions .btn-link { font-weight: 500; color: var(--muted); }
.btn.mic[aria-pressed="true"] { background: var(--error-bg); border-color: var(--error-line); color: var(--error-text); }
.btn.mic[aria-pressed="true"] .ico { animation: live-pulse 1.6s ease-in-out infinite; border-radius: 50%; }
.setup-wait { display: flex; flex-direction: column; align-items: center; gap: 12px; padding: 34px 6px 26px; text-align: center; }
.setup-wait p { margin: 0; }
#wait-text { font-size: 15px; font-weight: 600; }
.spinner { width: 34px; height: 34px; border-radius: 50%; border: 3px solid var(--surface-2); border-top-color: var(--accent); animation: spin 0.9s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .spinner { animation-duration: 3s; } .btn.mic[aria-pressed="true"] .ico { animation: none; } }
.sum { display: flex; flex-direction: column; gap: 5px; }
.sum > span { font-size: 11px; font-weight: 650; letter-spacing: 0.06em; text-transform: uppercase; color: var(--muted); }
.sum textarea { width: 100%; resize: vertical; font-size: 13.5px; line-height: 1.45; field-sizing: content; min-height: 44px; max-height: 160px; }
.sum-types { display: flex; flex-direction: column; gap: 6px; }
.sum-type { display: flex; flex-direction: column; gap: 3px; background: var(--surface-2); border-radius: 12px; padding: 8px 10px; }
.sum-type input { font-weight: 650; font-size: 13.5px; padding: 4px 8px; border-color: transparent; background: transparent; }
.sum-type input:hover, .sum-type input:focus { border-color: var(--border); background: var(--surface); }
.sum-type small { color: var(--muted); font-size: 12px; padding: 0 9px; }
.sum-kept { font-size: 13px; color: var(--muted); }
.sum-note { margin: 0; font-size: 12.5px; color: var(--muted); }
.sum-check { display: flex; align-items: flex-start; gap: 8px; font-size: 13px; cursor: pointer; }
.sum-check input { margin-top: 2px; accent-color: var(--ink); }
.fill-notice .notice-actions .btn-primary .ico { width: 14px; height: 14px; }

/* ---------- Barres de défilement discrètes ---------- */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #D9D5CE; border-radius: 999px; border: 3px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: #C9C4BC; }
::-webkit-scrollbar-track { background: transparent; }

/* ---------- Compte Bien dit ou clés personnelles ---------- */
/* Ce qui ne concerne qu'un des deux modes est masqué dans l'autre. */
body.mode-compte .cles-only, body.mode-cles .compte-only { display: none !important; }
.account-chip { align-items: center; gap: 5px; }
.account-chip .ico { width: 13px; height: 13px; }
.account-chip #account-badge { color: var(--text); font-weight: 650; }
.account-chip[data-level="low"] #account-badge { color: #A56A12; }
.account-chip[data-level="out"] #account-badge { color: var(--danger); }
.pop-title #acct-email { display: block; margin-top: 2px; font-size: 12px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.acct-text { margin: 4px 0 10px; font-size: 13px; line-height: 1.45; }
.acct-actions { display: flex; flex-direction: column; gap: 6px; }
.acct-actions:empty { display: none; }
.acct-actions .btn, .acct-actions .btn-primary { justify-content: center; }
.acct-msg { margin: 8px 0 0; font-size: 12px; color: var(--muted); }
.acct-msg.error { color: var(--error-text); }
.acct-msg:empty, .acct-offer:empty { display: none; }
.acct-offer { margin: 10px 0 0; font-size: 11.5px; color: var(--muted); line-height: 1.4; }
.pop-foot { margin: 10px 0 0; font-size: 12px; color: var(--muted); }
.acct-foot { padding-top: 8px; border-top: 1px solid var(--border); }
.acct-foot .btn-link { font-size: 12px; font-weight: 500; color: var(--muted); }

/* Connexion */
.btn.big { padding: 12px 20px; font-size: 14.5px; gap: 10px; }
.btn.google { font-weight: 600; }
.g-logo { width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center; font-weight: 800; font-size: 13px; color: #fff; background: conic-gradient(#EA4335 0 25%, #FBBC05 0 50%, #34A853 0 75%, #4285F4 0); }
.or { display: flex; align-items: center; gap: 10px; color: var(--muted); font-size: 12px; }
.or::before, .or::after { content: ''; flex: 1; height: 1px; background: var(--border); }
.login-step { display: none; flex-direction: column; gap: 12px; }
#panel-connexion[data-step="email"] .login-step[data-for="email"],
#panel-connexion[data-step="code"] .login-step[data-for="code"] { display: flex; }
#login-code { font-size: 20px; letter-spacing: 0.18em; text-align: center; font-variant-numeric: tabular-nums; }
.field-foot .btn-link { font-size: 12px; font-weight: 500; color: var(--muted); }
.login-wait { display: none; align-items: center; gap: 10px; font-size: 12.5px; color: var(--muted); }
#panel-connexion.waiting .login-wait { display: flex; }
#panel-connexion.waiting #login-google { display: none; }
.spinner.small { width: 16px; height: 16px; border-width: 2px; flex: none; }
.btn-link.quiet { font-weight: 500; color: var(--muted); }

/* Réglages > Compte */
.acct-set-actions { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; }
.btn-link.danger-link { color: var(--danger); font-weight: 500; font-size: 12.5px; }
#account-settings .segmented button { font-size: 12px; }
.field > .field-foot { font-weight: 400; color: var(--muted); }
