:root {
  color-scheme: light;
  font-family: system-ui, sans-serif;
  background: #f4f1ea;
  color: #1c2428;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  min-height: 100svh;
}

main {
  width: min(100%, 72rem);
  min-height: 100svh;
  margin: 0 auto;
  padding: max(1.5rem, env(safe-area-inset-top)) 1.25rem max(1.5rem, env(safe-area-inset-bottom));
  display: flex;
  flex-direction: column;
  gap: .75rem;
}

.eyebrow {
  color: #5b6b73;
  font-size: .72rem;
  font-weight: 700;
  letter-spacing: .12em;
  margin: 0;
}

.status {
  align-self: flex-start;
  color: #1c2428;
  background: #c8d9c2;
  border-radius: 999px;
  font-weight: 800;
  letter-spacing: .08em;
  padding: .45rem .9rem;
}

.detail {
  color: #44545c;
  min-height: 2.4rem;
  margin: 0;
}

.patient-language,
.voice-debug {
  color: #2c5270;
  font-size: .85rem;
  font-weight: 700;
  margin: 0;
}

.voice-debug {
  color: #5b6b73;
  font-weight: 600;
}

.actions {
  display: flex;
  flex-wrap: wrap;
  gap: .75rem;
}

.actions button {
  flex: 1 1 12rem;
  min-height: 3.5rem;
  border: 0;
  border-radius: .75rem;
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
}

#start { background: #1f6f54; color: #fff; }
#stop { background: #8a3b32; color: #fff; }
#speak { background: #2c5270; color: #fff; }
#synthesize { background: #5a4a2f; color: #fff; }
#instructions { background: #3d5a4a; color: #fff; }
#report { background: #355a78; color: #fff; }
#save-conversation { background: #4a5568; color: #fff; }
#load-conversation { background: #5c4a6a; color: #fff; }
#speak.refused {
  background: #8a3b32;
  animation: speak-refuse 2s ease;
}

@keyframes speak-refuse {
  0%, 100% { background: #8a3b32; }
  25%, 75% { background: #c45c52; }
}

.outgoing {
  background: #eef4ea;
  border: 1px solid #c5d4c0;
  border-radius: .85rem;
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
}

.outgoing[hidden] {
  display: none;
}

.outgoing-source,
.outgoing-translation,
.outgoing-status {
  margin: 0;
  line-height: 1.4;
}

.outgoing-source {
  color: #1c2428;
}

.outgoing-translation {
  background: #dceadf;
  border-radius: .45rem;
  padding: .45rem .55rem;
  font-weight: 600;
}

.outgoing-status {
  color: #8a6a28;
  font-size: .78rem;
  font-style: italic;
  font-weight: 600;
}

.synthesis {
  background: #f3efe6;
  border: 1px solid #d5cbb8;
  border-radius: .85rem;
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.synthesis[hidden] {
  display: none;
}

.synthesis h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #3d3424;
}

.synthesis-meta,
.synthesis-status {
  margin: 0;
  font-size: .78rem;
  color: #6a5a40;
}

.synthesis-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
  color: #1c2428;
}

.patient-instructions {
  background: #e8f0eb;
  border: 1px solid #b8cfc0;
  border-radius: .85rem;
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .45rem;
  cursor: pointer;
}

.patient-instructions[hidden] {
  display: none;
}

.patient-instructions.speaking {
  outline: 2px solid #2c5270;
  outline-offset: 2px;
}

.patient-instructions h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #24382c;
}

.instructions-label {
  margin: .35rem 0 0;
  font-size: .82rem;
  font-weight: 700;
  color: #3a5444;
}

.instructions-meta,
.instructions-status {
  margin: 0;
  font-size: .78rem;
  color: #4a6354;
}

.instructions-fr,
.instructions-translated {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.55;
  color: #1c2428;
}

.instructions-translated {
  background: #dceadf;
  border-radius: .45rem;
  padding: .45rem .55rem;
}

.instructions-hint {
  margin: 0;
  font-size: .78rem;
  color: #4a6354;
}

.practitioner-report {
  background: #e8eef4;
  border: 1px solid #b7c5d4;
  border-radius: .85rem;
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .5rem;
}

.practitioner-report[hidden] {
  display: none;
}

.practitioner-report h2 {
  margin: 0;
  font-size: 1rem;
  font-weight: 700;
  color: #243044;
}

.report-hint,
.report-meta,
.report-status {
  margin: 0;
  font-size: .78rem;
  color: #4a5a6a;
}

.report-text {
  margin: 0;
  white-space: pre-wrap;
  line-height: 1.45;
  color: #1c2428;
}

.actions button:disabled {
  background: #c5ced2;
  color: #6a767c;
  cursor: not-allowed;
}

.conversation {
  background: #fff;
  border: 1px solid #d5d0c6;
  border-radius: .85rem;
  padding: .9rem 1rem;
  flex: 1;
  min-height: 14rem;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.column-headers,
.live-row,
#conversation li {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: .75rem;
}

.column-headers h2 {
  margin: 0 0 .6rem;
  font-size: .78rem;
  letter-spacing: .08em;
  color: #5b6b73;
}

.live-row {
  min-height: 1.4rem;
  margin: 0 0 .6rem;
}

.live-row p {
  margin: 0;
  color: #6a767c;
  font-style: italic;
}

#conversation {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: .5rem;
  flex: 1;
  overflow: auto;
}

#conversation li p {
  margin: 0;
  line-height: 1.4;
  padding: .45rem .55rem;
  background: #f7f4ee;
  border-radius: .45rem;
}

#conversation li p.understood.processing {
  opacity: .75;
}

#conversation li p.understood.uncertain {
  background: #f3ead4;
}

#conversation li p.understood.translated {
  background: #e7eef6;
}

#conversation li {
  cursor: pointer;
}

#conversation li p.understood.selectable {
  cursor: pointer;
}

#conversation li.selected p.heard,
#conversation li.selected p.understood {
  outline: 2px solid #2c5270;
  background: #d9e6f2;
}

.role,
.voice,
.confidence {
  display: block;
  margin: 0 0 .35rem;
  color: #6a767c;
  font-size: .68rem;
  font-weight: 800;
  letter-spacing: .06em;
  text-transform: uppercase;
}

.voice,
.confidence {
  margin: -.15rem 0 .35rem;
  font-weight: 700;
  letter-spacing: .04em;
  text-transform: none;
}

.confidence {
  color: #5b6b73;
  font-size: .64rem;
}

li[data-role="PROFESSIONNEL"] .role { color: #1f6f54; }
li[data-role="PATIENT"] .role { color: #2c5270; }
li[data-role="IA"] .role { color: #5a3d7a; }

#conversation li[data-role="IA"] p.understood.outgoing {
  background: #dceadf;
}

.hint.translation {
  color: #2c5270;
}

mark.anonymized {
  background: #d4e4f5;
  color: #1a3f63;
  font-weight: 700;
  font-style: normal;
  padding: .05rem .28rem;
  border-radius: .3rem;
}

.hint {
  display: block;
  margin-top: .35rem;
  color: #8a6a28;
  font-size: .72rem;
  font-style: italic;
  font-weight: 600;
}

.version {
  position: fixed;
  right: .9rem;
  bottom: max(.75rem, env(safe-area-inset-bottom));
  color: #5b6b73;
  font-size: .68rem;
  opacity: .7;
}

body[data-status="écoute"] .status { background: #9fd0b8; }
body[data-status="erreur"] .status { background: #e2a39b; }
body[data-status="terminée"] .status { background: #d5d0c6; }
