.sync-body {
  display: grid;
  grid-template-columns: minmax(0, 1fr) 320px;
  gap: 16px;
  flex: 1;
  min-height: 0;
  padding: 16px;
  overflow: auto;
}

.sync-tree {
  display: grid;
  gap: 14px;
  align-content: start;
}

.sync-panel {
  display: grid;
  gap: 14px;
  align-content: start;
  position: sticky;
  top: 16px;
}

.sync-section {
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.sync-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 14px 16px;
  cursor: pointer;
  user-select: none;
  background: var(--surface-muted);
}

.sync-section-head h2 {
  margin: 0;
  font-size: 15px;
  font-family: var(--display-font);
}

.sync-section-head p {
  margin: 2px 0 0;
  color: var(--muted);
  font-size: 12px;
}

.sync-section-toggle {
  display: grid;
  place-items: center;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 900;
  font-size: 13px;
  transition: transform 0.15s ease;
}

.sync-section.collapsed .sync-section-toggle {
  transform: rotate(-90deg);
}

.sync-section-body {
  padding: 4px 16px 16px;
  display: grid;
  gap: 10px;
}

.sync-section.collapsed .sync-section-body {
  display: none;
}

.sync-area {
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.sync-area-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: var(--surface-muted);
  border-bottom: 1px solid var(--line);
}

.sync-area-head strong {
  font-size: 13px;
}

.sync-area-actions {
  display: flex;
  gap: 6px;
}

.sync-area-actions button {
  min-height: 26px;
  padding: 0 8px;
  font-size: 11px;
  background: #E7E9F5;
  color: var(--text);
}

.sync-area-body {
  display: grid;
}

.sync-query-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 12px;
  border-bottom: 1px solid var(--line);
  font-size: 13px;
}

.sync-query-row:last-child {
  border-bottom: 0;
}

.sync-query-row input[type="checkbox"] {
  width: 16px;
  height: 16px;
  min-height: auto;
  accent-color: var(--accent);
}

.sync-query-row label {
  display: block;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}

.sync-query-row span {
  color: var(--muted);
  font-size: 11px;
  display: block;
}

.sync-empty-area {
  padding: 12px;
  color: var(--muted);
  font-size: 12px;
  font-style: italic;
}

.sync-selected-list {
  display: grid;
  gap: 6px;
  max-height: 220px;
  overflow: auto;
}

.sync-selected-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 12px;
}

.sync-date-note {
  border-radius: 8px;
  padding: 8px 10px;
  background: var(--surface-muted);
  color: var(--muted);
  font-weight: 700;
}

#syncDateFields.sync-dates-inactive {
  opacity: 0.45;
  pointer-events: none;
}

.sync-log {
  margin: 0;
  max-height: 220px;
  overflow: auto;
  background: var(--text);
  color: #E8EBFB;
  border-radius: 8px;
  padding: 10px;
  font-size: 11px;
  line-height: 1.5;
  white-space: pre-wrap;
}

@media (max-width: 900px) {
  .sync-body {
    grid-template-columns: 1fr;
  }

  .sync-panel {
    position: static;
  }
}
