:root {
  --bg: #0b0f14;
  --bg-elev: #121820;
  --bg-elev-2: #18202a;
  --line: #223040;
  --text: #e6edf5;
  --muted: #8899ab;
  --accent: #29b6f6;
  --accent-soft: rgba(41, 182, 246, 0.12);
  --danger: #ef5350;
  --ok: #66bb6a;
  --radius: 10px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: radial-gradient(1200px 600px at 50% -10%, #16222f 0%, var(--bg) 60%);
  background-attachment: fixed;
  color: var(--text);
  font: 15px/1.5 "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  min-height: 100vh;
}

a {
  color: var(--accent);
}

.wrap {
  max-width: 1180px;
  margin: 0 auto;
  padding: 24px 20px 64px;
}

/* ---------- En-tête ---------- */

header.top {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-bottom: 18px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 24px;
}

.brand {
  font-size: 18px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin: 0;
}

.brand span {
  color: var(--accent);
}

.spacer {
  flex: 1;
}

.me {
  display: flex;
  align-items: center;
  gap: 9px;
  font-size: 14px;
  color: var(--muted);
}

.me img {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 1px solid var(--line);
}

/* ---------- Boutons ---------- */

button {
  font: inherit;
  cursor: pointer;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--text);
  padding: 8px 14px;
  transition: border-color 0.15s, background 0.15s, opacity 0.15s;
}

button:hover:not(:disabled) {
  border-color: var(--accent);
}

button:disabled {
  opacity: 0.5;
  cursor: default;
}

button.ghost {
  background: transparent;
  color: var(--muted);
  padding: 6px 10px;
  font-size: 13px;
}

button.ghost:hover:not(:disabled) {
  color: var(--text);
}

button.danger:hover:not(:disabled) {
  border-color: var(--danger);
  color: var(--danger);
}

/* ---------- Zone d'upload ---------- */

.drop {
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 32px 24px;
  text-align: center;
  transition: border-color 0.15s, background 0.15s;
}

.drop.over {
  border-color: var(--accent);
  background: var(--accent-soft);
}

.drop .hint {
  color: var(--muted);
  font-size: 13px;
  margin-top: 10px;
}

.upload-btn {
  background: var(--accent);
  border-color: var(--accent);
  color: #06131c;
  font-weight: 600;
  padding: 11px 22px;
}

.upload-btn:hover:not(:disabled) {
  filter: brightness(1.1);
}

/* ---------- Progression ---------- */

.progress {
  margin-top: 20px;
  text-align: left;
}

.progress[hidden] {
  display: none;
}

.progress .label {
  display: flex;
  justify-content: space-between;
  font-size: 13px;
  color: var(--muted);
  margin-bottom: 7px;
  gap: 12px;
}

.progress .name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.bar {
  height: 6px;
  border-radius: 99px;
  background: var(--bg-elev-2);
  overflow: hidden;
}

.bar > i {
  display: block;
  height: 100%;
  width: 0%;
  background: var(--accent);
  transition: width 0.2s;
}

/* ---------- Messages ---------- */

.msg {
  margin-top: 16px;
  padding: 10px 14px;
  border-radius: 8px;
  font-size: 14px;
  border: 1px solid var(--line);
}

.msg[hidden] {
  display: none;
}

.msg.error {
  border-color: rgba(239, 83, 80, 0.5);
  color: #ffb4b2;
  background: rgba(239, 83, 80, 0.08);
}

.msg.ok {
  border-color: rgba(102, 187, 106, 0.5);
  color: #b6e3b8;
  background: rgba(102, 187, 106, 0.08);
}

/* ---------- Liste ---------- */

h2.section {
  font-size: 13px;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 36px 0 12px;
  font-weight: 600;
}

.list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
}

.list li {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--line);
}

.list li:last-child {
  border-bottom: none;
}

.list li:hover {
  background: var(--bg-elev-2);
}

.file-icon {
  /* Format 16/9 : une capture d'ecran y est reconnaissable, et les fichiers
     sans miniature gardent la meme empreinte pour ne pas desaligner la liste. */
  width: 120px;
  height: 68px;
  flex: none;
  display: grid;
  place-items: center;
  border-radius: 6px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  font-size: 16px;
}

.file-main {
  min-width: 0;
  flex: 1;
}

.file-meta {
  font-size: 12.5px;
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 7px;
  margin-top: 3px;
  flex-wrap: wrap;
}

.file-meta img {
  width: 16px;
  height: 16px;
  border-radius: 50%;
}

.empty {
  padding: 28px 16px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
}

/* ---------- Page de connexion ---------- */

.login {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 20px;
}

.card {
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 40px 36px;
  max-width: 400px;
  width: 100%;
  text-align: center;
}

.card p {
  color: var(--muted);
  font-size: 14px;
}

.discord-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 8px;
  background: #5865f2;
  border-color: #5865f2;
  color: #fff;
  font-weight: 600;
  padding: 12px 22px;
  text-decoration: none;
  border-radius: 8px;
  border-style: solid;
  border-width: 1px;
}

.discord-btn:hover {
  filter: brightness(1.1);
}

@media (max-width: 560px) {
  .file-actions button span {
    display: none;
  }
}

/* ---------- Zone d'attente avant envoi ---------- */

.stage {
  margin-top: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  background: var(--bg-elev);
  padding: 18px 20px 20px;
}

.stage[hidden] {
  display: none;
}

.stage-head {
  display: flex;
  align-items: center;
  gap: 14px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
}

.stage-thumb {
  width: 120px;
  height: 68px;
  flex: none;
  display: grid;
  place-items: center;
  font-size: 24px;
  border-radius: 10px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
}

.stage-info {
  min-width: 0;
  flex: 1;
}

.stage-name {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.stage-label {
  display: block;
  font-size: 11px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 6px;
  font-weight: 600;
}

.stage-meta {
  font-size: 12.5px;
  color: var(--muted);
  margin-top: 6px;
}

.stage-count {
  font-size: 12.5px;
  color: var(--muted);
  border: 1px solid var(--line);
  border-radius: 99px;
  padding: 3px 10px;
  white-space: nowrap;
}

.stage-count:empty {
  display: none;
}

.group {
  margin-top: 18px;
}

.group h3 {
  font-size: 12px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 9px;
  font-weight: 600;
}

.stage-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 20px;
}

/* ---------- Pastilles ---------- */

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  align-items: center;
  min-height: 28px;
}

.chips-empty {
  font-size: 13px;
  color: var(--muted);
  opacity: 0.7;
}

.chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-size: 12.5px;
  line-height: 1;
  padding: 5px 10px;
  border-radius: 99px;
  border: 1px solid var(--line);
  background: var(--bg-elev-2);
  color: var(--muted);
  white-space: nowrap;
  max-width: 100%;
  overflow: hidden;
}

.chip > span:first-child {
  overflow: hidden;
  text-overflow: ellipsis;
}

button.chip {
  cursor: pointer;
}

button.chip:hover {
  filter: brightness(1.25);
}

.chip.faded {
  opacity: 0.72;
}

.chip.faded:hover {
  opacity: 1;
}

.chip.new {
  border-style: dashed;
}

.chip.is-player::before {
  content: '👤';
  font-size: 10px;
  opacity: 0.8;
}

.chip-x {
  font-size: 9px;
  opacity: 0.65;
}

button.chip:hover .chip-x {
  opacity: 1;
}

.chip-badge {
  font-size: 9.5px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  opacity: 0.6;
}

.suggest-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 9px;
  flex-wrap: wrap;
}

.suggest-row[hidden] {
  display: none;
}

.suggest-label {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: var(--muted);
  opacity: 0.65;
  flex: none;
}

/* ---------- Saisie + autocomplétion ---------- */

.combo {
  position: relative;
  margin-top: 10px;
}

.combo input {
  width: 100%;
  font: inherit;
  font-size: 14px;
  color: var(--text);
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 12px;
}

.combo input::placeholder {
  color: var(--muted);
  opacity: 0.7;
}

.combo input:focus {
  outline: none;
  border-color: var(--accent);
}

.autocomplete {
  position: absolute;
  z-index: 20;
  top: calc(100% + 5px);
  left: 0;
  right: 0;
  margin: 0;
  padding: 5px;
  list-style: none;
  max-height: 260px;
  overflow-y: auto;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: 0 12px 28px rgba(0, 0, 0, 0.45);
}

.autocomplete[hidden] {
  display: none;
}

.autocomplete li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px;
  border-radius: 6px;
  cursor: pointer;
}

.autocomplete li.active {
  background: var(--accent-soft);
}

.ac-count {
  margin-left: auto;
  font-size: 11.5px;
  color: var(--muted);
  opacity: 0.75;
}

.ac-create {
  font-size: 13.5px;
  color: var(--accent);
}

/* ---------- Étiquettes dans la liste ---------- */

.file-labels {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 7px;
}

.file-labels .chip {
  font-size: 11.5px;
  padding: 3px 8px;
}

/* ---------- Mise en page a deux colonnes ---------- */

.layout {
  display: flex;
  align-items: flex-start;
  gap: 28px;
}

.content {
  flex: 1;
  min-width: 0;
}

.sidebar {
  width: 224px;
  flex: none;
  position: sticky;
  top: 24px;
}

.side-head {
  display: flex;
  align-items: baseline;
  gap: 10px;
  margin-bottom: 4px;
}

.side-head .section {
  margin: 0;
  flex: 1;
}

.side-head button[hidden] {
  display: none;
}

.side-group {
  margin-top: 20px;
}

.side-group h3 {
  font-size: 11.5px;
  letter-spacing: 0.09em;
  text-transform: uppercase;
  color: var(--muted);
  opacity: 0.75;
  margin: 0 0 8px;
  font-weight: 600;
}

.list-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin: 36px 0 12px;
  flex-wrap: wrap;
}

.list-head .section {
  margin: 0;
  display: flex;
  align-items: baseline;
  gap: 10px;
}

.list-head .count {
  font-size: 12px;
  letter-spacing: 0;
  text-transform: none;
  color: var(--muted);
  opacity: 0.8;
  font-weight: 400;
}

.list-head .count:empty {
  display: none;
}

/* ---------- Facettes ---------- */

.facets {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.facet-empty {
  font-size: 13px;
  color: var(--muted);
  opacity: 0.6;
  padding: 4px 2px;
}

button.facet {
  width: 100%;
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 6px 9px;
  border: 1px solid transparent;
  border-radius: 7px;
  background: transparent;
  color: var(--muted);
  font-size: 13.5px;
  text-align: left;
}

button.facet:hover:not(:disabled) {
  background: var(--bg-elev);
  border-color: var(--line);
  color: var(--text);
}

button.facet.active {
  background: var(--accent-soft);
  border-color: rgba(41, 182, 246, 0.4);
  color: var(--text);
}

button.facet.vide {
  opacity: 0.38;
}

.facet .dot {
  width: 9px;
  height: 9px;
  flex: none;
  border-radius: 50%;
}

.facet-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.facet-count {
  font-size: 11.5px;
  opacity: 0.7;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
  .layout {
    display: block;
  }

  .sidebar {
    width: auto;
    position: static;
    margin-bottom: 26px;
    padding-bottom: 20px;
    border-bottom: 1px solid var(--line);
  }

  .facets {
    flex-direction: row;
    flex-wrap: wrap;
    gap: 6px;
  }

  button.facet {
    width: auto;
    border-color: var(--line);
    background: var(--bg-elev);
  }
}

/* ---------- Interrupteur a trois crans : images / tout / videos ---------- */

.sr {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border: 0;
}

.switch3 {
  position: relative;
  display: flex;
  padding: 3px;
  border: 1px solid var(--line);
  border-radius: 99px;
  background: var(--bg-elev);
  flex: none;
}

.switch3-thumb {
  position: absolute;
  top: 3px;
  bottom: 3px;
  left: 3px;
  width: calc((100% - 6px) / 3);
  border-radius: 99px;
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  transition: transform 0.18s ease;
  pointer-events: none;
}

.switch3 button {
  position: relative;
  z-index: 1;
  min-width: 54px;
  padding: 5px 10px;
  border: none;
  background: none;
  border-radius: 99px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.3;
  text-transform: none;
  letter-spacing: 0;
  transition: color 0.15s;
}

.switch3 button:hover {
  color: var(--text);
}

.switch3 button[aria-checked='true'] {
  color: var(--accent);
}

.switch3 button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* ---------- Tampon « Kit Marketing » ---------- */

header.top {
  position: relative;
}

.stamp {
  /* ---- Les trois reglages du tampon, tout est ici ---- */
  --stamp-angle: -9.5deg; /* inclinaison : negatif penche a gauche */
  --stamp-x: 33%; /* position horizontale dans le bandeau (50% = centre) */
  --stamp-y: -54%; /* decalage vertical : plus proche de 0 = deborde plus bas */

  position: absolute;
  left: var(--stamp-x);
  top: 50%;
  z-index: 5;

  /* Déporté vers le bas pour mordre sur le trait du bandeau, et de travers. */
  transform: translate(-50%, var(--stamp-y)) rotate(var(--stamp-angle));
  transform-origin: center;

  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 1px;
  padding: 7px 20px 8px;
  white-space: nowrap;
  text-decoration: none;

  color: #e0473c;
  border: 3px solid currentColor;
  border-radius: 5px;
  background: rgba(224, 71, 60, 0.07);
  opacity: 0.88;

  /* Encre irrégulière : de fines bandes en diagonale allègent le remplissage. */
  -webkit-mask-image: repeating-linear-gradient(
    114deg,
    #000 0 7px,
    rgba(0, 0, 0, 0.78) 7px 9px
  );
  mask-image: repeating-linear-gradient(114deg, #000 0 7px, rgba(0, 0, 0, 0.78) 7px 9px);

  transition: transform 0.16s ease, opacity 0.16s ease;
}

.stamp[hidden] {
  display: none;
}

/* Second filet intérieur, comme sur un vrai tampon */
.stamp::before {
  content: '';
  position: absolute;
  inset: 3px;
  border: 1px solid currentColor;
  border-radius: 3px;
  opacity: 0.5;
  pointer-events: none;
}

.stamp-line {
  font-size: 11.5px;
  letter-spacing: 0.22em;
  text-transform: uppercase;
  opacity: 0.9;
}

.stamp-strong {
  font-size: 14.5px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  line-height: 1.1;
}

/* Survol et clic derivent de --stamp-angle : un seul reglage a changer. */
.stamp:hover {
  opacity: 1;
  transform: translate(-50%, var(--stamp-y)) rotate(calc(var(--stamp-angle) + 1.5deg)) scale(1.04);
}

.stamp:active {
  transform: translate(-50%, var(--stamp-y)) rotate(calc(var(--stamp-angle) - 1deg)) scale(0.97);
  opacity: 0.95;
}

.stamp:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 4px;
}

/* Sous 1000 px il n'y a plus la place au centre : le tampon passe sous le
   bandeau, toujours de travers mais dans le flux. */
@media (max-width: 1000px) {
  /* Casse-ligne invisible : le tampon passe seul sur la ligne suivante tout en
     gardant sa largeur naturelle. Un flex-basis sur le tampon lui-meme
     l'etirerait sur toute la largeur. */
  header.top::after {
    content: '';
    flex-basis: 100%;
    height: 0;
    order: 9;
  }

  .stamp {
    position: static;
    transform: rotate(var(--stamp-angle));
    order: 10;
    margin: 12px auto 2px;
  }

  .stamp:hover {
    transform: rotate(calc(var(--stamp-angle) + 1.5deg)) scale(1.03);
  }

  .stamp:active {
    transform: rotate(calc(var(--stamp-angle) - 1deg)) scale(0.97);
  }

  header.top {
    flex-wrap: wrap;
  }
}

/* ---------- Page d'administration ---------- */

.btn-link {
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 6px 10px;
  font-size: 13px;
  color: var(--muted);
}

.btn-link:hover {
  color: var(--text);
  border-color: var(--accent);
}

.tabs {
  display: flex;
  gap: 6px;
  margin: 22px 0 18px;
  border-bottom: 1px solid var(--line);
}

.tab {
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  background: none;
  color: var(--muted);
  padding: 8px 14px;
  font-size: 14px;
}

.tab:hover:not(.active) {
  color: var(--text);
}

.tab.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
}

.panel[hidden] {
  display: none;
}

.admin-cols {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 26px;
  align-items: start;
}

.admin-col .section {
  margin-top: 0;
}

.admin-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
}

.admin-list li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 13px;
  border-bottom: 1px solid var(--line);
}

.admin-list li:last-child {
  border-bottom: none;
}

.admin-list li:hover {
  background: var(--bg-elev-2);
}

.admin-list li.empty {
  display: block;
}

.admin-name {
  flex: 1;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: 14px;
}

.admin-count {
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

.admin-actions {
  display: flex;
  gap: 4px;
  flex: none;
}

.admin-actions button {
  padding: 4px 8px;
  font-size: 12px;
}

/* ---------- Journal ---------- */

.journal-filters {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.journal-filters select,
.journal-filters input {
  font: inherit;
  font-size: 13.5px;
  color: var(--text);
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 7px 10px;
}

.journal-filters input {
  min-width: 240px;
  flex: 1;
  max-width: 380px;
}

.journal-filters select:focus,
.journal-filters input:focus {
  outline: none;
  border-color: var(--accent);
}

.journal-meta {
  font-size: 12px;
  color: var(--muted);
  opacity: 0.8;
  white-space: nowrap;
}

.journal {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--line);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--bg-elev);
  font-size: 13px;
}

.journal li {
  display: grid;
  grid-template-columns: 132px 118px 130px 1fr 108px;
  gap: 12px;
  align-items: baseline;
  padding: 7px 14px;
  border-bottom: 1px solid var(--line);
}

.journal li:last-child {
  border-bottom: none;
}

.journal li:hover {
  background: var(--bg-elev-2);
}

.journal li.empty {
  display: block;
}

.ev-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  font-size: 12px;
}

.ev-type {
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.ev-connexion { color: #81c784; }
.ev-deconnexion { color: #8899ab; }
.ev-login_refuse { color: var(--danger); }
.ev-envoi { color: #4fc3f7; }
.ev-telechargement { color: #ba68c8; }
.ev-suppression { color: #ff8a65; }
.ev-kit_marketing { color: #ffd54f; }
.ev-admin_label_delete,
.ev-admin_label_merge { color: #ffb74d; }

.ev-user {
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-detail {
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.ev-ip {
  color: var(--muted);
  opacity: 0.55;
  font-size: 11.5px;
  font-variant-numeric: tabular-nums;
  text-align: right;
}

.journal-more {
  display: flex;
  justify-content: center;
  margin-top: 14px;
}

.journal-more button[hidden] {
  display: none;
}

/* ---------- Boîte de dialogue ---------- */

.modal-backdrop {
  position: fixed;
  inset: 0;
  z-index: 50;
  display: grid;
  place-items: center;
  padding: 20px;
  background: rgba(3, 6, 10, 0.72);
}

.modal-backdrop[hidden] {
  display: none;
}

.modal {
  width: 100%;
  max-width: 440px;
  background: var(--bg-elev);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 24px;
}

.modal h3 {
  margin: 0 0 8px;
  font-size: 17px;
}

.modal-hint {
  margin: 0 0 18px;
  font-size: 13.5px;
  color: var(--muted);
  line-height: 1.5;
}

.modal-label {
  display: block;
  font-size: 11.5px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--muted);
  margin-bottom: 7px;
}

.modal-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  margin-top: 22px;
}

@media (max-width: 860px) {
  .admin-cols {
    grid-template-columns: 1fr;
  }

  .journal li {
    grid-template-columns: 1fr 1fr;
    row-gap: 3px;
  }

  .ev-detail,
  .ev-ip {
    grid-column: 1 / -1;
    text-align: left;
  }
}

/* ---------- Miniatures ---------- */

.file-icon.has-image,
.stage-thumb.has-image {
  /* display:block et non grid : avec « place-items: center », l'element n'est
     pas etire, le height:100% de l'image ne se resout pas et elle reprend sa
     hauteur naturelle. Une image portrait debordait alors et se faisait rogner
     par le bas au lieu d'etre centree. */
  display: block;
  padding: 0;
  overflow: hidden;
  background: var(--bg);
}

.file-icon.has-image img,
.stage-thumb.has-image img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

/* ---------- Nom modifiable dans la fiche de préparation ---------- */

/* Le champ s'annonce comme tel en permanence : sans bordure visible au repos,
   rien n'indique que le nom est modifiable. */
input.stage-name {
  width: 100%;
  font: inherit;
  font-size: 15px;
  font-weight: 600;
  color: var(--text);
  background: var(--bg-elev-2);
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 7px 10px;
  transition: border-color 0.15s, box-shadow 0.15s;
}

input.stage-name:hover {
  border-color: var(--muted);
}

input.stage-name:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-soft);
}

input.stage-name::placeholder {
  color: var(--muted);
  font-weight: 400;
}

.file-ext {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  padding: 1px 5px;
  border: 1px solid var(--line);
  border-radius: 4px;
  opacity: 0.85;
}

/* ---------- Ligne de fichier cliquable ---------- */

.list li.file-row {
  cursor: pointer;
}

.list li.file-row:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}

.file-name {
  display: block;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--text);
}

.list li.file-row:hover .file-name {
  color: var(--accent);
}

/* Actions d'une ligne : le telechargement est un lien, la suppression un
   bouton. Une hauteur explicite commune garantit leur alignement, que le
   contenu soit une icone ou du texte. */
.file-actions {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: none;
}

.file-actions > * {
  height: 30px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 0 10px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: transparent;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.file-actions > *:hover {
  color: var(--text);
  border-color: var(--accent);
}

.file-actions .danger:hover {
  color: var(--danger);
  border-color: var(--danger);
}

.icon-btn svg {
  display: block;
}

.icon-btn:hover {
  color: var(--accent);
}

/* ---------- Aperçu plein écran ---------- */

body.viewer-open {
  overflow: hidden;
}

.viewer {
  position: fixed;
  inset: 0;
  z-index: 100;
  display: flex;
  flex-direction: column;
  gap: 16px;
  padding: 18px 22px 22px;
  background: rgba(4, 7, 11, 0.92);
  backdrop-filter: blur(3px);
}

.viewer[hidden] {
  display: none;
}

.viewer-top {
  display: flex;
  align-items: center;
  gap: 16px;
  flex: none;
}

.viewer-name {
  flex: 1;
  min-width: 0;
  font-size: 14px;
  color: var(--muted);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.viewer-stage {
  position: relative;
  flex: 1;
  min-height: 0;
  /* Centre le message de repli ; les medias, eux, sont positionnes en absolu. */
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

/* Le media occupe exactement la zone disponible et s'y inscrit par
   object-fit. Aucun pourcentage a resoudre : un « max-height: 100% » sur un
   element centre dans une grille ne se resout pas, et l'image gardait sa
   hauteur naturelle en debordant sous les boutons. */
.viewer-stage img,
.viewer-stage video {
  position: absolute;
  /* Un leger retrait : le media ne colle jamais au titre ni aux boutons. */
  inset: 4px;
  width: 100%;
  height: 100%;
  object-fit: contain;
  object-position: center center;
  display: block;
}

.viewer-fallback {
  max-width: 460px;
  text-align: center;
  color: var(--muted);
  font-size: 14px;
  line-height: 1.6;
}

.viewer-bottom {
  display: flex;
  justify-content: flex-end;
  flex: none;
}

.viewer-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 42px;
  height: 42px;
  flex: none;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--bg-elev);
  color: var(--muted);
  cursor: pointer;
  text-decoration: none;
  transition: color 0.15s, border-color 0.15s;
}

.viewer-btn:hover {
  color: var(--text);
  border-color: var(--accent);
}

.viewer-btn:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .viewer {
    padding: 12px;
  }
}
