/* ============================================================================
   LIQUID GLASS + MAILCHIMP ANALYTICS
   ============================================================================

   Two things live in this file:

     1. `.lg-*` — a reusable liquid-glass material. Generic on purpose; nothing
        in it knows what Mailchimp is.
     2. `.mc-*` — the Mailchimp Analytics tab, built on top of it.

   HOW THE GLASS IS PUT TOGETHER — four stacked layers, in paint order:

     backdrop   an atmosphere painted *behind* the glass (.lg-atmosphere).
                Glass over a flat fill is just a grey box: refraction and
                saturation have nothing to act on. The drifting colour field is
                what makes the material read as glass, so it is part of the
                material, not decoration.
     lens       ::before — `backdrop-filter: url(#lg-lens)`, an SVG
                displacement map that bends the backdrop at the rim, with the
                RGB channels displaced by slightly different amounts (real
                chromatic aberration, not a coloured shadow faking it).
                Progressive enhancement: it only turns on under
                `html.lg-lens`, which mailchimp.js sets after testing that the
                browser actually parses a url() backdrop-filter.
     body       the element itself — blur + saturate + a tint gradient. This is
                the layer that must look right *alone*, because it is all a
                browser without url() backdrop-filter support will show.
     specular   ::after — the bevel. A bright arc where light catches the top
                edge and a dimmer one on the bottom, plus a sheen that tracks
                the pointer (--lg-mx/--lg-my) the way Apple's glass tracks
                device tilt.

   Light mode is NOT the dark values inverted. Dark glass is a dark tint with a
   bright rim and almost no shadow; light glass is a *white* material — white
   tint, high saturation, a crisp white top rim, a soft dark bottom rim, and a
   real drop shadow, because on a light page the shadow is the only thing
   separating the card from the surface. Two things that need holding onto
   there: the tint has to stay well below opaque (past ~0.6 the colour field
   stops coming through and every card reads as flat paper), and the sheen needs
   different geometry, since soft-light does nothing over white.
   ============================================================================ */

/* ────────────────────────────────────────────────────────────────────────────
   1. Material tokens
   ──────────────────────────────────────────────────────────────────────────── */
.mc-root,
.lg-scope {
  /* Blur strength per surface weight */
  --lg-blur-thin: 14px;
  --lg-blur: 22px;
  --lg-blur-thick: 40px;
  --lg-saturate: 180%;
  --lg-brightness: 1.06;

  /* Tint — the glass's own colour, over whatever is behind it */
  --lg-tint-top: rgba(255, 255, 255, 0.085);
  --lg-tint-bottom: rgba(255, 255, 255, 0.028);
  --lg-tint-solid: rgba(22, 22, 26, 0.55);

  /* Rim: specular highlight (light catching the bevel) and its underside */
  --lg-rim-top: rgba(255, 255, 255, 0.42);
  --lg-rim-bottom: rgba(255, 255, 255, 0.10);
  --lg-rim-side: rgba(255, 255, 255, 0.16);
  --lg-hairline: rgba(255, 255, 255, 0.14);

  /* Depth */
  --lg-shadow:
    0 1px 2px rgba(0, 0, 0, 0.28),
    0 8px 24px -8px rgba(0, 0, 0, 0.55),
    0 24px 60px -24px rgba(0, 0, 0, 0.65);
  --lg-shadow-lift:
    0 2px 4px rgba(0, 0, 0, 0.30),
    0 14px 36px -10px rgba(0, 0, 0, 0.58),
    0 36px 80px -28px rgba(0, 0, 0, 0.70);

  /* Sheen tracked by the pointer */
  --lg-sheen: rgba(255, 255, 255, 0.16);
  --lg-mx: 50%;
  --lg-my: 0%;

  /* Refraction strength, in px of displacement at the rim */
  --lg-lens-scale: 1;

  --lg-r-sm: 14px;
  --lg-r: 22px;
  --lg-r-lg: 28px;

  /* ── Chart palette ─────────────────────────────────────────────────────────
     Validated with the dataviz six-checks against the glass surface these
     actually render on (#17171a dark / #f7f7f8 light), not against a page
     background they never touch. Slots are assigned to *entities* — opens are
     blue everywhere in the suite, clicks are orange everywhere — so a filter
     that removes a series never repaints the survivors.

     Two documented WARNs, both with the required relief in place:
       · subs↔unsubs sit at CVD ΔE 6.5 (dark) / 6.9 (light). The growth chart
         puts subscribes above the zero line and unsubscribes below it, so
         position — not hue — is what carries the sign, and both are legended
         and direct-labelled.
       · subs green is 2.63:1 on the light surface. Every figure it encodes is
         also present as a visible label and in the table view. */
  --mc-opens: #3987e5;
  --mc-clicks: #d95926;
  --mc-subs: #199e70;
  --mc-unsubs: #e66767;

  /* Ordinal ramp for engagement tiers — one hue, monotone lightness, four
     steps. Ordered by CONTRAST against the surface, not by raw lightness:
     tier-4 is always the loudest step, so "Champions" is the most prominent
     bar in both themes. That means the dark ramp runs the opposite direction
     to the light one. */
  --mc-tier-1: #184f95;
  --mc-tier-2: #3987e5;
  --mc-tier-3: #86b6ef;
  --mc-tier-4: #b7d3f6;

  /* Chart chrome */
  --mc-grid: rgba(255, 255, 255, 0.07);
  --mc-axis: rgba(255, 255, 255, 0.16);
  --mc-ink: var(--text-primary);
  --mc-ink-2: var(--text-secondary);
  /* Not --text-tertiary: at #444 it is legible on a flat card but disappears
     against blurred glass. Label ink is set from the text colour's own alpha
     so it stays readable whatever the material is sitting over. */
  --mc-ink-3: rgba(232, 232, 232, 0.58);

  /* Status — only ever for direction cues, never as a series colour */
  --mc-good: #0ca30c;
  --mc-bad: #d03b3b;
}

[data-theme="light"] .mc-root,
[data-theme="light"] .lg-scope {
  /* Light glass is white, but not opaque-white: at 0.72/0.48 the colour field
     behind it was completely washed out and every card read as flat paper.
     These let enough through that the material still behaves like glass. */
  --lg-tint-top: rgba(255, 255, 255, 0.56);
  --lg-tint-bottom: rgba(255, 255, 255, 0.30);
  --lg-tint-solid: rgba(255, 255, 255, 0.86);
  --lg-saturate: 200%;
  --lg-brightness: 1.02;

  --lg-rim-top: rgba(255, 255, 255, 0.95);
  --lg-rim-bottom: rgba(15, 20, 30, 0.10);
  --lg-rim-side: rgba(255, 255, 255, 0.60);
  --lg-hairline: rgba(15, 23, 42, 0.09);

  --lg-shadow:
    0 1px 1px rgba(15, 23, 42, 0.04),
    0 6px 16px -6px rgba(15, 23, 42, 0.12),
    0 20px 44px -20px rgba(15, 23, 42, 0.18);
  --lg-shadow-lift:
    0 2px 4px rgba(15, 23, 42, 0.06),
    0 12px 28px -8px rgba(15, 23, 42, 0.16),
    0 32px 68px -24px rgba(15, 23, 42, 0.22);

  --lg-sheen: rgba(255, 255, 255, 0.62);

  --mc-opens: #2a78d6;
  --mc-clicks: #e8640a;
  --mc-subs: #1baf7a;
  --mc-unsubs: #e34948;

  /* Light ramp runs the other way — see the dark block. tier-4 stays the
     loudest step in both. */
  --mc-tier-1: #6da7ec;
  --mc-tier-2: #3987e5;
  --mc-tier-3: #256abf;
  --mc-tier-4: #104281;

  --mc-grid: rgba(15, 23, 42, 0.09);
  --mc-axis: rgba(15, 23, 42, 0.20);
  --mc-ink-3: rgba(17, 17, 17, 0.55);
}

/* A flat #f5f5f5 plane gives the glass nothing to work with. This is still
   near-white, just not uniform. */
[data-theme="light"] .lg-atmosphere {
  background:
    radial-gradient(120% 90% at 15% 0%, #ffffff 0%, rgba(255, 255, 255, 0) 55%),
    linear-gradient(170deg, #f2f3f6 0%, #eceef2 45%, #f4f2ef 100%);
}

/* Y2K opts out of the material entirely — translucency and 22px radii would
   fight a theme whose whole idea is hard bevels and zero radius. */
[data-theme="y2k"] .mc-root {
  --lg-tint-top: var(--bg-card);
  --lg-tint-bottom: var(--bg-card);
  --lg-tint-solid: var(--bg-card);
  --lg-rim-top: transparent;
  --lg-rim-bottom: transparent;
  --lg-rim-side: transparent;
  --lg-hairline: var(--border-strong);
  --lg-shadow: var(--shadow-sm);
  --lg-shadow-lift: var(--shadow-md);
  --lg-r-sm: 0px;
  --lg-r: 0px;
  --lg-r-lg: 0px;
  --mc-grid: rgba(0, 0, 0, 0.10);
  --mc-axis: rgba(0, 0, 0, 0.35);
  /* Must be redeclared: the base value is near-white for dark glass, which is
     invisible on this theme's cream. Every label and axis tick reads from it. */
  --mc-ink-3: rgba(21, 21, 21, 0.66);
}

[data-theme="y2k"] .lg,
[data-theme="y2k"] .lg-atmosphere {
  backdrop-filter: none !important;
  -webkit-backdrop-filter: none !important;
}

[data-theme="y2k"] .lg::before,
[data-theme="y2k"] .lg::after,
[data-theme="y2k"] .lg-atmosphere > * {
  display: none;
}

/* ────────────────────────────────────────────────────────────────────────────
   2. The atmosphere — what the glass has to refract
   ──────────────────────────────────────────────────────────────────────────── */
.lg-atmosphere {
  position: absolute;
  inset: 0;
  overflow: hidden;
  pointer-events: none;
  z-index: 0;
  background: var(--bg-primary);
}

.lg-blob {
  position: absolute;
  border-radius: 50%;
  filter: blur(70px);
  will-change: transform;
  opacity: 0.55;
}

/* Three drifting fields at different speeds. Slow enough (40–70s) that the
   movement is felt behind the glass rather than watched. */
.lg-blob-1 {
  width: 46vw; height: 46vw; min-width: 380px; min-height: 380px;
  left: -8vw; top: -12vw;
  background: radial-gradient(circle at 50% 50%, rgba(249, 115, 22, 0.55), rgba(249, 115, 22, 0) 68%);
  animation: lg-drift-1 52s var(--ease-smooth, ease-in-out) infinite alternate;
}

.lg-blob-2 {
  width: 52vw; height: 52vw; min-width: 420px; min-height: 420px;
  right: -14vw; top: 8vh;
  background: radial-gradient(circle at 50% 50%, rgba(56, 132, 229, 0.42), rgba(56, 132, 229, 0) 68%);
  animation: lg-drift-2 67s var(--ease-smooth, ease-in-out) infinite alternate;
}

.lg-blob-3 {
  width: 40vw; height: 40vw; min-width: 320px; min-height: 320px;
  left: 26vw; bottom: -16vw;
  background: radial-gradient(circle at 50% 50%, rgba(25, 158, 112, 0.34), rgba(25, 158, 112, 0) 68%);
  animation: lg-drift-3 44s var(--ease-smooth, ease-in-out) infinite alternate;
}

[data-theme="light"] .lg-blob { opacity: 0.62; filter: blur(84px); }
[data-theme="light"] .lg-blob-1 { background: radial-gradient(circle at 50% 50%, rgba(232, 100, 10, 0.42), rgba(232, 100, 10, 0) 68%); }
[data-theme="light"] .lg-blob-2 { background: radial-gradient(circle at 50% 50%, rgba(42, 120, 214, 0.38), rgba(42, 120, 214, 0) 68%); }
[data-theme="light"] .lg-blob-3 { background: radial-gradient(circle at 50% 50%, rgba(27, 175, 122, 0.30), rgba(27, 175, 122, 0) 68%); }

@keyframes lg-drift-1 {
  from { transform: translate3d(0, 0, 0) scale(1); }
  to   { transform: translate3d(9vw, 7vh, 0) scale(1.18); }
}
@keyframes lg-drift-2 {
  from { transform: translate3d(0, 0, 0) scale(1.1); }
  to   { transform: translate3d(-11vw, 12vh, 0) scale(0.92); }
}
@keyframes lg-drift-3 {
  from { transform: translate3d(0, 0, 0) scale(0.95); }
  to   { transform: translate3d(7vw, -9vh, 0) scale(1.2); }
}

/* Micro-texture. Real glass is never optically perfect; without this the
   material reads as plastic. Kept at 3.5% — visible as tooth, not as noise. */
.lg-grain {
  position: absolute;
  inset: -50%;
  pointer-events: none;
  opacity: 0.035;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='140' height='140'%3E%3Cfilter id='n'%3E%3CfeTurbulence type='fractalNoise' baseFrequency='0.85' numOctaves='3' stitchTiles='stitch'/%3E%3C/filter%3E%3Crect width='140' height='140' filter='url(%23n)'/%3E%3C/svg%3E");
  mix-blend-mode: overlay;
}

[data-theme="light"] .lg-grain { opacity: 0.05; mix-blend-mode: multiply; }

/* ────────────────────────────────────────────────────────────────────────────
   3. The glass surface
   ──────────────────────────────────────────────────────────────────────────── */
.lg {
  position: relative;
  isolation: isolate;
  border-radius: var(--lg-r);
  background-image: linear-gradient(160deg, var(--lg-tint-top), var(--lg-tint-bottom));
  backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  -webkit-backdrop-filter: blur(var(--lg-blur)) saturate(var(--lg-saturate)) brightness(var(--lg-brightness));
  box-shadow:
    var(--lg-shadow),
    inset 0 1px 0 0 var(--lg-rim-top),
    inset 0 -1px 0 0 var(--lg-rim-bottom),
    inset 1px 0 0 0 var(--lg-rim-side),
    inset -1px 0 0 0 var(--lg-rim-side);
  border: 1px solid var(--lg-hairline);
  color: var(--text-primary);
  transition: box-shadow 0.4s var(--ease-out, ease), transform 0.4s var(--ease-out, ease);
}

/* No backdrop-filter at all (older Firefox, forced-colors): fall back to an
   opaque tint. Translucency was the effect, so replace it — don't leave the
   card sitting transparent over the blobs, which would be unreadable. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
  .lg { background-image: none; background-color: var(--lg-tint-solid); }
}

.lg-thin { --lg-blur: var(--lg-blur-thin); }
.lg-thick { --lg-blur: var(--lg-blur-thick); }
.lg-sm { border-radius: var(--lg-r-sm); }
.lg-lg { border-radius: var(--lg-r-lg); }
.lg-pill { border-radius: 999px; }

/* ── Layer 2: the rim lens ────────────────────────────────────────────────────
   Masked to the outer ring. The displacement map is already neutral through the
   middle, so the mask is a cost control, not a correctness fix: it keeps the
   expensive filter off the large flat centre of every card. */
html.lg-lens .lg-refract::before {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: -1;
  backdrop-filter: url(#lg-lens);
  -webkit-backdrop-filter: url(#lg-lens);
  -webkit-mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, transparent 42%, #000 78%);
  mask-image: radial-gradient(ellipse 100% 100% at 50% 50%, transparent 42%, #000 78%);
}

html.lg-lens .lg-refract-strong::before { backdrop-filter: url(#lg-lens-strong); -webkit-backdrop-filter: url(#lg-lens-strong); }

/* ── Layer 4: the bevel ─────────────────────────────────────────────────────── */
.lg::after {
  content: '';
  position: absolute;
  inset: 0;
  border-radius: inherit;
  pointer-events: none;
  z-index: 1;
  background:
    radial-gradient(120% 80% at var(--lg-mx) var(--lg-my), var(--lg-sheen), transparent 58%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.10) 0%, transparent 22%, transparent 78%, rgba(255, 255, 255, 0.04) 100%);
  opacity: 0.55;
  transition: opacity 0.5s var(--ease-out, ease);
  mix-blend-mode: soft-light;
}

/* On white, a soft-light sheen does nothing and a normal-blend one at full
   strength paints a milky blob across the card. Normal blend, tight radius,
   half strength: reads as a glint on the top edge, not a wash. */
[data-theme="light"] .lg::after {
  opacity: 0.5;
  mix-blend-mode: normal;
  background:
    radial-gradient(70% 46% at var(--lg-mx) var(--lg-my), var(--lg-sheen), transparent 62%),
    linear-gradient(180deg, rgba(255, 255, 255, 0.55) 0%, transparent 14%);
}

/* Everything inside a glass surface has to out-stack the bevel. */
.lg > * { position: relative; z-index: 2; }

.lg-interactive { cursor: pointer; }

.lg-interactive:hover {
  transform: translateY(-2px);
  box-shadow:
    var(--lg-shadow-lift),
    inset 0 1px 0 0 var(--lg-rim-top),
    inset 0 -1px 0 0 var(--lg-rim-bottom),
    inset 1px 0 0 0 var(--lg-rim-side),
    inset -1px 0 0 0 var(--lg-rim-side);
}

.lg-interactive:hover::after { opacity: 0.9; }

.lg-interactive:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Someone who has asked for less transparency gets a solid card. The layout,
   type and colour all still work — only the material changes. */
@media (prefers-reduced-transparency: reduce) {
  .lg {
    backdrop-filter: none;
    -webkit-backdrop-filter: none;
    background-image: none;
    background-color: var(--bg-card);
    border-color: var(--border);
  }
  .lg::before, .lg::after { display: none; }
  .lg-atmosphere { background: var(--bg-primary); }
  .lg-blob, .lg-grain { display: none; }
}

@media (prefers-reduced-motion: reduce) {
  .lg-blob { animation: none; }
  .lg, .lg::after { transition: none; }
}

/* ────────────────────────────────────────────────────────────────────────────
   4. Mailchimp tab — shell
   ──────────────────────────────────────────────────────────────────────────── */
.mc-root {
  position: relative;
  height: 100%;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  font-family: var(--font-ui);
  color: var(--text-primary);
}

.mc-scroll {
  position: relative;
  z-index: 1;
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 22px 26px 60px;
  scrollbar-width: thin;
}

.mc-shell {
  max-width: 1440px;
  margin: 0 auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* One section's worth of cards, inside the shell. */
.mc-stack {
  display: flex;
  flex-direction: column;
  gap: 18px;
  min-width: 0;
}

/* ── Header ─────────────────────────────────────────────────────────────────── */
.mc-header {
  display: flex;
  align-items: center;
  gap: 16px;
  padding: 16px 20px;
  flex-wrap: wrap;
}

.mc-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  min-width: 0;
}

.mc-brand-mark {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  flex-shrink: 0;
  background: linear-gradient(150deg, var(--accent-bright), var(--accent-muted));
  box-shadow: 0 4px 14px -4px var(--accent-glow), inset 0 1px 0 rgba(255, 255, 255, 0.35);
  color: #fff;
}

.mc-brand-text { min-width: 0; }

.mc-title {
  margin: 0;
  font-size: 16px;
  font-weight: 650;
  letter-spacing: -0.01em;
  line-height: 1.2;
}

.mc-subtitle {
  margin: 2px 0 0;
  font-size: 11.5px;
  color: var(--text-secondary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.mc-header-spacer { flex: 1 1 auto; min-width: 12px; }

/* ── Segmented section switcher ─────────────────────────────────────────────── */
.mc-segmented {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: 999px;
  position: relative;
}

.mc-seg {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: inherit;
  font-size: 12px;
  font-weight: 550;
  letter-spacing: 0.01em;
  padding: 7px 15px;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  display: flex;
  align-items: center;
  gap: 7px;
  transition: color 0.25s var(--ease-out, ease), background 0.25s var(--ease-out, ease);
}

.mc-seg:hover { color: var(--text-primary); }

.mc-seg-active {
  color: var(--text-primary);
  background: linear-gradient(150deg, rgba(255, 255, 255, 0.16), rgba(255, 255, 255, 0.06));
  box-shadow:
    0 1px 2px rgba(0, 0, 0, 0.25),
    inset 0 1px 0 rgba(255, 255, 255, 0.30);
}

[data-theme="light"] .mc-seg-active {
  background: #fff;
  box-shadow: 0 1px 3px rgba(15, 23, 42, 0.14), inset 0 1px 0 rgba(255, 255, 255, 0.9);
}

.mc-seg svg { flex-shrink: 0; opacity: 0.85; }

/* ── Controls ───────────────────────────────────────────────────────────────── */
.mc-controls {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  flex-wrap: wrap;
}

.mc-control-label {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.09em;
  color: var(--mc-ink-3);
  font-weight: 600;
}

.mc-select {
  appearance: none;
  font-family: inherit;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--lg-hairline);
  border-radius: 10px;
  padding: 7px 30px 7px 11px;
  cursor: pointer;
  max-width: 260px;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23888' stroke-width='2.5' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  transition: border-color 0.2s var(--ease-out, ease), background-color 0.2s var(--ease-out, ease);
}

[data-theme="light"] .mc-select { background-color: rgba(255, 255, 255, 0.85); }

.mc-select:hover { border-color: var(--border-hover); }
.mc-select:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }

.mc-range { display: flex; gap: 2px; padding: 2px; border-radius: 999px; background: rgba(255, 255, 255, 0.05); border: 1px solid var(--lg-hairline); }
[data-theme="light"] .mc-range { background: rgba(255, 255, 255, 0.7); }

.mc-range-btn {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--text-secondary);
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 500;
  padding: 5px 11px;
  border-radius: 999px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out, ease);
}

.mc-range-btn:hover { color: var(--text-primary); }

.mc-range-btn-active {
  color: #fff;
  background: var(--accent);
  box-shadow: 0 1px 6px -1px var(--accent-glow);
}

.mc-btn {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-family: inherit;
  font-size: 12px;
  font-weight: 550;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--lg-hairline);
  border-radius: 10px;
  padding: 7px 13px;
  cursor: pointer;
  transition: all 0.2s var(--ease-out, ease);
  white-space: nowrap;
}

[data-theme="light"] .mc-btn { background: rgba(255, 255, 255, 0.9); }

.mc-btn:hover:not(:disabled) { border-color: var(--border-hover); color: var(--accent); }
.mc-btn:disabled { opacity: 0.5; cursor: default; }
.mc-btn-accent { background: var(--accent); border-color: transparent; color: #fff; }
.mc-btn-accent:hover:not(:disabled) { background: var(--accent-bright); color: #fff; }

/* inline-flex so the rotation has a box to turn — a bare inline span won't. */
.mc-spin { display: inline-flex; animation: mc-spin 0.9s linear infinite; }
@keyframes mc-spin { to { transform: rotate(360deg); } }

/* ── Sample-data badge ──────────────────────────────────────────────────────── */
/* Deliberately loud and permanent. These numbers are invented; nobody should be
   able to screenshot a panel and mistake it for a real audience. */
.mc-sample-bar {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 11px 16px;
  border-radius: var(--lg-r-sm);
  background: repeating-linear-gradient(
    -45deg,
    var(--accent-dim) 0 12px,
    transparent 12px 24px
  ), var(--accent-bloom);
  border: 1px dashed var(--border-accent);
  font-size: 12px;
  color: var(--text-secondary);
}

.mc-sample-tag {
  font-family: var(--font-data);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  color: var(--accent);
  border: 1px solid var(--border-accent);
  border-radius: 5px;
  padding: 3px 7px;
  flex-shrink: 0;
}

/* ── Stat tiles ─────────────────────────────────────────────────────────────── */
.mc-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(178px, 1fr));
  gap: 12px;
}

.mc-stat { padding: 15px 17px 14px; display: flex; flex-direction: column; gap: 8px; min-width: 0; }

.mc-stat-label {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  color: var(--mc-ink-3);
}

.mc-stat-value {
  font-size: 27px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  color: var(--text-primary);
  /* Proportional figures: tabular-nums makes a big standalone number look loose */
}

.mc-stat-unit { font-size: 15px; font-weight: 500; color: var(--text-secondary); margin-left: 1px; }

.mc-stat-foot { display: flex; align-items: center; gap: 7px; flex-wrap: wrap; min-height: 16px; }

.mc-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-data);
  font-size: 11px;
  font-weight: 600;
}

.mc-delta-up { color: var(--mc-good); }
.mc-delta-down { color: var(--mc-bad); }
.mc-delta-flat { color: var(--mc-ink-3); }
.mc-delta-note { font-size: 10.5px; color: var(--mc-ink-3); font-weight: 400; }

.mc-hero { padding: 20px 22px; }
.mc-hero-value { font-size: 46px; font-weight: 620; letter-spacing: -0.03em; line-height: 1; }

/* ── Cards ──────────────────────────────────────────────────────────────────── */
.mc-card { padding: 18px 20px; display: flex; flex-direction: column; gap: 14px; min-width: 0; }
.mc-card-head { display: flex; align-items: flex-start; gap: 12px; flex-wrap: wrap; }
.mc-card-title { margin: 0; font-size: 13.5px; font-weight: 620; letter-spacing: -0.005em; }
.mc-card-sub { margin: 3px 0 0; font-size: 11.5px; color: var(--text-secondary); line-height: 1.45; }
.mc-card-spacer { flex: 1 1 auto; }

.mc-grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(360px, 1fr)); gap: 14px; }
.mc-grid-wide { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(0, 1fr); gap: 14px; }

@media (max-width: 1020px) { .mc-grid-wide { grid-template-columns: minmax(0, 1fr); } }

/* ── Legend ─────────────────────────────────────────────────────────────────── */
.mc-legend { display: flex; align-items: center; gap: 14px; flex-wrap: wrap; }

.mc-legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);   /* never the series colour — identity is the swatch */
}

.mc-legend-key { width: 14px; height: 3px; border-radius: 2px; flex-shrink: 0; }
.mc-legend-key-rect { width: 11px; height: 11px; border-radius: 3px; }

/* ── Charts ─────────────────────────────────────────────────────────────────── */
.mc-chart { position: relative; width: 100%; }
.mc-chart svg { display: block; width: 100%; height: auto; overflow: visible; }
.mc-chart-tick { font-size: 10px; fill: var(--mc-ink-3); font-family: var(--font-data); }
.mc-chart-grid { stroke: var(--mc-grid); stroke-width: 1; }
.mc-chart-axis { stroke: var(--mc-axis); stroke-width: 1; }
.mc-chart-label { font-size: 10.5px; fill: var(--mc-ink-2); font-family: var(--font-ui); font-weight: 600; }

.mc-chart-hit { fill: transparent; cursor: crosshair; }
.mc-crosshair { stroke: var(--mc-axis); stroke-width: 1; pointer-events: none; }

.mc-tooltip {
  position: absolute;
  z-index: 40;
  min-width: 152px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--bg-elevated);
  border: 1px solid var(--lg-hairline);
  box-shadow: var(--lg-shadow);
  pointer-events: none;
  font-size: 11.5px;
  transform: translate(-50%, -100%);
  backdrop-filter: blur(20px) saturate(180%);
  -webkit-backdrop-filter: blur(20px) saturate(180%);
}

[data-theme="light"] .mc-tooltip { background: rgba(255, 255, 255, 0.94); }

.mc-tooltip-head {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--mc-ink-3);
  margin-bottom: 7px;
}

.mc-tooltip-row { display: flex; align-items: center; gap: 8px; margin-top: 4px; }
.mc-tooltip-key { width: 12px; height: 2.5px; border-radius: 2px; flex-shrink: 0; }
.mc-tooltip-value { font-family: var(--font-data); font-weight: 650; color: var(--text-primary); font-size: 12.5px; }
.mc-tooltip-name { color: var(--text-secondary); margin-left: auto; font-size: 11px; }

/* ── Tables ─────────────────────────────────────────────────────────────────── */
.mc-table-wrap { overflow-x: auto; margin: 0 -20px; padding: 0 20px; }
.mc-table { width: 100%; border-collapse: collapse; font-size: 12.5px; }

.mc-table th {
  text-align: left;
  font-size: 10px;
  font-weight: 650;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--mc-ink-3);
  padding: 0 12px 9px 0;
  white-space: nowrap;
  border-bottom: 1px solid var(--lg-hairline);
  background: none;
  font-family: var(--font-ui);
}

.mc-table th.mc-sortable { cursor: pointer; user-select: none; }
.mc-table th.mc-sortable:hover { color: var(--text-secondary); }
.mc-table th .mc-sort-arrow { margin-left: 4px; opacity: 0.9; color: var(--accent); }

.mc-table td {
  padding: 9px 12px 9px 0;
  border-bottom: 1px solid var(--lg-hairline);
  color: var(--text-primary);
  vertical-align: middle;
  font-family: var(--font-ui);
  background: none;
}

.mc-table tbody tr { transition: background 0.15s var(--ease-out, ease); }
.mc-table tbody tr:hover td { background: rgba(255, 255, 255, 0.045); }
[data-theme="light"] .mc-table tbody tr:hover td { background: rgba(15, 23, 42, 0.035); }
.mc-table tbody tr.mc-row-click { cursor: pointer; }
.mc-table tbody tr:last-child td { border-bottom: 0; }

.mc-num { font-family: var(--font-data); font-variant-numeric: tabular-nums; text-align: right; }
.mc-num-head { text-align: right; padding-right: 0; }
.mc-muted { color: var(--text-secondary); }
.mc-dim { color: var(--mc-ink-3); }
.mc-email { font-family: var(--font-data); font-size: 11.5px; }
.mc-truncate { max-width: 260px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; display: block; }

.mc-chip {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 10.5px;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid var(--lg-hairline);
  color: var(--text-secondary);
  white-space: nowrap;
}

.mc-chip-good { color: var(--mc-good); border-color: color-mix(in srgb, var(--mc-good) 40%, transparent); }
.mc-chip-bad { color: var(--mc-bad); border-color: color-mix(in srgb, var(--mc-bad) 40%, transparent); }
.mc-chip-mute { color: var(--mc-ink-3); }

/* Engagement meter — the unfilled track is a lighter step of the fill's own
   ramp, so tier reads across the whole bar rather than only where it's filled. */
.mc-meter { position: relative; height: 5px; border-radius: 999px; background: var(--mc-tier-1); opacity: 0.9; overflow: hidden; min-width: 46px; }
.mc-meter-fill { position: absolute; inset: 0 auto 0 0; border-radius: 999px; background: var(--mc-tier-3); }

.mc-rating { display: inline-flex; gap: 2px; }
.mc-rating-pip { width: 5px; height: 5px; border-radius: 50%; background: var(--text-muted); }
.mc-rating-pip-on { background: var(--accent); }

/* ── Search ─────────────────────────────────────────────────────────────────── */
.mc-search { position: relative; display: flex; align-items: center; min-width: 210px; flex: 1 1 210px; max-width: 340px; }
.mc-search svg { position: absolute; left: 11px; color: var(--mc-ink-3); pointer-events: none; }

.mc-search input {
  width: 100%;
  font-family: inherit;
  font-size: 12.5px;
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--lg-hairline);
  border-radius: 10px;
  padding: 8px 12px 8px 32px;
  transition: border-color 0.2s var(--ease-out, ease);
}

[data-theme="light"] .mc-search input { background: rgba(255, 255, 255, 0.9); }
.mc-search input::placeholder { color: var(--mc-ink-3); }
.mc-search input:focus { outline: none; border-color: var(--border-hover); }

/* ── Drawer ─────────────────────────────────────────────────────────────────── */
.mc-drawer-scrim {
  position: fixed;
  inset: 0;
  z-index: 2400;
  background: rgba(0, 0, 0, 0.42);
  backdrop-filter: blur(3px);
  -webkit-backdrop-filter: blur(3px);
  animation: mc-fade 0.25s var(--ease-out, ease);
}

[data-theme="light"] .mc-drawer-scrim { background: rgba(15, 23, 42, 0.22); }

.mc-drawer {
  position: fixed;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(520px, 100vw);
  z-index: 2401;
  display: flex;
  flex-direction: column;
  border-radius: var(--lg-r-lg) 0 0 var(--lg-r-lg);
  background-color: var(--lg-tint-solid);
  animation: mc-slide-in 0.42s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1));
}

@keyframes mc-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes mc-slide-in { from { transform: translateX(28px); opacity: 0; } to { transform: translateX(0); opacity: 1; } }

.mc-drawer-head { padding: 20px 22px 16px; border-bottom: 1px solid var(--lg-hairline); flex-shrink: 0; }
.mc-drawer-body { flex: 1; overflow-y: auto; padding: 18px 22px 34px; display: flex; flex-direction: column; gap: 18px; }
.mc-drawer-close {
  appearance: none; border: 1px solid var(--lg-hairline); background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary); width: 28px; height: 28px; border-radius: 8px; cursor: pointer;
  display: grid; place-items: center; flex-shrink: 0; transition: all 0.2s var(--ease-out, ease);
}
.mc-drawer-close:hover { color: var(--text-primary); border-color: var(--border-hover); }

/* ── Timeline ───────────────────────────────────────────────────────────────── */
.mc-timeline { display: flex; flex-direction: column; gap: 0; }

.mc-tl-row { display: grid; grid-template-columns: 22px minmax(0, 1fr); gap: 12px; padding-bottom: 16px; position: relative; }
.mc-tl-row:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 10.5px;
  top: 20px;
  bottom: 0;
  width: 1px;
  background: var(--lg-hairline);
}

.mc-tl-dot {
  width: 22px; height: 22px; border-radius: 50%;
  display: grid; place-items: center;
  border: 1px solid var(--lg-hairline);
  background: var(--bg-elevated);
  flex-shrink: 0;
  z-index: 1;
}

.mc-tl-open { color: var(--mc-opens); border-color: color-mix(in srgb, var(--mc-opens) 45%, transparent); }
.mc-tl-click { color: var(--mc-clicks); border-color: color-mix(in srgb, var(--mc-clicks) 45%, transparent); }
.mc-tl-sent { color: var(--mc-ink-3); }
.mc-tl-bounce { color: var(--mc-unsubs); border-color: color-mix(in srgb, var(--mc-unsubs) 45%, transparent); }

.mc-tl-title { font-size: 12.5px; font-weight: 550; line-height: 1.35; }
.mc-tl-meta { font-size: 11px; color: var(--text-tertiary); margin-top: 3px; font-family: var(--font-data); }
.mc-tl-url { font-size: 11px; color: var(--text-secondary); word-break: break-all; margin-top: 3px; }

/* ── States ─────────────────────────────────────────────────────────────────── */
.mc-empty { padding: 46px 26px; text-align: center; display: flex; flex-direction: column; align-items: center; gap: 12px; }
.mc-empty-icon { color: var(--mc-ink-3); opacity: 0.65; }
.mc-empty-title { font-size: 14px; font-weight: 600; }
.mc-empty-text { font-size: 12.5px; color: var(--text-secondary); max-width: 460px; line-height: 1.6; }

/* Refetch holds the previous render at reduced opacity — no skeleton flash, no
   layout jump, so the numbers never disappear while newer ones load. */
.mc-stale { opacity: 0.45; transition: opacity 0.2s var(--ease-out, ease); pointer-events: none; }

.mc-setup-steps { display: flex; flex-direction: column; gap: 10px; text-align: left; width: 100%; max-width: 520px; margin-top: 4px; }
.mc-setup-step { display: grid; grid-template-columns: 22px 1fr; gap: 11px; align-items: start; font-size: 12.5px; color: var(--text-secondary); line-height: 1.55; }
.mc-setup-num {
  width: 22px; height: 22px; border-radius: 50%; display: grid; place-items: center;
  font-family: var(--font-data); font-size: 11px; font-weight: 700;
  background: var(--accent-dim); color: var(--accent); border: 1px solid var(--border-accent);
}

.mc-code {
  font-family: var(--font-data);
  font-size: 11.5px;
  background: rgba(255, 255, 255, 0.07);
  border: 1px solid var(--lg-hairline);
  border-radius: 5px;
  padding: 1px 6px;
}
[data-theme="light"] .mc-code { background: rgba(15, 23, 42, 0.05); }

.mc-error {
  display: flex; align-items: flex-start; gap: 10px;
  padding: 13px 16px; border-radius: var(--lg-r-sm);
  background: var(--red-dim); border: 1px solid color-mix(in srgb, var(--red) 32%, transparent);
  font-size: 12.5px; color: var(--text-primary); line-height: 1.5;
}
.mc-error svg { color: var(--red); flex-shrink: 0; margin-top: 1px; }

/* ── Progress ───────────────────────────────────────────────────────────────── */
.mc-progress { height: 4px; border-radius: 999px; background: rgba(255, 255, 255, 0.10); overflow: hidden; }
[data-theme="light"] .mc-progress { background: rgba(15, 23, 42, 0.08); }
.mc-progress-fill { height: 100%; border-radius: 999px; background: var(--accent); transition: width 0.4s var(--ease-out, ease); }

/* ── Entrance ───────────────────────────────────────────────────────────────── */
/* One staggered reveal on mount. Cards rise as a group rather than each
   animating on its own schedule — the page assembles once and then holds still. */
.mc-rise { animation: mc-rise 0.6s var(--ease-out, cubic-bezier(0.22, 1, 0.36, 1)) both; }
.mc-rise-1 { animation-delay: 0.04s; }
.mc-rise-2 { animation-delay: 0.09s; }
.mc-rise-3 { animation-delay: 0.14s; }
.mc-rise-4 { animation-delay: 0.19s; }

@keyframes mc-rise {
  from { opacity: 0; transform: translateY(14px) scale(0.995); }
  to { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
  .mc-rise, .mc-drawer, .mc-drawer-scrim { animation: none; }
}

/* ── Narrow screens ─────────────────────────────────────────────────────────── */
@media (max-width: 720px) {
  .mc-scroll { padding: 14px 12px 46px; }
  .mc-header { padding: 13px 14px; }
  .mc-card { padding: 15px 15px; }
  .mc-table-wrap { margin: 0 -15px; padding: 0 15px; }
  .mc-stat-value { font-size: 23px; }
  .mc-hero-value { font-size: 36px; }
  .mc-segmented { width: 100%; overflow-x: auto; }
  .mc-drawer { width: 100vw; border-radius: 0; }
}
