/* Company Intel — list + detail editor
 * Mirrors buyer-admin.css layout pattern.
 * All rules scoped under #company-intel-root or .ci-* classes.
 */

#company-intel-root { display: none; }
body.mode-company-intel #company-intel-root { display: block; }
body.mode-company-intel form#config-form { display: none; }
body.mode-company-intel #funnel-tab { display: none !important; }
body.mode-company-intel .tab-bar { display: none; }
body.mode-company-intel .admin-main {
  max-width: none !important;
  padding-left: 0 !important;
  padding-right: 0 !important;
}

/* Two-column layout */
.ci-grid {
  display: grid;
  grid-template-columns: 320px 1fr;
  gap: 16px;
  padding: 16px 24px 32px;
  min-height: calc(100vh - 220px);
}

/* Left list panel */
.ci-list-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 12px;
  max-height: calc(100vh - 220px);
  overflow-y: auto;
}
.ci-list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}
.ci-list-header h3 { margin: 0; font-size: 14px; font-weight: 600; color: #374151; }
.ci-add-btn {
  padding: 4px 12px;
  font-size: 12px;
  font-weight: 600;
  color: #fff;
  background: #3b82f6;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.ci-add-btn:hover { background: #2563eb; }
.ci-search {
  width: 100%;
  padding: 7px 10px;
  font-size: 12px;
  border: 1px solid #e5e7eb;
  border-radius: 6px;
  margin-bottom: 8px;
  box-sizing: border-box;
}
.ci-search:focus { outline: none; border-color: #3b82f6; }
.ci-list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.ci-row {
  padding: 10px 12px;
  border-radius: 6px;
  cursor: pointer;
  border: 1px solid transparent;
  margin-bottom: 4px;
  transition: background 100ms, border-color 100ms;
}
.ci-row:hover { background: #f9fafb; }
.ci-row.active { background: #eff6ff; border-color: #3b82f6; }
.ci-row-main { font-size: 13px; color: #111827; display: flex; justify-content: space-between; align-items: center; gap: 6px; }
.ci-row-main strong { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.ci-row-meta { font-size: 11px; color: #6b7280; margin-top: 3px; display: flex; gap: 8px; align-items: center; }
.ci-empty { padding: 16px; font-size: 12px; color: #9ca3af; text-align: center; }

/* Source type badge */
.ci-source-badge {
  display: inline-block;
  padding: 1px 6px;
  border-radius: 8px;
  font-size: 9px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  flex-shrink: 0;
}
.ci-source-badge.buyer { background: #dbeafe; color: #1e40af; }
.ci-source-badge.partner { background: #fef3c7; color: #92400e; }
.ci-source-badge.manual { background: #e5e7eb; color: #6b7280; }

/* Enrichment status dot */
.ci-enriched-dot { color: #10b981; font-size: 9px; flex-shrink: 0; }
.ci-no-domain-dot { color: #f59e0b; font-size: 9px; flex-shrink: 0; cursor: help; }

/* Right editor panel */
.ci-editor-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  padding: 20px 24px;
  min-height: 600px;
  overflow-y: auto;
  max-height: calc(100vh - 220px);
}
.ci-editor-empty {
  padding: 80px 20px;
  text-align: center;
  color: #9ca3af;
  font-size: 14px;
}

/* Editor header */
.ci-editor-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
  gap: 12px;
}
.ci-editor-header h2 { margin: 0; font-size: 18px; font-weight: 600; color: #111827; }
.ci-editor-actions { display: flex; gap: 8px; align-items: center; flex-shrink: 0; }
.ci-btn {
  padding: 6px 14px;
  font-size: 12px;
  font-weight: 600;
  border: none;
  border-radius: 6px;
  cursor: pointer;
}
.ci-btn-primary { background: #3b82f6; color: #fff; }
.ci-btn-primary:hover { background: #2563eb; }
.ci-btn-secondary { background: #f3f4f6; color: #374151; border: 1px solid #e5e7eb; }
.ci-btn-secondary:hover { background: #e5e7eb; }
.ci-btn:disabled { opacity: 0.5; cursor: not-allowed; }
.ci-dirty-badge { color: #f59e0b; font-size: 12px; font-weight: 500; }

/* Intel summary card (read-only enrichment display) */
.ci-intel-card {
  padding: 16px;
  background: #f0f9ff;
  border: 1px solid #bfdbfe;
  border-radius: 8px;
  margin-bottom: 20px;
  font-size: 13px;
  line-height: 1.5;
}
.ci-intel-card h4 { margin: 0 0 4px; font-size: 13px; font-weight: 600; color: #1e40af; }
.ci-intel-card p { margin: 0 0 12px; color: #1e3a5f; }
.ci-intel-card p:last-child { margin-bottom: 0; }
.ci-intel-card ul { margin: 4px 0 12px; padding-left: 18px; }
.ci-intel-card li { margin-bottom: 4px; color: #1e3a5f; }
.ci-intel-as-of { font-size: 11px; color: #6b7280; margin-bottom: 12px; }
.ci-intel-warning {
  padding: 8px 12px;
  background: #fffbeb;
  border: 1px solid #fde68a;
  border-radius: 6px;
  font-size: 12px;
  color: #92400e;
  margin-bottom: 12px;
}
.ci-intel-no-data { color: #9ca3af; font-style: italic; }

/* Sources list */
.ci-sources { margin-top: 12px; }
.ci-sources a { font-size: 12px; color: #3b82f6; text-decoration: none; }
.ci-sources a:hover { text-decoration: underline; }

/* Overrides section */
.ci-overrides-section {
  border-top: 1px solid #e5e7eb;
  padding-top: 20px;
  margin-top: 20px;
}
.ci-overrides-section h3 { margin: 0 0 14px; font-size: 15px; font-weight: 600; color: #374151; }
.ci-field { margin-bottom: 14px; }
.ci-field label {
  display: block;
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  margin-bottom: 4px;
}
.ci-field input, .ci-field textarea, .ci-field select {
  width: 100%;
  padding: 8px 12px;
  font-size: 13px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  box-sizing: border-box;
  font-family: inherit;
}
.ci-field input:focus, .ci-field textarea:focus { outline: none; border-color: #3b82f6; }
.ci-field-note { font-size: 11px; color: #9ca3af; margin-top: 3px; }
.ci-field-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }

/* Banner */
.ci-banner {
  margin: 0 0 16px;
  padding: 10px 14px;
  border-radius: 6px;
  font-size: 13px;
  font-weight: 500;
}
.ci-banner.ok { background: #d1fae5; color: #065f46; border: 1px solid #10b981; }
.ci-banner.err { background: #fee2e2; color: #991b1b; border: 1px solid #ef4444; }

/* Add company modal (inline) */
.ci-add-form {
  padding: 12px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  margin-bottom: 8px;
}
.ci-add-form input {
  width: 100%;
  padding: 6px 10px;
  font-size: 12px;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  margin-bottom: 6px;
  box-sizing: border-box;
}
.ci-add-form-actions { display: flex; gap: 6px; justify-content: flex-end; }

/* Spinner for refresh button */
.ci-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid #e5e7eb;
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: ci-spin 0.6s linear infinite;
  vertical-align: middle;
  margin-right: 4px;
}
@keyframes ci-spin { to { transform: rotate(360deg); } }
