/* ========== Reset + Tokens ========== */
:root {
  --bg: #f5f5f7;
  --surface: #ffffff;
  --surface-elevated: #ffffff;
  --surface-hover: #fafafa;
  --border: #e5e5e7;
  --border-strong: #d2d2d7;
  --border-focus: #007aff;

  --text: #1d1d1f;
  --text-secondary: #6e6e73;
  --text-tertiary: #86868b;
  --text-on-accent: #ffffff;

  --accent: #007aff;
  --accent-hover: #0051d5;
  --accent-soft: #e6f1ff;
  --accent-soft-strong: #cce4ff;

  --success: #34c759;
  --success-soft: #e8f8ec;
  --warning: #ff9500;
  --warning-soft: #fff3e0;
  --danger: #ff3b30;
  --danger-soft: #ffeae8;

  --shadow-xs: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.04), 0 1px 2px rgba(0,0,0,0.03);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.06), 0 1px 4px rgba(0,0,0,0.04);
  --shadow-lg: 0 16px 40px rgba(0,0,0,0.08), 0 4px 12px rgba(0,0,0,0.04);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 20px;
  --radius-pill: 999px;

  --sidebar-w: 248px;
  --topbar-h: 56px;

  --font: -apple-system, BlinkMacSystemFont, "SF Pro Display", "SF Pro Text", "Segoe UI", system-ui, -apple-system, sans-serif;
  --font-mono: ui-monospace, "SF Mono", "Menlo", monospace;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; background: var(--bg); color: var(--text); font-family: var(--font);
  font-size: 14px; line-height: 1.5; -webkit-font-smoothing: antialiased; -moz-osx-font-smoothing: grayscale; }
a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }
code { font-family: var(--font-mono); font-size: 0.9em; background: rgba(0,0,0,0.04); padding: 2px 6px; border-radius: 4px; }
.muted { color: var(--text-secondary); }
.hidden { display: none !important; }
.mono { font-family: var(--font-mono); }

/* ========== Layout shell ========== */
.app { min-height: 100vh; display: grid; grid-template-columns: var(--sidebar-w) 1fr; grid-template-rows: var(--topbar-h) 1fr;
  grid-template-areas: "topbar topbar" "sidebar main"; }
.topbar { grid-area: topbar; background: var(--surface); border-bottom: 1px solid var(--border); display: flex;
  align-items: center; padding: 0 24px; gap: 16px; z-index: 10; position: sticky; top: 0; }
.topbar .brand { font-weight: 600; font-size: 15px; letter-spacing: -0.01em; }
.topbar .brand .brand-mark { display: inline-block; width: 22px; height: 22px; background: var(--text); color: var(--surface);
  border-radius: 6px; text-align: center; line-height: 22px; font-size: 13px; font-weight: 700; margin-right: 8px; vertical-align: -5px; }
.topbar .spacer { flex: 1; }
.topbar .crumbs { display: flex; align-items: center; gap: 8px; color: var(--text-secondary); font-size: 13px; }
.topbar .crumbs .crumb { color: var(--text-secondary); cursor: pointer; }
.topbar .crumbs .crumb:hover { color: var(--text); }
.topbar .crumbs .sep { color: var(--text-tertiary); }
.topbar .crumbs .crumb.current { color: var(--text); font-weight: 500; }

.sidebar { grid-area: sidebar; background: var(--surface); border-right: 1px solid var(--border); overflow-y: auto; padding: 16px 0;
  position: sticky; top: var(--topbar-h); align-self: start; max-height: calc(100vh - var(--topbar-h)); }
.sidebar-section { padding: 4px 12px; }
.sidebar-title { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--text-tertiary); padding: 12px 12px 6px; }
.sidebar a, .sidebar button.nav-item { display: flex; align-items: center; gap: 10px; padding: 8px 12px; border-radius: var(--radius-md);
  color: var(--text); font-size: 14px; cursor: pointer; background: none; border: 0; width: 100%; text-align: left; font-family: inherit; text-decoration: none; }
.sidebar a:hover, .sidebar .nav-item:hover { background: var(--surface-hover); text-decoration: none; }
.sidebar .nav-item.active { background: var(--accent-soft); color: var(--accent); font-weight: 500; }
.sidebar .nav-item .icon { width: 18px; flex-shrink: 0; opacity: .75; }
.sidebar .nav-item .badge { margin-left: auto; background: var(--bg); color: var(--text-secondary); font-size: 11px;
  padding: 2px 7px; border-radius: var(--radius-pill); }
.sidebar .nav-item.active .badge { background: var(--surface); color: var(--accent); }

.main { grid-area: main; padding: 32px 40px 80px; max-width: 1200px; }
.main h1 { font-size: 28px; font-weight: 600; letter-spacing: -0.02em; margin: 0 0 4px; }
.main h2 { font-size: 18px; font-weight: 600; letter-spacing: -0.01em; margin: 0 0 4px; }
.main h3 { font-size: 15px; font-weight: 600; margin: 0; }
.page-header { margin-bottom: 24px; }
.page-header .lead { color: var(--text-secondary); font-size: 14px; margin-top: 2px; }

/* ========== Buttons ========== */
.btn { display: inline-flex; align-items: center; justify-content: center; gap: 6px; padding: 8px 14px;
  border-radius: var(--radius-md); border: 1px solid var(--border-strong); background: var(--surface); color: var(--text);
  font-family: inherit; font-size: 14px; font-weight: 500; cursor: pointer; transition: all .12s ease;
  text-decoration: none; line-height: 1; }
.btn:hover { background: var(--surface-hover); border-color: var(--text-tertiary); }
.btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.btn:disabled { opacity: .5; cursor: not-allowed; }
.btn-primary { background: var(--accent); color: white; border-color: var(--accent); }
.btn-primary:hover { background: var(--accent-hover); border-color: var(--accent-hover); }
.btn-secondary { background: var(--surface); }
.btn-danger { color: var(--danger); }
.btn-danger:hover { background: var(--danger-soft); border-color: var(--danger); }
.btn-ghost { background: transparent; border-color: transparent; }
.btn-ghost:hover { background: var(--surface-hover); }
.btn-sm { padding: 6px 10px; font-size: 13px; }
.btn-lg { padding: 11px 20px; font-size: 15px; }
.btn-icon { padding: 6px; width: 32px; height: 32px; }
.btn.is-disabled { pointer-events: none; opacity: .4; }

/* ========== Inputs ========== */
input[type="text"], input[type="email"], input[type="number"], input[type="password"],
textarea, select {
  font-family: inherit; font-size: 14px; padding: 9px 12px; border-radius: var(--radius-md);
  border: 1px solid var(--border-strong); background: var(--surface); color: var(--text); width: 100%;
  transition: border-color .12s, box-shadow .12s;
}
input:focus, textarea:focus, select:focus { outline: none; border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-soft); }
textarea { resize: vertical; min-height: 60px; }
select { cursor: pointer; }

/* ========== Cards / Surfaces ========== */
.card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 20px;
  box-shadow: var(--shadow-xs); margin-bottom: 16px; }
.card-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.card-head h2 { margin: 0; }
.card-head .actions { display: flex; gap: 8px; }
.card-hint { color: var(--text-secondary); font-size: 13px; margin: -6px 0 14px; }
.card-count { color: var(--text-secondary); font-weight: 400; font-size: 14px; margin-left: 4px; }

.section-title { font-size: 11px; text-transform: uppercase; letter-spacing: 0.06em; color: var(--text-tertiary);
  font-weight: 600; margin: 16px 0 6px; }

/* Empty state */
.empty { background: var(--surface); border: 1px dashed var(--border-strong); border-radius: var(--radius-md);
  padding: 32px 20px; text-align: center; color: var(--text-secondary); font-size: 14px; }
.empty-illustration { font-size: 32px; margin-bottom: 8px; opacity: .4; }

/* ========== Row / Grid utilities ========== */
.row { display: flex; gap: 8px; align-items: center; flex-wrap: wrap; }
.row.gap-md { gap: 16px; }
.row.right { justify-content: flex-end; }
.col { display: flex; flex-direction: column; gap: 8px; }

/* ========== Stat pills (KPIs) ========== */
.stat-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 12px; margin-bottom: 24px; }
.stat { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 16px 18px; }
.stat .label { font-size: 12px; color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.stat .value { font-size: 24px; font-weight: 600; margin-top: 4px; letter-spacing: -0.02em; }
.stat .delta { font-size: 12px; margin-top: 2px; }
.stat .delta.up { color: var(--success); }
.stat .delta.down { color: var(--danger); }

.stat-pill { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 4px 10px; font-size: 12px; color: var(--text-secondary); font-weight: 500; }

/* ========== Sites overview (root) ========== */
.sites-toolbar { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; gap: 12px; }
.sites-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 14px; }
.site-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px;
  box-shadow: var(--shadow-xs); cursor: pointer; transition: all .12s; }
.site-card:hover { border-color: var(--border-strong); transform: translateY(-1px); box-shadow: var(--shadow-md); }
.site-card h3 { margin: 0 0 4px; font-size: 15px; }
.site-card .url-hint { color: var(--text-tertiary); font-size: 12px; margin-bottom: 12px; word-break: break-all; }
.site-card .stats-line { display: flex; gap: 10px; font-size: 12px; color: var(--text-secondary); }
.site-card .stats-line strong { color: var(--text); font-weight: 600; }

.folder-section { margin-bottom: 32px; }
.folder-section h2 { display: flex; align-items: center; gap: 8px; margin-bottom: 12px; font-size: 16px; }
.folder-section h2 .folder-icon { font-size: 18px; }
.folder-section h2 .count { color: var(--text-tertiary); font-weight: 400; }

/* ========== Snippet code block ========== */
.code { background: #f6f8fa; border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px;
  font-family: var(--font-mono); font-size: 12.5px; color: #24292e; overflow-x: auto; white-space: pre-wrap;
  word-break: break-all; margin: 0; }

/* ========== Suggestion cards ========== */
.suggestion { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 18px;
  margin-bottom: 12px; transition: all .12s; }
.suggestion.is-enabled { border-color: var(--success); box-shadow: inset 3px 0 0 var(--success), var(--shadow-xs); }
.suggestion.is-editing { border-color: var(--accent); box-shadow: inset 3px 0 0 var(--accent), var(--shadow-sm); }
.suggestion h3 { margin: 0 0 4px; font-size: 15px; font-weight: 600; }
.suggestion-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; }

.switch { position: relative; display: inline-block; width: 36px; height: 22px; flex-shrink: 0; cursor: pointer; }
.switch input { opacity: 0; width: 0; height: 0; }
.switch .slider { position: absolute; inset: 0; background: var(--border-strong); border-radius: 22px; transition: background .15s; }
.switch .slider::before { content: ""; position: absolute; height: 18px; width: 18px; left: 2px; top: 2px;
  background: white; border-radius: 50%; transition: transform .18s; box-shadow: 0 1px 2px rgba(0,0,0,0.2); }
.switch input:checked + .slider { background: var(--success); }
.switch input:checked + .slider::before { transform: translateX(14px); }

.match-block { margin-top: 12px; }
.match-label { color: var(--text-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; margin-bottom: 6px; }
.chips { display: flex; flex-wrap: wrap; gap: 6px; }
.chip { display: inline-flex; align-items: center; gap: 4px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-pill); padding: 4px 4px 4px 10px; font-family: var(--font-mono); font-size: 12px; color: var(--text); }
.chip-key { color: var(--text-secondary); }
.chip-x { background: var(--border); color: var(--text-secondary); border: 0; width: 18px; height: 18px; border-radius: 50%;
  cursor: pointer; font-size: 13px; line-height: 1; padding: 0; display: inline-flex; align-items: center; justify-content: center; }
.chip-x:hover { background: var(--danger); color: white; }

.token-block { margin-top: 12px; padding: 12px 14px; background: var(--accent-soft); border: 1px solid var(--accent-soft-strong);
  border-radius: var(--radius-md); }
.token-block .match-label { color: var(--accent); }
.token-row { display: flex; align-items: center; gap: 8px; margin-top: 6px; flex-wrap: wrap; }
.token-code { background: var(--surface); color: var(--accent); padding: 6px 12px; border-radius: var(--radius-sm);
  font-family: var(--font-mono); font-size: 13px; font-weight: 600; border: 1px solid var(--accent-soft-strong); }

.changes-list { margin-top: 12px; }
.change { padding: 10px 12px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 6px; font-size: 13px; }
.change .label { color: var(--text-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.03em;
  margin-bottom: 4px; }
.change .selector { font-family: var(--font-mono); color: var(--accent); font-size: 11px; }
.change .original { color: var(--text-tertiary); text-decoration: line-through; font-size: 12px; margin: 2px 0; }
.change .new { color: var(--text); font-weight: 500; }

.rationale { color: var(--text-secondary); font-style: italic; font-size: 13px; margin-top: 10px;
  padding: 8px 12px; background: var(--bg); border-radius: var(--radius-sm); border-left: 3px solid var(--border-strong); }

.suggestion-actions { margin-top: 14px; display: flex; flex-direction: column; gap: 8px; }
.suggestion-actions .row { margin-top: 0; }

/* AB toggle inline */
.ab-toggle { display: inline-flex; align-items: center; gap: 6px; font-size: 13px; cursor: pointer; padding: 6px 10px;
  border: 1px solid var(--border-strong); border-radius: var(--radius-md); background: var(--surface); }
.ab-toggle input { margin: 0; cursor: pointer; }
.ab-toggle.inline { padding: 4px 8px; font-size: 12px; }
.ab-toggle.inline.small { font-size: 11px; padding: 3px 7px; }
.ab-toggle:has(input:checked) { border-color: var(--success); color: var(--success); background: var(--success-soft); }

/* ========== Edit mode ========== */
.edit-title { font-size: 16px; font-weight: 600; width: 100%; margin-bottom: 6px; }
.edit-label { display: block; font-size: 11px; text-transform: uppercase; color: var(--text-secondary);
  margin: 10px 0 4px; letter-spacing: 0.04em; font-weight: 600; }
.match-edit-list { display: flex; flex-direction: column; gap: 8px; margin-top: 8px; }
.match-edit-row { display: flex; gap: 8px; align-items: center; }
.match-edit-row strong { flex-shrink: 0; min-width: 120px; color: var(--accent); font-size: 12px; font-family: var(--font-mono); }
.match-edit-row input, .match-edit-row select { flex: 1; min-width: 0; }
.changes-edit-list { display: flex; flex-direction: column; gap: 12px; margin-top: 8px; }
.change-edit { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 14px;
  display: flex; flex-direction: column; gap: 4px; }
.change-edit .row { margin-top: 0; }
.change-edit select { font-size: 13px; }

/* ========== Goals (multi-trigger) ========== */
.goal-row { display: flex; justify-content: space-between; align-items: center; padding: 14px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 8px; gap: 12px; box-shadow: var(--shadow-xs); }
.goal-info { flex: 1; min-width: 0; }
.goal-name { font-weight: 600; font-size: 14px; margin-bottom: 2px; }
.goal-triggers { margin: 4px 0 0; padding-left: 20px; font-size: 13px; color: var(--text-secondary); }
.goal-triggers li { margin: 2px 0; }
.goal-pill { display: inline-block; padding: 1px 7px; border-radius: var(--radius-pill); font-size: 10.5px; font-weight: 600;
  margin-left: 6px; vertical-align: middle; }
.goal-pill.off { background: var(--danger-soft); color: var(--danger); }
.goal-pill.no-ab { background: var(--bg); color: var(--text-secondary); }

.trigger-edit { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px; margin: 8px 0; display: flex; flex-direction: column; gap: 8px; }
.trigger-edit-head { display: flex; justify-content: space-between; align-items: center; }
.trigger-edit label { display: flex; flex-direction: column; gap: 4px; font-size: 12px; color: var(--text-secondary); }
.trigger-edit > div.hidden { display: none; }
.goal-options-row { display: flex; gap: 10px; flex-wrap: wrap; margin: 10px 0 4px; }

/* ========== Performance ========== */
.perf-rule { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 10px; }
.perf-rule-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 6px; }
.perf-impressions { font-size: 12px; margin-bottom: 12px; }
.perf-goal-row { padding: 10px 0; border-top: 1px solid var(--border); }
.perf-goal-row:first-of-type { border-top: 0; padding-top: 4px; }
.perf-goal-name { font-size: 12px; color: var(--text-secondary); margin-bottom: 6px;
  text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.perf-numbers { display: grid; grid-template-columns: 1fr 1fr 1fr; gap: 12px; font-size: 13px; }
.lift { font-weight: 600; font-size: 15px; }
.lift-up { color: var(--success); }
.lift-down { color: var(--danger); }
.winner-badge { display: inline-block; margin-top: 8px; font-size: 12px; padding: 3px 10px;
  border-radius: var(--radius-pill); font-weight: 600; }
.winner-badge.variant { background: var(--success-soft); color: var(--success); }
.winner-badge.control { background: var(--warning-soft); color: var(--warning); }
.winner-badge.tentative { background: var(--bg); color: var(--text-secondary); font-weight: 500; }
.ab-tag { background: var(--success-soft); color: var(--success); padding: 2px 9px; border-radius: var(--radius-pill); font-size: 11px; font-weight: 600; }

/* ========== Snapshot inspector ========== */
.kv-list { display: grid; grid-template-columns: 140px 1fr; gap: 8px 16px; font-size: 14px; margin-bottom: 12px; }
.kv-list dt { color: var(--text-secondary); }
.kv-list dd { margin: 0; word-break: break-all; }
.ctx-group { margin-top: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 10px 14px; }
.ctx-group summary { cursor: pointer; user-select: none; padding: 2px 0; font-size: 13px; font-weight: 500; }
.ctx-group summary:hover { color: var(--accent); }
.detected-list { display: flex; flex-direction: column; gap: 6px; max-height: 320px; overflow-y: auto; margin-top: 8px; }
.detected-row { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 13px; }
.detected-row code { color: var(--accent); font-size: 11px; word-break: break-all; }
.detected-row .label { color: var(--text-secondary); font-size: 11px; text-transform: uppercase; letter-spacing: 0.04em; }

/* ========== Page-Switcher (Multi-Page) ========== */
.page-switcher { display: flex; align-items: center; gap: 12px; margin-bottom: 16px; padding: 12px 16px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md); flex-wrap: wrap; }
.page-switcher-label { font-size: 12px; color: var(--text-secondary); font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; }
.page-switcher select { width: auto; min-width: 240px; max-width: 420px; }
.page-switcher .muted { font-size: 12px; font-family: var(--font-mono); word-break: break-all; flex: 1; min-width: 200px; }
.page-switcher-single { padding: 12px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-md); margin-bottom: 16px; font-size: 13px; }

/* ========== Setting row ========== */
.setting-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px;
  padding: 16px; margin-top: 14px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); }
.setting-row > div:first-child { flex: 1; min-width: 0; }
.setting-label { font-size: 14px; font-weight: 600; margin-bottom: 4px; }
.setting-hint { font-size: 13px; line-height: 1.45; color: var(--text-secondary); }
.setting-row select { width: auto; min-width: 180px; flex-shrink: 0; }

/* ========== Ad uploads ========== */
.ad-row { display: grid; grid-template-columns: 88px 1fr; gap: 14px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  margin-bottom: 10px; align-items: start; box-shadow: var(--shadow-xs); }
.ad-thumb { width: 88px; height: 88px; object-fit: cover; border-radius: var(--radius-sm);
  background: var(--bg); border: 1px solid var(--border); }
.ad-thumb.file-icon { display: flex; align-items: center; justify-content: center; font-size: 34px; }
.ad-filename { font-weight: 600; font-size: 13px; margin-bottom: 6px; word-break: break-all; }
.ad-summary { display: flex; flex-direction: column; gap: 3px; font-size: 12.5px; line-height: 1.45; }
.utm-suggest { margin-top: 6px; font-size: 12px; color: var(--accent); }
.utm-suggest code { background: var(--accent-soft); padding: 2px 6px; border-radius: 4px; font-family: var(--font-mono); }
.source-badge { display: inline-block; background: var(--accent-soft); color: var(--accent);
  padding: 2px 8px; border-radius: var(--radius-pill); font-size: 11px; margin: 4px 0; font-weight: 500; }

/* ========== Modals & wizards ========== */
dialog { background: var(--surface); color: var(--text); border: 1px solid var(--border);
  border-radius: var(--radius-xl); padding: 0; min-width: 480px; max-width: 92vw; box-shadow: var(--shadow-lg); }
dialog::backdrop { background: rgba(0,0,0,0.35); backdrop-filter: blur(4px); }
dialog form, dialog .dialog-content { padding: 28px 32px 24px; }
dialog h3 { margin: 0 0 4px; font-size: 19px; font-weight: 600; letter-spacing: -0.01em; }
dialog .dialog-subtitle { color: var(--text-secondary); font-size: 13px; margin-bottom: 20px; }
dialog label { display: flex; flex-direction: column; gap: 6px; font-size: 13px; color: var(--text); margin-bottom: 14px; font-weight: 500; }
dialog label .label-hint { font-size: 11px; color: var(--text-secondary); font-weight: 400; margin-top: -3px; }
dialog .row { margin-top: 20px; }

/* Wizard */
.wizard-steps { display: flex; align-items: center; gap: 6px; margin-bottom: 24px; }
.wizard-step { flex: 1; height: 4px; background: var(--border); border-radius: var(--radius-pill); }
.wizard-step.active { background: var(--accent); }
.wizard-step.done { background: var(--success); }
.wizard-step-label { display: flex; justify-content: space-between; margin-bottom: 4px; font-size: 11px;
  color: var(--text-secondary); text-transform: uppercase; letter-spacing: 0.04em; font-weight: 600; }
.wizard-pane { display: none; }
.wizard-pane.active { display: block; }
.wizard-actions { display: flex; justify-content: space-between; margin-top: 28px; }

.platform-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 8px; margin-bottom: 16px; }
.platform-btn { padding: 14px 12px; background: var(--surface); border: 2px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: all .12s; text-align: center; font-size: 13px; font-weight: 500; }
.platform-btn:hover { border-color: var(--border-strong); }
.platform-btn.selected { border-color: var(--accent); background: var(--accent-soft); color: var(--accent); }
.platform-btn .emoji { display: block; font-size: 22px; margin-bottom: 4px; }

.verify-status { padding: 16px; border-radius: var(--radius-md); margin: 14px 0; font-size: 14px; }
.verify-status.waiting { background: var(--bg); border: 1px solid var(--border); }
.verify-status.success { background: var(--success-soft); border: 1px solid var(--success); color: var(--success); }
.verify-status.error { background: var(--warning-soft); border: 1px solid var(--warning); color: var(--warning); }

/* ========== Toast ========== */
.toast { position: fixed; bottom: 24px; left: 50%; transform: translateX(-50%); background: var(--text);
  color: white; padding: 11px 20px; border-radius: var(--radius-md); box-shadow: var(--shadow-lg); z-index: 100;
  font-size: 14px; font-weight: 500; }
.toast.error { background: var(--danger); }

/* ========== Spinner ========== */
.spinner { display: inline-block; width: 14px; height: 14px; border: 2px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%; animation: spin .8s linear infinite;
  vertical-align: middle; margin-right: 6px; }
@keyframes spin { to { transform: rotate(360deg); } }

/* ========== Tag (used in analysis) ========== */
.tag { display: inline-block; background: var(--accent-soft); color: var(--accent); padding: 3px 10px;
  border-radius: var(--radius-pill); font-size: 12px; margin: 2px 4px 2px 0; font-weight: 500; }
.tag-painpoint { background: var(--danger-soft); color: var(--danger); }

/* ========== Page-title row (Settings/danger zone) ========== */
.page-title-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 12px; margin-bottom: 24px; }
.danger-zone { border: 1px solid var(--danger); background: var(--danger-soft); border-radius: var(--radius-lg);
  padding: 18px; margin-top: 32px; }
.danger-zone h3 { color: var(--danger); margin-bottom: 4px; }
.danger-zone p { font-size: 13px; color: var(--text); margin-bottom: 12px; }

/* ========== Sidebar nav-item: single-line label ========== */
.sidebar .nav-item .label { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

/* ========== Overview: Hero Card (Core-Feature Ads) ========== */
.hero-card { background: linear-gradient(135deg, var(--accent-soft) 0%, var(--surface) 100%);
  border: 1px solid var(--accent-soft-strong); }
.hero-card-head { display: flex; justify-content: space-between; align-items: center; gap: 24px; flex-wrap: wrap; }
.hero-card-head h2 { font-size: 22px; margin: 4px 0 8px; letter-spacing: -0.01em; }
.hero-eyebrow { display: inline-block; font-size: 11px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.08em; color: var(--accent); background: var(--surface);
  padding: 3px 10px; border-radius: var(--radius-pill); border: 1px solid var(--accent-soft-strong); }
.hero-desc { color: var(--text-secondary); font-size: 14px; line-height: 1.5; max-width: 560px; margin: 0; }
.hero-actions { display: flex; gap: 10px; flex-wrap: wrap; }

/* ========== Site Type Pill + Tech Stack ========== */
.site-type-row { display: flex; align-items: center; gap: 12px; flex-wrap: wrap; margin-bottom: 12px; }
.site-type-pill { display: inline-block; padding: 4px 14px; border-radius: var(--radius-pill);
  font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.site-type-pill.site-type-lead_gen { background: var(--accent-soft); color: var(--accent); }
.site-type-pill.site-type-ecommerce { background: var(--success-soft); color: var(--success); }
.site-type-pill.site-type-hybrid { background: var(--warning-soft); color: var(--warning); }
.site-type-pill.site-type-content { background: var(--bg); color: var(--text-secondary); }
.site-type-pill.site-type-unknown { background: var(--bg); color: var(--text-tertiary); }
.site-type-reason { color: var(--text-secondary); font-size: 13px; }

.tech-stack-block { margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--border); }
.tech-chips { display: flex; flex-wrap: wrap; gap: 6px; }
.tech-chip { display: inline-flex; align-items: center; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 4px 10px; font-size: 12px; color: var(--text); font-weight: 500; }

/* ========== Section-Title accent variant ========== */
.section-title-accent { color: var(--accent); font-size: 13px; }

/* ========== Empty-state hero (used in Ads tab) ========== */
.empty-hero { padding: 48px 20px; background: linear-gradient(180deg, var(--surface) 0%, var(--bg) 100%); }

/* ========== Ad-Card (Ad row + embedded personalization) ========== */
.ad-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-lg);
  margin-bottom: 16px; overflow: hidden; box-shadow: var(--shadow-xs); }
.ad-card .ad-row { display: grid; grid-template-columns: 96px 1fr; gap: 16px; padding: 16px; border: 0;
  border-radius: 0; margin-bottom: 0; background: transparent; box-shadow: none; align-items: start; }
.ad-card .ad-thumb { width: 96px; height: 96px; }
.ad-card .ad-main { min-width: 0; }

.ad-personalization { background: linear-gradient(180deg, var(--accent-soft) 0%, rgba(230,241,255,0.3) 100%);
  border-top: 1px solid var(--accent-soft-strong); padding: 14px 16px 16px; }
.ad-personalization-head { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 8px; gap: 12px; flex-wrap: wrap; }
.ad-perso-eyebrow { font-size: 11px; font-weight: 700; letter-spacing: 0.06em; text-transform: uppercase;
  color: var(--accent); }
.ad-perso-status { font-size: 11px; font-weight: 600; padding: 2px 9px; border-radius: var(--radius-pill); }
.ad-perso-status.live { background: var(--success-soft); color: var(--success); }
.ad-perso-status.off { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border-strong); }
.ad-personalization .suggestion { background: var(--surface); margin-bottom: 0; }
.ad-personalization-empty { padding: 12px 14px; background: var(--bg); border: 1px dashed var(--border-strong);
  border-radius: var(--radius-md); display: flex; justify-content: space-between; align-items: center;
  gap: 12px; flex-wrap: wrap; font-size: 13px; }

/* ========== Goal Suggestions ========== */
.goal-suggestions-card { border-color: var(--accent-soft-strong); background: linear-gradient(180deg, var(--accent-soft) 0%, var(--surface) 80%); }
.goal-suggestions-head { display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 12px; gap: 12px; flex-wrap: wrap; }
.goal-suggestions-head h2 { font-size: 17px; margin-bottom: 4px; }
.goal-suggestion-list { display: flex; flex-direction: column; gap: 8px; margin-top: 6px; }
.goal-suggestion { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px; display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; }
.goal-suggestion.is-primary { border-left: 3px solid var(--accent); }
.goal-suggestion.is-secondary { border-left: 3px solid var(--border-strong); }
.goal-suggestion.is-applied { background: var(--success-soft); border-color: var(--success); }
.goal-suggestion-main { flex: 1; min-width: 0; }
.goal-suggestion-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.goal-priority { font-size: 10px; font-weight: 700; padding: 2px 7px; border-radius: var(--radius-sm);
  text-transform: uppercase; letter-spacing: 0.06em; }
.goal-priority.primary { background: var(--accent); color: white; }
.goal-priority.secondary { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border-strong); }
.goal-suggestion-trigger { font-size: 13px; margin-bottom: 4px; }
.goal-suggestion-selector { display: inline-block; font-family: var(--font-mono); font-size: 11px;
  color: var(--accent); background: var(--bg); padding: 2px 6px; border-radius: 4px;
  max-width: 100%; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.goal-suggestion-reasoning { font-size: 12.5px; color: var(--text-secondary); margin-top: 6px; line-height: 1.4; }
.goal-suggestion-actions { flex-shrink: 0; }
.goal-pill.applied { background: var(--success-soft); color: var(--success); padding: 4px 10px; font-size: 12px; }

/* ========== Site-Health Banner (Nielsen H1: Visibility of system status) ========== */
.health-banner { display: flex; align-items: center; gap: 12px; padding: 12px 16px;
  border-radius: var(--radius-md); margin-bottom: 20px; font-size: 13.5px; line-height: 1.5;
  border: 1px solid transparent; }
.health-banner .health-icon { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-weight: 700; font-size: 13px; color: white; }
.health-banner .health-body { flex: 1; min-width: 0; }
.health-banner .health-title { font-weight: 600; color: var(--text); }
.health-banner .health-detail { color: var(--text-secondary); font-size: 12.5px; margin-top: 2px; }
.health-banner .health-actions { flex-shrink: 0; display: flex; gap: 8px; }

.health-banner.ok       { background: var(--success-soft); border-color: var(--success); }
.health-banner.ok       .health-icon { background: var(--success); }
.health-banner.warning  { background: var(--warning-soft); border-color: var(--warning); }
.health-banner.warning  .health-icon { background: var(--warning); }
.health-banner.error    { background: var(--danger-soft);  border-color: var(--danger); }
.health-banner.error    .health-icon { background: var(--danger); }
.health-banner.neutral  { background: var(--bg); border-color: var(--border-strong); }
.health-banner.neutral  .health-icon { background: var(--text-tertiary); }

/* ========== Snapshot-Source Banner ========== */
.source-banner { display: flex; align-items: center; gap: 10px; padding: 10px 14px;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  font-size: 13px; color: var(--text-secondary); margin-bottom: 16px; flex-wrap: wrap; }
.source-banner strong { color: var(--text); font-weight: 600; }
.source-banner code { font-size: 12px; }
.source-banner select { width: auto; min-width: 200px; padding: 5px 10px; font-size: 13px; }

/* ========== Tooltip-System (Nielsen H6, H10) ========== */
.info-icon { display: inline-flex; align-items: center; justify-content: center; width: 16px; height: 16px;
  border-radius: 50%; background: var(--bg); border: 1px solid var(--border-strong); color: var(--text-tertiary);
  font-size: 11px; font-weight: 600; cursor: help; margin-left: 6px; line-height: 1;
  font-family: var(--font); user-select: none; vertical-align: middle; }
.info-icon:hover { background: var(--accent-soft); border-color: var(--accent); color: var(--accent); }
.info-icon[data-tooltip] { position: relative; }
.info-icon[data-tooltip]:hover::after {
  content: attr(data-tooltip); position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: var(--text); color: white; padding: 8px 12px; border-radius: var(--radius-md);
  font-size: 12px; font-weight: 400; white-space: normal; min-width: 220px; max-width: 320px;
  z-index: 100; box-shadow: var(--shadow-md); text-align: left; line-height: 1.4;
  pointer-events: none;
}
.info-icon[data-tooltip]:hover::before {
  content: ''; position: absolute; bottom: calc(100% + 4px); left: 50%; transform: translateX(-50%);
  border: 4px solid transparent; border-top-color: var(--text); z-index: 100; pointer-events: none;
}

/* ========== Step-Indikator (Nielsen H1: bei Analyse + Suggestion) ========== */
.stepper { display: flex; flex-direction: column; gap: 10px; padding: 16px; background: var(--bg);
  border: 1px solid var(--border); border-radius: var(--radius-md); margin-bottom: 16px; }
.stepper-step { display: flex; align-items: flex-start; gap: 12px; font-size: 13px; }
.stepper-step .step-bullet { flex-shrink: 0; width: 22px; height: 22px; border-radius: 50%;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text-tertiary);
  display: inline-flex; align-items: center; justify-content: center; font-size: 11px; font-weight: 600; }
.stepper-step.done .step-bullet { background: var(--success); border-color: var(--success); color: white; }
.stepper-step.active .step-bullet { background: var(--accent); border-color: var(--accent); color: white; }
.stepper-step.active .step-bullet::after { content: ''; width: 6px; height: 6px; background: white;
  border-radius: 50%; animation: pulse 1.2s ease-in-out infinite; }
.stepper-step.active .step-bullet { font-size: 0; }
.stepper-step.pending .step-bullet { color: var(--text-tertiary); }
.stepper-step .step-label { flex: 1; }
.stepper-step.active .step-label { color: var(--text); font-weight: 500; }
.stepper-step.done .step-label { color: var(--text-secondary); }
@keyframes pulse {
  0%, 100% { opacity: 0.4; transform: scale(0.8); }
  50% { opacity: 1; transform: scale(1.2); }
}

/* ========== Inline help-text below labels ========== */
.help-text { display: block; font-size: 12px; color: var(--text-secondary); margin-top: 4px; line-height: 1.4; }
.help-text.warning { color: var(--warning); }
.help-text.danger  { color: var(--danger); }

/* ========== Live-Activation confirmation dialog ========== */
.activation-modal-content { padding: 28px 32px 24px; }
.activation-modal-content h3 { font-size: 19px; margin-bottom: 12px; }
.activation-modal-content .activation-warning {
  background: var(--warning-soft); border: 1px solid var(--warning);
  padding: 14px 16px; border-radius: var(--radius-md); margin: 16px 0; font-size: 14px; line-height: 1.5;
}
.activation-modal-content .activation-warning strong { color: var(--warning); }
.activation-modal-content .activation-changes { background: var(--bg); border: 1px solid var(--border);
  padding: 12px 14px; border-radius: var(--radius-md); margin: 12px 0; font-size: 13px; max-height: 200px; overflow-y: auto; }

/* ========== Persona Cards (Site-Kontext) ========== */
.persona-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 12px; }
.persona-card { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 14px 16px; display: flex; flex-direction: column; gap: 6px; transition: border-color .12s; }
.persona-card:hover { border-color: var(--accent-soft-strong); }
.persona-card-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: 8px; margin-bottom: 4px; }
.persona-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; flex: 1; min-width: 0; }
.persona-card-title strong { font-size: 14px; }
.persona-card-actions { display: flex; gap: 4px; flex-shrink: 0; }
.persona-section-title { font-size: 13px; font-weight: 600; color: var(--text);
  text-transform: uppercase; letter-spacing: 0.04em; margin: 0 0 10px;
  padding-top: 4px; }
.persona-card-derived { background: rgba(124, 58, 237, .04);
  border-color: rgba(124, 58, 237, .25); border-style: dashed; }
.persona-card-derived:hover { background: rgba(124, 58, 237, .06); }
.persona-source-tag { font-size: 10.5px; color: var(--accent);
  background: var(--accent-soft); padding: 1px 8px; border-radius: 999px; font-weight: 500; }
.persona-usage-unused { color: var(--muted); background: var(--bg); font-weight: 400; }
.persona-meta-muted { padding-top: 4px; border-top: 1px solid var(--border);
  margin-top: 4px; }
.persona-row { font-size: 12.5px; line-height: 1.4; display: grid; grid-template-columns: 80px 1fr; gap: 8px; }
.persona-label { color: var(--text-secondary); font-size: 11px; text-transform: uppercase;
  letter-spacing: 0.04em; font-weight: 600; }

/* ========== Checkbox-Liste (Persona-/Path-Auswahl) ========== */
.checkbox-list { display: flex; flex-direction: column; gap: 4px; max-height: 280px; overflow-y: auto;
  padding: 8px; background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); }
.checkbox-row { display: flex; align-items: center; gap: 10px; padding: 6px 10px; border-radius: var(--radius-sm);
  cursor: pointer; font-size: 13px; transition: background .12s; }
.checkbox-row:hover { background: var(--surface); }
.checkbox-row input[type="checkbox"] { margin: 0; flex-shrink: 0; cursor: pointer; }
.checkbox-row strong { font-weight: 500; }
.checkbox-row input[type="checkbox"]:disabled + span { opacity: 0.4; }

/* ========== Path-Chips (auf Suggestion-Card) ========== */
.chip-path { background: var(--bg); border: 1px solid var(--border-strong); color: var(--text);
  padding: 3px 10px; font-family: var(--font); font-size: 12px; font-weight: 500; }
.chip-path.is-all { background: var(--accent-soft); border-color: var(--accent-soft-strong); color: var(--accent); }

/* ========== Setup-Progress-Card (Overview) ========== */
.setup-card { border: 1px solid var(--border); }
.setup-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; }
.setup-progress-label { font-size: 12px; color: var(--text-secondary); font-weight: 500; }
.setup-list { display: flex; flex-direction: column; gap: 0; }
.setup-step { display: grid; grid-template-columns: 40px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 0; border-top: 1px solid var(--border); }
.setup-step:first-child { border-top: 0; padding-top: 4px; }
.setup-bullet { width: 28px; height: 28px; border-radius: 50%; display: inline-flex; align-items: center;
  justify-content: center; font-weight: 600; font-size: 13px;
  border: 2px solid var(--border-strong); background: var(--surface); color: var(--text-secondary); }
.setup-step.done .setup-bullet { background: var(--success); border-color: var(--success); color: white; }
.setup-step.active .setup-bullet { background: var(--accent); border-color: var(--accent); color: white;
  box-shadow: 0 0 0 4px var(--accent-soft); }
.setup-step.pending .setup-bullet { opacity: 0.6; }
.setup-title { font-weight: 500; font-size: 14px; color: var(--text); }
.setup-step.done .setup-title { color: var(--text-secondary); }
.setup-sub { font-size: 12.5px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }
.setup-action { flex-shrink: 0; }

/* ========== Filter-Toolbar (Personalisierungs-Tab) ========== */
.filter-bar { display: flex; gap: 12px; align-items: center; margin-bottom: 16px; flex-wrap: wrap; }
.filter-tabs { display: inline-flex; gap: 2px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); padding: 3px; }
.filter-tab { background: transparent; border: 0; padding: 6px 12px; font-size: 13px;
  border-radius: var(--radius-sm); cursor: pointer; color: var(--text-secondary); font-weight: 500;
  display: inline-flex; align-items: center; gap: 6px; font-family: inherit; }
.filter-tab:hover { color: var(--text); }
.filter-tab.active { background: var(--surface); color: var(--text); box-shadow: var(--shadow-xs); }
.filter-count { background: var(--bg); color: var(--text-secondary); font-size: 11px;
  padding: 1px 7px; border-radius: var(--radius-pill); font-weight: 600; }
.filter-tab.active .filter-count { background: var(--accent-soft); color: var(--accent); }
.filter-search { flex: 1; min-width: 200px; max-width: 320px; padding: 7px 12px; font-size: 13px; }

/* ========== Compact Suggestion-Row (List View) ========== */
.suggestion-row-wrap { background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 10px; overflow: hidden; }
.suggestion-row-wrap .suggestion { margin-bottom: 0; border: 0; box-shadow: none; border-radius: 0; }
.suggestion-row-collapse-bar { padding: 6px 16px; background: var(--bg); border-bottom: 1px solid var(--border);
  display: flex; justify-content: flex-end; }
.suggestion-row { display: grid; grid-template-columns: 44px 1fr auto; gap: 14px; align-items: center;
  padding: 14px 16px; background: var(--surface); border: 1px solid var(--border);
  border-radius: var(--radius-lg); margin-bottom: 8px; box-shadow: var(--shadow-xs); cursor: pointer;
  transition: border-color .12s; }
.suggestion-row:hover { border-color: var(--border-strong); }
.suggestion-row.is-enabled { border-left: 3px solid var(--success); padding-left: 13px; }
.row-switch { flex-shrink: 0; }
.row-main { min-width: 0; }
.row-top { display: flex; align-items: center; gap: 8px; margin-bottom: 4px; flex-wrap: wrap; }
.row-title { font-size: 14.5px; font-weight: 600; color: var(--text); margin: 0; }
.row-tag { display: inline-block; padding: 2px 8px; border-radius: var(--radius-pill);
  font-size: 10.5px; font-weight: 600; letter-spacing: 0.02em; text-transform: uppercase; }
.tag-ad { background: var(--accent-soft); color: var(--accent); }
.tag-manual { background: var(--bg); color: var(--text-secondary); border: 1px solid var(--border-strong); }
.tag-ab { background: var(--warning-soft); color: var(--warning); }
.row-meta { display: flex; gap: 14px; font-size: 12.5px; color: var(--text-secondary); flex-wrap: wrap; }
.meta-item { display: inline-flex; gap: 4px; align-items: center; }
.meta-icon { color: var(--text-tertiary); font-size: 11px; }
.row-actions { display: flex; gap: 6px; flex-shrink: 0; }

/* ========== Compact ad-perso strip (Anzeigen-Tab) ========== */
.ad-perso-strip { display: grid; grid-template-columns: 44px 1fr auto; gap: 12px; align-items: center;
  padding: 12px 16px; background: var(--bg); border-top: 1px solid var(--border);
  border-radius: 0 0 var(--radius-lg) var(--radius-lg); }
.ad-perso-strip.is-live { background: linear-gradient(90deg, var(--success-soft) 0%, var(--bg) 60%); }
.ad-perso-info { min-width: 0; }
.ad-perso-title { font-weight: 600; font-size: 13.5px; color: var(--text); margin-bottom: 2px; }
.ad-perso-sub { font-size: 12px; color: var(--text-secondary); }
.ad-perso-sub code { font-size: 11.5px; }

/* ========== Page-header CTA button — consistent across all tabs ========== */
.page-title-row .btn-primary { padding: 9px 16px; font-size: 14px; font-weight: 600; white-space: nowrap; flex-shrink: 0; }
.page-title-row { gap: 16px; }

/* ========== Drag-and-Drop Zone (Anzeigen tab) ========== */
.dropzone { border: 2px dashed var(--border-strong); border-radius: var(--radius-lg);
  padding: 28px 20px; text-align: center; background: var(--bg); margin-bottom: 16px;
  transition: all .15s; cursor: pointer; }
.dropzone:hover { border-color: var(--accent); background: var(--accent-soft); }
.dropzone.is-dragover { border-color: var(--accent); background: var(--accent-soft);
  border-style: solid; transform: scale(1.01); }
.dropzone-icon { font-size: 28px; opacity: 0.5; margin-bottom: 6px; }
.dropzone-title { font-size: 14px; font-weight: 600; color: var(--text); margin-bottom: 2px; }
.dropzone-sub { font-size: 12.5px; color: var(--text-secondary); }

/* ========== Persona Card v2 — denser, clearer ========== */
.persona-card { gap: 8px; }
.persona-card-head { align-items: flex-start; }
.persona-card-title { display: flex; align-items: center; gap: 8px; flex-wrap: wrap; min-width: 0; }
.persona-card-actions { display: inline-flex; gap: 4px; flex-shrink: 0; }
.persona-card-actions .btn { width: 28px; height: 28px; padding: 0; font-size: 14px; }
.persona-usage { background: var(--accent-soft); color: var(--accent); font-size: 10.5px;
  font-weight: 600; padding: 2px 7px; border-radius: var(--radius-pill); }
.persona-pain { font-size: 13px; line-height: 1.4; color: var(--text); padding: 8px 10px;
  background: var(--warning-soft); border-left: 3px solid var(--warning); border-radius: var(--radius-sm);
  display: flex; gap: 8px; align-items: flex-start; }
.persona-pain-icon { color: var(--warning); font-size: 14px; line-height: 1.3; flex-shrink: 0; }
.persona-meta { font-size: 12.5px; color: var(--text-secondary); line-height: 1.4; }
.persona-meta strong { color: var(--text); font-weight: 600; }

/* ========== Performance Tab — clearer A/B test cards ========== */
.perf-rule { padding: 18px; margin-bottom: 14px; }
.perf-rule-head { margin-bottom: 14px; align-items: flex-start; }
.ab-goal-card { background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 16px; margin-bottom: 10px; }
.ab-goal-card.win { border-color: var(--success); }
.ab-goal-card.lose { border-color: var(--danger); }
.ab-goal-card.tentative { border-color: var(--warning); }
.ab-goal-head { display: flex; justify-content: space-between; align-items: flex-start; gap: 16px; margin-bottom: 14px; flex-wrap: wrap; }
.ab-goal-label { font-size: 10.5px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.06em; margin-bottom: 2px; }
.ab-goal-name { font-size: 15px; font-weight: 600; color: var(--text); }
.ab-verdict { display: inline-flex; align-items: center; gap: 10px; padding: 8px 14px;
  border-radius: var(--radius-md); max-width: 380px; }
.ab-verdict.win { background: var(--success-soft); }
.ab-verdict.lose { background: var(--danger-soft); }
.ab-verdict.tentative { background: var(--warning-soft); }
.ab-verdict.inconclusive { background: var(--bg); border: 1px solid var(--border); }
.ab-verdict-icon { width: 28px; height: 28px; border-radius: 50%; display: inline-flex;
  align-items: center; justify-content: center; font-weight: 700; color: white; flex-shrink: 0; }
.ab-verdict.win .ab-verdict-icon { background: var(--success); }
.ab-verdict.lose .ab-verdict-icon { background: var(--danger); }
.ab-verdict.tentative .ab-verdict-icon { background: var(--warning); }
.ab-verdict.inconclusive .ab-verdict-icon { background: var(--text-tertiary); }
.ab-verdict-title { font-size: 13.5px; font-weight: 600; color: var(--text); line-height: 1.3; }
.ab-verdict-sub { font-size: 12px; color: var(--text-secondary); margin-top: 2px; line-height: 1.4; }

.ab-versus { display: grid; grid-template-columns: 1fr 40px 1fr; gap: 14px; align-items: center;
  margin: 14px 0; }
.ab-side { padding: 14px 16px; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-md); text-align: center; transition: all .15s; }
.ab-side.is-winner.variant { border-color: var(--success); background: var(--success-soft); box-shadow: 0 0 0 1px var(--success); }
.ab-side.is-winner.control { border-color: var(--warning); background: var(--warning-soft); box-shadow: 0 0 0 1px var(--warning); }
.ab-side-label { font-size: 11px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--text-secondary); margin-bottom: 6px; }
.ab-side-number { font-size: 40px; font-weight: 700; color: var(--text); line-height: 1; letter-spacing: -0.02em; }
.ab-side.is-winner .ab-side-number { color: var(--text); }
.ab-pct { font-size: 22px; font-weight: 500; color: var(--text-secondary); margin-left: 2px; }
.ab-side-sub { font-size: 12px; color: var(--text-secondary); margin-top: 6px; }
.ab-vs { text-align: center; font-size: 12px; font-weight: 600; color: var(--text-tertiary);
  text-transform: uppercase; letter-spacing: 0.1em; }

.ab-confidence-bar { position: relative; height: 8px; background: var(--bg); border-radius: 4px;
  overflow: hidden; margin-top: 12px; }
.ab-confidence-fill { height: 100%; background: linear-gradient(90deg, var(--accent), var(--success));
  border-radius: 4px; transition: width .4s; }
.ab-confidence-label { position: absolute; left: 50%; top: 14px; transform: translateX(-50%);
  font-size: 11px; color: var(--text-secondary); white-space: nowrap; }

/* ========== View-Toggle (Karten/Tabelle) ========== */
.view-toggle { display: inline-flex; background: var(--bg); border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 2px; gap: 2px; }
.view-toggle-btn { background: none; border: none; padding: 5px 11px; font-size: 12.5px;
  color: var(--muted); cursor: pointer; border-radius: var(--radius-sm); transition: all .12s; }
.view-toggle-btn:hover { color: var(--text); }
.view-toggle-btn.active { background: var(--surface); color: var(--accent); font-weight: 600;
  box-shadow: var(--shadow-xs); }

/* ========== Bulk-Edit-Tabelle ========== */
.bulk-toolbar { display: flex; justify-content: space-between; align-items: center;
  margin: 4px 0 12px; gap: 12px; }
.bulk-table-wrap { border: 1px solid var(--border); border-radius: var(--radius-md);
  overflow: auto; max-height: 70vh; }
.bulk-table { width: 100%; border-collapse: collapse; font-size: 13px; }
.bulk-table thead th { position: sticky; top: 0; z-index: 2; background: var(--surface);
  text-align: left; padding: 10px 12px; font-size: 11.5px; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted); border-bottom: 1px solid var(--border); }
.bulk-table td { padding: 8px 12px; border-bottom: 1px solid var(--border); vertical-align: top; }
.bt-sug-head td { background: var(--bg); border-top: 2px solid var(--border);
  padding: 10px 12px; }
.bt-sug-head strong { font-size: 13.5px; }
.bt-toggle { width: 48px; }
.bt-path { color: var(--muted); font-size: 11.5px; white-space: nowrap; }
.bt-label { color: var(--text); font-size: 12px; }
.bt-original { color: var(--muted); font-size: 12px; line-height: 1.4; }
.bt-new-input { width: 100%; box-sizing: border-box; border: 1px solid var(--border);
  border-radius: var(--radius-sm); padding: 6px 8px; font-size: 12.5px; font-family: inherit;
  resize: none; overflow: hidden; line-height: 1.4; background: var(--surface);
  transition: border-color .12s; }
.bt-new-input:focus { outline: none; border-color: var(--accent); background: #fff; }
.bt-change:hover td { background: rgba(124,58,237,.02); }

/* ========== Expand-Dialog rows (URL + level-selector) ========== */
.exp-list { display: flex; flex-direction: column; gap: 4px; max-height: 320px;
  overflow-y: auto; border: 1px solid var(--border); border-radius: var(--radius-md);
  padding: 6px; background: var(--bg); }
.exp-row { display: flex; align-items: center; justify-content: space-between;
  gap: 12px; padding: 8px 10px; border-radius: var(--radius-sm);
  background: var(--surface); border: 1px solid transparent;
  transition: border-color .12s, background .12s; }
.exp-row:hover { border-color: var(--border); }
.exp-row-check { display: flex; align-items: center; gap: 10px; flex: 1; min-width: 0;
  cursor: pointer; user-select: none; }
.exp-row-check input[type="checkbox"] { margin: 0; flex-shrink: 0; cursor: pointer;
  width: 16px; height: 16px; accent-color: var(--accent); }
.exp-row-path { font-size: 13px; color: var(--text); overflow: hidden;
  text-overflow: ellipsis; white-space: nowrap; flex: 1; }
.exp-row-badge { background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; padding: 1px 7px; border-radius: 999px;
  font-weight: 600; flex-shrink: 0; }
.exp-row-remove { background: none; border: none; color: var(--muted);
  font-size: 16px; line-height: 1; padding: 2px 6px; cursor: pointer;
  border-radius: var(--radius-sm); }
.exp-row-remove:hover { color: #b91c1c; background: rgba(239,68,68,.08); }
.exp-row-level { display: flex; gap: 2px; flex-shrink: 0;
  background: var(--bg); border-radius: 999px; padding: 2px; }
.exp-level-pill { position: relative; cursor: pointer; }
.exp-level-pill input[type="radio"] { position: absolute; opacity: 0; pointer-events: none; }
.exp-level-pill span { display: inline-block; padding: 4px 12px;
  font-size: 11.5px; color: var(--muted); border-radius: 999px;
  transition: color .12s, background .12s, font-weight .12s;
  user-select: none; }
.exp-level-pill:hover span { color: var(--text); }
.exp-level-pill input[type="radio"]:checked + span {
  background: var(--accent); color: white; font-weight: 600; }

/* ========== Custom confirm dialog (replaces native confirm()) ========== */
.confirm-dialog-message { font-size: 14.5px; color: var(--text);
  line-height: 1.5; padding: 4px 0 0; }
.btn.btn-danger { background: #dc2626; color: white; border: 1px solid #dc2626; }
.btn.btn-danger:hover { background: #b91c1c; border-color: #b91c1c; }

/* ========== Background-Job-Bar (bottom-right) ========== */
.job-bar { position: fixed; right: 16px; bottom: 16px; z-index: 9999;
  display: flex; flex-direction: column; gap: 6px; pointer-events: none;
  max-width: 320px; }
.job-bubble { background: var(--surface); border: 1px solid var(--border);
  border-radius: 999px; padding: 8px 14px 8px 12px; box-shadow: var(--shadow-md);
  display: inline-flex; align-items: center; gap: 8px;
  font-size: 12.5px; color: var(--text); pointer-events: auto;
  animation: jobIn .18s ease-out; transition: opacity .25s; }
.job-bubble.job-done { border-color: rgba(34, 197, 94, .50);
  background: rgba(34, 197, 94, .06); }
.job-bubble.job-error { border-color: rgba(239, 68, 68, .50);
  background: rgba(239, 68, 68, .06); }
.job-bubble.job-queued { opacity: .65; }
.job-icon { font-weight: 600; font-size: 13px;
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; }
.job-done .job-icon { color: #15803d; }
.job-error .job-icon { color: #b91c1c; }
.job-label { font-weight: 500; white-space: nowrap; max-width: 220px;
  overflow: hidden; text-overflow: ellipsis; }
.job-error .job-label { color: #b91c1c; }
.job-error-text { font-size: 11px; color: #b91c1c; opacity: .8; }
.job-spinner { display: inline-block; width: 12px; height: 12px;
  border: 2px solid var(--border); border-top-color: var(--accent);
  border-radius: 50%; animation: jobSpin .7s linear infinite; }
@keyframes jobSpin { to { transform: rotate(360deg); } }
@keyframes jobIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ========== KI-Metadaten in der Suggestion-Card ========== */
.confidence-badge { display: inline-flex; align-items: center; gap: 3px;
  font-size: 10.5px; font-family: var(--font-mono); padding: 1px 6px;
  border-radius: 999px; margin-left: 6px; font-weight: 600; }
.confidence-high { background: rgba(34, 197, 94, .12); color: #15803d; }
.confidence-medium { background: rgba(245, 158, 11, .15); color: #b45309; }
.confidence-low { background: rgba(239, 68, 68, .12); color: #b91c1c; }
.role-badge { display: inline-flex; font-size: 10.5px;
  padding: 1px 7px; border-radius: 999px; background: var(--bg);
  color: var(--muted); margin-left: 6px; font-family: var(--font-mono); }
.interactive-badge { display: inline-flex; font-size: 10.5px;
  padding: 1px 7px; border-radius: 999px;
  background: rgba(124, 58, 237, .10); color: var(--accent);
  margin-left: 6px; }
.match-reasoning { font-size: 11.5px; color: var(--muted);
  margin-top: 4px; font-style: italic; }
.suggestion-warnings { background: rgba(245, 158, 11, .08);
  border: 1px solid rgba(245, 158, 11, .30); border-radius: var(--radius-md);
  padding: 10px 12px; margin: 12px 0 0; }
.suggestion-warnings .warning-head { font-weight: 600;
  color: #b45309; font-size: 12.5px; margin-bottom: 4px; }
.suggestion-warnings ul { margin: 0; padding-left: 18px; font-size: 12.5px;
  color: var(--text); }
.suggestion-warnings li { margin-bottom: 2px; }
.suggestion-skipped { margin-top: 12px; font-size: 12.5px; }
.suggestion-skipped summary { cursor: pointer; color: var(--muted);
  user-select: none; padding: 4px 0; }
.suggestion-skipped summary:hover { color: var(--text); }
.suggestion-skipped ul { margin: 6px 0 0; padding-left: 18px; color: var(--muted); }
.suggestion-skipped li { margin-bottom: 3px; }

/* ========== Path-Tabs as pill-chips (doubles as "Aktive Seiten"-overview) ========== */
.path-tabs { display: flex; flex-wrap: wrap; gap: 6px; margin: 4px 0 0; }
.path-tab { background: var(--bg); border: 1px solid var(--border);
  padding: 5px 11px; border-radius: 999px;
  font-family: var(--font-mono); font-size: 12px; color: var(--text);
  cursor: pointer; display: inline-flex; align-items: center; gap: 6px;
  transition: color .12s, background .12s, border-color .12s, transform .08s;
  line-height: 1.3; }
.path-tab:hover { border-color: var(--accent-soft-strong); background: var(--surface); }
.path-tab:active { transform: scale(0.97); }
.path-tab.is-active { color: white; background: var(--accent);
  border-color: var(--accent); font-weight: 600; }
.path-tab.is-static { cursor: default; }
.path-tab.is-static:hover { border-color: var(--border); background: var(--bg); }
.path-tab.is-static.is-active { cursor: default; }
.path-tab.is-all { color: var(--muted); font-style: italic; }
.path-tab-label { line-height: 1.3; }
.path-tab-count { background: var(--accent-soft); color: var(--accent);
  font-size: 10.5px; font-weight: 600; padding: 1px 6px; border-radius: 999px;
  line-height: 1.3; }
.path-tab.is-active .path-tab-count { background: rgba(255,255,255,.25); color: white; }

/* ========== Scrape-Card (Seiten manuell hinzufuegen) ========== */
.scrape-card textarea { width: 100%; box-sizing: border-box; }

/* ========== Angle-Picker-Dialog ========== */
.angle-list { display: flex; flex-direction: column; gap: 10px; max-height: 480px; overflow-y: auto;
  background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 10px; }
.angle-item { display: grid; grid-template-columns: 28px 1fr; gap: 12px; padding: 14px;
  background: var(--surface); border: 1px solid var(--border); border-radius: var(--radius-md);
  cursor: pointer; transition: border-color .12s, background .12s; align-items: flex-start; }
.angle-item:hover { border-color: var(--border-strong); }
.angle-item input[type="checkbox"] { margin: 0; cursor: pointer; flex-shrink: 0; transform: translateY(2px); }
.angle-item.is-applied { border-color: var(--success); background: var(--success-soft); cursor: default; }
.angle-item.is-applied input { cursor: default; }
.angle-body { min-width: 0; }
.angle-head { display: flex; gap: 10px; align-items: center; margin-bottom: 4px; flex-wrap: wrap; }
.angle-head strong { font-size: 14px; }
.angle-source { font-size: 11.5px; color: var(--text-secondary); font-style: italic; margin-bottom: 6px; }
.angle-meta { font-size: 12.5px; line-height: 1.45; color: var(--text); margin-bottom: 8px; }
.angle-changes { background: var(--bg); border: 1px solid var(--border); border-radius: var(--radius-sm);
  padding: 8px 10px; font-size: 12px; line-height: 1.5; }
.angle-change-row { margin-bottom: 3px; }
.angle-change-row .strike { text-decoration: line-through; color: var(--text-tertiary); }
.angle-rationale { font-size: 12px; color: var(--text-secondary); font-style: italic; margin-top: 6px;
  padding: 6px 8px; background: var(--bg); border-left: 2px solid var(--border-strong); border-radius: 0 var(--radius-sm) var(--radius-sm) 0; }

/* ========== Responsive ========== */
@media (max-width: 900px) {
  .app { grid-template-columns: 1fr; grid-template-areas: "topbar" "main"; }
  .sidebar { display: none; }
  .main { padding: 20px; }
}
