:root {
  --fond: #0b0d10;
  --fond-2: #14181d;
  --fond-3: #1c222a;
  --bord: #2a323c;
  --texte: #e8edf3;
  --texte-doux: #93a1b1;
  --accent: #37d67a;
  --accent-sombre: #1f8f50;
  --rouge: #ff5c5c;
  --rayon: 12px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  background: var(--fond);
  color: var(--texte);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  -webkit-font-smoothing: antialiased;
}

[hidden] { display: none !important; }

button {
  font: inherit;
  cursor: pointer;
  border: none;
  border-radius: 10px;
  padding: 12px 18px;
  background: var(--accent);
  color: #06210f;
  font-weight: 600;
}
button:active { transform: translateY(1px); }
button.secondaire {
  background: var(--fond-3);
  color: var(--texte);
  border: 1px solid var(--bord);
  font-weight: 500;
}
button.lien {
  background: none;
  color: var(--texte-doux);
  padding: 8px 10px;
  font-weight: 500;
}

input, select {
  font: inherit;
  width: 100%;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid var(--bord);
  background: var(--fond);
  color: var(--texte);
  margin-bottom: 14px;
}
input:focus, select:focus { outline: 2px solid var(--accent-sombre); }

label {
  display: block;
  font-size: 13px;
  color: var(--texte-doux);
  margin-bottom: 6px;
}

/* ------------------------------------------------------------- connexion */
.connexion {
  min-height: 100dvh;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
}
.carte-connexion {
  width: 100%;
  max-width: 360px;
  background: var(--fond-2);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 28px;
}
.carte-connexion h1 { margin: 0; font-size: 26px; }
.sous-titre { color: var(--texte-doux); margin: 4px 0 22px; font-size: 14px; }
.carte-connexion button { width: 100%; margin-top: 6px; }
.erreur { color: var(--rouge); font-size: 14px; margin-top: 12px; }

/* ---------------------------------------------------------------- entete */
.entete {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  padding-top: max(12px, env(safe-area-inset-top));
  background: var(--fond-2);
  border-bottom: 1px solid var(--bord);
  position: sticky;
  top: 0;
  z-index: 10;
  flex-wrap: wrap;
}
.marque { display: flex; align-items: center; gap: 8px; }
.pastille {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--texte-doux);
  box-shadow: 0 0 0 0 rgba(55, 214, 122, .6);
}
.pastille.en-ligne { background: var(--accent); animation: pulse 2s infinite; }
.pastille.hors-ligne { background: var(--rouge); }
@keyframes pulse {
  0%   { box-shadow: 0 0 0 0 rgba(55, 214, 122, .5); }
  70%  { box-shadow: 0 0 0 8px rgba(55, 214, 122, 0); }
  100% { box-shadow: 0 0 0 0 rgba(55, 214, 122, 0); }
}

.onglets { display: flex; gap: 4px; margin-left: auto; }
.onglet {
  background: transparent;
  color: var(--texte-doux);
  padding: 8px 14px;
  border-radius: 999px;
  font-weight: 500;
}
.onglet.actif { background: var(--fond-3); color: var(--texte); }

main { padding: 16px; max-width: 1100px; margin: 0 auto; }
.vue { display: block; }

/* ----------------------------------------------------------------- video */
.cadre-video {
  position: relative;
  width: 100%;
  aspect-ratio: 16 / 9;
  background: #000;
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  overflow: hidden;
  margin-bottom: 14px;
}
.cadre-video video {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  background: #000;
}
.voile {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  background: rgba(11, 13, 16, .82);
  text-align: center;
  padding: 16px;
}
.voile-texte { font-size: 18px; font-weight: 600; }
.voile-detail { font-size: 13px; color: var(--texte-doux); }

.barre-actions { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.barre-actions button { flex: 1 1 auto; min-width: 130px; }

.grille-etat {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  gap: 10px;
}
.tuile {
  background: var(--fond-2);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 12px 14px;
}
.tuile .cle { font-size: 12px; color: var(--texte-doux); }
.tuile .valeur { font-size: 17px; font-weight: 600; margin-top: 4px; word-break: break-word; }

/* -------------------------------------------------------- enregistrements */
.carte-disque { margin-bottom: 12px; }
.ligne-disque {
  display: flex; justify-content: space-between; align-items: baseline;
  gap: 12px; font-size: 14px; color: #9aa4b2; margin-bottom: 6px;
}
.ligne-disque strong { color: #e6edf3; font-weight: 600; }
.jauge {
  height: 8px; border-radius: 999px; background: #1c2128;
  overflow: hidden; margin: 4px 0 12px;
}
.jauge-remplie {
  height: 100%; width: 0; border-radius: 999px; background: #2f81f7;
  transition: width .4s ease;
}
.jauge-remplie.critique { background: #d1242f; }

button.danger, .element button.danger {
  background: #2d1113; border-color: #6e2329; color: #ff8b93;
}
button.danger:hover { background: #45161a; }

.ligne-outils { display: flex; gap: 8px; align-items: center; margin-bottom: 12px; }
.ligne-outils select { margin-bottom: 0; }

.liste { display: flex; flex-direction: column; gap: 8px; }
.element {
  display: flex;
  align-items: center;
  gap: 12px;
  background: var(--fond-2);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 12px 14px;
}
.element .heure { font-weight: 600; font-variant-numeric: tabular-nums; }
.element .duree { color: var(--texte-doux); font-size: 13px; }
.element .actions { margin-left: auto; display: flex; gap: 8px; }
.element button, .element a.bouton {
  padding: 8px 12px;
  font-size: 14px;
  border-radius: 8px;
  text-decoration: none;
  display: inline-block;
}
a.bouton {
  background: var(--fond-3);
  color: var(--texte);
  border: 1px solid var(--bord);
}
.vide { color: var(--texte-doux); padding: 24px; text-align: center; }

/* -------------------------------------------------------------- reglages */
.carte {
  background: var(--fond-2);
  border: 1px solid var(--bord);
  border-radius: var(--rayon);
  padding: 20px;
  margin-bottom: 16px;
}
.carte h2 { margin: 0 0 6px; font-size: 18px; }
.aide { color: var(--texte-doux); font-size: 13px; margin: 0 0 16px; }
.duo { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.case { display: flex; align-items: center; gap: 10px; margin-bottom: 14px; }
.case input { width: auto; margin: 0; }
.case span { color: var(--texte); font-size: 15px; }
.message { color: var(--accent); font-size: 14px; margin-top: 12px; }
.message.ko { color: var(--rouge); }

.champ-copie {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--fond);
  border: 1px solid var(--bord);
  border-radius: 10px;
  padding: 10px 12px;
  margin-bottom: 10px;
  flex-wrap: wrap;
}
.champ-copie code {
  flex: 1 1 200px;
  font-size: 13px;
  word-break: break-all;
  color: var(--texte);
}
.champ-copie .etiquette { font-size: 12px; color: var(--texte-doux); }

@media (max-width: 560px) {
  .duo { grid-template-columns: 1fr; }
  .onglets { width: 100%; margin-left: 0; justify-content: space-between; }
  .onglet { flex: 1; text-align: center; padding: 8px 6px; }
  main { padding: 12px; }
  .element { flex-wrap: wrap; }
  .element .actions { margin-left: 0; width: 100%; }
  .element .actions button, .element .actions a.bouton { flex: 1; text-align: center; }
}

@media (orientation: landscape) and (max-height: 500px) {
  .entete { position: static; }
  .cadre-video { max-height: 78dvh; }
}
