/* =========================================================================
   ONYX DESIGN SYSTEM — « OBSIDIAN & LUMIÈRE »
   Espace perceptuel OKLCH (Contraste APCA constant Jour/Nuit)
   Hybride Tactile (Smartphone/Tablette) & 10-foot UI (Android TV D-Pad)
   ========================================================================= */

:root {
  color-scheme: dark light;

  /* Mode Jour (light — Lumière) / Mode Nuit (dark — Obsidian) via light-dark() */
  --bg-canvas: light-dark(oklch(97.5% 0.006 85), oklch(0% 0 0));
  --bg-surface: light-dark(oklch(94.5% 0.008 85), oklch(13.5% 0.004 285));
  --bg-elevated: light-dark(oklch(99.5% 0.003 85), oklch(18% 0.006 285));
  --bg-hud-glass: light-dark(oklch(98% 0.005 85 / 0.84), oklch(13.5% 0.004 285 / 0.80));
  --text-primary: light-dark(oklch(13.5% 0.004 285), oklch(100% 0 0));
  --text-secondary: light-dark(oklch(44% 0.012 285), oklch(71% 0.012 285));
  --accent-primary: light-dark(oklch(58% 0.14 78), oklch(77% 0.145 78));
  --focus-ring: light-dark(oklch(66% 0.155 78), oklch(81% 0.165 78));
  --border-subtle: light-dark(oklch(0% 0 0 / 0.10), oklch(100% 0 0 / 0.08));

  /* Alias & variables compatibles */
  --bg-elev-0: var(--bg-surface);
  --bg-elev-1: var(--bg-surface);
  --bg-elev-2-hover: light-dark(oklch(91% 0.008 85), oklch(21% 0.004 285));
  --bg-elev-2-active: light-dark(oklch(88% 0.010 85), oklch(25% 0.005 285));
  --accent-white: var(--text-primary);
  --accent-titanium: var(--text-secondary);
  --text-muted: var(--text-secondary);
  --num-tabular: var(--text-secondary);
  --live-red: oklch(62% 0.22 25);
  --radius-card: 16px;
  --radius-modal: 24px;
}

html[data-theme="dark"] {
  color-scheme: dark;
}
html[data-theme="light"] {
  color-scheme: light;
}
html[data-theme="auto"] {
  color-scheme: dark light;
}

/* =========================================================================
   SKELETON LOADERS & GPU SHIMMER (ZÉRO CLS)
   Balayage GPU transform: translateX(...) sur dégradé translucide, boucle 1.4s
   ========================================================================= */
.skeleton-shimmer {
  position: relative;
  overflow: hidden;
  background-color: var(--bg-surface);
  border-radius: var(--radius-card);
  will-change: transform;
}

.skeleton-shimmer::after {
  content: "";
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  left: 0;
  transform: translateX(-100%);
  background: linear-gradient(
    90deg,
    transparent 0%,
    light-dark(rgba(255, 255, 255, 0.45), rgba(255, 255, 255, 0.08)) 50%,
    transparent 100%
  );
  animation: onyx-shimmer-sweep 1.4s infinite ease-in-out;
  pointer-events: none;
}

@keyframes onyx-shimmer-sweep {
  0% {
    transform: translateX(-100%);
  }
  100% {
    transform: translateX(100%);
  }
}

@media (prefers-reduced-motion: reduce) {
  .skeleton-shimmer::after {
    animation: onyx-shimmer-fade 1.2s infinite ease-in-out;
    transform: none;
    background: light-dark(rgba(0, 0, 0, 0.04), rgba(255, 255, 255, 0.04));
  }
  @keyframes onyx-shimmer-fade {
    0%, 100% { opacity: 0.35; }
    50% { opacity: 0.85; }
  }
}

.skeleton-vod-card {
  aspect-ratio: 2 / 3;
  width: 100%;
  border-radius: 16px;
  border: 1px solid var(--border-subtle);
}

.skeleton-channel-card {
  height: 64px;
  width: 100%;
  border-radius: 12px;
  border: 1px solid var(--border-subtle);
}

.skeleton-epg-row {
  height: 72px;
  width: 100%;
  border-radius: 14px;
  border: 1px solid var(--border-subtle);
}

* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--bg-canvas);
  color: var(--accent-white);
  font-family: 'Plus Jakarta Sans', 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  letter-spacing: -0.015em;
  user-select: none;
  overflow-x: hidden;
}

/* En mode Scène Player Plein Écran, le body ne scrolle pas */
body[data-view-mode="player"] {
  overflow: hidden;
  height: 100vh;
  width: 100vw;
}

/* En mode Picture-in-Picture natif Android : masquer tout l'habillage UI */
body.in-pip-mode .chrome-top,
body.in-pip-mode .chrome-bottom,
body.in-pip-mode #hub-viewport,
body.in-pip-mode #mini-player-dock,
body.in-pip-mode .mobile-nav,
body.in-pip-mode .modal-layer {
  display: none !important;
}
body.in-pip-mode #video-scene {
  position: fixed !important;
  inset: 0 !important;
  z-index: 9999 !important;
}

/* Mode Lecteur Natif Android Media3 / ExoPlayer : WebView transparente sur la scène vidéo */
html.native-player-active,
body.native-player-active,
html:has(body.native-player-active),
body.native-player-active #video-scene,
body.native-player-active #main-stage,
body.native-player-active #main-player-box {
  background-color: transparent !important;
  background: transparent !important;
}
body.native-player-active #main-video,
body.native-player-active #ambient-canvas {
  opacity: 0 !important;
  pointer-events: none !important;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
  font-feature-settings: "tnum";
}

/* Verre fumé Onyx */
.onyx-dock {
  background: var(--bg-hud-glass);
  backdrop-filter: blur(28px) saturate(140%);
  -webkit-backdrop-filter: blur(28px) saturate(140%);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.onyx-modal {
  background: var(--bg-elevated);
  backdrop-filter: blur(32px);
  -webkit-backdrop-filter: blur(32px);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
}

.onyx-card {
  background-color: var(--bg-surface);
  border: 1px solid var(--border-subtle);
  color: var(--text-primary);
  transition: background-color 140ms ease, transform 140ms ease, border-color 140ms ease, box-shadow 140ms ease;
}
.onyx-card:hover {
  background-color: var(--bg-elev-2-hover);
  border-color: var(--border-subtle);
}
.onyx-card:active,
.onyx-card.is-selected {
  background-color: var(--bg-elev-2-active);
  border-color: var(--accent-primary);
}

/* =========================================================================
   MOTEUR DE FOCUS SPATIAL ANDROID TV (D-PAD 10-FOOT UI)
   ========================================================================= */
*:focus {
  outline: none;
}

.tv-focusable {
  transition: transform 220ms linear(0, 0.009, 0.035 2.1%, 0.141, 0.281 6.7%, 0.723 12.9%, 0.938 16.7%, 1.017, 1.077, 1.121, 1.149 24.3%, 1.159, 1.163, 1.161, 1.154 29.9%, 1.129 32.8%, 1.051 39.6%, 1.017 43.1%, 0.991, 0.977 51%, 0.974 53.8%, 0.975 57.1%, 0.997 69.8%, 1.003 76.9%, 1.004 83.8%, 1),
              box-shadow 220ms ease, border-color 220ms ease, background-color 140ms ease;
}

.tv-focusable:focus-visible,
body[data-input-mode="dpad"] .tv-focusable:focus {
  outline: none !important;
  box-shadow: 0 0 0 2.5px var(--focus-ring), 0 10px 28px rgba(0, 0, 0, 0.45) !important;
  background-color: var(--bg-elev-2-hover) !important;
  border-color: var(--focus-ring) !important;
  transform: scale(1.045) !important;
  z-index: 40 !important;
}

/* Focus spécifique sur les cartes de posters 2:3 */
.poster-card.tv-focusable:focus-visible .poster-frame,
body[data-input-mode="dpad"] .poster-card.tv-focusable:focus .poster-frame {
  box-shadow: 0 0 0 2.5px var(--focus-ring), 0 14px 34px rgba(0, 0, 0, 0.75) !important;
  border-color: var(--focus-ring) !important;
  transform: translateY(-4px) scale(1.045) !important;
}

/* =========================================================================
   CORRECTIFS GUIDE TV RESPONSIVE & SEGMENTED CONTROL (MOBILE + ANDROID TV)
   ========================================================================= */
.guide-modal {
  background: #09090B;
  color: #FFFFFF;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 24px;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  max-width: 100%;
  box-sizing: border-box;
}

.guide-header {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.guide-title-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.guide-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
}

/* Segmented Control sur 1 seule ligne garantie */
.segmented-control {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  background: #121215;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 4px;
  gap: 4px;
}

.tab-btn {
  background: transparent;
  color: #A1A1AA;
  border: 2px solid transparent;
  border-radius: 10px;
  padding: 8px 6px;
  font-size: 0.80rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  text-align: center;
  transition: all 0.16s ease;
}

.tab-btn.active {
  background: #FFFFFF;
  color: #000000;
  font-weight: 700;
}

/* Correctif Android TV : Focus D-Pad sur un onglet NON actif garde le texte blanc lisible */
.tab-btn:not(.active):focus-visible,
body[data-input-mode="dpad"] .tab-btn:not(.active):focus {
  background: #222226 !important;
  color: #FFFFFF !important;
  border-color: #FFFFFF !important;
  transition: none !important;
}

.guide-toolbar {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.collection-row {
  display: flex;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.collection-select {
  flex: 1;
  min-width: 0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #121215;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 999px;
  padding: 8px 14px;
  color: #FFFFFF;
}

/* Masquage contextuel des filtres selon l'onglet actif du Guide TV */
.guide-modal[data-active-tab="live"] .time-filter-bar,
.guide-modal[data-active-tab="pvr"] .time-filter-bar,
.guide-modal[data-active-tab="pvr"] .guide-toolbar {
  display: none !important;
}

.time-filter-bar {
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-time-picker {
  flex-shrink: 0;
  background: #18181B;
  border: 1px solid rgba(255, 255, 255, 0.14);
  color: #FFFFFF;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
}

.days-scroll {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  scrollbar-width: none;
}
.days-scroll::-webkit-scrollbar { display: none; }

.day-pill {
  flex-shrink: 0;
  background: #121215;
  border: 1px solid rgba(255, 255, 255, 0.08);
  color: #A1A1AA;
  border-radius: 999px;
  padding: 6px 12px;
  font-size: 0.75rem;
  font-weight: 600;
}
.day-pill.active {
  background: #FFFFFF;
  color: #000000;
  border-color: #FFFFFF;
}

@media (min-width: 768px) {
  .guide-header {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
  .guide-title-row {
    display: contents;
  }
  .segmented-control {
    width: 430px;
  }
  .guide-toolbar {
    flex-direction: row;
    align-items: center;
  }
}

/* =========================================================================
   HUB CATALOGUE SVOD (HERO, RAILS HORIZONTAUX, GRILLES POSTERS 2:3)
   ========================================================================= */
.hub-hero {
  min-height: 460px;
  position: relative;
  display: flex;
  align-items: flex-end;
  padding: 88px clamp(16px, 4vw, 56px) 40px;
  overflow: hidden;
  background: #09090B;
  isolation: isolate;
}

.hub-hero-backdrop {
  position: absolute;
  inset: 0;
  z-index: -2;
  background-size: cover;
  background-position: center 35%;
  filter: saturate(1.05) brightness(0.68);
  transition: background-image 0.5s ease;
}

.hub-hero::after {
  content: "";
  position: absolute;
  inset: 0;
  z-index: -1;
  background:
    linear-gradient(90deg, #000000 0%, rgba(0,0,0,0.82) 38%, rgba(0,0,0,0.22) 78%, rgba(0,0,0,0.10) 100%),
    linear-gradient(0deg, #000000 0%, rgba(0,0,0,0.45) 45%, rgba(0,0,0,0.65) 100%);
}

.rail-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(138px, 14.5vw, 196px);
  gap: 14px;
  overflow-x: auto;
  padding: 6px 4px 14px;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.rail-scroll::-webkit-scrollbar { display: none; }

.resume-rail-scroll {
  display: grid;
  grid-auto-flow: column;
  grid-auto-columns: clamp(240px, 26vw, 330px);
  gap: 14px;
  overflow-x: auto;
  padding: 6px 4px 14px;
  scrollbar-width: none;
  scroll-snap-type: x mandatory;
}
.resume-rail-scroll::-webkit-scrollbar { display: none; }

.poster-card {
  min-width: 0;
  scroll-snap-align: start;
  cursor: pointer;
  position: relative;
  border-radius: 14px;
}

.poster-frame {
  aspect-ratio: 2 / 3;
  border-radius: 14px;
  overflow: hidden;
  position: relative;
  background: #121215;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: transform 0.22s ease, border-color 0.22s ease, box-shadow 0.22s ease;
}

.poster-card:hover .poster-frame {
  transform: translateY(-4px);
  border-color: rgba(255, 255, 255, 0.32);
}

.poster-frame img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.catalog-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 20px 12px;
}
@media (min-width: 640px) {
  .catalog-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 22px 14px; }
}
@media (min-width: 960px) {
  .catalog-grid { grid-template-columns: repeat(5, minmax(0, 1fr)); gap: 24px 16px; }
}
@media (min-width: 1360px) {
  .catalog-grid { grid-template-columns: repeat(6, minmax(0, 1fr)); gap: 26px 18px; }
}

/* =========================================================================
   SCÈNE PLAYER, AMBILIGHT, SLIDERS & ONDES SONORES
   ========================================================================= */
#ambient-canvas {
  filter: blur(90px) saturate(1.4);
  opacity: 0.35;
  transform: scale(1.12);
  mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0) 75%);
  -webkit-mask-image: radial-gradient(ellipse at center, rgba(0,0,0,1) 30%, rgba(0,0,0,0) 75%);
  transition: opacity 0.5s ease;
}
@media (max-width: 768px), (orientation: portrait) {
  #ambient-canvas {
    display: none !important;
  }
}

.ui-transition {
  transition: opacity 180ms cubic-bezier(0.16, 1, 0.3, 1), transform 180ms cubic-bezier(0.16, 1, 0.3, 1);
}
body[data-view-mode="player"].ui-hidden .chrome-top {
  opacity: 0;
  transform: translateY(-16px);
  pointer-events: none;
}
body[data-view-mode="player"].ui-hidden .chrome-bottom {
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
}
body[data-view-mode="player"].ui-hidden .ambient-veil-top,
body[data-view-mode="player"].ui-hidden .ambient-veil-bottom {
  opacity: 0;
}
body[data-view-mode="player"].ui-hidden {
  cursor: none;
}

/* =========================================================================
   MULTIPLEX 2x2 & TRANSITIONS HUD LECTEUR
   ========================================================================= */
.multiplex-tile {
  position: relative;
  border-radius: 16px;
  overflow: hidden;
  transition: transform 360ms cubic-bezier(0.16, 1, 0.3, 1),
              border-color 220ms ease,
              box-shadow 220ms ease;
  border: 1.5px solid var(--border-subtle);
}

.multiplex-tile.has-audio-focus {
  border-color: var(--accent-primary) !important;
  box-shadow: 0 0 0 2.5px var(--accent-primary), 0 8px 24px rgba(0, 0, 0, 0.6) !important;
}

.multiplex-tile:not(.has-audio-focus) {
  opacity: 0.92;
}

.multiplex-tile:not(.has-audio-focus):hover {
  opacity: 1;
  border-color: var(--text-secondary);
}

.safe-bottom {
  padding-bottom: max(1.25rem, calc(env(safe-area-inset-bottom) + 0.75rem));
}
.safe-mobile-nav {
  padding-bottom: max(0.5rem, env(safe-area-inset-bottom));
}

.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }
.thin-scrollbar::-webkit-scrollbar { width: 5px; height: 5px; }
.thin-scrollbar::-webkit-scrollbar-track { background: transparent; }
.thin-scrollbar::-webkit-scrollbar-thumb { background: rgba(255, 255, 255, 0.16); border-radius: 9999px; }

input[type="range"].onyx-range {
  -webkit-appearance: none;
  appearance: none;
  background: rgba(255, 255, 255, 0.16);
  height: 6px;
  border-radius: 9999px;
  cursor: pointer;
  touch-action: none;
}
input[type="range"].onyx-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #FFFFFF;
  box-shadow: 0 0 8px rgba(0, 0, 0, 0.6);
  transition: transform 0.15s ease;
}
input[type="range"].onyx-range:hover::-webkit-slider-thumb,
input[type="range"].onyx-range:active::-webkit-slider-thumb {
  transform: scale(1.25);
}

@keyframes soundbar-1 { 0%, 100% { height: 4px; } 50% { height: 14px; } }
@keyframes soundbar-2 { 0%, 100% { height: 14px; } 50% { height: 5px; } }
@keyframes soundbar-3 { 0%, 100% { height: 7px; } 50% { height: 12px; } }
.soundwave-bar-1 { animation: soundbar-1 0.8s ease-in-out infinite; }
.soundwave-bar-2 { animation: soundbar-2 0.7s ease-in-out infinite; }
.soundwave-bar-3 { animation: soundbar-3 0.9s ease-in-out infinite; }

/* Masquage strict de la barre de collections TV sur mobile/tablette (< 1024px) ou hors mode Direct */
@media (max-width: 1023px) {
  #top-live-collections-wrap {
    display: none !important;
  }
}
body[data-playback-mode="vod"] #top-live-collections-wrap,
body[data-playback-mode="series"] #top-live-collections-wrap,
body[data-playback-mode="vod"] #channel-carousel,
body[data-playback-mode="series"] #channel-carousel {
  display: none !important;
}

/* Mode Smartphone : Positionnement sans chevauchement du Dock de lecture et de la Navigation Basse */
#bottom-dock {
  z-index: 30;
}

@media (max-width: 767px) and (orientation: portrait) {
  body[data-view-mode="player"] .chrome-top {
    top: max(0.5rem, env(safe-area-inset-top));
    max-height: 8vh;
  }
  body[data-view-mode="player"] #bottom-dock {
    bottom: calc(3.6rem + env(safe-area-inset-bottom, 0px) + 8px) !important;
    padding-bottom: 0 !important;
    max-height: none !important;
    gap: 0.35rem;
  }
  body[data-view-mode="player"] #bottom-dock .onyx-dock {
    padding: 0.6rem 0.85rem !important;
    gap: 0.4rem !important;
  }
  body[data-view-mode="player"] #channel-carousel {
    display: none !important; /* Libère la vue portrait, accessible via Guide TV */
  }
  body[data-view-mode="player"].ui-hidden .mobile-nav {
    opacity: 0;
    transform: translateY(100%);
    pointer-events: none;
    transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  }
}

/* En orientation paysage sur mobile/tablette : masquer la barre d'onglets pour une immersion 16:9 plein écran */
@media (orientation: landscape) and (max-height: 600px) {
  body[data-view-mode="player"] .mobile-nav {
    display: none !important;
  }
  body[data-view-mode="player"] #bottom-dock {
    bottom: 0 !important;
    padding-bottom: max(0.5rem, env(safe-area-inset-bottom, 0px)) !important;
    max-height: none !important;
  }
}

/* =========================================================================
   STYLE ET VISIBILITÉ OPTIMALE DES SOUS-TITRES WEBVTT (CC)
   ========================================================================= */
::cue {
  background-color: rgba(9, 9, 11, 0.88) !important;
  color: #FFFFFF !important;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif !important;
  font-size: 1.20rem !important;
  font-weight: 600 !important;
  line-height: 1.4 !important;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.95), 0 0 2px #000000 !important;
  border-radius: 8px !important;
  padding: 4px 12px !important;
}

/* Modes de remplissage vidéo pour écrans 20:9 / 21:9 */
#main-video.video-fit-contain {
  object-fit: contain !important;
}
#main-video.video-fit-cover {
  object-fit: cover !important;
}
#main-video.video-fit-fill {
  object-fit: fill !important;
}

/* =========================================================================
   RITUEL D'INITIATION ONYX (INSTANT ZÉRO — AMBIANCE CINÉMA OBSIDIENNE)
   ========================================================================= */
@keyframes onyx-aura-breathe {
  0%, 100% { transform: scale(1); opacity: 0.22; }
  50% { transform: scale(1.08); opacity: 0.38; }
}

.onyx-onboarding-aura {
  background: radial-gradient(circle at 50% 0%, rgba(255, 255, 255, 0.16) 0%, rgba(255, 255, 255, 0.03) 45%, transparent 75%);
  animation: onyx-aura-breathe 6s ease-in-out infinite;
}


/* Thème 4 : Élagage de l'interface Live sur Mobile & Tablette (<= 1024px) */
@media (max-width: 1024px) {
  /* Supprime les boutons ±10s en mode Live direct sur mobile */
  body[data-playback-mode="live"] #dock-rewind-btn,
  body[data-playback-mode="live"] #dock-forward-btn {
    display: none !important;
  }

  /* Supprime le bouton "Chaînes" en haut à gauche et les sélecteurs de flux techniques */
  #mobile-top-channel-btn,
  #stream-variant-selector-pill {
    display: none !important;
  }
}


/* =========================================================================
   GESTION DES SOURCES IPTV, SÉLECTION UNIQUE & BARRE DE SYNCHRONISATION
   ========================================================================= */

.onyx-brand-header {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  user-select: none;
}
.onyx-brand-logo {
  width: 26px;
  height: 26px;
  border-radius: 7px;
  object-fit: contain;
}
.onyx-brand-title {
  font-weight: 800;
  font-size: 0.95rem;
  letter-spacing: 0.08em;
  color: #FFFFFF;
}
.active-source-header-pill {
  font-size: 0.70rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.08);
  color: #A1A1AA;
  border: 1px solid rgba(255, 255, 255, 0.12);
  white-space: nowrap;
}

.sources-list-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin: 14px 0;
}
.source-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  border-radius: 14px;
  background: #121215;
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.source-item-card.is-active {
  background: rgba(255, 255, 255, 0.06);
  border-color: #FFFFFF;
}
.source-radio-trigger {
  display: flex;
  align-items: center;
  gap: 12px;
  background: transparent;
  border: none;
  color: inherit;
  text-align: left;
  cursor: pointer;
  flex: 1;
}
.source-radio-dot {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  border: 2px solid #71717A;
  position: relative;
  flex-shrink: 0;
}
.source-radio-dot.checked {
  border-color: #FFFFFF;
}
.source-radio-dot.checked::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #FFFFFF;
}
.source-active-badge {
  font-size: 0.65rem;
  font-weight: 800;
  padding: 2px 7px;
  border-radius: 999px;
  background: #FFFFFF;
  color: #000000;
  letter-spacing: 0.04em;
}
.source-type-tag {
  font-size: 0.68rem;
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.08);
  color: #A1A1AA;
}
.source-url-sub {
  display: block;
  font-size: 0.78rem;
  color: #71717A;
  margin-top: 2px;
}
.source-actions-group {
  display: flex;
  align-items: center;
  gap: 6px;
}
.btn-icon-onyx {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 8px;
  color: #A1A1AA;
  cursor: pointer;
  transition: all 0.15s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.btn-icon-onyx:hover {
  background: rgba(255, 255, 255, 0.15);
  color: #FFFFFF;
}
.btn-icon-onyx.danger:hover {
  background: rgba(239, 68, 68, 0.2);
  color: #EF4444;
  border-color: rgba(239, 68, 68, 0.4);
}

.sync-progress-card {
  background: #121215;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 14px;
}
.sync-progress-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.84rem;
  font-weight: 600;
  color: #E4E4E7;
  margin-bottom: 10px;
}
.sync-progress-track {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}
.sync-progress-fill {
  height: 100%;
  background: #FFFFFF;
  border-radius: 999px;
  transition: width 0.25s cubic-bezier(0.22, 1, 0.36, 1);
}
.sync-error-box {
  margin-top: 12px;
  padding-top: 10px;
  border-top: 1px solid rgba(239, 68, 68, 0.25);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  color: #FCA5A5;
  font-size: 0.82rem;
}
.btn-retry-sync {
  background: #EF4444;
  color: #FFFFFF;
  border: none;
  border-radius: 8px;
  padding: 6px 12px;
  font-size: 0.78rem;
  font-weight: 700;
  cursor: pointer;
}
.source-crud-form {
  background: #121215;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 16px;
  padding: 16px;
  margin-top: 16px;
}
.source-form-title-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.source-form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin-bottom: 12px;
}
@media (max-width: 640px) {
  .source-form-grid {
    grid-template-columns: 1fr;
  }
}
.source-form-grid input,
.source-form-grid select {
  background: #09090B;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 10px;
  padding: 8px 12px;
  color: #FFFFFF;
  font-size: 0.82rem;
}
.source-form-grid input:focus,
.source-form-grid select:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.35);
}

/* =========================================================================
   TRANSITIONS MODALES & ÉCRANS (360MS GPU & @starting-style)
   ========================================================================= */
#modal-detail {
  transition: opacity 360ms cubic-bezier(0.16, 1, 0.3, 1), display 360ms allow-discrete;
}
#modal-detail:not(.hidden) {
  opacity: 1;
}
#modal-detail.hidden {
  opacity: 0;
  display: none !important;
}
@starting-style {
  #modal-detail:not(.hidden) {
    opacity: 0;
  }
  #modal-detail:not(.hidden) .onyx-modal {
    transform: scale(0.96) translateY(12px);
    opacity: 0;
  }
}
