/* Direction B — ecrans : liste, fiche (bento), chat, performance, tableau de bord, administration. */

/* Liste des appels */
.conv-row {
  display: grid; grid-template-columns: 120px 1fr 170px 80px 140px; gap: 12px; align-items: center;
  min-height: 64px; padding: 12px 20px; border-radius: 22px; margin-bottom: 12px;
  cursor: pointer; font-size: 14px;
  transition: transform .15s var(--ease-out), border-color .15s ease-out;
}
.conv-row:hover { transform: translateY(-2px); border-color: var(--tint-40); }
.conv-row strong { font-size: 16px; font-weight: 600; letter-spacing: -.01em; }
.conv-row .muted { font-size: 13px; }

/* Fiche : grille bento — 4 colonnes, tuiles de 2 ou 4 */
.fiche .meta { color: var(--muted); font-size: 14px; margin-bottom: 22px; line-height: 1.5; }
.cards { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 16px; }
.card {
  grid-column: span 2; border-radius: var(--radius-tile); padding: 22px; font-size: 14px; line-height: 1.6;
}
.card.wide { grid-column: 1 / -1; }
.card.card-resume {
  font-size: 17px; line-height: 1.55; font-weight: 500; letter-spacing: -.01em;
  box-shadow: inset 4px 0 0 var(--accent-brand), inset 0 1px 0 rgba(255,255,255,.08), 0 24px 48px rgba(0,0,0,.38);
}
.card h3, .verdict-head h3, .admin h3 {
  font-size: 12px; letter-spacing: .08em; text-transform: uppercase; color: var(--muted);
  margin-bottom: 14px; font-weight: 600;
}
.card ul { padding-left: 18px; }
.card p + p, .card ul + p { margin-top: 8px; }
.kv { display: grid; grid-template-columns: minmax(90px, 140px) 1fr; gap: 8px 12px; }
.kv dt { color: var(--muted); }
.kv dd { margin: 0; }
.proba { height: 12px; background: rgba(255,255,255,.1); border-radius: var(--radius-pill); margin: 12px 0; overflow: hidden; }
.proba > div {
  height: 100%; border-radius: var(--radius-pill); transform-origin: left;
  background-image: linear-gradient(90deg, var(--blue), var(--ok));
  animation: growX .8s var(--ease-out) both;
}
.obj { border-left: 3px solid var(--line); padding: 10px 14px; margin-bottom: 10px;
  border-radius: 0 14px 14px 0; background: rgba(255,255,255,.04); }
.obj.bien { border-color: var(--ok); }
.obj.mal { border-color: var(--rose); }
.obj.non_traitee { border-color: var(--call); }
.feedback { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.fb {
  background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: var(--radius-pill);
  min-width: var(--target); min-height: var(--target); font-size: 17px;
  transition: transform .1s ease-out, border-color .15s ease-out;
}
.fb:hover:not(:disabled) { border-color: var(--accent-brand); }
.fb:active:not(:disabled) { transform: scale(.94); }
.fb.active { border-color: var(--ok); background: rgba(48,209,88,.16); }
.transcript { white-space: pre-wrap; font-size: 13px; color: var(--muted); max-height: 280px; overflow-y: auto; }

/* Chat de suivi */
.chat { margin-top: 4px; }
.chat .msg {
  max-width: min(78%, 640px); padding: 12px 16px; border-radius: 20px; margin-bottom: 10px;
  font-size: 14px; white-space: pre-wrap; line-height: 1.55; position: relative;
}
.chat .msg.user {
  background: var(--tint-12); border: 1px solid var(--tint-40); margin-left: auto; border-bottom-right-radius: 6px;
}
.chat .msg.assistant {
  background: rgba(255,255,255,.07); border: 1px solid var(--line); border-bottom-left-radius: 6px; padding-bottom: 48px;
}
/* Le bouton Copier reste toujours visible (cible tactile, pas de survol sur mobile) */
.chat .copy {
  position: absolute; bottom: 2px; right: 6px; background: none; border: 0; color: var(--muted);
  font-size: 13px; min-height: var(--target); padding: 0 12px; border-radius: var(--radius-pill);
}
.chat .copy:hover { color: var(--text); background: rgba(255,255,255,.08); }
.chat form { display: flex; gap: 8px; margin-top: 14px; align-items: stretch; }
.chat input#chatInput { flex: 1; min-width: 0; }
#attachBtn {
  background: rgba(255,255,255,.06); border: 1px solid var(--line); border-radius: var(--radius-pill);
  min-width: var(--target); min-height: var(--target); font-size: 17px; flex: none;
}
#attachBtn:hover:not(:disabled) { border-color: var(--accent-brand); }
#attachName { display: flex; align-items: center; gap: 6px; margin-top: 8px; font-size: 13px; color: var(--muted); }
#attachName:empty { display: none; }
.attach-clear { background: none; border: 0; color: var(--muted); font-size: 14px; min-width: var(--target); min-height: var(--target); }
.attach-clear:hover { color: var(--rose); }

/* Performance equipe */
.perf-header { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.perf-toggle { display: flex; gap: 4px; padding: 4px; border-radius: var(--radius-pill); background: rgba(255,255,255,.07); }
.perf-toggle button {
  background: none; border: 0; border-radius: var(--radius-pill); min-height: var(--target); padding: 0 20px;
  font-size: 14px; font-weight: 500; color: var(--muted);
}
.perf-toggle button:hover { color: var(--text); }
.perf-toggle button.active { background: var(--action); color: #fff; font-weight: 600; }
.table-wrap { overflow-x: auto; border-radius: var(--radius-tile); padding: 8px 20px; }
table { width: 100%; border-collapse: collapse; font-size: 14px; }
th, td { text-align: left; padding: 14px 10px; border-bottom: 1px solid rgba(255,255,255,.07); }
tr:last-child td { border-bottom: 0; }
th { color: var(--muted); font-weight: 600; font-size: 12px; letter-spacing: .05em; text-transform: uppercase; white-space: nowrap; }
.up { color: var(--ok); font-size: 12px; }
.down { color: var(--rose); font-size: 12px; }
.flat { color: var(--muted); }
.score-cell { display: flex; align-items: center; gap: 8px; font-weight: 600; }
.scorebar-track { height: 6px; width: 96px; background: rgba(255,255,255,.1); border-radius: var(--radius-pill); margin-top: 8px; overflow: hidden; }
.scorebar {
  height: 100%; width: 0; border-radius: var(--radius-pill); transform-origin: left;
  background-image: linear-gradient(90deg, var(--blue), var(--ok)); animation: growX .8s var(--ease-out) both;
}
.perf-row { cursor: pointer; transition: background-color .15s ease-out; }
.perf-row:hover { background: rgba(255,255,255,.06); }
.rank-first { color: var(--call); font-weight: 700; }
.bars { display: flex; align-items: flex-end; gap: 14px; height: 200px; }
.bar { display: flex; flex-direction: column; align-items: center; justify-content: flex-end; flex: 1; height: 100%; min-width: 0; }
.bar-value { font-size: 13px; margin-bottom: 6px; font-weight: 600; }
.bar-track {
  width: 100%; max-width: 44px; flex: 1; display: flex; align-items: flex-end;
  background: rgba(255,255,255,.07); border-radius: 12px; overflow: hidden;
}
.bar-fill {
  width: 100%; height: 0; border-radius: 12px; transform-origin: bottom;
  background-image: linear-gradient(180deg, #4d9dff, var(--action)); animation: growY .9s var(--ease-out) both;
}
.bar-label { font-size: 12px; margin-top: 8px; white-space: nowrap; }
.verdict-card { border-radius: var(--radius-tile); padding: 22px; }
.verdict-head { display: flex; align-items: center; justify-content: space-between; flex-wrap: wrap; gap: 12px; }
.verdict-head h3 { margin-bottom: 0; }
#verdictText { white-space: pre-wrap; line-height: 1.6; }

/* Tableau de bord */
.stats { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 16px; margin-bottom: 16px; }
.stat { border-radius: var(--radius-tile); padding: 22px; }
.stat .n { font-size: 46px; font-weight: 700; letter-spacing: -.03em; line-height: 1.1; }
.stat .l { color: var(--muted); font-size: 14px; margin-top: 6px; }
.stat:nth-child(1) .n { color: #5eb0ff; }
.stat:nth-child(2) .n { color: var(--ok); }

/* Administration */
.admin h3 { margin: 24px 0 12px; }
.admin h3:first-of-type { margin-top: 0; }
.admin form.inline { display: flex; gap: 10px; margin: 16px 0 8px; flex-wrap: wrap; }
.admin form.inline input, .admin form.inline select { flex: 1 1 160px; min-width: 0; }
.admin textarea {
  width: 100%; min-height: 200px; font-family: Consolas, "Cascadia Mono", monospace; font-size: 13px;
  line-height: 1.5; display: block;
}
.brand-name { margin: 20px 0 8px; font-weight: 600; font-size: 16px; }
.brand-save { margin: 10px 8px 6px 0; }
#adminMsg.ok { color: var(--ok); }

/* Mobile : tout s'empile, la barre d'enregistrement passe sur deux lignes */
@media (max-width: 768px) {
  body { overflow: auto; height: auto; min-height: 100vh; background-attachment: scroll; }
  .view { height: auto; min-height: 100vh; }
  .app { height: auto; min-height: 100vh; padding: 12px; gap: 12px; }
  .app-body { flex-direction: column; gap: 12px; }
  main { overflow: visible; padding: 0 0 32px; }
  #content h2 { font-size: 26px; }

  .sidebar { width: auto; flex-direction: row; flex-wrap: wrap; align-items: center; padding: 10px; gap: 6px; border-radius: 24px; }
  .sidebar .who { flex-basis: 100%; padding: 4px 8px 8px; }
  .sidebar .spacer { display: none; }
  .sidebar button { flex: 1 1 auto; padding: 0 16px 0 30px; white-space: nowrap; }
  .sidebar button::before { left: 12px; }
  .sidebar button:hover { transform: none; }

  .island { padding: 12px; gap: 8px; border-radius: 26px; }
  .island select#brand, .island select#callType { flex: 1 1 130px; width: auto; min-width: 0; }
  .island input#clientName { flex: 1 1 100%; order: 3; }
  .island .mic-select { flex: 1 1 0; width: auto; min-width: 0; order: 4; }
  .island .queue { order: 5; }
  .island .record { order: 6; margin-left: 0; }
  .record-bar.recording-live .island { flex-wrap: wrap; border-radius: 30px; }
  .record-bar.recording-live select#brand { flex: 1 1 100%; max-width: none; order: 1; }
  .record-bar.recording-live input#clientName { flex: 1 1 100%; order: 2; }
  .record-bar.recording-live #timer { order: 3; }
  .record-bar.recording-live .vu { order: 4; flex: 1; }
  .record-bar.recording-live .record { order: 5; margin-left: auto; }

  .cards { grid-template-columns: 1fr; }
  .card, .card.wide { grid-column: auto; padding: 18px; }
  .conv-row { grid-template-columns: 1fr auto; padding: 14px 16px; }
  .conv-row > :first-child { grid-column: 1 / -1; }
  .stats { grid-template-columns: 1fr; }
  .hide-mobile { display: none; }
  .table-wrap { padding: 4px 12px; }
  .bars { gap: 6px; }
  .chat .msg { max-width: 92%; }
  .chat form { flex-wrap: wrap; }
  .chat input#chatInput { flex: 1 1 100%; order: -1; }
  .chat button[type=submit] { flex: 1; }
}
