:root {
  color-scheme: light;
  font-family: Inter, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  background: #f5f7fb;
  color: #111827;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  min-height: 100%;
}

body {
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

.page-shell {
  max-width: 1320px;
  margin: 0 auto;
  padding: 24px;
}

header {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
  margin-bottom: 20px;
}

header h1 {
  margin: 0;
  font-size: 2rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 14px;
}

.app-logo {
  height: 56px;
  width: auto;
  display: block;
}

header p {
  margin: 0;
  color: #4b5563;
}

.mode-indicator {
  margin: 8px 0 0;
  font-size: 0.95rem;
}

.mode-indicator.demo {
  color: #b91c1c;
}

.mode-indicator.live {
  color: #047857;
}

.actions button {
  appearance: none;
  border: none;
  background: #2563eb;
  color: white;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.actions button:hover {
  background: #1d4ed8;
}

.stats-panel {
  display: grid;
  grid-template-columns: repeat(3, minmax(160px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 18px;
  padding: 18px;
  min-height: 96px;
}

.stat-card strong {
  display: block;
  font-size: 1.75rem;
  margin-bottom: 6px;
}

.stat-card span {
  color: #6b7280;
}

.filters-panel {
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 24px;
}

.filter-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(220px, 1fr));
  gap: 16px;
}

label {
  display: flex;
  flex-direction: column;
  gap: 8px;
  font-size: 0.95rem;
  color: #374151;
}

input[type='search'], select, textarea, input[type='file'] {
  width: 100%;
  border-radius: 12px;
  border: 1px solid #d1d5db;
  padding: 12px 14px;
  font-size: 0.95rem;
  outline: none;
}

textarea {
  min-height: 120px;
  resize: vertical;
}

.search-status {
  margin-top: 10px;
  color: #2563eb;
  font-size: 0.95rem;
  font-weight: 600;
}

.mode-toggle {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 10px;
  flex-wrap: wrap;
}
.mode-toggle-title { font-size: 0.9rem; color: #374151; font-weight: 600; }
.mode-opt {
  flex-direction: row;
  align-items: center;
  gap: 6px;
  font-size: 0.92rem;
  color: #111827;
}
.mode-hint {
  display: block;
  margin-top: 6px;
  font-size: 0.82rem;
  color: #6b7280;
}

.domain-actions {
  display: flex;
  flex-direction: column;
  gap: 10px;
  align-items: flex-start;
  justify-content: center;
}

.domain-actions button {
  appearance: none;
  border: none;
  background: #4338ca;
  color: white;
  padding: 12px 16px;
  border-radius: 12px;
  cursor: pointer;
  font-weight: 600;
}

.domain-actions button:hover {
  background: #3730a3;
}

input[type='search']:focus, select:focus {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.checkbox-label {
  flex-direction: row;
  align-items: center;
  gap: 10px;
  margin-top: 24px;
}

.checkbox-label.inline {
  margin-top: 0;
  font-size: 0.9rem;
}

.jobs-panel {
  background: white;
  border: 1px solid #d1d5db;
  border-radius: 20px;
  padding: 18px;
  margin-bottom: 24px;
}

.jobs-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px 16px;
  margin-bottom: 14px;
}

.jobs-header h2 {
  margin: 0;
  font-size: 1.2rem;
}

.jobs-hint {
  margin: 0;
  color: #6b7280;
  font-size: 0.88rem;
  flex: 1 1 320px;
}

.jobs-header button {
  appearance: none;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
}

.jobs-header button:hover {
  background: #eef2ff;
}

.jobs-empty {
  margin: 0;
  color: #6b7280;
}

.jobs-more {
  cursor: pointer;
  color: #2563eb;
  font-weight: 600;
}
.jobs-more:hover { text-decoration: underline; }

.jobs-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.job-card {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px 16px;
  border: 1px solid #e5e7eb;
  border-radius: 14px;
  padding: 12px 16px;
}

.job-card.viewing {
  border-color: #2563eb;
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.10);
}

.job-main {
  display: flex;
  flex-direction: column;
  gap: 2px;
  flex: 1 1 280px;
  min-width: 0;
}

.job-line {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
}

.job-meta {
  color: #6b7280;
  font-size: 0.85rem;
}

.job-coverage {
  font-size: 0.9rem;
  color: #374151;
}

.job-coverage .cc { color: #047857; font-weight: 600; }
.job-coverage .live { color: #7c3aed; font-weight: 600; }
.job-coverage .none { color: #9ca3af; font-weight: 600; }

.job-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

.job-actions button {
  appearance: none;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  padding: 7px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.88rem;
}

.job-actions button.primary { background: #2563eb; color: #fff; border-color: #2563eb; }
.job-actions button.primary:hover { background: #1d4ed8; }
.job-actions button.danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.job-actions button.danger:hover { background: #fee2e2; }
.job-actions button:hover { background: #eef2ff; }

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
}

.badge.running { background: #dbeafe; color: #1d4ed8; }
.badge.completed { background: #dcfce7; color: #166534; }
.badge.failed { background: #fee2e2; color: #991b1b; }
.badge.interrupted { background: #fef3c7; color: #92400e; }
.badge.stopped { background: #fee2e2; color: #9a3412; }

/* job Type chip + rename pencil in the Search jobs panel */
.job-type {
  display: inline-flex;
  align-items: center;
  padding: 2px 9px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.02em;
  background: #eef2ff;
  color: #3730a3;
  white-space: nowrap;
}
.job-rename {
  border: none;
  background: transparent;
  cursor: pointer;
  padding: 2px 4px;
  font-size: 0.95rem;
  line-height: 1;
  color: #6b7280;
  border-radius: 6px;
}
.job-rename:hover { background: #eef2ff; color: #3730a3; }

.badge.running::before {
  content: '';
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #2563eb;
  animation: pulse 1.2s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

.progress-track {
  width: 140px;
  height: 6px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: #2563eb;
  transition: width 0.4s ease;
}

.viewing-indicator {
  margin: 0 0 6px;
  font-weight: 700;
  color: #2563eb;
}

.viewing-indicator.hidden { display: none; }

.table-shell {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 22px;
  overflow: hidden;
}

.table-header {
  padding: 18px 24px;
  border-bottom: 1px solid #e5e7eb;
}

.table-header p {
  margin: 0;
  color: #4b5563;
}

.table-scroll {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 620px;          /* keep the results box a consistent size; scroll inside it */
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 1020px;
}

.loading-indicator {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
  color: #2563eb;
  font-weight: 600;
}

.loading-indicator.hidden {
  display: none;
}

.spinner {
  width: 18px;
  height: 18px;
  border: 3px solid rgba(37, 99, 235, 0.25);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

thead th {
  position: sticky;
  top: 0;
  background: #ffffffcc;
  backdrop-filter: blur(10px);
  text-align: left;
  font-weight: 700;
  padding: 16px 14px;
  border-bottom: 1px solid #e5e7eb;
  color: #111827;
}

tbody tr {
  border-bottom: 1px solid #e5e7eb;
}

tbody tr:nth-child(even) {
  background: #f8fafc;
}

tbody td {
  padding: 12px 14px;
  font-size: 0.92rem;
  color: #1f2937;
}

.photo-col, .photo-cell {
  width: 48px;
  padding-left: 12px;
  padding-right: 8px;
}

.row-photo {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  display: block;
  background: #f3f4f6;
}

/* sortable headers */
thead th.sortable {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
}
thead th.sortable:hover { color: #2563eb; }
thead th.sorted { color: #2563eb; }

/* Description: more room, single-line ellipsis so every row is the same height */
.desc-col { min-width: 360px; }
td.desc-cell { max-width: 380px; }
.desc-clip {
  max-width: 380px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Google Maps -> a red map pin linking to the maps URL */
td.maps-cell { text-align: center; }
.maps-pin {
  color: #ea4335;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.maps-pin:hover { color: #b31412; }

.domain-link { color: #2563eb; text-decoration: none; }
.domain-link:hover { text-decoration: underline; }

/* Position: a bit more room than a default cell */
.position-col { min-width: 220px; }
td.position-cell { min-width: 220px; }

/* Location (phone city/region): a little more room */
.location-col { min-width: 170px; }
td.location-cell { min-width: 170px; }

/* LinkedIn -> brand-blue "in" glyph linking to the profile */
td.linkedin-cell { text-align: center; }
.linkedin-link {
  color: #0a66c2;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.linkedin-link:hover { color: #004182; }

/* vCard -> address-card glyph linking to the downloadable .vcf */
td.vcard-cell { text-align: center; }
.vcard-link {
  color: #0f9d58;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.vcard-link:hover { color: #0b7a43; }

/* social profile icons (Facebook / X / WhatsApp) next to LinkedIn */
td.social-cell { text-align: center; }
.fb-link, .tw-link, .wa-link { display: inline-flex; align-items: center; justify-content: center; }
.fb-link { color: #1877f2; }
.tw-link { color: #0f1419; }
.wa-link { color: #25d366; }
.fb-link:hover, .tw-link:hover, .wa-link:hover { opacity: .78; }

/* ---- Search results table: tighter columns + frozen left columns ---- */
/* minimize whitespace between columns (scoped to the search page only) */
.search-page thead th { padding: 10px 8px; z-index: 4; }
.search-page tbody td { padding: 8px 8px; }

/* icon-only headers (LinkedIn, Google Maps) centered over their icon cells */
.search-page thead th.icon-col { text-align: center; }

/* Last Path: wider, single line with ellipsis */
.search-page td.lastpath-cell {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* Frozen left columns: checkbox, image, and Last Path stay put on horizontal scroll.
   box-sizing:border-box keeps the widths exact so the left offsets line up. */
.search-page th.check-col,    .search-page td.check-col,
.search-page th.photo-col,    .search-page td.photo-cell,
.search-page th.lastpath-col, .search-page td.lastpath-cell {
  position: sticky;
  box-sizing: border-box;
  background: #fff;
  z-index: 2;
}
.search-page th.check-col,    .search-page td.check-col     { left: 0;    width: 44px;  min-width: 44px;  max-width: 44px; }
.search-page th.photo-col,    .search-page td.photo-cell    { left: 44px; width: 52px;  min-width: 52px;  max-width: 52px; padding-left: 6px; padding-right: 6px; }
.search-page th.lastpath-col, .search-page td.lastpath-cell { left: 96px; width: 260px; min-width: 260px; max-width: 260px; box-shadow: inset -1px 0 0 #e5e7eb; }

/* header corner cells are sticky on both axes -> keep them above everything else */
.search-page thead th.check-col,
.search-page thead th.photo-col,
.search-page thead th.lastpath-col { z-index: 6; background: #fff; }

/* keep zebra + selection backgrounds on the frozen cells so scrolled content can't bleed through */
.search-page tbody tr:nth-child(even) td.check-col,
.search-page tbody tr:nth-child(even) td.photo-cell,
.search-page tbody tr:nth-child(even) td.lastpath-cell { background: #f8fafc; }
.search-page tbody tr.selected td.check-col,
.search-page tbody tr.selected td.photo-cell,
.search-page tbody tr.selected td.lastpath-cell { background: #ecfdf5; }

/* ---- Edit / AI Search modal ---- */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(15, 23, 42, 0.55);
  display: flex; align-items: flex-start; justify-content: center;
  padding: 40px 16px; overflow: auto;
}
.modal-dialog {
  background: #fff; border-radius: 12px; width: min(820px, 100%);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.3);
  display: flex; flex-direction: column; max-height: calc(100vh - 80px);
}
.modal-head {
  display: flex; align-items: center; justify-content: space-between;
  padding: 16px 20px; border-bottom: 1px solid #e5e7eb;
}
.modal-head h2 { margin: 0; font-size: 1.15rem; }
.modal-close {
  border: none; background: none; font-size: 1.6rem; line-height: 1;
  cursor: pointer; color: #6b7280; padding: 0 4px;
}
.modal-close:hover { color: #111827; }
.modal-body { padding: 16px 20px; overflow: auto; }
.modal-foot {
  display: flex; gap: 10px; justify-content: flex-end;
  padding: 14px 20px; border-top: 1px solid #e5e7eb;
}

.edit-card { border: 1px solid #e5e7eb; border-radius: 10px; padding: 12px 14px; margin-bottom: 14px; }
.edit-card-title { font-weight: 700; color: #111827; margin-bottom: 10px; font-size: 0.95rem; }
.edit-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 10px 14px; }
.edit-field { display: flex; flex-direction: column; gap: 4px; font-size: 0.8rem; color: #4b5563; }
.edit-field.wide { grid-column: 1 / -1; }
.edit-field input, .edit-field textarea {
  font-size: 0.9rem; padding: 7px 9px; border: 1px solid #d1d5db; border-radius: 7px;
  color: #111827; font-family: inherit; resize: vertical;
}
.edit-field input:focus, .edit-field textarea:focus { outline: none; border-color: #2563eb; }

.ai-status { font-size: 0.95rem; color: #374151; margin: 4px 0 12px; }
.ai-fail { color: #b91c1c; }
.ai-report { display: flex; flex-direction: column; gap: 10px; }
.ai-report-item { border: 1px solid #e5e7eb; border-radius: 8px; padding: 8px 12px; font-size: 0.85rem; }
.ai-report-email { font-weight: 700; color: #111827; margin-bottom: 4px; }
.ai-report-item > div { color: #374151; }
.ai-from { color: #9ca3af; text-decoration: line-through; }
.ai-to { color: #047857; font-weight: 600; }

@media (max-width: 640px) {
  .edit-grid { grid-template-columns: 1fr; }
}

/* second horizontal scrollbar pinned above the table, synced with the bottom one */
.table-scroll-top {
  overflow-x: auto;
  overflow-y: hidden;
  border-bottom: 1px solid #eef2f7;
}
.table-scroll-top > div { height: 1px; }

/* Search Jobs collapse toggle */
.jobs-toggle {
  appearance: none;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  width: 30px;
  height: 30px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 0.9rem;
  line-height: 1;
}
.jobs-toggle:hover { background: #eef2ff; }
.jobs-list.collapsed { display: none; }

/* thumbnail / source-link cell */
.photo-link { display: inline-flex; }
.photo-fallback {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  background: #f3f4f6;
  color: #6b7280;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.photo-link:hover .photo-fallback { background: #e0e7ff; color: #2563eb; }

/* pagination bar under the results */
.pagination {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 24px;
  border-top: 1px solid #e5e7eb;
}
.pagination button {
  appearance: none;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  padding: 7px 12px;
  border-radius: 9px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
}
.pagination button:hover:not(:disabled) { background: #eef2ff; }
.pagination button:disabled { opacity: 0.45; cursor: default; }
.page-info { color: #4b5563; font-weight: 600; }

footer {
  margin-top: 24px;
  color: #6b7280;
  font-size: 0.92rem;
}

code {
  background: #f3f4f6;
  padding: 2px 6px;
  border-radius: 6px;
}

@media (max-width: 960px) {
  .filter-row {
    grid-template-columns: 1fr;
  }
}

/* Green "Search Database" link styled as a button in the top nav (main page) */
.actions .nav-link {
  appearance: none;
  border: none;
  padding: 12px 18px;
  border-radius: 10px;
  cursor: pointer;
  font-weight: 600;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  background: #2563eb;
  color: #fff;
}
.actions .nav-link:hover { background: #1d4ed8; }
.actions .nav-link.green { background: #16a34a; }
.actions .nav-link.green:hover { background: #15803d; }

/* Action buttons relocated next to Clear domains / FIND CONTACTS */
.action-buttons {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

/* =====================================================================
   Search Database page (search.html) — full-bleed 25% / 75% split
   ===================================================================== */
body.search-page {
  margin: 0;
  background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}

.search-shell {
  display: flex;
  flex-direction: column;
  height: 100vh;
}

.search-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 22px;
  background: #fff;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}
.search-header .brand h1 { font-size: 1.4rem; }
.search-header .app-logo { height: 42px; }

.nav-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.nav-actions .nav-link {
  appearance: none;
  border: 1px solid #d1d5db;
  background: #f9fafb;
  color: #111827;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  font-size: 0.95rem;
}
.nav-actions .nav-link:hover { background: #eef2ff; }
.nav-actions .nav-link.green { background: #16a34a; color: #fff; border-color: #16a34a; }
.nav-actions .nav-link.green:hover { background: #15803d; }
.nav-actions .nav-link.active { box-shadow: 0 0 0 3px rgba(22, 163, 74, 0.18); }

.search-layout {
  flex: 1;
  display: grid;
  grid-template-columns: 25% 75%;
  gap: 16px;
  padding: 16px 22px 22px;
  min-height: 0;          /* allow children to scroll instead of growing the page */
}

.search-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  padding: 18px;
  overflow: hidden;          /* the criteria scroll internally; Search/Clear stay pinned */
  display: flex;
  flex-direction: column;
  gap: 14px;
}

/* scrollable criteria area — keeps the Search/Clear buttons visible below it */
.search-fields {
  display: flex;
  flex-direction: column;
  gap: 14px;
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto;
  padding-right: 2px;
}
.search-panel h2 { margin: 0 0 2px; font-size: 1.1rem; }
.search-panel label { font-size: 0.9rem; gap: 6px; }
.search-panel textarea { min-height: 84px; }
.search-panel .checkbox-label { margin-top: 4px; }

.search-actions { display: flex; gap: 10px; margin-top: 2px; padding-top: 12px; border-top: 1px solid #eef2f7; }
.search-actions button {
  flex: 1;
  appearance: none;
  border: none;
  border-radius: 10px;
  padding: 11px 12px;
  font-weight: 700;
  cursor: pointer;
}
.search-actions .primary { background: #2563eb; color: #fff; }
.search-actions .primary:hover { background: #1d4ed8; }
.search-actions .ghost { background: #f1f5f9; color: #111827; }
.search-actions .ghost:hover { background: #e2e8f0; }

.search-hint { margin: 0; color: #6b7280; font-size: 0.82rem; }

.results-panel {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 16px;
  display: flex;
  flex-direction: column;
  min-width: 0;
  overflow: hidden;
}

.results-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 14px 18px;
  border-bottom: 1px solid #e5e7eb;
  flex-wrap: wrap;
}
.results-toolbar p { margin: 0; color: #4b5563; }

/* "select all matching" banner (Gmail-style) shown above the results table */
.selection-banner {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 8px 14px;
  background: #ecfdf5;
  border-bottom: 1px solid #a7f3d0;
  color: #065f46;
  font-size: 0.9rem;
}
.selection-banner[hidden] { display: none; }
.selection-banner .link-btn {
  background: none;
  border: none;
  padding: 0;
  color: #047857;
  font: inherit;
  font-weight: 700;
  text-decoration: underline;
  cursor: pointer;
}
.selection-banner .link-btn:hover { color: #065f46; }

.toolbar-actions { display: flex; align-items: center; gap: 14px; }
.toolbar-actions .selected-info { color: #16a34a; font-weight: 700; font-size: 0.9rem; }
.toolbar-actions .primary {
  appearance: none;
  border: none;
  background: #16a34a;
  color: #fff;
  padding: 10px 16px;
  border-radius: 10px;
  font-weight: 700;
  cursor: pointer;
}
.toolbar-actions .primary:hover { background: #15803d; }

/* secondary + danger toolbar buttons (Edit / AI Search / Delete) */
.toolbar-actions .ghost,
.toolbar-actions .danger {
  appearance: none;
  border: 1px solid #d1d5db;
  background: #f8fafc;
  color: #111827;
  padding: 9px 14px;
  border-radius: 10px;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
}
.toolbar-actions .ghost:hover:not(:disabled) { background: #eef2f7; }
.toolbar-actions .danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.toolbar-actions .danger:hover:not(:disabled) { background: #fee2e2; }
.toolbar-actions button:disabled { opacity: 0.5; cursor: not-allowed; }

/* ===================== Auth pages (login / signup / forgot) ===================== */
.auth-page {
  margin: 0; min-height: 100vh; display: flex; align-items: center; justify-content: center;
  padding: 32px 16px; background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
}
.auth-card {
  background: #fff; border: 1px solid #e5e7eb; border-radius: 18px;
  box-shadow: 0 18px 50px rgba(15, 23, 42, 0.12); padding: 32px 28px; width: 100%; max-width: 400px; text-align: center;
}
.auth-card.wide { max-width: 640px; }
.auth-logo { width: 56px; height: 56px; object-fit: contain; margin-bottom: 8px; }
.auth-card h1 { margin: 4px 0 6px; font-size: 1.5rem; color: #111827; }
.auth-sub { margin: 0 0 18px; color: #6b7280; font-size: 0.92rem; }
.auth-form { display: flex; flex-direction: column; gap: 14px; text-align: left; }
.auth-form label { display: flex; flex-direction: column; gap: 6px; font-size: 0.85rem; color: #374151; font-weight: 600; }
.auth-form input[type="text"], .auth-form input[type="password"], .auth-form input[type="email"], .auth-form input[type="tel"] {
  padding: 11px 12px; border: 1px solid #d1d5db; border-radius: 10px; font-size: 0.95rem; font-family: inherit;
}
.auth-form input:focus { outline: none; border-color: #2563eb; }
.auth-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 12px 16px; }
.auth-check { flex-direction: row !important; align-items: flex-start; gap: 9px; font-weight: 500 !important; font-size: 0.88rem; }
.auth-check input { margin-top: 2px; width: 16px; height: 16px; flex: none; }
.auth-check a { color: #2563eb; }
.auth-form .primary {
  appearance: none; border: none; background: #2563eb; color: #fff; padding: 12px; border-radius: 10px;
  font-weight: 700; font-size: 0.98rem; cursor: pointer; margin-top: 4px;
}
.auth-form .primary:hover { background: #1d4ed8; }
.auth-msg { margin: 0; font-size: 0.88rem; min-height: 1em; }
.auth-msg.err { color: #b91c1c; }
.auth-msg.ok { color: #047857; }
.auth-links { display: flex; justify-content: space-between; gap: 12px; margin-top: 18px; flex-wrap: wrap; }
.auth-links a { color: #2563eb; text-decoration: none; font-size: 0.9rem; }
.auth-links a:hover { text-decoration: underline; }
.auth-legal { margin: 16px 0 0; font-size: 0.8rem; color: #9ca3af; }
.auth-legal a { color: #9ca3af; }
@media (max-width: 560px) { .auth-grid { grid-template-columns: 1fr; } }

/* ===================== Legal pages (privacy / terms) ===================== */
.legal-page { margin: 0; background: #f8fbff; }
.legal-shell { max-width: 860px; margin: 0 auto; padding: 0 20px 60px; }
.legal-header { display: flex; align-items: center; justify-content: space-between; padding: 20px 0; flex-wrap: wrap; gap: 12px; }
.legal-header .brand { display: flex; align-items: center; gap: 10px; text-decoration: none; color: #111827; font-weight: 700; }
.legal-header .app-logo { width: 36px; height: 36px; }
.legal-nav a { color: #2563eb; text-decoration: none; margin-left: 16px; font-size: 0.9rem; }
.legal-content { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 32px 36px; }
.legal-content h1 { margin-top: 0; color: #111827; }
.legal-body { white-space: pre-wrap; line-height: 1.6; color: #374151; font-size: 0.95rem; }

/* ===================== Top-nav user chip + logout ===================== */
.user-chip { font-size: 0.82rem; color: #6b7280; font-weight: 600; align-self: center; }
.nav-logout {
  appearance: none; border: 1px solid #d1d5db; background: #fff; color: #374151;
  padding: 7px 13px; border-radius: 9px; font-weight: 600; font-size: 0.85rem; cursor: pointer;
}
.nav-logout:hover { background: #f1f5f9; }
.nav-link.active { color: #16a34a; font-weight: 700; }

/* hide data-editing controls for the read-only 'user' role */
/* AI Search + Delete: hidden for the read-only 'user' role (analyst+ only) */
body[data-role="user"] #aiBtn,
body[data-role="user"] #deleteBtn { display: none !important; }
/* Edit: ADMIN-ONLY everywhere — users AND analysts cannot edit (Contact + Company Crawler) */
body:not([data-role="admin"]) #editBtn,
body:not([data-role="admin"]) .row-edit,
body:not([data-role="admin"]) .ccEdit { display: none !important; }
/* per-row Edit pencil (Contact Crawler) */
.row-edit-btn { border: none; background: none; cursor: pointer; font-size: 1rem; color: #6b7280; padding: 2px 6px; border-radius: 6px; line-height: 1; }
.row-edit-btn:hover { background: #eef2ff; color: #2563eb; }

/* ===================== Admin page ===================== */
.admin-main { flex: 1; overflow: auto; padding: 18px 22px 40px; display: flex; flex-direction: column; gap: 22px; }
.admin-section { background: #fff; border: 1px solid #e5e7eb; border-radius: 16px; padding: 18px 20px; }
.admin-section h2 { margin: 0 0 14px; font-size: 1.1rem; color: #111827; }
.pending-badge { font-size: 0.75rem; font-weight: 700; color: #b45309; background: #fef3c7; border-radius: 999px; padding: 2px 10px; margin-left: 8px; vertical-align: middle; }
.admin-table-wrap { overflow-x: auto; }
.admin-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.admin-table th { text-align: left; padding: 8px 10px; border-bottom: 2px solid #e5e7eb; color: #6b7280; white-space: nowrap; }
.admin-table td { padding: 8px 10px; border-bottom: 1px solid #f1f5f9; color: #1f2937; }
.admin-table tr.row-pending { background: #fffbeb; }
.role-tag { font-size: 0.72rem; font-weight: 700; border-radius: 6px; padding: 2px 8px; text-transform: capitalize; }
.role-admin { background: #ede9fe; color: #6d28d9; }
.role-analyst { background: #dbeafe; color: #1d4ed8; }
.role-user { background: #f3f4f6; color: #4b5563; }
.status-active { color: #047857; font-weight: 600; }
.status-pending { color: #b45309; font-weight: 600; }
.admin-actions { display: flex; gap: 6px; flex-wrap: wrap; }
.admin-actions button {
  appearance: none; border: 1px solid #d1d5db; background: #f8fafc; color: #374151;
  padding: 5px 9px; border-radius: 7px; font-size: 0.78rem; font-weight: 600; cursor: pointer;
}
.admin-actions button:hover:not(:disabled) { background: #eef2f7; }
.admin-actions button:disabled { opacity: 0.4; cursor: not-allowed; }
.admin-actions button.go { background: #ecfdf5; color: #047857; border-color: #a7f3d0; }
.admin-actions button.danger { background: #fef2f2; color: #b91c1c; border-color: #fecaca; }
.admin-create { display: flex; flex-wrap: wrap; gap: 10px; align-items: center; }
.admin-create input, .admin-create select {
  padding: 9px 11px; border: 1px solid #d1d5db; border-radius: 9px; font-size: 0.88rem; font-family: inherit; min-width: 130px;
}
.admin-create .admin-active { display: inline-flex; align-items: center; gap: 6px; font-size: 0.85rem; color: #374151; min-width: auto; }
.admin-create .primary, .admin-page-edit .primary {
  appearance: none; border: none; background: #2563eb; color: #fff; padding: 10px 16px; border-radius: 9px; font-weight: 700; cursor: pointer;
}
.admin-create .primary:hover, .admin-page-edit .primary:hover { background: #1d4ed8; }
.admin-msg { margin: 10px 0 0; font-size: 0.86rem; min-height: 1em; }
.admin-msg.err { color: #b91c1c; }
.admin-msg.ok { color: #047857; }
.admin-hint { margin: 0 0 12px; color: #6b7280; font-size: 0.88rem; }
.admin-pages { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
.admin-page-edit { display: flex; flex-direction: column; gap: 8px; }
.admin-page-edit label { font-weight: 700; color: #374151; font-size: 0.9rem; }
.admin-page-edit textarea { width: 100%; box-sizing: border-box; padding: 10px 12px; border: 1px solid #d1d5db; border-radius: 10px; font-family: inherit; font-size: 0.85rem; line-height: 1.5; resize: vertical; }
.admin-page-edit .primary { align-self: flex-start; }
@media (max-width: 800px) { .admin-pages { grid-template-columns: 1fr; } }

.results-scroll {
  flex: 1;
  overflow: auto;
  min-height: 0;
}
.results-panel .pagination { border-top: 1px solid #e5e7eb; }

/* checkbox column */
.check-col {
  width: 44px;
  text-align: center;
  padding-left: 14px !important;
  padding-right: 8px !important;
}
.row-check, .all-check { width: 16px; height: 16px; cursor: pointer; accent-color: #16a34a; }
tbody tr.selected { background: #ecfdf5 !important; }

/* NEW HIRE pill (Contact Crawler — records detected by the Sitemap Monitor) */
.newhire-pill { display: inline-block; background: #dcfce7; color: #166534; font-size: 0.7rem; font-weight: 700; padding: 2px 8px; border-radius: 999px; letter-spacing: 0.03em; }

/* ===================== Sitemap Monitor (Admin section) ===================== */
.mon-form { display: flex; gap: 10px; align-items: flex-end; flex-wrap: wrap; margin: 12px 0 6px; }
.mon-form label { display: flex; flex-direction: column; font-size: 13px; gap: 4px; flex: 1 1 520px; }
.mon-form textarea { padding: 9px 11px; font-size: 13.5px; min-height: 64px; resize: vertical; font-family: inherit; border: 1px solid #d1d5db; border-radius: 10px; }
.mon-status { font-size: 13.5px; margin: 10px 0; padding: 10px 12px; background: #f3f4f6; border-radius: 8px; }
.mon-status.err { background: #fde8e8; color: #9b1c1c; }
.mon-stats { display: flex; gap: 18px; flex-wrap: wrap; font-size: 13px; margin: 6px 0 14px; color: #374151; }
.mon-stats b { color: #111827; }
.mon-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin: 8px 0 6px; }
h3.mon-sec { margin: 22px 0 8px; font-size: 15px; }
table.mon-table { width: 100%; border-collapse: collapse; font-size: 13px; }
table.mon-table th, table.mon-table td { text-align: left; padding: 7px 9px; border-bottom: 1px solid #eceef1; vertical-align: top; }
table.mon-table th { position: sticky; top: 0; background: #fafbfc; font-weight: 600; }
table.mon-table td.url a, table.mon-table td.u a { word-break: break-all; }
.mon-tablewrap { max-height: 42vh; overflow: auto; border: 1px solid #eceef1; border-radius: 8px; }
.mon-empty { color: #6b7280; padding: 20px; text-align: center; }
.pill { display: inline-block; padding: 1px 7px; border-radius: 999px; font-size: 11.5px; }
.pill.new { background: #dcfce7; color: #166534; }
.pill.dep { background: #fee2e2; color: #991b1b; }
.pill.rea { background: #fef3c7; color: #92400e; }
.pill.active { background: #eef2ff; color: #3730a3; }
.pill.paused { background: #e5e7eb; color: #4b5563; }
.mon-actions .mini { font-size: 12px; padding: 5px 10px; border: 1px solid #d1d5db; background: #f9fafb; border-radius: 8px; cursor: pointer; }
.mon-actions .mini:hover { background: #eef2ff; }
.linklike { background: none; border: none; color: #2563eb; cursor: pointer; font-size: 12px; padding: 0 4px; }
.linklike:hover { text-decoration: underline; }

@media (max-width: 900px) {
  .search-shell { height: auto; min-height: 100vh; }
  .search-layout { grid-template-columns: 1fr; }
}
