/* --- Local Poppins: 300 (Light), 500 (Medium), 600 (SemiBold). --- */
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 300;
  font-display: swap;
  src: url('/media/font/poppins-v24-latin/poppins-v24-latin-300.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 500;
  font-display: swap;
  src: url('/media/font/poppins-v24-latin/poppins-v24-latin-500.woff2') format('woff2');
}
@font-face {
  font-family: 'Poppins';
  font-style: normal;
  font-weight: 600;
  font-display: swap;
  src: url('/media/font/poppins-v24-latin/poppins-v24-latin-600.woff2') format('woff2');
}

* { box-sizing: border-box; margin: 0; padding: 0; }

/* Prevent the browser's scroll-anchor from auto-scrolling the page down
   when animated cards move upward into their resting positions on load. */
html { overflow-anchor: none; }

/* === Brand palette ===
   sRGB hex first (universal fallback), then display-p3 overrides for
   wide-gamut displays. The same RGB tuple in P3 paints noticeably more
   saturated than in sRGB because P3's primaries sit further out — so on a
   Mac / modern phone the oranges/yellows/pinks pop the way they do in
   Illustrator instead of looking flat-clipped. */
:root {
  --blue-bg:      #c0dafe;
  --deep-blue:    #758abb;
  --green:        #80a89c;
  --pink:         #ce7c98;
  --orange:       #fdc684;
  --red-orange:   #fc9786;
  --yellow:       #f4e38e;
  --gemini-blue:  #5766e3;
  --claude-red:   #cb7c5e;
  --text-black:   #282828;
  --chart-grey:   #565656;
  --mid-grey:     #dadce0;
}
@supports (color: color(display-p3 1 1 1)) {
  /* Saturation-boosted P3 values: dominant channel pushed closer to 1.0,
     lesser channels reduced — this widens the chroma without changing the
     hue or perceived lightness much, so the colours read closer to the
     Illustrator preview on a P3-capable display. */
  :root {
    --blue-bg:      color(display-p3 0.730 0.840 0.998);
    --deep-blue:    color(display-p3 0.390 0.490 0.825);
    --green:        color(display-p3 0.445 0.715 0.575);
    --pink:         color(display-p3 0.870 0.415 0.570);
    --orange:       color(display-p3 1.000 0.740 0.430);
    --red-orange:   color(display-p3 1.000 0.510 0.430);
    --yellow:       color(display-p3 1.000 0.890 0.460);
    --gemini-blue:  color(display-p3 0.265 0.330 1.000);
    --claude-red:   color(display-p3 0.875 0.405 0.250);
    --text-black:   color(display-p3 0.157 0.157 0.157);
    --mid-grey:     color(display-p3 0.855 0.863 0.878);
  }
}

html, body {
  height: 100%;
  font-family: 'Poppins', system-ui, sans-serif;
  color: var(--text-black);
  -webkit-font-smoothing: antialiased;
  background: var(--blue-bg);
}
/* Reserve scrollbar space so the viewport width is identical
   whether the page is short enough to hide the scrollbar or long
   enough to need one. Without this, expand/minimize transitions
   between a 2-row and 3-row layout cause the scrollbar to appear
   or disappear, which nudges every grid column's `1fr` width by
   ~7-8 px — and that nudge gets picked up by the enlarge FLIP as a
   "card moved" event on cards that should be stationary.
   Mobile (≤640 px) is single-column and locks scroll while the
   burger menu is open; reserving a gutter there just leaves a
   phantom blue strip where the scrollbar used to be. */
@media (min-width: 641px) {
  html {
    scrollbar-gutter: stable;
  }
}

.shell {
  position: relative;
  min-height: 100vh;
  /* Contains all child stacking contexts so the topbar (z:50) reliably
     paints above GSAP-transformed chart cards (z:auto) during animation. */
  isolation: isolate;
}

/* --- Top sticky bar ---
   Solid white, full-width, with slightly curved bottom-only corners.
   Pinned to the top of the viewport. Logo on the left, three text nav
   buttons centred, and a right-hand cluster of Upgrade pill, brand-switch
   pill, and profile icon. */
.topbar {
  position: sticky;
  top: 0;
  z-index: 50;
  background: #ffffff;
  border-radius: 0 0 14px 14px;
  display: flex;
  align-items: center;
  gap: 40px;
  padding: 22px 44px;
  /* Same ambient shadow recipe as the chart card, so the bar reads as a
     gently floating surface above the blue background. */
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.08);
  /* Hide-on-scroll: slide the bar up out of view when scrolling down,
     slide it back into place when scrolling up. */
  transform: translateY(0);
  transition: transform 0.25s ease;
  will-change: transform;
}
.topbar.is-hidden {
  transform: translateY(-100%);
}
.topbar__logo img {
  display: block;
  height: 32px;
  width: auto;
}
.topbar__nav {
  display: flex;
  align-items: center;
  gap: 56px;
  margin: 0 auto;             /* centres the nav between logo and the right cluster */
}
.topbar__nav a {
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-black);
  text-decoration: none;
  padding: 6px 4px;
}
.topbar__nav a:hover,
.topbar__nav a.is-active {
  text-decoration: underline;
  text-underline-offset: 7px;
  text-decoration-thickness: 2px;
}

/* === Tracker dropdown in desktop nav === */
.topbar__nav-dropdown {
  position: relative;
}
.topbar__nav-dropdown-toggle {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 13px;
  line-height: 1.4;
  color: var(--text-black);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px 4px;
  text-underline-offset: 8px;
  text-decoration-thickness: 6px;
}
.topbar__nav-dropdown-toggle img {
  width: 8px;
  height: 6px;
  display: block;
  flex-shrink: 0;
}
.topbar__nav-dropdown-menu {
  position: absolute;
  top: 100%;                  /* flush to button — gap lives in padding-top */
  left: 50%;
  transform: translateX(-50%);
  background: #fff;
  border-radius: 7px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.12);
  padding: 10px 10px 10px;    /* 10px top bridges the hover gap */
  min-width: 180px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 60;
}
.topbar__nav-dropdown.is-open .topbar__nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.topbar__nav-dropdown-menu a {
  display: block;
  padding: 9px 14px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-black);
  text-decoration: none;
  white-space: nowrap;
  border-radius: 5px;
}
.topbar__nav-dropdown-menu a:hover { background: #f5f5f5; text-decoration: none; }

/* Pill variant — right-align the menu under the brand pill so it doesn't
   overflow the topbar's right edge. */
.topbar__nav-dropdown--pill .topbar__nav-dropdown-menu {
  left: auto;
  right: 0;
  transform: none;
}

.topbar__right {
  display: flex;
  align-items: center;
  gap: 18px;
}
.pill {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  border: none;
  cursor: pointer;
  border-radius: 8px;
  padding: 8px 14px;
  height: 34px;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 13px;
  line-height: 1;
  color: var(--text-black);
  white-space: nowrap;
}
.pill--upgrade { background: var(--yellow); }
.pill--brand   { background: var(--orange); }
.pill--upgrade:hover { filter: brightness(1.05); transition: filter 0.15s ease; }
.pill__arrow {
  width: 10px;
  height: 7px;
  display: block;
  flex-shrink: 0;
}
.topbar__profile {
  background: transparent;
  border: none;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: filter 0.15s ease;
}
.topbar__profile:hover { filter: brightness(1.3); }
.topbar__profile img {
  width: 28px;
  height: 28px;
  display: block;
}

/* === Profile icon dropdown === */
.topbar__profile-dropdown {
  position: relative;
  display: inline-flex;
  align-items: center;
}
.profile-menu {
  position: absolute;
  top: 100%;
  right: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 6px 28px rgba(0,0,0,0.13);
  padding: 12px 8px 8px;
  min-width: 175px;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  z-index: 60;
}
.profile-menu__item {
  display: block;
  padding: 9px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-black);
  text-decoration: none;
  border-radius: 6px;
  white-space: nowrap;
}
.profile-menu__item:hover { background: #f5f5f5; cursor: pointer; }
button.profile-menu__item {
  width: 100%;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
}
.topbar__profile-dropdown.is-open .profile-menu,
.topbar__profile-dropdown:not(.is-suppressed):hover .profile-menu,
.topbar__profile-dropdown:focus-within .profile-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
}
.profile-menu__sep {
  height: 1px;
  background: #ebebeb;
  margin: 6px 8px;
}

/* === Mobile burger button + expanding header menu ===
   Hidden on desktop. On mobile (≤640 px) the topbar becomes a 2-row
   grid: row 1 = [burger | logo | profile], row 2 = the drop-down menu.
   The menu lives INSIDE the topbar so the bar's own background, rounded
   corners, and shadow grow with it — the header literally expands rather
   than a second panel appearing below. */
.topbar__burger {
  display: none;            /* desktop hides this */
  position: relative;
  background: transparent;
  border: none;
  padding: 4px;
  margin: -4px;
  width: 24px;
  height: 24px;
  cursor: pointer;
  flex-shrink: 0;
  align-items: center;
  justify-content: center;
}
.topbar__burger-icon {
  position: absolute;
  inset: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  transform-origin: 50% 50%;
}
.topbar__burger-icon img {
  display: block;
  width: 14px;
  height: 14px;
}
.topbar__burger-icon--x {
  opacity: 0;               /* starts hidden — GSAP cross-fades on toggle */
}
.topbar__burger-icon--x img {
  /* The close glyph reads slightly tighter than the burger bars at the
     same pixel size, so nudge it up a hair. */
  width: 13px;
  height: 13px;
}

.topbar__mobile-menu {
  display: none;            /* desktop hides this */
  /* Side drawer: fixed to the left edge, full viewport height, slides
     in OVER the topbar and dashboard. Lives OUTSIDE the <header>
     because .topbar has its own transform, which would otherwise force
     this fixed element to be contained by the topbar, not the viewport. */
  position: fixed;
  top: 0;
  left: 0;
  width: min(82vw, 320px);
  height: 100vh;
  background: #fff;
  z-index: 60;              /* above topbar (50) and backdrop (40) */
  /* Initial closed offset is set by GSAP via xPercent at init — keeping
     CSS transform off this rule avoids a CSS/GSAP transform conflict
     that can leave the drawer at an unexpected position on first open. */
  pointer-events: none;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.08);
  overflow-y: auto;
  -webkit-overflow-scrolling: touch;
  will-change: transform;
}
.topbar__mobile-menu.is-open {
  pointer-events: auto;
}
.topbar__mobile-menu-inner {
  /* Top padding clears the area where the floating close X sits
     (top:18px + 32px height ≈ 50px, plus breathing room). */
  padding: 72px 24px 32px;
}
.topbar__mobile-close {
  display: none;           /* desktop hides this */
  /* Fixed to the viewport so it does NOT travel with the drawer.
     Matches the topbar's mobile padding (18px 16px) so the X sits
     exactly where the burger was. */
  position: fixed;
  top: 18px;
  left: 16px;
  width: 32px;
  height: 32px;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 70;             /* above drawer (60) and topbar (50) */
  opacity: 0;
  pointer-events: none;
}
.topbar__mobile-close.is-open {
  pointer-events: auto;
  opacity: 1;
}
.topbar__mobile-close img {
  width: 18px;            /* same render size as the burger's X glyph */
  height: 18px;
  display: block;
}
.topbar__mobile-list {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 22px;
}
.topbar__mobile-item {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-weight: 500;
  font-size: 14px;
  line-height: 1;
  color: var(--text-black);
  text-decoration: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 8px 12px;
  border-radius: 8px;
  white-space: nowrap;
}
.topbar__mobile-item.is-active {
  text-decoration: underline;
  text-underline-offset: 8px;
  text-decoration-thickness: 2px;
}
.topbar__mobile-item--brand {
  background: var(--orange);
  padding: 10px 16px;
  font-weight: 600;
  height: 36px;
}
.topbar__mobile-item--upgrade {
  background: var(--yellow);
  padding: 10px 18px;
  font-weight: 600;
  height: 36px;
}
.topbar__mobile-item .pill__arrow {
  width: 10px;
  height: 7px;
}

.mobile-backdrop {
  display: none;            /* desktop hides this */
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.2);
  z-index: 40;              /* below topbar (50), above page content */
  opacity: 0;
  pointer-events: none;
  will-change: opacity;
}

/* When the mobile menu is open, lock body scroll so the bar's
   hide-on-scroll handler can't fire mid-animation. */
body.is-menu-open {
  overflow: hidden;
}

/* --- Main content area --- */
.main {
  background: var(--blue-bg);
  min-height: calc(100vh - 64px);
  max-width: 1200px;
  margin: 0 auto;
  padding: 48px 32px;
}

.main__title {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 19px;
  line-height: 1.3;
  text-align: left;
  color: var(--text-black);
  margin: 0 0 32px 0;
}

/* === Card grid ===
   Two equal columns by default. Single-column cards take one slot;
   `.card--full` (manual) or `.card--enlarged` (toggled by the chart card's
   expand button) span both columns. */
.card-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 40px;
}
.card--full,
.card--enlarged {
  grid-column: 1 / -1;
}
.card--enlarged .chart { height: 396px; }

.chart-card--pre-reveal { opacity: 0; }

/* === Chart card === */
.chart-card {
  position: relative;            /* anchors the settings-reveal overlay */
  background: #ffffff;
  border-radius: 8px;
  padding: 36px 32px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
  display: flex;
  flex-direction: column;
  /* CSS Grid items default to `min-width: auto` which resolves to
     min-content. When the enlarge FLIP animates an inline `width`
     (e.g. width: 1180px on chart 2's "old wide" state), that explicit
     size would otherwise be picked up as the column track's auto
     minimum and squeeze the sibling column to near-zero. Setting
     `min-width: 0` opts out of that behaviour so 1fr tracks stay 1fr
     regardless of any item's inline width. */
  min-width: 0;
  min-height: 0;
}
/* Settings panel — lives in the Profile > Settings view, mounted into
   #settings-panel-mount inside the setup-card. Items start invisible and
   are staggered in by JS each time the settings view opens. */
.settings-panel {
  display: flex;
  flex-direction: column;
  gap: 20px;
  font-family: 'Poppins', sans-serif;
  color: var(--text-black);
  margin-top: 20px;
}
.settings-item {
  opacity: 1;
}
.settings-section__title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.02em;
  margin: 0 0 4px;
  color: var(--text-black);
}
.settings-section__sub {
  font-size: 11px;
  color: #777;
  margin: 0 0 12px;
}
.weights-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.weight-row {
  display: grid;
  grid-template-columns: 80px 1fr 96px;
  align-items: center;
  gap: 12px;
  font-size: 12px;
}
.weight-row__label { font-weight: 500; }
.weight-row__value {
  font-family: inherit;
  font-variant-numeric: tabular-nums;
  text-align: center;
  font-size: 13px;
  color: #333;
  flex: 1;
  min-width: 0;
  height: 30px;
  padding: 0 4px;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  background: #fff;
  outline: none;
  -moz-appearance: textfield;
}
.weight-row__value::-webkit-outer-spin-button,
.weight-row__value::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.weight-row__value:focus {
  border-color: var(--deep-blue);
}
.weight-row__value-wrap {
  display: flex;
  align-items: center;
  gap: 4px;
}
.weight-row__suffix {
  font-size: 13px;
  color: #555;
}
.weight-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 4px;
  background: #e6e6e6;
  border-radius: 2px;
  outline: none;
  cursor: pointer;
}
.weight-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--deep-blue);
  border: none;
  cursor: pointer;
}
.weight-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--deep-blue);
  border: none;
  cursor: pointer;
}
.settings-reset {
  align-self: flex-start;
  background: transparent;
  border: 1px solid #d0d0d0;
  border-radius: 4px;
  padding: 6px 12px;
  font: inherit;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-black);
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}
.settings-reset:hover {
  background: #f4f4f4;
  border-color: #b0b0b0;
}
.weights-total {
  font-size: 11px;
  color: #777;
  margin-top: 4px;
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.weights-total--invalid .weights-total__value {
  color: var(--red-orange);
  font-weight: 600;
}
.weights-source {
  font-size: 10px;
  color: #999;
  margin-top: 6px;
}

.chart-card__top {
  margin: 0 12px 12px 14px;
}
.chart-card__top-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.chart-card__title {
  font-family: 'Poppins', sans-serif;
  font-size: 15px;
  font-weight: 600;
  color: var(--text-black);
  margin: 0 0 16px;
}

/* Info icon + cursor-following tooltip — appears beside any chart-card title. */
.info-tip {
  position: relative;
  display: inline-flex;
  align-items: center;
  vertical-align: 1px;
  margin-left: 6px;
  cursor: help;
}
.info-tip img {
  width: 11px;
  height: 11px;
  display: block;
}
.info-tip__bubble {
  position: fixed;            /* positioned at cursor via JS */
  top: 0;
  left: 0;
  background: var(--text-black);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 400;
  line-height: 1.45;
  padding: 10px 12px;
  border-radius: 6px;
  width: 340px;
  max-width: calc(100vw - 24px);
  white-space: normal;
  text-align: left;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.12s ease;
  z-index: 70;
}
.info-tip.is-open .info-tip__bubble {
  opacity: 1;
}
@media (max-width: 640px) {
  .info-tip__bubble { width: 240px; font-size: 11px; }
}
.chart-card__desc {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 300;
  line-height: 1.3;
  color: var(--text-black);
  margin: 0;
}
.chart-card__enlarge {
  background: transparent;
  border: none;
  padding: 4px;
  margin: -4px;
  cursor: pointer;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.chart-card__enlarge img {
  width: 13px;
  height: 13px;
  display: block;
  opacity: 1;
}
.chart-card__enlarge:hover img { transform: scale(1.08); }

.chart-card__footer {
  display: flex;
  align-items: center;
  gap: 18px;
  margin: 14px 12px 0 14px;
  flex-wrap: wrap;
}
.chart-card__footer-spacer { flex: 1; }

/* === Legend === */
.legend {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  row-gap: 8px;
  margin: 0 12px 18px 14px;
}
.legend__item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: transparent;
  border: none;
  padding: 0 6px 0 0;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 300;
  color: var(--text-black);
  white-space: nowrap;
}
.legend__box {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 2px;
  border: 0.1px solid #1e2020;
  background: var(--swatch-color, #cccccc);
  flex-shrink: 0;
  transition: background-color 0.12s ease;
}
.legend__box img {
  position: absolute;
  inset: 0;
  margin: auto;
  width: 8px;
  height: 8px;
  display: block;
  filter: brightness(0) invert(1);
}
/* Per-series swatch colour, driven by data-key. Avoids inline style on every legend item. */
.legend__item[data-key="all"]        .legend__box { --swatch-color: var(--text-black); }
.legend__item[data-key="chatgpt"]    .legend__box { --swatch-color: var(--green); }
.legend__item[data-key="claude"]     .legend__box { --swatch-color: var(--claude-red); }
.legend__item[data-key="gemini"]     .legend__box { --swatch-color: var(--gemini-blue); }
.legend__item[data-key="perplexity"] .legend__box { --swatch-color: var(--pink); }
.legend__item[data-key="copilot"]    .legend__box { --swatch-color: var(--orange); }
.legend__item[data-key="grok"]       .legend__box { --swatch-color: var(--red-orange); }

/* Inactive: solid light-grey chip + light-grey text; tick hidden. */
.legend__item:not(.is-active) { color: #c8c8c8; }
.legend__item:not(.is-active) .legend__box {
  background: #ebebeb;
  border-color: #e0e0e0;
}
.legend__item:not(.is-active) .legend__box img { display: none; }
/* Pie/donut single-select: selected item uses text-black box instead of swatch colour. */
.legend--single .legend__item.is-active .legend__box {
  background: var(--text-black);
  border-color: var(--text-black);
}

/* === Chart-area + dropdown shell === */
.chart-area {
  position: relative;
}
.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 200px;
  color: #999;
  font-size: 15px;
  font-family: 'Poppins', sans-serif;
}

/* === Chart overlay toolbar (bottom-right of the plot) === */
.chart-overlay-tools {
  position: absolute;
  bottom: 40px;
  right: 22px;
  display: flex;
  align-items: center;
  gap: 4px;
  pointer-events: none;
}
.chart-overlay-tools > * { pointer-events: auto; }

.overlay-btn {
  background: rgba(255, 255, 255, 0.82);
  border: none;
  border-radius: 4px;
  height: 18px;
  padding: 0 6px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-family: 'Poppins', sans-serif;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-black);
  gap: 4px;
}
/* Year picker reads as an in-chart annotation, no plate. */
.chart-overlay-tools .dropdown > .overlay-btn {
  background: transparent;
}
.overlay-btn--letter {
  width: 14px;
  height: 14px;
  padding: 0;
  border-radius: 3px;
  background: transparent;
}
.overlay-btn.is-active {
  outline: 1px solid rgba(0, 0, 0, 0.35);
  outline-offset: -1px;
}
.overlay-btn:hover {
  font-weight: 600;
}
.overlay-btn__arrow {
  width: 7px;
  height: 4px;
  display: block;
  flex-shrink: 0;
}
.dropdown--up .dropdown__menu {
  top: auto;
  bottom: calc(100% + 6px);
}
.dropdown {
  position: relative;
  display: inline-block;
}
.dropdown__menu {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  min-width: 100%;
  background: #ffffff;
  border-radius: 6px;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.22);
  padding: 4px 0;
  margin: 0;
  list-style: none;
  z-index: 50;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}
.dropdown.is-open .dropdown__menu { opacity: 1; visibility: visible; pointer-events: auto; }
.dropdown__option {
  padding: 8px 14px;
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 300;
  color: var(--text-black);
  cursor: pointer;
  white-space: nowrap;
}
.dropdown__option:hover { background: #f3f4f8; }
.dropdown__option.is-selected { background: #eeeffd; }

/* Multi-select mode — options grow a leading checkbox indicator. */
.dropdown--multi .dropdown__option {
  padding-left: 32px;
  position: relative;
  background: transparent;
}
.dropdown--multi .dropdown__option:hover { background: #f3f4f8; }
.dropdown--multi .dropdown__option::before {
  content: '';
  position: absolute;
  left: 12px;
  top: 50%;
  width: 12px;
  height: 12px;
  margin-top: -6px;
  border: 1px solid #b8bcc4;
  border-radius: 3px;
  background: #fff;
  box-sizing: border-box;
}
.dropdown--multi .dropdown__option.is-selected::before {
  background: var(--deep-blue);
  border-color: var(--deep-blue);
}
.dropdown--multi .dropdown__option.is-selected::after {
  content: '';
  position: absolute;
  left: 15px;
  top: 50%;
  width: 6px;
  height: 3px;
  margin-top: -3px;
  border-left: 1.5px solid #fff;
  border-bottom: 1.5px solid #fff;
  transform: rotate(-45deg);
}

/* Tracker-name dropdown */
.tracker-dropdown {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: #ffffff;
  border: none;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-black);
  cursor: pointer;
  white-space: nowrap;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.18);
}
.tracker-dropdown:hover { transform: scale(1.03); }
.tracker-dropdown__arrow {
  width: 9px;
  height: 6px;
  display: block;
  flex-shrink: 0;
}

/* === Pie / donut chart === */
[data-chart-type="pie"] .chart-card__enlarge { display: none; }
[data-chart-type="pie"] .pie__centre { display: none; }

.pie-area {
  display: flex;
  align-items: center;
  gap: 24px;
  padding: 4px 14px 8px 14px;
  min-height: 210px;
}
.pie-wrap {
  position: relative;
  flex: 0 0 210px;
  max-width: 210px;
  aspect-ratio: 1 / 1;
}
.pie {
  width: 100%;
  height: 100%;
  display: block;
  overflow: visible;
}
.pie__track {                       /* faint ring behind segments */
  fill: none;
  stroke: rgba(30, 32, 32, 0.06);
  stroke-width: 32;
}
.pie__seg {
  fill: none;
  stroke-width: 32;
  transition: stroke-width 0.2s ease, filter 0.2s ease;
  cursor: pointer;
}
.pie__seg:hover,
.pie__seg.is-hover {
  stroke-width: 38;
  filter: drop-shadow(0 0 4px rgba(0, 0, 0, 0.12));
}
.pie__centre {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
}
.pie__centre-value {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 24px;
  line-height: 1;
  color: var(--text-black);
}
.pie__centre-label {
  margin-top: 6px;
  font-family: 'Poppins', sans-serif;
  font-weight: 300;
  font-size: 11px;
  color: var(--chart-grey);
}
.pie-legend {
  flex: 1 1 auto;
  display: flex;
  flex-direction: column;
  gap: 7px;
  min-width: 0;
}
.pie-legend__row {
  display: grid;
  grid-template-columns: 12px 1fr auto;
  align-items: center;
  gap: 9px;
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 400;
  line-height: 1.2;
  color: var(--text-black);
  cursor: pointer;
}
.pie-legend__swatch {
  width: 12px;
  height: 12px;
  border-radius: 3px;
  background: var(--swatch-color, #cccccc);
  /* Scale from the centre on hover so it grows symmetrically without
     shifting the row's grid cells (transform is out-of-flow, so the
     row height / line-height stays put). */
  transform-origin: center center;
  will-change: transform;
}
.pie-legend__name { font-weight: 400; }
.pie-legend__pct  { font-weight: 600; font-variant-numeric: tabular-nums; }

/* ── Top Backlinks card ──────────────────────────────────────── */
.backlinks { padding: 4px 6px 0; }
.backlinks__empty {
  margin: 16px 6px;
  color: rgba(0, 0, 0, 0.55);
  font-size: 14px;
}
.backlinks__list {
  list-style: none;
  padding: 0;
  margin: 0;
}
.backlinks__row {
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}
.backlinks__row:last-child { border-bottom: none; }
.backlinks__row.is-stale { opacity: 0.55; }

.backlinks__row details > summary { list-style: none; cursor: pointer; }
.backlinks__row details > summary::-webkit-details-marker { display: none; }

.backlinks__summary {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  align-items: baseline;
  gap: 12px;
  padding: 10px 4px;
  font-size: 14px;
}
.backlinks__domain { font-weight: 500; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.backlinks__freq   { font-weight: 600; font-variant-numeric: tabular-nums; }
.backlinks__hits   { color: rgba(0, 0, 0, 0.55); font-variant-numeric: tabular-nums; }
.backlinks__stale  {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 6px;
  border-radius: 4px;
  color: rgba(0, 0, 0, 0.55);
}

.backlinks__urls {
  list-style: none;
  padding: 0 8px 10px 14px;
  margin: 0;
}
.backlinks__url-row {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 12px;
  padding: 4px 0;
  font-size: 13px;
}
.backlinks__url {
  color: var(--deep-blue, #2563eb);
  text-decoration: none;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.backlinks__url:hover { text-decoration: underline; }
.backlinks__url-hits { color: rgba(0, 0, 0, 0.45); font-variant-numeric: tabular-nums; }
.backlinks__url-row--more {
  display: block;
  font-size: 12px;
  color: rgba(0, 0, 0, 0.45);
  padding-top: 6px;
}

@media (max-width: 1100px) {
  .pie-area { flex-direction: column; gap: 16px; }
  .pie-wrap { flex: 0 0 180px; max-width: 180px; }
  .pie-legend { width: 100%; }
}

/* === Mini-chart strip ===
   Three small widgets sitting inside one .chart-card.card--full panel
   that stretches across the 2-column grid. Visually divided with hairline
   borders so each widget reads as its own column without needing a second
   card per widget. */
.mini-charts {
  /* Drop the chart-card's default top/bottom padding a notch — the
     widgets carry their own breathing room and the strip should sit
     a bit shallower than the full chart cards below. */
  padding: 26px 32px;
}
.mini-charts__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  align-items: stretch;
  gap: 0;
}
.mini-chart {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  padding: 4px 22px;
  min-width: 0;
}
.mini-chart + .mini-chart {
  border-left: 1px solid rgba(0, 0, 0, 0.06);
}
.mini-chart__placeholder-note {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 300;
  color: var(--chart-grey);
  margin: 0;
}
.mini-chart--placeholder {
  /* Match the speedometer's vertical footprint so the row reads as
     even rectangles even before the other two widgets are spec'd. */
  justify-content: center;
  min-height: 220px;
}

/* === Speedometer ===
   Semicircle gauge. The arc is built from four <path> elements:
     1. .speedo__track — full background from `value` to 100, blue.
     2. .speedo__poor  — green segment 0 → min(33, value).
     3. .speedo__avg   — yellow segment 33 → min(66, value).
     4. .speedo__good  — coral segment 66 → value (when value > 66).
   dashboard.js renders each path's `d` from arcPath() so the threshold
   and current value can be changed without recomputing geometry by hand. */
.speedo {
  /* Block layout so the SVG's intrinsic 240×150 sets the container size.
     No flex/aspect-ratio juggling — keeps Safari + narrow flex contexts
     from collapsing the inline SVG. */
  position: relative;
  display: inline-block;
}
.speedo__svg {
  display: block;
  /* Shrink proportionally inside narrow flex parents but never grow past
     the intrinsic 240×150 from the width/height attrs on the element. */
  max-width: 100%;
  height: auto;
  overflow: visible;
}
.speedo__seg {
  fill: none;
  /* Coloured zones sit INSIDE the wider blue track (8 vs 20). The track
     is rendered first as the full semicircle background — segments
     overlay only the middle 8 units of the 20-unit band, leaving 6 units
     of blue visible above and below each coloured zone. */
  stroke-width: 14;
  stroke-linecap: butt;
}
.speedo__track {
  stroke: var(--deep-blue);
  /* Wider stroke than .speedo__seg so the blue background ring frames
     each coloured zone (visible halo above + below). */
  stroke-width: 21;
}
.speedo__poor  { stroke: var(--green); }
.speedo__avg   { stroke: var(--yellow); }
.speedo__good  { stroke: var(--red-orange); }

.speedo__value {
  position: absolute;
  left: 0;
  right: 0;
  /* The chord line (open diameter of the semicircle) sits at CSS y≈120
     within the 138 px tall SVG, i.e. ~18 px above the container's bottom.
     Push the line-box up so the glyph's visible bottom lands on that
     line rather than a few pixels below it. */
  bottom: 16px;
  text-align: center;
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 34px;
  line-height: 1;
  color: var(--text-black);
  pointer-events: none;
}

.speedo-legend {
  /* Sits right under the gauge — the SVG's viewBox is already cropped
     so the track edge meets the bottom of the box. */
  margin: 2px 0 0;
  padding: 0;
  display: flex;
  flex-direction: row;
  flex-wrap: wrap;
  justify-content: center;
  gap: 6px 12px;
}
.speedo-legend__item {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-family: 'Poppins', sans-serif;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-black);
  white-space: nowrap;
}
.speedo-legend__dot {
  width: 8px;
  height: 8px;
  /* Rounded square — small radius matches the legend swatches used on
     the line-chart cards rather than full circles. */
  border-radius: 2px;
  flex-shrink: 0;
}
.speedo-legend__dot--poor { background: var(--green); }
.speedo-legend__dot--avg  { background: var(--yellow); }
.speedo-legend__dot--good { background: var(--red-orange); }

/* === Mini pie (Widget 2 — AI Perception) ===
   Donut built from three <circle> slices sharing r=70 with pathLength=100
   so stroke-dasharray maps 1:1 to percentages. The deep-blue from the
   speedometer track is reused here for the neutral (majority) slice. */
.mini-pie {
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 6px 0 10px;
}
.mini-pie__svg {
  display: block;
  max-width: 100%;
  height: auto;
}
.mini-pie__track {
  fill: none;
  stroke: var(--deep-blue);
  stroke-width: 32;
}
.mini-pie__seg {
  fill: none;
  stroke-width: 32;
  stroke-dasharray: 0 100; /* hidden until JS animates in via inline style */
}
.mini-pie__seg--positive { stroke: var(--green); }
.mini-pie__seg--neutral  { stroke: var(--deep-blue); }
.mini-pie__seg--negative { stroke: var(--red-orange); }

.mini-pie-legend__dot--positive { background: var(--green); }
.mini-pie-legend__dot--neutral  { background: var(--deep-blue); }
.mini-pie-legend__dot--negative { background: var(--red-orange); }

/* === Widget instance controls ===
   Every widget card carries a remove (×) button — hidden until the card is
   hovered (always visible on touch devices). A dashed "+ Add widget" tile
   ends the grid; its menu lists the widget types (duplicates allowed —
   pin two copies of a chart to different trackers to compare). */
.card-remove {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #dce4f0;
  color: var(--red-orange);
  font-size: 17px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 2px 8px rgba(31, 38, 62, 0.16);
  z-index: 6;
  opacity: 0;
  transform: scale(0.85);
  transition: opacity 0.18s ease, transform 0.18s ease,
              background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.chart-card:hover .card-remove,
.card-remove:focus-visible {
  opacity: 1;
  transform: scale(1);
}
@media (hover: none) {
  .card-remove { opacity: 1; transform: scale(1); }
}
.card-remove:hover {
  background: var(--red-orange);
  border-color: var(--red-orange);
  color: #ffffff;
}

.widget-add {
  position: relative;
  min-height: 120px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1.5px dashed #c2cee4;
  border-radius: 8px;
  transition: border-color 0.2s ease;
}
.widget-add:hover {
  border-color: var(--deep-blue);
}
.widget-add__btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--chart-grey);
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 28px 48px;
  transition: color 0.15s ease;
}
.widget-add__btn:hover {
  color: var(--deep-blue);
}
.widget-add__plus {
  font-size: 30px;
  font-weight: 300;
  line-height: 1;
}
.widget-add__menu {
  position: absolute;
  bottom: calc(100% + 8px);
  left: 50%;
  transform: translateX(-50%) translateY(4px);
  min-width: 240px;
  background: #ffffff;
  border: 1px solid #e3e9f4;
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(31, 38, 62, 0.18);
  padding: 6px;
  display: none;
  flex-direction: column;
  z-index: 30;
}
.widget-add.is-open .widget-add__menu {
  display: flex;
  transform: translateX(-50%) translateY(0);
}
.widget-add__option {
  font-family: 'Poppins', sans-serif;
  font-size: 12.5px;
  font-weight: 500;
  text-align: left;
  color: var(--text-black);
  background: transparent;
  border: none;
  border-radius: 6px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.12s ease, color 0.12s ease;
}
.widget-add__option:hover {
  background: #f1f4fa;
  color: var(--deep-blue);
}
.widget-add__option:disabled {
  opacity: 0.6;
  cursor: wait;
}

/* === Source Mix expanded details — top domains per category === */
.hbar-detail-toggle {
  white-space: nowrap;
}
.hbar-detail-toggle.is-active {
  color: var(--deep-blue);
  font-weight: 600;
}
.hbar__domains {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: 8px;
}
.hbar-domain {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  font-size: 11px;
  background: #f4f6fb;
  border-radius: 999px;
  padding: 4px 10px;
}
.hbar-domain__name {
  color: var(--text-black);
  font-weight: 500;
}
.hbar-domain__count {
  color: var(--chart-grey);
  font-variant-numeric: tabular-nums;
}

/* === Welcome overlay (after creating a tracker) === */
.welcome-overlay {
  position: fixed;
  inset: 0;
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}
.welcome-overlay__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(31, 38, 62, 0.45);
  backdrop-filter: blur(2px);
}
.welcome-overlay__card {
  position: relative;
  max-width: 460px;
  background: #ffffff;
  border-radius: 12px;
  padding: 36px 36px 32px;
  box-shadow: 0 24px 64px rgba(31, 38, 62, 0.3);
  font-family: 'Poppins', sans-serif;
}
.welcome-overlay__title {
  font-size: 19px;
  font-weight: 600;
  margin: 0 0 14px;
  color: var(--text-black);
}
.welcome-overlay__text {
  font-size: 13px;
  line-height: 1.6;
  color: var(--text-black);
  margin: 0 0 12px;
}
.welcome-overlay__text--sub {
  font-size: 12px;
  color: var(--chart-grey);
  margin-bottom: 22px;
}
.welcome-overlay__dismiss {
  width: 100%;
  justify-content: center;
}

/* === Horizontal bar widgets (Sentiment Breakdown, Source Mix) ===
   Shared row layout: label + value head line, then a thin track whose fill
   width is the score/percentage. Fills start at width 0 (GSAP animates to
   the data-pct value on reveal); --fill-color lets the source-mix card cycle
   the pie palette while sentiment uses the bucket variants below. */
.hbar-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 6px 2px 10px;
  flex: 1;
}
.hbar__head {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 6px;
}
.hbar__label {
  font-size: 12.5px;
  font-weight: 500;
  color: var(--ink, #282a2a);
}
.hbar__value {
  font-size: 12px;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}
.hbar__count {
  font-weight: 400;
  color: var(--chart-grey);
}
.hbar__track {
  height: 10px;
  border-radius: 5px;
  background: #eef1f7;
  overflow: hidden;
}
.hbar__fill {
  height: 100%;
  width: 0; /* animated to data-pct% by dashboard.js */
  border-radius: 5px;
  background: var(--fill-color, var(--deep-blue));
}
.hbar__fill--positive { background: var(--green); }
.hbar__fill--neutral  { background: var(--deep-blue); }
.hbar__fill--negative { background: var(--red-orange); }
.hbar-empty {
  font-size: 12.5px;
  color: var(--chart-grey);
  padding: 24px 0;
  text-align: center;
}

/* === Mini rank tile (Widget 3 — AI Placement Rank) ===
   Deep-blue panel with the rank number large and white, plus a small
   white delta pill underneath showing the change since last update. */
.mini-chart--rank {
  /* Let the inner tile own the vertical breathing room; the mini-chart
     itself only adds the title above and centres the tile. */
  justify-content: flex-start;
}
.rank-tile {
  background: var(--deep-blue);
  border-radius: 14px;
  width: 100%;
  max-width: 150px;
  padding: 16px 14px 22px;
  margin: 8px auto 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
}
.rank-tile__value {
  font-family: 'Poppins', sans-serif;
  font-weight: 600;
  font-size: 56px;
  line-height: 1;
  color: #ffffff;
  font-variant-numeric: tabular-nums;
  opacity: 0; /* hidden until JS counter starts */
}
.rank-tile__delta {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: #ffffff;
  border-radius: 4px;
  padding: 4px 10px;
  color: var(--green);
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 500;
}
.rank-tile__delta-arrow {
  display: block;
  flex-shrink: 0;
}
.rank-tile__delta-text {
  color: var(--text-black);
}
.rank-tile__caption {
  /* Extra top margin (on top of the tile's flex gap) so the caption sits
     clearly below the delta pill rather than right beneath it. */
  margin: 6px 0 0;
  font-family: 'Poppins', sans-serif;
  font-size: 9px;
  font-weight: 400;
  color: #ffffff;
  text-align: center;
  line-height: 1.3;
}

/* Stack the three widgets at the same breakpoint the main grid collapses
   so we never end up with a 3-up strip cramped inside a 1-up card. */
@media (max-width: 820px) {
  .mini-charts { padding: 22px 18px; }
  .mini-charts__grid {
    grid-template-columns: 1fr;
    /* On mobile the widgets stack vertically — add a gap so they don't
     read as one continuous block crammed against the hairline divider. */
    gap: 28px;
  }
  .mini-chart {
    padding: 18px 0;
  }
  .mini-chart + .mini-chart {
    border-left: none;
    border-top: 1px solid rgba(0, 0, 0, 0.06);
  }
  .mini-chart--placeholder { min-height: 0; }
}

/* === Chart SVG === */
.chart {
  display: block;
  width: 100%;
  height: 297px;
  font-family: 'Poppins', sans-serif;
  overflow: hidden;
}
/* M view enables drag-to-scroll. Cursor + user-select cascade to ALL SVG
   children (text included), so dragging works equally over month labels. */
.chart.is-pannable {
  cursor: grab;
  user-select: none;
  -webkit-user-select: none;
  touch-action: pan-y;
}
.chart.is-pannable.is-dragging { cursor: grabbing; }
.chart text {
  cursor: inherit;
  user-select: none;
  -webkit-user-select: none;
}

/* Crosshair: faint dotted lines that follow the cursor. */
.chart__crosshair {
  visibility: hidden;
  pointer-events: none;
}
.chart__crosshair.is-visible { visibility: visible; }
.chart__crosshair line {
  stroke: #000000;
  stroke-opacity: 0.18;
  stroke-width: 0.5;
  stroke-dasharray: 2 3;
  shape-rendering: crispEdges;
}
.chart__bg {
  fill: #faf9f5;
}
.chart__grid line {
  stroke: var(--chart-grey);
  stroke-width: 0.1;
}
.chart__grid line.chart__grid-minor {
  stroke: #e3e1da;
  stroke-width: 0.5;
  shape-rendering: crispEdges;
}
.chart__ylabel text,
.chart__xlabel text {
  font-size: 10px;
  font-weight: 300;
  fill: var(--chart-grey);
}
.chart__yaxis-title {
  font-size: 10px;
  font-weight: 300;
  fill: var(--chart-grey);
}

/* Data-point circles — hidden by default; crosshair shows the nearest one. */
.chart__circle {
  fill: var(--circle-color);
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.1s ease;
}
.chart__circle.is-highlighted {
  opacity: 1;
}

/* Chart tooltip. */
.chart-tooltip {
  position: fixed;
  z-index: 100;
  pointer-events: none;
  background: rgba(255, 255, 255, 0.9);
  color: var(--text-black);
  padding: 11px 12px;
  border-radius: 4px;
  font-family: 'Poppins', sans-serif;
  line-height: 1.4;
  box-shadow: 0 0 6px rgba(0, 0, 0, 0.18);
  opacity: 0;
}
.chart-tooltip.is-visible { opacity: 1; }
.chart-tooltip__date {
  font-size: 8px;
  font-weight: 300;
  color: var(--text-black);
  margin-bottom: 5px;
}
.chart-tooltip__row {
  display: flex;
  align-items: center;
  gap: 5px;
  white-space: nowrap;
}
.chart-tooltip__row + .chart-tooltip__row { margin-top: 7px; }
.chart-tooltip__swatch {
  display: inline-block;
  width: 14px;
  height: 14px;
  border-radius: 4px;
  flex-shrink: 0;
}
.chart-tooltip__label {
  flex: 1;
  font-size: 10px;
  font-weight: 300;
  color: var(--text-black);
}
.chart-tooltip__value {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-black);
}

/* --- Text button --- */
.text-btn {
  background: transparent;
  border: none;
  padding: 0;
  font-family: 'Poppins', sans-serif;
  font-size: 9px;
  font-weight: 500;
  color: var(--text-black);
  cursor: pointer;
  line-height: 1.4;
  text-decoration: underline;
  text-decoration-thickness: 0.5px;
  text-underline-offset: 3px;
}
.text-btn:hover { text-decoration: none; }

/* --- Responsive --- */
@media (max-width: 1440px) {
  .chart { height: 231px; }
  .chart-overlay-tools { bottom: 22px; }
  .main__title { font-size: 17px; }
  .chart-card__title { font-size: 14px; }
  .chart-modal__title { font-size: 13px; }
}
@media (max-width: 1280px) {
  .main { padding: 40px 24px; }
}
@media (max-width: 1024px) {
  .main { padding: 32px 20px; }
  .main__title { font-size: 18px; margin-bottom: 24px; }
  .topbar { padding: 12px 20px; gap: 16px; }
  .topbar__nav { gap: 24px; }
  .chart-card { padding: 20px 18px; }
  .card-grid { gap: 18px; }
}
@media (max-width: 820px) {
  .card-grid { grid-template-columns: 1fr; gap: 14px; }
}
@media (max-width: 640px) {
  .main { padding: 20px 10px; }
  .main__title { font-size: 21px; margin-bottom: 16px; }
  .card-grid { gap: 28px; }

  .topbar {
    display: grid;
    grid-template-columns: auto 1fr auto;
    grid-template-areas: "burger logo profile";
    align-items: center;
    column-gap: 12px;
    padding: 18px 16px;
  }
  .topbar__burger {
    display: inline-flex;
    grid-area: burger;
  }
  .topbar__logo {
    grid-area: logo;
    justify-self: center;
  }
  .topbar__nav { display: none; }
  .topbar__right { display: contents; }
  .topbar__right .pill { display: none; }
  /* Hide the brand-switch dropdown wrapper too — otherwise its (block)
     wrapper still claims a grid cell and bumps profile to a new row. */
  .topbar__right .topbar__nav-dropdown--pill { display: none; }
  /* `display: contents` makes .topbar__profile-dropdown the grid item, so
     the grid-area must go on the wrapper, not the inner button. */
  .topbar__profile-dropdown {
    grid-area: profile;
    justify-self: end;
  }
  .topbar__mobile-menu {
    display: block;          /* drawer is position:fixed, not in the grid */
    transform: translateX(-100%);
  }
  .topbar__mobile-close { display: inline-flex; }
  .mobile-backdrop { display: block; }

  .topbar__profile img { width: 30px; height: 30px; }
  .topbar__logo img { height: 34px; }

  .topbar__burger { width: 32px; height: 32px; }
  .topbar__burger-icon img { width: 20px; height: 20px; }
  .topbar__burger-icon--x img { width: 18px; height: 18px; }

  .topbar__mobile-item { font-size: 16px; padding: 10px 14px; }
  .topbar__mobile-item--brand,
  .topbar__mobile-item--upgrade { font-size: 15px; height: 40px; padding: 10px 18px; }

  .chart-card { padding: 18px 12px; }
  .chart-card__top { margin: 0 8px 10px 10px; gap: 12px; }
  .chart-card__title { font-size: 19px; margin: 0 0 10px; }
  .chart-card__desc { font-size: 15px; }
  .legend { gap: 6px; row-gap: 8px; margin: 0 8px 16px 10px; }
  .legend__item { font-size: 13px; padding-right: 6px; }
  .legend__box { width: 16px; height: 16px; }
  .legend__box img { width: 9px; height: 9px; }
  .chart-card__footer { gap: 12px; margin: 12px 8px 0 10px; }
  .tracker-dropdown { font-size: 14px; padding: 9px 12px; }
  .text-btn { font-size: 13px; }
  .chart__ylabel text,
  .chart__xlabel text { font-size: 9px; }
  .chart__yaxis-title { font-size: 9px; }

  .pie-legend { gap: 4px; }
  .pie-legend__row {
    font-size: 12px;
    grid-template-columns: 10px 1fr auto;
    gap: 8px;
  }
  .pie-legend__swatch { width: 10px; height: 10px; }
  .pie__centre-label { font-size: 15px; }

  .speedo-legend { gap: 8px 14px; }
  .speedo-legend__item { font-size: 12px; gap: 6px; }
  .speedo-legend__dot { width: 10px; height: 10px; }

  .chart-card__desc.is-collapsed {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
  }
  .read-more-btn {
    display: inline-block;
    margin-top: 8px;
    background: transparent;
    border: none;
    padding: 0;
    font-family: 'Poppins', sans-serif;
    font-size: 13px;
    font-weight: 500;
    color: var(--text-black);
    cursor: pointer;
    text-decoration: underline;
    text-decoration-thickness: 0.5px;
    text-underline-offset: 3px;
  }
  .read-more-btn:hover { text-decoration: none; }
}

/* === Mobile chart modal (bottom sheet, portrait) === */
.chart-modal {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 200;
}
.chart-modal.is-open { display: block; }
.chart-modal__backdrop {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.52);
}
.chart-modal__sheet {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: #ffffff;
  border-radius: 20px 20px 0 0;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  box-shadow: 0 -6px 28px rgba(0, 0, 0, 0.16);
  overflow: hidden;
  padding-bottom: env(safe-area-inset-bottom, 0px);
}
.chart-modal__handle {
  width: 40px;
  height: 4px;
  background: #d8d5cf;
  border-radius: 2px;
  margin: 12px auto 4px;
  flex-shrink: 0;
}
.chart-modal__header {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 16px 12px;
  flex-shrink: 0;
}
.chart-modal__title {
  flex: 1;
  min-width: 0;
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-black);
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.chart-modal__close {
  width: 32px;
  height: 32px;
  border: none;
  background: #f0eeea;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}
.chart-modal__close img { width: 12px; height: 12px; display: block; }
.chart-modal__body {
  flex: 1;
  min-height: 0;
  padding: 16px 14px 20px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}
.chart-modal__body .chart {
  width: 100%;
  height: 240px !important;
  display: block;
  flex-shrink: 0;
}
.chart-modal__body .pie-area {
  flex: 1;
  min-height: 200px;
  width: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
}

/* Phone landscape: full-screen modal so chart gets maximum width */
@media (max-height: 500px) and (max-width: 900px) {
  .chart-modal__sheet {
    top: 0;
    border-radius: 0;
    max-height: 100%;
    box-shadow: none;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }
  .chart-modal__handle { display: none; }
  .chart-modal__body .chart {
    height: calc(100svh - 92px) !important;
  }
}

/* ============================================================
   Add Tracker / Setup flow
   ============================================================ */

/* Outer wrapper — centres the card and steps vertically in the main area */
.setup-wrap {
  max-width: 820px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 28px;
}

/* Step panel show/hide */
.setup-step-panel--hidden { display: none; }

/* === Step indicator === */
.setup-steps {
  display: flex;
  align-items: center;
  gap: 0;
  justify-content: center;
  padding: 0 4px;
}
.setup-steps__item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
}
.setup-steps__dot {
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #e4eaf4;
  color: #a0aec0;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, color 0.2s ease;
}
.setup-steps__item.is-active .setup-steps__dot {
  background: var(--deep-blue);
  color: #ffffff;
}
.setup-steps__label {
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: #a0aec0;
  white-space: nowrap;
  transition: color 0.2s ease;
}
.setup-steps__item.is-active .setup-steps__label {
  color: var(--text-black);
}
/* Completed step: dot becomes a filled tick-style using green */
.setup-steps__item.is-done .setup-steps__dot {
  background: var(--green);
  color: #ffffff;
}
.setup-steps__item.is-done .setup-steps__label {
  color: var(--chart-grey);
}
.setup-steps__line {
  flex: 1;
  height: 1.5px;
  background: #dce4f0;
  margin: 0 12px;
  margin-bottom: 22px; /* aligns with dot centre, accounting for label below */
}

/* === Setup card === */
.setup-card {
  background: #ffffff;
  border-radius: 8px;
  padding: 40px 40px 36px;
  box-shadow: 0 0 10px rgba(0, 0, 0, 0.25);
}

.setup-card__header {
  margin-bottom: 30px;
}
.setup-card__title {
  font-family: 'Poppins', sans-serif;
  font-size: 20px;
  font-weight: 600;
  color: var(--text-black);
  margin: 0 0 12px;
  line-height: 1.25;
}
.setup-card__desc {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 300;
  line-height: 1.6;
  color: var(--text-black);
  margin: 0;
}

/* === Form layout === */
.setup-form {
  display: flex;
  flex-direction: column;
  gap: 16px;
}
/* Step 3 field-set containers (B2C / B2B divs) inherit the same gap */
#step3-b2c-fields,
#step3-b2b-fields {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

/* Two-column row for paired fields (name+url, industry+location) */
.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 18px;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
}
.form-group--full {
  grid-column: 1 / -1;
}

.form-label {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 600;
  color: var(--text-black);
  line-height: 1.3;
}
.form-required {
  color: var(--red-orange);
  font-weight: 600;
}
.form-hint {
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 300;
  color: var(--chart-grey);
  margin: 0 0 6px;
  line-height: 1.4;
}
.form-error {
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: var(--red-orange);
  line-height: 1.3;
  display: block;
}

/* Text / URL inputs */
.form-input {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-black);
  background: #f7f9fc;
  border: 1px solid #dce4f0;
  border-radius: 6px;
  padding: 10px 13px;
  width: 100%;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  -webkit-appearance: none;
}
.form-input::placeholder { color: #b0bdd0; }
.form-input:focus {
  border-color: var(--deep-blue);
  box-shadow: 0 0 0 3px rgba(117, 138, 187, 0.15);
}
.form-input.is-invalid {
  border-color: var(--red-orange);
  box-shadow: 0 0 0 3px rgba(252, 151, 134, 0.15);
}

/* Select */
.form-select-wrap {
  position: relative;
}
.form-select {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 400;
  color: var(--text-black);
  background: #f7f9fc;
  border: 1px solid #dce4f0;
  border-radius: 6px;
  padding: 10px 34px 10px 13px;
  width: 100%;
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
}
.form-select option[value=""][disabled] { color: #b0bdd0; }
.form-select:focus {
  border-color: var(--deep-blue);
  box-shadow: 0 0 0 3px rgba(117, 138, 187, 0.15);
}
.form-select.is-invalid {
  border-color: var(--red-orange);
  box-shadow: 0 0 0 3px rgba(252, 151, 134, 0.15);
}
.form-select-arrow {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  width: 9px;
  height: 7px;
  display: block;
  pointer-events: none;
}

/* Inline error (sits beside a product/keyword input row) */
.form-error--inline {
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 500;
  color: var(--red-orange);
  white-space: nowrap;
  display: block;
  min-height: 14px;
}

/* === B2C / B2B toggle cards === */
.toggle-card-group {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.toggle-card {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  background: #f7f9fc;
  border: 1.5px solid #dce4f0;
  border-radius: 8px;
  padding: 14px 16px;
  cursor: pointer;
  text-align: left;
  transition: border-color 0.15s ease, background 0.15s ease;
  font-family: 'Poppins', sans-serif;
}
.toggle-card:hover {
  border-color: var(--deep-blue);
  background: #edf1f9;
}
.toggle-card.is-active {
  border-color: var(--deep-blue);
  background: #edf1f9;
}
.toggle-card__radio {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 1.5px solid #c4cfe0;
  flex-shrink: 0;
  margin-top: 2px;
  position: relative;
  transition: border-color 0.15s ease, background 0.15s ease;
}
.toggle-card.is-active .toggle-card__radio {
  border-color: var(--deep-blue);
  background: var(--deep-blue);
}
.toggle-card.is-active .toggle-card__radio::after {
  content: '';
  position: absolute;
  inset: 3px;
  border-radius: 50%;
  background: #ffffff;
}
.toggle-card__body {
  display: flex;
  flex-direction: column;
  gap: 3px;
}
.toggle-card__title {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-black);
  line-height: 1.3;
}
.toggle-card__desc {
  font-size: 10px;
  font-weight: 300;
  color: var(--chart-grey);
  line-height: 1.4;
}

/* === Multi-select toggle buttons === */
.toggle-group {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.toggle-btn {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 500;
  color: var(--text-black);
  background: #f7f9fc;
  border: 1px solid #dce4f0;
  border-radius: 20px;
  padding: 8px 16px;
  cursor: pointer;
  transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
  white-space: nowrap;
  line-height: 1;
}
.toggle-btn:hover {
  border-color: var(--deep-blue);
  background: #edf1f9;
}
.toggle-btn.is-active {
  background: var(--deep-blue);
  border-color: var(--deep-blue);
  color: #ffffff;
}

/* === Flagship product inputs === */
.product-inputs {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.product-inputs--prompts {
  gap: 18px;
}
.product-input-row {
  display: flex;
  align-items: center;
  gap: 10px;
}
.product-input-num {
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 600;
  color: var(--deep-blue);
  width: 18px;
  flex-shrink: 0;
  text-align: center;
}
.product-input-num--optional {
  color: #b0bdd0;
}

.prompt-tag {
  display: inline-block;
  font-size: 11px;
  font-weight: 600;
  line-height: 1;
  padding: 4px 10px;
  border-radius: 4px;
  background: rgba(99, 102, 241, 0.1);
  color: #6366f1;
  white-space: nowrap;
}

/* === Form actions row === */
.setup-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 8px;
}
.setup-actions__hint {
  font-family: 'Poppins', sans-serif;
  font-size: 10px;
  font-weight: 300;
  color: var(--chart-grey);
}

/* Half-width form group (for price segment) */
.form-group--half {
  max-width: calc(50% - 9px);
}

/* Back button */
.btn-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  color: var(--chart-grey);
  background: transparent;
  border: none;
  padding: 11px 0;
  cursor: pointer;
  transition: color 0.15s ease;
  line-height: 1;
}
.btn-back:hover { color: var(--text-black); }

/* Next / submit button */
.btn-next {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 600;
  color: #ffffff;
  background: var(--deep-blue);
  border: none;
  border-radius: 8px;
  padding: 11px 22px;
  cursor: pointer;
  transition: filter 0.15s ease, transform 0.1s ease;
  line-height: 1;
}
.btn-next:hover { filter: brightness(1.1); }
.btn-next:active { transform: scale(0.98); }

/* === Responsive === */
@media (max-width: 640px) {
  .setup-card {
    padding: 28px 20px 24px;
  }
  .setup-card__title { font-size: 18px; }
  .setup-card__desc { font-size: 13px; }
  .form-row { grid-template-columns: 1fr; gap: 16px; }
  .form-group--half { max-width: 100%; }
  .toggle-card-group { grid-template-columns: 1fr; }
  .setup-steps__label { display: none; }
  .setup-steps__line { margin-bottom: 0; }
  .setup-actions { flex-direction: column; align-items: flex-end; gap: 10px; }
  .btn-next { font-size: 14px; padding: 12px 26px; }
  /* 16px prevents iOS Safari auto-zoom on input focus */
  .form-input,
  .form-select,
  .weight-row__value { font-size: 16px; }
  .plan-grid { grid-template-columns: 1fr !important; }
}

/* === Settings page view === */
.settings-view { display: none; }
/* Settings view is wider than the Add Tracker flow — more room for the
   weight sliders so each row reads cleanly on desktop. */
.settings-view .setup-wrap { max-width: 960px; }
@media (min-width: 1100px) {
  .settings-view .setup-card { padding: 48px 56px 44px; }
}
.sview__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.sview__close {
  background: transparent;
  border: none;
  width: 36px;
  height: 36px;
  padding: 0;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: background 0.15s ease;
}
.sview__close:hover { background: #f4f4f4; }
.sview__close img { width: 14px; height: 14px; display: block; }

/* === Tracker list === */
.tracker-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.tracker-item {
  display: flex;
  align-items: center;
  gap: 16px;
  background: #f7f9fc;
  border: 1px solid #dce4f0;
  border-radius: 8px;
  padding: 16px 18px;
  transition: border-color 0.15s ease;
}
.tracker-item:hover { border-color: var(--deep-blue); }
.tracker-item__bar {
  width: 4px;
  align-self: stretch;
  border-radius: 2px;
  background: var(--tracker-colour, var(--deep-blue));
  flex-shrink: 0;
}
.tracker-item__info {
  flex: 1;
  min-width: 0;
}
.tracker-item__name {
  font-family: 'Poppins', sans-serif;
  font-size: 14px;
  font-weight: 600;
  color: var(--text-black);
  margin-bottom: 4px;
}
.tracker-item__meta {
  display: flex;
  flex-wrap: wrap;
  gap: 6px 18px;
  font-family: 'Poppins', sans-serif;
  font-size: 11px;
  font-weight: 300;
  color: var(--chart-grey);
}
.tracker-item__meta strong {
  font-weight: 600;
  color: var(--text-black);
}
.tracker-item__edit {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--deep-blue);
  background: transparent;
  border: 1px solid var(--deep-blue);
  border-radius: 6px;
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.15s ease, color 0.15s ease;
}
.tracker-item__edit:hover {
  background: var(--deep-blue);
  color: #ffffff;
}
.tracker-item__actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}
.tracker-item__duplicate {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: var(--chart-grey);
  background: transparent;
  border: 1px solid #dce4f0;
  border-radius: 6px;
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.tracker-item__duplicate:hover {
  border-color: var(--deep-blue);
  color: var(--deep-blue);
}
.tracker-item__duplicate:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.tracker-item__run {
  font-family: 'Poppins', sans-serif;
  font-size: 12px;
  font-weight: 500;
  color: #fff;
  background: var(--deep-blue);
  border: 1px solid var(--deep-blue);
  border-radius: 6px;
  padding: 7px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, opacity 0.15s ease;
}
.tracker-item__run:hover {
  opacity: 0.85;
}
.tracker-item__run:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* === Switch — small on/off pill (tracker weekly auto-run, widget toggles) === */
.switch {
  position: relative;
  width: 38px;
  height: 22px;
  flex-shrink: 0;
  align-self: center;
  background: #dce4f0;
  border: none;
  border-radius: 11px;
  cursor: pointer;
  padding: 0;
  transition: background 0.2s ease;
}
.switch__knob {
  position: absolute;
  top: 3px;
  left: 3px;
  width: 16px;
  height: 16px;
  background: #ffffff;
  border-radius: 50%;
  box-shadow: 0 1px 3px rgba(31, 38, 62, 0.25);
  transition: transform 0.2s ease;
}
.switch.is-on {
  background: var(--green);
}
.switch.is-on .switch__knob {
  transform: translateX(16px);
}
.switch:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}
.switch:focus-visible {
  outline: 2px solid var(--deep-blue);
  outline-offset: 2px;
}

@media (max-width: 640px) {
  .tracker-item { flex-wrap: wrap; gap: 10px; padding: 14px; }
  .tracker-item__meta { font-size: 12px; }
  .tracker-item__actions { width: 100%; }
  .tracker-item__edit,
  .tracker-item__duplicate,
  .tracker-item__run { flex: 1; text-align: center; }
}

/* === Colour picker === */
.colour-picker {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}
.colour-swatch {
  width: 28px;
  height: 28px;
  border-radius: 6px;
  border: 2px solid transparent;
  background: var(--swatch-bg, #ccc);
  cursor: pointer;
  padding: 0;
  transition: border-color 0.15s ease, transform 0.1s ease;
}
.colour-swatch:hover { transform: scale(1.12); }
.colour-swatch.is-active {
  border-color: var(--text-black);
  box-shadow: 0 0 0 2px #fff, 0 0 0 4px var(--text-black);
}

/* === Disabled button states === */
.btn-next:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  filter: none;
}
.btn-next:disabled:hover { filter: none; }
.btn-next:disabled:active { transform: none; }
.btn-back:disabled {
  opacity: 0.45;
  cursor: not-allowed;
}

/* === Focus-visible === */
.btn-next:focus-visible,
.btn-back:focus-visible,
.pill:focus-visible,
.topbar__burger:focus-visible,
.topbar__profile:focus-visible,
.chart-card__enlarge:focus-visible,
.legend__item:focus-visible,
.overlay-btn:focus-visible,
.tracker-dropdown:focus-visible,
.text-btn:focus-visible,
.toggle-card:focus-visible,
.toggle-btn:focus-visible,
.colour-swatch:focus-visible,
.tracker-item__edit:focus-visible,
.tracker-item__duplicate:focus-visible,
.tracker-item__run:focus-visible,
.profile-menu__item:focus-visible,
.topbar__nav-dropdown-toggle:focus-visible,
.topbar__mobile-item:focus-visible,
.sview__close:focus-visible,
.chart-modal__close:focus-visible,
.settings-reset:focus-visible {
  outline: 2px solid var(--deep-blue);
  outline-offset: 2px;
}
.topbar__nav a:focus-visible {
  outline: 2px solid var(--deep-blue);
  outline-offset: 4px;
}
.form-input:focus-visible,
.form-select:focus-visible {
  outline: none;
}

/* === Skip to content === */
.skip-link {
  position: absolute;
  top: -100%;
  left: 16px;
  z-index: 100;
  background: var(--deep-blue);
  color: #fff;
  padding: 8px 16px;
  border-radius: 0 0 6px 6px;
  font-family: 'Poppins', sans-serif;
  font-size: 13px;
  font-weight: 500;
  text-decoration: none;
}
.skip-link:focus {
  top: 0;
}
