:root {
  --bg: #0a0a0b;
  --panel: #131315;
  --panel-2: #1a1a1d;
  --hover: #222226;
  --line: #26262a;
  --line-2: #34343a;
  --text: #f4f4f5;
  --muted: #9a9aa1;
  --muted-2: #66666d;
  --danger: #ff6b61;
  --radius: 12px;
  --font: -apple-system, BlinkMacSystemFont, "SF Pro Text", "Inter", system-ui, "Segoe UI", Roboto, sans-serif;
  color-scheme: dark;
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: var(--font);
  font-size: 14px;
  line-height: 1.45;
  -webkit-font-smoothing: antialiased;
}
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; }
input { font: inherit; }
[hidden] { display: none !important; }

.wordmark {
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.22em;
  text-transform: uppercase;
}
.muted { color: var(--muted); }

/* Boutons */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  height: 34px; padding: 0 14px;
  border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--panel-2); color: var(--text);
  font-size: 13px; font-weight: 500; cursor: pointer;
  white-space: nowrap;
  transition: background .15s, border-color .15s, opacity .15s;
}
.btn:hover { background: var(--hover); border-color: #44444b; }
.btn:disabled { opacity: .45; cursor: default; }
.btn.primary { background: var(--text); color: #0a0a0b; border-color: var(--text); }
.btn.primary:hover { background: #dcdcdf; }
.btn.ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn.ghost:hover { background: var(--hover); color: var(--text); }
.btn.danger { color: var(--danger); }
.btn.icon { width: 34px; padding: 0; justify-content: center; }
.btn svg { width: 16px; height: 16px; flex: none; }

/* Fil d'Ariane */
.crumbs { display: flex; align-items: center; flex-wrap: wrap; gap: 4px; font-size: 13px; color: var(--muted); }
.crumbs a { padding: 3px 6px; border-radius: 6px; }
.crumbs a:hover { background: var(--hover); color: var(--text); }
.crumbs .sep { color: var(--muted-2); }
.crumbs .current { color: var(--text); padding: 3px 6px; }

/* Lecteur (modale) */
.viewer {
  position: fixed; inset: 0; z-index: 50;
  background: rgba(0,0,0,.92);
  display: flex; flex-direction: column;
  animation: fade .15s ease;
}
@keyframes fade { from { opacity: 0; } to { opacity: 1; } }
.viewer-top {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 14px 18px;
}
.viewer-title { min-width: 0; }
.viewer-title .name { font-weight: 600; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.viewer-title .meta { color: var(--muted); font-size: 12px; }
.viewer-actions { display: flex; gap: 8px; flex: none; }
.viewer-stage {
  flex: 1; min-height: 0;
  display: flex; align-items: center; justify-content: center;
  padding: 0 16px 20px; position: relative;
}
.viewer-stage video, .viewer-stage img {
  max-width: 100%; max-height: 100%;
  border-radius: 8px; background: #000;
  outline: none;
}
.viewer-msg {
  max-width: 420px; text-align: center; color: var(--muted);
  border: 1px solid var(--line); border-radius: var(--radius);
  padding: 28px; background: var(--panel);
}
.viewer-msg strong { display: block; color: var(--text); margin-bottom: 6px; }
.viewer-nav {
  position: absolute; top: 50%; transform: translateY(-50%);
  width: 40px; height: 40px; border-radius: 50%;
  border: 1px solid var(--line-2); background: rgba(20,20,22,.8);
  display: flex; align-items: center; justify-content: center; cursor: pointer;
}
.viewer-nav:hover { background: var(--hover); }
.viewer-nav.prev { left: 16px; }
.viewer-nav.next { right: 16px; }
.viewer-nav svg { width: 18px; height: 18px; }

/* Lecteur de validation (vidéo + commentaires à la seconde) */
.rvw { background: #060607; }
.rvw .viewer-actions { align-items: center; }
.rvw-body { flex: 1; min-height: 0; display: grid; grid-template-columns: minmax(0, 1fr) 340px; gap: 16px; padding: 0 18px 18px; }
.rvw-main { min-width: 0; min-height: 0; display: flex; flex-direction: column; gap: 10px; }
.rvw-stage { flex: 1; min-height: 0; display: flex; align-items: center; justify-content: center; background: #000; border-radius: 10px; overflow: hidden; }
.rvw-stage video, .rvw-stage img { max-width: 100%; max-height: 100%; display: block; outline: none; }
.rvw-bar { display: flex; align-items: center; gap: 14px; padding: 4px 2px; }
.rvw-tc { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; white-space: nowrap; min-width: 86px; }
.rvw-track { position: relative; flex: 1; height: 22px; cursor: pointer; }
.rvw-track::before { content: ''; position: absolute; left: 0; right: 0; top: 9px; height: 4px; border-radius: 4px; background: var(--line-2); }
.rvw-fill { position: absolute; left: 0; top: 9px; height: 4px; border-radius: 4px; background: #8a8a92; pointer-events: none; }
.rvw-dot {
  position: absolute; top: 4px; width: 14px; height: 14px; margin-left: -7px; padding: 0;
  border-radius: 50%; border: 2px solid #0a0a0b; background: var(--text); cursor: pointer;
  box-shadow: 0 0 0 1px rgba(255,255,255,.35); transition: transform .12s;
}
.rvw-dot:hover { transform: scale(1.3); }
.rvw-dot.done { background: #6a6a72; }
.rvw-tip {
  position: absolute; bottom: 26px; transform: translateX(-50%); max-width: 280px; width: max-content;
  background: var(--text); color: #0a0a0b; font-size: 12px; font-weight: 500; padding: 6px 9px; border-radius: 8px;
  pointer-events: none; white-space: normal; z-index: 2;
}
.rvw-side { min-height: 0; display: flex; flex-direction: column; background: var(--panel); border: 1px solid var(--line); border-radius: 12px; overflow: hidden; }
.rvw-hd { padding: 14px 16px; border-bottom: 1px solid var(--line); font-weight: 600; }
.rvw-list { flex: 1; overflow-y: auto; padding: 6px; }
.rvw-empty { color: var(--muted); font-size: 13px; padding: 14px 10px; }
.rvw-sub { color: var(--muted-2); font-size: 11px; text-transform: uppercase; letter-spacing: .1em; padding: 14px 10px 4px; }
.cmt { display: grid; grid-template-columns: auto 1fr auto; gap: 10px; align-items: start; padding: 10px; border-radius: 9px; cursor: pointer; }
.cmt:hover { background: var(--panel-2); }
.cmt.now { background: var(--hover); }
.cmt .t { font-size: 11px; font-weight: 600; font-variant-numeric: tabular-nums; padding: 2px 7px; border-radius: 6px; background: var(--text); color: #0a0a0b; margin-top: 1px; }
.cmt.general { cursor: default; }
.cmt.general .t { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px #6a6a72; }
.cmt .x { font-size: 13px; white-space: pre-wrap; word-break: break-word; min-width: 0; }
.cmt .by { color: var(--muted); font-size: 11px; margin-top: 3px; }
.cmt.done .x { color: var(--muted); text-decoration: line-through; text-decoration-color: #55555b; }
.cmt.done .t { background: #3a3a40; color: var(--muted); }
.cmt .ops { display: flex; gap: 2px; opacity: 0; transition: opacity .12s; }
.cmt:hover .ops { opacity: 1; }
.btn.icon.sm { width: 26px; height: 26px; }
.btn.icon.sm svg { width: 14px; height: 14px; }
.rvw-add { border-top: 1px solid var(--line); padding: 12px; display: flex; flex-direction: column; gap: 8px; }
.rvw-at { display: flex; align-items: center; gap: 8px; font-size: 11px; }
.rvw-chip { white-space: nowrap; font-size: 12px; font-weight: 600; padding: 2px 8px; border-radius: 6px; background: var(--text); color: #0a0a0b; font-variant-numeric: tabular-nums; }
.rvw-add textarea { width: 100%; resize: none; border-radius: 9px; border: 1px solid var(--line-2); background: var(--bg); color: var(--text); padding: 9px 11px; font: inherit; font-size: 13px; outline: none; }
.rvw-add textarea:focus { border-color: #6a6a72; }
.rvw-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
@media (max-width: 900px) {
  .rvw { overflow-y: auto; }
  .rvw-body { display: flex; flex-direction: column; padding: 0 10px 10px; }
  .rvw-stage { flex: none; height: 52vh; }
  .rvw-side { flex: none; max-height: none; }
  .rvw-list { max-height: 40vh; }
  .rvw .viewer-top { flex-wrap: wrap; padding: 10px 12px; }
  .rvw .viewer-actions { flex-wrap: wrap; }
  .rvw .rv-btn span, .hide-sm { display: none; }
  .cmt .ops { opacity: 1; }
}

/* Petits dialogues */
.dialog-back {
  position: fixed; inset: 0; z-index: 60; background: rgba(0,0,0,.6);
  display: flex; align-items: center; justify-content: center; padding: 16px;
  animation: fade .12s ease;
}
.dialog {
  width: 100%; max-width: 380px;
  background: var(--panel); border: 1px solid var(--line-2);
  border-radius: 14px; padding: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.6);
}
.dialog h3 { margin: 0 0 6px; font-size: 15px; }
.dialog p { margin: 0 0 14px; color: var(--muted); }
.dialog .row { display: flex; justify-content: flex-end; gap: 8px; margin-top: 16px; }

.field {
  width: 100%; height: 38px; padding: 0 12px;
  border-radius: 9px; border: 1px solid var(--line-2);
  background: var(--bg); color: var(--text); outline: none;
}
.field:focus { border-color: #6a6a72; }

/* Notification */
.toast {
  position: fixed; left: 50%; bottom: 24px; transform: translateX(-50%);
  z-index: 70; background: var(--text); color: #0a0a0b;
  padding: 9px 16px; border-radius: 999px; font-size: 13px; font-weight: 500;
  box-shadow: 0 10px 30px rgba(0,0,0,.5);
  animation: fade .15s ease;
}

.spinner {
  width: 18px; height: 18px; border-radius: 50%;
  border: 2px solid var(--line-2); border-top-color: var(--text);
  animation: spin .8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* Validation : Valider / À modifier / Écarter */
.rv { display: inline-flex; gap: 2px; padding: 3px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line); }
.rv-btn {
  display: inline-flex; align-items: center; gap: 6px;
  height: 28px; padding: 0 10px; border: 0; border-radius: 7px;
  background: transparent; color: var(--muted); font-size: 12px; font-weight: 500; cursor: pointer;
  transition: background .12s, color .12s;
}
.rv-btn svg { width: 14px; height: 14px; }
.rv-btn:hover { background: var(--hover); color: var(--text); }
.rv-btn.on.retenu { background: var(--text); color: #0a0a0b; }
.rv-btn.on.modifier { background: #3a3a40; color: var(--text); box-shadow: inset 0 0 0 1px #6a6a72; }
.rv-btn.on.ecarte { background: #26262a; color: #8a8a90; }

.pill {
  display: inline-flex; align-items: center; height: 20px; padding: 0 8px; border-radius: 999px;
  font-size: 11px; font-weight: 600; letter-spacing: .02em; white-space: nowrap;
}
.pill.retenu { background: var(--text); color: #0a0a0b; }
.pill.modifier { background: transparent; color: var(--text); box-shadow: inset 0 0 0 1px #8a8a92; }
.pill.ecarte { background: #26262a; color: #8a8a90; }
.pill.attente { background: transparent; color: var(--muted); box-shadow: inset 0 0 0 1px var(--line-2); }

.note {
  display: flex; gap: 8px; align-items: flex-start;
  padding: 10px 12px; border-radius: 10px; background: var(--panel); border: 1px solid var(--line-2);
  font-size: 13px; color: var(--text); white-space: pre-wrap; word-break: break-word;
}
.note svg { width: 15px; height: 15px; flex: none; margin-top: 2px; color: var(--muted); }
.note .who { color: var(--muted); font-size: 11px; display: block; margin-top: 4px; }
.note.old { color: var(--muted); border-style: dashed; }

.progress { height: 4px; border-radius: 4px; background: var(--line); overflow: hidden; }
.progress > div { height: 100%; background: var(--text); border-radius: 4px; transition: width .3s; }

textarea.field.area { height: auto; padding: 10px 12px; resize: vertical; line-height: 1.45; font: inherit; }

.empty {
  border: 1px dashed var(--line-2); border-radius: var(--radius);
  padding: 48px 24px; text-align: center; color: var(--muted);
}
.empty strong { display: block; color: var(--text); font-weight: 500; margin-bottom: 4px; }
