*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --surface-2: #252836;
  --border: #2e3245;
  --text: #e2e4f0;
  --text-muted: #7a7f9a;
  --primary: #6c63ff;
  --primary-hover: #574fd6;
  --success: #2dd4a0;
  --error: #f06060;
  --warning: #f5a623;
  --radius: 10px;
  --shadow: 0 4px 24px rgba(0,0,0,0.4);
}

:root[data-theme="light"] {
  --bg: #f5f6fa;
  --surface: #ffffff;
  --surface-2: #eef0f6;
  --border: #dbdfe8;
  --text: #1c1e29;
  --text-muted: #6b7086;
  --shadow: 0 4px 24px rgba(20,22,40,0.08);
}

body {
  background: var(--bg);
  color: var(--text);
  font-family: 'Segoe UI', system-ui, sans-serif;
  font-size: 14px;
  line-height: 1.6;
  min-height: 100vh;
  padding: 24px 16px;
}

.container {
  margin: 0 auto;
}

header {
  text-align: center;
  margin-bottom: 32px;
}

.theme-toggle {
  width: 36px;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 999px;
  color: var(--text);
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  transition: border-color 0.2s;
}
.theme-toggle:hover { border-color: var(--primary); }

header h1 {
  font-size: 2rem;
  font-weight: 700;
  background: linear-gradient(135deg, #6c63ff, #a78bfa);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle { color: var(--text-muted); margin-top: 6px; }

/* Nav bar */
.nav-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-top: 16px;
  gap: 12px;
}
.nav-tabs { display: flex; gap: 2px; }
.nav-tab {
  background: none;
  border: none;
  color: var(--text-muted);
  padding: 6px 14px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  font-weight: 500;
  transition: background 0.15s, color 0.15s;
}
.nav-tab:hover { color: var(--text); background: rgba(255,255,255,0.05); }
.nav-tab--active { color: var(--primary); background: rgba(108,99,255,0.12); }
.nav-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }
.nav-user { color: var(--text-muted); font-size: 13px; }

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 28px;
  box-shadow: var(--shadow);
  margin-bottom: 24px;
}

.hidden { display: none !important; }

.form-group { margin-bottom: 16px; }
label { display: block; font-weight: 600; margin-bottom: 8px; color: var(--text); }
.hint { font-weight: 400; color: var(--text-muted); font-size: 12px; }

textarea,
input[type="text"],
input[type="password"],
select {
  width: 100%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  color: var(--text);
  padding: 10px 14px;
  font-size: 14px;
  outline: none;
  transition: border-color 0.2s;
}
textarea {
  font-family: 'Consolas', monospace;
  font-size: 13px;
  resize: vertical;
  padding: 12px 14px;
}
textarea:focus,
input[type="text"]:focus,
input[type="password"]:focus,
select:focus { border-color: var(--primary); }

select { cursor: pointer; }
select option { background: var(--surface-2); }

.model-info {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 10px;
}

.url-count {
  text-align: right;
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 6px;
}

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 10px 22px;
  border: none;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s, opacity 0.2s;
}
.btn:disabled { opacity: 0.45; cursor: not-allowed; }
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:not(:disabled):hover { background: var(--primary-hover); }
.btn-secondary { background: var(--surface-2); color: var(--text); border: 1px solid var(--border); }
.btn-secondary:hover { border-color: var(--primary); color: var(--primary); }
.btn-outline { background: transparent; color: var(--text-muted); border: 1px solid var(--border); }
.btn-outline:hover { border-color: var(--text-muted); color: var(--text); }
.btn-sm { padding: 5px 12px; font-size: 12px; }
.btn-danger { background: var(--error); color: #fff; }
.btn-danger:not(:disabled):hover { opacity: 0.85; }

/* Panel-specific spacing */
#panel-login h2 { margin-bottom: 20px; }
#panel-input .perm-label { margin-bottom: 16px; }
#panel-detail .results-header { margin-bottom: 20px; }
#detail-url-title { margin-bottom: 4px; }
#detail-job-meta { color: var(--text-muted); font-size: 13px; }
#cleanup-edit-detail-url { margin: -8px 0 16px; font-size: 13px; color: var(--text-muted); }
.user-create-form h3 { margin-bottom: 16px; }

/* Login */
.login-error {
  color: var(--error);
  font-size: 13px;
  margin-bottom: 12px;
}

/* Progress */
.progress-bar-wrap {
  background: var(--surface-2);
  border-radius: 999px;
  height: 10px;
  overflow: hidden;
  margin: 16px 0 8px;
}
progress#progress-bar {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 100%;
  border: none;
  display: block;
  background: transparent;
}
progress#progress-bar::-webkit-progress-bar { background: transparent; }
progress#progress-bar::-webkit-progress-value {
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
  transition: width 0.4s ease;
}
progress#progress-bar::-moz-progress-bar {
  background: linear-gradient(90deg, var(--primary), var(--success));
  border-radius: 999px;
}
#progress-text { color: var(--text-muted); font-size: 13px; }
.job-id-label { color: var(--text-muted); font-size: 12px; margin-top: 10px; }
.job-id-label code { color: var(--primary); background: var(--surface-2); padding: 2px 6px; border-radius: 4px; }

/* Results */
.results-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 16px;
}
.export-buttons { display: flex; gap: 8px; flex-wrap: wrap; }
.stats { color: var(--text-muted); font-size: 13px; margin-bottom: 16px; }
.stats span { color: var(--text); font-weight: 600; }

.table-wrap { overflow-x: auto; border-radius: 8px; border: 1px solid var(--border); }
#panel-jobs .table-wrap { max-height: calc(100vh - 320px); overflow-y: auto; }
#panel-results {
  display: flex;
  flex-direction: column;
  max-height: calc(100vh - 180px);
  overflow: hidden;
}
#panel-results .table-wrap { flex: 1; overflow-y: auto; min-height: 0; }
table { width: 100%; border-collapse: collapse; font-size: 13px; }
thead th {
  background: var(--surface-2);
  color: var(--text-muted);
  text-align: left;
  padding: 10px 12px;
  white-space: nowrap;
  font-weight: 600;
  letter-spacing: 0.03em;
  text-transform: uppercase;
  font-size: 11px;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 1;
}
tbody tr { border-bottom: 1px solid var(--border); transition: background 0.15s; }
tbody tr:last-child { border-bottom: none; }
tbody tr:hover { background: var(--surface-2); }
tbody td { padding: 9px 12px; vertical-align: top; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
tbody td.wrap { white-space: normal; word-break: break-word; overflow: visible; text-overflow: unset; max-width: none; }

/* Ergebnis-Tabelle: Spaltenbreiten */
#results-table { min-width: 1300px; }
#results-table td:nth-child(1),
#results-table th:nth-child(1) { min-width: 160px; max-width: 220px; }  /* URL */
#results-table td:nth-child(2),
#results-table th:nth-child(2) { min-width: 140px; max-width: 200px; }  /* Name */
#results-table td:nth-child(3),
#results-table th:nth-child(3) { min-width: 200px; }                    /* Adresse */
#results-table td:nth-child(4),
#results-table th:nth-child(4) { min-width: 120px; max-width: 160px; }  /* Telefon */
#results-table td:nth-child(5),
#results-table th:nth-child(5) { min-width: 180px; max-width: 240px; }  /* E-Mail */
#results-table td:nth-child(6),
#results-table th:nth-child(6) { min-width: 160px; max-width: 220px; }  /* Rechtl. Name */
#results-table td:nth-child(7),
#results-table th:nth-child(7) { min-width: 80px;  max-width: 90px;  }  /* Impressum */
#results-table td:nth-child(8),
#results-table th:nth-child(8) { min-width: 220px; }                    /* Leistungen */
#results-table td:nth-child(9),
#results-table th:nth-child(9) { min-width: 150px; }                    /* Social Media */
#results-table td:nth-child(10),
#results-table th:nth-child(10){ min-width: 110px; max-width: 130px; }  /* Status */
td a { color: var(--primary); text-decoration: none; }
td a:hover { text-decoration: underline; }

.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
}
.badge-ok      { background: rgba(45,212,160,0.15);  color: var(--success); }
.badge-error   { background: rgba(240,96,96,0.15);   color: var(--error);   }
.badge-missing { background: rgba(245,166,35,0.15);  color: var(--warning); }
.badge-excluded { background: rgba(148,158,180,0.15); color: var(--text-muted); }
.warn-icon { color: var(--warning); cursor: help; }
.badge-role    { background: rgba(108,99,255,0.15);  color: var(--primary); }
.badge-pending { background: rgba(245,166,35,0.15);  color: var(--warning); }
.badge-running { background: rgba(108,99,255,0.15);  color: var(--primary); }
.badge-cancelled { background: rgba(148,158,180,0.15); color: var(--text-muted); }
.badge-failed  { background: rgba(240,96,96,0.15);   color: var(--error);   }
.badge-info    { background: rgba(45,212,160,0.12);  color: var(--success); }
.badge-lead      { background: rgba(45,212,160,0.15); color: var(--success); }
.badge-duplicate { background: rgba(148,158,180,0.2); color: var(--text-muted); }

/* Duplicate-group row highlighting — cyclic palette, matched by canonical_url */
#results-table tbody tr[data-canonical-url]:not([data-canonical-url=""]) { border-left: 3px solid transparent; }
.group-color-0 { border-left-color: #6c63ff !important; }
.group-color-1 { border-left-color: #2dd4a0 !important; }
.group-color-2 { border-left-color: #f5a623 !important; }
.group-color-3 { border-left-color: #f06060 !important; }
.group-color-4 { border-left-color: #29b6f6 !important; }
.group-color-5 { border-left-color: #ab47bc !important; }

.dedup-actionbar {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--primary);
  border-radius: 6px;
  font-size: 13px;
}
.dedup-actionbar span { color: var(--text); }
.col-select { width: 2rem; text-align: center; }
td.col-select { text-align: center; }

.job-id-code {
  font-size: 11px;
  color: var(--text-muted);
  background: var(--surface-2);
  padding: 2px 6px;
  border-radius: 4px;
}
.job-id-code--link {
  border: none;
  cursor: pointer;
  font-family: inherit;
}
.job-id-code--link:hover {
  color: var(--text);
  background: var(--surface-3, var(--border));
}

/* Error panel */
.error-box { text-align: center; padding: 16px; }
.error-box h2 { color: var(--error); margin-bottom: 12px; }
#error-message { color: var(--text-muted); margin-bottom: 20px; }

/* Users panel */
.users-list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.user-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.user-row:last-child { border-bottom: none; }
.user-row:hover { background: var(--surface-2); }
.user-name { flex: 1; font-weight: 600; }
.user-perms { color: var(--text-muted); font-size: 12px; min-width: 120px; }
.users-section-heading { margin: 20px 0 4px; padding: 0 16px; font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: .06em; color: var(--text-muted); }
.user-create-form { background: var(--surface-2); margin-top: 20px; }

/* Blacklist panel */
/* align-items: flex-end (not center, the default for a single-line input)
   so the button sits against the textarea's bottom edge as it grows with
   pasted lines, rather than staying pinned to its vertical center. */
.blacklist-add-row { display: flex; align-items: flex-end; gap: 10px; margin-bottom: 8px; }
.blacklist-add-row .filter-input { flex: 1; }
.blacklist-add-textarea { resize: vertical; min-height: 38px; font-family: inherit; line-height: 1.5; }
.blacklist-add-row .btn { flex: none; }
.blacklist-list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.blacklist-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.blacklist-row:last-child { border-bottom: none; }
.blacklist-row:hover { background: var(--surface-2); }
.blacklist-url { flex: 1; font-weight: 600; overflow-wrap: anywhere; }
.blacklist-meta { color: var(--text-muted); font-size: 12px; white-space: nowrap; }
/* Per-URL bulk-add outcome (see renderBlacklistAddSummary) — only the
   skipped/invalid ones are listed (the added ones already show up in the
   list re-render below), so this stays short even for a large paste. */
.blacklist-add-summary {
  margin-bottom: 16px;
  padding: 10px 14px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 13px;
}
.blacklist-add-summary-line { margin-bottom: 6px; }
.blacklist-add-summary ul { list-style: none; }
.blacklist-add-summary li { padding: 2px 0; color: var(--text-muted); overflow-wrap: anywhere; }
.blacklist-add-summary li .warn-icon { color: var(--warning); margin-right: 4px; }

.perm-group { display: flex; gap: 20px; }
.perm-label { display: flex; align-items: center; gap: 6px; font-weight: 400; cursor: pointer; }
.perm-label input[type="checkbox"] { width: auto; cursor: pointer; }

/* Detail panel */
.detail-card {
  border: 1px solid var(--border);
  border-radius: 8px;
  overflow: hidden;
  margin-bottom: 16px;
}
.detail-row {
  display: grid;
  grid-template-columns: 160px 1fr;
  gap: 12px;
  border-bottom: 1px solid var(--border);
  padding: 10px 16px;
  align-items: start;
}
.detail-row:last-child { border-bottom: none; }
.detail-label { color: var(--text-muted); font-size: 13px; padding-top: 1px; }
.field-changed { background: rgba(245,166,35,0.10); }
.field-changed .detail-label { color: var(--warning); }
.changed-marker { font-size: 9px; vertical-align: middle; color: var(--warning); }
.changed-marker--edited { font-size: 12px; color: var(--primary); cursor: help; }
.services-rest { display: none; }
.services-rest--visible { display: inline; }
.services-toggle {
  background: none;
  border: none;
  color: var(--primary);
  cursor: pointer;
  font-size: 12px;
  padding: 0 0 0 2px;
  text-decoration: underline;
}
.services-toggle:hover { color: var(--primary-hover); }
.detail-section-title { margin: 24px 0 10px; font-size: 14px; font-weight: 600; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.detail-version-header {
  padding: 8px 16px;
  background: var(--surface-2);
  font-size: 12px;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border);
}
.detail-location-heading {
  padding: 6px 16px;
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  border-bottom: 1px solid var(--border);
}

/* PublisherSourceId column */
th.col-row-num, td.row-num { width: 140px; min-width: 100px; max-width: 180px; }
td.row-num {
  color: var(--text-muted); font-size: 11px; text-align: left; padding-right: 4px; user-select: none;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}

/* Leftmost running-number column on the Analyse tables (#analyse-job-table,
   #import-rows-table) — narrow and muted so it reads as a position marker,
   not data. `:not(:only-child)` excludes the loading/error/empty-state rows,
   which are a single <td colspan="..."> spanning the whole table width, not
   this column. */
#analyse-job-table th:first-child, #analyse-job-table td:first-child:not(:only-child),
#import-rows-table th:first-child, #import-rows-table td:first-child:not(:only-child) {
  width: 1%;
  white-space: nowrap;
  text-align: right;
  color: var(--text-muted);
  font-size: 11px;
}

/* Results filter */
.results-filter {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.url-search-bar {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  margin-top: 12px;
  color: var(--text-muted);
  font-size: 13px;
}
.filter-input {
  flex: 1;
  min-width: 180px;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
}
.filter-input::placeholder { color: var(--text-muted); }
.filter-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}

/* Logs panel */
.logs-controls { display: flex; align-items: center; gap: 8px; }
.logs-filter-select {
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 6px 10px;
  font-size: 13px;
  cursor: pointer;
}
.log-details {
  margin-top: 6px;
  padding: 8px;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 11px;
  color: var(--text-muted);
  white-space: pre-wrap;
  word-break: break-all;
  max-height: 200px;
  overflow-y: auto;
}
.cleanup-intro-hint {
  margin-bottom: 20px;
}
.cleanup-results {
  margin-top: 16px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}
.cleanup-column-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}
.cleanup-column h3 {
  margin: 0 0 4px;
  font-size: 14px;
}
.cleanup-list {
  margin: 0;
  padding: 8px 12px;
  list-style: none;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 12px;
  color: var(--text);
  font-family: monospace;
  max-height: 600px;
  overflow-y: auto;
}
.cleanup-list li {
  padding: 2px 0;
  border-bottom: 1px solid var(--border);
  word-break: break-word;
}
.cleanup-list li:last-child {
  border-bottom: none;
}
@media (max-width: 700px) {
  .cleanup-results {
    grid-template-columns: 1fr;
  }
}

/* Clean Up: Bearbeitungsmodus */
.cleanup-mode-toggle { display: flex; gap: 8px; }

/* Analyse: Job-Auswertung (see renderJobStats) */
.job-stats-toolbar { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; margin-bottom: 8px; }
.job-stats-toolbar label { font-size: 13px; color: var(--text-muted); }
.job-stats { display: flex; flex-direction: column; gap: 10px; margin-top: 12px; }
.job-stats-table-wrap { max-height: 420px; overflow-y: auto; }
.job-stats-table-wrap td { vertical-align: top; }
.job-stats-message { word-break: break-word; min-width: 240px; }
.job-stats-urls-modal-list {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 12px;
  border: 1px solid var(--border);
  border-radius: 6px;
  background: var(--surface-2);
}
.job-stats-urls-modal-list-item {
  padding: 6px 10px;
  font-size: 12px;
  word-break: break-all;
  border-bottom: 1px solid var(--border);
}
.job-stats-urls-modal-list-item:last-child { border-bottom: none; }
.cleanup-edit-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
@media (max-width: 700px) {
  .cleanup-edit-columns { grid-template-columns: 1fr; }
}
.cleanup-edit-col-heading h3 { margin: 0 0 8px; font-size: 14px; }
.cleanup-edit-search {
  width: 100%;
  margin-bottom: 10px;
  padding: 6px 10px;
}
.cleanup-edit-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 10px;
  align-content: start;
}
.cleanup-edit-tile {
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 10px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 6px;
  text-align: left;
  cursor: pointer;
  color: var(--text);
  font: inherit;
}
.cleanup-edit-tile:hover { border-color: var(--primary); }
.cleanup-edit-tile-name {
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  color: inherit;
  cursor: pointer;
  font: inherit;
  text-align: left;
}
.cleanup-edit-tile-count { font-size: 12px; color: var(--warning); }
.cleanup-edit-tile-meta { font-size: 12px; color: var(--text-muted); }
.cleanup-edit-tile--done { cursor: default; align-items: flex-start; }

.cleanup-edit-review-filter-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin: 8px 0;
  padding: 6px 10px;
  background: var(--surface-2);
  border: 1px solid var(--primary);
  border-radius: 4px;
  font-size: 12px;
}

/* Bearbeitungsansicht (panel-cleanup-edit-detail) */
.cleanup-edit-detail-fields {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 12px;
}
.cleanup-edit-field {
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 12px 14px;
  background: var(--surface-2);
}
.cleanup-edit-field--resolved { border-color: var(--success); }
.cleanup-edit-field-label { font-weight: 600; margin-bottom: 6px; }
.cleanup-edit-field-values {
  display: flex;
  flex-direction: column;
  gap: 4px;
  font-size: 13px;
  color: var(--text-muted);
  margin-bottom: 8px;
}
.cleanup-edit-field-actions { display: flex; flex-direction: column; gap: 14px; }
.cleanup-edit-reason-row {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding-bottom: 10px;
  border-bottom: 1px solid var(--border);
}
.cleanup-edit-reason-row:last-of-type { border-bottom: none; padding-bottom: 0; }
.cleanup-edit-reason-label { font-size: 12px; color: var(--text-muted); }
.cleanup-edit-reason-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.cleanup-edit-reason-select { flex: 1 1 200px; min-width: 160px; max-width: 320px; }
.cleanup-edit-reason-custom-input { flex: 1 1 160px; }
.cleanup-edit-reason-controls .btn { flex: none; margin-left: auto; }
.cleanup-edit-field-actions > .btn-cleanup-field-neither { align-self: flex-start; }
.cleanup-edit-field-status {
  margin-top: 8px;
  font-size: 12px;
  color: var(--success);
}
.cleanup-edit-field-reason { color: var(--text-muted); }

/* "Gründe verwalten" — pool-level table within the Bearbeitungsmodus
   (#cleanup-edit-view), independent of any single entry. */
.cleanup-edit-reasons-section { margin-top: 28px; }
.cleanup-edit-reasons-tables {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 24px;
}
@media (max-width: 900px) {
  .cleanup-edit-reasons-tables { grid-template-columns: 1fr; }
}
.cleanup-edit-reasons-table-col h4 { margin: 0 0 8px; font-size: 13px; }
.cleanup-edit-reasons-table {
  width: 100%;
  border-collapse: collapse;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  margin-bottom: 8px;
}
.cleanup-edit-reasons-table th {
  text-align: left;
  font-size: 12px;
  color: var(--text-muted);
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.cleanup-edit-reasons-table td {
  padding: 8px 12px;
  border-bottom: 1px solid var(--border);
}
.cleanup-edit-reasons-table tr:last-child td { border-bottom: none; }
.cleanup-edit-reasons-text { overflow-wrap: anywhere; }
.cleanup-edit-reasons-actions { width: 1%; white-space: nowrap; text-align: right; }
.cleanup-edit-reasons-add-row { display: flex; gap: 8px; }
.cleanup-edit-reasons-add-row .filter-input { flex: 1; }
.cleanup-edit-detail-actions { margin-top: 20px; }

/* Analyse panel */
/* The Job and Import tables grow with their content instead of being capped
   to the viewport — a long comparison scrolls the whole page rather than
   being squeezed into an internal scroll box. Only horizontal overflow
   (the Import table's columns come from the uploaded file, so there can be
   many) still scrolls within its own wrap. */
.analyse-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.analyse-col {
  /* Grid items default to min-width:auto, so a wide table would otherwise
     force this column past its 1fr share instead of scrolling internally. */
  min-width: 0;
  display: flex;
  flex-direction: column;
}
.analyse-job-table-wrap { max-width: 100%; overflow-x: auto; }
/* The two Analyse tables are separate <table> elements laid out
   independently, so row N in one has no natural reason to be the same
   height as row N in the other. Left to content, the Import table's
   "Vergleich"-button (~49px with padding) is taller than every Job-table
   cell (plain text/badge, ~39px) — once row heights differ, every row below
   the tall one drifts out of alignment between the two tables. Forcing a
   shared explicit height — comfortably above the button's own height — on
   every cell in both tables (`height` acts as a minimum in table layout, so
   shorter content never shrinks below it) keeps every row pinned to the
   same height on both sides regardless of what it contains. */
#analyse-job-table tbody td,
#import-rows-table tbody td {
  height: 54px;
  vertical-align: middle;
  /* Enforced here, at the table level, rather than left to each cell to not
     opt into `.wrap` — an ID selector always outranks a class selector
     regardless of source order, so this overrides `.wrap`'s white-space:
     normal even if some cell in either table carries that class (as the
     socials cell once did, wrapping onto a second line and, since these two
     tables only stay row-aligned via the shared height above, dragging every
     row below it out of alignment with the other table). Both table wraps
     scroll horizontally (see .analyse-job-table-wrap), so a wide column from
     long unwrapped content is fine — unlike wrapped-and-hidden content, it's
     never actually inaccessible, just off-screen until scrolled to. */
  white-space: nowrap;
  overflow: visible;
  text-overflow: unset;
}
/* Same reasoning as above, applied to the header row: the Job table's
   fixed short labels and the Import table's dynamic (often longer) column
   names don't reliably produce the same natural header height, so without
   this the two theads can differ by a few px and throw every row below out
   of alignment before a single body row is even involved. */
#analyse-job-table thead th,
#import-rows-table thead th {
  height: 40px;
}
/* Copy-all-URLs button embedded in the Job table's URL column header (see
   renderAnalyseJobTable) — sized to fit inside the shared thead height above
   rather than the normal .btn-sm, and text-transform reset since it inherits
   thead th's uppercase/letter-spacing otherwise. */
.th-copy-btn {
  margin-left: 8px;
  padding: 3px 9px;
  font-size: 10px;
  text-transform: none;
  letter-spacing: normal;
  vertical-align: middle;
}
/* Aktionen column of the Import Rows table — "Vergleichen" and/or "Blacklist"
   (see renderImportRowsTable) can both appear on the same row, so they need
   a gap between them; each .btn is inline-flex on its own and butts straight
   up against the next one without this. flex-wrap is explicitly nowrap, not
   the default: the Job and Import tables share one fixed row height (see the
   height rule on #analyse-job-table/#import-rows-table td above) precisely
   so their rows stay aligned, and two buttons wrapping onto a second line
   here would grow this row past that shared height and throw every row
   below it out of alignment between the two tables. The column simply grows
   wider instead — both table wraps already scroll horizontally for exactly
   this reason (see the height rule's own comment). */
.row-actions { display: inline-flex; align-items: center; gap: 6px; flex-wrap: nowrap; white-space: nowrap; }
/* Icon-only note button in the Analyse tables' Notiz column/Aktionen cell
   (see noteButtonHtml) — narrower than a normal .btn-sm so it doesn't widen
   the row just to hold one glyph; --active tints it once a note exists, so a
   row with one is visible at a glance without opening the modal. */
.btn-note {
  padding: 3px 8px;
  font-size: 13px;
  line-height: 1;
}
.btn-note--active {
  border-color: var(--primary);
  color: var(--primary);
}
/* Flag button (see flagButtonHtml) — same sizing as .btn-note, sits right next
   to it in the same cell. --active tints it once flagged (review or done);
   the button itself is disabled once "done" (see flagButtonHtml). */
.btn-flag {
  padding: 3px 8px;
  font-size: 13px;
  line-height: 1;
  margin-left: 4px;
}
.btn-flag--active {
  border-color: var(--warning);
  color: var(--warning);
}
.note-modal-textarea {
  width: 100%;
  min-height: 100px;
  margin-top: 4px;
  padding: 8px;
  box-sizing: border-box;
  font-family: inherit;
  font-size: 13px;
  resize: vertical;
  background: var(--surface-2);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: var(--radius);
}
#import-batches-view { flex: none; }
#import-rows-view { flex: none; display: flex; flex-direction: column; }
/* Placeholder row keeping a Job row's position when no Import row matches it
   (see alignImportRowsToJob) — a faint stripe so it reads as "nothing here",
   not a rendering glitch. Cells carry a non-breaking space (see
   renderImportRowsTable) rather than staying empty, so the row's line height
   — and with it the row's overall height — matches a normal text row instead
   of collapsing shorter. */
#import-rows-table tr.analyse-row-blank td {
  background: repeating-linear-gradient(45deg, var(--surface-2), var(--surface-2) 6px, transparent 6px, transparent 12px);
}
/* Both columns' headings share this row layout — the diff-filter dropdown
   sits right of the "Aktuelle Daten" <h3>, the Import side's back
   button/title sit right of the "Import" <h3> — so both columns' tables
   start at the same height and line up side by side. A plain min-height
   doesn't actually guarantee that: the left side always renders its
   bordered/padded filter button (~32px tall), while the Import side is often
   just the bare <h3> plus an empty .hint span (~18px) when no batch is open
   — two independent flex boxes each sized to their own content, so they end
   up different heights unless pinned to the same explicit one (comfortably
   above the filter button's own height, same `height`-as-minimum reasoning
   as the tables' shared row height below). */
.analyse-col-heading {
  display: flex;
  align-items: center;
  gap: 10px;
  margin: 0 0 8px;
  height: 34px;
}
.analyse-col-heading h3 { margin: 0; font-size: 14px; color: var(--text-muted); flex: none; }
.analyse-col-heading .hint { margin: 0; }
.analyse-col-heading .analyse-row-count { flex: none; white-space: nowrap; }
/* Abgleichsergebnis panel — collapsible (see btnImportCompareToggle) so an
   evaluation with many stats (name + address_normalized's 4 fields) can be
   tucked away again once read, instead of just adding to the page's length. */
.import-compare-summary {
  flex: none;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
  margin-bottom: 16px;
  overflow: hidden;
}
.import-compare-summary-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 10px;
  padding: 10px 14px;
  background: none;
  border: none;
  color: var(--text);
  font: inherit;
  font-weight: 600;
  text-align: left;
  cursor: pointer;
}
.import-compare-summary-toggle:hover { background: var(--surface); }
.import-compare-summary-toggle-icon {
  color: var(--text-muted);
  font-size: 11px;
  transition: transform 0.15s ease;
}
.import-compare-summary.collapsed .import-compare-summary-toggle-icon { transform: rotate(-90deg); }
.import-compare-summary-body {
  padding: 0 14px 14px;
}
.import-compare-summary.collapsed .import-compare-summary-body { display: none; }
/* DB-side and Import-side context tiles (see runImportCompare's contextRow)
   sit side by side as two half-width columns — like Bootstrap's col-6 —
   instead of one stacked after the other, so the two independent groups of
   numbers aren't competing for the same column width. Collapses to one
   col-12 stacked column under the same breakpoint the two Analyse tables
   themselves stack at (see .analyse-columns below), since horizontal space
   is already tight by then. */
.import-compare-context-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-bottom: 10px;
}
@media (max-width: 900px) {
  .import-compare-context-row { grid-template-columns: 1fr; }
}
/* Stats sit side by side in a wrapping grid instead of one full-width line
   each — more compact and easier to scan at a glance. */
.import-compare-stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 10px;
}
.import-compare-stat {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.import-compare-stat-value { font-size: 22px; font-weight: 700; line-height: 1.15; }
.import-compare-stat-value.stat-good { color: var(--success); }
.import-compare-stat-value.stat-mid { color: var(--warning); }
.import-compare-stat-value.stat-bad { color: var(--error); }
.import-compare-stat-label { font-size: 12px; font-weight: 600; color: var(--text); }
.import-compare-stat-sub { font-size: 11px; font-weight: 400; color: var(--text-muted); }
.import-compare-stat--note {
  grid-column: 1 / -1;
  background: none;
  border-style: dashed;
  font-weight: 400;
  color: var(--text-muted);
}
.import-compare-stats-heading {
  grid-column: 1 / -1;
  margin-top: 6px;
  padding-top: 8px;
  border-top: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  font-weight: 700;
}
.import-compare-stats-heading:first-child { margin-top: 0; padding-top: 0; border-top: none; }
/* "Gründe"-Aufstellung im Abgleichsergebnis (runImportCompare) — Fließtext-
   Liste statt Kachelraster, spannt daher die volle Breite des umgebenden
   .import-compare-stats-grid. */
.import-compare-reasons-list {
  grid-column: 1 / -1;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}
.import-compare-reasons-field {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 10px 12px;
}
.import-compare-reasons-field-heading { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 6px; }
.import-compare-reasons-items { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 4px; }
.import-compare-reasons-items li { font-size: 12px; color: var(--text-muted); display: flex; align-items: center; gap: 6px; }
.import-compare-reasons-tag {
  flex: none;
  font-size: 10px;
  font-weight: 600;
  padding: 1px 6px;
  border-radius: 999px;
  background: rgba(108,99,255,0.15);
  color: var(--primary);
}
/* Import Rows table: name cell that deviates from the matching Job entry's
   name (see renderImportRowsTable's jobNameByUrl comparison) — same warning
   tint as .field-changed, scoped to the single cell instead of a whole row. */
.import-cell-diff {
  background: rgba(245,166,35,0.18);
  border-radius: 4px;
}
/* Diff filter (see #analyse-diff-filter in app.js): every row carries its
   own data-diff-status ("match"/"mismatch", or absent for rows with no
   Import counterpart to compare against) plus, when it has any deviation, a
   space-separated data-mismatch-fields list of exactly which of
   ANALYSE_ROW_DIFF_FIELDS deviate — kept on each <tr> for the row-count
   labels (see updateAnalyseJobRowCount/updateImportRowsRowCount) even though
   actual hiding is now decided in JS while building each row
   (diffFilterRowClass), not via a CSS attribute selector like this used to
   be — several checkboxes AND/OR-combined isn't expressible as one CSS
   attribute value the way a single-select's one filter was. */
/* Always visible (not tucked behind a dropdown) so which checkboxes are
   currently active is visible at a glance instead of needing to open a
   panel to check. Sits in its own full-width row above both tables rather
   than inside .analyse-col-heading — that row's height is pinned (see its
   own comment) to keep both columns' headings aligned, and a full row of
   these checkboxes wrapping there would blow past that. */
.analyse-diff-filter-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 14px;
  margin-bottom: 12px;
  padding: 8px 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  border-radius: 8px;
}
.analyse-diff-filter-bar-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-muted);
  flex: none;
}
.analyse-diff-filter-bar-sep {
  flex: none;
  width: 1px;
  align-self: stretch;
  background: var(--border);
}
.analyse-diff-filter-bar label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  font-weight: 400;
  cursor: pointer;
  white-space: nowrap;
}
.analyse-diff-filter-bar label input { flex: none; }
/* "Entscheidung"-Gruppe (Job-/Import-Wert korrekt, Weder noch) — visuell von
   den übrigen Diff-Filtern abgesetzt, damit klar ist, dass sie nach dem
   Bewertungssystem-Ergebnis statt nach Feld-Abweichungen filtert. */
.analyse-diff-filter-decision-group {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 4px 12px;
  padding: 4px 10px;
  background: rgba(108,99,255,0.12);
  border-radius: 6px;
}
.analyse-diff-filter-decision-group .analyse-diff-filter-bar-label {
  color: var(--primary);
  padding: 0 0 3px;
}
.analyse-diff-filter-decision-group label { padding: 3px 0; }
.analyse-diff-filter-decision-field-select { font-size: 13px; padding: 3px 6px; }
.analyse-diff-filter-reason-input { font-size: 13px; padding: 3px 6px; width: 160px; }
@media (max-width: 900px) {
  .analyse-columns { display: flex; flex-direction: column; }
  .analyse-col { flex: 1; min-height: 0; }
}

/* Import panel */
.import-upload-row {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 16px;
}
.import-batches-list { border: 1px solid var(--border); border-radius: 8px; overflow: hidden; }
.import-batch-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--border);
}
.import-batch-row:last-child { border-bottom: none; }
.import-batch-row:hover { background: var(--surface-2); }
.import-batch-name { flex: 1; font-weight: 600; }
.import-batch-meta { color: var(--text-muted); font-size: 12px; min-width: 160px; }

/* Import compare panel — one table per database location (see
   buildImportCompareTable), field label + both sides in the same row. */
.import-compare-scroll {
  max-height: 75vh;
  overflow-y: auto;
  border: 1px solid var(--border);
  border-radius: 8px;
}
/* Fixed layout, so the two value columns keep exactly the same width no
   matter what they contain — the two separate tables this replaced each
   sized themselves to their own content and therefore never matched. Long
   values wrap inside their cell instead of widening it (nothing here scrolls
   horizontally, unlike the Analyse tables). */
.import-compare-table {
  width: 100%;
  table-layout: fixed;
  border-collapse: collapse;
}
.import-compare-col-field { width: 210px; }
.import-compare-table th,
.import-compare-table td {
  padding: 9px 14px;
  border-bottom: 1px solid var(--border);
  text-align: left;
  vertical-align: top;
  font-weight: 400;
  overflow-wrap: anywhere;
}
.import-compare-table tr:last-child th,
.import-compare-table tr:last-child td { border-bottom: none; }
/* Sticky, so which column is the database and which the import stays
   readable while scrolling a long field list. */
.import-compare-table thead th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.import-compare-field { color: var(--text-muted); font-size: 13px; }
/* Which import column the value in this row came from (or that none
   matched) — the whole point of the row-per-field layout is knowing what was
   actually compared against what. */
.import-compare-source {
  display: block;
  margin-top: 2px;
  font-size: 11px;
  color: var(--text-muted);
  opacity: 0.8;
  overflow-wrap: anywhere;
}
/* Same warning tint as the Detail view's changed fields (.field-changed) and
   the Analyse tables' deviating cells (.import-cell-diff), so a deviation
   looks the same everywhere. */
.import-compare-row--diff { background: rgba(245,166,35,0.12); }
.import-compare-row--diff .import-compare-field { color: var(--warning); }
.import-compare-row--match .import-compare-field { color: var(--text-muted); }
/* Separator in front of the import columns that have no database
   counterpart at all (see buildImportCompareRows' tail). */
.import-compare-section th {
  background: var(--surface-2);
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
}
.import-compare-diff-summary {
  margin: 0;
  padding: 10px 14px;
  font-size: 13px;
  border-bottom: 1px solid var(--border);
  background: var(--surface-2);
}
.import-compare-diff-summary--ok { color: var(--success); }
.import-compare-diff-summary--diff { color: var(--warning); }
/* Leistungen/Keywords coverage chips (see keywordsCoverage) — one chip per
   import Keyword, colored by whether that term actually turned up in the
   Job's Leistungen text. Deliberately not a plain-equality diff tint like
   every other field: a "miss" here means "not reflected in Leistungen", not
   "wrong data", so it gets its own visual (a chip, not a tinted cell). */
.keyword-coverage-summary { font-size: 11px; color: var(--text-muted); margin-bottom: 4px; }
.keyword-chip {
  display: inline-block;
  padding: 1px 8px;
  margin: 2px 4px 2px 0;
  border-radius: 999px;
  font-size: 12px;
  border: 1px solid var(--border);
  background: var(--surface-2);
}
.keyword-chip--match { border-color: var(--success); color: var(--success); }
.keyword-chip--miss { border-color: var(--warning); color: var(--warning); background: rgba(245,166,35,0.08); }
.keyword-chip--unknown { color: var(--text-muted); }
@media (max-width: 700px) {
  .import-compare-col-field { width: 120px; }
  .import-compare-table th,
  .import-compare-table td { padding: 8px; }
}

/* Delete-entry confirmation modal */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.55);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 16px;
}
.modal-box {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 24px;
  max-width: 440px;
  width: 100%;
}
.modal-box h3 { margin-bottom: 12px; }
.modal-message { color: var(--text-muted); font-size: 13px; word-break: break-all; }
.modal-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  justify-content: flex-end;
  margin-top: 20px;
}
.modal-box--wide {
  max-width: 560px;
}
.modal-box--wide .filter-input {
  width: 100%;
  margin-top: 12px;
  box-sizing: border-box;
}
.cleanup-delete-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  margin-top: 10px;
}
.cleanup-delete-select-all {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
}
.cleanup-delete-list {
  margin: 8px 0 0;
  padding: 4px 12px;
  list-style: none;
  background: var(--surface-2);
  border-radius: 4px;
  font-size: 12px;
  font-family: monospace;
  height: 320px;
  overflow-y: auto;
}
.cleanup-delete-list li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px solid var(--border);
}
.cleanup-delete-list li:last-child {
  border-bottom: none;
}
.cleanup-delete-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  word-break: break-word;
  min-width: 0;
  flex: 1;
}
.cleanup-delete-list input[type="checkbox"]:disabled {
  cursor: not-allowed;
}
.cleanup-delete-status {
  flex-shrink: 0;
  font-size: 11px;
  white-space: nowrap;
}

/* "N offen" in confirmTile — the number itself doubles as a button opening
   #flag-stats-open-modal, styled as inline text rather than a boxed button
   (same idea as .services-toggle) so it doesn't disrupt the tile's layout. */
.btn-flag-stats-open {
  background: none;
  border: none;
  padding: 0;
  margin: 0;
  color: var(--primary);
  cursor: pointer;
  font: inherit;
  text-decoration: underline;
}
.btn-flag-stats-open:hover { color: var(--primary-hover); }

/* #flag-stats-open-modal's list — same box as .cleanup-delete-list, but each
   row carries a name + URL instead of one monospace ID. */
.flag-stats-open-list { font-family: inherit; }
.flag-stats-open-item {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}
.flag-stats-open-item-name { font-weight: 600; }
.flag-stats-open-item-url {
  font-size: 11px;
  color: var(--text-muted);
  word-break: break-all;
}
.cleanup-delete-status--ok { color: var(--success); }
.cleanup-delete-status--fail { color: var(--error); }

@media (max-width: 600px) {
  .results-header { flex-direction: column; align-items: flex-start; }
  .btn { width: 100%; justify-content: center; }
  .nav-bar { flex-direction: column; gap: 8px; }
}
