/* Header : bouton MAJ à droite, sans page intermédiaire */
.s38-update-btn {
  min-width: 172px !important;
  height: 42px !important;
  border-radius: 12px !important;
  background: #1b72cf !important;
  background-image: none !important;
  color: #fff !important;
  font-weight: 900 !important;
}

/* Filtres */
.s38-filter-card {
  padding: 14px !important;
}

.s38-filters {
  display: grid !important;
  align-items: end !important;
  gap: 10px !important;
  margin: 0 !important;
}

.s38-filters.disease-only {
  grid-template-columns: minmax(210px, 320px) 1fr !important;
}

.s38-filters.has-disease {
  grid-template-columns: minmax(150px,.9fr) minmax(150px,1fr) minmax(120px,.72fr) minmax(120px,.72fr) minmax(135px,.8fr) 112px 88px !important;
}

.s38-filters.has-sep {
  grid-template-columns: minmax(150px,.8fr) minmax(140px,.75fr) minmax(150px,.9fr) minmax(118px,.65fr) minmax(118px,.65fr) minmax(132px,.75fr) 112px 88px !important;
}

.s38-filters label {
  display: block !important;
  color: white !important;
  font-size: .82rem !important;
  font-weight: 850 !important;
}

.s38-filters select,
.s38-filters input[type="text"] {
  width: 100% !important;
  height: 38px !important;
  margin-top: 6px !important;
  padding: 0 10px !important;
  color: white !important;
  border-radius: 9px !important;
  border: 1px solid rgba(116,178,230,.28) !important;
  background: #091a2d !important;
  font-size: .88rem !important;
}

.s38-compact-check span {
  display: block !important;
  text-align: center !important;
  font-size: .68rem !important;
  line-height: 1.05 !important;
  margin-bottom: 5px !important;
  color: #d8e5f0 !important;
}

.s38-compact-check div {
  height: 38px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  border: 1px solid rgba(116,178,230,.22) !important;
  border-radius: 9px !important;
  background: rgba(9,26,45,.65) !important;
}

.s38-compact-check input {
  width: 13px !important;
  height: 13px !important;
  min-width: 13px !important;
  min-height: 13px !important;
  max-width: 13px !important;
  max-height: 13px !important;
  padding: 0 !important;
  margin: 0 !important;
  transform: none !important;
  accent-color: #1b72cf !important;
}

.s38-reset {
  height: 38px !important;
  display: grid !important;
  place-content: center !important;
  text-decoration: none !important;
  border: 1px solid rgba(116,178,230,.22) !important;
  border-radius: 9px !important;
  color: white !important;
  font-weight: 900 !important;
  background: rgba(255,255,255,.04) !important;
}

.s38-reset small {
  display: block !important;
  color: #a9bdd1 !important;
  font-size: .65rem !important;
  text-align: center !important;
}

@media(max-width: 1450px) {
  .s38-filters.has-sep,
  .s38-filters.has-disease {
    grid-template-columns: repeat(4, minmax(135px, 1fr)) !important;
  }
}

@media(max-width: 900px) {
  .s38-filters.disease-only,
  .s38-filters.has-sep,
  .s38-filters.has-disease {
    grid-template-columns: 1fr 1fr !important;
  }
}

@media(max-width: 650px) {
  .s38-filters.disease-only,
  .s38-filters.has-sep,
  .s38-filters.has-disease {
    grid-template-columns: 1fr !important;
  }
}

/* Modal de mise à jour */
.s38-sync-modal[hidden] { display: none !important; }

.s38-sync-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99999 !important;
  display: grid !important;
  place-items: center !important;
  padding: 20px !important;
  background: rgba(0, 8, 18, .72) !important;
}

.s38-sync-card {
  position: relative !important;
  width: min(720px, 96vw) !important;
  border-radius: 20px !important;
  border: 1px solid rgba(116,178,230,.32) !important;
  background: linear-gradient(180deg,#102943,#071524) !important;
  color: white !important;
  padding: 24px !important;
  box-shadow: 0 30px 80px rgba(0,0,0,.5) !important;
}

.s38-sync-card h2 {
  margin: 0 0 8px !important;
  font-size: 1.6rem !important;
}

.s38-sync-card p {
  margin: 0 0 16px !important;
  color: #d8e5f0 !important;
}

.s38-sync-close {
  position: absolute !important;
  top: 14px !important;
  right: 14px !important;
  width: 34px !important;
  height: 34px !important;
  border: 0 !important;
  border-radius: 10px !important;
  background: rgba(255,255,255,.10) !important;
  color: white !important;
  font-size: 20px !important;
  cursor: pointer !important;
}

.s38-progress-head {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  margin-bottom: 8px !important;
  font-weight: 900 !important;
}

.s38-progress {
  height: 10px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(116,178,230,.18) !important;
  overflow: hidden !important;
  margin-bottom: 16px !important;
}

.s38-progress span {
  display: block !important;
  width: 0% !important;
  height: 100% !important;
  background: linear-gradient(90deg,#2a83e9,#55e37e) !important;
  transition: width .25s ease !important;
}

.s38-sync-steps {
  display: grid !important;
  gap: 10px !important;
}

.s38-sync-steps > div {
  display: grid !important;
  grid-template-columns: 1fr auto !important;
  gap: 12px !important;
  align-items: center !important;
  padding: 12px 14px !important;
  border-radius: 12px !important;
  border: 1px solid rgba(116,178,230,.18) !important;
  background: rgba(255,255,255,.05) !important;
}

.s38-sync-steps strong {
  color: #fff !important;
}

.s38-sync-steps span {
  color: #ffd34d !important;
  font-weight: 900 !important;
}

.s38-sync-steps .running span { color: #35d5ff !important; }
.s38-sync-steps .done span { color: #55e37e !important; }
.s38-sync-steps .error span { color: #ff737c !important; }

.s38-sync-summary {
  margin-top: 14px !important;
  padding: 12px !important;
  border-radius: 12px !important;
  background: #020915 !important;
  color: #d8e5f0 !important;
  min-height: 22px !important;
}

/* Phase popup */
.s38-phase-help {
  display: inline-grid !important;
  place-items: center !important;
  width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  border: 1px solid rgba(55,245,209,.5) !important;
  background: rgba(55,245,209,.12) !important;
  color: #37f5d1 !important;
  font-weight: 900 !important;
  cursor: pointer !important;
}

.s38-phase-modal[hidden] { display: none !important; }

.s38-phase-modal {
  position: fixed !important;
  inset: 0 !important;
  z-index: 99998 !important;
  display: grid !important;
  place-items: center !important;
  padding: 20px !important;
  background: rgba(0,0,0,.68) !important;
}

.s38-phase-card {
  position: relative !important;
  width: min(760px,95vw) !important;
  max-height: 88vh !important;
  overflow: auto !important;
  border-radius: 18px !important;
  border: 1px solid rgba(116,178,230,.35) !important;
  background: #071524 !important;
  color: white !important;
  padding: 26px !important;
  box-shadow: 0 30px 80px rgba(0,0,0,.55) !important;
}

.s38-phase-close {
  position: absolute !important;
  right: 14px !important;
  top: 12px !important;
  width: 34px !important;
  height: 34px !important;
  border-radius: 10px !important;
  border: 1px solid rgba(116,178,230,.28) !important;
  background: rgba(255,255,255,.06) !important;
  color: white !important;
  font-size: 1.3rem !important;
  cursor: pointer !important;
}

.s38-phase-list {
  display: grid !important;
  gap: 12px !important;
  margin-top: 16px !important;
}

.s38-phase-list article {
  padding: 14px !important;
  border-radius: 12px !important;
  background: rgba(255,255,255,.05) !important;
  border: 1px solid rgba(116,178,230,.18) !important;
}

.s38-phase-list h3 {
  margin: 0 0 6px !important;
  color: #37f5d1 !important;
}

.s38-phase-list p {
  margin: 6px 0 0 !important;
  line-height: 1.45 !important;
  color: #d8e5f0 !important;
}

/* Timeline dashboard + globale */
.s38-timeline-head {
  align-items: center !important;
}

.s38-timeline-head small {
  color: #a9bdd1 !important;
  font-size: .8rem !important;
}

.s38-timeline-link {
  color: white !important;
  text-decoration: none !important;
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(116,178,230,.22) !important;
  border-radius: 10px !important;
  padding: 8px 10px !important;
  font-weight: 900 !important;
}

.s38-timeline-grid {
  --count: 1;
  position: relative !important;
  display: grid !important;
  grid-template-columns: repeat(var(--count), minmax(96px, 1fr)) !important;
  gap: 12px !important;
  min-height: 188px !important;
  padding: 42px 24px 24px !important;
}

.s38-timeline-grid::before {
  content: "" !important;
  position: absolute !important;
  left: 48px !important;
  right: 48px !important;
  top: 56px !important;
  height: 4px !important;
  border-radius: 999px !important;
  background: linear-gradient(90deg,#2a83e9,#55e37e) !important;
}

.s38-time-node {
  position: relative !important;
  z-index: 2 !important;
  display: grid !important;
  justify-items: center !important;
  text-align: center !important;
}

.s38-time-dot {
  width: 20px !important;
  height: 20px !important;
  border-radius: 50% !important;
  border: 3px solid rgba(255,255,255,.45) !important;
  background: #35d5ff !important;
  box-shadow: 0 0 0 6px rgba(53,213,255,.12) !important;
}

.s38-time-node.positive .s38-time-dot { background: #36dc79 !important; box-shadow: 0 0 0 6px rgba(54,220,121,.14) !important; }
.s38-time-node.failure .s38-time-dot { background: #ff4d5a !important; box-shadow: 0 0 0 6px rgba(255,77,90,.14) !important; }
.s38-time-node.uncertain .s38-time-dot { background: #ffd34d !important; box-shadow: 0 0 0 6px rgba(255,211,77,.14) !important; }

.s38-time-label {
  margin-top: 14px !important;
  display: grid !important;
  gap: 2px !important;
  color: white !important;
}

.s38-time-label strong {
  font-size: .82rem !important;
  color: #35d5ff !important;
}

.s38-time-node.positive .s38-time-label strong { color: #55e37e !important; }
.s38-time-node.failure .s38-time-label strong { color: #ff737c !important; }
.s38-time-node.uncertain .s38-time-label strong { color: #ffd34d !important; }

.s38-time-label span,
.s38-time-label small {
  color: #d8e5f0 !important;
  font-size: .78rem !important;
}

.s38-time-label em {
  color: white !important;
  font-style: normal !important;
  font-weight: 900 !important;
  font-size: .82rem !important;
}

.s38-chrono-body,
.s38-chrono-main {
  min-height: 100vh !important;
  background: #071524 !important;
}

.s38-chrono-header h1 {
  flex: 1 !important;
}

.s38-chrono-filter label {
  display: inline-flex !important;
  align-items: center !important;
  gap: 8px !important;
  color: white !important;
  font-weight: 900 !important;
}

.s38-chrono-filter input {
  width: 13px !important;
  height: 13px !important;
  transform: none !important;
  accent-color: #1b72cf !important;
}

.s38-global-card {
  overflow: hidden !important;
}

.s38-global-grid {
  grid-template-columns: repeat(var(--count), minmax(100px, 1fr)) !important;
}

@media(max-width: 900px) {
  .s38-timeline-grid,
  .s38-global-grid {
    grid-template-columns: repeat(var(--count), minmax(110px, 150px)) !important;
    overflow-x: auto !important;
  }
}


/* V9.2 - progression par source + bouton ignorer */
.s38-sync-card .s38-progress {
  display: none !important;
}
.s38-sync-card .bw-sync-elapsed {
  margin: 10px 0 12px !important;
  color: #d8e5f0 !important;
  font-weight: 800 !important;
}
.s38-sync-steps > div {
  grid-template-columns: minmax(170px, 1.15fr) minmax(110px, .9fr) auto auto !important;
}
.bw-source-progress {
  height: 8px !important;
  min-width: 110px !important;
  border-radius: 999px !important;
  background: rgba(255,255,255,.08) !important;
  border: 1px solid rgba(116,178,230,.18) !important;
  overflow: hidden !important;
}
.bw-source-progress span {
  display: block !important;
  height: 100% !important;
  width: 0% !important;
  border-radius: inherit !important;
  background: linear-gradient(90deg,#2a83e9,#55e37e) !important;
  transition: width .2s ease !important;
}
.bw-source-skip {
  border: 1px solid rgba(255,211,77,.45) !important;
  background: rgba(255,211,77,.10) !important;
  color: #ffd34d !important;
  border-radius: 10px !important;
  padding: 7px 10px !important;
  cursor: pointer !important;
  font-weight: 900 !important;
}
.bw-source-skip:disabled {
  opacity: .38 !important;
  cursor: not-allowed !important;
}
.s38-sync-steps .skipped span[data-source-status] {
  color: #b8c7d8 !important;
}
@media (max-width: 760px) {
  .s38-sync-steps > div {
    grid-template-columns: 1fr auto !important;
  }
  .bw-source-progress {
    grid-column: 1 / -1 !important;
  }
}

/* V47 — messages de synchronisation lisibles */
.bw-sync-step-note{display:none!important}
.s38-sync-modal.show-technical .bw-sync-step-note{display:block!important}
.bw-sync-technical-toggle{margin-top:12px;border:1px solid rgba(125,220,255,.4);border-radius:999px;background:rgba(23,71,112,.35);color:#dff7ff;padding:8px 14px;font-weight:800;cursor:pointer}
.bw-sync-final-summary{margin-top:14px;padding:14px 16px;border:1px solid rgba(85,239,122,.35);border-radius:14px;background:rgba(18,78,67,.22);color:#eafff3}
.bw-sync-final-summary ul{margin:.55rem 0 0 1.1rem;padding:0;line-height:1.55}


/* V110 — découvertes précliniques visibles immédiatement après une synchronisation */
.bw-sync-discoveries{margin-top:14px;padding-top:14px;border-top:1px solid rgba(255,255,255,.12)}
.bw-sync-discoveries-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:10px}
.bw-sync-discoveries-head>span{display:inline-flex;min-width:28px;height:28px;align-items:center;justify-content:center;border-radius:999px;background:rgba(71,225,189,.16);border:1px solid rgba(71,225,189,.4);font-weight:800}
.bw-sync-discovery{padding:11px 12px;margin-top:9px;border:1px solid rgba(255,255,255,.12);border-radius:12px;background:rgba(2,20,42,.34)}
.bw-sync-discovery-main,.bw-sync-discovery-meta{display:flex;flex-wrap:wrap;gap:7px;align-items:center}
.bw-sync-discovery-main strong{font-size:14px}
.bw-sync-discovery-main span,.bw-sync-discovery-meta span{padding:3px 7px;border-radius:999px;background:rgba(255,255,255,.07);font-size:11px}
.bw-sync-discovery-title{margin:7px 0 8px;font-size:12px;line-height:1.4;opacity:.92}
.bw-sync-discovery-meta a,.bw-sync-discoveries-actions a{font-weight:800;text-decoration:none;color:inherit;border-bottom:1px solid currentColor}
.bw-sync-discoveries-actions{margin-top:12px;text-align:right}
.bw-sync-discoveries-empty p{margin:7px 0 0;opacity:.8}

/* V128 — détail explicite des erreurs de synchronisation */
.bw-sync-errors{margin-top:14px;padding:13px 14px;border:1px solid rgba(255,107,122,.5);border-radius:14px;background:rgba(120,25,42,.18);color:#fff0f2}
.bw-sync-errors-head{display:flex;align-items:center;justify-content:space-between;gap:12px;margin-bottom:8px}
.bw-sync-errors-head>span{display:inline-flex;min-width:28px;height:28px;align-items:center;justify-content:center;border-radius:999px;background:rgba(255,107,122,.16);border:1px solid rgba(255,107,122,.45);font-weight:900}
.bw-sync-errors ol{margin:0;padding-left:1.35rem;display:grid;gap:10px}
.bw-sync-errors li{padding:9px 10px;border-radius:10px;background:rgba(255,255,255,.045);line-height:1.35}
.bw-sync-errors li>strong{display:block;margin-bottom:4px;color:#ffb9c1}
.bw-sync-errors li>div{overflow-wrap:anywhere}
.bw-sync-errors li>small{display:block;margin-top:6px;opacity:.72}
.bw-sync-errors code{font-family:ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;color:#dff7ff}

/* V129 — catalogue de sources explicite et progression globale restaurée */
.s38-sync-card .s38-progress{display:block!important;margin:12px 0 7px!important}
.bw-sync-unavailable{display:grid;gap:5px;margin:12px 0;padding:10px 12px;border:1px solid rgba(255,196,92,.28);border-radius:10px;background:rgba(255,196,92,.07);color:#d6e3ed;font-size:.78rem}
.bw-sync-unavailable strong{color:#ffc45c}
.bw-sync-unavailable span{line-height:1.35}
.bw-sync-source-copy{display:grid;gap:3px}.bw-sync-source-copy small{color:#8fa8bc;font-size:.72rem;line-height:1.3}
