:root {
  --primary: #0e4f63;
  --primary-700: #0a3d4d;
  --accent: #18c29c;
  --warn: #d98a00;
  --err: #d23b3b;
  --bg: #f3f5f7;
  --surface: #ffffff;
  --ink: #1c2733;
  --muted: #7b8794;
  --line: #e3e8ee;
  --sidebar: #0c1722;
  --sidebar-ink: #aebccb;
  --radius: 12px;
  --shadow: 0 1px 2px rgba(16,32,48,.06), 0 6px 18px rgba(16,32,48,.05);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--ink);
  font-size: 14px;
  line-height: 1.5;
}
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
h1, h2, h3 { margin: 0 0 .5rem; font-weight: 650; }
code, .mono { font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; }

/* Layout shell */
.shell { display: grid; grid-template-columns: 248px 1fr; min-height: 100vh; }
.sidebar {
  background: var(--sidebar);
  color: var(--sidebar-ink);
  display: flex; flex-direction: column;
  padding: 20px 16px;
  position: sticky; top: 0; height: 100vh;
}
.brand { display: flex; flex-direction: column; align-items: center; gap: 8px; margin-bottom: 28px; }
.brand-logos { display: flex; align-items: center; gap: 16px; }
.brand-caption { color: #fff; font-weight: 600; font-size: 15px; text-align: center; }
.brand-mark {
  background: var(--accent); color: #06231d; font-weight: 800;
  padding: 4px 8px; border-radius: 8px; letter-spacing: .5px; font-size: 13px;
}
.brand-text { color: #fff; font-weight: 600; }
/* SCDB wordmark: white logo on the brand background colour from the upload. */
.brand-logo {
  display: block; height: 40px; width: auto;
  background: #2c96de; padding: 7px 12px; border-radius: 8px;
}
/* Secondary product logo placed to the right of the primary logo, with its
   product caption centred underneath. Used in the sidebar, public header and
   footer; caption colour is overridden per context (see below). */
.site-brand-group { display: inline-flex; align-items: center; }
.logo2-block { display: inline-flex; flex-direction: column; align-items: center; gap: 3px; margin-left: 16px; }
.logo2-img { display: block; height: 40px; width: auto; }
.logo2-caption { font-size: 11px; line-height: 1; font-weight: 600; color: #fff; text-align: center; white-space: nowrap; }
.nav { display: flex; flex-direction: column; gap: 2px; }
.nav a {
  color: var(--sidebar-ink); padding: 10px 12px; border-radius: 8px;
  text-decoration: none; font-weight: 500;
}
.nav a:hover { background: rgba(255,255,255,.06); color: #fff; }
.nav a.active { background: var(--primary); color: #fff; }
.sidebar-foot { margin-top: auto; display: flex; flex-direction: column; gap: 6px; padding-top: 16px; }
.partner-name { color: #fff; font-weight: 600; }
.role-chip {
  display: inline-block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px;
  background: rgba(255,255,255,.08); padding: 3px 8px; border-radius: 20px; width: fit-content;
}
.lang-switch { display: flex; gap: 4px; margin-top: 8px; }
.lang-switch a {
  font-size: 11px; font-weight: 600; letter-spacing: .4px; color: rgba(255,255,255,.55);
  padding: 2px 8px; border-radius: 6px; background: rgba(255,255,255,.06); text-decoration: none;
}
.lang-switch a.active { color: #fff; background: rgba(255,255,255,.18); }

/* Subtle visual distinction between the admin and partner backends: a coloured
   accent strip on the sidebar plus a tinted role chip. Blue = admin, teal-green
   = partner (also applies while impersonating, where the area is the partner). */
.shell .sidebar { border-top: 4px solid transparent; }
.shell-admin .sidebar { border-top-color: #2f80c2; }
.shell-partner .sidebar { border-top-color: #18c29c; }
.shell-partner .nav a.active { background: #0f6b59; }
.shell-admin .role-chip { background: rgba(47,128,194,.30); color: #fff; }
.shell-partner .role-chip { background: rgba(24,194,156,.30); color: #fff; }

/* API field reference table (integration docs) */
.api-table td { vertical-align: middle; }
.api-table code { background: var(--bg); padding: 2px 6px; border-radius: 5px; font-size: 12.5px; }
.api-table .type-tag { color: var(--primary); font-weight: 600; }
.req-badge {
  display: inline-block; font-size: 11px; font-weight: 700; letter-spacing: .3px;
  padding: 2px 9px; border-radius: 20px; white-space: nowrap;
}
.req-required { background: rgba(210,59,59,.12); color: var(--err); }
.req-optional { background: var(--bg); color: var(--muted); }

/* i18n / translation editor */
.i18n-progress {
  display: block; width: 160px; height: 8px; border-radius: 6px;
  background: var(--line); overflow: hidden;
}
.i18n-progress > span { display: block; height: 100%; background: var(--accent, #3b82f6); }
.i18n-progress-inline { display: inline-block; vertical-align: middle; width: 120px; margin: 0 4px; }
.i18n-head { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.inline-form { display: inline-flex; align-items: center; margin: 0; }
.inline-form .chk { display: inline-flex; align-items: center; gap: 4px; font-size: 13px; }
.i18n-grid td { vertical-align: top; }
.i18n-grid .i18n-source { white-space: pre-wrap; color: var(--muted, #6b7280); max-width: 320px; }
.i18n-input { width: 100%; min-width: 220px; font: inherit; resize: vertical; }
.i18n-status { white-space: nowrap; }
.i18n-actions { position: sticky; bottom: 0; background: var(--surface); padding: 12px 0; }
.i18n-aibar { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin: 12px 0 16px; }

/* Modal overlay (AI translation progress) */
.modal-overlay {
  position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center;
  background: rgba(0,0,0,.5); padding: 20px;
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); color: inherit; border-radius: 12px; padding: 24px;
  width: 100%; max-width: 520px; box-shadow: 0 20px 60px rgba(0,0,0,.35);
}
.modal h2 { margin-top: 0; }
.modal .i18n-progress { width: 100%; height: 12px; margin: 12px 0; }

/* Native <dialog> popup (e.g. rename). */
dialog.modal-card {
  background: var(--surface); color: var(--ink); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 0; width: 100%; max-width: 420px;
  box-shadow: 0 24px 70px rgba(16,32,48,.28);
}
dialog.modal-card.modal-wide { max-width: 600px; }
dialog.modal-card .modal-body input[readonly] { background: #f3f5f7; cursor: text; }
dialog.modal-card::backdrop { background: rgba(12,23,34,.5); backdrop-filter: blur(2px); }
dialog.modal-card[open] { animation: modalPop .14s ease-out; }
@keyframes modalPop {
  from { opacity: 0; transform: translateY(-6px) scale(.98); }
  to { opacity: 1; transform: none; }
}
dialog.modal-card .modal-body { padding: 22px 24px 24px; }
dialog.modal-card h3 { margin: 0 0 4px; font-size: 17px; }
dialog.modal-card .modal-sub { margin: 0 0 16px; color: var(--muted); font-size: 13px; line-height: 1.4; }
dialog.modal-card label { display: block; font-size: 12px; font-weight: 600; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin-bottom: 6px; }
dialog.modal-card label + input,
dialog.modal-card label + select { margin-bottom: 16px; }
dialog.modal-card input[type="text"],
dialog.modal-card input[type="email"],
dialog.modal-card input[type="password"],
dialog.modal-card input[type="number"],
dialog.modal-card select {
  display: block; width: 100%; padding: 11px 13px; font: inherit; font-size: 15px;
  border: 1px solid var(--line); border-radius: 10px; background: #fff; color: var(--ink);
}
dialog.modal-card select { appearance: none; cursor: pointer; }
dialog.modal-card input[type="text"]:focus,
dialog.modal-card input[type="email"]:focus,
dialog.modal-card input[type="password"]:focus,
dialog.modal-card input[type="number"]:focus,
dialog.modal-card select:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
dialog.modal-card .form-actions { margin-top: 20px; display: flex; gap: 8px; justify-content: flex-end; }
.ai-counts { font-size: 14px; }
.ai-errors { max-height: 200px; overflow: auto; font-size: 13px; color: var(--danger, #b91c1c); margin: 8px 0; }
.ai-errors ul { margin: 4px 0 0; padding-left: 18px; }

.main { display: flex; flex-direction: column; min-width: 0; }
.topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 14px 28px; background: var(--surface); border-bottom: 1px solid var(--line);
  /* Above Leaflet's panes/controls (which reach ~z-index 1000) so the map never
     slides over the sticky header while scrolling. */
  position: sticky; top: 0; z-index: 1100;
}
.page-title { font-size: 18px; margin: 0; }
.topbar-right { display: flex; align-items: center; gap: 14px; }
.user { color: var(--muted); }
.content { padding: 28px; max-width: 1180px; width: 100%; }

/* Cards */
.card {
  background: var(--surface); border: 1px solid var(--line); border-radius: var(--radius);
  padding: 20px; margin-bottom: 20px; box-shadow: var(--shadow);
}
.card.narrow { max-width: 560px; }
.card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 14px; gap: 12px; }
.card-head h2 { font-size: 15px; margin: 0; }
/* Sub-navigation tabs (e.g. Integration: App-Start vs. Blitzer melden) */
.subtabs { display: flex; gap: 8px; margin-bottom: 20px; flex-wrap: wrap; }
.subtabs a, .subtabs button.tablink {
  padding: 9px 18px; font-size: 14px; font-weight: 600; color: var(--ink);
  text-decoration: none; border: 1px solid var(--line); border-radius: 8px;
  background: var(--surface); transition: background .12s, color .12s, border-color .12s;
}
.subtabs button.tablink { cursor: pointer; font: inherit; font-weight: 600; }
.subtabs a:hover, .subtabs button.tablink:hover { border-color: var(--primary); color: var(--primary); }
.subtabs a.active, .subtabs button.tablink.active {
  color: #fff; background: var(--primary); border-color: var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,.12);
}
.subtabs a.active:hover, .subtabs button.tablink.active:hover { color: #fff; }
.tab-panel { display: none; }
.tab-panel.active { display: block; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
@media (max-width: 880px){ .grid-2 { grid-template-columns: 1fr; } .shell { grid-template-columns: 1fr; } .sidebar { position: static; height: auto; } }

.maint-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; margin-top: 12px; }
.maint-item { border: 1px solid var(--line); border-radius: 8px; padding: 14px; display: flex; flex-direction: column; gap: 8px; }
.maint-item strong { font-size: 14px; }
.maint-item .btn { align-self: flex-start; }
.maint-item .maint-confirm { display: block; margin-top: 4px; width: 100%; max-width: 220px; }
@media (max-width: 880px){ .maint-grid { grid-template-columns: 1fr; } }

/* Stat cards */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); gap: 16px; margin-bottom: 20px; }
.stat { padding: 16px 18px; }
.stat-label { color: var(--muted); font-size: 12px; text-transform: uppercase; letter-spacing: .4px; }
.stat-value { font-size: 26px; font-weight: 700; margin-top: 4px; }
.stat.accent { background: linear-gradient(135deg, var(--primary), var(--primary-700)); color: #fff; border: none; }
.stat.accent .stat-label { color: rgba(255,255,255,.8); }

/* Tables */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { text-align: left; padding: 10px 12px; border-bottom: 1px solid var(--line); vertical-align: middle; }
.table th { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); font-weight: 600; }
.table.compact th, .table.compact td { padding: 7px 10px; font-size: 13px; }
.table .num { text-align: right; font-variant-numeric: tabular-nums; }
/* Continent quick-filter chips (Statistik SCDB). */
.table tfoot .sum-row td { border-top: 2px solid var(--line); background: var(--bg); font-variant-numeric: tabular-nums; }
.table-search { margin-bottom: 12px; }
.table-search input[type="search"] { width: 100%; max-width: 320px; padding: 8px 12px; border: 1px solid var(--line); border-radius: 8px; background: var(--surface); color: var(--ink); font-size: 14px; }
.table-search input[type="search"]:focus { outline: none; border-color: var(--primary); box-shadow: 0 0 0 3px rgba(14,79,99,.12); }
.continent-filter { display: flex; flex-wrap: wrap; align-items: center; gap: 8px; margin-bottom: 14px; }
.continent-filter-label { font-size: 12px; font-weight: 600; color: var(--muted); text-transform: uppercase; letter-spacing: .3px; margin-right: 4px; }
.chip { cursor: pointer; border: 1px solid var(--line); background: var(--surface); color: var(--ink); border-radius: 999px; padding: 6px 14px; font-size: 13px; font-weight: 600; line-height: 1.2; }
.chip:hover { border-color: var(--primary); }
.chip.active { border-color: var(--primary); background: rgba(14, 79, 99, .08); color: var(--primary); }
/* Sortable table headers: pointer + active-direction arrow indicator. */
.table.js-sortable th { user-select: none; }
.table.js-sortable th.sort-asc::after { content: " \25B2"; font-size: 10px; color: var(--muted); }
.table.js-sortable th.sort-desc::after { content: " \25BC"; font-size: 10px; color: var(--muted); }
.table .cell-max { background: #eef2ff; font-weight: 600; }
.table tr:last-child td { border-bottom: none; }
.empty { color: var(--muted); text-align: center; padding: 22px; }
.small { font-size: 12px; }
td.small { max-width: 220px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
/* Job result messages may be long; let them wrap instead of being truncated. */
.table td.job-msg { max-width: 360px; overflow: visible; text-overflow: clip; white-space: normal; overflow-wrap: anywhere; }
.muted { color: var(--muted); }
.nowrap { white-space: nowrap; }

/* Database browser */
.table-scroll { overflow-x: auto; border: 1px solid var(--line); border-radius: 8px; }
.table-scroll .table th, .table-scroll .table td { border-bottom: 1px solid var(--line); }
/* Keep the trailing action column (e.g. "Details") fully visible even when the
   row is wider than the container and scrolls horizontally (fixes the button
   being clipped on Safari/macOS). */
.table.sticky-action th:last-child,
.table.sticky-action td:last-child {
  position: sticky; right: 0; z-index: 1;
  background: var(--surface);
  text-align: right; white-space: nowrap;
  box-shadow: -8px 0 8px -8px rgba(16,32,48,.18);
}
/* Type/country statistics matrix */
.stat-matrix th, .stat-matrix td { text-align: center; white-space: nowrap; }
.stat-matrix th.group-head { text-align: center; border-bottom: 1px solid var(--line); }
.stat-matrix .num { text-align: right; }
.stat-matrix thead th.type-code { text-align: center; cursor: help; text-decoration: underline dotted var(--muted); text-underline-offset: 3px; }
.stat-matrix .country-col { text-align: left; }
.table.compact.stat-matrix th, .table.compact.stat-matrix td { padding: 2px 10px; }
.table.compact.stat-matrix .num { padding-left: 6px; padding-right: 6px; }
.stat-matrix .sticky-col { position: sticky; left: 0; background: var(--surface, #fff); text-align: left; z-index: 1; }
.stat-matrix thead .sticky-col { z-index: 2; }
/* Zebra striping: every second body row gets a subtle tint (incl. sticky col,
   which must stay opaque while scrolling horizontally). */
.stat-matrix tbody tr:nth-child(even) td { background: var(--bg); }
.stat-matrix tbody tr:hover td { background: rgba(14,79,99,.06); }
/* Vertical divider on the left edge of the Additional Coordinates group. */
.stat-matrix .sep { border-left: 2px solid #cbd5e0; }
.legend-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 18px 28px; }
.legend-grid h3 { font-size: 13px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin: 0 0 8px; }
dl.legend { display: grid; grid-template-columns: auto 1fr; gap: 4px 12px; margin: 0; }
dl.legend dt { font-family: "JetBrains Mono", ui-monospace, Menlo, Consolas, monospace; font-weight: 600; }
dl.legend dd { margin: 0; color: var(--muted); }

.db-subhead { font-size: 12px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted); margin: 16px 0 8px; }
.db-table-meta { display: inline-flex; gap: 8px; }
.db-cell { display: flex; flex-direction: column; gap: 10px; align-items: flex-start; }
.db-cell > .db-card { width: 100%; margin: 0; }
a.db-card { display: block; text-decoration: none; color: inherit; transition: border-color .15s, box-shadow .15s; }
a.db-card:hover { border-color: var(--accent, #2563eb); box-shadow: 0 2px 10px rgba(0,0,0,.08); }
.db-card-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 10px; }
.db-card-foot { display: inline-block; margin-top: 6px; font-size: 13px; font-weight: 600; color: var(--accent, #2563eb); }

/* Bar charts (CSS only) */
.cluster-daily { margin-top: 18px; }

/* Cluster noise/novelty scoring block in the detail panel */
.cluster-scoring { margin: 10px 0 16px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 10px; background: var(--surface, #fff); }
.scoring-head { display: flex; align-items: center; gap: 12px; margin-bottom: 10px; }
.review-badge { display: inline-block; padding: 3px 10px; border-radius: 999px; font-size: 12px; font-weight: 700; }
.review-review { background: #def5ee; color: #0a7a5d; }
.review-noise { background: #fbe2e2; color: #b62525; }
.review-neutral { background: #eef1f4; color: #56636f; }
.scoring-main { display: flex; flex-wrap: wrap; gap: 16px 32px; align-items: flex-start; }
.scoring-main .score-meters { flex: 1 1 240px; }
.scoring-main .scoring-factors { flex: 0 1 auto; margin-top: 0; align-self: center; }
.score-meters { display: flex; flex-direction: column; gap: 8px; max-width: 420px; }
.score-meter-label { display: flex; justify-content: space-between; font-size: 12.5px; margin-bottom: 3px; }
.meter { height: 8px; border-radius: 999px; background: #eef1f4; overflow: hidden; }
.meter-fill { height: 100%; border-radius: 999px; }
.meter-noise { background: var(--err); }
.meter-novelty { background: var(--accent); }
.scoring-factors { margin-top: 10px; max-width: 420px; }
.barchart { display: flex; align-items: flex-end; gap: 4px; height: 160px; padding-top: 8px; overflow-x: auto; }
.bar-col { flex: 1 1 0; min-width: 14px; display: flex; flex-direction: column; align-items: center; height: 100%; }
.bar-track { flex: 1; width: 100%; display: flex; align-items: flex-end; justify-content: center; }
.bar-fill { width: 70%; max-width: 26px; min-height: 0; background: var(--primary); border-radius: 3px 3px 0 0; transition: opacity .15s; }
.bar-col:hover .bar-fill { background: var(--accent); }
.bar-label { margin-top: 6px; font-size: 10.5px; color: var(--muted); white-space: nowrap; font-variant-numeric: tabular-nums; }

/* Badges */
.badge {
  display: inline-block; padding: 3px 9px; border-radius: 20px; font-size: 12px; font-weight: 600;
  background: #eef1f4; color: #56636f;
}
.badge-ok { background: #def5ee; color: #0a7a5d; }
.badge-warn { background: #fdf0d8; color: #a96b00; }
.badge-err { background: #fbe2e2; color: #b62525; }
.badge-neutral { background: #eef1f4; color: #56636f; }

/* SCDB country stats: 5-step data-quality scale (red -> green) + unknown. */
.badge-quality { min-width: 58px; text-align: center; }
.badge-quality.q0 { background: #eef1f4; color: #56636f; }
.badge-quality.q1 { background: #fbe2e2; color: #b62525; }
.badge-quality.q2 { background: #fbe6d2; color: #b25a12; }
.badge-quality.q3 { background: #f3efc9; color: #7a6a12; }
.badge-quality.q4 { background: #e4f3d4; color: #4a7a1e; }
.badge-quality.q5 { background: #def5ee; color: #0a7a5d; }
.badge-points { min-width: 24px; text-align: center; }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; gap: 6px; cursor: pointer;
  border: 1px solid var(--line); background: var(--surface); color: var(--ink);
  padding: 8px 14px; border-radius: 8px; font-size: 13px; font-weight: 600; text-decoration: none;
}
.btn:hover { background: #f7f9fb; text-decoration: none; }
.btn:disabled, .btn[disabled] {
  background: var(--bg); border-color: var(--line); color: var(--muted);
  opacity: .6; cursor: not-allowed;
}
.btn:disabled:hover, .btn[disabled]:hover { background: var(--bg); border-color: var(--line); color: var(--muted); }
.btn-sm { padding: 5px 10px; font-size: 12px; }
.btn-block { width: 100%; justify-content: center; }
.btn-primary { background: var(--primary); border-color: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-700); }
.btn-warn { background: var(--warn); border-color: var(--warn); color: #fff; }
.btn-warn:hover { background: #b87600; border-color: #b87600; color: #fff; }
.btn-danger { background: var(--err); border-color: var(--err); color: #fff; }
.btn-danger:hover { background: #b62525; border-color: #b62525; color: #fff; }
.btn-ghost { background: transparent; border-color: transparent; color: var(--muted); }
.btn-icon { padding: 6px 8px; }
.btn-icon svg { width: 15px; height: 15px; display: block; }
.row-actions { display: flex; gap: 6px; flex-wrap: wrap; align-items: center; }
/* Mail icon with hover popover (e.g. vendor invoice address). */
.email-hint { position: relative; display: inline-flex; }
.email-hint > a { display: inline-flex; color: var(--muted); }
.email-hint > a:hover { color: var(--primary); }
.email-hint svg { width: 16px; height: 16px; display: block; }
.email-hint .email-pop {
  position: absolute; bottom: 130%; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: 6px 10px; border-radius: 6px;
  font-size: 12px; white-space: nowrap; box-shadow: 0 6px 18px rgba(0,0,0,.25);
  opacity: 0; visibility: hidden; transition: opacity .12s; z-index: 30; pointer-events: none;
}
.email-hint:hover .email-pop { opacity: 1; visibility: visible; }
#event-types-table td.r { white-space: nowrap; }
#event-types-table td.r .row-actions { flex-wrap: nowrap; justify-content: flex-end; }
.filter-toggle { display: flex; align-items: center; }
.filter-toggle label { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--muted); cursor: pointer; white-space: nowrap; }
.job-actions, .form-actions { display: flex; gap: 10px; flex-wrap: wrap; }
.form-actions { justify-content: flex-end; margin-top: 8px; }

/* Forms */
.form label { display: block; margin-bottom: 14px; font-weight: 600; font-size: 13px; }
.form label.checkbox-inline { display: flex; align-items: center; gap: 8px; font-weight: 500; cursor: pointer; }
.form label.checkbox-inline input { width: auto; margin: 0; }
.form-section { font-size: 13px; font-weight: 700; color: var(--primary); text-transform: uppercase;
  letter-spacing: .4px; margin: 22px 0 12px; padding: 7px 12px;
  background: rgba(14, 79, 99, .05); border-left: 3px solid var(--primary); border-radius: 0 6px 6px 0; }
.form input, .form select, .form textarea, .form-inline input, .form-inline select, .tier-table input {
  width: 100%; margin-top: 5px; padding: 9px 11px; border: 1px solid var(--line);
  border-radius: 8px; font: inherit; background: #fff; color: var(--ink);
}
.form input:focus, .form select:focus, .form textarea:focus { outline: 2px solid var(--accent); border-color: var(--accent); }
.form textarea { resize: vertical; min-height: 64px; }

/* Two-column field layout inside a card form. Items flagged .col-span-2 and
   section headings stretch across both columns. */
.form-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 0 20px; align-items: start; }
.form-grid > .col-span-2, .form-grid > .form-section { grid-column: 1 / -1; }
@media (max-width: 720px) { .form-grid { grid-template-columns: 1fr; } }

/* Two-column read-only key/value layout (e.g. partner master data). */
.kv.kv-cols { display: grid; grid-template-columns: 1fr 1fr; gap: 6px 24px; }
.kv.kv-cols > .col-span-2 { grid-column: 1 / -1; }
@media (max-width: 720px) { .kv.kv-cols { grid-template-columns: 1fr; } }
.form-inline { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; margin-top: 12px; }
.form-inline input, .form-inline select { width: auto; flex: 1; min-width: 140px; margin-top: 0; }
.form-inline .check-inline { display: flex; align-items: center; gap: 6px; flex: 0 0 auto; white-space: nowrap; font-size: 14px; cursor: pointer; }
.form-inline .check-inline input { flex: 0 0 auto; width: auto; min-width: 0; }

/* Auth */
.auth-wrap { min-height: 100vh; display: grid; place-items: center; background: linear-gradient(135deg, #0c1722, #0e4f63); padding: 20px; }
.auth-stack { display: flex; flex-direction: column; align-items: center; gap: 16px; width: 100%; max-width: 380px; }
.auth-card { background: #fff; border-radius: 16px; padding: 36px; width: 100%; max-width: 380px; box-shadow: 0 20px 50px rgba(0,0,0,.25); }

/* Language switcher below the login card, on the dark gradient background. */
.auth-lang { display: inline-flex; align-items: center; gap: 8px; padding: 6px 8px 6px 14px;
  background: rgba(255,255,255,.07); border: 1px solid rgba(255,255,255,.14); border-radius: 999px; }
.auth-lang-icon { font-size: 15px; line-height: 1; opacity: .8; }
.auth-lang-label { color: rgba(255,255,255,.7); font-size: 13px; font-weight: 600; letter-spacing: .2px; }
.auth-lang .lang-select { appearance: none; -webkit-appearance: none; cursor: pointer;
  color: #fff; font-size: 13px; font-weight: 600; border: 1px solid rgba(255,255,255,.22);
  background-color: rgba(255,255,255,.10); border-radius: 999px; padding: 6px 30px 6px 12px;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='white' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'/></svg>");
  background-repeat: no-repeat; background-position: right 10px center; transition: background-color .15s ease, border-color .15s ease; }
.auth-lang .lang-select:hover { background-color: rgba(255,255,255,.18); border-color: rgba(255,255,255,.35); }
.auth-lang .lang-select:focus { outline: none; border-color: rgba(255,255,255,.55); box-shadow: 0 0 0 3px rgba(255,255,255,.12); }
.auth-lang .lang-select option { color: #12222e; }
.auth-brand { display: flex; align-items: center; gap: 10px; margin-bottom: 20px; }
.auth-brand .brand-text { color: var(--ink); font-weight: 700; }

/* Login wordmark: understated, timeless brand title. */
.brand-hero { display: block; margin-bottom: 22px; }
.brand-hero .brand-title { display: inline-block; font-size: 18px; font-weight: 700;
  line-height: 1.3; letter-spacing: .1px; color: var(--ink); }
.auth-sub { color: var(--muted); margin-top: -4px; margin-bottom: 18px; }
.auth-links { margin-top: 16px; text-align: center; font-size: 14px; }
.auth-links a { color: var(--accent); text-decoration: none; }
.auth-links a:hover { text-decoration: underline; }

/* Flash */
.flash { padding: 11px 14px; border-radius: 8px; margin-bottom: 16px; font-size: 13px; }
.flash-ok { background: #def5ee; color: #0a7a5d; }
.flash-warn { background: #fdf0d8; color: #91631a; }
.flash-err { background: #fbe2e2; color: #b62525; }
.flash-info { background: #e4eefb; color: #1b4f8a; }
.export-info { margin-top: 14px; }
.export-info .export-info-title { font-weight: 600; margin-bottom: 4px; }
.export-info .export-info-body { white-space: pre-wrap; }
.form-error { color: var(--err); font-size: 13px; margin-top: 8px; font-weight: 600; }

/* App detail */
.back-link { margin: 0 0 12px; font-size: 14px; }
.back-link a { color: var(--muted); text-decoration: none; }
.back-link a:hover { color: var(--ink); text-decoration: underline; }
.app-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; }
.app-meta { display: flex; align-items: center; gap: 12px; color: var(--muted); flex-wrap: wrap; }
.app-actions { display: flex; gap: 8px; flex-wrap: wrap; align-items: center; }
.app-actions form { margin: 0; display: inline-flex; align-items: center; }
.token-cell code { background: #f3f5f7; padding: 3px 7px; border-radius: 6px; }
.copy { cursor: pointer; }
.copy:hover { outline: 1px dashed var(--accent); }

/* Key-value + lists */
.kv { display: grid; gap: 10px; margin: 14px 0; }
.kv-key { display: inline-block; width: 90px; color: var(--muted); font-size: 12px; text-transform: uppercase; }
.kv code { background: #f3f5f7; padding: 4px 8px; border-radius: 6px; }
.lst { margin: 6px 0 14px; padding-left: 18px; }
.lst li { margin-bottom: 4px; }

/* Code cards */
.code-card { border: 1px solid var(--line); border-radius: 10px; overflow: hidden; margin-bottom: 16px; }
.code-head { display: flex; align-items: center; justify-content: space-between; padding: 8px 12px; background: #f7f9fb; border-bottom: 1px solid var(--line); font-weight: 600; font-size: 12px; }
.code-card pre { margin: 0; padding: 14px; background: #0c1722; color: #d6e2ee; overflow-x: auto; font-size: 12.5px; line-height: 1.55; }
pre.mini { background: #0c1722; color: #d6e2ee; padding: 10px 12px; border-radius: 8px; font-size: 12.5px; overflow-x: auto; }

/* Logs */
.logs-subhead { font-size: 13px; margin: 4px 0 10px; }
.logs-subhead:not(:first-child) { margin-top: 20px; }

/* Map */
.map-wrap { margin-bottom: 16px; }
.map-toggle { display: inline-flex; align-items: center; gap: 6px; margin: 4px 0 10px; cursor: pointer; }
.map-toggle input { cursor: pointer; }
.map { height: 280px; border-radius: 10px; border: 1px solid var(--line); }
.map.map-tall { height: 560px; }

/* Detail panel below the map (marker click target; replaces Leaflet popups).
   Collapsible; collapsed by default until a point/row is selected. */
.map-detail { margin-top: 14px; padding-top: 14px; border-top: 1px solid var(--line); }
.map-detail .card-head { margin-bottom: 10px; }
.map-detail h3 { font-size: 14px; margin: 0; }
.detail-toggle { cursor: pointer; user-select: none; }
.detail-toggle:focus-visible { outline: 2px solid var(--accent, #2563eb); outline-offset: 3px; border-radius: 6px; }
.detail-caret { color: var(--muted); transition: transform .15s ease; }
.map-detail.collapsed .detail-toggle { margin-bottom: 0; }
.map-detail.collapsed .detail-caret { transform: rotate(-90deg); }
.map-detail.collapsed .detail-body { display: none; }

/* Collapsible card via native <details>: the summary acts as the card head. */
.collapsible-card > summary { cursor: pointer; user-select: none; list-style: none; margin-bottom: 0; }
.collapsible-card > summary::-webkit-details-marker { display: none; }
.collapsible-card > summary .detail-caret { transform: rotate(-90deg); }
.collapsible-card[open] > summary { margin-bottom: 14px; }
.collapsible-card[open] > summary .detail-caret { transform: rotate(0deg); }
.detail .detail-type { font-weight: 700; margin: 0 0 12px; }
.detail .detail-type .mono { color: var(--muted); font-weight: 600; }
/* Masonry-style packing: groups flow column by column with no row gaps, so short
   blocks (distributions) sit tight under one another instead of leaving the big
   grid gaps a row-major grid produces. Each block stays intact (break-inside). */
.detail-grid { column-width: 300px; column-gap: 16px; }
.detail-group { min-width: 0; break-inside: avoid; -webkit-column-break-inside: avoid; page-break-inside: avoid;
  margin: 0 0 14px; padding: 9px 12px; border: 1px solid var(--line); border-left: 3px solid var(--line);
  border-radius: 8px; background: var(--surface, #fff); }
.detail-group h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 0 0 5px; }
/* Light accent tints cycle across the cards to break up the dense list. */
.detail-group:nth-of-type(6n+1) { border-left-color: #3b82f6; background: #f6f9ff; }
.detail-group:nth-of-type(6n+2) { border-left-color: #16a34a; background: #f4fbf6; }
.detail-group:nth-of-type(6n+3) { border-left-color: #7c3aed; background: #faf7ff; }
.detail-group:nth-of-type(6n+4) { border-left-color: #f59e0b; background: #fffbf2; }
.detail-group:nth-of-type(6n+5) { border-left-color: #0891b2; background: #f2fbfd; }
.detail-group:nth-of-type(6n+6) { border-left-color: #e11d48; background: #fff5f7; }
.detail-kv { width: 100%; }
/* Borderless, tightly padded rows; far denser than the default compact table. */
.detail-kv.table.compact th, .detail-kv.table.compact td { padding: 1px 0; border-bottom: none; font-size: 12.5px; line-height: 1.35; }
.detail-kv th { width: 1%; white-space: nowrap; text-align: left; vertical-align: top; padding-right: 14px !important; color: var(--muted); font-weight: 600; text-transform: none; letter-spacing: 0; }
.detail-kv td { vertical-align: top; word-break: break-word; }
/* Stacked key/value rows for long values (coordinates + method name + link) that
   never fit beside their label in a narrow masonry column. */
.kv-stack > div { margin-bottom: 4px; }
.kv-stack .k { display: block; color: var(--muted); font-weight: 600; font-size: 12px; }
.kv-stack .k .muted { font-weight: 400; }
.kv-stack .v { display: block; word-break: break-word; }
/* Winning estimate (best of mode vs. front) gets a subtle highlight. */
.kv-stack > div.best { background: #def5ee; border-left: 3px solid #0a7a5d; border-radius: 6px; padding: 3px 8px; margin-left: -8px; }
.kv-stack > div.best .k { color: #0a7a5d; }
.kv-stack .badge { vertical-align: middle; }
/* Direction relation chips for nearby known cameras. */
.cam-rel { display: inline-block; padding: 0 6px; border-radius: 999px; font-size: 11px; font-weight: 600; }
.cam-rel-same { background: #def5ee; color: #0a7a5d; }
.cam-rel-opp { background: #fdf0d8; color: #a96b00; }
.cam-rel-both { background: #e6eefc; color: #2a52be; }

/* Cluster detail: member reports projected onto the 1-D travel axis (a strip
   plot). The estimated position is the green marker at 0 m. */
.track-viz { margin-top: 14px; }
.track-viz h4 { font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); margin: 0 0 4px; }
.track { position: relative; height: 64px; margin: 12px 6px 4px; }
.track-line { position: absolute; top: 50%; left: 0; right: 0; height: 2px; background: var(--line); transform: translateY(-50%); }
.track-window { position: absolute; top: 50%; height: 26px; transform: translateY(-50%); background: rgba(22,163,74,.10); border: 1px solid rgba(22,163,74,.35); border-radius: 4px; }
.track-mode { position: absolute; top: 50%; height: 32px; width: 2px; transform: translate(-50%, -50%); background: #16a34a; }
.track-mode.track-mode2 { background: #7c3aed; height: 26px; border-radius: 0; }
/* The winning estimate's line is drawn thicker so it stands out at a glance. */
.track-mode.track-best { width: 4px; z-index: 1; box-shadow: 0 0 0 2px rgba(10,122,93,.18); }
.track-dot { position: absolute; top: 50%; width: 10px; height: 10px; transform: translate(-50%, -50%); border-radius: 50%; background: rgba(37,99,235,.40); border: 1px solid rgba(37,99,235,.7); }
/* Known fixed cameras, drawn below the line (so they don't cover the reports)
   with a direction arrow like on the map (90° = downstream / cluster direction). */
.track-cam { position: absolute; top: calc(50% + 24px); width: 0; height: 0; }
.track-cam-arrow { position: absolute; left: 0; top: 0; width: 0; height: 0; margin: -7px 0 0 -6px;
  border-left: 6px solid transparent; border-right: 6px solid transparent; border-bottom: 12px solid #b91c1c;
  transform-origin: 50% 50%; }
.track-dot.in-win { background: rgba(22,163,74,.55); border-color: #16a34a; }
.track-scale { display: flex; justify-content: space-between; font-size: 11px; color: var(--muted); font-variant-numeric: tabular-nums; margin: 0 6px; }
.track-legend { margin: 6px 0 0; }
.track-key { display: inline-block; width: 14px; height: 10px; vertical-align: middle; border-radius: 2px; }
.track-key.mode { width: 3px; height: 14px; background: #16a34a; border-radius: 0; }
.track-key.mode2 { width: 3px; height: 14px; background: #7c3aed; border-radius: 0; }
.track-key.win { background: rgba(22,163,74,.10); border: 1px solid rgba(22,163,74,.35); }
.track-key.cam { width: 0; height: 0; background: none; border-radius: 0; border-left: 5px solid transparent; border-right: 5px solid transparent; border-bottom: 9px solid #b91c1c; }

/* Server-side report clusters: a round counter bubble (low-zoom aggregation). */
.report-cluster { background: none; border: 0; }
.report-cluster-inner {
  width: 100%; height: 100%; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: rgba(44, 150, 222, .85); color: #fff;
  border: 2px solid #0e4f63; box-sizing: border-box;
  font-size: 13px; font-weight: 700; line-height: 1;
  box-shadow: 0 1px 4px rgba(0, 0, 0, .35); cursor: pointer;
}
/* Green variant for the active-cluster (low-zoom) counter bubble. */
.report-cluster-inner.cluster-green { background: rgba(22, 163, 74, .85); border-color: #14532d; }

/* Vertically scrollable list container (used for long, paginated tables). */
.table-scroll.scroll-y { max-height: 640px; overflow-y: auto; }

/* Pagination footer */
.pager { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-top: 14px; }
.pager-info { color: var(--muted, #64748b); font-size: 13px; }
.btn.disabled { opacity: .45; pointer-events: none; }
/* Report marker with a direction arrow rotating around the pin centre. The
   rotor fills the icon box (centred on the pin) and is rotated as a whole, so
   the arrow at its top edge orbits the pin and points in the travel heading. */
/* The 44x44 marker box is mostly transparent; make it click-through so it does
   not swallow clicks meant for a nearby marker (e.g. a fixed camera right next
   to a report). Only the visible arrow/dot stay clickable; clicks on the empty
   area fall through to whatever sits below. */
.dir-icon { background: none; border: 0; pointer-events: none; }
.dir-marker { position: relative; width: 44px; height: 44px; }
.dir-rotor { position: absolute; inset: 0; transform-origin: 50% 50%; }
.dir-arrow { position: absolute; left: 50%; top: 1px; width: 0; height: 0; margin-left: -7px; border-left: 7px solid transparent; border-right: 7px solid transparent; border-bottom: 13px solid #0e4f63; pointer-events: auto; }
.dir-dot { position: absolute; left: 50%; top: 50%; width: 12px; height: 12px; margin: -6px 0 0 -6px; border-radius: 50%; background: #2c96de; border: 2px solid #0e4f63; box-sizing: border-box; pointer-events: auto; }
/* Clickable report rows: focus the matching map marker. */
.report-row, .cluster-row { cursor: pointer; }
.report-row:hover, .cluster-row:hover { background: rgba(44,150,222,.08); }
.report-row.active, .cluster-row.active { background: rgba(44,150,222,.16); }

/* Geocoder details popup (hover/focus over the coordinates cell) */
/* Override td.small's overflow:hidden so the absolutely-positioned popup is
   not clipped by the cell. */
td.geo-cell { overflow: visible; max-width: none; }
.geo-tip { position: relative; cursor: help; border-bottom: 1px dotted var(--muted); outline: none; }
.geo-pop {
  position: absolute;
  right: 0;
  bottom: calc(100% + 8px);
  /* Above Leaflet's panes/controls (which reach ~z-index 1000) so the map
     never covers the popup. */
  z-index: 2000;
  display: none;
  min-width: 220px;
  padding: 10px 12px;
  text-align: left;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(28,39,51,.18);
  white-space: normal;
}
.geo-tip:hover .geo-pop,
.geo-tip:focus-visible .geo-pop,
.geo-tip:focus-within .geo-pop { display: block; }
.geo-pop::after {
  content: "";
  position: absolute;
  top: 100%;
  right: 14px;
  border: 6px solid transparent;
  border-top-color: var(--surface);
}
/* Small circular "i" info icon with a popup that opens below it. */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 18px;
  height: 18px;
  margin-left: 8px;
  border-radius: 50%;
  background: var(--muted);
  color: #fff;
  font-size: 12px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, "Times New Roman", serif;
  cursor: help;
  outline: none;
  vertical-align: middle;
}
.info-pop {
  position: absolute;
  left: 0;
  top: calc(100% + 8px);
  z-index: 2000;
  display: none;
  width: 320px;
  max-width: 80vw;
  padding: 10px 12px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 400;
  font-style: normal;
  font-family: inherit;
  line-height: 1.45;
  background: var(--surface);
  color: var(--ink);
  border: 1px solid var(--line);
  border-radius: 10px;
  box-shadow: 0 10px 30px rgba(28,39,51,.18);
  white-space: normal;
}
.info-tip:hover .info-pop,
.info-tip:focus-visible .info-pop,
.info-tip:focus-within .info-pop { display: block; }

.geo-pop-head { display: block; font-size: 11px; text-transform: uppercase; letter-spacing: .4px; color: var(--muted); font-weight: 700; margin-bottom: 6px; }
.geo-pop-table { border-collapse: collapse; font-size: 12.5px; font-family: inherit; }
.geo-pop-table th { text-align: left; padding: 2px 12px 2px 0; color: var(--muted); font-weight: 600; white-space: nowrap; text-transform: none; letter-spacing: 0; font-size: 12.5px; }
.geo-pop-table td { padding: 2px 0; color: var(--ink); }

/* Impersonation banner (admin temporarily acting as a partner-admin) */
.impersonation-bar {
  position: sticky; top: 0; z-index: 1500;
  display: flex; align-items: center; justify-content: space-between; gap: 16px;
  padding: 10px 18px; background: #b3261e; color: #fff;
  font-size: 14px; line-height: 1.4;
}
.impersonation-bar strong { font-weight: 700; }
.impersonation-bar .btn { background: #fff; color: #b3261e; border-color: #fff; flex-shrink: 0; }
.impersonation-bar .btn:hover { background: rgba(255,255,255,.88); color: #b3261e; }

/* Tariff tier editor */
.tier-del-cell { width: 1%; white-space: nowrap; text-align: right; }

/* Switch row (settings) */
.switch-row { display: flex; align-items: center; gap: 10px; font-weight: 600; }
.switch-row input[type="checkbox"] { width: 18px; height: 18px; margin: 0; }

/* Content editor */
.content-tokens { background: #f7f9fb; border: 1px solid var(--line); border-radius: 10px; padding: 12px 16px; margin-bottom: 18px; font-size: 13px; }
.content-tokens ul { margin: 8px 0 0; padding-left: 18px; }
.content-tokens li { margin-bottom: 4px; }
.content-tokens code { background: #fff; border: 1px solid var(--line); padding: 2px 6px; border-radius: 6px; }
.code-area { width: 100%; margin-top: 6px; padding: 12px 14px; border: 1px solid var(--line); border-radius: 8px; background: #0c1722; color: #d6e2ee; font-family: "JetBrains Mono", ui-monospace, "SF Mono", Menlo, Consolas, monospace; font-size: 12.5px; line-height: 1.6; resize: vertical; }
.code-area:focus { outline: 2px solid var(--accent); border-color: var(--accent); }

/* Small numeric input (sort order etc.) */
.num-sm { width: 90px; }

/* FAQ (partner area) */
.faq-list { display: flex; flex-direction: column; gap: 8px; }
.faq-item { border: 1px solid var(--line); border-radius: 8px; padding: 0; background: #fff; }
.faq-item > summary { cursor: pointer; padding: 12px 16px; font-weight: 600; list-style: none; }
.faq-item > summary::-webkit-details-marker { display: none; }
.faq-item > summary::before { content: "+"; display: inline-block; width: 16px; color: var(--accent); font-weight: 700; }
.faq-item[open] > summary::before { content: "\2212"; }
.faq-answer { padding: 0 16px 14px 32px; line-height: 1.6; }
.faq-answer > :first-child { margin-top: 0; }
.faq-answer > :last-child { margin-bottom: 0; }
.faq-answer pre { background: #0c1722; color: #d6e2ee; padding: 10px 14px; border-radius: 8px; overflow-x: auto; }
.faq-answer code { background: #f1f4f8; padding: 1px 5px; border-radius: 5px; }
.faq-answer pre code { background: none; padding: 0; }

/* Status dots (cluster legend / explanation popup) */
.dot { display: inline-block; width: 10px; height: 10px; border-radius: 50%; margin-right: 6px; vertical-align: baseline; }
.dot-confirmed { background: #16a34a; }
.dot-candidate { background: #d97706; }

/* Fixed-camera direction arrow on the map: same size as the report arrow but
   red and without a centre dot (the red circle marker is the dot). */
.cam-dir-marker { filter: drop-shadow(0 0 1px rgba(255,255,255,.9)); }
.cam-dir-marker .dir-arrow { border-bottom-color: #b91c1c; pointer-events: none; }
.bde-dir-marker { filter: drop-shadow(0 0 1px rgba(255,255,255,.9)); }
.bde-dir-marker .dir-arrow { border-bottom-color: #6b7280; pointer-events: none; }

/* Draggable explanation popup */
.explain-pop {
  position: fixed; top: 90px; left: 50%; transform: translateX(-50%);
  z-index: 10000; width: min(560px, calc(100vw - 32px));
  max-height: calc(100vh - 120px); display: flex; flex-direction: column;
  background: var(--surface, #fff); color: var(--ink, inherit);
  border: 1px solid var(--line, #e2e8f0); border-radius: 12px;
  box-shadow: 0 24px 70px rgba(0,0,0,.4);
}
.explain-pop[hidden] { display: none; }
.explain-pop-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 16px; border-bottom: 1px solid var(--line, #e2e8f0);
  cursor: move; user-select: none; border-radius: 12px 12px 0 0;
  background: #f7f9fb;
}
.explain-pop-head h3 { margin: 0; font-size: 14px; }
.explain-pop-close {
  border: none; background: transparent; cursor: pointer;
  font-size: 22px; line-height: 1; color: var(--muted, #64748b); padding: 0 4px;
}
.explain-pop-close:hover { color: var(--ink, #0f172a); }
.explain-pop-body { padding: 4px 18px 18px; overflow-y: auto; font-size: 13.5px; line-height: 1.55; }
.explain-pop-body h4 { margin: 18px 0 6px; font-size: 13px; text-transform: uppercase; letter-spacing: .3px; color: var(--muted, #64748b); }
.explain-pop-body p { margin: 6px 0; }
.explain-pop-body ul { margin: 6px 0; padding-left: 18px; }
.explain-pop-body li { margin: 4px 0; }
.explain-pop-body code { background: #f1f4f8; padding: 1px 5px; border-radius: 5px; font-size: 12px; }
.explain-table { border-collapse: collapse; width: 100%; margin: 6px 0; }
.explain-table th { text-align: left; vertical-align: top; white-space: nowrap; padding: 4px 12px 4px 0; color: var(--ink, #0f172a); font-weight: 600; }
.explain-table td { vertical-align: top; padding: 4px 0; color: var(--muted, #475569); }

/* Cluster relevance threshold editor (popup) */
.threshold-table { border-collapse: collapse; width: 100%; margin: 8px 0; }
.threshold-table th { text-align: left; padding: 4px 8px 4px 0; font-size: 12px; color: var(--muted, #64748b); font-weight: 600; }
.threshold-table td { padding: 3px 8px 3px 0; vertical-align: middle; }
.threshold-table input[type="number"] { width: 64px; }
.threshold-table input[type="text"] { width: 56px; text-transform: uppercase; }
.threshold-actions { display: flex; gap: 8px; align-items: center; margin: 8px 0; }
.threshold-remove { padding: 0 8px; line-height: 1.6; }
.contact-table td { vertical-align: middle; }
.contact-table th:last-child, .contact-table td:last-child { width: 1%; white-space: nowrap; text-align: right; }
.contact-remove { padding: 0 10px; line-height: 1.6; }
