/* === sync intranet === */

/* Bandeau historique */
.sync-history {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.65rem 1rem;
  margin-bottom: 1rem;
  background: var(--grey-100);
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.sync-history-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
.sync-history-dot-ok { background: var(--success, #0bc1aa); }
.sync-history-dot-error { background: var(--danger, #cf3333); }
.sync-history-cache { margin-left: auto; }

/* Bandeau résumé */
.sync-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 2rem;
  padding: 1.5rem 1.75rem;
  background: linear-gradient(135deg, var(--secondary) 0%, #034a47 100%);
  color: var(--text-sidebar);
  border-radius: var(--radius);
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow);
}

.sync-summary-counts {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}
.sync-count { text-align: center; }

.sync-count-num {
  font-size: 2.25rem;
  font-weight: 800;
  line-height: 1;
  color: #fff;
}

.sync-count-label {
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgb(255 255 255 / 70%);
  margin-top: 0.35rem;
}

.sync-count-arrow {
  font-size: 1.5rem;
  opacity: 0.5;
  color: #fff;
}

.sync-summary-action {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.sync-summary-text {
  margin: 0;
  font-size: 0.9375rem;
  color: rgb(255 255 255 / 92%);
}

.sync-summary-text strong {
  color: var(--primary);
  font-weight: 700;
}

.sync-summary-action .btn-primary {
  background: var(--primary);
  color: var(--primary-text);
  border-color: var(--primary);
  font-weight: 700;
}

.sync-summary-action .btn-primary:hover {
  background: var(--primary-hover);
  border-color: var(--primary-hover);
}

.sync-pill-ok {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.4rem 0.85rem;
  border-radius: 999px;
  background: rgb(177 250 51 / 18%);
  color: var(--primary);
  font-weight: 600;
  font-size: 0.875rem;
}

/* Tuiles compteurs */
.sync-tiles {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.75rem;
}

.sync-tile {
  background: #fff;
  border: 1px solid var(--grey-200);
  border-left: 4px solid var(--grey-300);
  border-radius: var(--radius-sm);
  padding: 0.875rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.sync-tile:hover { transform: translateY(-1px); box-shadow: var(--shadow); }

.sync-tile-icon {
  width: 32px; height: 32px;
  border-radius: 8px;
  display: grid; place-items: center;
  background: var(--grey-100);
  color: var(--text-secondary);
  flex-shrink: 0;
}
.sync-tile-num { font-size: 1.5rem; font-weight: 700; line-height: 1; color: var(--text-primary); }
.sync-tile-label { font-size: 0.8125rem; color: var(--text-secondary); margin-left: auto; font-weight: 500; }

.sync-tile-create { border-left-color: var(--primary); }
.sync-tile-create .sync-tile-icon { background: var(--primary-light); color: var(--primary-text); }
.sync-tile-create .sync-tile-num { color: var(--primary-text); }

.sync-tile-update { border-left-color: var(--secondary-light); }
.sync-tile-update .sync-tile-icon { background: #e6fcf7; color: var(--secondary); }

.sync-tile-deactivate { border-left-color: var(--warning); }
.sync-tile-deactivate .sync-tile-icon { background: var(--warning-light); color: #713716; }
.sync-tile-deactivate .sync-tile-num { color: #713716; }

.sync-tile-missing { border-left-color: var(--grey-300); }

/* Sections */
.sync-section {
  background: #fff;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  margin-bottom: 1rem;
  overflow: hidden;
}
.sync-section-create { border-left: 4px solid var(--primary); }
.sync-section-deactivate { border-left: 4px solid var(--warning); }
.sync-section-missing { border-left: 4px solid var(--grey-300); }
.sync-section-update { border-left: 4px solid var(--secondary-light); }

.sync-section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--grey-200);
  cursor: default;
}
details.sync-section .sync-section-header { cursor: pointer; user-select: none; }
details.sync-section[open] .sync-section-header { border-bottom: 1px solid var(--grey-200); }
details.sync-section:not([open]) .sync-section-header { border-bottom: none; }

.sync-section-header h2 {
  font-size: 1rem;
  font-weight: 700;
  margin: 0 0 0.15rem;
  color: var(--text-primary);
}
.sync-section-header p { margin: 0; font-size: 0.8125rem; }

/* Pills */
.sync-pill {
  display: inline-flex;
  align-items: center;
  padding: 0.25rem 0.65rem;
  border-radius: 999px;
  font-weight: 600;
  font-size: 0.8125rem;
  background: var(--grey-100);
  color: var(--text-secondary);
}
.sync-pill-create { background: var(--primary-light); color: var(--primary-text); }
.sync-pill-warning { background: var(--warning-light); color: #713716; }
.sync-pill-muted { background: var(--grey-100); color: var(--text-secondary); }

/* Liste d'employés */
.sync-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.sync-item {
  display: flex;
  align-items: center;
  gap: 0.875rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--grey-100);
  transition: background-color 0.15s;
}
.sync-item:last-child { border-bottom: none; }
.sync-item:hover { background: var(--grey-50, #fafbfc); }
.sync-item-muted { opacity: 0.85; }

.sync-item-avatar {
  width: 36px; height: 36px;
  border-radius: 50%;
  display: grid; place-items: center;
  color: #fff;
  font-weight: 700;
  font-size: 0.8125rem;
  flex-shrink: 0;
}

.sync-item-avatar-new {
  background: var(--primary);
  color: var(--primary-text);
  border: 2px dashed var(--primary-text);
}

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

.sync-item-name {
  font-weight: 600;
  color: var(--text-primary);
  display: flex;
  gap: 0.5rem;
  align-items: center;
  flex-wrap: wrap;
}

.sync-item-meta {
  display: flex;
  gap: 1rem;
  margin-top: 0.2rem;
  font-size: 0.8125rem;
  color: var(--text-secondary);
  flex-wrap: wrap;
}

.sync-item-link {
  font-size: 0.8125rem;
  color: var(--secondary-text);
  text-decoration: underline;
  flex-shrink: 0;
}

.sync-list-compact .sync-item-compact {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 1.25rem;
  font-size: 0.875rem;
}
.sync-list-compact .sync-item-compact .sync-item-name { font-weight: 500; }

.sync-badge {
  display: inline-block;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  font-size: 0.6875rem;
  font-weight: 600;
  background: var(--grey-100);
  color: var(--text-secondary);
}
.sync-badge-warning { background: var(--warning-light); color: #713716; }
.sync-badge-neutral { background: var(--grey-100); color: var(--text-secondary); }

/* Erreur */
.sync-error-card {
  display: flex;
  gap: 1rem;
  padding: 1.25rem;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-left: 4px solid var(--danger);
  border-radius: var(--radius);
}

.sync-error-icon {
  color: var(--danger);
  flex-shrink: 0;
}

.sync-error-card h3 {
  margin: 0 0 0.35rem;
  color: #991b1b;
  font-size: 1rem;
}
.sync-error-card p { margin: 0 0 0.35rem; color: #7f1d1d; }

@media (width <= 900px) {
  .sync-summary { flex-direction: column; align-items: stretch; gap: 1.25rem; }
  .sync-summary-action { flex-direction: column; align-items: stretch; }
  .sync-tiles { grid-template-columns: repeat(2, 1fr); }
  .sync-section-header { flex-direction: column; align-items: flex-start; }
  .sync-item { flex-wrap: wrap; }
}
