:root {
  --bg: #0f1419; --card: #1a2129; --line: #2a3440; --fg: #e6edf3; --mute: #8b98a5;
  --accent: #3b82f6; --ok: #22c55e; --warn: #f59e0b; --bad: #ef4444;
}
* { box-sizing: border-box; }
html, body { margin: 0; background: var(--bg); color: var(--fg);
  font: 15px/1.4 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif; }
body { padding: env(safe-area-inset-top) env(safe-area-inset-right) env(safe-area-inset-bottom) env(safe-area-inset-left); }
.hidden { display: none !important; }
header { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px;
  border-bottom: 1px solid var(--line); position: sticky; top: 0; background: var(--bg); z-index: 5; }
header h1 { font-size: 18px; margin: 0; }
nav { display: flex; gap: 6px; }
main { max-width: 1200px; margin: 0 auto; padding: 12px; display: grid; gap: 12px; }
#tab-live { grid-template-columns: 1fr; }
@media (min-width: 900px) {
  #tab-live { grid-template-columns: 380px 1fr; align-items: start; }
  #tab-live > section:first-child, #schedCard { grid-column: 1; }
  #workers { grid-column: 2; grid-row: 1 / span 2; }
}
#workers { display: grid; gap: 12px; }
@media (min-width: 1300px) { #workers { grid-template-columns: 1fr 1fr; } }
.card { background: var(--card); border: 1px solid var(--line); border-radius: 12px; padding: 14px; }
.card h2 { font-size: 16px; margin: 0 0 10px; display: flex; align-items: center; gap: 8px; }
.narrow { max-width: 340px; margin: 18vh auto; display: grid; gap: 10px; }
form { display: grid; gap: 8px; }
.row { display: flex; gap: 8px; align-items: center; }
.row > * { flex: 1; min-width: 0; }
input, select, button { font: inherit; color: var(--fg); background: #0b1015; border: 1px solid var(--line);
  border-radius: 8px; padding: 10px 12px; min-height: 42px; }
input[type=checkbox] { min-height: auto; width: 20px; height: 20px; }
input[type=range] { padding: 0; }
button { cursor: pointer; background: #222c37; user-select: none; -webkit-user-select: none; touch-action: manipulation; }
button:active { transform: scale(.98); }
button.primary { background: var(--accent); border-color: var(--accent); }
button.danger { background: #3a1717; border-color: #6b2121; color: #fca5a5; }
button.ghost { background: transparent; border-color: transparent; }
button.small { min-height: 0; padding: 2px 8px; }
button.on { background: var(--ok); border-color: var(--ok); color: #04210f; }
button.off { background: #3a2a10; border-color: var(--warn); color: var(--warn); }
button.talking { background: var(--bad); border-color: var(--bad); }
.tab.active { background: #2a3746; border-color: #3a4a5c; }
.chk { display: flex; align-items: center; gap: 8px; }
details summary { cursor: pointer; color: var(--mute); padding: 4px 0; }
.err { color: var(--bad); min-height: 1em; margin: 0; }
.whead { display: flex; align-items: center; gap: 8px; }
.whead h2 { margin: 0; }
.badge { font-size: 12px; padding: 2px 8px; border-radius: 99px; background: #2a3440; color: var(--mute); }
.badge.in_meeting { background: #12361f; color: var(--ok); }
.badge.joining, .badge.lobby, .badge.leaving { background: #3a2a10; color: var(--warn); }
.badge.error, .badge.offline { background: #3a1717; color: #fca5a5; }
.rec { color: var(--bad); font-weight: 600; font-size: 13px; margin-left: auto; animation: blink 1.6s infinite; }
@keyframes blink { 50% { opacity: .45; } }
.winfo { color: var(--mute); font-size: 13px; margin: 6px 0; word-break: break-all; }
.winfo .e { color: #fca5a5; }
.winfo .n { color: #fcd34d; }
.shot { width: 100%; aspect-ratio: 16/9; object-fit: contain; background: #000; border-radius: 8px;
  border: 1px solid var(--line); display: block; cursor: pointer; }
.audio-ctl, .actions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 10px; align-items: center; }
.audio-ctl .b-ptt { flex: 1; min-height: 56px; font-size: 17px; }
.audio-ctl .vol { width: 110px; }
.audio-ctl .lvl { width: 70px; height: 10px; }
.actions button { flex: 1 1 auto; font-size: 14px; }
.list { list-style: none; margin: 0; padding: 0; display: grid; gap: 8px; }
.list li { display: flex; gap: 8px; align-items: center; border-top: 1px solid var(--line); padding-top: 8px; flex-wrap: wrap; }
.list li .t { flex: 1 1 200px; min-width: 0; }
.list li .t b { display: block; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list li .t small { color: var(--mute); }
.list li a, .list li button { font-size: 13px; min-height: 34px; padding: 6px 10px; text-decoration: none; color: var(--fg);
  background: #222c37; border: 1px solid var(--line); border-radius: 8px; }
.modal { position: fixed; inset: 0; background: rgba(0,0,0,.85); display: flex; align-items: center; justify-content: center; z-index: 20; }
.modal-body { width: min(1100px, 96vw); position: relative; }
.modal video { width: 100%; max-height: 85vh; background: #000; border-radius: 8px; }
.modal .close { position: absolute; top: -44px; right: 0; font-size: 20px; }
#toast { position: fixed; left: 50%; bottom: calc(20px + env(safe-area-inset-bottom)); transform: translateX(-50%);
  background: #222c37; border: 1px solid var(--line); padding: 10px 16px; border-radius: 10px; opacity: 0;
  transition: opacity .2s; pointer-events: none; z-index: 30; max-width: 90vw; }
#toast.show { opacity: 1; }
html, body { overflow-x: hidden; }
main > *, #workers > *, .card { min-width: 0; }
.actions button { flex: 1 1 calc(50% - 8px); }
button:disabled { opacity: .4; cursor: default; }
#tab-live { grid-template-columns: minmax(0, 1fr); }
@media (min-width: 900px) { #tab-live { grid-template-columns: 380px minmax(0, 1fr); } }
form input:not([type=checkbox]), form select { width: 100%; }

/* ---- menu */
header { gap: 10px; }
header h1 { flex: 0 0 auto; }
nav.tabs { flex: 1; justify-content: center; }
.tab { display: inline-flex; align-items: center; gap: 6px; position: relative; }
.tab .count { background: var(--accent); color: #fff; border-radius: 99px; font-size: 11px; padding: 0 6px; line-height: 18px; }
@media (max-width: 700px) {
  nav.tabs { position: fixed; left: 0; right: 0; bottom: 0; z-index: 10; background: var(--card);
    border-top: 1px solid var(--line); padding: 6px 8px calc(6px + env(safe-area-inset-bottom)); gap: 4px; }
  .tab { flex: 1; flex-direction: column; gap: 2px; font-size: 12px; background: transparent; border: none; min-height: 52px; }
  .tab .ico { font-size: 20px; }
  .tab.active { background: #2a3746; }
  .tab .count { position: absolute; top: 4px; left: calc(50% + 8px); }
  main { padding-bottom: calc(90px + env(safe-area-inset-bottom)); }
}

/* ---- enregistrements */
.rec-toolbar { display: flex; flex-wrap: wrap; gap: 8px; margin-bottom: 8px; }
.rec-toolbar input { flex: 2 1 220px; min-width: 0; }
.rec-toolbar select { flex: 1 1 140px; min-width: 0; }
.storage { display: flex; flex-wrap: wrap; gap: 14px; color: var(--mute); font-size: 12px; margin-bottom: 6px; }
.storage .bar { display: inline-block; width: 80px; height: 6px; background: #0b1015; border-radius: 3px; vertical-align: middle; overflow: hidden; margin: 0 4px; }
.storage .bar i { display: block; height: 100%; background: var(--accent); }
.storage .bar i.hi { background: var(--bad); }
h3.day { font-size: 13px; color: var(--mute); text-transform: uppercase; letter-spacing: .04em; margin: 16px 0 8px; }
.rgrid { display: grid; gap: 10px; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr)); }
.ritem { background: #141b22; border: 1px solid var(--line); border-radius: 10px; overflow: hidden; display: flex; flex-direction: column; }
.ritem .thumb { position: relative; aspect-ratio: 16/9; background: #000; cursor: pointer; }
.ritem .thumb img { width: 100%; height: 100%; object-fit: cover; display: block; }
.ritem .thumb .dur { position: absolute; right: 6px; bottom: 6px; background: rgba(0,0,0,.75); font-size: 12px; padding: 1px 6px; border-radius: 4px; }
.ritem .thumb .live { position: absolute; left: 6px; top: 6px; background: var(--bad); font-size: 11px; font-weight: 600; padding: 1px 6px; border-radius: 4px; }
.ritem .thumb .plat { position: absolute; left: 6px; bottom: 6px; background: rgba(0,0,0,.75); font-size: 11px; padding: 1px 6px; border-radius: 4px; text-transform: uppercase; }
.ritem .thumb::after { content: "▶"; position: absolute; inset: 0; display: flex; align-items: center; justify-content: center;
  font-size: 34px; opacity: 0; transition: opacity .15s; background: rgba(0,0,0,.35); }
.ritem .thumb:hover::after { opacity: 1; }
.ritem .rbody { padding: 8px 10px 10px; display: grid; gap: 4px; }
.ritem .rtitle { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ritem small { color: var(--mute); font-size: 12px; }
.ritem .ractions { display: flex; gap: 6px; margin-top: 4px; }
.ritem .ractions > * { flex: 1; font-size: 13px; min-height: 36px; padding: 6px 8px; }
.ritem .ractions .icon { flex: 0 0 40px; }
a.btn { display: inline-flex; align-items: center; justify-content: center; text-decoration: none; color: var(--fg);
  background: #222c37; border: 1px solid var(--line); border-radius: 8px; padding: 8px 12px; min-height: 36px; }
.empty { color: var(--mute); text-align: center; padding: 30px 0; }
.modal-head { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; }
.modal-head b { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.modal .close { position: static; font-size: 20px; }
.ritem .ractions > * { white-space: nowrap; padding: 6px; }
.ritem .ractions .icon { flex: 0 0 36px; }
#refreshRec { flex: 0 0 46px; }
@media (max-width: 700px) { .rec-toolbar select { flex: 1 1 0; } }
select.sink { max-width: 220px; min-height: 36px; padding: 6px 8px; font-size: 13px; }
.modal-head select.sink { max-width: 200px; }
.audio-panel { width: min(480px, 94vw); display: grid; gap: 8px; }
.audio-panel label { color: var(--mute); font-size: 13px; margin-top: 6px; }
.audio-panel select { width: 100%; }
.audio-panel meter { width: 100%; height: 14px; }
.note { color: var(--mute); font-size: 12px; margin: 2px 0; }

/* ------------------------------------------------------------ transcription */
.trb { font-size: 14px; }
.rec + .trb, .trb { margin-left: 4px; }
.whead .rec.hidden + .trb { margin-left: auto; }
.tr-panel { margin-top: 10px; border: 1px solid var(--line); border-radius: 10px; background: #0b1015; overflow: hidden; }
.tr-head { display: flex; align-items: center; gap: 8px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tr-head .tr-status { flex: 1; min-width: 0; font-size: 13px; color: var(--mute); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.tr-head .tr-status.on::before { content: "● "; color: var(--ok); }
.tr-head .tr-status.err { color: #fca5a5; white-space: normal; }
.tr-head button { min-height: 34px; padding: 4px 10px; font-size: 13px; }
.tr-body { max-height: 42vh; overflow-y: auto; padding: 8px 12px; font-size: 15px; line-height: 1.5; overscroll-behavior: contain; }
.tr-body:empty::before { content: "La transcription apparaîtra ici dès que quelqu'un parle."; color: var(--mute); font-size: 13px; }
.tr-body p { margin: 0 0 .55em; }
.tr-body .ts { color: var(--mute); font-size: 12px; font-variant-numeric: tabular-nums; margin-right: 4px; }
.tr-body .ts.seek { cursor: pointer; text-decoration: underline dotted; }
.tr-body .ts.seek:hover { color: var(--accent); }
.tr-body .spk { font-weight: 600; margin-right: 4px; cursor: pointer; }
.tr-body .spk:hover { text-decoration: underline; }
.c0 { --sc: #7dd3fc; } .c1 { --sc: #fcd34d; } .c2 { --sc: #86efac; } .c3 { --sc: #f9a8d4; } .c4 { --sc: #c4b5fd; }
.c5 { --sc: #fdba74; } .c6 { --sc: #5eead4; } .c7 { --sc: #fca5a5; } .c8 { --sc: #a5b4fc; }
.tr-body .spk, .tr-spk .chip { color: var(--sc, #fcd34d); }
.tr-body p { border-left: 3px solid var(--sc, transparent); padding-left: 8px; }
.tr-spk { display: flex; flex-wrap: wrap; gap: 6px; padding: 6px 8px; border-bottom: 1px solid var(--line); }
.tr-spk:empty { display: none; }
.tr-spk .chip { font-size: 12px; font-weight: 600; border: 1px solid currentColor; border-radius: 999px; padding: 2px 9px;
  background: transparent; min-height: 0; cursor: pointer; }
.tr-spk .chip small { font-weight: 400; opacity: .7; margin-left: 4px; }
#playerSpk { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px; background: #0b1015; }
.tr-body .pending { opacity: .6; font-style: italic; }
#playerTr { max-height: 32vh; margin-top: 8px; background: #0b1015; border: 1px solid var(--line); border-radius: 8px; }
#player.tronly video { display: none; }
#player.tronly #playerTr { max-height: 80vh; }
.ritem .thumb.tthumb { display: flex; align-items: center; justify-content: center; font-size: 42px; background: #0b1015; }
.ritem .thumb .tr { position: absolute; right: 6px; top: 6px; background: rgba(0,0,0,.75); font-size: 12px; padding: 1px 6px; border-radius: 4px; }
#player.withtr video { max-height: 52vh; }
/* ---- onglets transcription / points d'étape / compte rendu */
.vtabs { display: flex; gap: 2px; border-bottom: 1px solid var(--line); background: #0d141b; }
.vtabs .vt { flex: 1; border: 0; border-radius: 0; background: transparent; color: var(--mute); min-height: 38px;
  font-size: 13px; font-weight: 600; border-bottom: 2px solid transparent; }
.vtabs .vt.on { color: var(--fg, #e6edf3); border-bottom-color: var(--accent); background: #0b1015; }
.vtabs .vt.hidden { display: none; }
.an-new { background: var(--accent); color: #fff; border-radius: 999px; padding: 1px 7px; font-size: 11px; margin-left: 4px; }
#playerTabs { margin-top: 8px; border: 1px solid var(--line); border-radius: 8px 8px 0 0; }
.an-body { max-height: 52vh; overflow-y: auto; padding: 8px 12px; font-size: 14.5px; line-height: 1.5; overscroll-behavior: contain; }
.an-body .empty { color: var(--mute); font-size: 13px; }
.an-sec { margin: 0 0 12px; }
.an-sec h4 { margin: 10px 0 4px; font-size: 13px; text-transform: uppercase; letter-spacing: .04em; color: var(--mute); }
.an-sec p { margin: 0 0 .4em; }
.an-sec ul { margin: 0; padding-left: 1.2em; }
.an-sec li { margin: 0 0 .3em; }
.an-sec.me { background: rgba(59,130,246,.10); border: 1px solid rgba(59,130,246,.35); border-radius: 8px; padding: 2px 10px 6px; }
.an-sec.warn h4 { color: #fbbf24; }
.an-body .meta, .an-body .ts { color: var(--mute); font-size: 12px; }
.an-body .ts.seek { cursor: pointer; text-decoration: underline dotted; white-space: nowrap; font-variant-numeric: tabular-nums; }
.an-body .ts.seek:hover { color: var(--accent); }
.an-body .done { opacity: .6; }
.an-body b.who { color: var(--sc, #fcd34d); font-weight: 600; }
.topics { display: flex; flex-wrap: wrap; gap: 6px; }
.topic { border: 1px solid var(--line); border-radius: 999px; padding: 2px 10px; font-size: 13px; }
.topic.cur { border-color: var(--ok); }
.topic.later { opacity: .65; border-style: dashed; }
.flash { border-left: 3px solid var(--line); padding: 2px 0 2px 10px; margin: 0 0 10px; }
.flash:first-child { border-left-color: var(--accent); }
.flash .fh { margin-bottom: 2px; }
.tr-body p.hl { background: rgba(59,130,246,.18); transition: background .4s; }
#playerCr, #playerAn { max-height: 70vh; margin-top: 0; background: #0b1015; border: 1px solid var(--line); border-top: 0; border-radius: 0 0 8px 8px; }
#player.withtr #playerCr, #player.withtr #playerAn { max-height: 34vh; }
#player.tronly #playerCr, #player.tronly #playerAn { max-height: 76vh; }
.cr h2 { font-size: 18px; margin: 6px 0 2px; }
.cr h5 { margin: 10px 0 4px; font-size: 14px; }
.cr .subj { border-left: 3px solid var(--line); padding-left: 10px; margin-bottom: 10px; }
.cr .concl { background: rgba(34,197,94,.08); border-radius: 6px; padding: 4px 8px; }
.cr .tw { overflow-x: auto; }
.cr table { border-collapse: collapse; width: 100%; font-size: 13.5px; }
.cr th, .cr td { border: 1px solid var(--line); padding: 4px 6px; text-align: left; vertical-align: top; }
.cr th { background: #121b24; font-weight: 600; }
.cr-bar { display: flex; flex-wrap: wrap; align-items: center; gap: 6px; padding: 4px 0 8px; border-bottom: 1px solid var(--line); margin-bottom: 6px; }
.cr-bar button, .cr-bar .btn { min-height: 32px; padding: 3px 10px; font-size: 13px; }
.cr-bar .run { color: var(--accent); font-size: 13px; flex: 1; }
.cr-bar .err { color: #fca5a5; font-size: 13px; flex: 1; }
.cr .bars .bar-row { display: grid; grid-template-columns: minmax(90px, 30%) 1fr auto; gap: 8px; align-items: center; margin: 3px 0; }
.cr .bars .b { background: #121b24; border-radius: 4px; height: 10px; overflow: hidden; }
.cr .bars .b i { display: block; height: 100%; background: var(--sc, var(--accent)); }
.cr .method { margin-top: 12px; font-size: 13px; }
.cr .method summary { cursor: pointer; color: var(--mute); }
.ractions .cr.run { opacity: .7; }
