/* ─────────────────────────────────────────────────────────────
   Capraseo — keywords page (3-zone redesign)
   Page-only primitives on top of main + account + health + links.

   Colour discipline: green = positive / owned, red = at-risk /
   negative, gold = warn / value, gray = neutral. The per-category
   left strip (.cat-*) is the only decorative colour and is kept
   low-saturation. Intent pills keep their own muted palette.
   ───────────────────────────────────────────────────────────── */

/* ── Intent pills — classification, not action (muted) ────── */
.intent-pill {
  display: inline-flex;
  align-items: center;
  height: 18px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  flex-shrink: 0;
}
.intent-pill.intent-info          { color: var(--lt23); background: rgba(140,170,210,0.10); }
.intent-pill.intent-commercial    { color: #d8c79a; background: rgba(230,196,122,0.08); }
.intent-pill.intent-transactional { color: var(--lt24); background: rgba(99, 102, 241,0.08); }
.intent-pill.intent-navigational  { color: var(--lt25); background: rgba(var(--wash-rgb), 0.04); }

/* ── Rank + delta (shared by Zone 2 cards & Zone 3 table) ── */
.pos-rank {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-1);
  font-variant-numeric: tabular-nums;
}
.pos-rank.unranked { color: var(--muted-2); font-weight: 400; }
.pos-rank.pos-good { color: var(--cyan-2); }   /* 1–3  */
.pos-rank.pos-mid  { color: var(--gold-5); }   /* 4–10 */
.pos-rank.pos-low  { color: var(--text-1); }   /* 11+  */
.pos-delta {
  display: inline-flex;
  align-items: center;
  gap: 2px;
  font-size: 11px;
  font-weight: 500;
  font-variant-numeric: tabular-nums;
}
.pos-delta.up   { color: var(--cyan-2); }
.pos-delta.down { color: var(--red-1); }
.pos-delta.flat { color: var(--muted-2); }
.pos-delta.tag {
  height: 16px;
  padding: 0 6px;
  border-radius: 999px;
  font-size: 9.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}
.pos-delta.tag.new  { color: var(--cyan-2); background: rgba(99, 102, 241,0.10); border: 1px solid rgba(99, 102, 241,0.22); }
.pos-delta.tag.lost { color: var(--red-1); background: rgba(255,122,122,0.08); border: 1px solid rgba(255,122,122,0.22); }

/* ════════════════════════════════════════════════════════════
   ZONE 1 — Status
   ════════════════════════════════════════════════════════════ */
.zone-status { padding-bottom: 14px; }
.kw-headline {
  margin: 16px 2px 2px;
  font-size: 13.5px;
  line-height: 1.55;
  color: var(--muted);
  letter-spacing: -0.003em;
}
.kw-headline strong { color: var(--text); font-weight: 600; }
.kw-headline-lever {
  color: var(--cyan-2);
  font-weight: 500;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
}

/* ════════════════════════════════════════════════════════════
   ZONE 2 — Actions
   ════════════════════════════════════════════════════════════ */
#act-tabs { flex-wrap: wrap; }
.tab-n {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 15px;
  margin-left: 5px;
  padding: 0 5px;
  border-radius: 999px;
  background: rgba(var(--wash-rgb), 0.06);
  font-size: 10px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  color: inherit;
}
#act-tabs button.active .tab-n { background: rgba(var(--well-rgb), var(--well-a24)); }

/* On a phone the six action-category tabs wrap to several rows. As a single
   segmented pill the wrapped rows jam together with no spacing ("no margins").
   Break the pill into spaced individual chips so every row has clear gaps.
   Scoped to #act-tabs so the timeframe/status toggle-pills stay segmented. */
@media (max-width: 768px) {
  #act-tabs {
    background: none;
    border: 0;
    padding: 0;
    gap: 7px;
  }
  #act-tabs button {
    border: 1px solid var(--line);
    background: rgba(var(--wash-rgb), 0.03);
    padding: 7px 11px;
  }
  #act-tabs button.active {
    border-color: rgba(99, 102, 241,0.5);
  }
}

.act-list { display: flex; flex-direction: column; }
.act-card {
  display: flex;
  align-items: flex-start;
  gap: 16px;
  padding: 16px 20px 16px 18px;
  border-left: 2px solid transparent;
  border-bottom: 1px solid var(--line);
}
.act-card:last-child { border-bottom: 0; }
.cat-winnable { border-left-color: rgba(99, 102, 241,0.55); }
.cat-defend   { border-left-color: rgba(230,196,122,0.55); }
.cat-snippet  { border-left-color: rgba(45,200,170,0.55); }
.cat-aio      { border-left-color: rgba(150,140,220,0.55); }
.cat-new      { border-left-color: rgba(120,160,210,0.55); }

/* Rank anchor box — the only far-left element */
.act-rank {
  flex-shrink: 0;
  width: 52px;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 3px;
  padding-top: 1px;
}
.act-rank-n { font-size: 14px; font-weight: 600; color: var(--text-1); font-variant-numeric: tabular-nums; }
.act-rank-delta { font-size: 11px; }
.act-rank-delta.up   { color: var(--cyan-2); }
.act-rank-delta.down { color: var(--red-1); }
.act-rank-delta.flat { color: var(--muted-2); }
.act-rank-state {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--lt26);
}

/* Body — everything indents from the keyword, not the rank box */
.act-body { flex: 1; min-width: 0; }
.act-hdr {
  display: flex;
  align-items: center;
  gap: 9px;
  flex-wrap: wrap;
}
.act-kw {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-hi);
  letter-spacing: -0.01em;
}
.act-tag {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 7px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 500;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--muted);
  background: rgba(var(--wash-rgb), 0.04);
  border: 1px solid rgba(var(--wash-rgb), 0.07);
}
.act-impact {
  margin-left: auto;
  font-size: 14px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
  white-space: nowrap;
  padding-left: 12px;
}
.act-impact.gain { color: var(--cyan-4); }
.act-impact.risk { color: var(--red-1); }
.act-meta {
  margin-top: 5px;
  font-size: 11.5px;
  color: var(--muted-2);
  font-variant-numeric: tabular-nums;
  letter-spacing: 0.01em;
}
.act-page {
  display: inline-block;
  max-width: 100%;
  margin-top: 4px;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 11px;
  color: #93b4d6;
  text-decoration: none;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  vertical-align: bottom;
}
.act-page:hover { text-decoration: underline; }
.act-page.none { color: var(--muted-2); font-style: italic; font-family: inherit; }
.act-why {
  margin-top: 8px;
  font-size: 12.5px;
  line-height: 1.5;
  color: var(--muted);
  max-width: 78ch;
}
.act-resolved {
  margin-top: 8px;
  font-size: 12px;
  font-weight: 500;
  color: var(--cyan-2);
}
.act-conf {
  display: inline-flex;
  align-items: center;
  height: 17px;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
}
.act-conf-high { color: var(--cyan-4); background: rgba(99, 102, 241,0.10); border: 1px solid rgba(99, 102, 241,0.30); }
.act-conf-low  { color: var(--gold-5); background: rgba(230,196,122,0.09); border: 1px solid rgba(230,196,122,0.28); }
.act-hedge {
  margin-top: 8px;
  padding: 8px 11px;
  font-size: 12px;
  line-height: 1.5;
  color: #d8cba6;
  background: rgba(230,196,122,0.06);
  border-left: 2px solid rgba(230,196,122,0.45);
  border-radius: 0 6px 6px 0;
  max-width: 78ch;
}
.act-hedge-tag {
  display: inline-block;
  margin-right: 8px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--gold-5);
}

/* Action buttons — informational-but-clickable, never 3, no flood */
.act-actions {
  display: flex;
  gap: 10px;
  margin-top: 12px;
  flex-wrap: wrap;
}
.act-btn {
  flex: 1 1 0;
  min-width: 220px;
  max-width: 360px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 10px 12px;
  text-align: left;
  background: rgba(var(--wash-rgb), 0.022);
  border: 1px solid rgba(var(--wash-rgb), 0.07);
  border-radius: 10px;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.act-btn:hover { border-color: rgba(var(--wash-rgb), 0.16); background: rgba(var(--wash-rgb), 0.04); }
.act-btn:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.act-btn-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--muted);
  background: rgba(var(--wash-rgb), 0.04);
}
.cat-winnable .act-btn-icon { color: var(--cyan-4); background: rgba(99, 102, 241,0.08); }
.cat-defend   .act-btn-icon { color: var(--gold-5); background: rgba(230,196,122,0.08); }
.cat-snippet  .act-btn-icon { color: #8fd8c6; background: rgba(45,200,170,0.08); }
.cat-aio      .act-btn-icon { color: var(--lt26); background: rgba(150,140,220,0.08); }
.cat-new      .act-btn-icon { color: #a6c8ec; background: rgba(120,160,210,0.08); }
.act-btn-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.act-btn-label {
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.act-btn-title { font-size: 12.5px; font-weight: 600; color: var(--text-1); }
.act-btn-sub { font-size: 11px; line-height: 1.4; color: var(--muted); }

/* Lead-in beside the action buttons: spells out that clicking opens a
   data-grounded chat, then offers a green one-click "Start task" CTA
   attached to the same card. */
.act-ai-hint {
  flex: 1 1 220px;
  min-width: 200px;
  max-width: 340px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  padding: 11px 12px;
  border-radius: 10px;
  background: rgba(99, 102, 241,0.05);
  border: 1px solid rgba(99, 102, 241,0.18);
}
.act-ai-hint-head {
  display: flex;
  align-items: flex-start;
  gap: 9px;
}
.act-ai-hint-icon {
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 26px;
  border-radius: 7px;
  color: var(--cyan-4);
  background: rgba(99, 102, 241,0.1);
}
.act-ai-hint-txt { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.act-ai-hint-txt b {
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--accent);
}
.act-ai-hint-txt span { font-size: 11px; line-height: 1.45; color: var(--muted); }
/* Green CTA attached to the AI-hint card. */
.act-start-task {
  margin-top: auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  padding: 9px 12px;
  border: 0;
  border-radius: 8px;
  background: var(--accent);
  color: var(--cyan-bg);
  font-size: 12.5px;
  font-weight: 700;
  cursor: pointer;
  transition: background 140ms ease, transform 140ms ease;
}
.act-start-task:hover { background: var(--positive); }
.act-start-task:active { transform: translateY(1px); }
.act-start-task:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.act-start-task svg { flex-shrink: 0; }

.act-foot {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 12px;
  margin-top: 11px;
}
.act-campaign {
  display: inline-flex;
  align-items: center;
  height: 19px;
  padding: 0 9px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 500;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--lt26);
  background: rgba(150,140,220,0.10);
  border: 1px solid rgba(150,140,220,0.26);
}
.act-empty {
  padding: 30px 24px;
  text-align: center;
  font-size: 13px;
  color: var(--muted);
}
.act-more-wrap { display: flex; justify-content: center; padding: 14px 20px 18px; }

/* ════════════════════════════════════════════════════════════
   ZONE 3 — All keywords
   ════════════════════════════════════════════════════════════ */
.kw-search {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  height: 34px;
  padding: 0 14px;
  border-radius: 999px;
  background: rgba(var(--wash-rgb), 0.03);
  border: 1px solid rgba(var(--wash-rgb), 0.07);
  min-width: 260px;
  transition: border-color 160ms ease;
}
.kw-search:focus-within { border-color: rgba(var(--wash-rgb), 0.20); }
.kw-search svg { color: var(--muted-2); flex-shrink: 0; }
.kw-search input {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text);
  font: inherit;
  font-size: 13px;
  width: 100%;
  outline: none;
}
.kw-search input::placeholder { color: var(--muted-2); }
.kw-search input::-webkit-search-cancel-button { filter: invert(0.6); cursor: pointer; }

.kw-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
  padding: 14px 20px;
  border-bottom: 1px solid rgba(var(--wash-rgb), 0.04);
}
.kw-filters { display: flex; align-items: center; flex-wrap: wrap; gap: 8px; }
.kw-sel {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  height: 30px;
  padding: 0 6px 0 12px;
  border-radius: 999px;
  background: rgba(var(--wash-rgb), 0.03);
  border: 1px solid rgba(var(--wash-rgb), 0.06);
  transition: border-color 160ms ease, background 160ms ease;
}
.kw-sel > span {
  font-size: 10px;
  font-weight: 500;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  color: var(--muted-2);
  white-space: nowrap;
}
.kw-sel select {
  appearance: none;
  -webkit-appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-1);
  font: inherit;
  font-size: 12px;
  height: 28px;
  padding: 0 20px 0 2px;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%238a8a92' stroke-width='2.6' stroke-linecap='round' stroke-linejoin='round'><path d='M6 9l6 6 6-6'/></svg>");
  background-repeat: no-repeat;
  background-position: right 2px center;
}
.kw-sel select option { background: var(--ctl-2); color: var(--text-1); }
.kw-sel.is-active { border-color: rgba(99, 102, 241,0.40); background: rgba(99, 102, 241,0.08); }
.kw-sel.is-active > span { color: var(--lt24); }
.kw-toolbar-right { margin-left: auto; display: inline-flex; align-items: center; gap: 14px; }
.kw-reset {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: inherit;
  font-size: 11.5px;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
  white-space: nowrap;
}
.kw-reset:hover { color: var(--text); }
.kw-reset[hidden] { display: none; }

/* Sortable headers */
.tbl-kw thead th.th-sort {
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: color 140ms ease;
}
.tbl-kw thead th.th-sort:hover { color: var(--text); }
.th-sort.is-sorted { color: var(--text); }
.sort-caret {
  display: inline-block;
  width: 0; height: 0;
  margin-left: 6px;
  vertical-align: middle;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  opacity: 0;
  transition: opacity 140ms ease;
}
.th-sort.is-sorted .sort-caret { opacity: 0.9; }
.th-sort.is-sorted.dir-asc  .sort-caret { border-bottom: 5px solid currentColor; }
.th-sort.is-sorted.dir-desc .sort-caret { border-top: 5px solid currentColor; }

/* Cells */
.kw-mono {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12.5px;
  color: var(--text-1);
  letter-spacing: -0.01em;
}
.tbl-kw td.num, .tbl-kw th:nth-child(4), .tbl-kw th:nth-child(5), .tbl-kw th:nth-child(9) {
  text-align: right;
}
.tbl-kw td.num {
  font-variant-numeric: tabular-nums;
  color: var(--text-2);
}
.tbl-kw td:nth-child(9).num { color: var(--muted); }
.kw-spark { display: block; }
.kw-spark.none { color: var(--muted-2); }
.serp-badges { display: inline-flex; gap: 4px; flex-wrap: nowrap; }
.serp-badge {
  display: inline-flex;
  align-items: center;
  height: 16px;
  padding: 0 5px;
  border-radius: 4px;
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.03em;
  border: 1px solid;
  cursor: help;
}
.serp-badge.owned   { color: var(--cyan-4); background: rgba(99, 102, 241,0.12); border-color: rgba(99, 102, 241,0.32); }
.serp-badge.present { color: var(--muted); background: transparent; border-color: rgba(var(--wash-rgb), 0.14); }
.serp-badge-none { color: var(--muted-2); }

.kw-foot {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 14px 20px;
  border-top: 1px solid rgba(var(--wash-rgb), 0.04);
  font-size: 11.5px;
  color: var(--muted);
}
.kw-count { font-variant-numeric: tabular-nums; }
.kw-count strong { color: var(--text-1); font-weight: 600; }
.kw-sortind { color: var(--muted-2); }
.kw-foot .kw-more { margin-left: auto; }

.kw-more {
  appearance: none;
  height: 32px;
  padding: 0 16px;
  border-radius: 999px;
  background: rgba(var(--wash-rgb), 0.03);
  border: 1px solid rgba(var(--wash-rgb), 0.08);
  color: var(--text);
  font: inherit;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: border-color 160ms ease, background 160ms ease;
}
.kw-more:hover { border-color: rgba(var(--wash-rgb), 0.18); background: rgba(var(--wash-rgb), 0.05); }
.kw-more[hidden] { display: none; }
.kw-empty { text-align: center; color: var(--muted); padding: 28px 24px; }
.kw-empty-reset {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--accent);
  font: inherit;
  font-weight: 500;
  cursor: pointer;
  text-decoration: underline;
  text-underline-offset: 3px;
}

/* ── Preview-first stub (opens after a button click) ──────── */
.kw-preview-backdrop {
  position: fixed;
  inset: 0;
  z-index: 60;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(var(--scrim-rgb), 0.55);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  opacity: 0;
  transition: opacity 180ms ease;
}
.kw-preview-backdrop.open { opacity: 1; }
.kw-preview {
  width: 460px;
  max-width: 100%;
  padding: 22px 22px 18px;
  background:
    linear-gradient(180deg, rgba(var(--glass-hi-rgb),0.96), rgba(var(--glass-lo-rgb),0.97));
  border: 1px solid rgba(var(--wash-rgb), 0.08);
  border-radius: 14px;
  box-shadow: 0 24px 60px -20px rgba(0,0,0,0.7);
}
.kw-preview-head { display: flex; align-items: flex-start; justify-content: space-between; gap: 12px; }
.kw-preview-kind {
  font-size: 9.5px;
  font-weight: 600;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--muted-2);
}
.kw-preview-head h3 { margin: 4px 0 0; font-size: 16px; font-weight: 600; color: var(--text-hi); }
.kw-preview-kw { margin-top: 4px; }
.kw-preview-kw code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 12px;
  color: var(--muted);
}
.kw-preview-x {
  appearance: none;
  border: 0;
  background: rgba(var(--wash-rgb), 0.05);
  color: var(--muted);
  width: 26px;
  height: 26px;
  border-radius: 7px;
  cursor: pointer;
  flex-shrink: 0;
}
.kw-preview-x:hover { background: rgba(var(--wash-rgb), 0.09); color: var(--text); }
.kw-preview-lead { margin: 14px 0 12px; font-size: 12.5px; line-height: 1.5; color: var(--muted); }
.kw-preview-evidence {
  margin: 0 0 14px;
  padding: 10px 12px;
  font-size: 12px;
  line-height: 1.5;
  color: var(--lt27);
  background: rgba(120,160,210,0.07);
  border-left: 2px solid rgba(120,160,210,0.45);
  border-radius: 0 6px 6px 0;
}
.kw-preview-elabel {
  display: block;
  margin-bottom: 4px;
  font-size: 9px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: #a6c8ec;
}
.kw-preview-fields { list-style: none; margin: 0; padding: 0; display: flex; flex-direction: column; gap: 1px; }
.kw-preview-fields li {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 9px 12px;
  background: rgba(var(--wash-rgb), 0.025);
  font-size: 12px;
  color: var(--text-2);
}
.kw-preview-fields li:first-child { border-radius: 8px 8px 0 0; }
.kw-preview-fields li:last-child { border-radius: 0 0 8px 8px; }
.kw-preview-flabel { flex-shrink: 0; }
.kw-preview-field {
  flex: 1;
  min-width: 90px;
  max-width: 200px;
  height: 24px;
  border: 1px solid rgba(var(--wash-rgb), 0.14);
  border-radius: 6px;
  background: rgba(var(--wash-rgb), 0.03);
  cursor: text;
  transition: border-color 160ms ease;
}
.kw-preview-field::after {
  content: "";
  display: block;
  width: 1px;
  height: 13px;
  margin: 5px 0 0 9px;
  background: rgba(var(--wash-rgb), 0.32);
}
.kw-preview-field:hover,
.kw-preview-field:focus-visible {
  border-color: rgba(var(--wash-rgb), 0.30);
  outline: none;
}
.kw-preview-foot {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 14px;
  margin-top: 16px;
}
.kw-preview-note { font-size: 10.5px; color: var(--muted-2); line-height: 1.4; }
.kw-preview-gen {
  flex-shrink: 0;
  opacity: 0.5;
  cursor: not-allowed;
  pointer-events: none;
}

/* ── Responsive ───────────────────────────────────────────── */
@media (max-width: 900px) {
  /* align-items:flex-start from the base rule would size children to
     max-content in column direction and overflow the card — stretch. */
  .act-card { flex-direction: column; gap: 10px; align-items: stretch; }
  .act-rank { flex-direction: row; width: auto; gap: 10px; align-items: center; }
  .act-btn { min-width: 0; }
}
@media (max-width: 560px) {
  /* Action cards stack one per row — two-up crushes their copy. */
  .act-btn { flex: 1 1 100%; max-width: none; }
}
@media (max-width: 720px) {
  .kw-search { min-width: 0; width: 100%; }
  .kw-toolbar-right { margin-left: 0; width: 100%; }
  .kw-foot { flex-wrap: wrap; }
  .kw-foot .kw-more { margin-left: 0; }
  .act-impact { margin-left: 0; padding-left: 0; }
}
@media (prefers-reduced-motion: reduce) {
  .kw-sel, .kw-more, .sort-caret, .act-btn, .kw-search,
  .kw-preview-backdrop { transition: none; }
}

/* ── Keyword performance — results view ─────────────────────
   Replaces the old Status zone: hero sentence + 4 KPI cards +
   traffic chart + position breakdown + page-2 focus list. Uses
   existing site tokens (Inter, --accent/--danger, .card glass) so
   it reads with the rest of the keywords page. Numbers are tabular. */
.kw-results {
  padding: 20px 22px 22px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}
.kwr-kpi-value, .kwr-kpi-delta, .kwr-mv, .kwr-kw-vol b,
.kwr-bar-fill, .kwr-kw-rank { font-variant-numeric: tabular-nums; }

/* 1 · hero */
.kwr-hero {
  display: flex;
  gap: 14px;
  align-items: flex-start;
  padding: 16px 18px;
  border: 1px solid rgba(var(--wash-rgb), 0.06);
  border-radius: 12px;
  background: rgba(var(--wash-rgb), 0.025);
}
.kwr-hero-badge {
  flex: none;
  width: 34px; height: 34px;
  display: flex; align-items: center; justify-content: center;
  border-radius: 9px;
  font-size: 17px;
  background: rgba(99, 102, 241,0.12);
  color: var(--accent);
}
.kw-results.trend-down .kwr-hero-badge { background: rgba(255,122,122,0.12); color: var(--danger); }
.kwr-hero-text {
  margin: 0;
  font-size: 16px;
  line-height: 1.45;
  font-weight: 500;
  color: var(--text);
}
.kwr-up { color: var(--accent); font-weight: 600; }
.kwr-dn { color: var(--danger); font-weight: 600; }
.kwr-flat { color: var(--muted); font-weight: 600; }
.kwr-since { display: block; margin-top: 7px; font-size: 12.5px; font-weight: 400; color: var(--muted-2); }

/* 2 · KPI cards */
.kwr-kpis { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.kwr-kpi {
  display: flex; flex-direction: column;
  padding: 14px 16px;
  border: 1px solid rgba(var(--wash-rgb), 0.06);
  border-radius: 12px;
  background: rgba(var(--wash-rgb), 0.025);
}
.kwr-kpi-top { display: flex; align-items: center; justify-content: space-between; gap: 8px; margin-bottom: 8px; min-height: 18px; }
.kwr-kpi-label { font-size: 12px; font-weight: 500; color: var(--muted); }
/* Quick-wins label doubles as a link to the full page-2 set in the table. */
.kwr-kpi-link {
  appearance: none;
  background: none;
  border: 0;
  padding: 0;
  margin: 0;
  font: inherit;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
  transition: color 140ms ease;
}
.kwr-kpi-link:hover, .kwr-kpi-link:focus-visible { color: var(--accent); outline: none; }
.kwr-link-arrow { font-size: 11px; opacity: 0.7; }
.kwr-kpi-link:hover .kwr-link-arrow { opacity: 1; }
.kwr-kpi-delta {
  font-size: 11.5px; font-weight: 600;
  padding: 3px 7px; border-radius: 6px;
  display: inline-flex; align-items: center; gap: 3px;
}
.kwr-kpi-delta.up { color: var(--accent); background: rgba(99, 102, 241,0.12); }
.kwr-kpi-delta.down { color: var(--danger); background: rgba(255,122,122,0.12); }
.kwr-kpi-delta.flat { color: var(--muted-2); background: rgba(var(--wash-rgb), 0.05); }
.kwr-kpi-value {
  font-size: 28px; font-weight: 600; color: var(--text);
  letter-spacing: -0.01em; line-height: 1.05;
}
.kwr-of { font-size: 15px; font-weight: 500; color: var(--muted); }
.kwr-kpi-sub { font-size: 12px; color: var(--muted); margin-top: 6px; }
.kwr-kpi-mean { font-size: 11.5px; color: var(--muted-2); margin-top: 9px; line-height: 1.35; }
.kwr-movers { display: flex; gap: 12px; align-items: baseline; }
.kwr-mv { font-size: 17px; font-weight: 600; display: inline-flex; align-items: center; gap: 4px; }
.kwr-mv.up { color: var(--accent); }
.kwr-mv.down { color: var(--danger); }
.kwr-mv.new { color: var(--gold, var(--gold)); }
.kwr-mv.flat { color: var(--muted-2); font-size: 12.5px; font-weight: 500; }

/* 3/4/5 · panels */
.kwr-panel {
  border: 1px solid rgba(var(--wash-rgb), 0.06);
  border-radius: 12px;
  background: rgba(var(--wash-rgb), 0.02);
  padding: 16px 18px;
}
.kwr-panel-head { display: flex; align-items: baseline; justify-content: space-between; gap: 8px; flex-wrap: wrap; }
.kwr-panel-title { margin: 0; font-size: 14px; font-weight: 600; color: var(--text); }
.kwr-legend { display: flex; gap: 14px; font-size: 11.5px; color: var(--muted); }
.kwr-leg i { display: inline-block; width: 16px; height: 0; vertical-align: middle; margin-right: 6px; }
.kwr-leg-est i { border-top: 2px solid var(--muted-2); }
.kwr-note { font-size: 12px; color: var(--muted-2); margin: 4px 0 10px; line-height: 1.45; }
.kwr-chart-host { position: relative; }
.kwr-chart { min-height: 260px; }
.kwr-chart-empty { font-size: 12.5px; color: var(--muted-2); padding: 28px 4px; text-align: center; }

/* Pull-date badges under the chart (tag-cloud row) + hover callout */
.kwr-pull-row { display: flex; align-items: center; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.kwr-pull-lead { font-size: 11.5px; font-weight: 500; color: var(--muted-2); flex: none; }
.kwr-pull-badges { display: flex; flex-wrap: wrap; gap: 7px; }
.kwr-pull-badge {
  appearance: none;
  font: 500 12px 'Inter', sans-serif;
  font-variant-numeric: tabular-nums;
  display: inline-flex; align-items: center; gap: 2px;
  padding: 5px 11px;
  border-radius: 999px;
  border: 1px solid rgba(var(--wash-rgb), 0.10);
  background: rgba(var(--wash-rgb), 0.04);
  color: var(--muted);
  cursor: pointer;
  transition: color 140ms ease, border-color 140ms ease, background 140ms ease;
}
.kwr-pull-badge:hover, .kwr-pull-badge.is-active { color: var(--text); border-color: rgba(var(--wash-rgb), 0.22); }
.kwr-pull-badge:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kwr-pull-badge.is-up { color: var(--accent); border-color: rgba(99, 102, 241,0.28); background: rgba(99, 102, 241,0.08); }
.kwr-pull-badge.is-down { color: var(--danger); border-color: rgba(255,122,122,0.28); background: rgba(255,122,122,0.08); }
.kwr-pull-badge.is-active { box-shadow: inset 0 0 0 1px var(--accent); }
.kwr-badge-arrow { font-size: 9px; }

.kwr-pull-callout {
  position: absolute; top: 6px; left: 0;
  width: 196px;
  padding: 10px 12px;
  border: 1px solid rgba(var(--wash-rgb), 0.10);
  border-radius: 10px;
  background: #14181f;
  box-shadow: 0 8px 24px rgba(0,0,0,0.40);
  pointer-events: none;
  z-index: 5;
}
.kwr-co-date { font-size: 12px; font-weight: 600; color: var(--text); margin-bottom: 7px; display: flex; align-items: center; gap: 6px; }
.kwr-co-tag { font-size: 9.5px; font-weight: 600; letter-spacing: 0.03em; text-transform: uppercase; color: var(--accent); background: rgba(99, 102, 241,0.12); border-radius: 999px; padding: 1px 6px; }
.kwr-co-row { display: flex; align-items: baseline; justify-content: space-between; gap: 10px; font-size: 11.5px; color: var(--muted); padding: 2px 0; }
.kwr-co-row b { color: var(--text); font-weight: 600; font-variant-numeric: tabular-nums; }
.kwr-co-d.up { color: var(--accent); }
.kwr-co-d.down { color: var(--danger); }
.kwr-co-d.flat { color: var(--muted-2); }
/* Movement report (hover an older fetch) */
.kwr-co-empty { font-size: 12px; color: var(--muted); line-height: 1.45; padding: 2px 0; }
.kwr-mv-grid { display: grid; grid-template-columns: 1fr 1fr; gap: 9px 10px; margin: 2px 0 2px; }
.kwr-mvc { display: flex; flex-direction: column; font-size: 15px; font-weight: 600; font-variant-numeric: tabular-nums; line-height: 1.15; }
.kwr-mvc small { font-size: 10.5px; font-weight: 500; color: var(--muted-2); margin-top: 1px; }
.kwr-mvc.up { color: var(--accent); }
.kwr-mvc.down { color: var(--danger); }
.kwr-mvc.new { color: var(--gold, var(--gold)); }
.kwr-mvc.flat { color: var(--muted); }
.kwr-mv-win { margin-top: 9px; padding-top: 8px; border-top: 1px solid rgba(var(--wash-rgb), 0.07); display: flex; flex-direction: column; gap: 2px; }
.kwr-mv-win-lab { font-size: 10px; font-weight: 600; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-2); }
.kwr-mv-win b { font-size: 12.5px; color: var(--text); font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kwr-mv-win-rank { font-size: 11.5px; font-variant-numeric: tabular-nums; color: var(--accent); }

/* ── Progress check ─────────────────────────────────────── */
.kwr-progress-hint { font-size: 11px; color: var(--muted-2); }
.kwr-progress .kwr-chart { min-height: 230px; }
/* "now" badge — present but not selectable as a compare-from */
.kwr-pull-badge:disabled { cursor: default; opacity: 0.85; }
.kwr-pull-badge:disabled:hover { color: var(--muted); border-color: rgba(var(--wash-rgb), 0.10); }
.kwr-badge-now {
  margin-left: 5px; font-size: 9px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.04em; color: var(--muted-2);
}

/* Verdict card */
.kwr-verdict {
  display: flex; align-items: center; gap: 14px;
  margin-top: 14px; padding: 14px 16px;
  border: 1px solid var(--line); border-radius: 12px;
  background: rgba(var(--wash-rgb), 0.03);
  transition: background 200ms ease, border-color 200ms ease;
}
.kwr-verdict.is-good { background: rgba(99, 102, 241,0.08); border-color: rgba(99, 102, 241,0.26); }
.kwr-verdict.is-bad { background: rgba(255,122,122,0.07); border-color: rgba(255,122,122,0.26); }
.kwr-verdict.is-neutral { background: rgba(var(--wash-rgb), 0.03); border-color: var(--line-strong); }
.kwr-verdict-ico {
  display: flex; align-items: center; justify-content: center;
  width: 42px; height: 42px; flex: none; border-radius: 11px;
  background: rgba(var(--wash-rgb), 0.05); color: var(--muted);
}
.kwr-verdict.is-good .kwr-verdict-ico { background: rgba(99, 102, 241,0.14); color: var(--accent); }
.kwr-verdict.is-bad .kwr-verdict-ico { background: rgba(255,122,122,0.12); color: var(--danger); }
.kwr-verdict-body { flex: 1; min-width: 0; }
.kwr-verdict-label { font-size: 18px; font-weight: 600; color: var(--text); line-height: 1.2; }
.kwr-verdict.is-good .kwr-verdict-label { color: var(--accent); }
.kwr-verdict.is-bad .kwr-verdict-label { color: var(--danger); }
.kwr-verdict-sub { font-size: 12.5px; color: var(--muted); margin-top: 3px; }
.kwr-verdict-net { text-align: right; flex: none; }
.kwr-verdict-net b { display: block; font-size: 24px; font-weight: 700; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1; }
.kwr-verdict-net small { font-size: 10px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.06em; color: var(--muted-2); }

/* Threshold-crossing chips */
.kwr-chips { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 12px; }
.kwr-chip {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 5px 11px; border-radius: 999px;
  font-size: 12px; font-weight: 500;
  border: 1px solid; line-height: 1.2;
}
.kwr-chip svg { flex: none; }
.kwr-chip.is-good { color: var(--accent); background: rgba(99, 102, 241,0.10); border-color: rgba(99, 102, 241,0.24); }
.kwr-chip.is-win { color: var(--gold, var(--gold)); background: rgba(230,196,122,0.10); border-color: rgba(230,196,122,0.26); }
.kwr-chip.is-bad { color: var(--danger); background: rgba(255,122,122,0.08); border-color: rgba(255,122,122,0.24); }

/* Delta stat tiles */
.kwr-tiles { display: grid; grid-template-columns: repeat(4, 1fr); gap: 10px; margin-top: 14px; }
.kwr-tile {
  padding: 11px 13px; border: 1px solid var(--line); border-radius: 11px;
  background: rgba(var(--wash-rgb), 0.025);
}
.kwr-tile-label { font-size: 10.5px; font-weight: 500; text-transform: uppercase; letter-spacing: 0.04em; color: var(--muted-2); }
.kwr-tile-valrow { display: flex; align-items: baseline; gap: 7px; margin-top: 6px; }
.kwr-tile-val { font-size: 21px; font-weight: 600; color: var(--text); font-variant-numeric: tabular-nums; line-height: 1; }

/* Biggest movers list */
.kwr-movers-head { margin-top: 18px; }
.kwr-movers-list { margin-top: 8px; border: 1px solid var(--line); border-radius: 11px; overflow: hidden; }
.kwr-mover {
  display: flex; align-items: center; gap: 12px;
  padding: 9px 13px; border-bottom: 1px solid var(--line);
}
.kwr-mover:last-child { border-bottom: 0; }
.kwr-mover-kw { flex: 1; min-width: 0; }
.kwr-mover-term { font-size: 13px; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kwr-mover-vol { font-size: 11px; color: var(--muted-2); margin-top: 1px; }
.kwr-mover-rank { font-size: 12px; color: var(--muted); font-variant-numeric: tabular-nums; flex: none; }
.kwr-mover-rank b { color: var(--text); font-weight: 600; }
.kwr-mover-delta {
  display: inline-flex; align-items: center; gap: 2px;
  min-width: 44px; justify-content: flex-end;
  font-size: 13px; font-weight: 600; font-variant-numeric: tabular-nums; flex: none;
}
.kwr-mover-delta.up { color: var(--accent); }
.kwr-mover-delta.down { color: var(--danger); }

/* Clickable movers jump to their card in the action queue below. */
.kwr-mover--act { cursor: pointer; transition: background .12s ease; }
.kwr-mover--act:hover,
.kwr-mover--act:focus-visible { background: var(--accent-soft, rgba(99, 102, 241,.07)); outline: none; }
.kwr-mover-jump {
  flex: none; font-size: 11px; font-weight: 600; color: var(--accent);
  white-space: nowrap; opacity: .55; transition: opacity .12s ease;
}
.kwr-mover--act:hover .kwr-mover-jump,
.kwr-mover--act:focus-visible .kwr-mover-jump { opacity: 1; }

/* Quick flash on the action card the user was sent to, so the target
   item is unmistakable the moment the page scrolls to it. */
@keyframes actFlash {
  0%   { box-shadow: 0 0 0 0 var(--accent); background: var(--accent-soft, rgba(99, 102, 241,.12)); }
  100% { box-shadow: 0 0 0 3px transparent; background: transparent; }
}
.act-card.act-flash {
  animation: actFlash 1.4s ease-out;
  border-radius: 12px;
}

.kwr-two { display: grid; grid-template-columns: 1.5fr 1fr; gap: 14px; }

/* position bars */
.kwr-bars { margin-top: 12px; display: flex; flex-direction: column; gap: 10px; }
.kwr-bars-empty { font-size: 12.5px; line-height: 1.5; color: var(--muted-2); padding: 22px 4px; text-align: center; }
.kwr-bar-row { display: flex; align-items: center; gap: 12px; border-radius: 8px; }
.kwr-bar-row.is-clickable { cursor: pointer; padding: 4px 6px; margin: -4px -6px; transition: background 140ms ease; }
.kwr-bar-row.is-clickable:hover { background: rgba(var(--wash-rgb), 0.035); }
.kwr-bar-row.is-clickable:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.kwr-bar-row.is-clickable:hover .kwr-bar-lab b { color: var(--accent); }
.kwr-bar-lab { width: 96px; flex: none; font-size: 12px; }
.kwr-bar-lab b { display: block; color: var(--text); font-weight: 600; }
.kwr-bar-lab span { font-size: 11px; color: var(--muted-2); }
.kwr-bar { flex: 1; height: 24px; background: rgba(var(--wash-rgb), 0.04); border-radius: 6px; overflow: hidden; }
.kwr-bar-fill {
  height: 100%; border-radius: 6px;
  display: flex; align-items: center; padding-left: 9px;
  font-size: 11.5px; font-weight: 600; color: #0a0b0e;
}
.kwr-bar-fill.p1 { background: var(--accent); }
.kwr-bar-fill.p2 { background: var(--cyan-1); }
.kwr-bar-fill.p3 { background: #4a5560; color: var(--text); }
.kwr-bar-fill.p4 { background: #343a44; color: var(--muted); }

/* focus list */
.kwr-kw { display: flex; align-items: center; gap: 12px; padding: 10px 0; border-bottom: 1px solid rgba(var(--wash-rgb), 0.05); }
.kwr-kw:last-child { border-bottom: none; }
.kwr-kw-rank {
  flex: none; width: 34px; text-align: center;
  font-size: 12px; font-weight: 600; color: var(--gold, var(--gold));
  background: rgba(230,196,122,0.12); border-radius: 6px; padding: 4px 0;
}
.kwr-kw-body { flex: 1; min-width: 0; }
.kwr-kw-name { font-size: 13.5px; font-weight: 500; color: var(--text); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.kwr-kw-why { font-size: 11.5px; color: var(--muted-2); margin-top: 1px; }
.kwr-kw-vol { flex: none; text-align: right; font-size: 12px; color: var(--muted); }
.kwr-kw-vol b { display: block; color: var(--text); font-weight: 600; }
.kwr-kw-vol span { font-size: 10.5px; color: var(--muted-2); }
.kwr-focus-empty { font-size: 12.5px; color: var(--muted-2); padding: 10px 0; }
.kwr-focus-more { display: inline-block; margin-top: 12px; font-size: 12.5px; font-weight: 500; color: var(--accent); text-decoration: none; }
.kwr-focus-more:hover { text-decoration: underline; }

@media (max-width: 880px) {
  .kwr-kpis { grid-template-columns: repeat(2, 1fr); }
  .kwr-two { grid-template-columns: 1fr; }
  .kwr-tiles { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 520px) {
  .kwr-kpis { grid-template-columns: 1fr; }
  .kwr-hero-text { font-size: 15px; }
  .kwr-verdict { flex-wrap: wrap; }
  .kwr-verdict-net { text-align: left; }
  /* Give the preview modal more room on a phone. */
  .kw-preview-backdrop { padding: 14px; }
  .kw-preview { padding: 18px 16px 14px; }
}

/* ── Verified GSC columns ──────────────────────────────────
   With the three Google columns unhidden the table can exceed the card
   width — the wrapper scrolls horizontally instead of clipping. */
.tbl-scroll { overflow-x: auto; }
.tbl-kw th.th-gsc { text-align: right; }
.tbl-kw th.th-gsc .gsc-badge { margin-right: 6px; vertical-align: 1px; }
.tbl-kw.gsc-on thead th,
.tbl-kw.gsc-on tbody td { padding-left: 9px; padding-right: 9px; }

/* ── Free verified layer on a locked page (gsc-free-mode) ─────────
   The All-keywords card shows only the user's real Search Console
   queries: hide the paid-table chrome (filters, search, sort footer,
   the 12-column table) and show the injected 5-column .gsc-free one. */
.gsc-free-mode .kw-toolbar,
.gsc-free-mode .kw-search,
.gsc-free-mode .kw-foot,
.gsc-free-mode .tbl-scroll:not(.gsc-free) { display: none; }
.gsc-free-mode .gsc-free { margin-top: 4px; }
