/* ASO Research — Dark SaaS Dashboard (AppTweak / Reference Exact Match) */
:root {
  --bg: #080b11;
  --bg-sidebar: #0b0f17;
  --bg-card: #131926;
  --bg-input: #0f1523;
  --border-line: #1e293b;
  --border-focus: #232f46;
  
  --fg: #ffffff;
  --fg-sec: #94a3b8;
  --fg-muted: #64748b;
  --fg-dim: #334155;
  
  --brand-blue: #2563eb;
  --brand-blue-hover: #1d4ed8;
  --blue-soft: #1e3a8a;
  --blue-text: #60a5fa;
  --cyan-text: #38bdf8;
  
  --green-bg: #064e3b;
  --green-text: #34d399;
  --green-dot: #22c55e;
  
  --purple-bg: #4c1d95;
  --purple-text: #a78bfa;
  
  --gold-bg: #78350f;
  --gold-text: #fbbf24;
  
  --pink-bg: #831843;
  --pink-text: #f472b6;
  --red-diff: #f43f5e;
  --yellow-diff: #f59e0b;
  
  --radius-sm: 4px;
  --radius-md: 6px;
  --radius-lg: 8px;
}

* { box-sizing: border-box; }
html, body { height: 100%; margin: 0; }

body {
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "SF Pro Text", Inter, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* Shell Layout */
.shell {
  display: grid;
  grid-template-columns: 240px 1fr;
  min-height: 100vh;
}

/* Left Sidebar */
.sidebar {
  background: var(--bg-sidebar);
  border-right: 1px solid var(--border-line);
  display: flex;
  flex-direction: column;
  padding: 16px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  overflow-y: auto;
  z-index: 10;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 6px 18px;
}
.mark {
  width: 28px;
  height: 28px;
  border-radius: 7px;
  background: var(--brand-blue);
  color: #fff;
  font-weight: 700;
  font-size: 14px;
  display: grid;
  place-items: center;
}
.brand-text strong {
  display: block;
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
}
.brand-text span {
  font-size: 11px;
  color: var(--fg-muted);
}

.nav { display: flex; flex-direction: column; gap: 3px; }
.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: transparent;
  border: 0;
  border-radius: var(--radius-md);
  color: var(--fg-sec);
  font-size: 13px;
  font-weight: 500;
  padding: 8px 10px;
  cursor: pointer;
  text-align: left;
  transition: all 0.15s ease;
}
.nav-item svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.8; flex: none; }
.nav-item:hover { background: #131926; color: #fff; }
.nav-item.active { background: #1e293b; color: #fff; font-weight: 600; }

/* Sidebar Filters Section */
.sidebar-filters {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid var(--border-line);
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.filters-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.filters-title {
  font-size: 12px;
  font-weight: 700;
  color: #fff;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}
.reset-link {
  background: transparent;
  border: 0;
  color: var(--brand-blue);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}
.filter-group { display: flex; flex-direction: column; gap: 6px; }
.filter-lbl { font-size: 11.5px; color: var(--fg-sec); font-weight: 500; }
.side-input {
  background: var(--bg-input);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 12px;
  padding: 6px 9px;
  outline: none;
}
.side-input:focus { border-color: var(--brand-blue); }
.check-list { display: flex; flex-direction: column; gap: 6px; }
.check-item {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--fg-sec);
  cursor: pointer;
}
.check-item input[type="checkbox"] {
  accent-color: var(--brand-blue);
  border-radius: 3px;
  cursor: pointer;
}
.check-item span { flex: 1; display: flex; justify-content: space-between; }
.check-item b { font-weight: 600; color: #fff; font-variant-numeric: tabular-nums; }
.slider-head { display: flex; justify-content: space-between; align-items: center; }
.slider-val { font-size: 11.5px; color: #fff; font-variant-numeric: tabular-nums; }
.side-range {
  width: 100%;
  accent-color: var(--brand-blue);
  cursor: pointer;
}
.info-dot { font-style: normal; color: var(--fg-muted); font-size: 11px; margin-left: 2px; }

.side-foot {
  margin-top: auto;
  padding-top: 14px;
}
.side-card {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
}
.side-card .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-dot);
  box-shadow: 0 0 6px rgba(34, 197, 94, 0.4);
}
.side-card strong { font-size: 12px; color: #fff; }
.side-card span { font-size: 11px; color: var(--fg-muted); margin-left: 4px; }

/* Main Content Area */
.main {
  padding: 24px 32px 80px;
  overflow-y: auto;
  min-width: 0;
}

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 20px;
}
.topbar h1 {
  margin: 0;
  font-size: 22px;
  font-weight: 700;
  color: #fff;
  letter-spacing: -0.015em;
}
#page-sub {
  margin: 4px 0 0;
  color: var(--fg-sec);
  font-size: 13px;
}
.top-actions { display: flex; align-items: center; gap: 10px; }
.ads-connect-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  font-size: 12px;
  font-weight: 500;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  background: rgba(255, 255, 255, 0.04);
  color: var(--fg, #f8fafc);
  cursor: pointer;
  transition: all 0.15s ease;
}
.ads-connect-btn:hover {
  background: rgba(255, 255, 255, 0.09);
  border-color: rgba(255, 255, 255, 0.25);
}
.ads-connect-btn.connected {
  border-color: rgba(16, 185, 129, 0.4);
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}
.ads-connect-btn .apple-icon {
  font-size: 13px;
  line-height: 1;
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 4px 10px;
  border-radius: 999px;
  background: #161f30;
  border: 1px solid #232f46;
  font-size: 12px;
  color: var(--fg-sec);
}
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--green-dot);
  box-shadow: 0 0 5px rgba(34, 197, 94, 0.5);
}

/* Hero Search Bar Box */
.hero-search {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 16px 20px;
  margin-bottom: 16px;
}
.seed-row-hero {
  display: flex;
  gap: 12px;
  align-items: center;
}
.search-input-wrap {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}
.search-hero-icon {
  position: absolute;
  left: 14px;
  width: 16px;
  height: 16px;
  color: var(--fg-sec);
  pointer-events: none;
}
.hero-input {
  width: 100%;
  height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-lg);
  color: #fff;
  font-size: 14.5px;
  padding-left: 40px;
  padding-right: 14px;
  outline: none;
}
.hero-input:focus { border-color: var(--brand-blue); }

.storefront-select-wrap {
  position: relative;
  display: flex;
  align-items: center;
  height: 44px;
  background: var(--bg-input);
  border: 1px solid var(--border-focus);
  border-radius: var(--radius-lg);
  padding: 0 12px;
  gap: 6px;
}
.flag-icon { font-size: 16px; }
.hero-select {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 13.5px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}
.hero-select option { background: var(--bg-card); color: #fff; }

.hero-btn {
  height: 44px;
  background: var(--brand-blue);
  color: #fff;
  border: 0;
  border-radius: var(--radius-lg);
  font-size: 13.5px;
  font-weight: 600;
  padding: 0 18px;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition: background 0.15s ease;
}
.hero-btn:hover { background: var(--brand-blue-hover); }
.hero-btn .btn-icon { width: 15px; height: 15px; }

/* Hero Hints Row */
.hero-hints-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 14px;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  font-size: 12px;
}
.hints-left, .hints-right {
  display: flex;
  align-items: center;
  gap: 8px;
}
.hint-label { color: var(--fg-sec); font-weight: 500; }
.hint-chips { display: flex; gap: 6px; align-items: center; flex-wrap: wrap; }
.chip-example {
  background: #161f30;
  border: 1px solid #232f46;
  border-radius: var(--radius-md);
  color: var(--fg-sec);
  font-size: 11.5px;
  padding: 3px 8px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.chip-example:hover { color: #fff; border-color: var(--brand-blue); }
.chip-recent {
  background: #161f30;
  border: 1px solid #232f46;
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 11.5px;
  padding: 3px 8px;
}
.clear-link {
  background: transparent;
  border: 0;
  color: var(--brand-blue);
  font-size: 12px;
  cursor: pointer;
  padding: 0;
}

/* Stepper Runhead Bar */
.runhead-reference {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 14px 18px;
  margin-bottom: 14px;
}
.runhead-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
}
.runhead-info {
  display: flex;
  align-items: center;
  gap: 8px;
}
.runhead-term {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
}
.runhead-sep { color: var(--fg-muted); }
.runhead-comps { font-size: 13px; color: var(--fg-sec); }
.runhead-status {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  color: var(--fg-sec);
}

.stepper-bar {
  display: flex;
  align-items: center;
  gap: 6px;
  background: #0f1523;
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 6px 10px;
  overflow-x: auto;
}
.step-pill {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 5px 8px;
  border-radius: var(--radius-md);
  flex: 1;
  min-width: 140px;
}
.step-pill.active {
  border: 1px solid var(--brand-blue);
  background: rgba(37, 99, 235, 0.1);
}
.step-circle {
  width: 20px;
  height: 20px;
  border-radius: 50%;
  background: #1e293b;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  display: grid;
  place-items: center;
  flex: none;
}
.step-pill.active .step-circle {
  background: var(--brand-blue);
}
.step-text { display: flex; flex-direction: column; line-height: 1.2; }
.st-name { font-size: 11.5px; font-weight: 600; color: #fff; }
.st-sub { font-size: 10px; color: var(--fg-sec); }
.step-pill.active .st-sub { color: var(--blue-text); }
.step-arrow { color: var(--fg-dim); font-size: 14px; user-select: none; }

/* 6 Equal Metric Summary Cards */
.metric-cards-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}
.mcard {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 12px 14px;
  display: flex;
  flex-direction: column;
}
.mcard-icon {
  width: 26px;
  height: 26px;
  border-radius: 6px;
  display: grid;
  place-items: center;
  font-size: 13px;
  margin-bottom: 8px;
}
.icon-blue { background: #1e3a8a; }
.icon-green { background: #064e3b; }
.icon-purple { background: #4c1d95; }
.icon-gold { background: #78350f; }
.icon-sky { background: #1e293b; }
.icon-pink { background: #831843; }

.mcard-val {
  font-size: 20px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  line-height: 1.2;
}
.text-blue { color: #38bdf8; }
.text-green { color: #34d399; }
.text-purple { color: #a78bfa; }
.text-gold { color: #fbbf24; }
.text-sky { color: #60a5fa; }
.text-pink { color: #f472b6; }

.mcard-label {
  font-size: 11.5px;
  font-weight: 600;
  color: #fff;
  margin-top: 4px;
}
.mcard-sub {
  font-size: 10px;
  color: var(--fg-sec);
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* Reference Table Container & Toolbar */
.tablecard-reference {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.ref-table-bar {
  display: flex;
  align-items: center;
  justify-content: flex-start;
  flex-wrap: wrap;
  row-gap: 8px;
  padding: 12px 16px;
  background: #0f1523;
  border-bottom: 1px solid var(--border-line);
  gap: 12px;
}
.ref-table-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.view-tabs {
  display: flex;
  align-items: center;
  gap: 4px;
  background: rgba(255, 255, 255, 0.05);
  padding: 3px;
  border-radius: 8px;
  border: 1px solid var(--border-line);
}
.view-tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  background: transparent;
  border: none;
  color: var(--fg-sec);
  font-size: 13px;
  font-weight: 600;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.15s ease;
}
.view-tab:hover {
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
}
.view-tab.active {
  background: var(--brand-blue);
  color: #fff;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}
.view-tab-count {
  font-size: 11px;
  font-weight: 600;
  padding: 1px 6px;
  background: rgba(255, 255, 255, 0.18);
  border-radius: 10px;
}
.comp-source-tag {
  display: inline-block;
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
  margin-left: 6px;
  vertical-align: middle;
}
.comp-source-tag.seed {
  background: rgba(59, 130, 246, 0.18);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}
.comp-source-tag.discovered {
  background: rgba(16, 185, 129, 0.18);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}
.ranked-kw-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 11px;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid var(--border-line);
  padding: 2px 7px;
  border-radius: 6px;
  color: #e2e8f0;
  margin: 2px 4px 2px 0;
  white-space: nowrap;
}
.ranked-kw-pill .rk-num {
  font-weight: 700;
  color: var(--brand-blue);
}
.ref-table-title {
  font-size: 14.5px;
  font-weight: 700;
  color: #fff;
}
.ref-table-count {
  font-size: 12px;
  color: var(--fg-sec);
}
.ref-table-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1;
  max-width: 320px;
}
.ref-table-search .search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--fg-sec);
  pointer-events: none;
}
.ref-table-search input {
  width: 100%;
  height: 32px;
  background: var(--bg-sidebar);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-md);
  color: #fff;
  font-size: 12px;
  padding-left: 32px;
  padding-right: 24px;
  outline: none;
}
.ref-table-search input:focus { border-color: var(--brand-blue); }
.ref-table-search .clear-btn {
  position: absolute;
  right: 6px;
  background: transparent;
  border: 0;
  color: var(--fg-sec);
  cursor: pointer;
  font-size: 14px;
}

.ref-table-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}
.ref-btn-ghost {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  background: #161f30;
  border: 1px solid #232f46;
  border-radius: var(--radius-md);
  color: var(--fg-sec);
  font-size: 12px;
  font-weight: 500;
  padding: 0 10px;
  cursor: pointer;
}
.ref-btn-ghost:hover { color: #fff; border-color: var(--brand-blue); }
.arrow-down { font-size: 10px; color: var(--fg-muted); }

.ref-sort-wrap {
  display: flex;
  align-items: center;
  gap: 6px;
  height: 32px;
  background: #161f30;
  border: 1px solid #232f46;
  border-radius: var(--radius-md);
  padding: 0 8px;
}
.ref-sort-lbl { font-size: 11px; color: var(--fg-muted); }
.ref-select {
  background: transparent;
  border: 0;
  color: #fff;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  outline: none;
}
.ref-select option { background: #131926; color: #fff; }

.ref-btn-icon {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  background: #161f30;
  border: 1px solid #232f46;
  border-radius: var(--radius-md);
  color: var(--fg-sec);
  cursor: pointer;
}
.ref-btn-icon:hover { color: #fff; border-color: var(--brand-blue); }

/* Table Columns and Cell Formatting */
.ref-terms-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  table-layout: fixed;
}
.ref-terms-table thead th {
  position: sticky;
  top: 0;
  z-index: 2;
  background: #131926;
  border-bottom: 1px solid var(--border-line);
  font-size: 10.5px;
  font-weight: 700;
  color: var(--fg-sec);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  padding: 9px 12px;
  text-align: left;
  white-space: nowrap;
}
.ref-terms-table thead th.num { text-align: right; }
.ref-terms-table thead th[data-sort] { cursor: pointer; user-select: none; }
.ref-terms-table thead th[data-sort]:hover { color: #fff; }

.ref-terms-table tbody td {
  padding: 9px 12px;
  border-bottom: 1px solid #1a2233;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 12.5px;
}
.ref-terms-table tbody tr {
  background: #080b11;
  transition: background 0.12s ease;
}
.ref-terms-table tbody tr:hover {
  background: #161f30;
}
.ref-terms-table tbody tr:hover td {
  background: #161f30;
}

/* Specific Cell Elements */
.chk-col input[type="checkbox"] {
  accent-color: var(--brand-blue);
  cursor: pointer;
}

/* Badges for sources */
.src-badge-row {
  display: flex;
  gap: 4px;
}
.sbadge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 2px 5px;
  border-radius: 4px;
  letter-spacing: 0.03em;
}
.sbadge-seed { background: #1e1b4b; border: 1px solid #312e81; color: #a5b4fc; }
.sbadge-auto { background: #1e293b; border: 1px solid #334155; color: #60a5fa; }
.sbadge-meta { background: #3b2807; border: 1px solid #713f12; color: #fbbf24; }
.sbadge-user { background: #164e63; border: 1px solid #0891b2; color: #67e8f9; }

.src-root-hint {
  display: block;
  font-size: 10.5px;
  color: var(--fg-muted);
  margin-top: 3px;
  font-style: normal;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 170px;
}
.src-root-hint span {
  color: #93c5fd;
  font-weight: 500;
}

/* Sparkline & Volume cell */
.vol-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.vol-text {
  font-weight: 600;
  color: #fff;
  font-variant-numeric: tabular-nums;
}
.sparkline-svg {
  width: 44px;
  height: 16px;
  flex: none;
}

/* Difficulty cell with track bar */
.diff-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}
.diff-val {
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.diff-track {
  width: 40px;
  height: 6px;
  background: #1e293b;
  border-radius: 3px;
  overflow: hidden;
  flex: none;
}
.diff-fill {
  height: 100%;
  border-radius: 3px;
}
.diff-fill.high { background: var(--red-diff); }
.diff-fill.med { background: var(--yellow-diff); }
.diff-fill.easy { background: var(--green-dot); }

/* Top 10 Competitors Avatar Stack in Table */
.top10-stack {
  display: flex;
  align-items: center;
  gap: 3px;
  overflow: hidden;
}
.top10-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  border: 1px solid var(--border-line);
  background: var(--bg-card);
  flex: none;
  object-fit: cover;
  transition: transform 0.15s ease, z-index 0.15s ease;
}
.top10-icon:hover {
  transform: scale(1.35);
  z-index: 5;
  box-shadow: 0 2px 6px rgba(0,0,0,0.6);
}
.top10-empty {
  font-size: 11px;
  color: var(--fg-muted);
}

/* Official Apple Search Ads Badge & Popularity Column Cell */
.pop-cell {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  gap: 8px;
}
.pop-left {
  display: flex;
  align-items: center;
  flex: none;
}
.pop-right {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  margin-left: auto;
}
.official-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: rgba(37, 99, 235, 0.16);
  border: 1px solid rgba(59, 130, 246, 0.4);
  color: #60a5fa;
  margin-left: 0;
  white-space: nowrap;
  letter-spacing: 0.02em;
}
.index-badge {
  font-size: 9.5px;
  font-weight: 700;
  text-transform: uppercase;
  padding: 1.5px 5px;
  border-radius: 4px;
  background: rgba(16, 185, 129, 0.16);
  border: 1px solid rgba(16, 185, 129, 0.4);
  color: #34d399;
  margin-left: 0;
  white-space: nowrap;
  letter-spacing: 0.02em;
}

/* Apple caps its reporting floor at 5: show the badge, muted, so every row has a value */
.index-badge.floor {
  background: rgba(148, 163, 184, 0.1);
  border-color: rgba(148, 163, 184, 0.28);
  color: #94a3b8;
  font-weight: 600;
}

/* Apple Ads Popularity column: Apple's own numbers, kept visually distinct from our estimate */
.apple-pop-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  width: 100%;
}
.apple-pop-cell .diff-track {
  background: rgba(16, 185, 129, 0.14);
}
.apple-pop-floor {
  font-size: 12px;
  font-weight: 700;
  color: #94a3b8;
  border: 1px dashed rgba(148, 163, 184, 0.45);
  border-radius: 4px;
  padding: 1px 7px;
  cursor: help;
}

/* Actions cell */
.act-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  color: var(--fg-muted);
}
.act-cell span { cursor: pointer; }
.act-cell span:hover { color: #fff; }

/* Pagination Footer */
.ref-table-footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  background: #0f1523;
  border-top: 1px solid var(--border-line);
}
.ref-foot-left {
  font-size: 12px;
  color: var(--fg-sec);
}
.ref-pagination {
  display: flex;
  align-items: center;
  gap: 4px;
}
.pg-btn {
  height: 26px;
  min-width: 26px;
  padding: 0 6px;
  background: transparent;
  border: 1px solid var(--border-line);
  border-radius: 4px;
  color: var(--fg-sec);
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
}
.pg-btn:hover { color: #fff; border-color: var(--brand-blue); }
.pg-btn.active {
  background: var(--brand-blue);
  border-color: var(--brand-blue);
  color: #fff;
  font-weight: 600;
}
.pg-dots { color: var(--fg-muted); padding: 0 4px; font-size: 11px; }

/* Empty App State & Bottom Settings Grid matching reference */
.ref-empty-banner {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 36px 24px;
  text-align: center;
  margin-top: 20px;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
}
.ref-empty-banner .empty-icon {
  width: 44px;
  height: 44px;
  border-radius: 10px;
  background: #161f30;
  display: grid;
  place-items: center;
  color: var(--fg-muted);
  margin-bottom: 6px;
}
.ref-empty-banner h2 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}
.ref-empty-banner p {
  margin: 0;
  font-size: 12.5px;
  color: var(--fg-sec);
  max-width: 520px;
  line-height: 1.5;
}

.ref-settings-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 16px;
}
.ref-setting-card {
  background: var(--bg-card);
  border: 1px solid var(--border-line);
  border-radius: var(--radius-lg);
  padding: 16px;
}
.ref-setting-card .card-head h2 {
  font-size: 13.5px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.ref-setting-card .settings {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-top: 12px;
}
.ref-setting-card .note {
  font-size: 11px;
  color: var(--fg-muted);
  margin-top: 12px;
  margin-bottom: 0;
}

/* Responsive adjustments */
@media (max-width: 1200px) {
  .metric-cards-grid { grid-template-columns: repeat(3, 1fr); }
  .stepper-bar { flex-wrap: wrap; }
}

* { box-sizing: border-box; }
html, body { height: 100%; }

body {
  margin: 0;
  background: var(--bg);
  color: var(--fg);
  font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", -apple-system-subheadline, Inter, system-ui, sans-serif;
  font-size: 13px;
  -webkit-font-smoothing: antialiased;
}

/* ---------- shell ---------- */
.shell { display: grid; grid-template-columns: 232px 1fr; min-height: 100vh; }

.sidebar {
  background: var(--bg-soft);
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  padding: 18px 12px;
  position: sticky;
  top: 0;
  height: 100vh;
  z-index: 10;
}

.brand { display: flex; align-items: center; gap: 10px; padding: 4px 8px 20px; }
.mark {
  width: 26px; height: 26px; border-radius: 7px;
  background: linear-gradient(160deg, var(--accent), #3f5fd6);
  color: #fff; font-weight: 700; font-size: 13px;
  display: grid; place-items: center;
}
.brand-text { display: flex; flex-direction: column; line-height: 1.25; }
.brand-text strong { font-size: 13px; font-weight: 600; letter-spacing: -0.01em; }
.brand-text span { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.07em; }

.nav { display: flex; flex-direction: column; gap: 2px; }
.nav-item {
  display: flex; align-items: center; gap: 10px;
  background: none; border: 0; border-radius: 8px;
  color: var(--muted); font: inherit; font-size: 13px;
  padding: 9px 10px; text-align: left; cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease;
}
.nav-item svg { width: 16px; height: 16px; fill: none; stroke: currentColor; stroke-width: 1.5; stroke-linecap: round; flex: none; }
.nav-item:hover { background: var(--panel); color: var(--fg); }
.nav-item.active { background: var(--accent-soft); color: #cbd8ff; }
.nav-item.active svg { stroke: #a9c0ff; }

.side-foot { margin-top: auto; }
.side-card {
  display: flex; gap: 9px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 9px;
  padding: 9px 10px; background: var(--panel);
}
.side-card strong { display: block; font-size: 11.5px; font-weight: 600; }
.side-card span:last-child { display: block; font-size: 10.5px; color: var(--faint); margin-top: 1px; }
.dot { width: 7px; height: 7px; border-radius: 50%; margin-top: 4px; flex: none; background: var(--faint); }
.dot.ok { background: var(--good); box-shadow: 0 0 0 3px color-mix(in srgb, var(--good) 15%, transparent); }

/* ---------- main ---------- */
.main { padding: 22px 28px 64px; width: 100%; min-width: 0; }

.topbar { display: flex; align-items: flex-start; justify-content: space-between; gap: 16px; margin-bottom: 20px; }
.topbar h1 { margin: 0; font-size: 19px; font-weight: 600; letter-spacing: -0.015em; }
#page-sub { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; }
.top-actions { display: flex; gap: 8px; align-items: center; }

.chip {
  font-size: 11px; padding: 3px 9px; border-radius: 999px;
  border: 1px solid var(--line); color: var(--muted); background: var(--panel);
  white-space: nowrap;
}
.chip.sm { font-size: 10.5px; padding: 1px 7px; }
.chip.ok { color: var(--good); border-color: color-mix(in srgb, var(--good) 35%, var(--line)); }
.chip.warn { color: var(--warn); border-color: color-mix(in srgb, var(--warn) 35%, var(--line)); }

.view { display: flex; flex-direction: column; gap: 16px; }

/* ---------- cards ---------- */
.card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 16px;
}
.card-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; margin-bottom: 12px; }
.card-head h2 { margin: 0; font-size: 13px; font-weight: 600; }
.card-head .meta { margin: 0; }
.actions { display: flex; gap: 8px; }

/* ---------- forms ---------- */
.seed-row { display: flex; gap: 10px; align-items: flex-end; }
.field { display: flex; flex-direction: column; gap: 5px; }
.field.grow { flex: 1; }
.field > span { font-size: 11px; color: var(--muted); }

input, select {
  font: inherit; font-size: 13px;
  background: var(--bg);
  color: var(--fg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 9px 11px;
  min-width: 0;
}
input:disabled, select:disabled { color: var(--muted); background: var(--panel-2); }
input:focus, select:focus {
  outline: none;
  border-color: color-mix(in srgb, var(--accent) 60%, var(--line));
  box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}
select {
  appearance: none; padding-right: 30px;
  background-image: linear-gradient(45deg, transparent 50%, var(--muted) 50%), linear-gradient(135deg, var(--muted) 50%, transparent 50%);
  background-position: calc(100% - 16px) 51%, calc(100% - 11px) 51%;
  background-size: 5px 5px, 5px 5px;
  background-repeat: no-repeat;
}

.btn {
  font: inherit; font-size: 12.5px; font-weight: 500;
  border-radius: 8px; padding: 9px 14px; cursor: pointer;
  border: 1px solid var(--line); background: var(--panel-2); color: var(--fg);
  white-space: nowrap; transition: background 0.15s ease, border-color 0.15s ease;
}
.btn:hover:not(:disabled) { border-color: #2c3444; background: #1b212c; }
.btn.primary { background: var(--accent); border-color: var(--accent); color: #0a0f1c; font-weight: 600; }
.btn.primary:hover:not(:disabled) { background: #7d99ff; border-color: #7d99ff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: 5px 10px; font-size: 11.5px; }
.btn:disabled { opacity: 0.4; cursor: not-allowed; }

.meta { margin: 10px 0 0; color: var(--muted); font-size: 12px; font-variant-numeric: tabular-nums; }
.note { color: var(--muted); font-size: 12px; line-height: 1.55; margin: 12px 0 0; }
.note b { color: var(--fg); font-weight: 600; }

/* ---------- collapsible recent runs & competitors ---------- */
.rounds-card {
  background: #0f1523;
  border: 1px solid var(--border-line);
  border-radius: 12px;
  padding: 16px 20px;
  margin-bottom: 20px;
}
.rounds-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 12px;
}
.rounds-title-left {
  display: flex;
  align-items: center;
  gap: 12px;
}
.rounds-icon {
  font-size: 20px;
  padding: 6px;
  background: rgba(37, 99, 235, 0.12);
  border-radius: 8px;
}
.rounds-title {
  font-size: 15px;
  font-weight: 700;
  color: #fff;
  margin: 0;
}
.rounds-sub {
  font-size: 12px;
  color: var(--fg-sec);
  margin: 2px 0 0;
}
.rounds-grid {
  display: flex;
  gap: 14px;
  overflow-x: auto;
  padding-bottom: 6px;
}
.round-item-card {
  flex: 1;
  min-width: 280px;
  max-width: 380px;
  background: #131b2e;
  border: 1px solid var(--border-line);
  border-radius: 10px;
  padding: 14px 16px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: border-color 0.15s ease;
}
.round-item-card:hover {
  border-color: rgba(37, 99, 235, 0.4);
}
.round-item-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 12px;
}
.round-tag {
  font-size: 11px;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(37, 99, 235, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(37, 99, 235, 0.35);
  text-transform: uppercase;
}
.round-time {
  font-size: 11px;
  color: var(--fg-muted);
}
.round-stat-table {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px 12px;
}
.round-stat-col {
  display: flex;
  flex-direction: column;
}
.round-stat-col.full-col {
  grid-column: span 2;
  margin-top: 4px;
  padding-top: 8px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.round-stat-lbl {
  font-size: 11px;
  color: var(--fg-muted);
}
.round-stat-num {
  font-size: 14px;
  font-weight: 700;
  color: #fff;
  margin-top: 1px;
}
.round-stat-num.text-green {
  color: #34d399;
}
/* Spinner Animation for In-Progress Round Stats */
@keyframes spin-round {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.round-spinner {
  display: inline-block;
  width: 14px;
  height: 14px;
  border: 2px solid rgba(96, 165, 250, 0.25);
  border-top-color: #60a5fa;
  border-radius: 50%;
  animation: spin-round 0.8s linear infinite;
  margin-top: 3px;
  vertical-align: middle;
}

.round-tag.running {
  background: rgba(245, 158, 11, 0.18);
  color: #fbbf24;
  border-color: rgba(245, 158, 11, 0.4);
}

.round-tag.running::before {
  content: "●";
  margin-right: 5px;
  font-size: 8px;
  vertical-align: middle;
  animation: pulse-dot 1.5s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}
.btn-expand-round {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: var(--brand-blue);
  color: #fff;
  font-size: 12.5px;
  font-weight: 600;
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  transition: all 0.15s ease;
  box-shadow: 0 2px 6px rgba(37, 99, 235, 0.3);
}
.btn-expand-round:hover {
  background: var(--brand-blue-hover);
  transform: translateY(-1px);
}
.btn-expand-round:disabled {
  opacity: 0.6;
  cursor: not-allowed;
  transform: none;
}

.recent-card, .competitors-card {
  padding: 0;
  overflow: hidden;
  border: 1px solid var(--line);
}
.recent-summary, .competitors-summary {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 11px 16px;
  cursor: pointer;
  list-style: none;
  user-select: none;
  background: var(--panel);
  transition: background 0.15s ease;
}
.recent-summary::-webkit-details-marker, .competitors-summary::-webkit-details-marker { display: none; }
.recent-summary::marker, .competitors-summary::marker { display: none; }
.recent-summary:hover, .competitors-summary:hover { background: var(--panel-2); }
.competitors-card .scroll { border: 0; border-top: 1px solid var(--line-soft); border-radius: 0; }
.competitors-card[open] .chevron, .recent-card[open] .chevron { transform: rotate(180deg); }
.recent-title {
  display: flex;
  align-items: center;
  gap: 10px;
}
.recent-title h2 {
  margin: 0;
  font-size: 13px;
  font-weight: 600;
}
svg.chevron {
  width: 14px !important;
  height: 14px !important;
  min-width: 14px;
  min-height: 14px;
  max-width: 14px;
  max-height: 14px;
  color: var(--muted);
  transition: transform 0.2s ease;
  flex: none;
}
.recent-hint {
  font-size: 11.5px;
  color: var(--faint);
}
.recent-card .runs {
  padding: 12px 16px 14px;
  border-top: 1px solid var(--line-soft);
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  background: var(--bg-soft);
}
.run-chip {
  display: flex; flex-direction: column; gap: 2px;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 7px 10px; font-size: 12px; cursor: pointer; background: var(--bg);
  transition: border-color 0.15s ease, background 0.15s ease;
}
.run-chip:hover { border-color: #2c3444; background: var(--panel); }
.run-chip.active {
  border-color: color-mix(in srgb, var(--accent) 55%, var(--line));
  background: var(--accent-soft);
}
.run-chip .h-seed { font-weight: 500; }
.run-chip .h-meta { color: var(--faint); font-size: 10.5px; font-variant-numeric: tabular-nums; }

/* ---------- progress ---------- */
.progress { height: 4px; background: var(--line-soft); border-radius: 999px; overflow: hidden; margin: 6px 0 14px; }
#progress-fill { height: 100%; width: 0; background: var(--accent); transition: width 0.4s ease; }

.steps { list-style: none; display: grid; grid-template-columns: repeat(6, 1fr); gap: 8px; margin: 0; padding: 0; }
.step {
  display: flex; gap: 9px; align-items: flex-start;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 9px 10px; background: var(--bg); min-width: 0;
}
.step-num {
  width: 17px; height: 17px; border-radius: 50%; flex: none;
  display: grid; place-items: center;
  font-size: 10px; font-weight: 600;
  background: var(--panel-2); color: var(--muted);
}
.step-body { min-width: 0; display: flex; flex-direction: column; gap: 2px; }
.step-name { font-size: 11.5px; font-weight: 500; }
.step-detail { font-size: 10.5px; color: var(--faint); font-variant-numeric: tabular-nums;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.step.running { border-color: color-mix(in srgb, var(--accent) 50%, var(--line)); background: var(--accent-soft); }
.step.running .step-num { background: var(--accent); color: #0a0f1c; }
.step.done .step-num { background: color-mix(in srgb, var(--good) 22%, transparent); color: var(--good); }
.step.failed { border-color: color-mix(in srgb, var(--bad) 50%, var(--line)); }
.step.failed .step-num { background: color-mix(in srgb, var(--bad) 22%, transparent); color: var(--bad); }

/* ---------- stats ---------- */
.stats { display: grid; grid-template-columns: repeat(auto-fit, minmax(132px, 1fr)); gap: 8px; }
.stat {
  background: var(--panel); border: 1px solid var(--line);
  border-radius: 9px; padding: 10px 12px;
  display: flex; flex-direction: column; gap: 3px;
}
.stat-k { font-size: 10.5px; color: var(--faint); text-transform: uppercase; letter-spacing: 0.06em; }
.stat-v { font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; }

/* ---------- table card & toolbar ---------- */
.tablecard { padding: 0; overflow: hidden; display: flex; flex-direction: column; }

.table-bar {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: var(--panel-2);
  border-bottom: 1px solid var(--line);
  flex-wrap: wrap;
}

.table-search {
  position: relative;
  display: flex;
  align-items: center;
  flex: 1 1 240px;
  max-width: 360px;
}
.table-search .search-icon {
  position: absolute;
  left: 10px;
  width: 14px;
  height: 14px;
  color: var(--muted);
  pointer-events: none;
}
.table-search input {
  width: 100%;
  padding-left: 32px;
  padding-right: 28px;
  padding-top: 7px;
  padding-bottom: 7px;
  font-size: 12.5px;
  background: var(--bg);
}
.table-search .clear-btn {
  position: absolute;
  right: 8px;
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 16px;
  line-height: 1;
  padding: 2px 4px;
  border-radius: 4px;
}
.table-search .clear-btn:hover { color: var(--fg); }

.filter-tabs {
  display: flex;
  background: var(--bg);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 2px;
}
.filter-tab {
  background: transparent;
  border: 0;
  border-radius: 6px;
  color: var(--muted);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  padding: 5px 10px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: all 0.15s ease;
}
.filter-tab:hover { color: var(--fg); }
.filter-tab.active {
  background: var(--panel);
  color: var(--fg);
  font-weight: 600;
  box-shadow: 0 1px 2px rgba(0,0,0,0.3);
}
.tab-badge {
  font-size: 10px;
  padding: 1px 6px;
  border-radius: 999px;
  background: var(--panel-2);
  color: var(--muted);
  font-variant-numeric: tabular-nums;
}
.filter-tab.active .tab-badge {
  background: var(--accent-soft);
  color: #a9c0ff;
}

.table-bar-right {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 8px;
}

.table-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 7px 16px;
  background: var(--panel);
  border-bottom: 1px solid var(--line-soft);
  font-size: 11.5px;
}
.sort-hint {
  color: var(--faint);
  font-size: 11px;
}

/* ---------- tables ---------- */
.scroll { overflow: auto; border: 1px solid var(--line); border-radius: 9px; }
.scroll.short { max-height: 320px; }
.scroll.tall { max-height: calc(100vh - 440px); min-height: 320px; }
.tablecard .scroll { border: 0; border-radius: 0; }

table { width: 100%; border-collapse: separate; border-spacing: 0; table-layout: fixed; }
thead th {
  position: sticky; top: 0; z-index: 2;
  background: var(--panel-2);
  font-size: 10.5px; font-weight: 600; color: var(--muted);
  text-transform: uppercase; letter-spacing: 0.05em;
  text-align: left; padding: 9px 10px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
}
thead th[data-sort] {
  cursor: pointer;
  user-select: none;
  transition: color 0.15s ease, background 0.15s ease;
}
thead th[data-sort]:hover {
  color: var(--fg);
  background: #1c2230;
}
thead th[data-sort].sort-active {
  color: #dbe4ff;
  background: color-mix(in srgb, var(--accent) 15%, var(--panel-2));
}
thead th[data-sort]::after {
  content: "";
  display: inline-block;
  margin-left: 5px;
  font-size: 9px;
  opacity: 0.25;
}
thead th[data-sort]:hover::after {
  content: "↕";
  opacity: 0.6;
}
thead th[data-sort].sort-asc::after {
  content: "▲";
  opacity: 1;
  color: var(--accent);
}
thead th[data-sort].sort-desc::after {
  content: "▼";
  opacity: 1;
  color: var(--accent);
}

tbody td {
  padding: 8px 10px;
  border-bottom: 1px solid var(--line-soft);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
tbody tr:hover td { background: #151a24; }
tbody tr:last-child td { border-bottom: 0; }
td.num, th.num { text-align: right; font-variant-numeric: tabular-nums; }
td.mono, .mono { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; }
.muted { color: var(--muted); }
.strong { font-weight: 600; }
.right { text-align: right; }

#terms { width: 100%; table-layout: fixed; }
#terms thead th, #competitors-table thead th {
  position: sticky !important;
  top: 0 !important;
  z-index: 20 !important;
  background: #131926 !important;
}
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  bottom: 0;
  cursor: col-resize;
  user-select: none;
  z-index: 5;
}
.col-resizer:hover, .col-resizer.resizing {
  background: var(--accent);
}
#terms th.term-col, #terms td.term-col { width: 230px; }
#terms th.src-col, #terms td.src-col { width: 160px; }
#terms th.num, #terms td.num { width: 92px; }
#terms td.term-col { color: var(--fg); font-weight: 500; }

tr.pending td.term-col { color: var(--muted); font-weight: 400; }
tr.excluded td { color: var(--faint); }
tr.excluded td.term-col { text-decoration: line-through; text-decoration-color: var(--faint); font-weight: 400; }

.pill {
  font-size: 10.5px; padding: 2px 7px; border-radius: 999px;
  border: 1px solid color-mix(in srgb, var(--good) 35%, var(--line));
  color: var(--good);
  background: color-mix(in srgb, var(--good) 10%, transparent);
  font-weight: 600;
}
.pill.off {
  border-color: var(--line);
  color: var(--faint);
  background: transparent;
  font-weight: 400;
}

/* ---------- source badges ---------- */
.src {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 550;
  border: 1px solid var(--line);
  white-space: nowrap;
  letter-spacing: -0.01em;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.src-both {
  color: #34d399;
  background: color-mix(in srgb, #34d399 12%, transparent);
  border-color: color-mix(in srgb, #34d399 40%, var(--line));
}
.src-hint {
  color: #818cf8;
  background: color-mix(in srgb, #818cf8 12%, transparent);
  border-color: color-mix(in srgb, #818cf8 40%, var(--line));
}
.src-derived {
  color: #38bdf8;
  background: color-mix(in srgb, #38bdf8 10%, transparent);
  border-color: color-mix(in srgb, #38bdf8 35%, var(--line));
  border-style: dashed;
}
.src-extract {
  color: var(--muted);
  background: color-mix(in srgb, var(--panel-2) 80%, transparent);
  border-color: var(--line);
}

/* apps table */
#apps th.pick, #apps td.pick { width: 34px; }
#apps th.icon, #apps td.icon { width: 36px; }
#apps th.num, #apps td.num { width: 74px; }
#apps th.name-col, #apps td.name-col { width: 34%; }
#apps th.seller-col, #apps td.seller-col { width: 24%; }
#apps th.sub-col, #apps td.sub-col { width: 28%; }
#apps td.seller-col, #apps td.sub-col { overflow: hidden; text-overflow: ellipsis; }
.app-icon { width: 22px; height: 22px; border-radius: 5px; display: block; }
.app-icon.empty { background: var(--panel-2); }
input[type="checkbox"] { accent-color: var(--accent); width: 14px; height: 14px; margin: 0; }

table.plain th, table.plain td { padding: 10px 12px; }
table.plain th { background: transparent; }

/* ---------- legend ---------- */
.legend summary {
  cursor: pointer; font-size: 12.5px; font-weight: 600; color: var(--muted);
  list-style: none;
}
.legend summary::-webkit-details-marker { display: none; }
.legend summary::before { content: "▸ "; color: var(--faint); }
.legend[open] summary::before { content: "▾ "; }
.legend[open] summary { color: var(--fg); margin-bottom: 12px; }
.legend dl { display: grid; grid-template-columns: 140px 1fr; gap: 10px 16px; margin: 0; }
.legend dt { font-weight: 600; font-size: 12px; }
.legend dd { margin: 0; color: var(--muted); font-size: 12px; line-height: 1.55; }
.legend dd b { color: var(--fg); font-weight: 600; }
.legend code { background: var(--bg); border: 1px solid var(--line); border-radius: 4px; padding: 0 4px; font-size: 11px; }

.legend-list {
  list-style: none;
  padding: 0;
  margin: 6px 0 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.legend-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

/* ---------- empty state ---------- */
.empty { text-align: center; padding: 64px 32px; display: flex; flex-direction: column; align-items: center; gap: 10px; }
.empty-icon svg { width: 30px; height: 30px; fill: none; stroke: var(--faint); stroke-width: 1.4; }
.empty h2 { margin: 6px 0 0; font-size: 15px; font-weight: 600; }
.empty p { margin: 0; color: var(--muted); max-width: 460px; line-height: 1.6; }
.empty .hint { font-size: 12px; color: var(--faint); }
.empty .btn { margin-top: 10px; }

/* ---------- difficulty & score badges (Reference Design) ---------- */
.score-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 22px;
  padding: 0 7px;
  border-radius: 6px;
  font-size: 11.5px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  border: 1px solid transparent;
}
.score-easy {
  color: #34d399;
  background: rgba(16, 185, 129, 0.14);
  border-color: rgba(16, 185, 129, 0.35);
}
.score-med {
  color: #fbbf24;
  background: rgba(245, 158, 11, 0.14);
  border-color: rgba(245, 158, 11, 0.35);
}
.score-hard {
  color: #f87171;
  background: rgba(239, 68, 68, 0.14);
  border-color: rgba(239, 68, 68, 0.35);
}

/* Horizontal mini progress bar inside table cells */
.bar-cell {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 7px;
}
.mini-bar {
  width: 44px;
  height: 5px;
  background: var(--panel-2);
  border: 1px solid var(--line);
  border-radius: 999px;
  overflow: hidden;
  display: inline-block;
  flex: none;
}
.mini-bar-fill {
  height: 100%;
  border-radius: 999px;
}
.mini-bar-fill.fill-easy { background: #10b981; }
.mini-bar-fill.fill-med { background: #f59e0b; }
.mini-bar-fill.fill-hard { background: #ef4444; }
.mini-bar-fill.fill-accent { background: #3b82f6; }

/* Keyword term cell styling */
.term-cell {
  display: flex;
  align-items: center;
  gap: 8px;
}
.term-icon {
  width: 14px;
  height: 14px;
  color: var(--muted);
  flex: none;
  opacity: 0.6;
}
.term-text {
  font-weight: 600;
  color: #fff;
  letter-spacing: -0.01em;
}

/* Row Inspector Drawer */
.inspector-drawer {
  position: fixed;
  top: 0;
  right: 0;
  width: 460px;
  max-width: 90vw;
  height: 100vh;
  background: #10141e;
  border-left: 1px solid var(--line);
  box-shadow: -12px 0 36px rgba(0, 0, 0, 0.55);
  z-index: 100;
  display: flex;
  flex-direction: column;
  transform: translateX(100%);
  transition: transform 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}
.inspector-drawer.open {
  transform: translateX(0);
}
.drawer-head {
  padding: 16px 20px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--panel);
}
.drawer-title {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 8px;
  color: #fff;
}
.drawer-close {
  background: transparent;
  border: 0;
  color: var(--muted);
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  padding: 4px 8px;
  border-radius: 6px;
}
.drawer-close:hover { color: #fff; background: var(--panel-2); }
.drawer-body {
  padding: 20px;
  overflow-y: auto;
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 16px;
}
.drawer-metric-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}
.drawer-metric-box {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 10px 12px;
}
.drawer-metric-lbl {
  font-size: 10.5px;
  color: var(--muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 4px;
}
.drawer-metric-val {
  font-size: 17px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: #fff;
}
.serp-app-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  margin-bottom: 8px;
}
.serp-rank {
  font-size: 12px;
  font-weight: 700;
  color: var(--muted);
  width: 22px;
  text-align: center;
}
.serp-app-info {
  flex: 1;
  min-width: 0;
}
.serp-app-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--fg);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.serp-app-sub {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.serp-app-meta {
  font-size: 11px;
  color: var(--faint);
  display: flex;
  gap: 8px;
  margin-top: 3px;
}
tbody tr.clickable-row {
  cursor: pointer;
}
tbody tr.clickable-row:hover td {
  background: #171d2b !important;
}

/* ---------- settings ---------- */
.settings { display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); gap: 14px; }

/* ==========================================================================
   REFRESHED MODERN DASHBOARD LAYOUT & COMPONENTS
   ========================================================================== */

/* Full-width clean shell without sidebar */
.shell {
  display: flex !important;
  flex-direction: column !important;
  min-height: 100vh !important;
  width: 100% !important;
}

.sidebar {
  display: none !important;
}

.topbar {
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  padding: 12px 28px !important;
  background: var(--bg-card, #121824) !important;
  border-bottom: 1px solid var(--border-line, #1e293b) !important;
  position: sticky;
  top: 0;
  z-index: 100;
}

.topbar-left .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 0;
}

.main {
  width: 100% !important;
  max-width: 1560px !important;
  margin: 0 auto !important;
  padding: 20px 28px 80px !important;
  min-width: 0 !important;
}

/* Sleek Horizontal Recent Runs Bar */
.recent-runs-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  padding: 10px 16px;
  background: #111827;
  border: 1px solid var(--border-line, #1e293b);
  border-radius: var(--radius-lg, 10px);
  margin-bottom: 16px;
  overflow-x: auto;
}

.recent-runs-head {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: none;
}

.recent-runs-title {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted, #94a3b8);
}

.recent-runs-chips {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 1;
  overflow-x: auto;
  padding: 2px 0;
}

.recent-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  background: #1e293b;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  font-size: 12px;
  font-weight: 500;
  color: #f1f5f9;
  text-decoration: none;
  cursor: pointer;
  white-space: nowrap;
  transition: all 0.15s ease;
}

.recent-chip:hover {
  background: #27354f;
  border-color: #3b82f6;
  color: #fff;
  transform: translateY(-1px);
}

.recent-chip.active {
  background: rgba(37, 99, 235, 0.25);
  border-color: #3b82f6;
  color: #60a5fa;
  box-shadow: 0 0 10px rgba(59, 130, 246, 0.2);
}

.recent-chip-seed {
  font-weight: 600;
}

.recent-chip-sub {
  font-size: 10.5px;
  color: var(--fg-muted, #94a3b8);
}

/* Dedicated Seed Competitors Card */
.seed-comp-card {
  margin-bottom: 16px;
  padding: 16px 20px;
  background: var(--bg-card, #121824);
  border: 1px solid var(--border-line, #1e293b);
  border-radius: var(--radius-lg, 10px);
}

.seed-comp-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
}

.seed-comp-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.seed-comp-icon {
  font-size: 22px;
  line-height: 1;
}

.seed-comp-title-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.seed-comp-h3 {
  margin: 0;
  font-size: 15px;
  font-weight: 700;
  color: #fff;
}

.seed-comp-sub {
  margin: 2px 0 0;
  font-size: 12px;
  color: var(--fg-muted, #94a3b8);
}

.seed-comp-table {
  width: 100%;
  border-collapse: collapse;
}

.seed-comp-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  padding: 8px 12px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--fg-muted, #94a3b8);
  border-bottom: 1px solid var(--border-line, #1e293b);
  background: #121824;
}

.seed-comp-table td {
  padding: 10px 12px;
  font-size: 12.5px;
  color: var(--fg, #e2e8f0);
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  vertical-align: middle;
}

.seed-comp-table tr:hover td {
  background: rgba(255, 255, 255, 0.02);
}

.seed-comp-cell {
  display: flex;
  align-items: center;
  gap: 12px;
}

.seed-comp-thumb {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  object-fit: cover;
  border: 1px solid rgba(255, 255, 255, 0.1);
  background: #1e293b;
  flex: none;
}

.seed-comp-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.seed-comp-name {
  font-weight: 600;
  color: #fff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.seed-comp-subtitle {
  font-size: 11px;
  color: var(--fg-muted, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.star-rating {
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

.star-icon {
  color: #f59e0b;
  font-size: 14px;
  line-height: 1;
}

.star-val {
  font-weight: 700;
  color: #fff;
  font-variant-numeric: tabular-nums;
}

/* 5 Metric Summary Cards Grid */
.metric-cards-grid {
  display: grid !important;
  grid-template-columns: repeat(5, 1fr) !important;
  gap: 10px !important;
  margin-bottom: 16px !important;
}

@media (max-width: 1100px) {
  .metric-cards-grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
}

/* Measurement Progress Bar in Table Toolbar */
.measure-progress-box {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid var(--border-line, #1e293b);
  padding: 6px 14px;
  border-radius: 8px;
  flex: 1;
  max-width: 280px;
}

.measure-progress-track {
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 999px;
  overflow: hidden;
}

.measure-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #10b981);
  border-radius: 999px;
  transition: width 0.3s ease;
}

.measure-progress-box.done .measure-progress-bar {
  background: #10b981;
}

.measure-progress-text {
  font-size: 11.5px;
  font-weight: 600;
  color: #e2e8f0;
  white-space: nowrap;
  font-variant-numeric: tabular-nums;
}

@media (max-width: 1100px) {
  .shell { grid-template-columns: 200px 1fr; }
  .main { padding: 18px 18px 48px; }
  .steps { grid-template-columns: repeat(3, 1fr); }
  .table-bar { flex-direction: column; align-items: stretch; }
  .table-search { max-width: none; }
  .table-bar-right { margin-left: 0; }
}

/* transient confirmations (keyword added, measurement queued) */
.toast-box {
  position: fixed;
  right: 22px;
  bottom: 22px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  z-index: 9999;
  pointer-events: none;
}
.toast-item {
  background: #131926;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-left: 3px solid var(--brand-blue, #3b82f6);
  color: var(--fg, #e5e7eb);
  font-size: 12.5px;
  padding: 9px 14px;
  border-radius: 6px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.35);
  transition: opacity 0.35s ease, transform 0.35s ease;
  max-width: 420px;
}
.toast-item.toast-out {
  opacity: 0;
  transform: translateY(6px);
}

/* bulk keyword modal */
.modal-overlay[hidden] { display: none !important; }
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(4, 8, 16, 0.72);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  padding: 24px;
}
.modal-box {
  width: min(560px, 100%);
  background: #0e1521;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 10px;
  box-shadow: 0 24px 60px rgba(0, 0, 0, 0.5);
  padding: 18px 18px 14px;
}
.modal-head {
  font-size: 14px;
  font-weight: 650;
  color: var(--fg, #e5e7eb);
  margin-bottom: 6px;
}
.modal-hint {
  font-size: 12px;
  color: var(--fg-muted, #94a3b8);
  margin-bottom: 12px;
  line-height: 1.45;
}
.modal-textarea {
  width: 100%;
  background: #0a1018;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 7px;
  color: var(--fg, #e5e7eb);
  font: 12.5px/1.6 var(--mono, ui-monospace, SFMono-Regular, Menlo, monospace);
  padding: 10px 12px;
  resize: vertical;
  outline: none;
}
.modal-textarea:focus { border-color: var(--brand-blue, #3b82f6); }
.modal-foot {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: 12px;
}
.modal-count {
  font-size: 12px;
  color: var(--fg-muted, #94a3b8);
}

/* chip that marks the "only keywords I added" view */
.added-chip {
  color: var(--brand-blue, #3b82f6);
  border-color: var(--brand-blue, #3b82f6);
}

/* Apple Ads link is configured but Apple stopped answering.
   ID selector on purpose: earlier .ads-connect-btn rules outranked the class-only version. */
#btn-apple-ads-connect.disconnected {
  background: rgba(239, 68, 68, 0.12) !important;
  border-color: rgba(239, 68, 68, 0.55) !important;
  color: #fca5a5 !important;
}
#btn-apple-ads-connect.disconnected #ads-connect-label,
#btn-apple-ads-connect.disconnected .apple-icon { color: #fca5a5 !important; }
#btn-apple-ads-connect.connected #ads-connect-label,
#btn-apple-ads-connect.connected .apple-icon { color: #34d399 !important; }




/* destructive bulk action */
.btn-danger {
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.5);
  color: #fca5a5;
  border-radius: 6px;
  cursor: pointer;
}
.btn-danger:hover { background: rgba(239, 68, 68, 0.26); }
.btn-danger:disabled { opacity: 0.6; cursor: default; }

/* ---------- two-row table toolbar ---------- */
.ref-toolbar,
.ref-filterbar {
  display: flex;
  align-items: flex-end;
  gap: 10px;
  flex-wrap: wrap;
}
.ref-toolbar { margin-bottom: 10px; align-items: center; }
.ref-filterbar {
  margin-bottom: 12px;
  padding: 9px 12px 10px;
  background: #101725;
  border: 1px solid #1d2637;
  border-radius: 8px;
}

/* stacked label + select, aligned on a common baseline */
.fgroup {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 132px;
}
.flbl {
  font-size: 9.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #78869d;
  padding-left: 1px;
}
.fselect-wrap {
  position: relative;
  display: block;
}
.fselect {
  appearance: none;
  -webkit-appearance: none;
  width: 100%;
  height: 32px;
  padding: 0 28px 0 10px;
  background: #161f30;
  border: 1px solid #27334a;
  border-radius: 6px;
  color: #e6edf7;
  font-size: 12.5px;
  font-weight: 500;
  line-height: 30px;
  cursor: pointer;
  transition: border-color 0.12s ease, background 0.12s ease;
}
.fselect:hover { background: #1b2536; border-color: #33425e; }
.fselect:focus {
  outline: none;
  border-color: var(--brand-blue, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}
.fselect option { background: #101725; color: #e6edf7; }
.fselect-wrap::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -5px;
  border-right: 1.6px solid #7f8ca3;
  border-bottom: 1.6px solid #7f8ca3;
  transform: rotate(45deg);
  pointer-events: none;
}
.fselect-wrap:hover::after { border-color: #b6c2d4; }

#more-btn-slot {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: auto;
  padding-bottom: 1px;
}
#more-btn-slot:empty { display: none; }
#more-btn-slot .btn { white-space: nowrap; }


/* top line inside the table toolbar: search + actions; the filter bar always starts a new row */
.ref-table-top {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1 1 420px;
  min-width: 280px;
  flex-wrap: wrap;
}
.ref-table-top .ref-table-search { flex: 1 1 180px; max-width: none; }
.ref-filterbar {
  flex: 1 0 100%;
  order: 20;
}


/* the sort / page-size selects share the filter bar look */
.ref-select {
  appearance: none;
  -webkit-appearance: none;
  padding-right: 26px;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M1 1l4 4 4-4' fill='none' stroke='%237f8ca3' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 9px center;
  cursor: pointer;
}
.ref-select:hover { border-color: #33425e; }
.ref-select:focus { outline: none; border-color: var(--brand-blue, #3b82f6); box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18); }

/* compact dialog variant for confirm/alert */
.modal-box-sm { width: min(420px, 100%); }
.modal-box-sm .modal-hint { margin-bottom: 16px; font-size: 12.5px; line-height: 1.5; }
.modal-box-sm .modal-foot .btn { min-width: 84px; justify-content: center; }

/* ---------- custom dropdown component ---------- */
.fselect-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  text-align: left;
  font-family: inherit;
}
.fselect-btn::after {
  content: "";
  position: absolute;
  right: 11px;
  top: 50%;
  width: 6px;
  height: 6px;
  margin-top: -5px;
  border-right: 1.6px solid #7f8ca3;
  border-bottom: 1.6px solid #7f8ca3;
  transform: rotate(45deg);
  pointer-events: none;
  transition: transform 0.12s ease;
}
.fselect-btn[data-open="1"] {
  border-color: var(--brand-blue, #3b82f6);
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18);
}
.fselect-btn[data-open="1"]::after { transform: rotate(-135deg); margin-top: -2px; }
.fgroup > .fselect-btn { position: relative; width: 100%; }

.dd-panel {
  position: fixed;
  z-index: 10002;
  background: #131926;
  border: 1px solid #27334a;
  border-radius: 8px;
  box-shadow: 0 18px 40px rgba(0, 0, 0, 0.5);
  padding: 6px;
  max-height: 360px;
  overflow: auto;
}
.dd-item {
  display: flex;
  width: 100%;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  background: none;
  border: 0;
  color: #dbe4f0;
  font-size: 12.5px;
  padding: 7px 9px;
  border-radius: 6px;
  cursor: pointer;
  text-align: left;
}
.dd-item:hover { background: #1b2536; }
.dd-item.active { background: rgba(59, 130, 246, 0.16); color: #fff; }
.dd-item-count { color: #7f8ca3; font-size: 11px; font-variant-numeric: tabular-nums; }

.dd-range-head {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #78869d;
  padding: 4px 6px 8px;
}
.dd-range-row { display: flex; align-items: center; gap: 8px; padding: 0 6px; }
.dd-num {
  width: 100%;
  height: 30px;
  background: #0d1420;
  border: 1px solid #27334a;
  border-radius: 6px;
  color: #e6edf7;
  font-size: 12.5px;
  padding: 0 8px;
}
.dd-num:focus { outline: none; border-color: #3b82f6; box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.18); }
.dd-dash { color: #7f8ca3; }
.dd-chips { display: flex; flex-wrap: wrap; gap: 6px; padding: 9px 6px 2px; }
.dd-chip {
  background: #161f30;
  border: 1px solid #27334a;
  color: #c3cede;
  font-size: 11px;
  padding: 3px 9px;
  border-radius: 999px;
  cursor: pointer;
}
.dd-chip:hover { border-color: #3b82f6; color: #fff; }
.dd-foot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 6px 4px;
  margin-top: 8px;
  border-top: 1px solid #1d2637;
}
.dd-action {
  background: none;
  border: 1px solid transparent;
  color: #9fb0c6;
  font-size: 12px;
  padding: 5px 10px;
  border-radius: 6px;
  cursor: pointer;
}
.dd-action:hover { color: #fff; background: #1b2536; }
.dd-action-primary { background: #2f6fed; border-color: #2f6fed; color: #fff; }
.dd-action-primary:hover { background: #3b7bf5; }

/* divider between bucket choices and the custom range inside the Apple Ads panel */
.dd-divider {
  height: 1px;
  background: #1d2637;
  margin: 6px 4px;
}

/* saved view rows inside the Views dropdown */
.dd-item-view { padding-right: 4px; }
.dd-view-del {
  background: none;
  border: 0;
  color: #7f8ca3;
  font-size: 14px;
  line-height: 1;
  padding: 2px 6px;
  border-radius: 4px;
  cursor: pointer;
}
.dd-view-del:hover { color: #fca5a5; background: rgba(239, 68, 68, 0.14); }

/* per-run menu trigger inside the recent-runs chip */
.recent-chip-more {
  margin-left: 6px;
  color: var(--fg-muted, #94a3b8);
  font-size: 12px;
  line-height: 1;
  padding: 0 2px;
  cursor: pointer;
}
.recent-chip-more:hover { color: #fff; }

.account-chip {
  background: #16233a; border: 1px solid #27334a; color: #c9d6e8; cursor: pointer;
  font-size: 11px; padding: 4px 9px; border-radius: 6px; max-width: 210px;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.account-chip:hover { border-color: #3b82f6; color: #fff; }

/* ---------- account panel ---------- */
.client-pill {
  background: #16233a; border: 1px solid #27334a; color: #c9d6e8; cursor: pointer;
  font-size: 11px; padding: 4px 9px; border-radius: 6px; display: inline-flex; align-items: center; gap: 6px;
}
.client-pill .dot { width: 7px; height: 7px; border-radius: 50%; background: #64748b; }
.client-pill.online .dot { background: #22c55e; box-shadow: 0 0 6px #22c55e80; }
.client-pill.idle .dot { background: #eab308; }
.client-pill.offline .dot { background: #64748b; }
.client-pill.offline { color: #8494ab; }
.client-pill:hover { border-color: #3b82f6; }

.acct-box {
  width: 640px; max-width: calc(100vw - 48px); max-height: calc(100vh - 96px); overflow: auto;
  background: #121a29; border: 1px solid #27334a; border-radius: 14px; box-shadow: 0 30px 80px rgba(0,0,0,.55);
}
.acct-head {
  display: flex; align-items: center; justify-content: space-between; padding: 16px 20px;
  border-bottom: 1px solid #1d283c; position: sticky; top: 0; background: #121a29; z-index: 2;
}
.acct-head strong { font-size: 14px; }
.acct-close { background: none; border: 0; color: #8494ab; font-size: 20px; cursor: pointer; line-height: 1; }
.acct-close:hover { color: #fff; }
.acct-body { padding: 18px 20px 24px; }
.acct-section { margin-bottom: 22px; }
.acct-section h3 {
  font-size: 10.5px; text-transform: uppercase; letter-spacing: .08em; color: #78869d;
  margin: 0 0 10px; font-weight: 600;
}
.acct-card { background: #0e1626; border: 1px solid #1d283c; border-radius: 10px; padding: 14px 16px; }
.acct-row { display: flex; align-items: center; justify-content: space-between; padding: 5px 0; font-size: 12.5px; }
.acct-row .k { color: #8494ab; }
.acct-row .v { color: #e6ecf5; font-variant-numeric: tabular-nums; }
.acct-bar { height: 5px; background: #1d283c; border-radius: 3px; overflow: hidden; margin-top: 6px; }
.acct-bar > i { display: block; height: 100%; background: #3b82f6; }
.acct-key { font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 12.5px; letter-spacing: .04em; }
.acct-dev { display: grid; grid-template-columns: 1fr auto; gap: 4px 12px; padding: 12px 0; border-bottom: 1px solid #1a2334; }
.acct-dev:last-child { border-bottom: 0; }
.acct-dev .name { font-size: 13px; color: #e6ecf5; display: flex; align-items: center; gap: 8px; }
.acct-dev .meta { font-size: 11.5px; color: #78869d; }
.acct-dev .dot { width: 8px; height: 8px; border-radius: 50%; background: #64748b; flex: none; }
.acct-dev .dot.online { background: #22c55e; box-shadow: 0 0 6px #22c55e80; }
.acct-dev .dot.idle { background: #eab308; }
.acct-dev .dot.revoked { background: #ef4444; }
.acct-badge { font-size: 10.5px; padding: 1px 6px; border-radius: 4px; border: 1px solid #27334a; color: #8494ab; }
.acct-badge.ok { color: #22c55e; border-color: #14532d; }
.acct-badge.bad { color: #ef4444; border-color: #7f1d1d; }
.acct-btn {
  background: #16233a; border: 1px solid #27334a; color: #c9d6e8; border-radius: 6px;
  font-size: 11.5px; padding: 5px 10px; cursor: pointer;
}
.acct-btn:hover { border-color: #3b82f6; color: #fff; }
.acct-btn.danger:hover { border-color: #ef4444; color: #ef4444; }
.acct-input {
  width: 100%; height: 34px; padding: 0 10px; border-radius: 7px; border: 1px solid #27334a;
  background: #0b1220; color: #e6ecf5; font-size: 12.5px; margin-bottom: 8px;
}
.acct-inline { display: flex; gap: 8px; align-items: center; }
.acct-inline .acct-input { margin-bottom: 0; }
.acct-hint { font-size: 11.5px; color: #78869d; margin-top: 8px; line-height: 1.5; }
.acct-cmd {
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace; font-size: 11.5px; background: #0b1220;
  border: 1px solid #1d283c; border-radius: 7px; padding: 10px 12px; color: #93c5fd; overflow-x: auto;
}
