/* Espace orthophoniste : même univers que le jeu, en plus sobre. */

body { background: #f2f7f8; }

.pro-bar {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 10px 20px;
  background: #fff;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  z-index: 5;
}
.pro-brand { display: flex; align-items: center; gap: 8px; font-weight: 900; color: var(--ink); text-decoration: none; }
.pro-brand img { height: 32px; width: auto; display: block; }
.pro-who { margin-left: auto; color: var(--ink-soft); font-weight: 700; }
.pro-nav { display: flex; gap: 18px; margin-left: 12px; }
.pro-nav a { color: var(--ink); font-weight: 800; text-decoration: none; padding: 4px 0; border-bottom: 3px solid transparent; }
.pro-nav a:hover { border-color: var(--brand-light); }
@media (max-width: 720px) { .pro-bar { flex-wrap: wrap; } .pro-nav { order: 3; width: 100%; margin-left: 0; } }

/* --- Tableau des patients --------------------------------------------- */

.patient-table th { padding: 0; }
.patient-table th .sort {
  display: inline-flex; align-items: center; gap: 4px; width: 100%; padding: 6px 8px;
  border: 0; background: none; font: inherit; color: inherit; text-transform: inherit; letter-spacing: inherit; text-align: left; cursor: pointer;
}
.patient-table th .sort:hover { color: var(--brand); }
.patient-table th[aria-sort='ascending'] .sort-icon::after { content: '▲'; }
.patient-table th[aria-sort='descending'] .sort-icon::after { content: '▼'; }
.patient-table th[aria-sort='ascending'] .sort, .patient-table th[aria-sort='descending'] .sort { color: var(--brand); }
.patient-table .sort-icon { font-size: 0.7em; }
/* Pas de défilement horizontal : colonnes secondaires masquées, puis une carte par patient. */
.patient-table { table-layout: auto; }
.sort-select { display: none; align-items: center; gap: 8px; font-weight: 700; color: var(--ink-soft); }
.sort-select select { font: inherit; padding: 8px 10px; border: 2px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); }
.patient-table td { vertical-align: middle; }
.patient-table td.col-actions { width: 1%; white-space: nowrap; text-align: right; }
.patient-table td.col-last { white-space: nowrap; }
@media (max-width: 860px) {
  .patient-table .col-birthYear, .patient-table .col-created { display: none; }
}
@media (max-width: 560px) {
  .patient-table thead { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); }
  .patient-table, .patient-table tbody, .patient-table tr, .patient-table td { display: block; }
  .patient-table tr { padding: 12px 0; border-top: 1px solid var(--line); }
  .patient-table tr:first-child { border-top: 0; }
  .patient-table td { border: 0; padding: 2px 0; }
  .patient-table td[data-label]::before { content: attr(data-label) ' : '; color: var(--ink-soft); font-weight: 700; }
  .patient-table td.col-actions { width: auto; text-align: left; padding-top: 8px; }
  .patient-table .col-birthYear, .patient-table .col-created { display: block; }
  .sort-select { display: flex; }
}
.patient-table tbody tr:hover { background: #f5f8fb; }
.patient-link { color: var(--ink); text-decoration: none; }
.patient-link:hover { color: var(--brand); text-decoration: underline; }
.visually-hidden { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }

/* --- Réglages par défaut ---------------------------------------------- */

.default-head { display: flex; align-items: center; gap: 14px; }
.default-head img { width: 56px; height: 56px; object-fit: contain; }
.default-head > div { flex: 1; }
.default-head h2 { margin: 0; }
.default-head p { margin: 4px 0 0; }
.default-form { margin-top: 14px; }
.defaults-note { margin: 4px 0 8px; }
.pro-bar .btn-link { padding: 0; }

.screen.pro { max-width: 1000px; }
.pro-title { font-size: clamp(1.5rem, 4vw, 2rem); font-weight: 900; margin: 12px 0 8px; }
.pro .btn-back { display: inline-block; text-decoration: none; color: var(--ink); margin-top: 8px; background: #fff; }
.muted { color: var(--ink-soft); }
.small { font-size: 0.88rem; }

.login { max-width: 460px; }

/* --- Formulaires ------------------------------------------------------ */

.form { display: flex; flex-direction: column; gap: 14px; }
.form h2 { margin-bottom: 0; }
.form label { display: flex; flex-direction: column; gap: 6px; font-weight: 700; flex: 1; min-width: 180px; }
.form label.check { flex-direction: row; align-items: center; font-weight: 600; }
.form input[type='email'],
.form input[type='number'],
.form input:not([type]),
.form input[type='search'],
.form input[inputmode] {
  font: inherit;
  font-weight: 600;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #fbfdff;
  min-width: 0;
}
.form input:focus { outline: none; border-color: var(--brand); }
.form .row { display: flex; flex-wrap: wrap; gap: 14px; }
.field-help { font-weight: 600; font-size: 0.85rem; color: var(--ink-soft); }
.initials-preview { color: var(--ink); }
.form-msg { color: var(--danger); font-weight: 700; margin: 0; min-height: 1.2em; }
.form-actions { display: flex; align-items: center; gap: 16px; }

fieldset.emails { border: 0; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
fieldset.emails legend { font-weight: 700; margin-bottom: 6px; padding: 0; }
.email-list { display: flex; flex-direction: column; gap: 8px; }
.email-row { display: flex; gap: 8px; max-width: 460px; }
.email-row input { flex: 1; }
fieldset.emails .btn-link { align-self: flex-start; padding: 0; }

.btn-primary {
  border: 0;
  border-radius: 999px;
  padding: 11px 20px;
  font-weight: 800;
  color: #fff;
  background: var(--brand);
  box-shadow: 0 3px 0 var(--brand-dark);
  text-decoration: none;
  display: inline-block;
  align-self: flex-start;
  white-space: nowrap;
}
.btn-primary:active:not(:disabled) { transform: translateY(2px); box-shadow: 0 1px 0 var(--brand-dark); }

.btn-small,
.btn-secondary-small {
  border: 2px solid var(--line);
  background: #fff;
  border-radius: 999px;
  padding: 6px 12px;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--ink);
  text-decoration: none;
  white-space: nowrap;
}
.btn-small.primary { border-color: var(--brand); color: var(--brand); }
.btn-small.danger { color: var(--danger-strong); }
.btn-small.armed { background: var(--danger-strong); border-color: var(--danger-strong); color: #fff; }
.btn-icon { border: 0; background: #eef2f6; border-radius: 8px; width: 40px; font-size: 1.2rem; font-weight: 800; }

/* --- Listes ----------------------------------------------------------- */

.toolbar { display: flex; gap: 12px; align-items: center; margin: 8px 0 4px; flex-wrap: wrap; }
.toolbar .search {
  flex: 1;
  min-width: 200px;
  font: inherit;
  padding: 10px 14px;
  border: 2px solid var(--line);
  border-radius: 999px;
  background: #fff;
}

.rows { list-style: none; margin: 0; padding: 0; }
.row-item {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-wrap: wrap;
  padding: 12px 0;
  border-top: 1px solid var(--line);
}
.row-item:first-child { border-top: 0; }
.row-item.is-disabled { opacity: 0.55; }
.row-main { display: flex; flex-direction: column; gap: 2px; flex: 1; min-width: 220px; color: inherit; text-decoration: none; }
a.row-main:hover strong { text-decoration: underline; }
.row-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }

.patient-head { display: flex; justify-content: space-between; align-items: center; gap: 16px; flex-wrap: wrap; }
.patient-head p { margin: 0 0 4px; }

.table { width: 100%; border-collapse: collapse; }
.table th { text-align: left; font-size: 0.8rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--ink-soft); padding: 6px 8px; }
.table td { padding: 10px 8px; border-top: 1px solid var(--line); vertical-align: top; }
.table td:last-child { width: 120px; vertical-align: middle; }
.tag { font-size: 0.75rem; background: #fff3cd; border-radius: 6px; padding: 1px 6px; font-weight: 700; }
.tag.ok { background: var(--ok-soft); color: var(--ok-ink); }
.tag.warn { background: var(--danger-soft); color: var(--danger-ink); }
.tag.info { background: var(--brand-soft); color: var(--brand); }
.table-scroll { overflow-x: auto; }
.table td:last-child .h-bar { display: block; margin-top: 4px; }

/* --- Voix ---------------------------------------------------------------- */

.voice-choice { border: 0; padding: 0; margin: 0; }
.voice-choice legend { font-weight: 800; padding: 0; }
.voice-options { display: flex; flex-wrap: wrap; gap: 10px; margin-top: 6px; }
.voice-option { display: flex; align-items: center; gap: 8px; border: 2px solid var(--line); border-radius: 14px; padding: 6px 8px 6px 12px; background: #fff; }
.voice-option:has(input:checked) { border-color: var(--brand); background: var(--brand-soft); }
.form .voice-option label { display: flex; flex-direction: row; align-items: center; gap: 8px; font-weight: 700; cursor: pointer; margin: 0; }
.voice-option input { accent-color: var(--brand); }

/* --- Replay ------------------------------------------------------------ */

body.replay-open { overflow: hidden; }
.replay-overlay {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(35, 50, 74, 0.55);
  display: grid; place-items: center; padding: 16px;
}
.replay {
  width: min(960px, 100%); max-height: calc(100dvh - 32px); overflow: auto;
  background: linear-gradient(var(--sky), #fff4ea); border-radius: 22px;
  padding: 14px 18px 16px; display: flex; flex-direction: column; gap: 10px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
}
.replay-head { display: flex; justify-content: space-between; align-items: center; gap: 12px; }
.replay-caption { margin: 0; min-height: 1.4em; background: #fff; border-radius: 12px; padding: 8px 12px; font-weight: 600; }
.replay-track { position: relative; padding-top: 4px; }
.replay-seek { width: 100%; accent-color: var(--brand); }
.replay-marks { position: relative; height: 10px; margin: 0 8px; }
.replay-marks .mark { position: absolute; top: 0; width: 4px; height: 10px; border-radius: 2px; transform: translateX(-2px); background: #9aa9bb; }
.replay-marks .mark.ok { background: var(--ok); }
.replay-marks .mark.ko { background: var(--danger); }
.replay-controls { display: flex; flex-wrap: wrap; align-items: center; gap: 10px; }
.replay-controls .btn-primary { min-width: 64px; }
.replay-time { font-variant-numeric: tabular-nums; font-weight: 800; min-width: 92px; }
.replay-speed { display: inline-flex; width: auto; }
.replay-speed button { padding: 6px 12px; }
.replay-opt { display: inline-flex; align-items: center; gap: 6px; font-weight: 700; font-size: 0.9rem; }
.session-detail .btn-replay { margin: 2px 0 10px; }
.btn-icon { border: 0; background: rgba(255, 255, 255, 0.8); width: 36px; height: 36px; border-radius: 50%; font-weight: 900; cursor: pointer; }

/* --- Suivi ------------------------------------------------------------- */

.stats { display: grid; grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)); gap: 10px; margin: 10px 0 6px; }
.stat { background: #f5f8fb; border-radius: 12px; padding: 10px 12px; display: flex; flex-direction: column; }
.stat strong { font-size: 1.35rem; font-weight: 900; }
.stat span { font-size: 0.85rem; color: var(--ink-soft); font-weight: 700; }
.panel h3 { margin: 20px 0 8px; font-size: 1rem; }
.insights { list-style: none; padding: 0; margin: 0; display: grid; gap: 6px; }
.insights li { padding: 8px 12px 8px 14px; border-radius: 10px; border-left: 5px solid; background: #f5f8fb; font-weight: 600; }
.insights li.alert { border-color: var(--danger); background: var(--danger-soft); }
.insights li.warn { border-color: #e2a400; background: #fff7dd; }
.insights li.good { border-color: var(--ok); background: var(--ok-soft); }
.insights li.info { border-color: var(--brand-light); }
.session-row { cursor: pointer; }
.session-row:hover, .session-row[aria-expanded="true"] { background: #f5f8fb; }
.session-detail td { background: #f5f8fb; border-top: 0; }
.items { margin: 0; padding-left: 28px; display: grid; gap: 6px; }
.items li { display: flex; flex-wrap: wrap; gap: 6px 14px; align-items: baseline; }
.item-q { min-width: 180px; }
.item-a { display: flex; flex-wrap: wrap; gap: 6px; }
.try { font-size: 0.85rem; font-weight: 700; border-radius: 6px; padding: 1px 8px; }
.try.ok { background: var(--ok-soft); color: var(--ok-ink); }
.try.ko { background: var(--danger-soft); color: var(--danger-ink); }
.try small { font-weight: 600; opacity: 0.75; }

/* --- Partage ----------------------------------------------------------- */

.settings-step .step-title { font-size: 1.15rem; font-weight: 800; margin: 22px 0 0; }
.share-actions { display: flex; align-items: center; gap: 16px; margin: 6px 0 20px; }
.share-result { border: 3px solid var(--ok); }
.link-box { display: flex; gap: 8px; margin: 10px 0; }
.link-box input {
  flex: 1;
  min-width: 0;
  font: inherit;
  font-size: 0.95rem;
  padding: 10px 12px;
  border: 2px solid var(--line);
  border-radius: 10px;
  background: #f6f9fc;
}
.send-form { display: flex; flex-direction: column; gap: 8px; align-items: flex-start; margin: 14px 0; }
.send-form h3 { margin: 0; }
.send-form .check { display: flex; gap: 8px; align-items: center; font-weight: 600; }

/* --- Notifications ------------------------------------------------------ */

.toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%);
  max-width: calc(100% - 32px);
  padding: 12px 20px;
  border-radius: 12px;
  background: var(--ink);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
  z-index: 20;
  word-break: break-all;
  transition: opacity 0.3s;
}
.toast-error { background: var(--danger-strong); }
.toast.out { opacity: 0; }

@media (max-width: 600px) {
  .pro-who { display: none; }
  .pro-bar { padding: 10px 16px; }
  .link-box { flex-direction: column; }
}
