/* =========================================================
   Amplified SEO: Rankings Dashboard
   Layered dark theme — see README for the token rationale.
   ========================================================= */

@import url('https://fonts.googleapis.com/css2?family=Montserrat:ital,wght@0,400;0,500;0,600;0,700;0,800;0,900;1,500&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

:root{
  /* Layered dark surfaces — darkest to most raised */
  --navy-alt:    #071B2D;  /* deeper alternating section background */
  --navy:        #081F34;  /* main background */
  --navy-deep:   #051624;  /* topbar / footer (kept from original brand system) */
  --navy-card:   #0A2540;  /* cards, tables, panels */
  --navy-raise:  #0D2D4A;  /* raised / interactive surfaces: table headers, inputs, popovers */
  --navy-line:   #1C3E5E;

  --green:       #CFFF81;  /* primary accent (Amplified lime) */
  --green-deep:  #9FE04E;
  --amber:       #FFC857;  /* warnings only */
  --red:         #FF6E90;  /* declines / risk only */
  --blue:        #6FBBFF;  /* calm neutral-positive (positions 11–20) */
  --slate:       #8CA0B8;

  /* Text on dark */
  --text:        #FFFFFF;
  --text-soft:   rgba(255,255,255,0.72);
  --text-faint:  rgba(255,255,255,0.64);

  /* Borders */
  --border:      rgba(255,255,255,0.10);
  --border-lime: rgba(207,255,129,0.18);
  --hair:        rgba(255,255,255,0.08);

  --f-heading:   'Montserrat', sans-serif;
  --f-body:      'Montserrat', sans-serif;
  --f-mono:      'JetBrains Mono', monospace;

  --radius-s: 10px;
  --radius-m: 16px;
  --radius-l: 26px;

  --shadow-card: none;
  --shadow-deep: 0 20px 44px -26px rgba(0,0,0,0.55);

  --maxw: 1440px;
}

*{ box-sizing:border-box; }
html{ scroll-behavior:smooth; }
@media (prefers-reduced-motion: reduce){ html{ scroll-behavior:auto; } *{ animation-duration:0.001ms !important; animation-iteration-count:1 !important; transition-duration:0.001ms !important; } }

body{
  margin:0;
  font-family:var(--f-body);
  background:var(--navy);
  color:var(--text);
  font-size:16px;
  line-height:1.6;
  -webkit-font-smoothing:antialiased;
}

img{ max-width:100%; display:block; }
a{ color:var(--green-deep); }
a:hover{ color:var(--green); }

.wrap{ max-width:var(--maxw); margin:0 auto; padding:0 32px; }
@media (max-width:640px){ .wrap{ padding:0 18px; } }

section{ position:relative; }

.skip-link{
  position:absolute; left:-999px; top:0; z-index:200;
  background:var(--green); color:var(--navy); padding:10px 18px; border-radius:0 0 8px 0; font-weight:700;
}
.skip-link:focus{ left:0; }

.visually-hidden{
  position:absolute; width:1px; height:1px; padding:0; margin:-1px; overflow:hidden;
  clip:rect(0,0,0,0); white-space:nowrap; border:0;
}

:focus-visible{ outline:3px solid var(--amber); outline-offset:2px; border-radius:4px; }

/* ---------- Top bar (kept structure) ---------- */
.topbar{
  position:sticky; top:0; z-index:50;
  background:rgba(5,22,36,0.94);
  backdrop-filter:blur(10px);
  border-bottom:1px solid var(--border-lime);
}
.topbar-inner{
  display:flex; align-items:center; justify-content:space-between; gap:16px;
  padding:14px 32px;
}
.brand{ display:flex; align-items:baseline; gap:10px; color:#fff; text-decoration:none; flex-shrink:1; min-width:0; }
.brand:hover{ color:#fff; }
.brand-id{ display:flex; align-items:baseline; gap:8px; min-width:0; }
.brand-name{ font-weight:700; font-size:15px; letter-spacing:0.02em; white-space:nowrap; flex-shrink:0; }
.brand-name .amplified{ color:var(--green); }
.brand-sep{ color:var(--text-faint); font-size:14px; font-weight:400; flex-shrink:0; }
.brand-client{ font-weight:600; font-size:15px; color:var(--text-soft); white-space:nowrap; overflow:hidden; text-overflow:ellipsis; }
.brand-product{
  font-family:var(--f-mono); font-size:11.5px; color:var(--text-faint); padding:2px 8px;
  border:1px solid rgba(255,255,255,0.18); border-radius:20px; white-space:nowrap; flex-shrink:0;
}
.brand-product .product-short{ display:none; }

@media (max-width:1024px){
  .brand-product .product-full{ display:none; }
  .brand-product .product-short{ display:inline; }
}
@media (max-width:640px){
  .brand-product{ display:none; }
  .brand-client{ max-width:36vw; }
}

.topnav{ display:flex; gap:16px; flex-wrap:wrap; }
.topnav a{
  color:var(--text-soft); text-decoration:none; font-size:12.5px; font-weight:600;
  letter-spacing:0.01em; transition:color .15s; white-space:nowrap;
}
.topnav a:hover, .topnav a:focus-visible{ color:var(--green); }
.topnav-toggle{ display:none; background:none; border:none; color:#fff; font-size:22px; cursor:pointer; flex-shrink:0; }

@media (max-width:1180px){
  .topnav{ display:none; }
  .topnav-toggle{ display:block; }
  .topnav.open{
    display:flex; flex-direction:column; position:absolute; top:60px; left:0; right:0;
    background:var(--navy-deep); padding:18px 32px; gap:14px; border-bottom:1px solid var(--navy-line);
    max-height:75vh; overflow-y:auto;
  }
}

/* ---------- Hero (kept structure) ---------- */
.hero{
  background:
    radial-gradient(circle at 82% -10%, rgba(207,255,129,0.14), transparent 55%),
    radial-gradient(circle at -10% 110%, rgba(207,255,129,0.06), transparent 45%),
    linear-gradient(180deg, var(--navy) 0%, var(--navy-deep) 100%);
  color:#fff;
  padding:56px 0 68px;
  overflow:hidden;
}
.hero-grid{
  display:grid; grid-template-columns:1.15fr 0.85fr; gap:48px; align-items:center;
}
@media (max-width:900px){ .hero-grid{ grid-template-columns:1fr; gap:36px; } }

.eyebrow{
  display:inline-flex; align-items:center; gap:8px;
  font-size:12px; font-weight:700; letter-spacing:0.14em; text-transform:uppercase;
  color:var(--green); margin-bottom:18px;
}
.eyebrow::before{ content:''; width:6px; height:6px; border-radius:50%; background:var(--green); }

.hero h1{
  font-family:var(--f-heading); font-weight:800; font-size:clamp(28px,4vw,42px);
  line-height:1.14; margin:0 0 18px; letter-spacing:-0.01em;
}
.hero h1 em{ font-style:normal; color:var(--green); }
.hero p.lede{
  font-size:16.5px; color:var(--text-soft); max-width:60ch; margin:0 0 24px;
}
.hero-meta{ display:flex; gap:22px; flex-wrap:wrap; font-size:13px; color:var(--text-faint); }
.hero-meta strong{ color:#fff; font-weight:700; font-family:var(--f-mono); }

.verdict-card{
  background:linear-gradient(160deg, var(--navy-raise), rgba(15,46,76,0.7));
  border:1px solid var(--border-lime);
  border-left:4px solid var(--green);
  border-radius:var(--radius-l);
  padding:30px 32px 28px;
  box-shadow:var(--shadow-deep);
}
.verdict-divider{ height:1px; background:rgba(255,255,255,0.12); margin:18px 0 16px; }

/* Hero status card: last-successful-update date is the primary figure, with
   a compact status indicator directly beneath it; the next scheduled date
   sits below the divider, deliberately smaller/quieter so hierarchy reads
   at a glance without repeating the same status sentence twice. */
.update-label{ font-size:11px; font-weight:700; letter-spacing:0.1em; text-transform:uppercase; color:var(--text-faint); margin-bottom:6px; }
.update-primary .update-value{ font-family:var(--f-mono); font-size:clamp(24px,2.6vw,28px); font-weight:700; color:#fff; line-height:1.15; }
.status-indicator{ display:flex; align-items:center; gap:8px; margin-top:10px; font-size:13px; font-weight:600; color:var(--text-soft); }
.status-indicator .status-dot{ width:9px; height:9px; border-radius:50%; flex-shrink:0; background:var(--slate); }
.status-indicator.success .status-dot{ background:var(--green-deep); }
.status-indicator.success .status-text{ color:var(--green-deep); }
.status-indicator.pending .status-dot{ background:var(--amber); }
.status-indicator.pending .status-text{ color:var(--amber); }
.status-indicator.error .status-dot{ background:var(--red); }
.status-indicator.error .status-text{ color:var(--red); }
.update-value-next{ font-family:var(--f-mono); font-size:17px; font-weight:700; color:var(--text-soft); }

/* ---------- Section scaffolding ---------- */
.section{ padding:60px 0; border-bottom:1px solid var(--hair); background:var(--navy); }
.section.alt{ background:var(--navy-alt); }
.section:last-of-type{ border-bottom:none; }
.section-head{ max-width:78ch; margin-bottom:30px; }
.section-head-row{ display:flex; align-items:flex-start; justify-content:space-between; gap:20px; flex-wrap:wrap; }
.kicker{
  font-size:12px; font-weight:800; letter-spacing:0.14em; text-transform:uppercase;
  color:var(--slate); margin-bottom:10px;
}
.section h2{ font-family:var(--f-heading); font-weight:800; font-size:clamp(22px,3vw,28px); margin:0 0 10px; letter-spacing:-0.01em; color:#fff; }
.section-head p{ color:var(--text-soft); font-size:15px; margin:0; }
.chart-note{ font-size:12.5px; color:var(--text-faint); margin-top:8px; font-style:italic; }

/* ---------- Cards ---------- */
.card-grid{ display:grid; grid-template-columns:repeat(4,1fr); gap:16px; }
.card-grid.cols-3{ grid-template-columns:repeat(3,1fr); }
.card-grid.cols-4{ grid-template-columns:repeat(4,1fr); }
@media (max-width:980px){ .card-grid, .card-grid.cols-3, .card-grid.cols-4{ grid-template-columns:repeat(2,1fr); } }
@media (max-width:560px){ .card-grid, .card-grid.cols-3, .card-grid.cols-4{ grid-template-columns:1fr; } }

.stat-card{
  background:var(--navy-card); border:1px solid var(--border); border-radius:var(--radius-m);
  padding:20px 18px;
}
.stat-card .label{ font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:0.06em; color:var(--text-faint); margin-bottom:8px; }
.stat-card .value{ font-family:var(--f-mono); font-weight:700; font-size:26px; color:#fff; line-height:1.1; }
.stat-card .value small{ font-family:var(--f-body); font-size:12.5px; font-weight:600; color:var(--text-soft); }
.stat-card .foot{ font-size:12px; color:var(--text-soft); margin-top:8px; }
.stat-card.accent{ border-color:rgba(207,255,129,0.35); background:linear-gradient(160deg, rgba(207,255,129,0.09), var(--navy-card) 60%); }
.stat-card.accent .value{ color:var(--green); }
.stat-card.warn{ border-color:rgba(255,200,87,0.4); }
.stat-card.warn .value{ color:var(--amber); }
.stat-card.bad .value{ color:var(--red); }
.stat-card.good .value{ color:var(--green-deep); }

/* ---------- Tables ---------- */
.scroll-caption{ display:flex; align-items:center; gap:6px; font-size:12.5px; color:var(--green-deep); margin:0 0 8px; }
.table-scroll-outer{ position:relative; }
.table-scroll{
  overflow:auto; max-height:640px; border-radius:var(--radius-m); border:1px solid var(--border); background:var(--navy-card);
  cursor:grab; scrollbar-color:rgba(159,224,78,0.4) transparent; scrollbar-width:thin;
}
.table-scroll.dragging{ cursor:grabbing; user-select:none; }
.table-scroll::-webkit-scrollbar{ width:10px; height:10px; }
.table-scroll::-webkit-scrollbar-track{ background:transparent; }
.table-scroll::-webkit-scrollbar-thumb{ background:rgba(159,224,78,0.35); border-radius:20px; border:2px solid var(--navy-card); }
.table-scroll::-webkit-scrollbar-thumb:hover{ background:rgba(159,224,78,0.55); }
.history-table-scroll{
  overflow-x:auto; border-radius:var(--radius-m); border:1px solid var(--border); background:var(--navy-card);
  scrollbar-color:rgba(159,224,78,0.4) transparent; scrollbar-width:thin;
}
.history-table-scroll::-webkit-scrollbar{ height:10px; }
.history-table-scroll::-webkit-scrollbar-track{ background:transparent; }
.history-table-scroll::-webkit-scrollbar-thumb{ background:rgba(159,224,78,0.35); border-radius:20px; border:2px solid var(--navy-card); }
.scroll-hint{
  position:absolute; top:1px; right:1px; bottom:1px; width:56px; border-radius:0 var(--radius-m) var(--radius-m) 0;
  background:linear-gradient(to right, transparent, var(--navy-card) 65%);
  display:flex; align-items:center; justify-content:flex-end; padding-right:10px;
  pointer-events:none; z-index:4; transition:opacity .2s;
}
.scroll-hint[hidden]{ display:none; }
.scroll-hint .chevron{
  color:var(--green); font-size:22px; font-weight:700; line-height:1;
  animation:scroll-nudge 1.6s ease-in-out infinite;
}
@keyframes scroll-nudge{ 0%,100%{ transform:translateX(0); } 50%{ transform:translateX(5px); } }
.scroll-hint-bottom{
  position:absolute; left:1px; right:1px; bottom:1px; height:44px; border-radius:0 0 var(--radius-m) var(--radius-m);
  background:linear-gradient(to bottom, transparent, var(--navy-card) 70%);
  display:flex; align-items:flex-end; justify-content:center; padding-bottom:4px;
  pointer-events:none; z-index:4; transition:opacity .2s;
}
.scroll-hint-bottom[hidden]{ display:none; }
.scroll-hint-bottom .chevron-down{
  color:var(--green); font-size:22px; font-weight:700; line-height:1;
  animation:scroll-nudge-down 1.6s ease-in-out infinite;
}
@keyframes scroll-nudge-down{ 0%,100%{ transform:translateY(0); } 50%{ transform:translateY(5px); } }
/* border-collapse:collapse silently breaks position:sticky on <th> in
   Chromium -- separate + zero spacing keeps the same visual borders (only
   border-bottom is used anywhere below) while letting the sticky header work. */
table{ width:100%; border-collapse:separate; border-spacing:0; min-width:640px; }
thead th{
  background:var(--navy-raise); color:#fff; text-align:left; font-family:var(--f-heading); font-size:11.5px; font-weight:700;
  letter-spacing:0.04em; text-transform:uppercase; padding:12px 14px; white-space:nowrap;
  position:sticky; top:0; z-index:2; border-bottom:1px solid var(--border);
}
thead th button.sort-btn{
  background:none; border:none; color:inherit; font:inherit; letter-spacing:inherit; text-transform:inherit;
  cursor:pointer; display:inline-flex; align-items:center; gap:5px; padding:2px; border-radius:4px;
}
thead th button.sort-btn:hover{ color:var(--green); }
thead th .sort-icon{ font-size:10px; opacity:0.7; }
thead th .info-btn{ text-transform:none; letter-spacing:normal; }

tbody td{ padding:11px 14px; font-size:13.5px; border-bottom:1px solid var(--hair); vertical-align:middle; color:var(--text); white-space:nowrap; max-width:280px; overflow:hidden; text-overflow:ellipsis; }
tbody td:first-child{ white-space:normal; max-width:320px; min-width:220px; overflow:visible; text-overflow:clip; }
thead th:first-child{ min-width:220px; }
tbody tr:last-child td{ border-bottom:none; }
tbody tr:nth-child(even){ background:rgba(255,255,255,0.025); }
tbody tr.kw-row{ cursor:pointer; }
tbody tr.kw-row:hover{ background:rgba(159,224,78,0.08); }
tbody tr.kw-row.expanded{ background:rgba(159,224,78,0.13); }
td.num{ font-family:var(--f-mono); }

/* Sticky first (keyword) column, kept in sync with the row's own background */
thead th:first-child{ position:sticky; left:0; z-index:3; background:var(--navy-raise); }
tbody td:first-child{ position:sticky; left:0; z-index:1; background:#0A2540; }
tbody tr:nth-child(even) td:first-child{ background:#0C2A48; }
tbody tr.kw-row:hover td:first-child{ background:#123A52; }
tbody tr.kw-row.expanded td:first-child{ background:#153F58; }

.tag{
  display:inline-block; padding:3px 9px; border-radius:20px; font-size:11px; font-weight:700;
  background:rgba(255,255,255,0.08); color:var(--text-soft); white-space:nowrap;
}
.tag.high{ background:var(--green); color:#04121F; }
.tag.green{ background:rgba(159,224,78,0.16); color:var(--green-deep); }
.tag.amber{ background:rgba(255,200,87,0.16); color:var(--amber); }
.tag.red{ background:rgba(255,110,144,0.16); color:var(--red); }
.tag.slate{ background:rgba(255,255,255,0.08); color:var(--text-soft); }

/* Uniform 3-color rule: green = moved up (including a new entry into the
   rankings), amber = held a ranked position steady, red = moved down
   (including dropping out entirely). "Never ranked, still not ranked" is
   its own neutral grey -- it's not really "static", there's just nothing
   to compare. */
.movement{ display:inline-flex; align-items:center; gap:5px; font-weight:600; font-size:12.5px; white-space:nowrap; }
.movement.up{ color:var(--green-deep); }
.movement.down{ color:var(--red); }
.movement.static{ color:var(--amber); }
.movement.flat{ color:var(--text-faint); }
.movement.new{ color:var(--green-deep); }
.movement.lost{ color:var(--red); }
.movement .arrow{ font-size:12px; font-family:var(--f-mono); }
.movement .delta-num{ font-family:var(--f-mono); }

/* ---------- Position badges ---------- */
.pos-badge{
  display:inline-flex; align-items:center; justify-content:center; gap:4px;
  font-family:var(--f-mono); font-weight:700; font-size:12.5px; line-height:1;
  padding:5px 9px; border-radius:8px; border:1px solid transparent; white-space:nowrap;
}
.pos-top3{ background:var(--green); color:#04121F; border-color:var(--green); font-weight:800; }
.pos-top10{ background:rgba(159,224,78,0.16); color:var(--green-deep); border-color:rgba(159,224,78,0.35); }
.pos-top20{ background:rgba(111,187,255,0.16); color:var(--blue); border-color:rgba(111,187,255,0.35); }
.pos-top50{ background:rgba(255,200,87,0.16); color:var(--amber); border-color:rgba(255,200,87,0.35); }
.pos-top100{ background:rgba(255,255,255,0.06); color:var(--text-soft); border-color:rgba(255,255,255,0.16); }
.pos-none{
  background:transparent; color:var(--text-faint); border:1px dashed rgba(255,255,255,0.22);
  font-family:var(--f-body); font-weight:600; font-size:10.5px; letter-spacing:0.02em; padding:5px 8px;
}

/* ---------- Callouts / panels ---------- */
.callout{ border-left:4px solid var(--slate); background:var(--navy-card); border-radius:0 var(--radius-m) var(--radius-m) 0; padding:18px 22px; margin:18px 0; border:1px solid var(--border); border-left-width:4px; }
.callout h4{ margin:0 0 6px; font-size:14px; font-weight:800; color:#fff; }
.callout p{ margin:0; font-size:14px; color:var(--text-soft); }
.callout.go{ border-left-color:var(--green-deep); }
.callout.go h4{ color:var(--green-deep); }
.callout.caution{ border-left-color:var(--amber); }
.callout.caution h4{ color:var(--amber); }
.callout.risk{ border-left-color:var(--red); }
.callout.risk h4{ color:var(--red); }
.callout.info{ border-left-color:var(--slate); }

.overlap-details{ margin-top:12px; }
.overlap-details summary{ cursor:pointer; color:var(--green-deep); font-size:13px; font-weight:700; list-style:none; display:inline-flex; align-items:center; gap:6px; }
.overlap-details summary::-webkit-details-marker{ display:none; }
.overlap-details summary::before{ content:'▸'; font-size:11px; }
.overlap-details[open] summary::before{ content:'▾'; }
.overlap-details ul{ margin:12px 0 0; padding:0; list-style:none; display:flex; flex-direction:column; gap:8px; }
.overlap-details li{ display:flex; justify-content:space-between; gap:12px; font-size:13px; color:var(--text-soft); background:rgba(255,255,255,0.03); border:1px solid var(--hair); border-radius:8px; padding:8px 12px; }
.overlap-details li .kw-name{ color:#fff; font-weight:600; }

.two-col{ display:grid; grid-template-columns:1fr 1fr; gap:20px; }
@media (max-width:820px){ .two-col{ grid-template-columns:1fr; } }
.panel{ background:var(--navy-card); border:1px solid var(--border); border-radius:var(--radius-m); padding:20px 22px; }
.panel h4{ margin:0 0 14px; font-size:14px; font-weight:800; }
.panel.strengths h4{ color:var(--green-deep); }
.panel.weaknesses h4{ color:var(--red); }
.panel ul{ margin:0; padding-left:0; list-style:none; }
.panel li{ font-size:13.5px; margin-bottom:10px; padding-bottom:10px; border-bottom:1px solid var(--hair); display:flex; justify-content:space-between; gap:10px; align-items:center; }
.panel li:last-child{ border-bottom:none; margin-bottom:0; padding-bottom:0; }
.panel li .kw-name{ color:#fff; }
.panel li .mover-meta{ color:var(--text-faint); font-size:12px; }

/* ---------- Chart ---------- */
.chart-wrap{ background:var(--navy-card); border:1px solid var(--border); border-radius:var(--radius-m); padding:22px 20px 12px; }
.chart-legend{ display:flex; gap:18px; flex-wrap:wrap; align-items:center; font-size:12px; color:var(--text-soft); margin-top:6px; padding:0 4px 6px; }
.chart-legend span{ display:inline-flex; align-items:center; gap:6px; }
.chart-legend .dot{ width:10px; height:10px; border-radius:50%; display:inline-block; }
.chart-title{ font-weight:700; font-size:13.5px; margin:0 0 4px; color:#fff; display:flex; align-items:center; gap:2px; }
.chart-title-row{ display:flex; align-items:center; justify-content:space-between; gap:12px; flex-wrap:wrap; margin-bottom:12px; }
.chart-sub{ font-size:12.5px; color:var(--text-faint); margin:0 0 12px; }
.early-trend-tag{ font-size:11px; font-weight:700; letter-spacing:0.04em; color:var(--amber); background:rgba(255,200,87,0.12); border:1px solid rgba(255,200,87,0.3); padding:3px 9px; border-radius:20px; white-space:nowrap; }

/* ---------- Info popover (accessible, keyboard + click) ---------- */
.info-wrap{ position:relative; display:inline-flex; align-items:center; }
.info-btn{
  display:inline-flex; align-items:center; justify-content:center; width:18px; height:18px;
  border-radius:50%; border:1px solid rgba(255,255,255,0.32); background:rgba(255,255,255,0.06);
  color:var(--text-soft); font-size:11px; font-weight:700; font-family:var(--f-heading); cursor:pointer;
  margin-left:7px; line-height:1; flex-shrink:0; padding:0;
}
.info-btn:hover{ border-color:var(--green); color:var(--green); }
.info-popover{
  /* Fixed + JS-positioned (not absolute) so it always floats above the
     viewport correctly even when its trigger sits inside a sticky,
     horizontally-scrolling table header — an ancestor's overflow:hidden/auto
     or sticky positioning can otherwise clip or mis-place an absolutely
     positioned popover. */
  position:fixed; z-index:200; width:280px; max-width:80vw;
  background:var(--navy-raise); border:1px solid var(--border-lime); border-radius:var(--radius-s);
  padding:14px 16px; font-size:12.5px; line-height:1.55; font-weight:400; letter-spacing:normal;
  text-transform:none; text-align:left; color:var(--text-soft); box-shadow:var(--shadow-deep);
}
.info-popover[hidden]{ display:none; }
.info-popover strong{ color:#fff; }

.legend-btn.info-btn{
  width:auto; height:auto; border-radius:var(--radius-s); padding:9px 16px; font-size:13.5px; font-weight:600;
  font-family:inherit; margin-left:0; background:var(--navy-card); border:1px solid var(--border); color:var(--text);
}
.legend-btn.info-btn:hover{ border-color:var(--slate); color:var(--text); }
.legend-popover{ width:300px; }
.legend-title{ margin:0 0 8px; font-size:11.5px; font-weight:700; letter-spacing:0.04em; text-transform:uppercase; color:var(--text-faint); }
.legend-title:not(:first-child){ margin-top:16px; }
.legend-list{ list-style:none; margin:0; padding:0; }
.legend-list li{ display:flex; align-items:center; gap:9px; padding:3px 0; color:var(--text-soft); }
.legend-swatch{ width:16px; height:16px; border-radius:5px; border:1px solid transparent; flex-shrink:0; }
.legend-dot{ width:10px; height:10px; border-radius:50%; flex-shrink:0; }
.legend-dot.up{ background:var(--green-deep); }
.legend-dot.static{ background:var(--amber); }
.legend-dot.down{ background:var(--red); }
.legend-dot.flat{ background:var(--text-faint); }

/* ---------- Truncation tooltip (keyboard + hover accessible) ---------- */
.truncate-tip{
  display:inline-block; max-width:100%; overflow:hidden; text-overflow:ellipsis; white-space:nowrap;
  vertical-align:bottom; cursor:help; border-bottom:1px dotted rgba(255,255,255,0.35); position:relative;
}
.truncate-tip:hover::after, .truncate-tip:focus::after{
  content:attr(data-full);
  position:absolute; left:0; top:100%; margin-top:6px; z-index:70;
  background:var(--navy-raise); color:#fff; border:1px solid var(--border-lime);
  padding:8px 11px; border-radius:8px; font-size:12.5px; line-height:1.45;
  white-space:normal; width:max-content; max-width:320px; box-shadow:var(--shadow-deep);
}

/* ---------- Toolbar / filters ---------- */
.toolbar{
  display:flex; flex-wrap:wrap; align-items:flex-end; gap:14px;
  background:var(--navy-card); border:1px solid var(--border); border-radius:var(--radius-m);
  padding:18px; margin-bottom:14px;
}
.search-box{ flex:1 1 220px; min-width:200px; }
.search-box input{
  width:100%; padding:10px 14px; border-radius:var(--radius-s); border:1px solid var(--border);
  font:inherit; font-size:14px; background:var(--navy-raise); color:var(--text);
}
.search-box input::placeholder{ color:var(--text-faint); }
.filter-controls{ display:flex; flex-wrap:wrap; gap:10px; align-items:flex-end; }
.filter-field{ display:flex; flex-direction:column; gap:4px; font-size:11.5px; font-weight:700; text-transform:uppercase; letter-spacing:0.04em; color:var(--text-faint); position:relative; }

/* A closed <details> reserves a few px of height beyond its <summary>'s own
   box in every engine tested here, even with zero margin/padding/border on
   the element itself and the dropdown panel taken out of flow — so instead
   of chasing that reservation, every filter field (the <details> used by
   Tier/Category/Position/Page status and the plain wrapper used by
   Priority's <select>) gets the same explicit height, which overrides it. */
.filter-field.multi, .filter-field{ height:42px; }

/* Shared sizing baseline for every filter-toolbar trigger — the <details>
   <summary> used by Tier/Category/Position/Page status and the native
   <select> used by Priority. A bare <select> renders with its own browser
   chrome (extra internal padding around the text/arrow) that doesn't match
   a custom flex box even with identical padding/border/font-size, so
   appearance is reset below and every metric that affects height is set
   explicitly here rather than left to each element's own defaults. */
.filter-field.multi summary,
.filter-select{
  box-sizing:border-box; min-height:40px; width:100%;
  display:flex; align-items:center; gap:8px;
  font:inherit; font-size:13.5px; font-weight:500; text-transform:none; letter-spacing:normal; color:var(--text);
  padding:9px 10px; border-radius:var(--radius-s); border:1px solid var(--border); background:var(--navy-raise);
  cursor:pointer;
}
.filter-field.multi summary{ list-style:none; justify-content:space-between; }
.filter-field.multi summary::-webkit-details-marker{ display:none; }
.filter-field.multi summary::after{ content:'▾'; font-size:10px; color:var(--text-faint); }
.filter-field.multi[open] summary::after{ content:'▴'; }

.select-wrap{ position:relative; display:block; }
.select-wrap::after{
  content:'▾'; position:absolute; right:12px; top:50%; transform:translateY(-50%);
  font-size:10px; color:var(--text-faint); pointer-events:none;
}
.filter-select{
  appearance:none; -webkit-appearance:none; -moz-appearance:none;
  padding-right:28px; min-width:150px;
}
.filter-count{ font-family:var(--f-mono); background:var(--green); color:#04121F; border-radius:20px; padding:1px 7px; font-size:11px; }
.filter-count:empty{ display:none; }
.checkbox-list{
  position:absolute; top:calc(100% + 4px); left:0; z-index:20; min-width:220px; max-height:260px; overflow-y:auto;
  background:var(--navy-raise); border:1px solid var(--border-lime); border-radius:var(--radius-s); box-shadow:var(--shadow-deep);
  padding:8px;
}
.checkbox-list label{
  display:flex; align-items:center; gap:8px; font-size:13px; font-weight:500; text-transform:none; letter-spacing:normal;
  color:var(--text); padding:6px 6px; border-radius:6px; cursor:pointer;
}
.checkbox-list label:hover{ background:rgba(255,255,255,0.06); }
.checkbox-list input{ accent-color:var(--green-deep); width:15px; height:15px; }

.toolbar-actions{ display:flex; gap:8px; margin-left:auto; }
.btn{
  font:inherit; font-size:13px; font-weight:700; padding:9px 16px; border-radius:20px; border:1px solid var(--border);
  background:var(--navy-raise); color:var(--text); cursor:pointer; white-space:nowrap;
}
.btn:hover{ border-color:var(--slate); }
.btn-accent{ background:var(--green); border-color:var(--green-deep); color:#04121F; }
.btn-accent:hover{ background:var(--green-deep); }
.btn-text{
  font:inherit; font-size:12.5px; font-weight:700; color:var(--green-deep); background:none; border:none;
  cursor:pointer; padding:2px 4px; text-decoration:underline; text-underline-offset:2px;
}
.btn-text:hover{ color:var(--green); }

.active-filters{ display:flex; flex-wrap:wrap; gap:8px; margin-bottom:10px; min-height:1px; }
.filter-chip{
  display:inline-flex; align-items:center; gap:6px; background:var(--navy-raise); border:1px solid var(--border); color:#fff; font-size:12px;
  font-weight:600; padding:5px 8px 5px 12px; border-radius:20px;
}
.filter-chip button{ background:rgba(255,255,255,0.15); border:none; color:#fff; border-radius:50%; width:18px; height:18px; cursor:pointer; font-size:11px; line-height:1; }
.filter-chip button:hover{ background:var(--red); }

.result-row{ display:flex; align-items:center; gap:14px; flex-wrap:wrap; margin:0 0 10px; }
.result-count{ font-size:13px; color:var(--text-soft); margin:0; }

.column-menu{
  display:flex; flex-wrap:wrap; gap:10px; background:var(--navy-card); border:1px solid var(--border);
  border-radius:var(--radius-m); padding:14px 16px; margin-bottom:14px;
}
.column-menu[hidden]{ display:none; }
.column-menu label{ display:flex; align-items:center; gap:6px; font-size:13px; color:var(--text-soft); }
.column-menu input{ accent-color:var(--green-deep); }

.priority-badge{
  display:inline-flex; align-items:center; gap:5px; background:var(--green); color:#04121F;
  font-size:11px; font-weight:800; padding:3px 9px; border-radius:20px; white-space:nowrap;
}

.url-status-dot{ display:inline-block; width:8px; height:8px; border-radius:50%; margin-right:6px; }
.url-status-dot.correct{ background:var(--green-deep); }
.url-status-dot.different, .url-status-dot.different_cannibalisation{ background:var(--red); }
.url-status-dot.unverified{ background:var(--amber); }
.url-status-dot.no_ranking_url{ background:rgba(255,255,255,0.25); }

tr.kw-expand-row td{
  background:#0C1F30; border-bottom:1px solid var(--hair); padding:0; white-space:normal;
  position:static; cursor:default;
}
tr.kw-expand-row:hover{ background:none; }

/* Header (title + close) sits outside .expand-body, which has its own
   bounded scroll -- so the close button is always visible without hunting
   for it after scrolling through a long position history. */
.expand-head{
  display:flex; align-items:flex-start; justify-content:space-between; gap:16px;
  padding:16px 24px 12px; border-bottom:1px solid var(--hair);
}
.expand-title-wrap h3{ margin:0 0 4px; font-size:16px; color:#fff; }
.expand-title-wrap .expand-sub{ font-size:13px; color:var(--text-faint); margin:0; }
.expand-panel-inner .close-btn{
  flex-shrink:0; background:var(--navy-raise); border:1px solid var(--border); color:var(--text);
  border-radius:20px; padding:6px 14px; font-size:12.5px; cursor:pointer;
}
.expand-panel-inner .close-btn:hover{ border-color:var(--slate); }
.expand-body{ max-height:360px; overflow-y:auto; padding:16px 24px 20px; }
.expand-chart{ max-width:640px; margin-left:auto; margin-right:auto; }
.chart-svg-wrap{ position:relative; }
.chart-point{ cursor:pointer; }
.chart-tooltip{
  position:absolute; z-index:10; pointer-events:none; transform:translateY(-100%);
  background:var(--navy-raise); color:#fff; border:1px solid var(--border-lime);
  padding:5px 10px; border-radius:8px; font-size:12px; white-space:nowrap; box-shadow:var(--shadow-deep);
}

.empty-state, .error-state{
  text-align:center; padding:48px 20px; color:var(--text-soft); font-size:14px;
}
.empty-state strong, .error-state strong{ display:block; color:#fff; font-size:16px; margin-bottom:6px; }

.loading-state{ display:flex; align-items:center; gap:10px; color:var(--text-soft); font-size:14px; padding:20px; }
.spinner{
  width:16px; height:16px; border-radius:50%; border:2px solid var(--border); border-top-color:var(--green-deep);
  animation:spin 0.8s linear infinite;
}
@keyframes spin{ to{ transform:rotate(360deg); } }

/* ---------- Footer (kept structure) ---------- */
.footer{ background:var(--navy-deep); color:var(--text-faint); padding:28px 0; font-size:12.5px; }
.footer .wrap{ display:flex; justify-content:space-between; align-items:center; flex-wrap:wrap; gap:10px; }
.footer-powered .amplified{ color:var(--green); font-weight:700; }

@media print{
  .topbar{ position:static; }
  .section{ break-inside:avoid-page; }
}

/* ---------- Responsive: intentional layout, not just scroll ---------- */
@media (max-width:1024px){
  .wrap{ padding:0 24px; }
  .section-head-row{ flex-direction:column; align-items:stretch; }
}
@media (max-width:768px){
  .toolbar{ flex-direction:column; align-items:stretch; }
  .toolbar-actions{ margin-left:0; justify-content:flex-start; }
  .filter-controls{ width:100%; }
  .result-row{ flex-direction:column; align-items:flex-start; gap:6px; }
}
@media (max-width:480px){
  .update-primary .update-value{ font-size:19px; }
  .stat-card .value{ font-size:22px; }
  /* The hero's bottom padding and the next section's top padding are tuned
     for the desktop hero-grid's height; stacked to one column on a small
     phone the hero reads much shorter, so the same fixed values leave an
     oversized gap before "At a glance". Trimmed here (scoped to #overview
     only) rather than touching .hero/.section generally, so spacing between
     every other section stays exactly as it is. */
  .hero{ padding-bottom:28px; }
  #overview{ padding-top:28px; }
}
