div.crm-autofields-results {
  position: fixed !important;
  min-width: 340px !important;
  max-width: calc(100vw - 16px) !important;
  z-index: 2147483647 !important;
  background: #ffffff !important;
  border: 1px solid #cbd5e1 !important;
  border-radius: 8px !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 10px 25px -5px rgba(0, 0, 0, 0.15) !important;
  max-height: 340px !important;
  overflow-y: auto !important;
  overflow-x: hidden !important;
  padding: 4px 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  animation: crmAfFadeIn 0.12s ease-out !important;
}

@keyframes crmAfFadeIn {
  from { opacity: 0; transform: translateY(-3px); }
  to { opacity: 1; transform: translateY(0); }
}

.crm-section, .crm-af-field, .crm-address-block, .crm-entity-form, .crm-content {
  overflow: visible !important;
}

/* Base item styling - 2 Columns Flex (Left: Core data, Right: Distant Source & ID) */
.crm-autofields-results .crm-autofields-item {
  all: unset !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: flex-start !important;
  width: 100% !important;
  box-sizing: border-box !important;
  text-align: left !important;
  background: #ffffff !important;
  border: none !important;
  border-bottom: 1px solid #f1f5f9 !important;
  padding: 9px 14px !important;
  cursor: pointer !important;
  margin: 0 !important;
  gap: 16px !important;
  transition: background-color 0.12s ease !important;
}

.crm-autofields-results .crm-autofields-item:last-child {
  border-bottom: none !important;
}

.crm-autofields-results .crm-autofields-item:hover,
.crm-autofields-results .crm-autofields-item:focus {
  background-color: #f8fafc !important;
  outline: none !important;
}

/* Left Column: Data to import */
.crm-autofields-item-main {
  flex: 1 1 auto !important;
  min-width: 0 !important;
}

.crm-autofields-title-row {
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.crm-autofields-main {
  font-size: 14px !important;
  font-weight: 600 !important;
  color: #0f172a !important;
  line-height: 1.3 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.crm-autofields-activity-row {
  font-size: 12px !important;
  color: #64748b !important;
  margin-top: 2px !important;
  line-height: 1.3 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

.crm-autofields-address-row {
  font-size: 12px !important;
  font-weight: 500 !important;
  color: #334155 !important;
  margin-top: 2px !important;
  line-height: 1.3 !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Right Column: Distant Source Badge & Identifiers */
.crm-autofields-item-meta {
  flex: 0 0 auto !important;
  display: flex !important;
  flex-direction: column !important;
  align-items: flex-end !important;
  text-align: right !important;
  gap: 3px !important;
}

.crm-autofields-id-row {
  font-size: 11.5px !important;
  font-weight: 600 !important;
  color: #334155 !important;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, monospace !important;
  letter-spacing: 0.3px !important;
}

.crm-autofields-extra-row {
  font-size: 11px !important;
  color: #64748b !important;
}

/* Provider Badges - Sober, Clean, Neutral Slate */
.crm-af-badge {
  display: inline-block !important;
  padding: 1px 5px !important;
  font-size: 9.5px !important;
  font-weight: 500 !important;
  text-transform: uppercase !important;
  letter-spacing: 0.4px !important;
  border-radius: 3px !important;
  line-height: 1.2 !important;
  white-space: nowrap !important;
  color: #64748b !important;
  background: #f8fafc !important;
  border: 1px solid #e2e8f0 !important;
}

.crm-af-badge-cess-e,
.crm-af-badge-dissoute {
  color: #991b1b !important;
  background: #fef2f2 !important;
  border: 1px solid #fee2e2 !important;
}

.crm-af-badge-container {
  color: #1d4ed8 !important;
  background: #eff6ff !important;
  border: 1px solid #bfdbfe !important;
  font-weight: 600 !important;
}

/* Container / Intermediate suggestion indicators */
.crm-autofields-expand-arrow {
  display: inline-block !important;
  margin-left: 4px !important;
  color: #64748b !important;
  font-weight: 700 !important;
  font-size: 14px !important;
}

mark.crm-autofields-highlight {
  background-color: #fef08a !important;
  color: inherit !important;
  padding: 0 1px !important;
  border-radius: 2px !important;
  font-weight: 600 !important;
}

.crm-autofields-results .crm-autofields-item--container:hover,
.crm-autofields-results .crm-autofields-item--container:focus {
  background-color: #f0f7ff !important;
}

/* Manual Fallback Option */
.crm-autofields-results .crm-autofields-item--manual {
  background-color: #fffbeb !important;
  border-top: 1px dashed #fde68a !important;
}

.crm-autofields-results .crm-autofields-item--manual:hover,
.crm-autofields-results .crm-autofields-item--manual:focus {
  background-color: #fef3c7 !important;
}

.crm-autofields-results .crm-autofields-item--manual .crm-autofields-main {
  color: #92400e !important;
  white-space: normal !important;
}

.crm-autofields-results .crm-autofields-item--manual .crm-autofields-sub {
  color: #b45309 !important;
}

/* Notices & Empty states */
.crm-autofields-notice {
  padding: 10px 12px !important;
  font-size: 12px !important;
  color: #64748b !important;
  text-align: center !important;
}

.crm-autofields-loading {
  padding: 12px 14px !important;
  font-size: 13px !important;
  color: #475569 !important;
  text-align: left !important;
  display: flex !important;
  align-items: center !important;
  gap: 8px !important;
}

.crm-autofields-loading::before {
  content: '' !important;
  display: inline-block !important;
  width: 14px !important;
  height: 14px !important;
  border: 2px solid #cbd5e1 !important;
  border-top-color: #3b82f6 !important;
  border-radius: 50% !important;
  animation: crmAfSpin 0.7s linear infinite !important;
  box-sizing: border-box !important;
}

@keyframes crmAfSpin {
  to { transform: rotate(360deg); }
}

/* When the viewport itself is narrow, preserve the useful content first. */
.crm-autofields-results--compact .crm-autofields-item {
  gap: 8px !important;
  padding-right: 10px !important;
  padding-left: 10px !important;
}

.crm-autofields-results--compact .crm-autofields-item-meta {
  max-width: 42% !important;
}

.crm-autofields-results--compact .crm-autofields-id-row {
  overflow: hidden !important;
  max-width: 100% !important;
  text-overflow: ellipsis !important;
  white-space: nowrap !important;
}

/* Progressive Reveal Transitions */
tr.crm-autofields-hidden-row,
.crm-autofields-hidden-row {
  display: none !important;
}

tr.crm-autofields-revealed-row,
.crm-autofields-revealed-row {
  display: table-row !important;
  animation: crmAutofieldsFadeIn 0.2s ease-out forwards;
}

div.crm-autofields-revealed-row,
.crm-section.crm-autofields-revealed-row {
  display: block !important;
  animation: crmAutofieldsFadeIn 0.2s ease-out forwards;
}

@keyframes crmAutofieldsFadeIn {
  from {
    opacity: 0;
    transform: translateY(-3px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}
