/* SYNCHRONISATION — fenêtre (synchronisation.js) */

.sync-overlay {
  position: fixed;
  inset: 0;
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
  background: rgba(15, 23, 42, .55);
}

.sync-overlay.open {
  display: flex;
}

.sync-modal {
  display: flex;
  width: min(760px, 100%);
  max-height: calc(100vh - 32px);
  flex-direction: column;
  overflow: hidden;
  border-radius: 14px;
  background: #f4f6f9;
  box-shadow: 0 20px 50px rgba(15, 23, 42, .3);
  font-family: inherit;
}

.sync-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 18px;
  background: #1f3a68;
  color: #fff;
  font-size: 18px;
  font-weight: 700;
}

.sync-fermer {
  width: 36px;
  height: 36px;
  border: 0;
  border-radius: 8px;
  background: rgba(255, 255, 255, .15);
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
}

.sync-body {
  display: grid;
  gap: 12px;
  padding: 14px;
  overflow-y: auto;
}

.sync-card {
  padding: 14px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  background: #fff;
}

.sync-card h3 {
  margin: 0 0 10px;
  color: #1f2937;
  font-size: 15px;
}

.sync-status {
  display: flex;
  align-items: center;
  gap: 10px;
  color: #111827;
  font-size: 15.5px;
  font-weight: 700;
}

.sync-dot {
  width: 12px;
  height: 12px;
  flex: 0 0 12px;
  border-radius: 50%;
  background: #9ca3af;
}

.sync-dot.ok { background: #16a34a; }
.sync-dot.err { background: #dc2626; }
.sync-dot.warn { background: #f59e0b; }
.sync-dot.busy { background: #2563eb; animation: sync-pulse 1s infinite; }

@keyframes sync-pulse {
  50% { opacity: .35; }
}

.sync-sous {
  margin: 6px 0 0 22px;
  color: #4b5563;
  font-size: 13px;
  line-height: 1.55;
}

.sync-stats {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 8px;
  margin-top: 12px;
}

.sync-stat {
  padding: 8px 10px;
  border-radius: 9px;
  background: #f3f6fb;
  color: #4b5563;
  font-size: 11.5px;
  line-height: 1.3;
}

.sync-stat b {
  display: block;
  color: #1f3a68;
  font-size: 18px;
}

.sync-progress {
  display: none;
  height: 6px;
  margin-top: 12px;
  overflow: hidden;
  border-radius: 99px;
  background: #e5e7eb;
}

.sync-progress.on {
  display: block;
}

.sync-progress i {
  display: block;
  width: 0;
  height: 100%;
  background: #2563eb;
  transition: width .3s;
}

.sync-msg {
  margin-top: 8px;
  color: #15803d;
  font-size: 13.5px;
  font-weight: 600;
}

.sync-msg:empty {
  display: none;
}

.sync-msg.ko,
.sync-ko {
  color: #b42318;
}

.sync-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.sync-btn {
  min-height: 38px;
  padding: 0 14px;
  border: 1px solid #d1d5db;
  border-radius: 9px;
  background: #fff;
  color: #1f2937;
  font: inherit;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
}

.sync-btn:hover:not(:disabled) {
  border-color: #1f3a68;
}

.sync-btn.primary {
  border-color: #1f3a68;
  background: #1f3a68;
  color: #fff;
}

.sync-btn:disabled {
  opacity: .55;
  cursor: wait;
}

.sync-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 18px;
  font-size: 14px;
}

.sync-row label {
  display: flex;
  align-items: center;
  gap: 8px;
}

.sync-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
}

.sync-row select {
  min-height: 34px;
  padding: 0 8px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font: inherit;
}

.sync-aide {
  margin: 8px 0 0;
  color: #6b7280;
  font-size: 12.5px;
}

.sync-zone {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid #e5e7eb;
}

.sync-zone[hidden] {
  display: none;
}

.sync-titre-zone {
  margin: 0 0 8px;
  color: #1f2937;
  font-size: 14px;
  font-weight: 700;
}

.sync-ok {
  margin: 0;
  color: #15803d;
  font-weight: 600;
}

.sync-probleme {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  margin-top: 8px;
  padding: 10px 12px;
  border-radius: 10px;
  background: #fffbeb;
  font-size: 13.5px;
}

.sync-probleme p {
  margin: 3px 0 0;
  color: #6b7280;
  font-size: 12.5px;
}

.sync-probleme .sync-btn {
  flex: 0 0 auto;
}

.sync-log {
  max-height: 220px;
  overflow-y: auto;
  font-size: 13px;
}

.sync-log div {
  display: flex;
  gap: 12px;
  padding: 5px 0;
  border-bottom: 1px solid #f1f2f4;
}

.sync-log .d {
  flex: 0 0 auto;
  color: #9ca3af;
}

.sync-log .ko {
  color: #b42318;
}

@media (max-width: 640px) {
  .sync-stats {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }

  .sync-probleme {
    flex-direction: column;
    align-items: stretch;
  }

  .sync-log div {
    flex-direction: column;
    gap: 0;
  }
}
