:root {
  --bg: #0a0d11;
  --surface: #131820;
  --surface-2: #1a2029;
  --surface-3: #20262f;
  --border: #232a35;
  --border-soft: #1c222b;
  --text: #e6edf3;
  --muted: #7d8a99;
  --accent: #2fb3ff;
  --ok: #3fb950;
  --warn: #d29922;
  --warn-strong: #e07a3c;
  --bad: #f85149;
  --bad-bg: rgba(248, 81, 73, 0.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  background: var(--bg);
  color: var(--text);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
  font-size: 14px;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
a:hover { text-decoration: none; }

.container { max-width: 1280px; margin: 0 auto; padding: 36px 36px 60px; }
.container.embed { padding: 16px; max-width: none; }
.container.embed .section-tight { display: none; } /* hide stage-history strip in embed */

.footer {
  border-top: 1px solid var(--border-soft);
  text-align: right;
  padding: 18px 36px;
  color: var(--muted);
  font-size: 12px;
}

/* ---------- Page title ---------- */
.page-h1 { font-size: 32px; font-weight: 700; margin: 0 0 4px; letter-spacing: -0.5px; }
.page-h1.accent { color: var(--accent); }
.page-sub { color: var(--muted); margin: 0 0 28px; font-size: 14px; }

/* ---------- DQ Header bar ---------- */
.dq-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 22px;
  margin-bottom: 4px;
}
.dq-header-left { display: flex; align-items: center; gap: 14px; }
.dq-icon {
  width: 38px; height: 38px;
  border-radius: 8px;
  background: linear-gradient(135deg, #2f7dff, #2fb3ff);
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 13px; letter-spacing: 0.3px;
  color: white;
}
.dq-title { font-weight: 600; font-size: 15px; }
.dq-subtitle { color: var(--muted); font-size: 12px; }
.dq-actions { display: flex; align-items: center; gap: 14px; }
.dq-pills { display: flex; gap: 8px; align-items: center; }

/* ---------- Search bar ---------- */
.search-wrap {
  position: relative;
  display: flex;
  align-items: center;
}
.search-wrap input {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 30px 8px 32px;
  border-radius: 18px;
  font-size: 13px;
  width: 240px;
  font-family: inherit;
  outline: none;
  transition: border-color .15s, width .2s, background .15s;
}
.search-wrap input::placeholder { color: var(--muted); }
.search-wrap input:focus { border-color: var(--accent); background: var(--surface-3); width: 280px; }
.search-icon {
  position: absolute;
  left: 11px;
  font-size: 12px;
  pointer-events: none;
  opacity: 0.6;
}
.search-clear {
  position: absolute;
  right: 8px;
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 4px;
  display: none;
}
.search-wrap.has-text .search-clear { display: inline; }
.search-wrap.has-text input { border-color: var(--accent); }
.search-clear:hover { color: var(--text); }
.pill {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--muted);
  font-size: 12px;
  padding: 5px 12px;
  border-radius: 14px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 28px;
  border-bottom: 1px solid var(--border);
  padding: 0 22px;
  margin-bottom: 32px;
  background: var(--surface);
  border-left: 1px solid var(--border);
  border-right: 1px solid var(--border);
  border-radius: 0 0 10px 10px;
  margin-top: -1px;
}
.tab {
  color: var(--muted);
  padding: 14px 0;
  font-size: 13px;
  font-weight: 500;
  border-bottom: 2px solid transparent;
  transition: color .15s, border-color .15s;
}
.tab:hover { color: var(--text); }
.tab.active { color: var(--accent); border-bottom-color: var(--accent); }

/* ---------- Sections ---------- */
.section { margin-bottom: 32px; }
.section-tight { margin-bottom: 18px; }

/* ---------- Compact stage-history strip ---------- */
.track-strip {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 8px 14px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  font-size: 12px;
}
.track-strip-label {
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  font-size: 10px;
  font-weight: 600;
  margin-right: 4px;
}
.track-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 10px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--border);
  font-size: 12px;
}
.track-chip.ok  { color: var(--ok); border-color: rgba(63, 185, 80, 0.35); }
.track-chip.bad { color: var(--bad); border-color: rgba(248, 81, 73, 0.4); }
.check-mark-sm {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: rgba(63, 185, 80, 0.18);
  font-size: 9px;
  font-weight: 700;
}
.track-chip.bad .check-mark-sm { background: rgba(248, 81, 73, 0.18); }
.section-title {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  margin: 0 0 12px;
}
.section-title.flush { margin: 0; }

/* ---------- Stage history panel ---------- */
.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.panel-head {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
  padding: 14px 20px;
  border-bottom: 1px solid var(--border-soft);
  background: var(--surface-2);
}
.track-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-bottom: 1px solid var(--border-soft);
  font-size: 13px;
}
.track-row:last-child { border-bottom: none; }
.track-row.ok { color: var(--ok); }
.track-row.bad { color: var(--bad); }
.check-mark {
  width: 22px; height: 22px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 50%;
  background: rgba(63, 185, 80, 0.15);
  color: var(--ok);
  font-size: 12px;
  font-weight: 700;
}
.track-row.bad .check-mark { background: rgba(248, 81, 73, 0.15); color: var(--bad); }

/* ---------- Relationship gap cards ---------- */
.gap-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.gap-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 18px 20px;
}
.gap-label { color: var(--muted); font-size: 12px; margin-bottom: 12px; }
.gap-pct { font-size: 36px; font-weight: 700; line-height: 1; margin-bottom: 12px; }
.gap-counts { display: flex; gap: 18px; margin-top: 12px; font-size: 12px; }
.gap-counts strong { font-size: 14px; }

/* ---------- Top-3 panels ---------- */
.top-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.top-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  display: block;
  transition: border-color .15s, transform .15s;
}
.top-panel:hover { border-color: var(--accent); transform: translateY(-1px); }
.top-head {
  display: flex; justify-content: space-between; align-items: baseline;
  border-bottom: 1px solid var(--border-soft);
  padding-bottom: 10px; margin-bottom: 12px;
}
.top-head strong { font-size: 14px; }
.top-row {
  display: flex; justify-content: space-between; align-items: baseline;
  font-size: 13px;
  margin-top: 10px;
}
.top-name { color: var(--text); }
.top-pct { font-weight: 700; font-size: 13px; }

/* ---------- KPI tiles (per-object header) ---------- */
.kpi-row {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
.kpi-tile {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 16px 18px;
  min-height: 96px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kpi-label {
  font-size: 10px;
  letter-spacing: 1.4px;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}
.kpi-num { font-size: 28px; font-weight: 700; line-height: 1.1; }
.kpi-sub { font-size: 11px; color: var(--muted); }
.kpi-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 700;
  padding: 6px 12px;
  border-radius: 16px;
  width: fit-content;
}
.kpi-badge.healthy { background: rgba(63, 185, 80, 0.12); color: var(--ok); }
.kpi-badge.poor    { background: rgba(248, 81, 73, 0.12); color: var(--bad); }
.kpi-badge .dot { width: 8px; height: 8px; border-radius: 50%; background: currentColor; }

/* ---------- Legend ---------- */
.legend {
  display: flex;
  gap: 20px;
  font-size: 12px;
  color: var(--muted);
  margin-bottom: 14px;
}
.legend .dot {
  display: inline-block;
  width: 8px; height: 8px;
  border-radius: 50%;
  margin-right: 6px;
  vertical-align: middle;
}
.legend .dot.ok { background: var(--ok); }
.legend .dot.warn { background: var(--warn); }
.legend .dot.warn-strong { background: var(--warn-strong); }
.legend .dot.bad { background: var(--bad); }

/* ---------- Export row ---------- */
.export-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.btn-ghost {
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text);
  padding: 7px 14px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  font-family: inherit;
}
.btn-ghost:hover { border-color: var(--accent); color: var(--accent); }
.btn-ghost:disabled { opacity: 0.5; cursor: wait; }
.btn-refresh { margin-left: 4px; }

/* ---------- Status banner (WS-driven) ---------- */
.status-banner {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 16px;
  border-radius: 8px;
  margin: -28px 0 24px;
  font-size: 13px;
  border: 1px solid;
}
.status-banner[data-level="info"]    { background: rgba(47, 179, 255, 0.08); border-color: rgba(47, 179, 255, 0.35); color: var(--accent); }
.status-banner[data-level="success"] { background: rgba(63, 185, 80, 0.08); border-color: rgba(63, 185, 80, 0.35); color: var(--ok); }
.status-banner[data-level="error"]   { background: rgba(248, 81, 73, 0.08); border-color: rgba(248, 81, 73, 0.4); color: var(--bad); }
.status-spinner {
  width: 12px; height: 12px;
  border: 2px solid rgba(255,255,255,0.18);
  border-top-color: currentColor;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
.status-banner[data-level="success"] .status-spinner,
.status-banner[data-level="error"]   .status-spinner { display: none; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ---------- Bar-list (Pareto) toolbar + toggle ---------- */
.bar-list-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-bottom: 12px;
  flex-wrap: wrap;
}
.bar-list-toolbar .legend { margin-bottom: 0; }
.toolbar-actions { display: flex; gap: 12px; align-items: center; }
.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--muted);
  cursor: pointer;
  user-select: none;
  padding: 6px 12px;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
}
.toggle:hover { border-color: var(--accent); color: var(--text); }
.toggle input { accent-color: var(--accent); cursor: pointer; }

/* ---------- Bar list ---------- */
.bar-list {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  overflow: hidden;
}
.bar-section {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 18px;
  background: var(--surface-2);
  border-top: 1px solid var(--border);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1.2px;
  color: var(--muted);
}
.bar-section:first-child { border-top: none; }
.bar-section-dot {
  width: 8px; height: 8px; border-radius: 50%;
  background: currentColor;
}
.bar-section-dot.ok          { color: var(--ok); }
.bar-section-dot.warn        { color: var(--warn); }
.bar-section-dot.warn-strong { color: var(--warn-strong); }
.bar-section-dot.bad         { color: var(--bad); }
.bar-section-label { font-weight: 700; color: var(--text); }
.bar-section-range { color: var(--muted); font-weight: 400; }
.bar-section-count {
  margin-left: auto;
  background: var(--surface-3);
  color: var(--muted);
  padding: 2px 9px;
  border-radius: 10px;
  font-size: 11px;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  letter-spacing: 0.5px;
}

.bar-row {
  display: grid;
  grid-template-columns: 22px 22px minmax(220px, 28%) 1fr 60px 110px 22px;
  align-items: center;
  gap: 10px;
  padding: 10px 18px;
  border-top: 1px solid var(--border-soft);
  font-size: 13px;
  transition: background .12s;
}
.pin-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 16px;
  cursor: pointer;
  padding: 0;
  line-height: 1;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s, opacity .15s;
}
.pin-btn:hover { color: var(--accent); background: rgba(47, 179, 255, 0.12); }
.pin-btn.pinned { color: var(--warn); }
.pin-btn.pinned:hover { color: var(--warn-strong); }

/* Locked (view-only) state — hide edit affordances unless edit mode is on.
   The flag button is the exception: when a row is marked high-severity we
   keep the icon visible (filled red) so the marking is readable; only the
   click is disabled. */
body:not(.edit-mode) .pin-btn,
body:not(.edit-mode) .del-btn { visibility: hidden; pointer-events: none; }
body:not(.edit-mode) .flag-btn { pointer-events: none; }
body:not(.edit-mode) .flag-btn:not(.active) { visibility: hidden; }

.flag-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  padding: 0;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  filter: grayscale(1) opacity(0.45);
  transition: filter .15s, background .15s;
}
.flag-btn:hover { filter: none; background: rgba(248, 81, 73, 0.1); }
.flag-btn.active { filter: none; }
.bar-row.is-high-severity { background: rgba(248, 81, 73, 0.04); }
.bar-row.is-high-severity:hover { background: rgba(248, 81, 73, 0.07); }

/* High-severity-only filter — hide non-marked rows (and their now-empty sections via JS) */
.high-severity-only .bar-row:not(.is-high-severity) { display: none; }

/* Filter button active state */
.btn-flag-filter.active {
  background: var(--bad);
  border-color: var(--bad);
  color: white;
}
.btn-flag-filter.active:hover { color: white; opacity: 0.92; }

/* Client Status dropdown */
.filter-select {
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
  outline: none;
}
.filter-select:hover  { border-color: var(--accent); }
.filter-select:focus  { border-color: var(--accent); }
/* Highlight when a non-default value is chosen */
.filter-select:not([data-default="1"]):not(:has(option[value="All"]:checked)) { border-color: var(--accent); color: var(--accent); }

.del-btn {
  background: transparent;
  border: none;
  color: var(--muted);
  font-size: 13px;
  cursor: pointer;
  width: 22px;
  height: 22px;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: color .15s, background .15s, opacity .15s;
  opacity: 0.5;
}
.bar-row:hover .del-btn { opacity: 1; }
.del-btn:hover { color: var(--bad); background: rgba(248, 81, 73, 0.12); opacity: 1; }

/* Hidden by user — used by JS filter */
.bar-row.is-hidden-by-user,
.bar-section.is-hidden-section { display: none; }

/* ---------- Confirmation modal ---------- */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 200;
  backdrop-filter: blur(2px);
}
.modal-backdrop.visible { display: flex; }
.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 22px 24px;
  max-width: 440px;
  width: 90%;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7);
  animation: modal-in .15s ease-out;
}
@keyframes modal-in {
  from { transform: translateY(8px); opacity: 0; }
  to   { transform: translateY(0);   opacity: 1; }
}
.modal h3 { margin: 0 0 8px; font-size: 16px; font-weight: 600; color: var(--text); }
.modal-body { color: var(--muted); margin: 0 0 20px; font-size: 13px; line-height: 1.5; }
.modal-body strong { color: var(--text); }
.modal-actions { display: flex; justify-content: flex-end; gap: 10px; }
.btn-danger {
  background: var(--bad);
  color: white;
  border: 1px solid var(--bad);
  padding: 8px 16px;
  border-radius: 6px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  font-family: inherit;
}
.btn-danger:hover { opacity: 0.92; }

/* Restore button on Config page */
.restore-btn {
  background: var(--accent);
  color: #0d1117;
  border: none;
  padding: 6px 14px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
}
.restore-btn:hover { opacity: 0.92; }

/* Edit button active state */
.btn-edit.active {
  background: var(--accent);
  color: #0d1117;
  border-color: var(--accent);
}
.btn-edit.active:hover { color: #0d1117; opacity: .92; }
.watchlist-actions { display: flex; gap: 8px; align-items: center; }

/* ---------- Undo toast ---------- */
.undo-toast {
  position: fixed;
  left: 50%;
  bottom: 24px;
  transform: translateX(-50%) translateY(20px);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 10px 14px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 14px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.55);
  opacity: 0;
  pointer-events: none;
  transition: opacity .2s, transform .2s;
  z-index: 100;
}
.undo-toast.visible {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}
.undo-toast-msg { color: var(--text); }
.undo-toast-msg strong { color: var(--accent); }
.undo-toast-btn {
  background: transparent;
  border: 1px solid var(--accent);
  color: var(--accent);
  padding: 4px 12px;
  border-radius: 5px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.undo-toast-btn:hover { background: var(--accent); color: #0d1117; }
.bar-row:hover { background: rgba(88, 166, 255, 0.04); }

.bar-row-name {
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.bar-row-bar {
  height: 8px;
  background: var(--surface-3);
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}
.bar-row-fill {
  height: 100%;
  background: var(--accent);
  border-radius: 4px;
  transition: width .3s ease;
}
.bar-row-fill.ok          { background: var(--ok); }
.bar-row-fill.warn        { background: var(--warn); }
.bar-row-fill.warn-strong { background: var(--warn-strong); }
.bar-row-fill.bad         { background: var(--bad); }

.bar-row-pct {
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  text-align: right;
  font-size: 14px;
}
.bar-row-counts {
  font-variant-numeric: tabular-nums;
  font-size: 12px;
  color: var(--text);
  text-align: right;
  white-space: nowrap;
}
.bar-row-counts .muted { color: var(--muted); }

/* Hide-passing toggle behavior — class can sit on <html> or <body>.
   Scoped to per-object and watchlist lists so the Config page's
   #hidden-list (where we deliberately want to see passing-but-hidden
   validators so the user can restore them) is unaffected. */
.hide-passing #bar-list .bar-row[data-severity="ok"],
.hide-passing #bar-list .bar-section[data-severity="ok"],
.hide-passing #pinned-grid .bar-row[data-severity="ok"],
.hide-passing #pinned-grid .bar-section[data-severity="ok"] { display: none; }

/* Mobile */
@media (max-width: 720px) {
  .bar-row { grid-template-columns: 22px 1fr 50px; grid-template-rows: auto auto; gap: 6px 8px; }
  .bar-row-name { grid-column: 2 / span 2; }
  .bar-row-bar { grid-column: 2 / 3; }
  .bar-row-pct { grid-column: 3 / 4; grid-row: 2; }
  .bar-row-counts { grid-column: 2 / span 2; font-size: 11px; }
}

/* ---------- Watchlist (pinned) bar list on overview ---------- */
.watchlist-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
  margin-bottom: 14px;
}
.watchlist-hint {
  font-size: 12px;
  color: var(--muted);
  margin: 6px 0 0;
}
.pin-list .bar-row { border-top: 1px solid var(--border-soft); }
.pin-list .bar-row:first-child { border-top: none; }

/* Watchlist + config rows: use auto-width last column instead of fixed 22px */
.pin-row { grid-template-columns: 22px 22px minmax(220px, 28%) 1fr 60px 110px auto; }

/* Watchlist object section header (no severity dot, slightly different feel) */
.bar-section-object .bar-section-label { color: var(--accent); font-weight: 700; letter-spacing: 0.4px; }

.bar-row-tag {
  display: inline-block;
  background: var(--surface-3);
  color: var(--muted);
  text-transform: uppercase;
  font-size: 9px;
  letter-spacing: 0.8px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 10px;
  margin-right: 10px;
  text-decoration: none;
  vertical-align: middle;
}
.bar-row-tag:hover { color: var(--accent); border-color: var(--accent); text-decoration: none; }
.bar-row-validator { color: var(--text); }

.empty-state {
  text-align: center;
  padding: 40px 20px;
  color: var(--muted);
  font-size: 13px;
  border-top: none !important;
}

/* ---------- KPI grid (validator cards) — legacy, unused on per-object pages ---------- */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
}
.kpi-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 14px 16px;
  min-height: 110px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}
.kpi-card-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}
.kpi-name { font-size: 13px; line-height: 1.3; color: var(--text); }
.info-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  margin-left: 6px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--surface-2);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  font-style: italic;
  font-family: Georgia, serif;
  cursor: help;
  vertical-align: middle;
  position: relative;
  outline: none;
}
.info-icon:hover, .info-icon:focus { color: var(--accent); border-color: var(--accent); }
.info-icon[data-tooltip]:hover::after,
.info-icon[data-tooltip]:focus::after {
  content: attr(data-tooltip);
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--surface-3);
  border: 1px solid var(--border);
  color: var(--text);
  font: normal 400 12px/1.5 -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  font-style: normal;
  padding: 10px 14px;
  border-radius: 6px;
  white-space: pre-line;
  width: max-content;
  max-width: 320px;
  text-align: left;
  z-index: 50;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.5);
  pointer-events: none;
}
.info-icon[data-tooltip]:hover::before,
.info-icon[data-tooltip]:focus::before {
  content: "";
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 5px solid transparent;
  border-top-color: var(--border);
  z-index: 51;
}
.kpi-card-pct { font-size: 18px; font-weight: 700; white-space: nowrap; }
.kpi-card-counts {
  display: flex;
  gap: 14px;
  font-size: 12px;
  margin-top: 12px;
}
.kpi-card-counts strong { font-size: 13px; }
.kpi-card-counts .muted { font-size: 9px; letter-spacing: 0.6px; }

/* ---------- Bars ---------- */
.bar {
  width: 100%;
  height: 5px;
  background: var(--surface-3);
  border-radius: 3px;
  overflow: hidden;
  margin-top: 10px;
}
.bar.tiny { height: 3px; margin-top: 6px; }
.bar-fill {
  height: 100%;
  background: var(--accent);
  transition: width .25s;
}

/* ---------- Severity colors ---------- */
.ok          { color: var(--ok); }
.warn        { color: var(--warn); }
.warn-strong { color: var(--warn-strong); }
.bad         { color: var(--bad); }
.bar-fill.ok          { background: var(--ok); }
.bar-fill.warn        { background: var(--warn); }
.bar-fill.warn-strong { background: var(--warn-strong); }
.bar-fill.bad         { background: var(--bad); }

.muted { color: var(--muted); }
.small { font-size: 12px; }

/* ---------- Responsive ---------- */
@media (max-width: 1100px) {
  .kpi-grid { grid-template-columns: repeat(3, 1fr); }
  .kpi-row  { grid-template-columns: repeat(3, 1fr); }
  .gap-grid, .top-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 720px) {
  .container { padding: 20px; }
  .kpi-grid, .kpi-row, .gap-grid, .top-grid { grid-template-columns: 1fr; }
  .dq-header { flex-direction: column; align-items: flex-start; gap: 12px; }
  .dq-actions { flex-direction: column; align-items: stretch; width: 100%; }
  .search-wrap input { width: 100%; }
  .tabs { overflow-x: auto; gap: 18px; }
}
