:root {
  --black: #060606; --orange: #fb7c00; --amber: #e08a00; --cream: #faf8f5; --line: #e6e2dc;
  --green: #2e9e6b; --red: #b4232a; --redbg: #fff8f8; --ink: #1b1b1b; --muted: #777;
}
* { box-sizing: border-box; }
html, body { margin: 0; }
body { font-family: system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif; color: var(--ink); background: var(--cream); font-size: 15px; line-height: 1.5; }
a { color: inherit; }
button { font: inherit; cursor: pointer; }
input, textarea, select { font: inherit; color: inherit; }
.hidden { display: none !important; }

/* En-tête */
.top { background: var(--black); color: #fff; padding: 14px 28px; display: flex; align-items: center; gap: 18px; }
.logo { font-weight: 800; font-size: 18px; letter-spacing: -.01em; text-decoration: none; color: #fff; }
.logo span { color: var(--orange); }
.logo small { font-weight: 600; font-size: 11px; letter-spacing: .18em; text-transform: uppercase; color: #aaa; margin-left: 10px; }
.top .sp { flex: 1; }
.top .who { color: #bbb; font-size: 13px; }
.top a.lnk, .top button.lnk { color: #fff; background: none; border: 1px solid #333; border-radius: 8px; padding: 6px 12px; font-size: 13px; text-decoration: none; }
.top a.lnk:hover, .top button.lnk:hover { border-color: var(--orange); }

main { max-width: 1180px; margin: 0 auto; padding: 32px 28px 60px; }
.kicker { font-size: 11px; letter-spacing: .22em; font-weight: 800; color: var(--orange); text-transform: uppercase; }
h1 { font-size: 40px; line-height: 1.05; margin: 8px 0 10px; letter-spacing: -.02em; font-weight: 800; }
h1 .o { color: var(--orange); }
h2 { font-size: 22px; margin: 0 0 12px; font-weight: 800; }
h3 { font-size: 16px; margin: 0 0 8px; font-weight: 800; }
.lead { color: var(--muted); font-size: 16px; max-width: 680px; margin: 0 0 26px; }

.card { background: #fff; border: 1px solid var(--line); border-radius: 14px; padding: 22px; }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.grid3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
@media (max-width: 860px) { .grid2, .grid3 { grid-template-columns: 1fr; } h1 { font-size: 30px; } }

a.btn { text-decoration: none; display: inline-block; }
.btn { border: 0; border-radius: 10px; padding: 12px 20px; font-weight: 700; background: var(--orange); color: #fff; }
.btn:hover { filter: brightness(1.05); }
.btn:disabled { opacity: .5; cursor: default; }
.btn.dark { background: var(--black); }
.btn.ghost { background: #fff; color: var(--ink); border: 1px solid var(--line); }
.btn.red { background: var(--red); }
.btn.sm { padding: 7px 12px; font-size: 13px; border-radius: 8px; }
.row { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; }

label.f { display: block; font-size: 12px; font-weight: 700; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); margin: 14px 0 6px; }
input.in, textarea.in, select.in { width: 100%; border: 1px solid var(--line); border-radius: 10px; padding: 11px 13px; background: #fff; }
input.in:focus, textarea.in:focus, select.in:focus { outline: 2px solid var(--orange); border-color: transparent; }
textarea.in { min-height: 90px; resize: vertical; }
textarea.code { font-family: ui-monospace, Consolas, monospace; font-size: 13px; min-height: 320px; }

.msg { padding: 10px 14px; border-radius: 10px; margin: 12px 0; font-size: 14px; }
.msg.err { background: var(--redbg); color: var(--red); border-left: 3px solid #e5484d; }
.msg.ok { background: #eef9f3; color: #1d6b47; border-left: 3px solid var(--green); }
.msg.info { background: #fff4e6; color: #5a3a12; border-left: 3px solid var(--orange); }

/* Connexion */
.login { min-height: 100vh; display: grid; grid-template-columns: 1.1fr 1fr; }
.login .side { background: var(--black); color: #fff; padding: 56px; display: flex; flex-direction: column; justify-content: space-between; }
.login .side h1 { font-size: 46px; }
.login .side p { color: #bdbdbd; max-width: 460px; }
.login .form { display: flex; align-items: center; justify-content: center; padding: 40px; }
.login .form .card { width: 100%; max-width: 400px; }
.code-in { font-size: 28px; letter-spacing: 10px; text-align: center; font-weight: 800; }
@media (max-width: 860px) { .login { grid-template-columns: 1fr; } .login .side { padding: 32px; } }

/* Choix du client */
.clients { display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); gap: 18px; margin-bottom: 26px; }
.client { text-align: left; background: #fff; border: 2px solid var(--line); border-radius: 16px; padding: 22px; transition: border-color .15s, transform .15s; }
.client:hover { border-color: #f5b97a; transform: translateY(-2px); }
.client.sel { border-color: var(--orange); box-shadow: 0 0 0 4px #fff0de; }
.client .nm { font-size: 22px; font-weight: 800; }
.client .tg { color: var(--muted); font-size: 14px; margin-top: 6px; }
.client .ct { margin-top: 14px; font-size: 12px; font-weight: 700; color: var(--orange); }
.seg { display: inline-flex; background: #fff; border: 1px solid var(--line); border-radius: 10px; padding: 4px; }
.seg button { border: 0; background: none; padding: 8px 16px; border-radius: 7px; font-weight: 700; color: var(--muted); }
.seg button.on { background: var(--black); color: #fff; }

table.t { width: 100%; border-collapse: collapse; font-size: 14px; }
table.t th { text-align: left; font-size: 11px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted); padding: 8px 10px; border-bottom: 2px solid var(--black); }
table.t td { padding: 10px; border-bottom: 1px solid var(--line); vertical-align: top; }
table.t tr.click { cursor: pointer; }
table.t tr.click:hover td { background: #fffaf3; }
.pill { display: inline-block; padding: 2px 9px; border-radius: 99px; font-size: 12px; font-weight: 700; background: #eee; }
.pill.rdv { background: #e5f6ee; color: #1d6b47; }
.pill.refus { background: var(--redbg); color: var(--red); }
.pill.rappel { background: #fff4e6; color: #8a5200; }
.score { font-weight: 800; }

/* Préparation */
.prep { display: grid; grid-template-columns: 1.3fr 1fr; gap: 22px; align-items: start; }
@media (max-width: 960px) { .prep { grid-template-columns: 1fr; } }
.fiche dl { display: grid; grid-template-columns: 190px 1fr; gap: 8px 14px; margin: 0; font-size: 14px; }
.fiche dt { color: var(--muted); font-weight: 600; }
.fiche dd { margin: 0; word-break: break-word; }
.fiche .who { font-size: 13px; color: var(--muted); }
.timer { font-variant-numeric: tabular-nums; font-weight: 800; font-size: 28px; }
.goalbar { background: var(--black); color: #fff; border-radius: 14px; padding: 16px 20px; margin-bottom: 18px; display: flex; gap: 20px; align-items: center; justify-content: space-between; flex-wrap: wrap; }
.goalbar b { color: var(--orange); }
details.trame { margin-top: 18px; }
details.trame summary { cursor: pointer; font-weight: 700; }
details.trame pre { white-space: pre-wrap; font-family: inherit; font-size: 13px; background: var(--cream); padding: 14px; border-radius: 10px; max-height: 420px; overflow: auto; }

/* Appel */
.call { background: var(--black); color: #fff; border-radius: 22px; padding: 34px; min-height: 520px; display: flex; flex-direction: column; align-items: center; text-align: center; }
.call .who { font-size: 13px; letter-spacing: .2em; text-transform: uppercase; color: #999; }
.call .name { font-size: 30px; font-weight: 800; margin: 6px 0 2px; }
.call .co { color: #bbb; }
.call .clock { font-variant-numeric: tabular-nums; color: var(--orange); font-weight: 700; margin-top: 8px; }
.orb { width: 150px; height: 150px; border-radius: 50%; margin: 30px 0 18px; display: grid; place-items: center; font-size: 44px; background: #1b1b1b; border: 2px solid #333; transition: all .2s; }
.orb.listen { border-color: var(--green); box-shadow: 0 0 0 10px rgba(46,158,107,.15), 0 0 0 22px rgba(46,158,107,.07); animation: pulse 1.6s infinite; }
.orb.speak { border-color: var(--orange); box-shadow: 0 0 0 10px rgba(251,124,0,.18), 0 0 0 22px rgba(251,124,0,.08); }
.orb.think { border-color: #777; }
@keyframes pulse { 50% { box-shadow: 0 0 0 14px rgba(46,158,107,.10), 0 0 0 30px rgba(46,158,107,.04); } }
.state { font-weight: 700; min-height: 24px; }
.live { color: #cfcfcf; min-height: 48px; max-width: 640px; font-size: 16px; margin: 8px 0 16px; }
.call .ctrls { display: flex; gap: 12px; flex-wrap: wrap; justify-content: center; margin-top: auto; }
.call .ctrls .btn.ghost { background: #1b1b1b; color: #fff; border-color: #333; }
.sub { width: 100%; max-width: 720px; text-align: left; margin-top: 18px; }
.bubble { padding: 9px 13px; border-radius: 12px; margin: 6px 0; max-width: 85%; font-size: 14px; }
.bubble.prospect { background: #1f1f1f; color: #eee; }
.bubble.buddy { background: var(--orange); color: #fff; margin-left: auto; }
.typebox { display: flex; gap: 8px; width: 100%; max-width: 640px; margin: 12px 0 16px; }
.typebox input { flex: 1; background: #1b1b1b; border: 1px solid #333; color: #fff; border-radius: 10px; padding: 10px 12px; }

/* Débrief */
.scorebig { display: flex; gap: 26px; align-items: center; flex-wrap: wrap; }
.ring { width: 140px; height: 140px; border-radius: 50%; display: grid; place-items: center; font-size: 40px; font-weight: 800; background: conic-gradient(var(--orange) calc(var(--p) * 1%), #eee 0); position: relative; }
.ring::after { content: ''; position: absolute; inset: 12px; background: #fff; border-radius: 50%; }
.ring span { position: relative; z-index: 1; }
.ring small { font-size: 14px; color: var(--muted); }
.bar { height: 8px; background: #eee; border-radius: 99px; overflow: hidden; margin: 6px 0 4px; }
.bar i { display: block; height: 100%; background: var(--orange); border-radius: 99px; }
.crit { padding: 12px 0; border-bottom: 1px solid var(--line); }
.crit .h { display: flex; justify-content: space-between; font-weight: 700; }
.crit p { margin: 4px 0 0; color: #444; font-size: 14px; }
.quote { border-left: 3px solid var(--orange); padding: 6px 12px; background: var(--cream); border-radius: 0 8px 8px 0; font-style: italic; margin: 6px 0; }
ul.clean { padding-left: 18px; margin: 6px 0; }
ul.clean li { margin-bottom: 6px; }
.obj { background: var(--redbg); border-left: 3px solid #e5484d; padding: 10px 12px; border-radius: 0 10px 10px 0; margin: 8px 0; font-size: 14px; }
.obj .q { color: var(--red); font-weight: 700; }
.spinner { width: 42px; height: 42px; border: 4px solid #eee; border-top-color: var(--orange); border-radius: 50%; animation: spin 1s linear infinite; margin: 30px auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* Admin */
.tabs { display: flex; gap: 6px; border-bottom: 2px solid var(--line); margin-bottom: 22px; flex-wrap: wrap; }
.tabs button { background: none; border: 0; padding: 10px 16px; font-weight: 700; color: var(--muted); border-bottom: 3px solid transparent; margin-bottom: -2px; }
.tabs button.on { color: var(--ink); border-bottom-color: var(--orange); }
.muted { color: var(--muted); }
.small { font-size: 13px; }

/* Courbe de progression */
.stats { display: flex; gap: 12px; flex-wrap: wrap; margin-bottom: 14px; }
.stat { flex: 1 1 150px; border: 1px solid var(--line); border-radius: 10px; padding: 10px 14px; }
.stat .sl { font-size: 11px; letter-spacing: .06em; text-transform: uppercase; color: var(--muted); }
.stat .sv { font-size: 22px; font-weight: 800; color: var(--ink); }
.stat .sv.up::first-letter { color: var(--green); }
.stat .sv.down::first-letter { color: var(--red); }
.chartwrap { position: relative; }
.chart { width: 100%; height: auto; display: block; }
.chart .grid { stroke: var(--line); stroke-width: 1; }
.chart .axis { stroke: #bdb7ae; stroke-width: 1; }
.chart .tick { font-size: 11px; fill: var(--muted); }
.chart .line { fill: none; stroke: var(--orange); stroke-width: 2; stroke-linejoin: round; stroke-linecap: round; }
.chart .dot { fill: var(--orange); stroke: #fff; stroke-width: 2; pointer-events: none; }
.chart .hit { fill: transparent; cursor: pointer; }
.chart .hit:hover + .dot, .chart .hit:hover { fill: rgba(251, 124, 0, .12); }
.tip { position: absolute; transform: translate(-50%, calc(-100% - 12px)); background: var(--black); color: #fff; border-radius: 8px; padding: 8px 10px; font-size: 12px; line-height: 1.4; white-space: nowrap; pointer-events: none; z-index: 2; }
.tip .muted { color: #bbb; }

/* ================= Accessibilité ================= */
:focus-visible { outline: 3px solid var(--orange); outline-offset: 2px; }
.a11y-listen { display: none; margin: 4px 0 10px; }
html.a11y-read .a11y-listen { display: inline-block; }
.top .a11y-btn { font-weight: 700; }

/* Fenêtre des réglages */
.a11y-dlg { width: calc(100% - 32px); max-width: 680px; max-height: calc(100vh - 32px); overflow: auto; border: 0; border-radius: 16px; padding: 24px; background: var(--card, #fff); color: var(--ink); }
.a11y-dlg::backdrop { background: rgba(0, 0, 0, .65); }
.a11y-group { border: 1px solid var(--line); border-radius: 12px; padding: 10px 14px 12px; margin: 12px 0 0; }
.a11y-group legend { font-weight: 800; padding: 0 6px; }
.a11y-opts { display: flex; flex-wrap: wrap; gap: 8px; }
.a11y-opt { display: inline-flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 10px; padding: 8px 12px; cursor: pointer; }
.a11y-opt:has(input:checked) { border-color: var(--orange); font-weight: 700; }
.a11y-opt input { width: 18px; height: 18px; accent-color: var(--orange); }
.a11y-keys { margin-top: 14px; padding: 10px 12px; border-radius: 10px; background: var(--cream); }

/* Aucun mouvement (réglage, ou préférence du système) */
html.a11y-nomotion *, html.a11y-nomotion *::before, html.a11y-nomotion *::after { animation: none !important; transition: none !important; scroll-behavior: auto !important; }
html.a11y-nomotion .client:hover { transform: none; }
html.a11y-nomotion .orb { transform: none !important; }
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
  .client:hover { transform: none; }
}

/* Mise en page simplifiée : une colonne, centrée, cibles larges */
html.a11y-simple main { max-width: 820px; }
html.a11y-simple .grid2, html.a11y-simple .grid3, html.a11y-simple .prep, html.a11y-simple .login { grid-template-columns: 1fr; }
html.a11y-simple .clients { grid-template-columns: 1fr; }
html.a11y-simple .fiche dl { grid-template-columns: 1fr; gap: 2px 0; }
html.a11y-simple .fiche dd { margin-bottom: 10px; }
html.a11y-simple .btn, html.a11y-simple .seg button, html.a11y-simple .tabs button { min-height: 48px; }
html.a11y-simple .call { padding: 24px 16px; }
html.a11y-simple .lead, html.a11y-simple .small, html.a11y-simple .muted, html.a11y-simple table.t, html.a11y-simple .fiche dl { font-size: 15px; }
html.a11y-simple :focus-visible { outline-width: 4px; }

/* Thème sombre doux (photosensibilité : pas de grandes surfaces blanches) */
html.a11y-sombre {
  --cream: #141210; --ink: #ece4d6; --muted: #bdb3a4; --line: #3d3833; --card: #1e1b18;
  --orange: #ff9d3d; --amber: #f0a640; --green: #6fd3a2; --red: #ff8f85; --redbg: #2b1816; --black: #050505;
  color-scheme: dark;
}
/* Contraste maximal (jaune sur noir) */
html.a11y-jaune {
  --cream: #000; --ink: #ffe94d; --muted: #f2dc5a; --line: #9c8a1e; --card: #000;
  --orange: #ffd400; --amber: #ffd400; --green: #8dff9f; --red: #ff8a8a; --redbg: #000; --black: #000;
  color-scheme: dark;
}
html.a11y-jaune .card, html.a11y-jaune .client, html.a11y-jaune .call { border: 2px solid var(--line); }
html.a11y-jaune .logo, html.a11y-jaune .top a.lnk, html.a11y-jaune .top button.lnk, html.a11y-jaune .call .name { color: var(--ink); }
:is(html.a11y-sombre, html.a11y-jaune) :is(.card, .client, .seg, .btn.ghost, input.in, textarea.in, select.in, .ring::after, .a11y-dlg) { background: var(--card); color: var(--ink); }
:is(html.a11y-sombre, html.a11y-jaune) .btn:not(.ghost):not(.dark):not(.red) { color: #111; }
:is(html.a11y-sombre, html.a11y-jaune) .btn.dark { background: #2a2622; color: var(--ink); }
:is(html.a11y-sombre, html.a11y-jaune) .btn.red { background: #8f1d23; color: #fff; }
:is(html.a11y-sombre, html.a11y-jaune) .btn:hover { filter: none; }
:is(html.a11y-sombre, html.a11y-jaune) .seg button.on { background: var(--orange); color: #111; }
:is(html.a11y-sombre, html.a11y-jaune) .client.sel { box-shadow: 0 0 0 4px rgba(255, 157, 61, .25); }
:is(html.a11y-sombre, html.a11y-jaune) table.t th { border-bottom-color: var(--line); }
:is(html.a11y-sombre, html.a11y-jaune) table.t tr.click:hover td { background: #2a2520; }
:is(html.a11y-sombre, html.a11y-jaune) .pill { background: #2e2a26; color: var(--ink); }
:is(html.a11y-sombre, html.a11y-jaune) .pill.rdv { background: #163326; color: var(--green); }
:is(html.a11y-sombre, html.a11y-jaune) .pill.refus { background: #3a1a1a; color: var(--red); }
:is(html.a11y-sombre, html.a11y-jaune) .pill.rappel { background: #3a2a10; color: var(--amber); }
:is(html.a11y-sombre, html.a11y-jaune) .msg.ok { background: #132a1f; color: var(--green); }
:is(html.a11y-sombre, html.a11y-jaune) .msg.info { background: #2e2310; color: #ffd9a8; }
:is(html.a11y-sombre, html.a11y-jaune) .msg.err, :is(html.a11y-sombre, html.a11y-jaune) .obj { background: var(--redbg); color: var(--red); }
:is(html.a11y-sombre, html.a11y-jaune) .crit p { color: var(--muted); }
:is(html.a11y-sombre, html.a11y-jaune) :is(.bar, .spinner) { background: #2e2a26; border-color: #2e2a26; border-top-color: var(--orange); }
:is(html.a11y-sombre, html.a11y-jaune) .ring { background: conic-gradient(var(--orange) calc(var(--p) * 1%), #2e2a26 0); }
:is(html.a11y-sombre, html.a11y-jaune) .chart .dot { stroke: var(--card); }
:is(html.a11y-sombre, html.a11y-jaune) .chart .axis { stroke: var(--muted); }
:is(html.a11y-sombre, html.a11y-jaune) .tip { background: #2a2622; color: var(--ink); border: 1px solid var(--line); }
:is(html.a11y-sombre, html.a11y-jaune) .bubble.buddy { color: #111; }
:is(html.a11y-sombre, html.a11y-jaune) .client:hover { border-color: var(--orange); }
:is(html.a11y-sombre, html.a11y-jaune) .orb.listen, :is(html.a11y-sombre, html.a11y-jaune) .orb.speak { box-shadow: none; border-width: 4px; }
html.a11y-sombre :is(.top, .login .side, .call, .goalbar, .logo, .call .name, .top a.lnk, .top button.lnk) { color: var(--ink); }
html.a11y-sombre .login .side p, html.a11y-sombre .call .co { color: var(--muted); }

/* Notes de préparation à côté de l'appel */
.callgrid { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: 18px; align-items: start; }
.callnotes { position: sticky; top: 16px; }
.callnotes .quote { font-style: normal; font-size: 15px; }
.callnotes .note { margin-top: 10px; }
@media (max-width: 960px) { .callgrid { grid-template-columns: 1fr; } .callnotes { position: static; } }
html.a11y-simple .callgrid { grid-template-columns: 1fr; }
html.a11y-simple .callnotes { position: static; }
