/* ── Cards (glass) ────────────────────────────────────────── */
.card {
  background: var(--card-bg);
  border: 1px solid var(--color-border-soft);
  border-radius: var(--radius-lg);
  padding: var(--space-6);
  backdrop-filter: blur(8px);
  transition: border-color 0.18s ease, transform 0.18s ease, box-shadow 0.18s ease;
}
.card.hover:hover,
a.card:hover {
  border-color: rgba(124, 92, 255, 0.4);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.card .card-title {
  font-size: 12px; font-weight: 700; color: var(--color-muted);
  text-transform: uppercase; letter-spacing: 1.5px; margin-bottom: var(--space-4);
}
.card .card-actions { margin-top: var(--space-4); display: flex; gap: var(--space-2); }
.card.flush { padding: 0; overflow: hidden; }

/* ── Stat tiles ───────────────────────────────────────────── */
.stat {
  display: flex; flex-direction: column; gap: var(--space-1);
}
.stat .stat-label { font-size: 12px; color: var(--color-muted); text-transform: uppercase; letter-spacing: 1px; font-weight: 600; }
.stat .stat-value { font-size: 32px; font-weight: 800; letter-spacing: -0.02em; line-height: 1; }

/* ── Score ring (gradient, animated) ──────────────────────── */
.score-ring {
  --score: 0;
  --ring-color: var(--color-good);
  width: 168px; height: 168px;
  border-radius: 50%;
  display: grid; place-items: center;
  background: conic-gradient(var(--ring-color) calc(var(--score) * 1%), var(--track) 0);
  position: relative;
  animation: ring-in 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes ring-in { from { transform: rotate(-12deg) scale(0.9); opacity: 0; } to { transform: none; opacity: 1; } }
.score-ring::before {
  content: ""; position: absolute; inset: 12px;
  background: var(--ring-well);
  border-radius: 50%;
  box-shadow: inset 0 2px 12px rgba(0, 0, 0, 0.5);
}
.score-ring .score-value { position: relative; font-size: 44px; font-weight: 800; letter-spacing: -0.03em; }
.score-ring .score-sub { position: relative; font-size: 11px; color: var(--color-muted); text-transform: uppercase; letter-spacing: 1.5px; margin-top: 2px; }
.score-ring.size-sm { width: 92px; height: 92px; }
.score-ring.size-sm::before { inset: 7px; }
.score-ring.size-sm .score-value { font-size: 24px; }

/* On the gradient hero, ring sits on a translucent well. */
.hero .score-ring::before { background: rgba(10, 11, 16, 0.55); }
.hero .score-ring { box-shadow: 0 12px 40px -8px rgba(0, 0, 0, 0.5); }

.score-ring.bad  { --ring-color: var(--color-bad); }
.score-ring.warn { --ring-color: var(--color-warn); }
.score-ring.good { --ring-color: var(--color-good); }

/* ── Trend pill (▲ +6 / ▼ -3) ─────────────────────────────── */
.trend {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 10px; border-radius: 999px;
  font-size: 12px; font-weight: 700;
  background: rgba(255, 255, 255, 0.12);
  color: #fff;
}
.trend.up   { background: rgba(62, 224, 142, 0.18); color: var(--color-good); }
.trend.down { background: rgba(255, 107, 107, 0.18); color: var(--color-bad); }
.trend.flat { background: rgba(255, 255, 255, 0.1); color: var(--color-muted); }

/* ── Provider rows with progress bars ─────────────────────── */
.provider-list { display: flex; flex-direction: column; gap: var(--space-4); }
.provider-row { display: block; padding: var(--space-2) 0; }
.provider-row .row { margin-bottom: var(--space-2); }
.provider-row .pname { font-weight: 650; }
.provider-row .pscore { font-variant-numeric: tabular-nums; font-weight: 700; }
.bar { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.bar > span {
  display: block; height: 100%; border-radius: 999px;
  background: var(--gradient-brand);
  width: 0;
  animation: bar-grow 1s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}
@keyframes bar-grow { to { width: var(--w, 0%); } }
.bar.good > span { background: linear-gradient(90deg, #2bd47a, #6ee7a8); }
.bar.warn > span { background: linear-gradient(90deg, #f7b955, #ffd28a); }
.bar.bad  > span { background: linear-gradient(90deg, #ff6b6b, #ff9a9a); }

/* ── Sparkline (score history) ────────────────────────────── */
.sparkline { display: flex; align-items: flex-end; gap: 4px; height: 48px; }
.sparkline .spark {
  flex: 1; min-width: 4px;
  background: var(--gradient-brand);
  border-radius: 3px 3px 0 0;
  opacity: 0.55;
  transition: opacity 0.15s ease;
}
.sparkline .spark:last-child { opacity: 1; }
.sparkline:hover .spark { opacity: 0.85; }
.sparkline:hover .spark:last-child { opacity: 1; }

/* ── Insight lists (strengths / weaknesses / opportunities) ── */
.insight-list { list-style: none; display: flex; flex-direction: column; gap: var(--space-3); }
.insight-list li {
  display: flex; gap: var(--space-3); align-items: flex-start;
  padding-bottom: var(--space-3); border-bottom: 1px solid var(--color-border-soft);
}
.insight-list li:last-child { border-bottom: 0; padding-bottom: 0; }
.insight-list .dot { width: 8px; height: 8px; border-radius: 50%; margin-top: 7px; flex: 0 0 8px; background: var(--color-accent); }
.card.good .insight-list .dot { background: var(--color-good); }
.card.warn .insight-list .dot { background: var(--color-warn); }
.card.accent .insight-list .dot { background: var(--color-pink); }
.insight-list .it-title { font-weight: 600; }
.insight-list .it-detail { color: var(--color-muted); font-size: 13px; }

/* Card accent top-border for the three insight cards. */
.card.good { box-shadow: inset 0 2px 0 rgba(62, 224, 142, 0.6); }
.card.warn { box-shadow: inset 0 2px 0 rgba(247, 185, 85, 0.6); }
.card.accent { box-shadow: inset 0 2px 0 rgba(255, 92, 147, 0.6); }

/* ── Buttons ──────────────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5);
  border-radius: var(--radius-md);
  border: 1px solid var(--color-border);
  background: var(--color-surface-2);
  color: var(--color-text);
  font-size: 14px; font-weight: 600;
  cursor: pointer; text-decoration: none;
  transition: all 0.15s ease;
}
.btn:hover { background: var(--color-surface); color: var(--color-text); text-decoration: none; transform: translateY(-1px); }
.btn.primary {
  background: var(--gradient-brand); border-color: transparent; color: #fff;
  box-shadow: 0 6px 20px -6px rgba(124, 92, 255, 0.6);
}
.btn.primary:hover { color: #fff; filter: brightness(1.08); box-shadow: var(--glow-accent); }
.btn.on-hero { background: rgba(255, 255, 255, 0.16); border-color: rgba(255, 255, 255, 0.25); color: #fff; backdrop-filter: blur(6px); }
.btn.on-hero:hover { background: rgba(255, 255, 255, 0.26); }
.btn.danger { background: var(--color-bad); border-color: var(--color-bad); color: #fff; }
.btn.ghost { background: transparent; }
.btn.sm { padding: var(--space-1) var(--space-3); font-size: 13px; border-radius: var(--radius-sm); }

/* keeps Edit / × from touching in table action cells */
.table-actions { display: inline-flex; align-items: center; gap: var(--space-2); justify-content: flex-end; }
.table-actions form { display: inline-flex; margin: 0; }
.select.sm { width: auto; padding: var(--space-1) var(--space-2); font-size: 13px; border-radius: var(--radius-sm); }

/* select dropdowns styled as colored pills (checklist + clients list) */
.status-pill, .pill-select {
  width: auto;
  border-radius: 999px;
  padding: 4px 28px 4px 13px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  line-height: 1.5;
  cursor: pointer;
  border: 1px solid transparent;
  -webkit-appearance: none;
  -moz-appearance: none;
  appearance: none;
  background-image: url("data:image/svg+xml,%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='%238b93a8' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: filter 0.12s ease, box-shadow 0.12s ease;
}
.status-pill:hover, .pill-select:hover { filter: brightness(1.08); }
.status-pill:focus, .pill-select:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.2);
}
.status-pill option, .pill-select option {
  background: var(--color-surface-2);
  color: var(--color-text);
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0;
}

.status-pill.status-open        { background-color: var(--color-surface-2); color: var(--color-muted); }
.status-pill.status-in_progress { background-color: rgba(245, 191, 79, 0.16); color: var(--color-warn); border-color: rgba(245, 191, 79, 0.3); }
.status-pill.status-done        { background-color: rgba(62, 224, 142, 0.16); color: var(--color-good); border-color: rgba(62, 224, 142, 0.3); }
.status-pill.status-other       { background-color: rgba(124, 131, 143, 0.16); color: var(--color-muted); border-color: rgba(124, 131, 143, 0.32); }

/* clients-list status + progress pills (color keyed off the selected value) */
.pill-active,
.pill-done                      { background-color: rgba(62, 224, 142, 0.16); color: var(--color-good); border-color: rgba(62, 224, 142, 0.3); }
.pill-paused,
.pill-in_progress               { background-color: rgba(245, 191, 79, 0.16); color: var(--color-warn); border-color: rgba(245, 191, 79, 0.3); }
.pill-archived,
.pill-not_started               { background-color: var(--color-surface-2); color: var(--color-muted); border-color: var(--color-border); }
.pill-on_hold                   { background-color: rgba(47, 107, 255, 0.16); color: var(--color-accent-hover); border-color: rgba(47, 107, 255, 0.3); }
.pill-canceled                  { background-color: rgba(255, 107, 107, 0.16); color: var(--color-bad); border-color: rgba(255, 107, 107, 0.3); }

/* ── Forms ────────────────────────────────────────────────── */
.input, .select, .textarea {
  width: 100%;
  background: var(--input-bg);
  border: 1px solid var(--color-border);
  color: var(--color-text);
  border-radius: var(--radius-md);
  padding: var(--space-3) var(--space-3);
  font-size: 14px;
  font-family: inherit;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.input:focus, .select:focus, .textarea:focus {
  outline: none;
  border-color: var(--color-accent);
  box-shadow: 0 0 0 3px rgba(124, 92, 255, 0.18);
}
.textarea { resize: vertical; min-height: 100px; font-family: var(--font-mono); font-size: 13px; }

.field { display: flex; flex-direction: column; gap: var(--space-1); margin-bottom: var(--space-4); }
.field label { font-size: 13px; color: var(--color-muted); font-weight: 500; }
.field .error { color: var(--color-bad); font-size: 12px; }

/* ── Table ────────────────────────────────────────────────── */
.table { width: 100%; border-collapse: collapse; }
.table th, .table td { padding: var(--space-3) var(--space-3); text-align: left; border-bottom: 1px solid var(--color-border-soft); }
.table th { color: var(--color-muted); font-weight: 700; font-size: 11px; text-transform: uppercase; letter-spacing: 1.5px; }
.table tbody tr { transition: background 0.12s ease; }
.table tr:hover td { background: var(--hover-row); }
.table tr:last-child td { border-bottom: 0; }

/* ── Badges ───────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.5px;
  background: var(--color-surface-2);
  color: var(--color-muted);
}
.badge.good   { background: rgba(62, 224, 142, 0.16); color: var(--color-good); }
.badge.warn   { background: rgba(247, 185, 85, 0.16); color: var(--color-warn); }

/* Staleness filter chips on the clients list ("Overdue: 12" / "Coming up: 8").
   Tinted by severity; the active one fills in so the current filter is obvious. */
.chip-filter { display: inline-flex; align-items: center; gap: 6px; padding: 3px 10px;
  border-radius: 999px; font-size: 12px; font-weight: 700; letter-spacing: 0.01em;
  border: 1px solid transparent; text-decoration: none; white-space: nowrap; }
.chip-filter:hover { text-decoration: none; filter: brightness(1.12); }
.chip-filter.bad  { background: rgba(255, 107, 107, 0.16); color: var(--color-bad);
  border-color: rgba(255, 107, 107, 0.32); }
.chip-filter.warn { background: rgba(247, 185, 85, 0.16); color: var(--color-warn);
  border-color: rgba(247, 185, 85, 0.32); }
.chip-filter.bad.active  { background: var(--color-bad); color: #fff; }
.chip-filter.warn.active { background: var(--color-warn); color: #1b2530; }
.badge.bad    { background: rgba(255, 107, 107, 0.16); color: var(--color-bad); }
.badge.accent { background: rgba(47, 107, 255, 0.18); color: var(--color-accent-hover); }

/* ── Alerts ───────────────────────────────────────────────── */
.alert {
  padding: var(--space-3) var(--space-4);
  border-radius: var(--radius-md);
  margin-bottom: var(--space-4);
  border: 1px solid;
}
.alert.success { border-color: rgba(62, 224, 142, 0.4); background: rgba(62, 224, 142, 0.1); color: var(--color-good); }
.alert.danger  { border-color: rgba(255, 107, 107, 0.4); background: rgba(255, 107, 107, 0.1); color: var(--color-bad); }
.alert.info    { border-color: rgba(47, 107, 255, 0.4); background: rgba(47, 107, 255, 0.1); color: var(--color-accent-hover); }

/* ── Checklist ────────────────────────────────────────────── */
.checklist { list-style: none; }
.checklist li { display: flex; align-items: center; gap: var(--space-3); padding: var(--space-4) 0; border-bottom: 1px solid var(--color-border-soft); }
.checklist li:last-child { border-bottom: 0; }
.checklist li.done .title { text-decoration: line-through; color: var(--color-muted); }
.checklist input[type=checkbox] { width: 20px; height: 20px; accent-color: var(--color-accent); cursor: pointer; }
/* Per-engine rank cards on the client dashboard: left gauge + right details. */
.rank-card { background: var(--card-bg); border: 1px solid var(--color-border-soft); border-radius: var(--radius-lg, 16px); padding: var(--space-5); display: flex; align-items: center; gap: var(--space-4); text-align: left; }
.rank-card .rank-body { display: flex; flex-direction: column; gap: 1px; min-width: 0; }
.rank-card .rank-engine { font-size: 13px; font-weight: 600; letter-spacing: .04em; text-transform: uppercase; display: flex; align-items: center; gap: 6px; }
.rank-card .rank-num { font-size: 40px; font-weight: 800; line-height: 1.05; background: var(--gradient-brand); -webkit-background-clip: text; background-clip: text; -webkit-text-fill-color: transparent; }
.rank-card .rank-num.miss { background: none; -webkit-text-fill-color: initial; color: var(--color-muted); }
.rank-card .rank-of { font-size: 13px; color: var(--color-muted); }
.rank-card .rank-reason { font-size: 12.5px; color: var(--color-muted); margin-top: var(--space-2); line-height: 1.45; }

/* Standing gauge (rank ÷ total → fill %), tinted to the engine color. */
.rank-gauge {
  --pct: 0;
  flex: 0 0 auto; width: 78px; height: 78px; border-radius: 50%;
  background: conic-gradient(var(--engine-color, var(--color-accent)) calc(var(--pct) * 1%), var(--color-surface-2) 0);
  display: flex; align-items: center; justify-content: center; position: relative;
}
.rank-gauge::before { content: ''; position: absolute; inset: 7px; border-radius: 50%; background: var(--color-surface); }
.rank-gauge-val { position: relative; font-size: 19px; font-weight: 800; color: var(--color-text); }
.rank-gauge-val small { font-size: 11px; font-weight: 700; color: var(--color-muted); margin-left: 1px; }
.rank-card.is-miss .rank-gauge { background: var(--color-surface-2); }
.rank-card.is-miss .rank-gauge-val { color: var(--color-muted); }

/* Info button → opens the "why this rank" modal. */
.info-btn { border: 0; background: none; padding: 0; cursor: pointer; color: var(--color-faint, var(--color-muted)); font-size: 14px; line-height: 1; transition: color 0.12s ease; }
.info-btn:hover { color: var(--engine-color, var(--color-accent)); }

/* Read-only status marker (client cannot toggle — admin controls completion). */
.checklist .status-marker { flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; display: inline-flex; align-items: center; justify-content: center; font-size: 13px; font-weight: 700; line-height: 1; border: 2px solid var(--color-border); color: #fff; }
.checklist .status-marker.status-open { background: transparent; }
.checklist .status-marker.status-in_progress { border-color: var(--color-accent); background: transparent; box-shadow: inset 0 0 0 3px var(--color-accent); }
.checklist .status-marker.status-done { background: var(--color-good, #16a34a); border-color: var(--color-good, #16a34a); }
.checklist .status-marker.status-other { background: var(--color-muted, #7c838f); border-color: var(--color-muted, #7c838f); color: #fff; }

/* ── Checklist progress header ────────────────────────────── */
.progress-head { display: flex; align-items: center; gap: var(--space-6); margin-bottom: var(--space-4); }
.progress-ring {
  --pct: 0;
  flex: 0 0 auto; width: 92px; height: 92px; border-radius: 50%;
  background: conic-gradient(var(--color-good) calc(var(--pct) * 1%), var(--color-surface-2) 0);
  display: flex; align-items: center; justify-content: center; position: relative;
}
/* Hole must be an OPAQUE surface colour — --card-bg is translucent and lets the
   ring show through, making it read as a full filled circle instead of a donut. */
.progress-ring::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--color-surface); }
.progress-ring-num { position: relative; font-size: 24px; font-weight: 800; line-height: 1; }
.progress-ring-num span { font-size: 13px; font-weight: 700; color: var(--color-muted); margin-left: 1px; }
.progress-title { font-size: 18px; font-weight: 700; }
.progress-stats { display: flex; gap: var(--space-4); margin-top: var(--space-2); flex-wrap: wrap; }
.pstat { font-size: 13px; font-weight: 600; color: var(--color-muted); display: inline-flex; align-items: center; gap: 7px; }
.pstat::before { content: ''; width: 9px; height: 9px; border-radius: 50%; background: var(--color-border); }
.pstat.done::before { background: var(--color-good); }
.pstat.prog::before { background: var(--color-accent); }
.pstat.open::before { background: var(--color-muted); }

/* ── Admin client "At a glance" blue donut row ────────────── */
/* Right column of the client page stacks the donut card over Notes. */
.col-stack { display: flex; flex-direction: column; gap: var(--space-6); }
.donut-list { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-3); }
.donut-item { display: flex; flex-direction: column; align-items: center; text-align: center; gap: 5px; min-width: 0; }
/* Registering --pct as a real <number> lets the conic-gradient animate (custom
   props are otherwise non-animatable and would just jump). */
@property --pct { syntax: '<number>'; inherits: false; initial-value: 0; }

.donut {
  --pct: 0;
  width: 64px; height: 64px; border-radius: 50%;
  /* Real donut: a thick coloured ring with a big open hole (the ::before below
     punches the centre out). Number sits inside the hole. Ring colour overridable
     per donut via --ring. */
  background: conic-gradient(var(--ring, var(--color-accent)) calc(var(--pct) * 1%), var(--color-surface-2) 0);
  display: flex; align-items: center; justify-content: center; position: relative;
  /* Fill the ring on load: animate --pct from 0 up to the inline target (--p). */
  animation: donutFill 1.1s cubic-bezier(0.22, 1, 0.36, 1) both;
}
@keyframes donutFill { from { --pct: 0; } to { --pct: var(--p, 0); } }
@media (prefers-reduced-motion: reduce) {
  .donut { animation: none; --pct: var(--p, 0); }
}
/* Hole must be an OPAQUE surface colour — --card-bg is a translucent gradient in
   dark mode, which lets the ring show through and reads as a full circle. */
.donut::before { content: ''; position: absolute; inset: 9px; border-radius: 50%; background: var(--color-surface); }
.donut-val { position: relative; font-size: 15px; font-weight: 800; color: var(--color-text); line-height: 1; }
.donut-val small { font-size: 10px; font-weight: 700; color: var(--color-muted); margin-left: 1px; }
.donut-lbl { font-size: 12px; font-weight: 600; color: var(--color-text); }
.donut-hint { font-size: 11px; color: var(--color-muted); }
@media (max-width: 560px) { .donut-list { grid-template-columns: repeat(2, 1fr); gap: var(--space-4); } }

/* ── Per-engine identity on rank cards ────────────────────── */
.rank-card { position: relative; overflow: hidden; transition: transform 0.15s ease, border-color 0.15s ease; }
.rank-card::before { content: ''; position: absolute; top: 0; left: 0; right: 0; height: 3px; background: var(--engine-color, var(--color-accent)); }
.rank-card:hover { transform: translateY(-2px); border-color: var(--engine-color, var(--color-accent)); }
.rank-card.engine-openai { --engine-color: #10a37f; }
.rank-card.engine-gemini { --engine-color: #4285f4; }
.rank-card.engine-claude { --engine-color: #d97757; }
.rank-card .rank-engine > span { color: var(--engine-color, var(--color-muted)); }

/* ── Breadcrumbs ──────────────────────────────────────────── */
.breadcrumbs a { color: var(--color-muted); text-decoration: none; }
.breadcrumbs a:hover { color: var(--color-accent); }
.breadcrumbs .bc-sep { color: var(--color-faint, var(--color-muted)); margin: 0 6px; }

/* ── Page with a right rail (clients list + "to check") ───── */
.with-rail { display: grid; grid-template-columns: minmax(0, 1fr) 300px; gap: var(--space-5); align-items: start; }
.with-rail > * { min-width: 0; }            /* allow columns to shrink below content */
.with-rail .card { overflow-x: auto; }      /* wide table scrolls inside its card, not the page */
@media (max-width: 1100px) { .with-rail { grid-template-columns: 1fr; } }
/* Stacked rail cards (Packages, To check this week, …) need breathing room. */
.rail-card + .rail-card { margin-top: var(--space-5); }
.rail-card .review-row { display: flex; align-items: center; gap: var(--space-2); padding: var(--space-2) 0; border-bottom: 1px solid var(--color-border-soft); }
.rail-card .review-row:last-child { border-bottom: 0; }
.rail-card a.review-row { color: inherit; text-decoration: none; padding-left: var(--space-2); padding-right: var(--space-2); margin: 0 calc(-1 * var(--space-2)); border-radius: var(--radius-sm); }
.rail-card a.review-row:hover { background: var(--color-surface-2); }
.rail-card a.review-row.active { background: var(--color-surface-2); font-weight: 600; }
.rail-dot { width: 8px; height: 8px; border-radius: 50%; flex: 0 0 auto; }

/* ── Report build picker (admin) ──────────────────────────── */
.build-query { margin-bottom: var(--space-6); }
.build-query + .build-query { border-top: 1px solid var(--color-border-soft); padding-top: var(--space-5); }
.build-query-title {
  font-size: 13px; font-weight: 700; letter-spacing: 0.3px;
  margin: 0 0 var(--space-3); color: var(--color-text);
}
.provider-col.engine-openai { --engine-color: #10a37f; }
.provider-col.engine-gemini { --engine-color: #4285f4; }
.provider-col.engine-claude { --engine-color: #d97757; }
.provider-col {
  background: var(--color-surface-2);
  border: 1px solid var(--color-border);
  border-top: 3px solid var(--engine-color, var(--color-accent));
  border-radius: var(--radius-md);
  padding: var(--space-3);
}
.provider-col-head {
  font-weight: 700; font-size: 15px;
  color: var(--engine-color, var(--color-text));
  margin-bottom: var(--space-3);
}
.provider-col-empty { color: var(--color-muted); font-size: 13px; }
.run-row {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-1) 0;
}
.run-row + .run-row { border-top: 1px solid var(--color-border-soft); }
.run-pick {
  display: flex; align-items: center; gap: var(--space-2);
  flex: 1; cursor: pointer; font-size: 13px; margin: 0;
}
.run-pick-rank { font-weight: 700; min-width: 34px; }
.run-pick-date { color: var(--color-muted); }
.run-row.is-latest { background: color-mix(in srgb, var(--engine-color) 8%, transparent); border-radius: var(--radius-sm); }
.badge.sm { font-size: 10px; padding: 1px 6px; }
.run-view { font-size: 12px; color: var(--color-muted); text-decoration: none; }
.run-view:hover { color: var(--color-accent); }

/* ── Client rank tabs + detail panels ─────────────────────── */
.query-phrase { font-size: 14px; color: var(--color-muted); margin-bottom: var(--space-3); }
.query-phrase strong { color: var(--color-text); }
.rank-tabs { margin-bottom: var(--space-4); }
/* rank-card is a <button> here — reset UA chrome, keep the card look */
button.rank-card { width: 100%; font: inherit; color: inherit; cursor: pointer; appearance: none; -webkit-appearance: none; }
button.rank-card.is-active {
  border-color: var(--engine-color, var(--color-accent));
  box-shadow: 0 0 0 2px color-mix(in srgb, var(--engine-color, var(--color-accent)) 35%, transparent);
}
.rank-panels { position: relative; }
.rank-panel {
  background: var(--card-bg);
  border: 1px solid var(--color-border-soft);
  border-top: 3px solid var(--engine-color, var(--color-accent));
  border-radius: var(--radius-lg, 16px);
  padding: var(--space-5);
}
.rank-panel[hidden] { display: none; }
.rank-panel.engine-openai, .rank-panel .engine-openai { --engine-color: #10a37f; }
.rank-panel.engine-gemini, .rank-panel .engine-gemini { --engine-color: #4285f4; }
.rank-panel.engine-claude, .rank-panel .engine-claude { --engine-color: #d97757; }
.rd-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); margin-bottom: var(--space-3); flex-wrap: wrap; }
.rd-engine { font-size: 16px; font-weight: 800; color: var(--engine-color, var(--color-text)); }
.rd-buckets { margin-top: var(--space-4); }
.rd-buckets .rd-bucket { margin-top: 0; } /* grid columns — no stacked top gap */
.rd-more { margin-top: var(--space-2); }
.rd-more summary { cursor: pointer; font-size: 12px; font-weight: 600; color: var(--color-accent); list-style: none; }
.rd-more summary::-webkit-details-marker { display: none; }
.rd-more summary:hover { text-decoration: underline; }
.rd-more[open] summary { margin-bottom: var(--space-2); }
.rd-disclaimer { margin-top: var(--space-4); font-size: 11.5px; color: var(--color-faint, var(--color-muted)); font-style: italic; }
/* remaining bucket rules are shared with .rank-detail (defined later) */

/* ── "Why this rank" modal ────────────────────────────────── */
.modal-backdrop { position: fixed; inset: 0; z-index: 50; display: flex; align-items: center; justify-content: center; padding: var(--space-5); background: rgba(0, 0, 0, 0.55); backdrop-filter: blur(3px); }
.modal-backdrop[hidden] { display: none; }
.modal { position: relative; width: 100%; max-width: 520px; max-height: 85vh; overflow-y: auto; padding: var(--space-6); background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg, 16px); box-shadow: 0 24px 60px -12px rgba(0, 0, 0, 0.5); }
.modal-close { position: absolute; top: var(--space-4); right: var(--space-4); border: 0; background: none; cursor: pointer; color: var(--color-muted); font-size: 22px; line-height: 1; }
.modal-close:hover { color: var(--color-text); }
.modal-eyebrow { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1.5px; color: var(--color-muted); }
.modal-title { font-size: 20px; font-weight: 800; margin: var(--space-1) 0 var(--space-3); }
.modal-body { font-size: 14px; line-height: 1.6; color: var(--color-text); }

/* Rich per-engine detail rendered inside the modal */
.rank-detail .rd-standing { font-size: 13px; font-weight: 700; color: var(--color-muted); margin-bottom: var(--space-2); }
.rank-detail .rd-reason { margin: 0 0 var(--space-4); }
.rank-detail .rd-bucket { margin-top: var(--space-4); padding-left: var(--space-3); border-left: 3px solid var(--color-border); }
.rank-detail .rd-good { border-left-color: var(--color-good); }
.rank-detail .rd-warn { border-left-color: var(--color-warn); }
.rank-detail .rd-accent { border-left-color: var(--color-accent); }
.rank-detail .rd-bucket-title { font-size: 11px; font-weight: 700; text-transform: uppercase; letter-spacing: 1px; color: var(--color-muted); margin-bottom: var(--space-2); }
.rank-detail .rd-bucket ul { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-2); }
.rank-detail .rd-bucket li strong { display: block; font-size: 13.5px; font-weight: 600; }
.rank-detail .rd-bucket li span { display: block; font-size: 12.5px; color: var(--color-muted); line-height: 1.45; }
.rank-detail .rd-empty { font-size: 13px; color: var(--color-faint, var(--color-muted)); }

/* ── Key/value ────────────────────────────────────────────── */
.kv { display: grid; grid-template-columns: 140px 1fr; gap: var(--space-2) var(--space-4); }
.kv dt { color: var(--color-muted); font-size: 13px; }
.kv dd { font-size: 14px; }

/* ── Empty state ──────────────────────────────────────────── */
.empty {
  padding: var(--space-12) var(--space-8);
  text-align: center;
  color: var(--color-muted);
  border: 1px dashed var(--color-border);
  border-radius: var(--radius-lg);
  background: var(--hover-row);
}
.empty .empty-icon { font-size: 34px; margin-bottom: var(--space-3); opacity: 0.8; }
.empty .empty-title { color: var(--color-text); font-weight: 650; font-size: 16px; margin-bottom: var(--space-2); }

/* ── Provider tabs ────────────────────────────────────────── */
.provider-tabs { display: flex; gap: var(--space-1); border-bottom: 1px solid var(--color-border-soft); margin-bottom: var(--space-5); }
.provider-tabs a { padding: var(--space-3) var(--space-4); color: var(--color-muted); border-bottom: 2px solid transparent; font-weight: 600; }
.provider-tabs a:hover { color: var(--color-text); text-decoration: none; }
.provider-tabs a.active { color: var(--color-text); border-bottom-color: var(--color-accent); }

/* ── Theme toggle ─────────────────────────────────────────── */
.theme-toggle {
  display: inline-flex; align-items: center; gap: var(--space-2);
  background: none; border: 0; cursor: pointer;
  color: var(--color-muted); font-size: 13px; font-family: inherit; font-weight: 500;
  padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm);
  width: 100%; text-align: left;
}
.theme-toggle:hover { color: var(--color-text); background: var(--color-surface-2); }
.theme-toggle .to-dark { display: none; }
.theme-toggle .to-light { display: inline; }
:root[data-theme="light"] .theme-toggle .to-light { display: none; }
:root[data-theme="light"] .theme-toggle .to-dark { display: inline; }

/* Floating variant for guest screens (login / 2fa). */
.theme-toggle.floating {
  position: fixed; top: var(--space-5); right: var(--space-5); z-index: 5;
  width: auto;
  background: var(--card-bg); border: 1px solid var(--color-border-soft);
  box-shadow: var(--shadow-sm); backdrop-filter: blur(8px);
}

/* Smooth theme cross-fade. */
body, .card, .sidebar, .input, .select, .textarea, .table td, .btn, .badge {
  transition: background-color 0.25s ease, border-color 0.25s ease, color 0.25s ease;
}

/* ── Client workspace tabs (admin → client) ───────────────── */
.client-tabs {
  display: flex; gap: var(--space-1);
  border-bottom: 1px solid var(--color-border-soft);
  margin: var(--space-4) 0 var(--space-6);
  overflow-x: auto;
}
.client-tabs a {
  padding: var(--space-3) var(--space-4); color: var(--color-muted);
  border-bottom: 2px solid transparent; font-weight: 600; white-space: nowrap;
}
.client-tabs a:hover { color: var(--color-text); text-decoration: none; }
.client-tabs a.active { color: var(--color-accent); border-bottom-color: var(--color-accent); }
.client-tabs .count {
  font-size: 11px; font-weight: 700; margin-left: 6px;
  background: var(--color-accent); color: #fff; border-radius: 999px; padding: 1px 7px;
}

/* ── Admin: client workspace colour accents ───────────────── */
/* At-a-glance donuts — give each metric its own ring colour. */
.donut-list .donut-item:nth-child(1) .donut { --ring: var(--color-accent); }
.donut-list .donut-item:nth-child(2) .donut { --ring: #3b82f6; }
.donut-list .donut-item:nth-child(3) .donut { --ring: #2fbf71; }
.donut-list .donut-item:nth-child(4) .donut { --ring: #f7b955; }

/* Colour-coded section headers on the Analysis tab. */
.section-h { border-left: 4px solid var(--color-accent); padding-left: var(--space-3); }
.section-h.sh-searches { border-color: #3b82f6; }
.section-h.sh-runs     { border-color: #f7b955; }
.section-h.sh-build    { border-color: #2fbf71; }

/* Provider dot in the run log. */
.engine-dot { display: inline-block; width: 8px; height: 8px; border-radius: 50%; margin-right: 6px; vertical-align: middle; background: var(--engine-color, var(--color-muted)); }

/* Run log scrolls inside a fixed height; header stays pinned. */
.run-log { max-height: 360px; overflow-y: auto; }
.run-log table thead th { position: sticky; top: 0; background: var(--color-surface); z-index: 1; }

/* Client-preview banner on the Reports tab. */
.preview-banner {
  display: flex; align-items: center; justify-content: space-between; gap: var(--space-3); flex-wrap: wrap;
  padding: var(--space-3) var(--space-4); margin: var(--space-4) 0 var(--space-6);
  background: var(--color-surface); border: 1px solid var(--color-border); border-left: 4px solid var(--color-accent);
  border-radius: 10px; font-size: 14px; color: var(--color-muted);
}
/* Reports preview: CSS-only tabs (radio toggle) — one report visible at a time. */
.preview-tab-input { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }
.preview-tabbar { display: flex; gap: var(--space-2); border-bottom: 2px solid var(--color-border); margin-bottom: var(--space-6); }
.preview-tab {
  display: flex; align-items: center; gap: var(--space-2);
  padding: var(--space-3) var(--space-5); font-weight: 700; color: var(--color-muted);
  cursor: pointer; border-bottom: 2px solid transparent; margin-bottom: -2px; user-select: none;
}
.preview-tab:hover { color: var(--color-text); }
.preview-panel { display: none; }
/* :checked drives both the active tab styling and which panel shows. */
#pt-audit:checked ~ .preview-tabbar label[for="pt-audit"],
#pt-ai:checked ~ .preview-tabbar label[for="pt-ai"],
#pt-seo:checked ~ .preview-tabbar label[for="pt-seo"] { color: var(--color-accent); border-bottom-color: var(--color-accent); }
#pt-audit:checked ~ .preview-panel[data-panel="audit"],
#pt-ai:checked ~ .preview-panel[data-panel="ai"],
#pt-seo:checked ~ .preview-panel[data-panel="seo"] { display: block; }
/* Keyboard focus visible on the labels. */
.preview-tab-input:focus-visible ~ .preview-tabbar label { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* ── Stat cards (overview metrics) ────────────────────────── */
.stat-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.stat .num { font-size: 32px; font-weight: 800; letter-spacing: -0.03em; line-height: 1.1; }
.stat .num.grad {
  background: var(--gradient-text); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent;
}
.stat .lbl { font-size: 12px; color: var(--color-muted); text-transform: uppercase; letter-spacing: 0.05em; margin-bottom: var(--space-2); }
.stat .hint { font-size: 12px; color: var(--color-muted); margin-top: var(--space-1); }
@media (max-width: 800px) { .stat-grid { grid-template-columns: repeat(2, 1fr); } }

/* ── Dashboard overview ───────────────────────────────────── */
.overview { padding-top: var(--space-8); }

/* Transparent report heading (no card, no border). Centered by default (used on
   the AI tab); left-aligned when it sits in the overview's 50|50 text column. */
.ai-hero { text-align: center; }
.ai-hero .eyebrow {
  font-size: 12px; font-weight: 700; letter-spacing: 2px; text-transform: uppercase;
  color: var(--color-accent); margin-bottom: var(--space-3);
}
.ai-hero h2 {
  font-size: clamp(30px, 4.5vw, 48px); font-weight: 800; letter-spacing: -0.03em;
  line-height: 1.05; margin: 0 auto var(--space-4); max-width: 20ch;
}
.ai-hero .lede { color: var(--color-muted); max-width: 60ch; margin: 0 auto; }

/* Top 50|50: summary text (left) beside the coloured donuts (right). Sits on a
   subtle surface panel. */
.overview-top {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8) var(--space-10);
  background: var(--color-surface); padding: 50px; border-radius: 10px;
}
.overview-text, .overview-stats { flex: 1 1 340px; min-width: 0; }
.overview-text .ai-hero { text-align: left; }
.overview-text .ai-hero h2, .overview-text .ai-hero .lede { margin-left: 0; margin-right: 0; }

/* Donut numbers — inline in one row, each metric its own colour so it's not bland.
   Number in the ring, caption directly under it. Wraps if the row gets tight. */
.donut-stats { display: flex; flex-wrap: wrap; justify-content: center; gap: var(--space-5); }
.donut-stat {
  flex: 0 1 auto; min-width: 0;
  display: flex; flex-direction: column; align-items: center; gap: var(--space-2); text-align: center;
}
/* Number + caption stacked inside the ring. */
.donut-stat .donut { width: 132px; height: 132px; flex-direction: column; gap: 2px; }
.donut-stat .donut::before { inset: 14px; }
.donut-stat .donut-val { font-size: 30px; }
.donut-stat .donut-val small { font-size: 15px; }
.donut-cap {
  position: relative; max-width: 92px;
  font-size: 9px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  line-height: 1.15; color: var(--color-muted);
}
.donut-stat.is-ai  .donut { --ring: var(--color-accent); }
.donut-stat.is-seo .donut { --ring: #3b82f6; }
.donut-stat.is-act .donut { --ring: #f7b955; }
.donut-stat.is-chk .donut { --ring: #2fbf71; }

/* "3 major LLMs" teaser. Big centred title, one card per engine, 2 tips each. */
.llm-section { margin-top: 75px; }
.llm-title { text-align: center; font-size: clamp(26px, 3.5vw, 40px); font-weight: 800; letter-spacing: -0.03em; margin: 0 0 var(--space-6); }
.llm-grid { display: flex; flex-wrap: wrap; gap: var(--space-5); }
.llm-card { flex: 1 1 240px; border-top: 3px solid var(--engine-color, var(--color-accent)); }
/* Name + rank centred and large (smaller than the section heading above). */
.llm-head { text-align: center; margin-bottom: var(--space-4); }
.llm-name { font-size: clamp(22px, 2.8vw, 30px); font-weight: 700; color: var(--engine-color, var(--color-text)); }
.llm-rank { font-size: clamp(38px, 4.6vw, 48px); font-weight: 800; letter-spacing: -0.02em; line-height: 1.1; }
.llm-tips { list-style: none; display: flex; flex-direction: column; gap: var(--space-2); padding: 0; margin: 0; }
.llm-tips li { position: relative; padding-left: var(--space-5); font-size: 14px; color: var(--color-muted); line-height: 1.4; }
.llm-tips li::before { content: '↗'; position: absolute; left: 0; top: 0; color: var(--engine-color, var(--color-accent)); font-weight: 700; }
.overview-cta { text-align: center; margin-top: 30px; }

/* SEO teaser — text beside the trend chart, same surface card as .overview-top. */
.seo-teaser {
  display: flex; flex-wrap: wrap; align-items: center; gap: var(--space-8) var(--space-10);
  background: var(--color-surface); padding: 50px; border-radius: 10px;
  margin-top: 75px;
}
.seo-teaser-text, .seo-teaser-chart { flex: 1 1 340px; min-width: 0; }
.seo-teaser-text .llm-title { text-align: left; margin-bottom: var(--space-4); }
.seo-teaser-text .overview-cta { text-align: left; }
.seo-teaser-score { display: flex; align-items: baseline; gap: var(--space-2); margin: var(--space-5) 0; }
.seo-score-num { font-size: clamp(40px, 6vw, 64px); font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.seo-score-num.score-good { color: var(--color-good); }
.seo-score-num.score-warn { color: var(--color-warn); }
.seo-score-num.score-bad  { color: var(--color-bad); }
.seo-score-max { font-size: 20px; font-weight: 600; color: var(--color-muted); }

/* Engine colours usable on any element (not just rank cards). */
.engine-openai { --engine-color: #10a37f; }
.engine-gemini { --engine-color: #4285f4; }
.engine-claude { --engine-color: #d97757; }

/* Activity boxes: flexbox so a lone box fills the row, two split it, three share
   thirds — grid columns leave dead space when boxes are hidden. Heading sits
   above the card; each box gets generous vertical breathing room. */
.activity-row { display: flex; flex-wrap: wrap; gap: var(--space-5); margin-top: 75px; }
.activity-box { flex: 1 1 300px; padding: 5vh 0; }
.activity-head { font-size: 16px; font-weight: 700; margin-bottom: var(--space-3); }

/* ── SEO audit page ───────────────────────────────────────── */
/* Score + reasoning on one surface panel: big donut left, "why" right. */
.seo-overview {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: var(--space-8) var(--space-10);
  background: var(--color-surface); padding: 50px; border-radius: 10px; margin-top: var(--space-10);
}
.seo-score { flex: 0 0 auto; display: flex; flex-direction: column; align-items: center; gap: var(--space-3); }
.seo-score-hint { font-size: 13px; color: var(--color-muted); }
.seo-why-text { color: var(--color-muted); line-height: 1.7; font-size: 16px; margin: 0; }
/* Full-width intro paragraph on the SEO page (no measure cap). */
.seo-hero .lede { max-width: none; }

/* Big animated score donut — number + caption inside the ring. */
.donut-xl { width: 168px; height: 168px; flex-direction: column; gap: 3px; --ring: #3b82f6; }
.donut-xl::before { inset: 18px; }
.donut-xl .donut-val { font-size: 44px; }
.donut-xl .donut-cap { max-width: 130px; font-size: 11px; }

/* Spaced-out sections + scannable recommendation cards. */
.seo-section { margin-top: 75px; }
.seo-h { font-size: clamp(24px, 3vw, 34px); font-weight: 800; letter-spacing: -0.02em; margin: 0 0 var(--space-6); }
/* Three priority columns — High / Medium / Low — each stacking its own cards. */
.seo-cols { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: var(--space-6); }
@media (max-width: 860px) { .seo-cols { grid-template-columns: 1fr; } }
.seo-col { display: flex; flex-direction: column; gap: var(--space-3); }
.seo-col-head {
  display: flex; align-items: center; justify-content: space-between;
  font-size: 17px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.06em;
  padding-bottom: var(--space-3); margin: 0 0 var(--space-1); border-bottom: 2px solid currentColor;
}
.seo-col-head.high   { color: #ff6b6b; }
.seo-col-head.medium { color: #f7b955; }
.seo-col-head.low    { color: var(--color-accent); }
.seo-col-count { font-size: 26px; font-weight: 800; line-height: 1; }
.seo-col-empty { font-size: 15px; color: var(--color-muted); }
.seo-rec { display: flex; flex-direction: column; gap: var(--space-2); }
.seo-rec .it-title { color: var(--color-text); font-size: 17px; font-weight: 700; }
.seo-rec .it-detail { font-size: 15px; line-height: 1.55; }

/* Metric tiles — number + label + coloured fill bar. */
.metric-tiles { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); gap: var(--space-4); }
.metric-tile { display: flex; flex-direction: column; gap: var(--space-2); }
.metric-val { font-size: 30px; font-weight: 800; letter-spacing: -0.03em; line-height: 1; }
.metric-val small { font-size: 0.5em; font-weight: 700; color: var(--color-muted); margin-left: 1px; }
.metric-lbl { font-size: 12px; color: var(--color-muted); }
.metric-bar { height: 6px; border-radius: 3px; background: var(--color-surface-2); overflow: hidden; }
.metric-bar span {
  display: block; height: 100%; border-radius: 3px; background: var(--color-accent);
  transform-origin: left center; animation: barFill 0.9s cubic-bezier(0.22, 1, 0.36, 1) both;
}
.metric-bar.good span { background: #2fbf71; }
.metric-bar.warn span { background: #f7b955; }
.metric-bar.bad span  { background: #ff6b6b; }
@keyframes barFill { from { transform: scaleX(0); } to { transform: scaleX(1); } }

/* Site-health trend (inline SVG line chart). */
.trend { width: 100%; padding: var(--space-5); border-radius: 10px; display: flex; flex-direction: column; }
.trend-svg { width: 100%; height: auto; display: block; }
.trend-grid { stroke: var(--color-border); stroke-width: 1; }
.trend-axis { fill: var(--color-muted); font-size: 11px; }
.trend-line {
  stroke: var(--color-accent); stroke-width: 2.5; stroke-linejoin: round; stroke-linecap: round;
  stroke-dasharray: 1; stroke-dashoffset: 1; animation: trendDraw 1.4s ease-out forwards;
}
.trend-dot { fill: var(--color-accent); stroke: var(--color-surface); stroke-width: 2; animation: trendDot 0.4s ease-out both; animation-delay: 1.1s; }
.trend-val { fill: var(--color-text); font-size: 12px; font-weight: 700; animation: trendDot 0.4s ease-out both; animation-delay: 1.2s; }
.trend-note { text-align: center; color: var(--color-muted); font-size: 13px; margin: var(--space-3) 0 0; }
@keyframes trendDraw { to { stroke-dashoffset: 0; } }
@keyframes trendDot { from { opacity: 0; } to { opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
  .metric-bar span { animation: none; transform: none; }
  .trend-line { animation: none; stroke-dashoffset: 0; }
  .trend-dot, .trend-val { animation: none; opacity: 1; }
}

/* Inline checkbox + label (forms). */
.check-inline { display: flex; align-items: center; gap: var(--space-2); font-weight: 500; cursor: pointer; }
.check-inline input { width: 18px; height: 18px; accent-color: var(--color-accent); cursor: pointer; }

/* Modal (inline editors, e.g. notes popup). */
.modal-backdrop { position: fixed; inset: 0; background: rgba(0, 0, 0, 0.5); display: flex; align-items: center; justify-content: center; z-index: 50; padding: var(--space-4); }
.modal-backdrop[hidden] { display: none; }
.modal { background: var(--color-surface); border: 1px solid var(--color-border-soft); border-radius: var(--radius-lg); padding: var(--space-5); width: 100%; max-width: 560px; box-shadow: var(--shadow-lg); }
.modal-title { font-weight: 700; margin-bottom: var(--space-3); }

/* Notes cell in the clients table. */
.notes-cell { background: none; border: 0; cursor: pointer; font: inherit; text-align: left; padding: 0; max-width: 200px; color: var(--color-text); }
.notes-cell:hover .notes-snip { text-decoration: underline; }
.notes-snip { display: inline-block; max-width: 200px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; vertical-align: bottom; color: var(--color-muted); font-size: 13px; }

/* Columns show/hide dropdown. */
.cols-menu { position: relative; }
.cols-menu > summary { list-style: none; cursor: pointer; }
.cols-menu > summary::-webkit-details-marker { display: none; }
.cols-pop { position: absolute; right: 0; top: calc(100% + 6px); background: var(--color-surface); border: 1px solid var(--color-border-soft); border-radius: var(--radius-md); box-shadow: var(--shadow-md); padding: var(--space-3); z-index: 20; display: flex; flex-direction: column; gap: var(--space-2); min-width: 160px; }
.cols-pop label { display: flex; align-items: center; gap: var(--space-2); font-size: 13px; white-space: nowrap; cursor: pointer; }

/* Sortable table headers. */
.table th a { color: inherit; text-decoration: none; }
.table th a:hover { color: var(--color-accent); }
.table th a.active { color: var(--color-accent); }   /* current sort column */

/* Inline "Added" date input in the clients table. */
.input-date { width: 150px; padding: var(--space-1) var(--space-2); font-size: 13px; }

/* Small inline edit affordance (e.g. FD ticket pencil). */
.link-edit { background: none; border: 0; cursor: pointer; color: var(--color-muted); font-size: 12px; padding: 0 0 0 4px; }
.link-edit:hover { color: var(--color-accent); }

/* Active progress filter link in the Total-clients breakdown. */
.stat .hint a { color: var(--color-muted); text-decoration: none; }
.stat .hint a:hover { color: var(--color-text); }
.stat .hint a.is-active { color: var(--color-accent); font-weight: 700; }

/* Constrain the framework paginator's arrow SVGs (no Tailwind here = they render huge). */
nav[role="navigation"] svg,
.pagination svg { width: 18px; height: 18px; display: inline; }

/* Stat-card state tints (client dashboard: green good / amber in-progress / red low). */
.stat.is-good { background: linear-gradient(180deg, rgba(62, 224, 142, 0.10), transparent); border-color: rgba(62, 224, 142, 0.35); }
.stat.is-warn { background: linear-gradient(180deg, rgba(247, 185, 85, 0.10), transparent); border-color: rgba(247, 185, 85, 0.35); }
.stat.is-bad  { background: linear-gradient(180deg, rgba(255, 107, 107, 0.10), transparent); border-color: rgba(255, 107, 107, 0.30); }

/* Sub-prompt ("other focus areas") cards on the client dashboard. */
.sub-rank { display: flex; flex-direction: column; gap: var(--space-3); }
.sub-rank-head { display: flex; align-items: baseline; justify-content: space-between; gap: var(--space-3); }
.sub-rank-label { font-weight: 700; font-size: 16px; }
.sub-rank-score { font-size: 26px; font-weight: 800; letter-spacing: -0.02em; flex: 0 0 auto; }
.sub-rank-score small { font-size: 13px; color: var(--color-muted); font-weight: 600; }
/* Per-engine donuts inside a focus area. */
.sub-donuts { display: flex; justify-content: space-around; gap: var(--space-3); border-top: 1px solid var(--color-border-soft); padding-top: var(--space-4); margin-top: auto; }
.sub-donut { display: flex; flex-direction: column; align-items: center; gap: var(--space-1); text-align: center; }
.sub-donut .donut { width: 72px; height: 72px; --ring: var(--engine-color, var(--color-accent)); }
.sub-donut .donut::before { inset: 8px; }
.sub-donut .donut-val { font-size: 17px; }
.sub-donut .donut-val small { font-size: 10px; }
.sub-donut.is-miss .donut { --ring: var(--color-surface-2); }
.sub-donut-cap { font-size: 12px; font-weight: 700; color: var(--engine-color, var(--color-text)); }
.sub-donut-rank { font-size: 12px; color: var(--color-muted); }

/* ── Live-refresh toast (bottom-center) ───────────────────── */
#toast-root { position: fixed; left: 0; right: 0; bottom: var(--space-5); display: flex; justify-content: center; pointer-events: none; z-index: 60; }
.toast {
  pointer-events: auto;
  display: inline-flex; align-items: center; gap: var(--space-3);
  max-width: min(92vw, 460px);
  padding: var(--space-3) var(--space-4);
  background: var(--color-surface); color: var(--color-text);
  border: 1px solid var(--color-border-soft); border-radius: var(--radius-md);
  box-shadow: var(--shadow-lg);
  font-size: 14px; font-weight: 500;
  opacity: 0; transform: translateY(10px); transition: opacity 0.25s ease, transform 0.25s ease;
}
.toast.show { opacity: 1; transform: translateY(0); }
.toast.done { border-color: color-mix(in srgb, var(--color-good) 50%, var(--color-border-soft)); }
.toast-spin {
  flex: 0 0 auto; width: 16px; height: 16px; border-radius: 50%;
  border: 2px solid var(--color-border); border-top-color: var(--color-accent);
  animation: toast-spin 0.7s linear infinite;
}
.toast-check { flex: 0 0 auto; width: 16px; height: 16px; display: inline-flex; align-items: center; justify-content: center; color: var(--color-good); font-weight: 800; }
@keyframes toast-spin { to { transform: rotate(360deg); } }
@media (prefers-reduced-motion: reduce) { .toast-spin { animation: none; } .toast { transition: none; } }

/* ── 2FA ──────────────────────────────────────────────────── */
.qr-wrap { background: #fff; padding: var(--space-3); border-radius: var(--radius-md); display: inline-block; }
.qr-wrap svg { display: block; max-width: 220px; height: auto; }
.code-display { font-family: var(--font-mono); background: var(--color-surface-2); padding: var(--space-2) var(--space-3); border-radius: var(--radius-sm); display: inline-block; word-break: break-all; }

/* ═══════════════════════════════════════════════════════════════════
   Analytics / SEO dashboard (an-*) — GA4 + GSC. Inline-SVG charts.
   Uses the global design tokens, so light theme flips automatically.
   ═══════════════════════════════════════════════════════════════════ */
.an-dash { display: flex; flex-direction: column; gap: var(--space-8); }
.an-dash-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-4); flex-wrap: wrap; }
.an-domain { font-weight: 700; font-size: 1.05rem; }
.an-range { color: var(--color-muted); font-size: 0.85rem; margin-left: var(--space-2); }

.an-section { display: flex; flex-direction: column; gap: var(--space-5); }
.an-h2 { font-size: 1.15rem; font-weight: 700; margin: 0; display: flex; align-items: center; gap: var(--space-3); }
.an-src { font-size: 0.68rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-muted); background: var(--color-surface-2); border: 1px solid var(--color-border);
  padding: 2px 8px; border-radius: 999px; }

/* ── KPI cards — big numbers front and centre ─────────────────────── */
.an-kpi-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); }
.an-kpi { background: var(--card-bg); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  padding: var(--space-5); display: flex; flex-direction: column; gap: var(--space-2); min-width: 0; }
.an-kpi-accent { border-color: transparent; background: var(--gradient-brand-soft);
  box-shadow: inset 0 0 0 1px rgba(47, 107, 255, 0.35); }
.an-kpi-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.06em;
  color: var(--color-muted); }
.an-kpi-value { font-size: clamp(1.7rem, 3.2vw, 2.6rem); font-weight: 800; line-height: 1; letter-spacing: -0.02em;
  overflow: hidden; text-overflow: ellipsis; }
.an-kpi-accent .an-kpi-value { background: var(--gradient-text); -webkit-background-clip: text;
  background-clip: text; -webkit-text-fill-color: transparent; }
.an-kpi-suffix { font-size: 0.5em; font-weight: 600; color: var(--color-muted); margin-left: 2px; -webkit-text-fill-color: var(--color-muted); }
.an-kpi-delta { font-size: 0.78rem; font-weight: 600; }
.an-kpi-vsprev { color: var(--color-faint); font-weight: 400; }
.an-delta-up { color: var(--color-good); }
.an-delta-down { color: var(--color-bad); }
.an-delta-flat { color: var(--color-muted); }

/* ── Cards, charts ────────────────────────────────────────────────── */
.an-card, .an-line, .an-donut { background: var(--card-bg); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-5); }
.an-card-title { font-size: 0.8rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-muted); margin-bottom: var(--space-4); }
.an-grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: var(--space-4); }

.an-line-svg { width: 100%; height: 200px; display: block; }
.an-line-axis { display: flex; justify-content: space-between; margin-top: var(--space-2);
  color: var(--color-faint); font-size: 0.68rem; }

/* ── Donut ────────────────────────────────────────────────────────── */
.an-donut-body { display: flex; align-items: center; gap: var(--space-5); flex-wrap: wrap; }
.an-donut-svg { width: 140px; height: 140px; flex: none; }
.an-donut-total { font-size: 20px; font-weight: 800; fill: var(--color-text); }
.an-donut-unit { font-size: 10px; fill: var(--color-muted); text-transform: uppercase; letter-spacing: 0.05em; }
.an-legend { list-style: none; margin: 0; padding: 0; flex: 1; min-width: 160px; display: flex;
  flex-direction: column; gap: var(--space-2); }
.an-legend li { display: flex; align-items: center; gap: var(--space-2); font-size: 0.85rem; }
.an-dot { width: 10px; height: 10px; border-radius: 3px; flex: none; }
.an-legend-label { flex: 1; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-legend-val { font-weight: 600; }
.an-legend-pct { color: var(--color-faint); font-weight: 400; margin-left: 4px; }

/* AI-source badge — marks ChatGPT/Gemini/Perplexity… rows wherever they appear
   (acquisition donut legend, traffic-source drill). */
.an-ai-tag { display: inline-block; margin-left: 6px; padding: 1px 6px; border-radius: 999px;
  font-size: 0.66rem; font-weight: 700; letter-spacing: 0.04em; color: #fff;
  background: linear-gradient(90deg, #b06cff, #2f6bff); vertical-align: middle; }

/* ── Featured card: AI assistant traffic ───────────────────────────── */
.an-ai { margin-bottom: var(--space-4); }
.an-ai-featured { background: var(--gradient-brand-soft); border-left: 3px solid var(--color-accent); }
.an-ai-head { display: flex; flex-wrap: wrap; align-items: center; justify-content: space-between;
  gap: var(--space-5); margin-bottom: var(--space-4); }
.an-ai-big { display: flex; align-items: baseline; flex-wrap: wrap; gap: 8px; }
.an-ai-num { font-size: clamp(2.2rem, 4vw, 3rem); font-weight: 800; line-height: 1; letter-spacing: -0.02em;
  background: var(--gradient-text); -webkit-background-clip: text; background-clip: text;
  -webkit-text-fill-color: transparent; }
.an-ai-unit { color: var(--color-muted); font-size: 0.85rem; font-weight: 600; }
.an-ai-delta { font-size: 0.85rem; font-weight: 700; margin-left: var(--space-2); }
.an-ai-meta { list-style: none; margin: 0; padding: 0; display: flex; flex-wrap: wrap; gap: var(--space-5); }
.an-ai-meta li { display: flex; flex-direction: column; gap: 2px; }
.an-ai-k { color: var(--color-faint); font-size: 0.66rem; text-transform: uppercase; letter-spacing: 0.05em;
  font-weight: 600; }
.an-ai-v { font-weight: 700; font-size: 1.05rem; font-variant-numeric: tabular-nums; }
.an-ai-bar { display: inline-block; width: 54px; height: 6px; border-radius: 999px; margin-right: var(--space-2);
  background: var(--input-bg, rgba(128, 128, 128, 0.14)); overflow: hidden; vertical-align: middle; }
.an-ai-bar > span { display: block; height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, #b06cff, #2f6bff); }
.an-ai-note { margin-top: var(--space-3); font-size: 0.76rem; color: var(--color-faint); }
.an-kpi-ai { border-left: 3px solid transparent;
  border-image: linear-gradient(180deg, #b06cff, #2f6bff) 1; }
.an-kpi-ai .an-tile-src { color: #fff; background: linear-gradient(90deg, #b06cff, #2f6bff); font-weight: 700; }
.an-kpi-note { font-size: 0.72rem; color: var(--color-muted); margin-top: 2px; font-weight: 600; }
@media (max-width: 640px) { .an-ai-bar { display: none; } }

/* ── KPI strip: uniform big stat cards, each with a sparkline ───────── */
.an-kpi-strip { display: grid; grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: var(--space-4); margin-bottom: var(--space-4); }
.an-kpi-big { display: flex; flex-direction: column; overflow: hidden; }
.an-kpi-lead { border-left: 3px solid var(--color-accent); }
.an-tile-label { font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--color-muted); font-weight: 600; display: flex; align-items: center;
  justify-content: space-between; gap: 6px; }
.an-tile-src { font-size: 0.58rem; color: var(--color-faint); background: var(--color-surface-2);
  padding: 1px 6px; border-radius: 999px; text-transform: none; letter-spacing: 0; }
.an-big-value { font-size: clamp(2rem, 3vw, 2.6rem); font-weight: 800; line-height: 1.05;
  letter-spacing: -0.02em; color: var(--color-text); margin-top: 4px; }
.an-big-delta { font-size: 0.8rem; font-weight: 700; margin-top: 4px; }
.an-hero-vs { color: var(--color-faint); font-weight: 500; }
.an-big-spark { width: 100%; height: 34px; margin-top: var(--space-3); display: block; }
@media (max-width: 720px) { .an-kpi-strip { grid-template-columns: repeat(auto-fit, minmax(150px, 1fr)); } }

/* ── Engagement summary — bold iconed lead panel (first-view money metric) ── */
.an-eng { background: var(--gradient-brand-soft); border: 1px solid var(--color-border);
  border-radius: var(--radius-lg); padding: var(--space-5); margin-bottom: var(--space-4); }
.an-eng-head { display: flex; justify-content: space-between; align-items: flex-start;
  gap: var(--space-3); margin-bottom: var(--space-4); }
.an-eng-title { font-size: 1.15rem; font-weight: 800; margin: 0; letter-spacing: -0.01em; }
.an-eng-sub { font-size: 0.8rem; color: var(--color-muted); margin: 2px 0 0; }
.an-eng-flag { font-size: 0.66rem; color: var(--color-faint); white-space: nowrap; }
.an-eng-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-4); }
.an-eng-tile { background: var(--card-bg); border-radius: var(--radius-md); padding: var(--space-4);
  display: flex; flex-direction: column; gap: 2px; box-shadow: var(--shadow-sm); position: relative;
  overflow: hidden; }
.an-eng-tile::after { content: ''; position: absolute; inset: 0 0 auto 0; height: 3px;
  background: var(--color-accent); opacity: 0.9; }
.an-eng-ico { width: 40px; height: 40px; border-radius: 11px; display: flex; align-items: center;
  justify-content: center; background: var(--gradient-brand); color: #fff; margin-bottom: 8px; }
.an-eng-ico svg { width: 20px; height: 20px; }
.an-eng-num { font-size: 2rem; font-weight: 800; line-height: 1; letter-spacing: -0.02em; }
.an-eng-lbl { font-size: 0.82rem; color: var(--color-muted); font-weight: 600; }
.an-eng-delta { font-size: 0.74rem; font-weight: 700; min-height: 1em; margin-top: 2px; }
/* lead types get a matching accent bar */
.an-eng-phone::after { background: #16a34a; }
.an-eng-form::after  { background: #2f6bff; }
.an-eng-click::after { background: #b06cff; }
.an-eng-mini { display: flex; flex-wrap: wrap; gap: var(--space-5); margin-top: var(--space-4);
  padding-top: var(--space-4); border-top: 1px solid var(--color-border-soft); }
.an-eng-mini-item { display: flex; flex-direction: column; }
.an-eng-mini-val { font-size: 1.1rem; font-weight: 800; }
.an-eng-mini-lbl { font-size: 0.72rem; color: var(--color-muted); }

/* User-acquisition donut: device-breakdown layout, enlarged, blue left accent,
   stretched to match the All-events card beside it in the 50/50 row. */
.an-acq { border-left: 3px solid var(--color-accent); display: flex; flex-direction: column; }
.an-split-2 .an-acq { height: 100%; }
.an-acq .an-donut-body { flex: 1; flex-direction: column; align-items: stretch;
  justify-content: center; gap: var(--space-5); }
.an-acq .an-donut-svg { align-self: center; width: 180px; height: 180px; }
.an-acq .an-legend { min-width: 0; font-size: 0.9rem; }

/* ── Keyword / page tables ────────────────────────────────────────── */
.an-keywords { border-left: 3px solid var(--color-accent); }
.an-kw-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }
.an-kw-table th { text-align: left; font-size: 0.68rem; text-transform: uppercase; letter-spacing: 0.05em;
  color: var(--color-muted); padding: 0 var(--space-3) var(--space-2); font-weight: 600; }
.an-kw-table td { padding: var(--space-2) var(--space-3); border-top: 1px solid var(--color-border-soft); }
.an-kw-table .r { text-align: right; }
.an-rank { color: var(--color-faint); font-variant-numeric: tabular-nums; width: 2ch; }
.an-kw { font-weight: 500; max-width: 340px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-strong { font-weight: 700; }
.an-pos { display: inline-block; min-width: 34px; text-align: center; padding: 1px 6px; border-radius: 999px;
  font-weight: 600; font-size: 0.8rem; }
.an-pos.good { color: var(--color-good); background: rgba(62, 224, 142, 0.12); }
.an-pos.warn { color: var(--color-warn); background: rgba(247, 185, 85, 0.12); }
.an-pos.bad { color: var(--color-bad); background: rgba(255, 107, 107, 0.12); }

/* ── States ───────────────────────────────────────────────────────── */
.an-unavailable, .an-empty { background: var(--color-surface-2); border: 1px dashed var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-4) var(--space-5); color: var(--color-muted); font-size: 0.9rem; }

@media (max-width: 820px) {
  .an-kpi-row { grid-template-columns: repeat(2, 1fr); }
  .an-grid-2 { grid-template-columns: 1fr; }
}

/* ── Analytics v2: grouped stat cards, comparison line, ranked bars ── */
.an-statgroup { display: flex; gap: var(--space-4); background: var(--card-bg);
  border: 1px solid var(--color-border); border-radius: var(--radius-lg); padding: var(--space-5); align-items: stretch; }
.an-statgroup-accent { background: var(--gradient-brand-soft); box-shadow: inset 0 0 0 1px rgba(47,107,255,0.28); }
.an-icon { flex: none; width: 56px; height: 56px; border-radius: var(--radius-md);
  display: grid; place-items: center; color: #fff; background: var(--gradient-brand); box-shadow: var(--glow-accent); }
.an-icon svg { width: 26px; height: 26px; }
.an-metrics { display: grid; grid-template-columns: repeat(4, 1fr); gap: var(--space-4); flex: 1; }
.an-metric { display: flex; flex-direction: column; gap: 3px; min-width: 0; }
.an-metric-label { font-size: 0.7rem; font-weight: 600; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); }
.an-metric-value { font-size: clamp(1.4rem, 2.6vw, 2rem); font-weight: 800; line-height: 1.05; letter-spacing: -0.02em;
  overflow: hidden; text-overflow: ellipsis; }
.an-metric-suffix { font-size: 0.55em; font-weight: 600; color: var(--color-muted); margin-left: 2px; }
.an-metric-delta { font-size: 0.74rem; font-weight: 700; }

.an-line-head { display: flex; justify-content: space-between; align-items: center; margin-bottom: var(--space-3); }
.an-legend-inline { display: flex; gap: var(--space-4); font-size: 0.72rem; color: var(--color-muted); }
.an-legend-inline span { display: inline-flex; align-items: center; gap: 5px; }
.an-legend-inline i { width: 14px; height: 3px; border-radius: 2px; display: inline-block; }
.an-prev-swatch { background: var(--color-border) !important; }
.an-line-svg { width: 100%; height: 210px; display: block; }
.an-grid { stroke: var(--color-border-soft); stroke-width: 1; }
.an-axis-y { fill: var(--color-faint); font-size: 9px; }
.an-prev-line { stroke: var(--color-muted); opacity: 0.5; stroke-dasharray: 4 4; }

.an-bars .an-bar-list { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: var(--space-3); }
.an-bar-list li { display: grid; grid-template-columns: 90px 1fr auto; align-items: center; gap: var(--space-3); font-size: 0.85rem; }
.an-bar-label { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-bar-track { height: 8px; border-radius: 999px; background: var(--track); overflow: hidden; }
.an-bar-fill { display: block; height: 100%; border-radius: 999px; background: var(--gradient-brand); }
.an-bar-val { font-weight: 700; font-variant-numeric: tabular-nums; }

@media (max-width: 820px) {
  .an-statgroup { flex-direction: column; }
  .an-metrics { grid-template-columns: repeat(2, 1fr); }
}

/* ── Analytics v3: unified layout (KPIs -> graph -> 3-box grid) ────── */
.an-kpi-cards { display: grid; grid-template-columns: repeat(auto-fit, minmax(320px, 1fr)); gap: var(--space-4); }
.an-grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: var(--space-4); align-items: stretch; }
.an-grid-3 > * { margin: 0; }
.an-grid-3 .an-donut, .an-grid-3 .an-card { height: 100%; }
/* stack the donut vertically inside a narrow grid cell */
.an-grid-3 .an-donut-body { flex-direction: column; align-items: stretch; gap: var(--space-4); }
.an-grid-3 .an-donut-svg { align-self: center; }
.an-grid-3 .an-legend { min-width: 0; }

.an-compact td { padding: 6px var(--space-2); }
.an-compact .an-kw { max-width: 150px; }
.an-grid-table .an-kw-table { font-size: 0.82rem; }

@media (max-width: 1000px) { .an-grid-3 { grid-template-columns: 1fr; } }

/* ── Line chart hover tooltip ─────────────────────────────────────── */
.an-line-plot { position: relative; }
.an-guide { position: absolute; top: 16px; bottom: 24px; width: 1px; background: var(--color-border);
  pointer-events: none; z-index: 1; }
.an-tip { position: absolute; z-index: 2; pointer-events: none; background: var(--color-surface);
  border: 1px solid var(--color-border); border-radius: var(--radius-md); box-shadow: var(--shadow-md);
  padding: 6px 10px; font-size: 0.78rem; min-width: 96px; display: flex; flex-direction: column; gap: 1px; }
.an-tip-lbl { color: var(--color-muted); font-size: 0.68rem; }
.an-tip-val { font-weight: 800; font-size: 1rem; }
.an-tip-prev { color: var(--color-faint); font-size: 0.68rem; }
.an-line-svg { cursor: crosshair; }

/* ── Line chart geometry fix: uniform scale (round dots), full-height guide ── */
.an-line-svg { width: 100%; height: auto; display: block; cursor: crosshair; }
.an-guide { top: 0; bottom: 0; }

/* ── Chart metric tabs + range picker ─────────────────────────────── */
.an-chart-tabs { display: inline-flex; gap: 4px; background: var(--color-surface-2);
  border: 1px solid var(--color-border); border-radius: 999px; padding: 3px; }
.an-chart-tab { border: none; background: transparent; color: var(--color-muted); cursor: pointer;
  font: inherit; font-size: 0.76rem; font-weight: 600; padding: 4px 12px; border-radius: 999px; }
.an-chart-tab:hover { color: var(--color-text); }
.an-chart-tab.active { background: var(--gradient-brand); color: #fff; box-shadow: var(--shadow-sm); }
.an-chart-legend { margin-top: var(--space-2); padding-left: 42px; }
.an-cur-swatch { background: var(--color-accent); }

/* ── Multi-line chart (Pages & Screens): all series + toggle legend ── */
.an-ml-body { display: flex; gap: var(--space-4); align-items: stretch; }
.an-ml-plot { position: relative; flex: 1 1 auto; min-width: 0; }
.an-ml-svg { width: 100%; height: auto; display: block; }
.an-ml-axis { display: flex; justify-content: space-between; margin-top: var(--space-2);
  color: var(--color-faint); font-size: 0.68rem; padding-left: 42px; }
.an-ml-legend { flex: 0 0 180px; margin: 0; padding: 0; list-style: none;
  max-height: 230px; overflow-y: auto; display: flex; flex-direction: column; gap: 2px; }
.an-ml-legend li { display: flex; align-items: center; gap: 8px; padding: 4px 6px;
  cursor: pointer; border-radius: var(--radius-sm); font-size: 0.75rem;
  color: var(--color-text); white-space: nowrap; overflow: hidden; user-select: none; }
.an-ml-legend li:hover { background: var(--color-surface-2); }
.an-ml-legend li.off { opacity: 0.4; }
.an-ml-dot { flex: 0 0 auto; width: 10px; height: 10px; border-radius: 3px; }
.an-ml-name { overflow: hidden; text-overflow: ellipsis; }
@media (max-width: 640px) {
  .an-ml-body { flex-direction: column; }
  .an-ml-legend { flex-basis: auto; max-height: none; flex-flow: row wrap; }
}

.an-range-pick { display: inline-flex; gap: 4px; background: var(--color-surface-2);
  border: 1px solid var(--color-border); border-radius: 999px; padding: 3px; }
.an-range-btn { font-size: 0.76rem; font-weight: 600; color: var(--color-muted); padding: 4px 12px;
  border-radius: 999px; text-decoration: none; }
.an-range-btn:hover { color: var(--color-text); }
.an-range-btn.active { background: var(--gradient-brand); color: #fff; }

/* ── Keywords-by-page featured panel ──────────────────────────────── */
.an-kwpage-grid { display: grid; grid-template-columns: repeat(2, 1fr); gap: var(--space-4); }
.an-kwpage { background: var(--color-surface-2); border: 1px solid var(--color-border);
  border-radius: var(--radius-md); padding: var(--space-4); border-left: 3px solid var(--color-accent); }
.an-kwpage-head { display: flex; justify-content: space-between; align-items: baseline; gap: var(--space-3);
  margin-bottom: var(--space-3); padding-bottom: var(--space-2); border-bottom: 1px solid var(--color-border-soft); }
.an-kwpage-path { font-weight: 700; font-size: 0.9rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-kwpage-clicks { font-weight: 800; white-space: nowrap; }
.an-kwpage-clicks small { color: var(--color-muted); font-weight: 500; font-size: 0.72rem; }
.an-kwpage-kws { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 6px; }
.an-kwpage-kws li { display: grid; grid-template-columns: 1fr auto auto; align-items: center; gap: var(--space-3); font-size: 0.84rem; }
.an-kwpage-q { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.an-kwpage-kc { font-weight: 700; font-variant-numeric: tabular-nums; min-width: 3ch; text-align: right; }
@media (max-width: 820px) { .an-kwpage-grid { grid-template-columns: 1fr; } }

/* ── Dashboard analytics preview (66|33) ──────────────────────────── */
.an-preview { margin-top: var(--space-6); gap: var(--space-4); }
.an-grid-66-33 { display: grid; grid-template-columns: 2fr 1fr; gap: var(--space-4); align-items: stretch; }
.an-grid-66-33 > * { margin: 0; }
.an-grid-66-33 .an-chart, .an-grid-66-33 .an-grid-table { height: 100%; }
@media (max-width: 900px) { .an-grid-66-33 { grid-template-columns: 1fr; } }

/* Grid adapts to however many boxes render (some hide when a source is absent). */
.an-grid-3 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }

/* ── Clients page: full-width body, top-action popovers, info hub ──── */
.clients-body { width: 100%; }
.top-actions { display: inline-flex; gap: var(--space-2); align-items: center; }
.icon-btn { display: inline-flex; align-items: center; gap: 6px; }
.icon-btn svg { width: 15px; height: 15px; }

/* Packages hover popover */
.pkg-pop { position: relative; }
.pop-card { position: absolute; top: calc(100% + 6px); right: 0; z-index: 40; min-width: 240px;
  background: var(--color-surface); border: 1px solid var(--color-border); border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg); padding: var(--space-2); opacity: 0; visibility: hidden;
  transform: translateY(-6px); transition: opacity .16s ease, transform .16s ease, visibility .16s; }
.pkg-pop:hover .pop-card, .pkg-pop:focus-within .pop-card { opacity: 1; visibility: visible; transform: translateY(0); }
.pop-title { display: flex; justify-content: space-between; align-items: center; font-size: 0.72rem;
  font-weight: 700; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted); padding: 6px 10px; }
.pop-clear { font-weight: 500; text-transform: none; letter-spacing: 0; }
.pop-row { display: flex; justify-content: space-between; gap: var(--space-4); padding: 8px 10px;
  border-radius: var(--radius-md); color: var(--color-text); }
.pop-row:hover { background: var(--hover-row); text-decoration: none; }
.pop-row.active { background: var(--gradient-brand-soft); }
.pop-count { color: var(--color-faint); font-weight: 700; font-variant-numeric: tabular-nums; }

/* Info hub button + badge */
.info-hub-btn { position: relative; }
.info-badge { position: absolute; top: -7px; right: -7px; min-width: 18px; height: 18px; padding: 0 5px;
  border-radius: 999px; background: var(--color-bad); color: #fff; font-size: 0.68rem; font-weight: 800;
  display: grid; place-items: center; box-shadow: 0 0 0 2px var(--color-bg); }

/* Info hub slide-in panel */
.infohub-backdrop { position: fixed; inset: 0; background: rgba(0,0,0,0.45); z-index: 90;
  opacity: 0; visibility: hidden; transition: opacity .2s ease, visibility .2s; }
.infohub-backdrop.open { opacity: 1; visibility: visible; }
.infohub-panel { position: fixed; top: 0; right: 0; height: 100vh; width: 380px; max-width: 92vw; z-index: 91;
  background: var(--color-surface); border-left: 1px solid var(--color-border); box-shadow: var(--shadow-lg);
  display: flex; flex-direction: column; transform: translateX(100%); transition: transform .24s ease; }
.infohub-panel.open { transform: translateX(0); }
.infohub-head { display: flex; justify-content: space-between; align-items: center; padding: var(--space-4) var(--space-5);
  border-bottom: 1px solid var(--color-border); }
.infohub-head h2 { margin: 0; font-size: 1.1rem; }
.infohub-body { padding: var(--space-4) var(--space-5); overflow-y: auto; display: flex; flex-direction: column; gap: var(--space-6); }
.infohub-section h3 { font-size: 0.72rem; text-transform: uppercase; letter-spacing: 0.05em; color: var(--color-muted);
  margin: 0 0 var(--space-3); display: flex; align-items: center; gap: 8px; }
.infohub-n { background: var(--color-surface-2); border: 1px solid var(--color-border); border-radius: 999px;
  padding: 0 8px; font-size: 0.7rem; font-weight: 700; }
.infohub-item { display: flex; align-items: center; gap: var(--space-2); padding: 9px 10px; border-radius: var(--radius-md);
  color: var(--color-text); border-top: 1px solid var(--color-border-soft); }
.infohub-item:first-child { border-top: none; }
.infohub-item:hover { background: var(--hover-row); text-decoration: none; }

/* Info hub: unread notification emphasis */
.infohub-item.unread { border-left: 3px solid var(--color-accent); background: var(--gradient-brand-soft); }
.infohub-item .it-title { font-weight: 600; }

/* Client portal: custom brand logo */
.brand-logo { max-height: 40px; max-width: 100%; display: block; margin-bottom: 4px; }

/* Breakdown matrix: badge counts as links */
.breakdown-table td .badge { text-decoration: none; }
.breakdown-table th, .breakdown-table td { white-space: nowrap; }

/* Practice switcher (sidebar) — only rendered for multi-practice logins */
.practice-switch { padding: 0 var(--space-4) var(--space-3); display: flex; flex-direction: column; gap: 4px; }
.practice-switch select { width: 100%; }

/* Practice chooser (guest shell) */
.practice-list { display: flex; flex-direction: column; gap: var(--space-2); }
.practice-option { display: flex; align-items: center; gap: var(--space-3); width: 100%; text-align: left;
  padding: var(--space-3) var(--space-4); border: 1px solid var(--color-border); border-radius: var(--radius-md);
  background: var(--color-surface); color: var(--color-text); cursor: pointer; }
.practice-option:hover { background: var(--hover-row); border-color: var(--color-accent); }
.practice-option.is-active { border-color: var(--color-accent); background: var(--gradient-brand-soft); }
.practice-meta { display: flex; flex-direction: column; }
.practice-logo { max-height: 28px; max-width: 80px; }

/* Archived clients: the permanent-delete confirmation popover. Reuses
   .cols-menu for positioning but needs a wider, text-friendly panel. */
.danger-pop { position: absolute; right: 0; top: calc(100% + 6px); z-index: 20; width: 320px;
  padding: var(--space-3); text-align: left; white-space: normal;
  background: var(--color-surface); border: 1px solid var(--color-bad);
  border-radius: var(--radius-md); box-shadow: var(--shadow-md); }
.danger-pop p { margin: 0 0 var(--space-2); font-size: 13px; }
.danger-pop label { display: block; margin-bottom: 6px; font-size: 12px; color: var(--color-muted); }
.danger-pop .input { width: 100%; margin-bottom: var(--space-2); }
