/* ===========================================================================
   Narrative Metrics — UI v2 design tokens
   Ported from the Android Compose theme (Color.kt / Spacing.kt / Type.kt).
   Premium AMOLED: cinematic navy base, glass-dark surfaces, neon accents.
   =========================================================================== */

:root {
  /* --- base / background --- */
  --bg: #050816;                          /* NmBackground */
  --bg-secondary: #0A1330;                /* NmBackgroundSecondary */
  --ambient-glow: rgba(44, 92, 255, .12); /* NmAmbientGlow */

  /* --- surfaces (glass-dark) --- */
  --card: #101830;                        /* NmSurface */
  --surface-variant: #0A1330;             /* NmSurfaceVariant */
  --glass-top: rgba(16, 24, 48, .96);     /* NmGlassTop */
  --glass-bottom: rgba(8, 14, 32, .98);   /* NmGlassBottom */
  --inner-glow: rgba(255, 255, 255, .03); /* NmInnerGlow */

  /* --- lines / borders --- */
  --line: #2A3768;                        /* NmLine (chips/pills) */
  --border-glow: rgba(120, 150, 255, .14);/* NmBorderGlow (card border) */
  --footer-divider: rgba(255, 255, 255, .08);

  /* --- text --- */
  --text: #F5F7FF;                        /* NmText */
  --text-body: rgba(240, 245, 255, .88);  /* NmTextBody */
  --muted: rgba(180, 190, 220, .72);      /* NmMuted */

  /* --- accents / iconography --- */
  --accent: #6EA8FE;                      /* NmAccent */
  --icon-blue: #6FA8FF;                   /* NmIconBlue */
  --icon-blue-glow: rgba(111, 168, 255, .2);

  /* --- score ring (neon amber telemetry) --- */
  --neon-amber: #FFC72C;                  /* NmNeonAmber */
  --neon-amber-glow: rgba(255, 199, 44, .35);
  --inactive-track: #17254F;              /* NmInactiveTrack */

  /* --- telemetry bars --- */
  --telemetry-track: rgba(255, 255, 255, .08);
  --telemetry-cyan: #57D6FF;
  --telemetry-cyan-glow: rgba(87, 214, 255, .28);
  --telemetry-yellow: #FFD84D;
  --telemetry-yellow-glow: rgba(255, 216, 77, .28);

  /* --- signal panel (mission control) --- */
  --signal-panel-bg: rgba(10, 18, 40, .72);
  --signal-panel-border: rgba(120, 150, 255, .10);

  /* --- status --- */
  --confidence-neon: #36F7A1;             /* NmConfidenceNeon */
  --confidence-glow: rgba(54, 247, 161, .25);
  --timestamp-muted: rgba(155, 176, 214, .8);
  --toggle-active: #6AA6FF;
  --toggle-glow: rgba(106, 166, 255, .4);

  /* --- legacy semantic (chips/pastile) --- */
  --good: #36D399;                        /* NmGreen */
  --warn: #FBBF24;                        /* NmAmber */
  --bad: #FB7185;                         /* NmRed */

  /* --- spacing (8px grid) --- */
  --sp-xs: 4px;
  --sp-sm: 8px;
  --sp-md: 16px;
  --sp-lg: 24px;
  --sp-xl: 32px;
  --sp-xxl: 40px;
  --card-padding: 32px;

  /* --- radii --- */
  --card-radius: 28px;
  --mini-card-radius: 20px;
  --signal-panel-radius: 22px;
  --pill-radius: 999px;

  /* --- typography --- */
  --font-sans: "Inter", ui-sans-serif, system-ui, -apple-system, "Segoe UI", Roboto, Arial, sans-serif;

  --type-display-size: 48px;
  --type-display-weight: 700;
  --type-display-spacing: -.031em;

  --type-headline-size: 30px;
  --type-headline-weight: 700;
  --type-headline-spacing: -.025em;

  --type-title-size: 22px;
  --type-title-weight: 600;
  --type-title-spacing: -.015em;

  --type-body-lg-size: 18px;
  --type-body-size: 15px;
  --type-meta-size: 13px;
}

/* ===== reset ===== */
*, *::before, *::after { box-sizing: border-box; }

html, body { height: 100%; }
*[hidden] { display: none !important; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 50% 18%, rgba(76, 115, 202, .18), transparent 44%),
    radial-gradient(circle at 92% 6%, rgba(76, 115, 202, .08), transparent 30%),
    linear-gradient(180deg, #050816 0%, #071224 30%, #0B1020 100%);
  color: var(--text);
  font-family: var(--font-sans);
  font-size: var(--type-body-size);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
  min-height: 100dvh;
}

/* ===== ambient background glow ===== */
.nm-ambient {
  position: fixed;
  inset: 0;
  z-index: -1;
  background: transparent;
  pointer-events: none;
}

/* ===== layout ===== */
.nm-app {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 var(--sp-lg) var(--sp-xxl);
  display: flex;
  flex-direction: column;
  gap: var(--sp-lg);
}

.nm-topbar {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--sp-md);
}

.nm-home-lede {
  min-width: 0;
  text-align: center;
}

.oa-about {
  margin-top: var(--sp-xxl);
  color: var(--muted);
  font-size: var(--type-body-size);
  line-height: 1.6;
}

.oa-about h2 {
  margin: 0 0 var(--sp-md);
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  color: var(--text-body);
}

.oa-about p {
  margin: 0 0 var(--sp-md);
}

.nm-disclaimer {
  margin-top: var(--sp-xxl);
  color: var(--muted);
  font-size: var(--type-meta-size);
  line-height: 1.5;
}

/* ===== OA / NM brand switch (ported from v1) ===== */
.oa-brand-switch {
  --switch-padding: 4px;
  --pill-padding-y: 7px;
  --pill-padding-x: 14px;
  --pill-font-size: 14px;
  --pill-radius: 999px;
  --switch-bg: rgba(255,255,255,0.03);
  --switch-border: rgba(255,255,255,0.12);
  --pill-text: rgba(232,238,246,0.72);
  --pill-text-active: #e8eef6;

  position: relative;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  width: max-content;
  flex: 0 0 auto;
  padding: var(--switch-padding);
  border: 1px solid var(--switch-border);
  border-radius: var(--pill-radius);
  background: var(--switch-bg);
  isolation: isolate;
  min-height: 42px;
}

.oa-brand-switch__indicator { display: none; }

.oa-brand-pill {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 0;
  width: auto;
  padding: var(--pill-padding-y) var(--pill-padding-x);
  font-size: var(--pill-font-size);
  line-height: 1;
  font-weight: 700;
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: -0.025em;
  color: var(--pill-text);
  border-radius: var(--pill-radius);
  transition: color 180ms ease, opacity 180ms ease;
}

.oa-brand-pill:hover,
.oa-brand-pill:focus-visible {
  color: #e8eef6;
  text-decoration: none;
  outline: none;
}

.oa-brand-pill:visited { color: inherit; }

.oa-brand-switch--oa .oa-brand-pill--oa,
.oa-brand-switch--nm .oa-brand-pill--nm {
  background: linear-gradient(
    180deg,
    rgba(59,130,246,0.28),
    rgba(59,130,246,0.18)
  );
  box-shadow: inset 0 0 0 1px rgba(255,255,255,0.06);
  color: var(--pill-text-active);
  font-size: calc(var(--pill-font-size) * 1.8);
  letter-spacing: -0.02em;
}

.oa-brand-primary { color: #ffffff; }
.oa-brand-accent { color: var(--accent); }

/* Match the OddsAccuracy brand-switch mobile downscale (frontend/css/brand.css) */
@media (max-width: 760px) {
  .oa-brand-switch {
    --switch-padding: 3px;
    --pill-padding-y: 6px;
    --pill-padding-x: 10px;
    --pill-font-size: 12px;
    min-height: 36px;
    max-width: 100%;
  }

  /* Title/subtitle left-aligned; window selector moved onto their row, right side */
  .nm-home-lede {
    display: grid;
    grid-template-columns: minmax(0, 1fr) auto;
    align-items: center;
    column-gap: var(--sp-md);
    text-align: left;
  }
  .nm-home-lede .nm-display { grid-column: 1; grid-row: 1; }
  .nm-home-lede #nm-subtitle { grid-column: 1; grid-row: 2; }
  .nm-home-lede #nm-windows { grid-column: 2; grid-row: 1 / span 2; justify-self: end; }
  .nm-feedback-link { display: none; }
}

.nm-tabs {
  flex: 1 1 auto;
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 6px;
  min-width: 0;
}

.nm-home-head {
  margin-top: var(--sp-sm);
}

.nm-tab {
  appearance: none;
  flex: 0 1 auto;
  min-width: 0;
  height: 40px;
  padding: 0 10px;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  font: 700 12px/12px var(--font-sans);
  color: var(--muted);
  cursor: pointer;
  transition: color .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}

.nm-tab:hover { color: var(--text-body); border-color: rgba(120, 150, 255, .18); }

.nm-tab.is-active {
  color: #8EF985;
  background: linear-gradient(180deg, rgba(54, 247, 161, .19), rgba(110, 168, 254, .08));
  border-color: rgba(54, 247, 161, .32);
  box-shadow: 0 0 14px rgba(54, 247, 161, .16);
}

/* Tab icons show only in the mobile bottom bar (see media query) */
.nm-tab__icon { display: none; }

.nm-section__placeholder {
  margin: 0;
  font-size: var(--type-body-size);
}

.nm-methodology-frame,
.nm-research-frame {
  display: block;
  width: 100%;
  min-height: calc(100vh - 132px);
  border: 0;
  background: transparent;
}

.nm-methodology-mode .nm-app,
.nm-research-mode .nm-app {
  max-width: none;
  min-height: 100dvh;
  padding: 0;
  gap: 0;
}

.nm-methodology-mode .nm-methodology-frame,
.nm-research-mode .nm-research-frame {
  min-height: 100dvh;
}

.nm-list-head {
  position: sticky;
  top: 0;
  z-index: 10;
  margin-top: 0;
  padding-top: 20px;
  background: transparent;
  backdrop-filter: blur(12px);
}

.nm-hero {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: var(--sp-lg);
}

.nm-feedback-link {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  height: 40px;
  padding: 0 12px;
  border-radius: 10px;
  border: 1px solid rgba(111, 168, 255, .32);
  background: linear-gradient(180deg, rgba(59, 130, 246, .16), rgba(59, 130, 246, .08));
  color: var(--text-body);
  font: 700 12px/12px var(--font-sans);
  text-decoration: none;
  white-space: nowrap;
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .04), 0 0 18px rgba(111, 168, 255, .08);
  transition: color .15s ease, border-color .15s ease, background .15s ease, box-shadow .15s ease;
}

.nm-feedback-link:hover,
.nm-feedback-link:focus-visible {
  color: #fff;
  border-color: rgba(111, 168, 255, .58);
  background: linear-gradient(180deg, rgba(59, 130, 246, .24), rgba(59, 130, 246, .12));
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, .06), 0 0 22px rgba(111, 168, 255, .14);
  outline: none;
}

/* ===== type utilities ===== */
.nm-eyebrow {
  margin: 0 0 var(--sp-sm);
  font-size: var(--type-meta-size);
  letter-spacing: .14em;
  text-transform: uppercase;
  color: var(--icon-blue);
}

.nm-display {
  margin: 0;
  font-size: 25px;
  font-weight: var(--type-display-weight);
  letter-spacing: 0;
  line-height: 26px;
}

.nm-title {
  margin: 0 0 var(--sp-sm);
  font-size: var(--type-title-size);
  font-weight: var(--type-title-weight);
  letter-spacing: var(--type-title-spacing);
}

.nm-body-lg { font-size: 12.5px; line-height: 14px; margin: var(--sp-xs) 0 0; font-weight: 600; }
.nm-body { font-size: var(--type-body-size); line-height: 1.5; margin: 0; }
.nm-meta { font-size: var(--type-meta-size); }
.nm-muted { color: var(--muted); }

/* ===== glass card ===== */
.glass-card {
  position: relative;
  padding: var(--card-padding);
  border-radius: var(--card-radius);
  background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  border: 1px solid var(--border-glow);
  box-shadow:
    0 24px 60px rgba(0, 0, 0, .45),
    inset 0 1px 0 var(--inner-glow);
}

.glass-card__head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: var(--sp-md);
}

/* ===== pill ===== */
.pill {
  display: inline-flex;
  align-items: center;
  padding: 4px 12px;
  border-radius: var(--pill-radius);
  border: 1px solid var(--line);
  background: var(--surface-variant);
  color: var(--text-body);
  font-size: var(--type-meta-size);
  letter-spacing: .02em;
}

/* ===== swatches (foundation preview only) ===== */
.swatches { display: flex; gap: var(--sp-sm); margin: var(--sp-lg) 0 var(--sp-md); }
.swatch {
  width: 28px; height: 28px;
  border-radius: 10px;
  box-shadow: 0 0 16px rgba(0, 0, 0, .4), inset 0 1px 0 var(--inner-glow);
}

/* ===== telemetry bars ===== */
.telemetry { display: grid; gap: var(--sp-sm); }
.telemetry__track {
  height: 6px;
  border-radius: var(--pill-radius);
  background: var(--telemetry-track);
  overflow: hidden;
}
.telemetry__fill { display: block; height: 100%; border-radius: var(--pill-radius); }
.telemetry__fill--cyan {
  background: var(--telemetry-cyan);
  box-shadow: 0 0 12px var(--telemetry-cyan-glow);
}
.telemetry__fill--yellow {
  background: var(--telemetry-yellow);
  box-shadow: 0 0 12px var(--telemetry-yellow-glow);
}

.glass-card--mini { padding: var(--sp-md) var(--sp-lg); border-radius: var(--mini-card-radius); }

/* ===== window selector ===== */
.nm-windowbar {
  flex: none;
  display: flex;
  align-items: center;
  gap: 4px;
  height: 48px;
  padding: 4px;
  border-radius: 12px;
  border: 1px solid rgba(120, 150, 255, .20);
  background: rgba(7, 17, 38, .54);
}
.nm-window {
  appearance: none;
  cursor: pointer;
  width: 48px;
  height: 40px;
  padding: 0;
  border-radius: 9px;
  border: 1px solid transparent;
  background: transparent;
  color: var(--muted);
  font: 700 13px/13px var(--font-sans);
  transition: color .15s ease, border-color .15s ease, box-shadow .15s ease, background .15s ease;
}
.nm-window:hover { color: var(--text-body); border-color: rgba(120, 150, 255, .18); }
.nm-window.is-active {
  color: #8EF985;
  background: linear-gradient(180deg, rgba(54, 247, 161, .19), rgba(110, 168, 254, .08));
  border-color: rgba(54, 247, 161, .32);
  box-shadow: 0 0 14px rgba(54, 247, 161, .16);
}
.nm-window__label,
.nm-window__sub { display: block; }
.nm-window__sub {
  margin-top: 2px;
  font-size: 7.5px;
  line-height: 8px;
  color: #6B7686;
}
.nm-window.is-active .nm-window__sub { color: rgba(54, 247, 161, .72); }

.nm-separator {
  height: 1px;
  margin-top: var(--sp-sm);
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .14), transparent);
}

/* ===== status ===== */
.nm-status { margin: 0; }
.nm-status--error { color: var(--bad); }

/* ===== list ===== */
.nm-list { display: grid; gap: var(--sp-md); }

/* ===== narrative card (Android ClubPressureCard look) ===== */
.nm-card {
  display: grid;
  grid-template-columns: 48px 1fr auto;
  align-items: center;
  gap: var(--sp-md);
  min-height: 86px;
  padding: 12px 14px;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--glass-top), var(--glass-bottom));
  border: 1px solid var(--border-glow);
  box-shadow:
    0 12px 28px rgba(0, 0, 0, .42),
    inset 0 1px 0 var(--inner-glow);
  transition: transform .14s ease, box-shadow .14s ease, border-color .14s ease;
}
.nm-card:hover {
  transform: translateY(-1px);
  border-color: var(--icon-blue-glow);
  box-shadow: 0 16px 34px rgba(0, 0, 0, .5), inset 0 1px 0 var(--inner-glow);
}

/* logo slot */
.nm-card__logo {
  width: 48px;
  height: 48px;
  display: grid;
  place-items: center;
  border-radius: 14px;
  background: var(--surface-variant);
  border: 1px solid var(--border-glow);
  color: var(--icon-blue);
  font-weight: 700;
  font-size: 16px;
  letter-spacing: .02em;
  text-shadow: 0 0 12px var(--icon-blue-glow);
}

.nm-team-logo {
  position: relative;
  overflow: hidden;
  background: linear-gradient(180deg, var(--logo-top), var(--logo-bottom));
  border-color: color-mix(in srgb, var(--logo-accent) 78%, transparent);
  color: var(--logo-text);
  text-shadow: none;
  isolation: isolate;
}

.nm-team-logo[data-shape="circle"] {
  width: 46px;
  height: 46px;
  border-radius: 50%;
}

.nm-team-logo[data-shape="oval"] {
  width: 39px;
  height: 47px;
  border-radius: 50%;
}

.nm-team-logo[data-shape="shield"] {
  width: 42px;
  height: 47px;
  border-radius: 10px;
}

.nm-team-logo[data-shape="square"] {
  width: 43px;
  height: 43px;
  border-radius: 10px;
}

.nm-team-logo__mark,
.nm-team-logo__mark::before,
.nm-team-logo__mark::after {
  position: absolute;
  content: "";
  inset: 0;
  pointer-events: none;
  z-index: 1;
}

.nm-team-logo[data-mark="center-stripe"] .nm-team-logo__mark {
  left: 42%;
  right: auto;
  width: 16%;
  background: color-mix(in srgb, var(--logo-accent) 72%, transparent);
}

.nm-team-logo[data-mark="double-stripe"] .nm-team-logo__mark::before,
.nm-team-logo[data-mark="double-stripe"] .nm-team-logo__mark::after {
  width: 18%;
  background: color-mix(in srgb, var(--logo-accent) 72%, transparent);
}

.nm-team-logo[data-mark="double-stripe"] .nm-team-logo__mark::before { left: 18%; }
.nm-team-logo[data-mark="double-stripe"] .nm-team-logo__mark::after { left: 64%; }

.nm-team-logo[data-mark="diagonal"] .nm-team-logo__mark::before {
  top: 46%;
  left: 4%;
  width: 92%;
  height: 5px;
  border-radius: 999px;
  background: color-mix(in srgb, var(--logo-accent) 82%, transparent);
  transform: rotate(-35deg);
}

.nm-team-logo[data-mark="ring"] .nm-team-logo__mark::before {
  inset: 24%;
  border-radius: 999px;
  border: 3px solid color-mix(in srgb, var(--logo-accent) 58%, transparent);
}

.nm-team-logo[data-mark="split"] .nm-team-logo__mark::before {
  clip-path: polygon(0 0, 100% 0, 0 100%);
  background: color-mix(in srgb, var(--logo-accent) 38%, transparent);
}

.nm-team-logo__text {
  position: relative;
  z-index: 2;
  padding: 0 3px;
  color: var(--logo-text);
  font-size: 15px;
  line-height: 15px;
  font-weight: 900;
  text-align: center;
  letter-spacing: 0;
  max-width: 100%;
  white-space: nowrap;
}

.nm-team-logo[data-text-size="long"] .nm-team-logo__text {
  font-size: 9px;
  line-height: 9px;
}

.nm-card__body { min-width: 0; }
.nm-card__titlerow { display: flex; align-items: baseline; gap: 8px; min-width: 0; }
.nm-card__rank { font-size: 12px; font-weight: 700; color: var(--icon-blue); flex: none; }
.nm-card__title {
  margin: 0;
  font-size: 16px;
  line-height: 1.15;
  font-weight: 700;
  color: #F0F3F7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.nm-card__meta {
  margin: 3px 0 8px;
  font-size: var(--type-meta-size);
  text-transform: capitalize;
}

.nm-state {
  display: inline-flex;
  align-items: center;
  width: fit-content;
  margin-top: 4px;
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 10px;
  line-height: 10px;
  font-weight: 700;
}
.nm-state--rising { color: #22D3EE; background: rgba(34, 211, 238, .288); }
.nm-state--forming { color: #A78BFA; background: rgba(167, 139, 250, .288); }
.nm-state--accelerating { color: #4ADE80; background: rgba(74, 222, 128, .288); }
.nm-state--persistent { color: #FBBF24; background: rgba(251, 191, 36, .288); }
.nm-state--fading { color: #F43F5E; background: rgba(244, 63, 94, .288); }
.nm-state--default { color: #CBD5E1; background: rgba(203, 213, 225, .16); }

.nm-mentions {
  display: grid;
  gap: 3px;
  margin-top: 5px;
}
.nm-mention {
  margin: 0;
  color: #B5BECA;
  font-size: 10.5px;
  line-height: 11.5px;
  font-weight: 500;
}
.nm-mention__accel.is-up { color: #4DE36A; }
.nm-mention__accel.is-down { color: #FF4D58; }

.nm-metrics { display: flex; flex-wrap: wrap; gap: 6px; }
.nm-metric {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  padding: 3px 9px;
  border-radius: var(--pill-radius);
  background: var(--signal-panel-bg);
  border: 1px solid var(--signal-panel-border);
}
.nm-metric__k { font-size: 10px; letter-spacing: .04em; text-transform: uppercase; color: var(--muted); }
.nm-metric__v { font-size: 12px; font-weight: 600; color: var(--text-body); }

/* right column: score + sparkline slot, status/trend chip below */
.nm-card__right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}
.nm-card__scorerow { display: flex; align-items: center; gap: 8px; }
.nm-score { display: flex; flex-direction: column; align-items: flex-end; min-width: 52px; }
.nm-score__k {
  font-size: 10px;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--icon-blue);
}
.nm-score__v {
  font-size: 28px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: 0;
  color: #F0F3F7;
  text-shadow: none;
}
.nm-spark {
  width: 82px;
  height: 22px;
}
.nm-spark__svg {
  display: block;
  width: 82px;
  height: 22px;
  overflow: visible;
}
.nm-spark__area { fill: rgba(83, 232, 108, .20); }
.nm-spark__line {
  fill: none;
  stroke: #53E86C;
  stroke-width: 1.05;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.nm-driver {
  font-size: 11px;
  line-height: 11px;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: 4px;
  border: 1px solid rgba(203, 213, 225, .10);
  color: #CBD5E1;
}
.nm-driver--blue { color: #93C5FD; border-color: rgba(59, 130, 246, .30); }
.nm-driver--warn { color: #FCD34D; border-color: rgba(234, 179, 8, .30); }
.nm-driver--purple { color: #C4B5FD; border-color: rgba(139, 92, 246, .30); }
.nm-driver--teal { color: #2DD4BF; border-color: rgba(20, 184, 166, .30); }
.nm-driver--green { color: #86EFAC; border-color: rgba(34, 197, 94, .28); }
.nm-driver--cyan { color: #67E8F9; border-color: rgba(34, 211, 238, .28); }
.nm-driver--fragile { color: #FDA4AF; border-color: rgba(244, 63, 94, .30); }

/* ===== detail route ===== */
.nm-card[role="button"] {
  cursor: pointer;
}

.nm-card[role="button"]:focus-visible {
  outline: 2px solid rgba(110, 168, 254, .75);
  outline-offset: 4px;
}

.nm-detail {
  display: grid;
  gap: var(--sp-md);
}

.nm-detail__back {
  width: fit-content;
  border: 1px solid rgba(110, 168, 254, .24);
  border-radius: 8px;
  background: rgba(10, 19, 48, .92);
  color: var(--text);
  padding: 7px 12px;
  font: inherit;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
}

.nm-detail__back:focus-visible {
  outline: 2px solid rgba(110, 168, 254, .75);
  outline-offset: 3px;
}

.nm-detail__sticky {
  position: sticky;
  top: 0;
  z-index: 10;
  display: grid;
  gap: var(--sp-md);
  padding-top: var(--sp-xs);
  padding-bottom: var(--sp-sm);
  background: var(--bg-secondary);
}

.nm-detail__hero {
  display: grid;
  gap: 8px;
}

.nm-detail__herotop {
  display: flex;
  align-items: center;
  gap: var(--sp-md);
}

.nm-detail__herolede {
  flex: 1 1 auto;
  min-width: 0;
  display: grid;
  gap: 4px;
}

.nm-detail__herotitle {
  margin: 0;
  color: var(--text);
  font-size: 24px;
  line-height: 28px;
  font-weight: 800;
}

.nm-detail__herosub {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  line-height: 16px;
  font-weight: 400;
}

.nm-detail__windows { flex: none; }

.nm-detail__herodiv {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, .14), transparent);
}

.nm-detail__panel {
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(142, 167, 223, .24);
  background: linear-gradient(90deg, #1B2850, #111936, #050816);
}

.nm-detail__panelglow {
  height: 1px;
  background: rgba(255, 255, 255, .03);
}

.nm-detail__panelbody {
  display: grid;
  gap: 14px;
  padding: 18px;
}

.nm-detail__head {
  display: grid;
  grid-template-columns: 52px minmax(0, 1fr) auto;
  align-items: start;
  gap: var(--sp-md);
}

.nm-detail__titleblock {
  min-width: 0;
}

.nm-detail__title {
  margin: 0;
  color: #F0F3F7;
  font-size: 24px;
  line-height: 1.08;
  font-weight: 800;
  letter-spacing: 0;
}

.nm-detail__chips {
  display: flex;
  flex-wrap: wrap;
  gap: 7px;
  margin-top: 8px;
}

.nm-detail__score {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 7px;
}

.nm-detail__scoreline {
  display: flex;
  align-items: flex-end;
  gap: 5px;
}

.nm-detail__scoreline span {
  color: #F0F3F7;
  font-size: 24px;
  line-height: 1;
  font-weight: 800;
}

.nm-detail__scoreline small {
  margin-bottom: 2px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
  text-transform: none;
}

.nm-watch-toggle {
  appearance: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 0;
  border: 0;
  background: transparent;
  color: var(--muted);
  font: 700 13px/1 var(--font-sans);
  cursor: pointer;
}

.nm-watch-toggle__label {
  color: var(--muted);
  font-size: 13px;
  line-height: 1;
  font-weight: 700;
}

.nm-watch-toggle__pill {
  position: relative;
  box-sizing: border-box;
  display: inline-block;
  width: 57px;
  height: 22.5px;
  padding: 0;
  border-radius: 999px;
  border: 1px solid rgba(156, 165, 179, .28);
  background: rgba(255, 255, 255, .05);
  color: var(--muted);
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}

.nm-watch-toggle__state {
  position: absolute;
  z-index: 1;
  top: 50%;
  right: 11px;
  transform: translateY(-50%);
  font-size: 11px;
  line-height: 1;
}

.nm-watch-toggle__knob {
  position: absolute;
  left: 3px;
  top: 2.75px;
  width: 16px;
  height: 16px;
  border-radius: 999px;
  background:
    radial-gradient(circle at 50% 25%, currentColor 0 8%, transparent 9%),
    radial-gradient(circle at 50% 75%, #0B1226 0 8%, transparent 9%),
    radial-gradient(circle at 50% 25%, #0B1226 0 25%, transparent 26%),
    radial-gradient(circle at 50% 75%, currentColor 0 25%, transparent 26%),
    linear-gradient(90deg, currentColor 0 50%, #0B1226 50% 100%);
  box-shadow: 0 1px 5px rgba(0, 0, 0, .32);
  transform-origin: center;
  transition: transform .28s ease;
}

.nm-watch-toggle.is-on .nm-watch-toggle__pill {
  border-color: rgba(194, 232, 60, .52);
  background: rgba(194, 232, 60, .16);
  color: #C2E83C;
}

.nm-watch-toggle.is-on .nm-watch-toggle__state {
  left: 11px;
  right: auto;
}

.nm-watch-toggle.is-on .nm-watch-toggle__knob {
  transform: translateX(32px) rotate(180deg);
}

.nm-watch-remove {
  width: fit-content;
  margin-left: auto;
  padding: 3px 8px;
  border-radius: 8px;
  border: 1px solid var(--line);
  background: var(--surface);
  color: var(--text-body);
  font: 700 10px/1 var(--font-sans);
  cursor: pointer;
}

.nm-tiles {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 8px;
}

.nm-tiles--2 {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.nm-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  min-height: 104px;
  padding: 14px 12px;
  border-radius: 20px;
  border: 1px solid rgba(120, 150, 255, .14);
  background: linear-gradient(180deg, rgba(16, 24, 48, .96), rgba(8, 14, 32, .98));
}

.nm-tile__label {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  font-weight: 600;
  letter-spacing: .04em;
  text-align: center;
}

.nm-tile__valuerow {
  display: flex;
  align-items: center;
  gap: 4px;
}

.nm-tile__arrow {
  font-size: 16px;
  font-weight: 700;
}

.nm-tile__value {
  font-size: 16px;
  line-height: 1.2;
  font-weight: 700;
}

.nm-tile__sub {
  color: var(--muted);
  font-size: 10px;
  line-height: 1.2;
  text-align: center;
}

.nm-detail__section {
  overflow: hidden;
  border-radius: 22px;
  border: 1px solid rgba(120, 150, 255, .10);
  background: rgba(10, 18, 40, .72);
}

.nm-detail__sectionglow {
  height: 1px;
  background: rgba(255, 255, 255, .03);
}

.nm-detail__sectionbody {
  display: grid;
  gap: 14px;
  padding: 20px 22px;
}

.nm-detail__sectionhead {
  display: flex;
  align-items: center;
  gap: 10px;
}

.nm-detail__dot {
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: #6EA8FE;
}

.nm-detail__sectiontitle {
  color: var(--muted);
  font-size: 12px;
  line-height: 1;
  font-weight: 700;
  letter-spacing: .04em;
}

.nm-detail__sectiontrailing { margin-left: auto; }

.nm-trend__chartbox {
  display: flex;
  align-items: center;
  height: 92px;
  padding: 8px;
  border-radius: 10px;
  border: 1px solid rgba(87, 214, 255, .118);
}

.nm-trend__svg {
  display: block;
  width: 100%;
  height: 74px;
}

.nm-trend__grid {
  fill: none;
  stroke: rgba(255, 255, 255, .14);
  stroke-width: 1;
  stroke-dasharray: 6 6;
  vector-effect: non-scaling-stroke;
}

.nm-trend__area {
  fill: url(#nmTrendFill);
  stroke: none;
}

.nm-trend__line {
  fill: none;
  stroke: #39FF14;
  stroke-width: 1.2;
  stroke-linejoin: round;
  stroke-linecap: round;
  vector-effect: non-scaling-stroke;
}

.nm-keyins {
  display: grid;
  gap: 12px;
  padding: 14px 16px;
  border-radius: 18px;
  border: 1px solid rgba(54, 247, 161, .45);
  background: rgba(54, 247, 161, .06);
}

.nm-keyins__head {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nm-keyins__icon {
  flex: none;
  width: 28px;
  height: 28px;
  color: #36F7A1;
}

.nm-keyins__title {
  color: #36F7A1;
  font-size: 13px;
  font-weight: 700;
  letter-spacing: .02em;
}

.nm-keyins__row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.nm-keyins__dot {
  flex: none;
  width: 8px;
  height: 8px;
  margin-top: 6px;
  border-radius: 999px;
}

.nm-keyins__text {
  display: grid;
  gap: 2px;
}

.nm-keyins__headline {
  margin: 0;
  color: var(--text);
  font-size: 13px;
  font-weight: 600;
}

.nm-keyins__body {
  margin: 0;
  color: var(--muted);
  font-size: 12px;
  line-height: 1.4;
}

.nm-detail__mentions {
  display: grid;
  gap: 5px;
}

.nm-detail__empty {
  color: var(--muted);
  font-size: var(--type-body-size);
}

/* ===== responsive ===== */
@media (max-width: 520px) {
  :root { --card-padding: 22px; --type-display-size: 38px; }
  .nm-app { padding: 0 var(--sp-lg) calc(var(--sp-xl) + 64px + env(safe-area-inset-bottom)); gap: var(--sp-md); }
  .nm-list-head { padding-top: 10px; }
  /* Only the brand switch remains in the header on mobile — center it */
  .nm-hero { justify-content: center; }
  .nm-card { grid-template-columns: 40px minmax(0, 1fr) auto; gap: var(--sp-sm); padding: 10px 12px; }
  .nm-card__logo { width: 40px; height: 40px; font-size: 14px; }
  .nm-card__title { font-size: 15px; }
  .nm-score__v { font-size: 24px; }
  /* Nudge the score + full-size sparkline left so they sit inside the card */
  .nm-card__right { padding-right: 4px; }

  /* Section tabs relocate to a fixed bottom menu on mobile */
  #nm-tabs.nm-tabs {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    flex: none;
    justify-content: space-around;
    gap: 4px;
    padding: 8px max(var(--sp-md), env(safe-area-inset-right)) calc(8px + env(safe-area-inset-bottom)) max(var(--sp-md), env(safe-area-inset-left));
    background: linear-gradient(180deg, rgba(8, 14, 32, .82), rgba(5, 8, 22, .96));
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 -1px 0 rgba(120, 150, 255, .10), 0 -12px 28px rgba(2, 5, 16, .55);
  }

  #nm-tabs .nm-tab {
    flex: 1 1 0;
    min-width: 0;
    height: 50px;
    padding: 4px 2px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    text-align: center;
    border-radius: 11px;
  }
  #nm-tabs .nm-tab__icon { display: block; width: 20px; height: 20px; }
  #nm-tabs .nm-tab__icon svg { display: block; width: 100%; height: 100%; }
  #nm-tabs .nm-tab__label { font-size: 10px; line-height: 1; font-weight: 700; }

  /* Reserve bottom space inside the full-bleed iframe modes too */
  .nm-methodology-mode .nm-app,
  .nm-research-mode .nm-app { padding-bottom: calc(58px + env(safe-area-inset-bottom)); }
}
