:root {
  --room: #0E3B43;      /* bleu-vert profond : la salle d'entretien */
  --room-2: #155563;
  --paper: #F3F6F5;     /* blanc froid */
  --card: #FFFFFF;
  --ink: #16262B;
  --slate: #56686E;
  --line: #D5DFDD;
  --signal: #E8A33D;    /* ambre : l'appel et la note, rien d'autre */
  --good: #2F7D5B;
  --warn: #B8541E;
  --focus: #2D8FA3;
  --radius-lg: 22px;
  --radius-sm: 10px;
  color-scheme: light;
}
@media (prefers-color-scheme: dark) {
  :root {
    --paper: #0F1A1D; --card: #15252A; --ink: #E7EEEC; --slate: #9DB0B4; --line: #26393E;
    --room: #0B2E35; --room-2: #134652; --good: #59B68A; --warn: #E08A57; color-scheme: dark;
  }
}
* { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0; background: var(--paper); color: var(--ink);
  font: 17px/1.55 "Source Sans 3", system-ui, sans-serif;
}
h1, h2, h3, .brand, .cc-name, .score-big { font-family: "Bricolage Grotesque", system-ui, sans-serif; letter-spacing: -0.01em; }
h1 { font-size: clamp(2rem, 5.2vw, 3.3rem); line-height: 1.04; font-weight: 800; margin: 0 0 .5rem; }
h2 { font-size: 1.5rem; line-height: 1.15; margin: 0 0 .75rem; font-weight: 700; }
h3 { font-size: 1.08rem; margin: 1.6rem 0 .5rem; font-weight: 700; }
p { margin: 0 0 .8rem; }
.muted { color: var(--slate); }
a { color: inherit; }
:focus-visible { outline: 3px solid var(--focus); outline-offset: 2px; border-radius: 6px; }

/* En-tête */
.top { display: flex; align-items: center; justify-content: space-between; max-width: 760px; margin: 0 auto; padding: 18px 16px; }
.brand { display: flex; align-items: center; gap: 10px; font-weight: 800; font-size: 1.15rem; text-decoration: none; }
.brand-mark { width: 22px; height: 22px; border-radius: 50%; background: var(--room); box-shadow: inset 0 0 0 6px var(--signal); }
.top-right { display: flex; gap: 14px; align-items: center; color: var(--slate); font-size: .95rem; }
.link { background: none; border: 0; color: inherit; font: inherit; cursor: pointer; text-decoration: underline; text-underline-offset: 3px; padding: 4px; }

main { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; }

/* La carte d'appel */
.hero { display: grid; gap: 28px; padding: 18px 0 30px; }
.callcard {
  position: relative; display: flex; align-items: center; gap: 16px;
  background: var(--room); color: #EAF4F2; border-radius: var(--radius-lg);
  padding: 20px 22px; max-width: 460px; overflow: hidden;
}
.cc-avatar { flex: none; width: 56px; height: 56px; border-radius: 50%; display: grid; place-items: center; background: var(--room-2); font: 700 1.1rem "Bricolage Grotesque", sans-serif; color: var(--signal); }
.cc-body { min-width: 0; }
.cc-name { margin: 0; font-size: 1.25rem; font-weight: 700; }
.cc-role { margin: 0; opacity: .78; font-size: .95rem; }
.cc-status { margin: .35rem 0 0; font-size: .98rem; }
.cc-ring { position: absolute; right: 20px; width: 44px; height: 44px; border-radius: 50%; background: var(--signal); display: none; }
.cc-ring span { position: absolute; inset: 0; border-radius: 50%; border: 2px solid var(--signal); animation: ring 1.6s ease-out infinite; }
.cc-ring span + span { animation-delay: .8s; }
.callcard[data-state="ringing"] .cc-ring, .callcard[data-state="in_call"] .cc-ring { display: block; }
.callcard[data-state="in_call"] .cc-ring { background: var(--good); }
.callcard[data-state="in_call"] .cc-ring span { border-color: var(--good); animation-duration: 2.4s; }
.callcard[data-state="ringing"] .cc-body, .callcard[data-state="in_call"] .cc-body { padding-right: 56px; }
@keyframes ring { from { transform: scale(1); opacity: .9; } to { transform: scale(2.1); opacity: 0; } }
@media (prefers-reduced-motion: reduce) { .cc-ring span { animation: none; } }
.cc-score { margin-left: auto; text-align: right; font: 800 2.4rem/1 "Bricolage Grotesque", sans-serif; color: var(--signal); }
.cc-score small { display: block; font: 600 .8rem "Source Sans 3", sans-serif; color: #CFE3E0; }
.hero-text p { max-width: 60ch; color: var(--slate); font-size: 1.1rem; }

/* Panneaux */
.panel { background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-lg); padding: 24px; margin-bottom: 22px; }
.panel.quiet { background: transparent; border: 0; padding: 8px 0; }
.stack { display: grid; gap: 14px; max-width: 420px; }
label { display: grid; gap: 6px; font-weight: 600; font-size: .95rem; }
input[type=text], input[type=email], input[type=password], input[type=tel], select, textarea {
  font: inherit; font-weight: 400; color: var(--ink); background: var(--paper);
  border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 10px 12px; width: 100%;
}
textarea { resize: vertical; line-height: 1.45; }
.btn { font: 700 1rem "Source Sans 3", sans-serif; border: 0; border-radius: 999px; padding: 13px 22px; cursor: pointer; background: var(--line); color: var(--ink); }
.btn.primary { background: var(--room); color: #fff; }
.btn:disabled { opacity: .55; cursor: progress; }
.err { color: var(--warn); font-weight: 600; }

/* Étapes du formulaire : c'est une vraie séquence, d'où les numéros */
.steps { display: grid; gap: 26px; }
.step { border: 0; padding: 0; margin: 0; display: grid; gap: 14px; }
legend { display: flex; align-items: center; gap: 10px; font: 700 1.15rem "Bricolage Grotesque", sans-serif; margin-bottom: 12px; padding: 0; }
.step-n { width: 28px; height: 28px; border-radius: 50%; display: grid; place-items: center; background: var(--room); color: #fff; font-size: .9rem; }
.drop { position: relative; display: block; border: 2px dashed var(--line); border-radius: var(--radius-sm); padding: 22px; text-align: center; color: var(--slate); font-weight: 600; cursor: pointer; }
.drop input { position: absolute; inset: 0; opacity: 0; cursor: pointer; }
.drop.ok { border-style: solid; border-color: var(--good); color: var(--good); }
.drop.busy { opacity: .6; }
.raw summary { cursor: pointer; color: var(--slate); font-size: .95rem; }
.raw textarea { margin-top: 8px; }
.row2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.row3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 12px; }
.row-between { display: flex; justify-content: space-between; align-items: end; gap: 12px; flex-wrap: wrap; }
.filebtn { cursor: pointer; color: var(--room-2); text-decoration: underline; text-underline-offset: 3px; font-weight: 600; }
@media (prefers-color-scheme: dark) { .filebtn { color: var(--focus); } }
.inline { min-width: 200px; flex: 1; max-width: 300px; }
.choice { display: grid; grid-template-columns: 1fr 1fr; gap: 10px; }
.choice label { position: relative; display: block; cursor: pointer; }
.choice input { position: absolute; opacity: 0; }
.choice span { display: grid; gap: 2px; border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; background: var(--paper); height: 100%; }
.choice small { color: var(--slate); font-weight: 400; }
.choice input:checked + span { border-color: var(--room); box-shadow: inset 0 0 0 1px var(--room); background: var(--card); }
.choice input:focus-visible + span { outline: 3px solid var(--focus); outline-offset: 2px; }
.phone { display: flex; gap: 8px; }
.phone select { width: auto; flex: none; }
.check { display: flex; gap: 10px; align-items: flex-start; font-weight: 400; color: var(--slate); }
.check input { margin-top: 4px; width: 18px; height: 18px; flex: none; }
.btn.call { display: inline-flex; align-items: center; gap: 10px; background: var(--signal); color: #1B1405; font-size: 1.08rem; padding: 15px 26px; justify-self: start; }
.phone-ico { width: 20px; height: 20px; }
.brand { white-space: nowrap; }

/* Suivi */
.timeline { list-style: none; padding: 0; margin: 0 0 6px; display: grid; gap: 10px; }
.timeline li { display: flex; gap: 12px; align-items: center; color: var(--slate); }
.timeline li::before { content: ""; width: 12px; height: 12px; border-radius: 50%; border: 2px solid var(--line); flex: none; }
.timeline li.done { color: var(--ink); }
.timeline li.done::before { background: var(--good); border-color: var(--good); }
.timeline li.now { color: var(--ink); font-weight: 700; }
.timeline li.now::before { border-color: var(--signal); background: var(--signal); }

/* Rapport */
.report-head { display: flex; gap: 22px; align-items: center; flex-wrap: wrap; margin-bottom: 8px; }
.score-big { font-size: 4.2rem; font-weight: 800; line-height: .9; color: var(--room); }
@media (prefers-color-scheme: dark) { .score-big { color: var(--signal); } }
.score-big small { font-size: 1.2rem; color: var(--slate); font-weight: 600; }
.verdict { flex: 1; min-width: 240px; font-size: 1.08rem; }
.crit { display: grid; gap: 12px; }
.crit-row { display: grid; grid-template-columns: minmax(130px, 34%) 1fr 34px; gap: 12px; align-items: center; }
.crit-row .bar { height: 10px; background: var(--line); border-radius: 99px; overflow: hidden; }
.crit-row .bar i { display: block; height: 100%; background: var(--room-2); border-radius: 99px; }
.crit-row .n { font-weight: 700; text-align: right; }
.crit-row p { grid-column: 1 / -1; margin: -6px 0 2px; color: var(--slate); font-size: .95rem; }
.two { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.list { list-style: none; padding: 0; margin: 0; display: grid; gap: 12px; }
.list li { padding-left: 14px; border-left: 3px solid var(--line); }
.list.good li { border-color: var(--good); }
.list.bad li { border-color: var(--warn); }
.list q { display: block; color: var(--slate); font-style: italic; quotes: "« " " »"; }
.list .fix { display: block; margin-top: 3px; }
.qa { border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 0; margin-bottom: 10px; }
.qa summary { cursor: pointer; padding: 12px 14px; display: flex; justify-content: space-between; gap: 12px; font-weight: 600; }
.qa summary .n { color: var(--slate); font-weight: 700; white-space: nowrap; }
.qa div { padding: 0 14px 14px; }
.qa .better { background: var(--paper); border-radius: var(--radius-sm); padding: 10px 12px; margin-top: 6px; }
.actions { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 22px; }

/* Historique */
.history { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.history button { width: 100%; text-align: left; display: flex; justify-content: space-between; gap: 12px; background: var(--card); border: 1px solid var(--line); border-radius: var(--radius-sm); padding: 12px 14px; font: inherit; color: inherit; cursor: pointer; }
.history .score { font: 800 1.2rem "Bricolage Grotesque", sans-serif; }
.history .sub { color: var(--slate); font-size: .92rem; }
.empty { color: var(--slate); }

.foot { max-width: 760px; margin: 0 auto; padding: 0 16px 40px; color: var(--slate); font-size: .9rem; }

@media (max-width: 600px) {
  .who { display: none !important; }
  .row2, .row3, .choice, .two { grid-template-columns: 1fr; }
  .panel { padding: 18px; }
  .callcard { padding: 16px; }
}
@media print {
  .top, .hero, #newView, #historyView, .actions, .foot { display: none !important; }
  body { background: #fff; }
  .panel { border: 0; }
  .qa { break-inside: avoid; }
  .qa[open] div, .qa div { display: block; }
}

/* ---- Entretien en direct ---- */
.choice.two-col { grid-template-columns: 1fr 1fr; }
.live { margin-top: 18px; border: 1px solid var(--line); border-radius: 14px; padding: 16px; background: var(--card); }
.live-top { display: flex; align-items: center; gap: 10px; font-weight: 700; font-variant-numeric: tabular-nums; font-size: 1.15rem; }
.live-top .dot { width: 10px; height: 10px; border-radius: 50%; background: var(--good); box-shadow: 0 0 0 0 rgba(47,125,91,.6); animation: livepulse 1.6s infinite; }
@keyframes livepulse { 70% { box-shadow: 0 0 0 10px rgba(47,125,91,0); } 100% { box-shadow: 0 0 0 0 rgba(47,125,91,0); } }
.live h3 { margin: 12px 0 6px; font-size: 1rem; }
.live-turns { list-style: none; margin: 0; padding: 0; max-height: 300px; overflow-y: auto; display: grid; gap: 6px; }
.live-turns li { padding: 8px 10px; border-radius: 10px; background: var(--paper); line-height: 1.4; }
.live-turns li.candidate { background: color-mix(in srgb, var(--signal) 14%, var(--card)); }
.live-turns li b { display: block; font-size: .8rem; opacity: .7; }
.live-turns li.empty { background: none; opacity: .7; }
.small { font-size: .9rem; }
@media (prefers-reduced-motion: reduce) { .live-top .dot { animation: none; } }
@media (max-width: 520px) { .choice.two-col { grid-template-columns: 1fr; } }
