/* Retake — styles partagés (admin + review). Thème sombre par défaut, thème clair sous :root[data-theme="light"], esthétique timeline de montage.
   Tout ce qui est couleur passe par des variables ; seuls les éléments posés SUR une vidéo / une vignette gardent des teintes fixes. */
:root, :root[data-theme="dark"], .player:fullscreen {
  --bg: #0a0a0b;
  --bg-1: #111113;
  --bg-2: #18181b;
  --bg-3: #202024;
  --bg-hover: #141417;
  --card-hover: #131316;
  --line: #26262b;
  --line-2: #36363d;
  --line-3: #4a4a54;
  --text: #ededef;
  --muted: #8d8d97;
  --dim: #5d5d68;
  --accent: #ff4a2b;
  --accent-hover: #ff6045;
  --on-accent: #140400;
  --accent-soft: rgba(255, 74, 43, 0.14);
  --accent-line: rgba(255, 74, 43, 0.45);
  --accent-faint: rgba(255, 74, 43, 0.045);
  --accent-glow: rgba(255, 74, 43, 0.12);
  --ok: #3ecf8e;
  --ok-soft: rgba(62, 207, 142, 0.1);
  --ok-line: rgba(62, 207, 142, 0.4);
  --info: #5b9dff;
  --info-soft: rgba(91, 157, 255, 0.1);
  --info-line: rgba(91, 157, 255, 0.4);
  --warn: #f5b942;
  --warn-soft: rgba(245, 185, 66, 0.1);
  --warn-line: rgba(245, 185, 66, 0.45);
  --violet: #a78bfa;
  --violet-soft: rgba(167, 139, 250, 0.1);
  --violet-line: rgba(167, 139, 250, 0.4);
  --tint: rgba(255, 255, 255, 0.02);
  --hatch: rgba(255, 255, 255, 0.015);
  --grid-line: rgba(255, 255, 255, 0.022);
  --swatch-ring: rgba(255, 255, 255, 0.25);
  --track: rgba(0, 0, 0, 0.4);
  --scrim: rgba(0, 0, 0, 0.6);
  --scrim-modal: rgba(0, 0, 0, 0.72);
  --bg-glass: rgba(10, 10, 11, 0.86);
  --bg-veil: rgba(10, 10, 11, 0.8);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55), 0 0 0 1px rgba(255, 255, 255, 0.03);
  --shadow-hover: 0 12px 34px rgba(0, 0, 0, 0.45);
  --shadow-modal: 0 30px 80px rgba(0, 0, 0, 0.6);
  --shadow-drawer: 24px 0 60px rgba(0, 0, 0, 0.6);
}
:root { color-scheme: dark; }

/* Thème clair : blanc cassé chaud, surfaces blanches, filets fins, rouge REC légèrement assombri pour le contraste. */
:root[data-theme="light"] {
  color-scheme: light;
  --bg: #f6f5f2;
  --bg-1: #ffffff;
  --bg-2: #eeece7;
  --bg-3: #e4e1da;
  --bg-hover: #ebe9e3;
  --card-hover: #fcfbfa;
  --line: #e4e2dc;
  --line-2: #d2cfc6;
  --line-3: #bbb7ac;
  --text: #17171a;
  --muted: #55545b;
  --dim: #6f6d76;
  --accent: #cf3417;
  --accent-hover: #b72c12;
  --on-accent: #ffffff;
  --accent-soft: rgba(207, 52, 23, 0.09);
  --accent-line: rgba(207, 52, 23, 0.4);
  --accent-faint: rgba(207, 52, 23, 0.05);
  --accent-glow: rgba(207, 52, 23, 0.08);
  --ok: #0b7a4b;
  --ok-soft: rgba(11, 122, 75, 0.09);
  --ok-line: rgba(11, 122, 75, 0.35);
  --info: #1c5bc4;
  --info-soft: rgba(28, 91, 196, 0.08);
  --info-line: rgba(28, 91, 196, 0.35);
  --warn: #8f5a00;
  --warn-soft: rgba(143, 90, 0, 0.09);
  --warn-line: rgba(143, 90, 0, 0.35);
  --violet: #6b4bd0;
  --violet-soft: rgba(107, 75, 208, 0.08);
  --violet-line: rgba(107, 75, 208, 0.35);
  --tint: rgba(0, 0, 0, 0.025);
  --hatch: rgba(0, 0, 0, 0.03);
  --grid-line: rgba(0, 0, 0, 0.045);
  --swatch-ring: rgba(0, 0, 0, 0.22);
  --track: rgba(0, 0, 0, 0.09);
  --scrim: rgba(23, 20, 14, 0.4);
  --scrim-modal: rgba(23, 20, 14, 0.5);
  --bg-glass: rgba(246, 245, 242, 0.86);
  --bg-veil: rgba(246, 245, 242, 0.86);
  --shadow-pop: 0 16px 44px rgba(40, 32, 16, 0.16), 0 0 0 1px rgba(0, 0, 0, 0.04);
  --shadow-hover: 0 12px 30px rgba(40, 32, 16, 0.12);
  --shadow-modal: 0 28px 70px rgba(40, 32, 16, 0.22);
  --shadow-drawer: 24px 0 60px rgba(40, 32, 16, 0.2);
}
:root {
  --font: 'Geist', system-ui, -apple-system, 'Segoe UI', sans-serif;
  --mono: 'Geist Mono', ui-monospace, 'SF Mono', Menlo, Consolas, monospace;
  --r: 6px;
  --ease: cubic-bezier(0.2, 0.7, 0.2, 1);
  --tap: 40px;
}

*,
*::before,
*::after { box-sizing: border-box; }
html { -webkit-text-size-adjust: 100%; }
body {
  margin: 0;
  background: var(--bg);
  color: var(--text);
  font: 14px/1.5 var(--font);
  -webkit-font-smoothing: antialiased;
  overflow-x: hidden;
}
[hidden] { display: none !important; }
a { color: inherit; }
button, input, select, textarea { font: inherit; color: inherit; }
::selection { background: var(--accent); color: var(--on-accent); }
.mono { font-family: var(--mono); }

/* Scrollbars discrètes */
* { scrollbar-width: thin; scrollbar-color: var(--line-2) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--line-2); border-radius: 4px; }

/* ---------- Boutons / champs ---------- */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: 6px;
  min-height: 34px; padding: 0 14px;
  background: var(--bg-2); border: 1px solid var(--line-2); border-radius: var(--r);
  font-size: 13px; font-weight: 500; cursor: pointer; text-decoration: none; white-space: nowrap;
  transition: background .15s var(--ease), border-color .15s var(--ease), color .15s var(--ease), transform .1s;
}
.btn:hover { background: var(--bg-3); border-color: var(--line-3); }
.btn:active { transform: translateY(1px); }
.btn:disabled { opacity: .4; cursor: not-allowed; transform: none; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: var(--on-accent); font-weight: 600; }
.btn.primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { color: var(--text); background: var(--bg-2); }
.btn.danger:hover { border-color: var(--accent-line); color: var(--accent); background: var(--accent-soft); }
.btn.sm { min-height: 28px; padding: 0 10px; font-size: 12px; }
.btn.on { background: var(--accent-soft); border-color: var(--accent-line); color: var(--accent); }
.btn:focus-visible, .icon-btn:focus-visible, input:focus-visible, select:focus-visible, textarea:focus-visible, .tc-btn:focus-visible {
  outline: 2px solid var(--accent); outline-offset: 1px;
}

.field, select.field, textarea.field {
  width: 100%; min-height: 38px; padding: 8px 12px;
  background: var(--bg-1); border: 1px solid var(--line-2); border-radius: var(--r);
  transition: border-color .15s var(--ease);
}
.field:focus { outline: none; border-color: var(--accent); }
select.field { appearance: none; padding-right: 30px; cursor: pointer;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 50%, calc(100% - 11px) 50%; background-size: 5px 5px; background-repeat: no-repeat; }
label.lbl { display: block; font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); margin-bottom: 7px; }

.icon-btn {
  display: inline-grid; place-items: center; width: var(--tap); height: var(--tap); flex: none;
  background: transparent; border: 0; border-radius: var(--r); color: var(--text); cursor: pointer;
  transition: background .15s var(--ease), color .15s var(--ease);
}
.icon-btn:hover { background: var(--bg-3); }
.icon-btn.on { color: var(--accent); }
.icon-btn svg { width: 20px; height: 20px; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.icon-btn svg .fill { fill: currentColor; stroke: none; }

.eyebrow { font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.muted { color: var(--muted); }
.err-text { color: var(--accent); font-size: 13px; }

/* ---------- Brand / topbar ---------- */
.brand { display: inline-flex; align-items: center; gap: 9px; font: 600 13px/1 var(--mono); letter-spacing: .14em; text-transform: uppercase; text-decoration: none; }
.brand-link { cursor: pointer; border-radius: 4px; transition: opacity .15s var(--ease); }
.brand-link:hover { opacity: .75; }
.brand-link:focus-visible { outline: 2px solid var(--accent); outline-offset: 3px; }
.brand i { width: 9px; height: 9px; border-radius: 50%; background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); animation: rec 2.4s ease-in-out infinite; }
@keyframes rec { 50% { box-shadow: 0 0 0 5px transparent; } }
.topbar {
  display: flex; align-items: center; gap: 14px; height: 52px; padding: 0 16px;
  border-bottom: 1px solid var(--line); background: var(--bg); position: relative; z-index: 5;
}
.topbar .spacer { flex: 1; }
.crumb { display: flex; align-items: baseline; gap: 10px; min-width: 0; }
.crumb .t { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.crumb .c { color: var(--muted); font-size: 13px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ---------- Modales / toast ---------- */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 16px; background: var(--scrim-modal); backdrop-filter: blur(6px); animation: fade .18s var(--ease); }
@keyframes fade { from { opacity: 0; } }
.modal-card { width: min(420px, 100%); background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 10px; padding: 26px; box-shadow: var(--shadow-modal); }
.modal-card h2 { margin: 0 0 6px; font-size: 20px; letter-spacing: -.01em; }
.modal-card p { margin: 0 0 18px; color: var(--muted); }
.modal-card .row { display: flex; gap: 8px; margin-top: 16px; justify-content: flex-end; }

.toast { position: fixed; left: 50%; bottom: 24px; transform: translate(-50%, 20px); opacity: 0; pointer-events: none; z-index: 80;
  background: var(--text); color: var(--bg); padding: 10px 16px; border-radius: 8px; font-size: 13px; font-weight: 500; max-width: calc(100vw - 32px);
  transition: opacity .2s var(--ease), transform .2s var(--ease); }
.toast.show { opacity: 1; transform: translate(-50%, 0); }
.toast.err { background: var(--accent); color: var(--on-accent); }

.state { display: grid; place-items: center; text-align: center; padding: 64px 20px; color: var(--muted); }
.state b { display: block; color: var(--text); font-size: 16px; margin-bottom: 6px; }
.spinner { width: 22px; height: 22px; border: 2px solid var(--line-2); border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite; margin: 0 auto 14px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* =====================================================
   REVIEW
   ===================================================== */
body.review { height: 100dvh; display: flex; flex-direction: column; overflow: hidden; }
.layout { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 400px; }
.player-col { min-width: 0; min-height: 0; display: flex; flex-direction: column; background: #000; }
.player { display: flex; flex-direction: column; min-height: 0; flex: 1; background: #000; }
.stage { position: relative; flex: 1; min-height: 0; background: #000; overflow: hidden; user-select: none; -webkit-user-select: none; }
.stage video { position: absolute; inset: 0; width: 100%; height: 100%; object-fit: contain; background: #000; }
.stage canvas { position: absolute; pointer-events: none; touch-action: none; }
.stage canvas.drawing { pointer-events: auto; cursor: crosshair; outline: 1px dashed rgba(255,74,43,.45); }
.stage-msg { position: absolute; inset: 0; display: grid; place-items: center; text-align: center; color: #8d8d97; padding: 20px; pointer-events: none; }
.big-play { position: absolute; left: 50%; top: 50%; width: 68px; height: 68px; margin: -34px 0 0 -34px; border-radius: 50%; border: 1px solid rgba(255,255,255,.3);
  background: rgba(10,10,11,.55); backdrop-filter: blur(4px); display: grid; place-items: center; cursor: pointer; color: #fff; opacity: 0; pointer-events: none; transition: opacity .2s; }
.big-play svg { width: 26px; height: 26px; fill: currentColor; margin-left: 3px; }
.stage.paused:not(.drawing-on) .big-play.ready { opacity: 1; pointer-events: auto; }
.draw-badge { position: absolute; top: 10px; left: 10px; font: 500 11px/1 var(--mono); letter-spacing: .08em; text-transform: uppercase; color: #ff4a2b; background: rgba(0,0,0,.6); border: 1px solid rgba(255,74,43,.45); padding: 6px 8px; border-radius: 4px; pointer-events: none; }

/* Timeline */
.tl { position: relative; height: 46px; background: var(--bg-1); border-top: 1px solid var(--line); cursor: pointer; touch-action: none; user-select: none; -webkit-user-select: none; }
.tl-inner { position: absolute; left: 10px; right: 10px; top: 0; bottom: 0; }
.tl-track { position: absolute; left: 0; right: 0; top: 50%; height: 6px; margin-top: -2px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.tl-progress { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--line-2); }
.tl-ranges { position: absolute; left: 0; right: 0; top: 0; bottom: 0; pointer-events: none; }
.rng { position: absolute; top: 50%; height: 6px; margin-top: -2px; background: var(--accent); opacity: .55; border-radius: 1px; min-width: 2px; pointer-events: none; }
.rng.resolved { background: var(--ok); opacity: .4; }
.rng.sel { opacity: 1; }
.rng.draft { background: var(--info); opacity: .6; }
.tl-markers { position: absolute; inset: 0; pointer-events: none; }
.mk { position: absolute; top: 0; bottom: 0; width: 18px; margin-left: -9px; padding: 0; border: 0; background: none; cursor: pointer; pointer-events: auto; z-index: 2; }
.mk::before { content: ''; position: absolute; left: 50%; top: 9px; bottom: 6px; width: 2px; margin-left: -1px; background: var(--accent); }
.mk::after { content: ''; position: absolute; left: 50%; top: 4px; width: 9px; height: 8px; margin-left: -4.5px; background: var(--accent); clip-path: polygon(0 0, 100% 0, 50% 100%); transition: transform .15s var(--ease); }
.mk.resolved::before, .mk.resolved::after { background: var(--ok); opacity: .65; }
.mk.sel::before, .mk.sel::after { background: var(--text); opacity: 1; }
.mk:hover::after { transform: scale(1.35); }
.tl-head { position: absolute; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: var(--text); pointer-events: none; z-index: 3; left: 0; }
.tl-head::before { content: ''; position: absolute; top: 0; left: 50%; width: 11px; height: 8px; margin-left: -5.5px; background: var(--text); clip-path: polygon(0 0, 100% 0, 50% 100%); }

/* Contrôles */
.controls { display: flex; align-items: center; gap: 2px; padding: 4px 8px; background: var(--bg-1); border-top: 1px solid var(--line); flex-wrap: wrap; }
.controls .sep { width: 1px; height: 20px; background: var(--line); margin: 0 6px; }
.controls .grow { flex: 1; }
.tc-display { display: flex; flex-direction: column; align-items: flex-start; padding: 0 10px; line-height: 1.15; min-width: 118px; }
.tc-display .tc { font: 500 17px/1.1 var(--mono); letter-spacing: .02em; font-variant-numeric: tabular-nums; }
.tc-display .fr { font: 400 10.5px/1.3 var(--mono); color: var(--muted); letter-spacing: .06em; font-variant-numeric: tabular-nums; }
.speed { width: auto; min-height: 32px; padding: 0 22px 0 8px; font: 500 12px var(--mono); background-color: transparent; border-color: transparent; }
.speed:hover { background-color: var(--bg-3); }
.vol { width: 70px; accent-color: var(--accent); height: 28px; }
.dur-text { font: 400 11px var(--mono); color: var(--muted); padding: 0 8px; }

/* Sidebar */
.side { min-width: 0; min-height: 0; display: flex; flex-direction: column; border-left: 1px solid var(--line); background: var(--bg); }
.composer { padding: 14px; border-bottom: 1px solid var(--line); background: var(--bg-1); position: relative; }
.composer.dragover { outline: 2px dashed var(--accent); outline-offset: -6px; }
.composer textarea { width: 100%; min-height: 76px; max-height: 220px; resize: vertical; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); line-height: 1.45; font-size: 14px; }
.composer textarea:focus { outline: none; border-color: var(--accent); }
.c-row { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.check { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 13px; min-height: 32px; }
.check input { accent-color: var(--accent); width: 16px; height: 16px; margin: 0; cursor: pointer; }
.tc-chip { font: 500 12px var(--mono); color: var(--accent); font-variant-numeric: tabular-nums; }
.range-chip { display: inline-flex; align-items: center; gap: 6px; font: 500 11.5px var(--mono); color: var(--info); background: var(--info-soft); border: 1px solid var(--info-line); padding: 3px 4px 3px 8px; border-radius: 4px; }
.range-chip button { background: none; border: 0; color: inherit; cursor: pointer; width: 20px; height: 20px; padding: 0; opacity: .8; font-size: 15px; line-height: 1; }
.tools { display: flex; align-items: center; gap: 6px; flex-wrap: wrap; margin-top: 10px; padding: 8px; border: 1px dashed var(--line-2); border-radius: var(--r); }
.swatch { width: 26px; height: 26px; border-radius: 50%; border: 2px solid transparent; cursor: pointer; padding: 0; box-shadow: inset 0 0 0 1px var(--swatch-ring); }
.swatch.on { border-color: var(--text); }
.atts { display: flex; gap: 8px; flex-wrap: wrap; margin-top: 10px; }
.att { position: relative; width: 62px; height: 62px; border-radius: 6px; overflow: hidden; background: var(--bg-3); border: 1px solid var(--line-2); display: grid; place-items: center; font: 500 10px var(--mono); color: var(--muted); text-transform: uppercase; }
.att img { width: 100%; height: 100%; object-fit: cover; }
.att .x { position: absolute; top: 2px; right: 2px; width: 22px; height: 22px; border-radius: 50%; border: 0; background: rgba(0,0,0,.75); color: #fff; cursor: pointer; font-size: 14px; line-height: 1; padding: 0; }
.att .bar { position: absolute; left: 0; right: 0; bottom: 0; height: 4px; background: rgba(0,0,0,.6); }
.att .bar i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .15s linear; }
.att.fail { border-color: var(--accent); }
.send-row { display: flex; align-items: center; gap: 8px; margin-top: 12px; }
.send-row .hint { flex: 1; font: 400 11px var(--mono); color: var(--dim); }
.as-line { font: 400 12px var(--mono); color: var(--muted); }

.filters { display: flex; gap: 4px; padding: 10px 14px; border-bottom: 1px solid var(--line); }
.filters button { flex: 1; min-height: 34px; background: transparent; border: 1px solid transparent; border-radius: var(--r); color: var(--muted); font-size: 13px; cursor: pointer; transition: all .15s var(--ease); }
.filters button:hover { color: var(--text); }
.filters button.on { background: var(--bg-3); border-color: var(--line-2); color: var(--text); }
.filters .n { font: 500 11px var(--mono); margin-left: 4px; color: var(--dim); }
.filters button.on .n { color: var(--accent); }

.clist { flex: 1; min-height: 0; overflow-y: auto; padding: 0 0 24px; overscroll-behavior: contain; }
.empty-list { padding: 40px 20px; text-align: center; color: var(--dim); font-size: 13px; }

.cm { position: relative; padding: 12px 14px 12px 16px; border-bottom: 1px solid var(--line); cursor: default; transition: background .15s var(--ease); }
.cm.has-frame { cursor: pointer; }
.cm:hover { background: var(--bg-1); }
.cm::before { content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 2px; background: transparent; transition: background .15s; }
.cm.sel { background: var(--bg-1); }
.cm.sel::before { background: var(--accent); }
.cm.resolved .cm-body, .cm.resolved .cm-atts { opacity: .5; }
.cm-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.tc-btn { font: 500 12px var(--mono); font-variant-numeric: tabular-nums; color: var(--accent); background: var(--accent-soft); border: 1px solid var(--accent-line); border-radius: 4px; padding: 3px 7px; cursor: pointer; min-height: 24px; }
.cm.resolved .tc-btn { color: var(--ok); background: var(--ok-soft); border-color: var(--ok-line); }
.tc-btn:hover { filter: brightness(1.25); }
:root[data-theme="light"] .tc-btn:hover { filter: brightness(.88); }
.gen-tag { font: 500 11px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--dim); }
.cm-author { font-weight: 600; font-size: 13px; }
.cm-author.admin::after { content: 'AUTEUR'; margin-left: 6px; font: 500 9.5px var(--mono); letter-spacing: .08em; color: var(--accent); border: 1px solid var(--accent-line); padding: 1px 4px; border-radius: 3px; vertical-align: 1px; }
.cm-time { font-size: 12px; color: var(--dim); }
.cm-res { margin-left: auto; font-size: 12px; color: var(--muted); }
.cm-body { margin: 7px 0 0; white-space: pre-wrap; overflow-wrap: anywhere; font-size: 14px; }
.cm-atts { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 8px; }
.thumb { width: 72px; height: 54px; border-radius: 5px; overflow: hidden; border: 1px solid var(--line-2); background: var(--bg-3); display: grid; place-items: center; cursor: pointer; padding: 0; font: 500 10px var(--mono); color: var(--muted); text-transform: uppercase; text-decoration: none; }
.thumb img { width: 100%; height: 100%; object-fit: cover; }
.thumb:hover { border-color: var(--accent); }
.cm-actions { display: flex; gap: 2px; margin-top: 6px; margin-left: -8px; }
.cm-actions button { background: none; border: 0; color: var(--muted); font-size: 12px; cursor: pointer; padding: 6px 8px; min-height: 30px; border-radius: 4px; }
.cm-actions button:hover { color: var(--text); background: var(--bg-3); }
.cm-actions button.del:hover { color: var(--accent); }
.replies { margin: 8px 0 0 6px; padding-left: 12px; border-left: 1px solid var(--line-2); }
.reply { padding: 8px 0; }
.reply + .reply { border-top: 1px solid var(--line); }
.inline-form textarea { width: 100%; min-height: 60px; padding: 8px 10px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); resize: vertical; }
.inline-form textarea:focus { outline: none; border-color: var(--accent); }
.inline-form .row { display: flex; gap: 6px; justify-content: flex-end; margin-top: 6px; }

.lightbox { position: fixed; inset: 0; z-index: 70; background: rgba(0,0,0,.92); display: grid; place-items: center; padding: 20px; cursor: zoom-out; animation: fade .15s; }
.lightbox img { max-width: 100%; max-height: 100%; object-fit: contain; border-radius: 4px; }
.lightbox .close { position: absolute; top: 12px; right: 12px; color: #fff; }
.lightbox .close:hover { background: rgba(255,255,255,.14); }

.drop-hint { position: fixed; inset: 0; z-index: 60; display: none; place-items: center; background: var(--bg-veil); border: 2px dashed var(--accent); margin: 10px; border-radius: 12px; font: 500 14px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--accent); pointer-events: none; }
body.dragging .drop-hint { display: grid; }

.player:fullscreen { background: #000; }
.player:fullscreen .stage { flex: 1; }

/* ---------- V2 : validation ---------- */
.ap-pill { display: inline-block; font: 500 11px/1 var(--mono); padding: 6px 10px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); white-space: nowrap; }
.ap-pill.changes { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.ap-pill.approved { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.apbar { display: flex; align-items: center; gap: 8px 12px; flex-wrap: wrap; padding: 10px 14px; border-bottom: 1px solid var(--line); background: var(--bg); }
.ap-info { flex: 1 1 140px; min-width: 0; font: 400 11.5px var(--mono); color: var(--muted); }
.ap-btns { display: flex; gap: 6px; flex-wrap: wrap; }

/* ---------- V2 : suivi des versions précédentes ---------- */
.carry { border-bottom: 1px solid var(--line); background: var(--bg-1); }
.carry-head { display: flex; align-items: center; gap: 8px; width: 100%; min-height: var(--tap); padding: 0 14px; background: none; border: 0; color: var(--warn); font: 500 12.5px var(--font); text-align: left; cursor: pointer; }
.carry-head:hover { background: var(--bg-2); }
.carry-caret { font-size: 11px; width: 10px; }
.carry-list { max-height: 260px; overflow-y: auto; border-top: 1px solid var(--line); }
.carry-item { padding: 10px 14px; border-bottom: 1px solid var(--line); }
.carry-item:last-child { border-bottom: 0; }
.carry-meta { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.carry-v { font: 600 11px var(--mono); color: var(--muted); border: 1px solid var(--line-2); border-radius: 3px; padding: 1px 5px; }
.carry-actions { display: flex; align-items: center; gap: 12px; margin-top: 4px; flex-wrap: wrap; }
.link-btn { background: none; border: 0; padding: 6px 0; min-height: 32px; color: var(--info); font-size: 12px; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.link-btn:hover { color: var(--text); }

/* ---------- V2 : commentaires enrichis ---------- */
.cm-row { display: flex; gap: 10px; align-items: flex-start; }
.cm-main { flex: 1; min-width: 0; }
.cm-frame { flex: none; width: 88px; height: 50px; margin-top: 2px; padding: 0; overflow: hidden; border-radius: 5px; border: 1px solid var(--line-2); background: var(--bg-3); cursor: pointer; }
.cm-frame img { width: 100%; height: 100%; object-fit: cover; display: block; }
.cm-frame:hover { border-color: var(--accent); }
.src-tag { font: 500 9.5px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--info); border: 1px solid var(--info-line); padding: 1px 5px; border-radius: 3px; }
.src-tag.ai { color: var(--violet); border-color: var(--violet-line); }
.cm-voices { margin-top: 8px; }
.cm-voice { display: flex; align-items: center; gap: 8px; }
.cm-voice audio, .voice-panel audio { flex: 1; min-width: 0; max-width: 300px; height: 36px; }
.cm-dur { font: 400 11px var(--mono); color: var(--muted); }
.cm-transcript { margin: 6px 0 0; font-style: italic; color: var(--muted); font-size: 13.5px; white-space: pre-wrap; overflow-wrap: anywhere; }
.cm.resolved .cm-transcript, .cm.resolved .cm-voices { opacity: .5; }

/* ---------- V2 : vocal ---------- */
.rec-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-top: 10px; padding: 10px; border: 1px solid var(--accent-line); background: var(--accent-soft); border-radius: var(--r); }
.rec-dot { width: 10px; height: 10px; border-radius: 50%; background: var(--accent); animation: rec 1.2s ease-in-out infinite; flex: none; }
.rec-time { font: 500 13px var(--mono); font-variant-numeric: tabular-nums; min-width: 84px; }
.rec-meter { flex: 1; min-width: 60px; height: 8px; background: var(--track); border-radius: 4px; overflow: hidden; }
.rec-meter i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .08s linear; }
.rec-live { flex-basis: 100%; font-style: italic; color: var(--muted); font-size: 13px; min-height: 18px; overflow-wrap: anywhere; }
.voice-panel { margin-top: 10px; padding: 10px; border: 1px solid var(--line-2); border-radius: var(--r); background: var(--bg); }
.vp-head { display: flex; align-items: center; gap: 8px; margin-bottom: 10px; }
.voice-panel label.lbl { margin-bottom: 6px; }
.composer .voice-panel textarea { min-height: 52px; font-style: italic; }
.voice-panel .hint { font: 400 11px var(--mono); color: var(--dim); margin-top: 6px; }

/* ---------- V2 : boucle + comparaison ---------- */
.loop-badge { left: auto; right: 10px; color: #5b9dff; border-color: rgba(91,157,255,.5); }
.cmp-bar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; padding: 6px 10px; background: var(--bg-2); border-top: 1px solid var(--line); }
.cmp-bar select.field { width: auto; min-width: 120px; min-height: 34px; padding-top: 4px; padding-bottom: 4px; }
.seg { display: inline-flex; border: 1px solid var(--line-2); border-radius: var(--r); overflow: hidden; }
.seg button { min-height: 34px; padding: 0 12px; background: transparent; border: 0; color: var(--muted); font-size: 12.5px; cursor: pointer; }
.seg button + button { border-left: 1px solid var(--line-2); }
.seg button.on { background: var(--accent-soft); color: var(--accent); }
.cmp-bar .btn { margin-left: auto; }
.stage.cmp canvas { display: none; }
.stage.cmp-side #video { width: 50%; }
.stage.cmp-side #video2 { left: 50%; width: 50%; }
.stage.cmp-wipe #video2 { clip-path: inset(0 0 0 var(--wipe, 50%)); }
.stage.cmp .big-play { display: none; }
.cmp-tag { position: absolute; top: 8px; z-index: 4; font: 600 11px/1 var(--mono); letter-spacing: .06em; color: #fff; background: rgba(0,0,0,.65); border: 1px solid rgba(255,255,255,.25); padding: 5px 7px; border-radius: 4px; pointer-events: none; }
.cmp-tag-a { left: 8px; }
.stage.cmp-side .cmp-tag-b { left: calc(50% + 8px); }
.stage.cmp-wipe .cmp-tag-b { right: 8px; }
.cmp-div { position: absolute; top: 0; bottom: 0; left: var(--wipe, 50%); width: 44px; margin-left: -22px; z-index: 5; cursor: ew-resize; touch-action: none; }
.cmp-div::before { content: ''; position: absolute; left: 50%; top: 0; bottom: 0; width: 2px; margin-left: -1px; background: #fff; box-shadow: 0 0 0 1px rgba(0,0,0,.4); }
.cmp-div span { position: absolute; left: 50%; top: 50%; width: 30px; height: 30px; margin: -15px 0 0 -15px; border-radius: 50%; background: #fff; box-shadow: 0 2px 8px rgba(0,0,0,.5); }
.cmp-div span::before, .cmp-div span::after { content: ''; position: absolute; top: 50%; margin-top: -4px; border: 4px solid transparent; }
.cmp-div span::before { left: 3px; border-right-color: #111; }
.cmp-div span::after { right: 3px; border-left-color: #111; }
.cmp-div:focus-visible { outline: none; }
.cmp-div:focus-visible span { outline: 2px solid var(--accent); outline-offset: 2px; }

/* Mobile : lecteur en haut (collant), commentaires dessous */
@media (max-width: 899px) {
  body.review { height: auto; min-height: 100dvh; overflow: visible; display: block; }
  .layout { display: block; }
  .player-col { position: sticky; top: 0; z-index: 10; }
  .player { flex: none; }
  .stage { flex: none; aspect-ratio: 16 / 9; max-height: 44dvh; width: 100%; }
  .side { border-left: 0; }
  .clist { overflow: visible; }
  .topbar { padding: 0 12px; gap: 10px; height: 48px; }
  .crumb .c { display: none; }
  .controls { padding: 2px 4px; }
  .controls .vol, .controls .hide-m { display: none; }
  .tc-display { min-width: 0; padding: 0 6px; }
  .btn, .filters button { min-height: var(--tap); }
  .btn.sm { min-height: 36px; }
  .check { min-height: var(--tap); }
  .cm-actions button { min-height: var(--tap); padding: 0 12px; }
  .tc-btn { min-height: 34px; padding: 0 10px; }
  .swatch { width: 34px; height: 34px; }
  .composer textarea { font-size: 16px; }
  .field, .inline-form textarea { font-size: 16px; }
  .stage.cmp-side { aspect-ratio: 16 / 18; max-height: 62dvh; }
  .stage.cmp-side #video { width: 100%; height: 50%; }
  .stage.cmp-side #video2 { left: 0; top: 50%; width: 100%; height: 50%; }
  .stage.cmp-side .cmp-tag-b { left: 8px; top: calc(50% + 8px); }
  .cmp-bar select.field { font-size: 16px; min-height: var(--tap); }
  .seg button { min-height: var(--tap); }
  .apbar { padding: 10px 12px; }
  .ap-pill { padding: 5px 8px; font-size: 10.5px; }
  .cm-frame { width: 72px; height: 41px; }
  .link-btn { min-height: var(--tap); }
  .cm-voice audio, .voice-panel audio { height: 40px; }
}
@media (max-height: 520px) and (orientation: landscape) and (max-width: 899px) {
  .stage { max-height: 60dvh; }
}

/* =====================================================
   ADMIN
   ===================================================== */
body.admin-body { min-height: 100dvh; }
.wrap { max-width: 1040px; margin: 0 auto; padding: 32px 20px 80px; }
.login { min-height: calc(100dvh - 52px); display: grid; place-items: center; padding: 20px; }
.login-card { width: min(380px, 100%); }
.login-card h1 { font-size: 28px; letter-spacing: -.02em; margin: 0 0 6px; }
.login-card p { color: var(--muted); margin: 0 0 24px; }
.page-head { display: flex; align-items: flex-end; justify-content: space-between; gap: 16px; margin-bottom: 24px; flex-wrap: wrap; }
.page-head h1 { margin: 6px 0 0; font-size: 28px; letter-spacing: -.02em; line-height: 1.15; }
.page-head .sub { color: var(--muted); margin-top: 4px; }
.back { font: 500 12px var(--mono); letter-spacing: .06em; text-transform: uppercase; color: var(--muted); text-decoration: none; }
.back:hover { color: var(--text); }

.plist { border: 1px solid var(--line); border-radius: 8px; overflow: hidden; }
.prow { display: grid; grid-template-columns: minmax(0, 1fr) 100px 120px 24px; align-items: center; gap: 12px; padding: 16px 18px; border-bottom: 1px solid var(--line); text-decoration: none; transition: background .15s var(--ease); }
.prow:last-child { border-bottom: 0; }
.prow:hover { background: var(--bg-1); }
.prow .nm { font-weight: 600; font-size: 15px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.prow .cl { color: var(--muted); font-size: 13px; }
.prow .stat { font: 400 12px var(--mono); color: var(--muted); }
.prow .arrow { color: var(--dim); transition: transform .15s var(--ease), color .15s; }
.prow:hover .arrow { transform: translateX(3px); color: var(--accent); }
.prow.archived { opacity: .5; }
.pill { display: inline-block; font: 500 11px var(--mono); padding: 3px 8px; border-radius: 99px; border: 1px solid var(--line-2); color: var(--muted); }
.pill.open { color: var(--accent); border-color: var(--accent-line); background: var(--accent-soft); }
.pill.ok { color: var(--ok); border-color: var(--ok-line); }

.panel { border: 1px solid var(--line); border-radius: 8px; background: var(--bg-1); padding: 18px; margin-bottom: 20px; }
.panel h2 { margin: 0 0 14px; font: 500 11px/1 var(--mono); letter-spacing: .1em; text-transform: uppercase; color: var(--muted); }
.share { display: flex; gap: 8px; flex-wrap: wrap; }
.share input { flex: 1; min-width: 200px; font: 400 13px var(--mono); }
.grid2 { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.grid3 { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; }

.vrow { display: grid; grid-template-columns: 54px minmax(0, 1fr) auto; gap: 14px; align-items: center; padding: 14px 0; border-bottom: 1px solid var(--line); }
.vrow:last-child { border-bottom: 0; padding-bottom: 0; }
.vrow:first-of-type { padding-top: 0; }
.vnum { font: 600 20px var(--mono); }
.vmeta { font: 400 12px var(--mono); color: var(--muted); margin-top: 3px; }
.vlabel { font-weight: 500; }
.vnotes { color: var(--muted); font-size: 13px; margin-top: 3px; white-space: pre-wrap; overflow-wrap: anywhere; }
.vactions { display: flex; gap: 6px; flex-wrap: wrap; justify-content: flex-end; align-items: center; }

.drop { border: 1px dashed var(--line-2); border-radius: 8px; padding: 30px 16px; text-align: center; color: var(--muted); cursor: pointer; transition: all .15s var(--ease); }
.drop:hover, .drop.over { border-color: var(--accent); color: var(--text); background: var(--accent-soft); }
.drop b { display: block; color: var(--text); margin-bottom: 4px; }
.file-line { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; font: 400 13px var(--mono); }
.file-line .nm { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.up-total { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; margin: 14px 0 10px; }
.up-total i { display: block; height: 100%; width: 0; background: var(--accent); transition: width .2s linear; }
.parts { display: grid; grid-template-columns: repeat(auto-fill, minmax(34px, 1fr)); gap: 4px; }
.part { height: 18px; background: var(--bg-3); border-radius: 2px; overflow: hidden; position: relative; }
.part i { position: absolute; left: 0; top: 0; bottom: 0; width: 0; background: var(--accent); }
.part.done i { background: var(--ok); }
.up-status { font: 400 12px var(--mono); color: var(--muted); display: flex; justify-content: space-between; gap: 10px; margin-top: 10px; flex-wrap: wrap; }

@media (max-width: 640px) {
  .wrap { padding: 20px 16px 60px; }
  .prow { grid-template-columns: minmax(0, 1fr) 24px; }
  .prow .stat { grid-column: 1; }
  .prow .arrow { grid-row: 1; grid-column: 2; }
  .grid2, .grid3 { grid-template-columns: 1fr; }
  .vrow { grid-template-columns: 44px minmax(0, 1fr); }
  .vactions { grid-column: 1 / -1; justify-content: flex-start; }
  .page-head h1 { font-size: 24px; }
  .btn { min-height: var(--tap); }
  .btn.sm { min-height: 36px; }
  .field, select.field { font-size: 16px; min-height: 44px; }
}

/* ---------- V2 admin : validation, activité, IA ---------- */
.pill.warn { color: var(--warn); border-color: var(--warn-line); background: var(--warn-soft); }
.pill.ap-ok { color: var(--ok); border-color: var(--ok-line); background: var(--ok-soft); }
.activity { max-height: 360px; overflow-y: auto; margin: 0 -18px -18px; border-top: 1px solid var(--line); }
.act { display: grid; grid-template-columns: 8px minmax(0, 1fr) auto; gap: 12px; align-items: start; padding: 12px 18px; border-bottom: 1px solid var(--line); text-decoration: none; transition: background .15s var(--ease); }
.act:last-child { border-bottom: 0; }
.act:hover { background: var(--bg-2); }
.act .dot { width: 8px; height: 8px; margin-top: 7px; border-radius: 50%; background: transparent; }
.act.new .dot { background: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
.act.new { background: var(--accent-faint); }
.act .who { font-weight: 600; }
.act .where { color: var(--muted); font: 400 12px var(--mono); }
.act .ex { color: var(--muted); font-size: 13px; margin-top: 2px; overflow-wrap: anywhere; }
.act .when { color: var(--dim); font-size: 12px; white-space: nowrap; }
.act .tags { display: inline-flex; gap: 6px; margin-left: 6px; }
.panel h2 .new-count { color: var(--accent); margin-left: 8px; }
.codebox { display: flex; gap: 8px; align-items: stretch; margin-bottom: 12px; }
.codebox code { flex: 1; min-width: 0; display: block; padding: 10px 12px; background: var(--bg); border: 1px solid var(--line-2); border-radius: var(--r); font: 400 12.5px/1.5 var(--mono); overflow-x: auto; white-space: pre; }
.codebox .btn { align-self: flex-start; }
@media (max-width: 640px) {
  .act { grid-template-columns: 8px minmax(0, 1fr); }
  .act .when { grid-column: 2; }
  .codebox { flex-direction: column; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { animation: none !important; transition: none !important; }
}

/* ---- link security (admin) */
.lk-badges { display: flex; gap: 6px; flex-wrap: wrap; margin-top: 6px; }
.sec-row { display: grid; grid-template-columns: 110px 1fr auto; gap: 12px; align-items: center; padding: 12px 0; border-top: 1px solid var(--line); margin-top: 12px; font-size: 13px; }
.sec-lbl { font: 500 11px var(--mono); letter-spacing: .08em; text-transform: uppercase; color: var(--muted); }
.sec-act { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; justify-content: flex-end; }
.sec-act .field { width: auto; min-height: 34px; padding-top: 4px; padding-bottom: 4px; }
.quota { height: 6px; background: var(--bg-3); border-radius: 3px; overflow: hidden; }
.quota i { display: block; height: 100%; background: var(--ok); }
.quota i.hot { background: var(--warn); }
@media (max-width: 640px) { .sec-row { grid-template-columns: 1fr; gap: 8px; } .sec-act { justify-content: flex-start; } }

/* ---- review: password / expired screens */
.gate { width: min(360px, 100%); margin: 0 auto; text-align: left; }
.gate h1 { font-size: 22px; letter-spacing: -.02em; margin: 0 0 6px; color: var(--text); }
.gate p { margin: 0 0 18px; }
.exp-note { color: var(--muted); font: 400 11px var(--mono); margin-left: 10px; }

/* Téléphone : l'en-tête passe sur deux lignes (projet + prénom, puis version / validation / comparer). */
@media (max-width: 640px) {
  .topbar { flex-wrap: wrap; height: auto; min-height: 48px; padding: 8px 12px; row-gap: 8px; }
  .topbar .spacer { display: none; }
  .topbar .crumb { flex: 1 1 0; min-width: 0; }
  #whoBtn { order: 2; margin-left: auto; max-width: 30vw; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
  #versionSelect { order: 5; flex: 1 0 60%; min-width: 0; max-width: none !important; } /* 60 % : passe seul sur la 2e ligne */
  #apPill { display: none !important; } /* l'état est déjà affiché dans la barre de validation */
  #btnCompare { order: 7; }
  #themeBtn { order: 3; width: 36px; height: 36px; }
}

/* ---------- Apparence : menu + contrôle segmenté ---------- */
.theme-menu { position: fixed; z-index: 95; min-width: 168px; padding: 5px; background: var(--bg-1); border: 1px solid var(--line-2); border-radius: 10px; box-shadow: var(--shadow-pop); animation: fade .12s var(--ease); }
.theme-item { display: flex; align-items: center; gap: 10px; width: 100%; min-height: 36px; padding: 0 10px; background: none; border: 0; border-radius: 6px; font-size: 13px; text-align: left; cursor: pointer; color: var(--text); }
.theme-item span { flex: 1; }
.theme-item svg, .theme-seg button svg { flex: none; fill: none; stroke: currentColor; stroke-width: 1.8; stroke-linecap: round; stroke-linejoin: round; }
.theme-item svg { color: var(--muted); }
.theme-item:hover, .theme-item:focus-visible { background: var(--bg-3); outline: none; }
.theme-item.on { color: var(--accent); }
.theme-item.on svg { color: var(--accent); }
.theme-seg button { display: inline-flex; align-items: center; gap: 7px; }
.theme-seg button.on svg { color: var(--accent); }

/* Changement de thème en douceur (classe posée ~200 ms par theme.js, jamais au chargement). */
@media (prefers-reduced-motion: no-preference) {
  html.theme-anim, html.theme-anim *, html.theme-anim *::before, html.theme-anim *::after {
    transition: background-color .15s ease, color .15s ease, border-color .15s ease, fill .15s ease, stroke .15s ease !important;
  }
}
