/* =========================================================
   Podscope - Performance Dashboard
   Modern, dark-first design system, dependency-free.
   ========================================================= */

/* ---------- Tokens ---------- */
:root,
[data-theme='dark'] {
  --bg: #0a0b10;
  --bg-soft: #0e1018;
  --surface: #13151d;
  --surface-2: #181b25;
  --surface-3: #1f2331;
  --line: #232636;
  --line-soft: #1c1f2c;
  --ink: #ecedf2;
  --ink-2: #c9ccd6;
  --muted: #8a8f9c;
  --muted-2: #5e636e;

  --accent: #7c8cff;
  --accent-2: #a78bff;
  --accent-glow: rgba(124, 140, 255, 0.16);

  --pos: #34d399;
  --pos-soft: rgba(52, 211, 153, 0.14);
  --neg: #f87171;
  --neg-soft: rgba(248, 113, 113, 0.16);
  --warn: #f59e0b;
  --warn-soft: rgba(245, 158, 11, 0.14);
  --info: #38bdf8;
  --info-soft: rgba(56, 189, 248, 0.14);

  --gold: #f6c270;
  --pink: #f472b6;
  --teal: #2dd4bf;

  --shadow-1: 0 1px 2px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.02);
  --shadow-2: 0 24px 60px -20px rgba(0, 0, 0, 0.6), 0 0 0 1px rgba(255, 255, 255, 0.03);

  --radius-sm: 8px;
  --radius: 14px;
  --radius-lg: 18px;
  --radius-xl: 22px;

  --font-sans: 'Inter', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI Variable', 'Segoe UI', Roboto, sans-serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', ui-monospace, 'Roboto Mono', Menlo, monospace;
}

[data-theme='light'] {
  --bg: #f6f7fb;
  --bg-soft: #eef0f7;
  --surface: #ffffff;
  --surface-2: #fafbfd;
  --surface-3: #f1f3f9;
  --line: #e6e8ef;
  --line-soft: #eceef4;
  --ink: #15171c;
  --ink-2: #2c303a;
  --muted: #6b7180;
  --muted-2: #9aa0ad;

  --accent: #4f46e5;
  --accent-2: #7c3aed;
  --accent-glow: rgba(79, 70, 229, 0.12);

  --pos: #059669;
  --pos-soft: rgba(5, 150, 105, 0.12);
  --neg: #dc2626;
  --neg-soft: rgba(220, 38, 38, 0.12);
  --warn: #b45309;
  --warn-soft: rgba(180, 83, 9, 0.12);
  --info: #0284c7;
  --info-soft: rgba(2, 132, 199, 0.12);

  --shadow-1: 0 1px 2px rgba(15, 23, 42, 0.06), 0 0 0 1px rgba(15, 23, 42, 0.04);
  --shadow-2: 0 16px 40px -16px rgba(15, 23, 42, 0.16), 0 0 0 1px rgba(15, 23, 42, 0.04);
}

/* ---------- Reset & base ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  background: var(--bg);
  color: var(--ink);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
  text-rendering: optimizeLegibility;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(1200px 600px at 85% -10%, var(--accent-glow), transparent 70%),
    radial-gradient(900px 600px at -10% 10%, rgba(167, 139, 250, 0.08), transparent 70%),
    var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  font-feature-settings: 'cv11', 'ss01', 'ss03', 'cv02';
}

h1, h2, h3, h4, h5, h6, p, ul, ol {
  margin: 0;
}

button, input, select, textarea {
  font: inherit;
  color: inherit;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  text-decoration: underline;
}

::selection {
  background: var(--accent-glow);
  color: var(--ink);
}

/* ---------- App shell ---------- */
.app {
  width: min(1440px, 100% - 32px);
  margin: 0 auto;
  padding: 16px 0 56px;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

/* ---------- Topbar ---------- */
.topbar {
  position: sticky;
  top: 0;
  z-index: 30;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: color-mix(in oklab, var(--surface) 88%, transparent);
  backdrop-filter: saturate(140%) blur(14px);
  -webkit-backdrop-filter: saturate(140%) blur(14px);
  box-shadow: var(--shadow-1);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 18px;
  min-width: 0;
  flex: 1 1 auto;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 4px 10px 4px 4px;
  flex: 0 0 auto;
}

.brand-mark {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: 9px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: white;
  box-shadow: 0 6px 16px -4px var(--accent-glow);
}

.brand-text {
  display: flex;
  flex-direction: column;
  line-height: 1.05;
}

.brand-name {
  font-weight: 700;
  font-size: 14px;
  letter-spacing: -0.01em;
}

.brand-sub {
  font-size: 11px;
  color: var(--muted);
  font-weight: 500;
}

.tabs {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 3px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 12px;
  overflow-x: auto;
  scrollbar-width: none;
}

.tabs::-webkit-scrollbar {
  display: none;
}

.tab {
  appearance: none;
  border: 0;
  background: transparent;
  color: var(--muted);
  padding: 7px 12px;
  border-radius: 9px;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  white-space: nowrap;
  transition: color 140ms ease, background 140ms ease, transform 140ms ease;
}

.tab:hover {
  color: var(--ink);
}

.tab.is-active {
  background: var(--surface-3);
  color: var(--ink);
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.2), inset 0 0 0 1px var(--line);
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.freshness {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
  white-space: nowrap;
}

.freshness::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 0 4px var(--pos-soft);
}

.freshness.is-stale::before {
  background: var(--warn);
  box-shadow: 0 0 0 4px var(--warn-soft);
}

.icon-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, transform 140ms ease;
}

.icon-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
}

.icon-btn:active {
  transform: scale(0.97);
}

[data-theme='dark'] .icon-sun { display: none; }
[data-theme='light'] .icon-moon { display: none; }

.primary-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 10px;
  border: 0;
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
  color: white;
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  box-shadow: 0 6px 16px -6px var(--accent-glow), 0 0 0 1px rgba(255,255,255,0.06) inset;
  transition: transform 140ms ease, filter 140ms ease, box-shadow 140ms ease;
}

.primary-btn:hover {
  filter: brightness(1.06);
  box-shadow: 0 10px 22px -8px var(--accent-glow), 0 0 0 1px rgba(255,255,255,0.08) inset;
}

.primary-btn:active {
  transform: translateY(1px);
}

.primary-btn:disabled,
.primary-btn.is-loading {
  cursor: progress;
  opacity: 0.85;
}

.primary-btn.is-loading svg {
  animation: spin 1s linear infinite;
}

.ghost-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink-2);
  font-weight: 600;
  font-size: 13px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease, border-color 140ms ease;
}

.ghost-btn:hover {
  background: var(--surface-3);
  color: var(--ink);
  border-color: var(--line);
}

.ghost-btn:disabled,
.ghost-btn.is-loading {
  cursor: progress;
  opacity: 0.85;
}

.upload-wrap {
  position: relative;
}

.upload-wrap .popover {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: 220;
  min-width: 300px;
  padding: 8px;
  border-radius: 14px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  opacity: 0;
  transform: translateY(-4px);
  pointer-events: none;
  transition: opacity 140ms ease, transform 140ms ease;
}

.upload-wrap .popover.is-open {
  opacity: 1;
  transform: translateY(0);
  pointer-events: auto;
}

.popover-head {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 8px 10px 6px;
}

.popover-item {
  display: grid;
  grid-template-columns: 32px 1fr;
  gap: 10px;
  align-items: center;
  width: 100%;
  padding: 10px 10px;
  margin: 2px 0;
  border-radius: 10px;
  border: 0;
  background: transparent;
  color: var(--ink);
  cursor: pointer;
  text-align: left;
  transition: background 140ms ease;
}

.popover-item:hover { background: var(--surface-2); }

.popover-item .pi-mark {
  width: 32px;
  height: 32px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: color-mix(in oklab, var(--accent) 16%, transparent);
  color: var(--accent);
  font-weight: 800;
  font-size: 14px;
  letter-spacing: -0.02em;
}

.popover-item .pi-meta {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.popover-item .pi-meta strong {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.popover-item .pi-meta small {
  font-size: 11.5px;
  color: var(--muted);
  margin-top: 1px;
}

.popover-foot {
  margin-top: 4px;
  padding: 8px 10px 6px;
  border-top: 1px solid var(--line-soft);
  font-size: 11px;
  color: var(--muted);
}

.popover-foot-title {
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 4px;
  color: var(--muted);
  font-size: 9.5px;
}

.popover-foot-row {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
  padding: 1px 0;
}

/* ---------- Upload progress modal ---------- */
.upload-progress {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(8, 11, 19, 0.55);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 500;
  padding: 24px;
  overflow-y: auto;
  animation: upFade 160ms ease;
}

[data-theme='light'] .upload-progress {
  background: rgba(15, 23, 42, 0.32);
}

@keyframes upFade {
  from { opacity: 0; }
  to { opacity: 1; }
}

.upload-progress[hidden] { display: none; }

.upload-progress-card {
  width: min(640px, 100%);
  max-height: calc(100vh - 48px);
  margin: auto 0;
  display: flex;
  flex-direction: column;
  gap: 14px;
  padding: 20px;
  border-radius: 16px;
  background: var(--surface);
  border: 1px solid var(--line);
  box-shadow: var(--shadow-2);
  overflow: hidden;
  min-height: 0;
}

.upload-progress-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.up-head-meta {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}

.up-kind-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 3px 8px;
  border-radius: 6px;
  background: color-mix(in oklab, var(--accent) 18%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 32%, transparent);
}

.up-head-meta strong {
  font-size: 14px;
  font-weight: 600;
  color: var(--ink);
}

.up-filename {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 240px;
}

.upload-progress-bar {
  height: 6px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.upload-progress-fill {
  height: 100%;
  width: 0%;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transition: width 220ms cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-progress-fill.is-indeterminate {
  width: 35% !important;
  animation: upIndet 1.4s ease-in-out infinite;
  background: linear-gradient(90deg, transparent, var(--accent), transparent);
}

@keyframes upIndet {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(420%); }
}

.upload-progress-fill.is-done {
  background: linear-gradient(90deg, var(--pos), color-mix(in oklab, var(--pos) 70%, var(--accent-2)));
}

.upload-progress-fill.is-error {
  background: linear-gradient(90deg, var(--neg), #ef4444);
}

.upload-progress-status {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  font-size: 12px;
  color: var(--ink-2);
}

.upload-progress-status .up-pct {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.upload-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.upload-stats .us-stat {
  display: flex;
  flex-direction: column;
  gap: 1px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.upload-stats .us-num {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.upload-stats .us-label {
  font-size: 10px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.upload-stats .us-new .us-num { color: var(--pos); }
.upload-stats .us-replaced .us-num { color: var(--accent); }
.upload-stats .us-skipped .us-num { color: var(--gold, #f59e0b); }

.upload-log-wrap {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1 1 0%;
  min-height: 0;
  overflow: hidden;
}

.upload-log-head {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.upload-log {
  font-family: var(--font-mono);
  font-size: 11.5px;
  line-height: 1.5;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  border-radius: 10px;
  padding: 10px 12px;
  flex: 1 1 0%;
  min-height: 80px;
  max-height: 240px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.upload-log .up-log-line {
  display: flex;
  gap: 8px;
  align-items: baseline;
  color: var(--ink-2);
  white-space: pre-wrap;
  word-break: break-word;
}

.upload-log .up-log-time {
  color: var(--muted);
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.upload-log .up-log-msg {
  flex: 1 1 auto;
}

.upload-log .lvl-success .up-log-msg { color: var(--pos); }
.upload-log .lvl-warn .up-log-msg { color: var(--gold, #f59e0b); }
.upload-log .lvl-error .up-log-msg { color: var(--neg); }

.upload-progress-foot {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  word-break: break-all;
}

.upload-progress.is-error .up-kind-tag {
  background: color-mix(in oklab, var(--neg) 22%, transparent);
  color: var(--neg);
  border-color: color-mix(in oklab, var(--neg) 36%, transparent);
}

.upload-progress.is-done .up-kind-tag {
  background: color-mix(in oklab, var(--pos) 22%, transparent);
  color: var(--pos);
  border-color: color-mix(in oklab, var(--pos) 36%, transparent);
}

@media (max-width: 700px) {
  .upload-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .upload-log { max-height: 160px; }
  .up-filename { max-width: 140px; }
}

@media (max-height: 620px) {
  .upload-progress-card { gap: 10px; padding: 16px; }
  .upload-log { min-height: 60px; max-height: 120px; }
  .upload-stats .us-num { font-size: 16px; }
  .upload-stats .us-stat { padding: 7px 9px; }
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ---------- Completion card ---------- */
.completion-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.completion-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.completion-stat .value {
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.completion-stat .label {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
}

.completion-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.completion-row {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(0, 1.4fr);
  gap: 16px;
  align-items: center;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.completion-row .meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.completion-row .meta strong {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.completion-row .meta small {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.completion-bars {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 8px;
}

.completion-bar {
  position: relative;
  height: 24px;
  border-radius: 6px;
  background: var(--surface-3);
  border: 1px solid var(--line-soft);
  overflow: hidden;
  display: flex;
  align-items: center;
  padding: 0 8px;
}

.completion-bar .cb-fill {
  position: absolute;
  inset: 0 auto 0 0;
  background: linear-gradient(90deg, color-mix(in oklab, var(--accent) 65%, transparent), color-mix(in oklab, var(--accent-2) 50%, transparent));
  opacity: 0.55;
}

.completion-bar .cb-label {
  position: relative;
  font-family: var(--font-mono);
  font-size: 10px;
  letter-spacing: 0.04em;
  color: var(--muted);
  z-index: 1;
}

.completion-bar .cb-value {
  position: relative;
  margin-left: auto;
  font-family: var(--font-mono);
  font-size: 11.5px;
  font-weight: 700;
  color: var(--ink);
  z-index: 1;
}

@media (max-width: 900px) {
  .completion-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .completion-row { grid-template-columns: 1fr; }
}

/* ---------- Channel mix tiles (Overview) ---------- */
.channel-mix-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.channel-tile {
  display: flex;
  flex-direction: column;
  gap: 4px;
  padding: 14px 14px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
  position: relative;
  overflow: hidden;
}

.channel-tile .channel-head {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.channel-tile .channel-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex: 0 0 auto;
}

.channel-tile .channel-name {
  color: var(--ink-2);
}

.channel-tile .channel-num {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.03em;
  line-height: 1;
}

.channel-tile .channel-meta {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 8px;
  margin-top: 2px;
}

.channel-tile .channel-pct {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
}

.channel-tile .channel-detail {
  font-size: 11px;
  color: var(--muted);
}

.channel-tile .channel-bar {
  margin-top: 6px;
  height: 5px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.channel-tile .channel-bar-fill {
  height: 100%;
  border-radius: inherit;
  transition: width 600ms cubic-bezier(0.4, 0, 0.2, 1);
}

@media (max-width: 800px) {
  .channel-mix-grid { grid-template-columns: 1fr; }
}

/* ---------- YouTube performance card ---------- */
.youtube-summary {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 16px;
}

.yt-stat {
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 12px 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.yt-stat-label {
  font-size: 10.5px;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 700;
}

.yt-stat-value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.05;
  margin-top: 4px;
}

.yt-stat-sub {
  font-size: 11px;
  color: var(--muted);
  margin-top: 2px;
}

.youtube-top {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.youtube-top-head {
  display: flex;
  align-items: baseline;
  gap: 8px;
}

.youtube-top-head .eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.youtube-top-head .small {
  font-size: 11px;
}

.youtube-bars {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.youtube-row {
  display: grid;
  grid-template-columns: minmax(0, 1.4fr) minmax(0, 2fr) auto;
  align-items: center;
  gap: 14px;
  padding: 8px 12px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.youtube-row .yt-meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.youtube-row .yt-meta strong {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.youtube-row .yt-meta small {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.youtube-row .yt-ratio {
  font-family: var(--font-mono);
  color: var(--accent);
  font-weight: 700;
}

.youtube-row .yt-bar {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.youtube-row .yt-bar-fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, #ef4444, #f97316);
}

.youtube-row .yt-views {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

@media (max-width: 900px) {
  .youtube-summary { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .youtube-row { grid-template-columns: 1fr; gap: 6px; }
  .youtube-row .yt-views { text-align: right; }
}

/* ---------- Hero ---------- */
.hero {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr) auto;
  gap: 24px;
  align-items: start;
  padding: 22px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background:
    radial-gradient(700px 400px at 0% 0%, rgba(124, 140, 255, 0.10), transparent 60%),
    var(--surface);
  box-shadow: var(--shadow-1);
}

.hero-art {
  position: relative;
  width: 132px;
  height: 132px;
  border-radius: 18px;
  overflow: hidden;
  background: linear-gradient(135deg, var(--surface-3), var(--surface-2));
  border: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: center;
  flex: 0 0 auto;
}

.hero-art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.hero-art-fallback {
  font-family: var(--font-mono);
  font-size: 38px;
  color: var(--muted);
  letter-spacing: -0.05em;
}

.hero-meta {
  min-width: 0;
}

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 10px;
}

.hero-eyebrow .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 0 4px var(--accent-glow);
}

.hero-name {
  font-size: clamp(28px, 3.4vw, 40px);
  line-height: 1.05;
  letter-spacing: -0.025em;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--ink);
}

.hero-summary {
  color: var(--ink-2);
  font-size: 14px;
  line-height: 1.6;
  max-width: 78ch;
  margin-bottom: 14px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.hero-stats {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 12px;
}

.hero-rank {
  align-self: stretch;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 12px;
  min-width: 220px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: linear-gradient(180deg, color-mix(in oklab, var(--accent-glow) 60%, transparent), transparent), var(--surface-2);
}

.hero-rank-eyebrow {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
}

.hero-rank-value {
  font-family: var(--font-mono);
  font-size: 56px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.04em;
  color: var(--ink);
}

.hero-rank-meta {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.4;
}

.hero-rank-meta strong {
  color: var(--ink-2);
  font-weight: 600;
}

/* ---------- Pills, tags, chips ---------- */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  color: var(--ink-2);
  font-size: 12px;
  font-weight: 600;
  white-space: nowrap;
}

.pill .dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--muted-2);
}

.pill.pos { color: var(--pos); border-color: color-mix(in oklab, var(--pos) 30%, var(--line)); background: var(--pos-soft); }
.pill.neg { color: var(--neg); border-color: color-mix(in oklab, var(--neg) 30%, var(--line)); background: var(--neg-soft); }
.pill.warn { color: var(--warn); border-color: color-mix(in oklab, var(--warn) 30%, var(--line)); background: var(--warn-soft); }
.pill.info { color: var(--info); border-color: color-mix(in oklab, var(--info) 30%, var(--line)); background: var(--info-soft); }
.pill.accent { color: var(--accent); border-color: color-mix(in oklab, var(--accent) 30%, var(--line)); background: var(--accent-glow); }
.pill.ghost { background: transparent; }

.tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.tag {
  display: inline-flex;
  align-items: center;
  padding: 3px 9px;
  border-radius: 999px;
  background: var(--surface-2);
  color: var(--ink-2);
  border: 1px solid var(--line);
  font-size: 12px;
  font-weight: 500;
  transition: background 140ms ease, color 140ms ease;
}

.tag:hover {
  background: var(--surface-3);
  color: var(--ink);
}

/* ---------- KPI strip ---------- */
.kpi-strip {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 10px;
}

.kpi {
  position: relative;
  display: flex;
  flex-direction: column;
  gap: 6px;
  padding: 14px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  transition: transform 200ms ease, border-color 200ms ease, box-shadow 200ms ease;
  overflow: hidden;
}

.kpi:hover {
  border-color: color-mix(in oklab, var(--accent) 30%, var(--line));
  transform: translateY(-1px);
}

.kpi-label {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 26px;
  font-weight: 600;
  line-height: 1.05;
  letter-spacing: -0.03em;
  color: var(--ink);
}

.kpi-detail {
  font-size: 12px;
  color: var(--muted);
  line-height: 1.35;
}

.kpi-spark {
  display: block;
  margin: 8px -16px -14px;
  width: calc(100% + 32px);
  height: 36px;
  pointer-events: none;
  opacity: 0.7;
}

/* ---------- Cards & view grids ---------- */
.views {
  display: block;
  position: relative;
}

.view {
  display: none;
  animation: fadeUp 240ms ease both;
}

.view.is-active {
  display: block;
}

@keyframes fadeUp {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.view-grid {
  display: grid;
  grid-template-columns: repeat(12, minmax(0, 1fr));
  gap: 16px;
}

.card {
  position: relative;
  display: flex;
  flex-direction: column;
  padding: 18px 18px 16px;
  border-radius: var(--radius-lg);
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: var(--shadow-1);
  min-width: 0;
}

.card-tall {
  min-height: 360px;
}

.card-graph {
  padding: 0;
  overflow: hidden;
  min-height: 580px;
}

.card-span-3 { grid-column: span 3; }
.card-span-4 { grid-column: span 4; }
.card-span-5 { grid-column: span 5; }
.card-span-6 { grid-column: span 6; }
.card-span-7 { grid-column: span 7; }
.card-span-8 { grid-column: span 8; }
.card-span-9 { grid-column: span 9; }
.card-span-12 { grid-column: span 12; }

.card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 14px;
}

.card-head h2,
.card-head h3 {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: -0.005em;
  color: var(--ink);
}

.card-head .eyebrow {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 4px;
}

.card-head .head-meta {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

.card-foot {
  margin-top: auto;
  padding-top: 14px;
  font-size: 12px;
  color: var(--muted);
}

/* Info indicator with floating tooltip system */
.info {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 1px solid var(--line);
  color: var(--muted);
  font-size: 9px;
  font-weight: 700;
  font-family: var(--font-sans);
  cursor: help;
  background: var(--surface-2);
  transition: color 120ms ease, border-color 120ms ease;
}

.info:hover {
  color: var(--ink);
  border-color: var(--ink-2);
}

/* ---------- Tooltip ---------- */
.tooltip {
  position: fixed;
  z-index: 200;
  max-width: 320px;
  padding: 9px 11px;
  background: var(--ink);
  color: var(--bg);
  font-size: 12px;
  line-height: 1.45;
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0, 0, 0, 0.4);
  pointer-events: none;
  opacity: 0;
  transform: translate(-50%, -8px);
  transition: opacity 140ms ease, transform 140ms ease;
}

.tooltip.is-visible {
  opacity: 1;
  transform: translate(-50%, -12px);
}

[data-theme='light'] .tooltip {
  background: #1f2330;
  color: #f6f7fb;
}

.tooltip strong {
  display: block;
  font-size: 12.5px;
  letter-spacing: 0.01em;
}

.tooltip .tt-pub {
  margin-top: 1px;
  font-size: 11px;
  opacity: 0.65;
}

.tooltip .tt-link {
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px solid rgba(15, 23, 42, 0.16);
  font-size: 11.5px;
}

.tooltip .tt-direct,
.tooltip .tt-indirect {
  display: inline-block;
  padding: 1px 6px;
  margin-right: 6px;
  border-radius: 999px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  font-size: 9.5px;
}

/* Default (dark mode) — tooltip background is var(--ink) = #ecedf2 (light cream),
   so pills need DEEP-tinted text to be legible. */
.tooltip .tt-direct {
  background: rgba(79, 70, 229, 0.18);
  color: #3a3fc7;
}

.tooltip .tt-indirect {
  background: rgba(15, 23, 42, 0.10);
  color: #2c303a;
}

/* Light mode — tooltip background is #1f2330 (dark slate),
   so pills need LIGHT-tinted text. */
[data-theme='light'] .tooltip .tt-direct {
  background: rgba(124, 140, 255, 0.22);
  color: #c5cdff;
}

[data-theme='light'] .tooltip .tt-indirect {
  background: rgba(255, 255, 255, 0.08);
  color: #d6d9e3;
}

[data-theme='light'] .tooltip .tt-link {
  border-top-color: rgba(255, 255, 255, 0.14);
}

.tooltip .tt-self {
  font-style: italic;
  opacity: 0.85;
}

.tooltip .tt-chain {
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.85;
  line-height: 1.45;
  word-break: break-word;
}

.tooltip .tt-arrow {
  opacity: 0.5;
  margin: 0 3px;
}

/* ---------- Charts (SVG) ---------- */
.chart {
  width: 100%;
  display: block;
  overflow: visible;
}

.chart text {
  fill: var(--muted);
  font-size: 10.5px;
  font-family: var(--font-sans);
}

.chart .grid-line {
  stroke: var(--line-soft);
  stroke-width: 1;
  stroke-dasharray: 2 4;
}

.chart .axis-label {
  fill: var(--muted-2);
  font-size: 10px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}

.chart .area-line {
  fill: none;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

.chart .area-fill {
  opacity: 0.85;
}

.chart .data-point {
  cursor: pointer;
  transition: r 120ms ease;
}

.chart .data-point:hover {
  r: 5.5;
}

.chart .crosshair {
  stroke: var(--ink-2);
  stroke-width: 1;
  stroke-dasharray: 2 3;
  opacity: 0;
  pointer-events: none;
}

.chart .crosshair.is-visible {
  opacity: 0.5;
}

.chart-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 14px;
  margin-top: 10px;
  font-size: 12px;
  color: var(--muted);
}

.chart-legend button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 0;
  cursor: pointer;
  color: var(--muted);
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font: inherit;
  font-weight: 500;
  transition: color 120ms ease, opacity 120ms ease;
}

.chart-legend button[aria-pressed='true'] {
  color: var(--ink);
}

.chart-legend button[aria-pressed='false'] {
  opacity: 0.45;
}

.chart-legend .swatch {
  width: 10px;
  height: 10px;
  border-radius: 3px;
}

/* Bar chart */
.bars {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.bar-row {
  display: grid;
  grid-template-columns: minmax(0, 110px) 1fr auto;
  gap: 12px;
  align-items: center;
  font-size: 12.5px;
}

.bar-row .label {
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.flag {
  display: inline-block;
  border-radius: 2px;
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.12), 0 1px 2px rgba(15, 23, 42, 0.08);
  flex: 0 0 auto;
  background: var(--surface-3);
  object-fit: cover;
  vertical-align: -2px;
}

.flag.flag-sm { width: 18px; height: 13.5px; }
.flag.flag-md { width: 22px; height: 16.5px; }
.flag.flag-lg { width: 28px; height: 21px; }

[data-theme='light'] .flag {
  box-shadow: 0 0 0 1px rgba(15, 23, 42, 0.16), 0 1px 2px rgba(15, 23, 42, 0.06);
}

/* ---------- Bar / Pie toggle (audience cards) ---------- */
.chart-toggle {
  display: inline-flex;
  background: var(--surface-2);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 2px;
  gap: 0;
}

.chart-toggle .ct-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px;
  height: 22px;
  border: 0;
  background: transparent;
  color: var(--muted);
  border-radius: 6px;
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
  padding: 0;
}

.chart-toggle .ct-btn:hover {
  color: var(--ink-2);
}

.chart-toggle .ct-btn.is-active {
  background: var(--surface);
  color: var(--accent);
  box-shadow: 0 0 0 1px var(--line) inset;
}

[data-theme='light'] .chart-toggle .ct-btn.is-active {
  background: var(--surface);
}

/* ---------- Donut chart ---------- */
.donut-wrap {
  display: grid;
  grid-template-columns: minmax(120px, 160px) minmax(0, 1fr);
  gap: 16px;
  align-items: center;
}

.donut-ring {
  position: relative;
  aspect-ratio: 1 / 1;
  width: 100%;
  max-width: 160px;
  margin: 0 auto;
}

.donut-svg {
  display: block;
  width: 100%;
  height: 100%;
  transform: rotate(0deg);
}

.donut-svg .donut-slice {
  transition: stroke-width 160ms ease, opacity 160ms ease;
}

.donut-svg:hover .donut-slice {
  opacity: 0.55;
}

.donut-svg .donut-slice:hover {
  stroke-width: 6;
  opacity: 1;
}

.donut-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  pointer-events: none;
  text-align: center;
  padding: 0 8px;
}

.donut-center-value {
  font-family: var(--font-mono);
  font-size: 20px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
  line-height: 1.05;
}

.donut-center-label {
  font-size: 10.5px;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--muted);
  font-weight: 600;
  margin-top: 4px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}

.donut-legend {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 0;
  font-size: 12px;
}

.donut-legend li {
  display: grid;
  grid-template-columns: 10px minmax(0, 1fr) auto;
  gap: 8px;
  align-items: center;
  min-width: 0;
}

.donut-legend .sw {
  width: 10px;
  height: 10px;
  border-radius: 3px;
  flex: 0 0 auto;
}

.donut-legend .lbl {
  display: flex;
  align-items: center;
  gap: 6px;
  min-width: 0;
  color: var(--ink-2);
}

.donut-legend .lbl-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--ink);
  font-weight: 500;
}

.donut-legend .lbl-sub {
  color: var(--muted);
  font-size: 11px;
  white-space: nowrap;
}

.donut-legend .val {
  font-family: var(--font-mono);
  font-weight: 600;
  color: var(--ink);
  font-size: 11.5px;
  letter-spacing: -0.02em;
}

@media (max-width: 700px) {
  .donut-wrap {
    grid-template-columns: 1fr;
    gap: 12px;
  }
}

.bar-row .track {
  position: relative;
  height: 8px;
  border-radius: 999px;
  background: var(--surface-3);
  overflow: hidden;
}

.bar-row .fill {
  position: absolute;
  inset: 0 auto 0 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  transform-origin: left center;
  animation: barIn 700ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.bar-row .fill.alt {
  background: linear-gradient(90deg, var(--teal), var(--info));
}

.bar-row .fill.warm {
  background: linear-gradient(90deg, var(--gold), var(--pink));
}

.bar-row .value {
  font-family: var(--font-mono);
  color: var(--ink);
  font-size: 12px;
  font-weight: 500;
  letter-spacing: -0.02em;
  white-space: nowrap;
}

@keyframes barIn {
  from { transform: scaleX(0); }
  to   { transform: scaleX(1); }
}

/* Donut chart wrapper */
.donut-wrap {
  display: flex;
  align-items: center;
  gap: 16px;
}

.donut-legend {
  display: flex;
  flex-direction: column;
  gap: 6px;
  font-size: 12px;
  color: var(--ink-2);
}

.donut-legend .row {
  display: flex;
  align-items: center;
  gap: 8px;
}

.donut-legend .swatch {
  width: 9px;
  height: 9px;
  border-radius: 2px;
}

/* ---------- Rank components ---------- */
.rank-strip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
  gap: 10px;
}

.rank-card {
  display: grid;
  grid-template-columns: auto minmax(0, 1fr);
  gap: 12px;
  align-items: center;
  padding: 12px 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
  transition: border-color 160ms ease, transform 160ms ease, background 160ms ease;
  cursor: default;
}

.rank-card > * {
  min-width: 0;
}

.rank-card:hover {
  border-color: color-mix(in oklab, var(--accent) 35%, var(--line));
  transform: translateY(-1px);
  background: var(--surface);
}

.rank-card.is-elite {
  border-color: color-mix(in oklab, var(--pos) 36%, var(--line));
  background: linear-gradient(180deg, var(--pos-soft), transparent), var(--surface-2);
}

.rank-card.is-strong {
  border-color: color-mix(in oklab, var(--accent) 30%, var(--line));
}

.rank-badge {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 14px;
  background: linear-gradient(180deg, var(--surface-3), var(--surface));
  border: 1px solid var(--line);
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--ink);
  flex: 0 0 auto;
}

.rank-card.is-elite .rank-badge {
  background: linear-gradient(180deg, var(--pos-soft), transparent), var(--surface);
  color: var(--pos);
  border-color: color-mix(in oklab, var(--pos) 30%, var(--line));
}

.rank-card.is-strong .rank-badge {
  color: var(--accent);
  border-color: color-mix(in oklab, var(--accent) 30%, var(--line));
}

.rank-card .country {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  line-height: 1.2;
  margin-bottom: 2px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  gap: 6px;
}

.rank-card .country > .country-name {
  flex: 1 1 auto;
  min-width: 0;
  display: flex;
  align-items: center;
  gap: 7px;
}

.rank-card .country > .country-name > .name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.rank-card .country > .country-name > .flag {
  flex: 0 0 auto;
}

.rank-card .country > .change {
  flex: 0 0 auto;
}

.rank-card .change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 999px;
}

.change.up { color: var(--pos); background: var(--pos-soft); }
.change.down { color: var(--neg); background: var(--neg-soft); }
.change.flat { color: var(--muted); background: var(--surface-3); }

.rank-card-body { min-width: 0; }

.rank-card .category {
  font-size: 12px;
  color: var(--muted);
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  min-width: 0;
}

.rank-card .category .cat-name {
  color: var(--ink-2);
  font-weight: 500;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  min-width: 0;
}

.rank-card .category .tracked {
  color: var(--muted);
  white-space: nowrap;
}

/* Platform tag — used by ranking surfaces to make "Apple Podcasts" explicit */
.platform-tag {
  display: inline-flex;
  align-items: center;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  padding: 1px 6px 2px;
  border-radius: 4px;
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  color: var(--accent);
  border: 1px solid color-mix(in oklab, var(--accent) 28%, transparent);
  white-space: nowrap;
  flex: 0 0 auto;
}

.market-row .platform {
  font-size: 10.5px;
  font-weight: 600;
  letter-spacing: 0.02em;
  color: var(--muted);
  white-space: nowrap;
}

.climb-card .climb-context {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 8px;
  font-size: 11.5px;
  color: var(--muted);
  flex-wrap: wrap;
}

.climb-card .climb-context .cat-name {
  color: var(--ink-2);
  font-weight: 500;
}

.nearby-card .nearby-sub {
  margin-top: -4px;
  margin-bottom: 8px;
}

.hero-rank-line {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  flex-wrap: wrap;
}

/* Climb model cards */
.climb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.climb-card {
  padding: 16px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.climb-card .country {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.climb-card .country > .name-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.climb-card .current {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.04em;
  color: var(--ink);
  line-height: 1;
  margin-bottom: 12px;
}

.climb-targets {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.climb-target {
  display: grid;
  grid-template-columns: auto 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--line-soft);
}

.climb-target .target-rank {
  width: 30px;
  height: 30px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
  background: var(--surface-3);
  color: var(--ink);
}

.climb-target .competitor {
  min-width: 0;
}

.climb-target .competitor .name {
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.climb-target .competitor .label {
  font-size: 10.5px;
  color: var(--muted-2);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.climb-target .lift {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 600;
  color: var(--accent);
  text-align: right;
}

.climb-target .lift small {
  display: block;
  font-size: 10px;
  font-weight: 500;
  color: var(--muted);
  letter-spacing: 0.02em;
}

/* Nearby competitor lists */
.nearby-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 12px;
}

.nearby-card {
  padding: 14px;
  border-radius: var(--radius);
  border: 1px solid var(--line);
  background: var(--surface-2);
}

.nearby-card h4 {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 8px;
  color: var(--ink);
  display: flex;
  align-items: center;
  gap: 7px;
  min-width: 0;
}

.nearby-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.nearby-list li {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 6px 8px;
  border-radius: 8px;
  font-size: 12.5px;
  color: var(--muted);
  border-left: 2px solid transparent;
}

.nearby-list li .rank-num {
  font-family: var(--font-mono);
  text-align: right;
  letter-spacing: -0.02em;
}

.nearby-list li.is-self {
  background: var(--accent-glow);
  color: var(--ink);
  font-weight: 600;
  border-left-color: var(--accent);
}

.nearby-list li.is-self .rank-num {
  color: var(--accent);
}

/* ---------- Tables ---------- */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius);
  border: 1px solid var(--line);
}

.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.data-table thead {
  position: sticky;
  top: 0;
  background: var(--surface-2);
  z-index: 1;
}

.data-table th {
  text-align: left;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  white-space: nowrap;
  cursor: pointer;
  user-select: none;
  transition: color 120ms ease, background 120ms ease;
}

.data-table th:hover {
  color: var(--ink);
  background: var(--surface-3);
}

.data-table th[data-sort='asc']::after,
.data-table th[data-sort='desc']::after {
  content: '';
  display: inline-block;
  margin-left: 6px;
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-top: 4px solid currentColor;
  transform: translateY(-1px);
  color: var(--accent);
}

.data-table th[data-sort='asc']::after {
  transform: rotate(180deg) translateY(-1px);
}

.data-table td {
  padding: 11px 12px;
  border-bottom: 1px solid var(--line-soft);
  color: var(--ink-2);
  vertical-align: middle;
}

.data-table tbody tr:last-child td {
  border-bottom: 0;
}

.data-table tbody tr:hover {
  background: var(--surface-2);
}

.data-table .num {
  font-family: var(--font-mono);
  font-variant-numeric: tabular-nums;
  text-align: right;
  color: var(--ink);
}

.data-table .title-cell {
  max-width: 460px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.data-table .title-cell strong {
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: block;
  max-width: 460px;
}

.data-table .title-cell small {
  color: var(--muted);
  font-size: 11.5px;
}

.table-toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.search-input {
  flex: 0 1 280px;
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  border-radius: 10px;
  border: 1px solid var(--line);
  background: var(--surface-2);
  color: var(--ink);
  transition: border-color 140ms ease, background 140ms ease;
}

.search-input:focus-within {
  border-color: color-mix(in oklab, var(--accent) 50%, var(--line));
  background: var(--surface);
}

.search-input svg {
  color: var(--muted);
  flex: 0 0 auto;
}

.search-input input {
  border: 0;
  background: transparent;
  outline: none;
  width: 100%;
  font-size: 13px;
}

.search-input input::placeholder {
  color: var(--muted);
}

/* ---------- Latest episode highlight ---------- */
.latest-episode {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 18px;
  padding: 14px;
  border-radius: var(--radius);
  background: linear-gradient(180deg, var(--accent-glow), transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 28%, var(--line));
}

.latest-episode .meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
  flex-wrap: wrap;
}

.latest-episode h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  color: var(--ink);
  margin-bottom: 8px;
  line-height: 1.25;
}

.latest-episode .stats {
  display: flex;
  gap: 18px;
  flex-wrap: wrap;
}

.latest-episode .stats .item {
  font-size: 12px;
  color: var(--muted);
}

.latest-episode .stats .item strong {
  display: block;
  font-family: var(--font-mono);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
  margin-bottom: 1px;
}

/* Leaderboard list */
.leader-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.leader-row {
  display: grid;
  grid-template-columns: 24px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 9px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.leader-row:hover {
  border-color: var(--line);
  background: var(--surface-3);
}

.leader-row .rank {
  font-family: var(--font-mono);
  color: var(--muted);
  font-size: 12px;
  text-align: right;
}

.leader-row .title {
  min-width: 0;
  font-size: 12.5px;
  color: var(--ink-2);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-weight: 500;
}

.leader-row .metric {
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.market-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.market-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto auto;
  gap: 12px;
  align-items: center;
  padding: 9px 10px 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  transition: background 140ms ease, border-color 140ms ease;
}

.market-row:hover {
  border-color: var(--line);
  background: var(--surface-3);
}

.market-row .meta {
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 1px;
  line-height: 1.25;
}

.market-row .country {
  font-size: 13px;
  color: var(--ink);
  font-weight: 600;
  letter-spacing: -0.01em;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.market-row .cat {
  font-size: 11px;
  color: var(--muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.market-row .rank-pill {
  display: inline-flex;
  align-items: baseline;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 8px;
  background: color-mix(in oklab, var(--accent) 14%, transparent);
  border: 1px solid color-mix(in oklab, var(--accent) 26%, transparent);
  white-space: nowrap;
}

.market-row .rank-pill .rank-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--accent);
  opacity: 0.9;
}

.market-row .rank-pill .rank-num {
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
  color: var(--ink);
  letter-spacing: -0.02em;
}

.market-row .rank-pill .rank-where {
  font-size: 11.5px;
  font-weight: 600;
  color: var(--ink-2);
  letter-spacing: -0.005em;
  margin-left: 1px;
}

.market-row .change {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  display: inline-flex;
  align-items: center;
  gap: 2px;
  padding: 1px 6px;
  border-radius: 999px;
}

.segmented {
  display: inline-flex;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface-2);
  border: 1px solid var(--line);
  gap: 1px;
}

.segmented button {
  appearance: none;
  background: transparent;
  border: 0;
  padding: 6px 10px;
  border-radius: 7px;
  font-size: 12px;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
  transition: background 140ms ease, color 140ms ease;
}

.segmented button:hover {
  color: var(--ink);
}

.segmented button.is-active {
  background: var(--surface-3);
  color: var(--ink);
  box-shadow: inset 0 0 0 1px var(--line);
}

/* ---------- Audience ---------- */
.audience-summary {
  display: grid;
  gap: 10px;
  margin-bottom: 16px;
}

.audience-summary .row {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 12px;
  padding: 8px 0;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}

.audience-summary .row:last-child {
  border-bottom: 0;
}

.audience-summary .row .label {
  color: var(--muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.audience-summary .row .value {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 12.5px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.theme-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.theme-item {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 12px;
  align-items: start;
  padding: 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.theme-item .num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--muted);
  width: 22px;
  text-align: center;
  padding-top: 1px;
}

.theme-item p {
  color: var(--ink-2);
  line-height: 1.55;
  font-size: 13px;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.review {
  padding: 14px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.review .meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}

.review .stars {
  display: inline-flex;
  gap: 1px;
  color: var(--gold);
}

.review .author {
  font-size: 12px;
  color: var(--muted);
  font-weight: 500;
}

.review .country {
  font-size: 11px;
  color: var(--muted-2);
  margin-left: auto;
}

.review .title {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 4px;
}

.review p {
  color: var(--ink-2);
  line-height: 1.55;
  font-size: 13px;
}

/* ---------- Network ---------- */
.network-canvas {
  position: relative;
  width: 100%;
  height: 100%;
  min-height: 580px;
  background:
    radial-gradient(700px 400px at 30% 30%, color-mix(in oklab, var(--accent) 12%, transparent), transparent 70%),
    radial-gradient(500px 400px at 75% 70%, color-mix(in oklab, var(--accent-2) 10%, transparent), transparent 70%),
    var(--bg-soft);
  overflow: hidden;
}

.network-canvas svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}

.network-canvas svg:active { cursor: grabbing; }

.network-graph-host {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
}

.network-graph-host canvas {
  display: block;
  outline: none;
}

.network-graph-host .scene-tooltip,
.network-graph-host .graph-info-msg { display: none !important; }

.graph-link {
  stroke: color-mix(in oklab, var(--ink) 18%, transparent);
  stroke-width: 0.7;
}

.graph-link.depth-0,
.graph-link.depth-1 {
  stroke: color-mix(in oklab, var(--accent) 38%, transparent);
  stroke-width: 1.4;
}

.graph-node {
  cursor: pointer;
  transition: filter 160ms ease;
}

.graph-node circle {
  stroke: color-mix(in oklab, var(--ink) 25%, transparent);
  stroke-width: 1.2;
  filter: drop-shadow(0 4px 10px rgba(0,0,0,0.4));
}

.graph-node.is-core circle {
  stroke: var(--ink);
  stroke-width: 2.4;
}

.graph-node.is-selected circle {
  stroke: var(--accent);
  stroke-width: 2.8;
  filter: drop-shadow(0 0 12px var(--accent-glow));
}

.graph-node.is-faded { opacity: 0.18; }

.graph-label {
  fill: color-mix(in oklab, var(--ink) 90%, transparent);
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
  paint-order: stroke;
  stroke: rgba(0, 0, 0, 0.45);
  stroke-width: 2.8px;
}

[data-theme='light'] .graph-label {
  stroke: rgba(255, 255, 255, 0.7);
}

.graph-label.is-core {
  font-size: 12px;
}

.network-toolbar {
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  z-index: 2;
  pointer-events: none;
}

.network-toolbar > * {
  pointer-events: auto;
}

.network-toolbar .stats {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 7px 12px;
  border-radius: 999px;
  background: color-mix(in oklab, var(--surface) 86%, transparent);
  border: 1px solid var(--line);
  backdrop-filter: blur(10px);
  font-size: 12px;
  color: var(--ink-2);
  font-weight: 500;
}

.network-controls {
  display: inline-flex;
  gap: 6px;
}

.network-controls button {
  appearance: none;
  border: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface) 86%, transparent);
  color: var(--ink-2);
  border-radius: 10px;
  padding: 7px 10px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  backdrop-filter: blur(10px);
  transition: background 140ms ease, color 140ms ease;
}

.network-controls button:hover {
  color: var(--ink);
  background: var(--surface-2);
}

.network-controls .zoom-btn {
  width: 30px;
  padding: 7px 0;
  font-size: 16px;
  line-height: 1;
  font-weight: 700;
  text-align: center;
}

.detail-panel h3 {
  font-size: 17px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  color: var(--ink);
}

.detail-panel .publisher {
  color: var(--muted);
  font-size: 12px;
  margin-bottom: 12px;
}

.detail-panel .description {
  color: var(--ink-2);
  font-size: 13px;
  line-height: 1.6;
  margin-bottom: 12px;
  display: -webkit-box;
  -webkit-line-clamp: 8;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.detail-panel .artwork {
  width: 100%;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  background: var(--surface-3);
  margin-bottom: 12px;
  overflow: hidden;
  border: 1px solid var(--line);
}

.detail-panel .detail-link {
  margin: 4px 0 14px;
  padding: 10px 12px;
  border-radius: 12px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.detail-panel .detail-link-tag {
  display: inline-block;
  padding: 2px 8px;
  margin-bottom: 6px;
  border-radius: 999px;
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.detail-panel .detail-link-tag.is-direct {
  background: color-mix(in oklab, var(--accent) 22%, transparent);
  color: var(--accent);
}

.detail-panel .detail-link-tag.is-indirect {
  background: color-mix(in oklab, var(--ink) 10%, transparent);
  color: var(--ink-2);
}

.detail-panel .detail-link-tag.is-self {
  background: color-mix(in oklab, var(--accent-2) 22%, transparent);
  color: var(--accent-2);
}

.detail-panel .detail-link-text {
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.5;
}

.detail-panel .detail-link-chain {
  margin-top: 6px;
  display: flex;
  flex-wrap: wrap;
  gap: 4px 6px;
  align-items: center;
  color: var(--ink);
  font-size: 12px;
  line-height: 1.4;
}

.detail-panel .detail-link-chain .arrow {
  opacity: 0.5;
  font-size: 11px;
}

.detail-panel .artwork img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.similar-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.similar-row {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: 10px;
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
  transition: background 140ms ease, border-color 140ms ease;
}

.similar-row:hover {
  background: var(--surface-3);
  border-color: var(--line);
}

.similar-row .pos {
  font-family: var(--font-mono);
  text-align: right;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
}

.similar-row .art {
  width: 32px;
  height: 32px;
  border-radius: 7px;
  overflow: hidden;
  background: var(--surface-3);
  border: 1px solid var(--line);
  flex: 0 0 auto;
}

.similar-row .art img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.similar-row .meta {
  min-width: 0;
}

.similar-row .meta strong {
  display: block;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.similar-row .meta small {
  font-size: 11px;
  color: var(--muted);
}

.similar-row .badge {
  font-size: 11px;
  padding: 2px 6px;
  border-radius: 6px;
  background: var(--surface-3);
  color: var(--muted);
  font-weight: 600;
}

.similar-row .badge.sponsored {
  color: var(--gold);
  background: color-mix(in oklab, var(--gold) 14%, transparent);
}

.target-sponsor-head {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
  flex-wrap: wrap;
}

.target-sponsor-stats {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 10px;
  margin-bottom: 14px;
}

.target-sponsor-stat {
  padding: 12px 14px;
  border-radius: 14px;
  background: var(--surface-2);
  border: 1px solid var(--line-soft);
}

.target-sponsor-stat span {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.target-sponsor-stat strong {
  display: block;
  color: var(--ink);
  font-size: 18px;
  letter-spacing: -0.02em;
}

.target-sponsor-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.target-sponsor-section {
  display: flex;
  flex-direction: column;
  gap: 12px;
  padding-top: 14px;
  margin-top: 14px;
  border-top: 1px solid var(--line-soft);
}

.target-sponsor-section-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 16px;
}

.target-sponsor-section-head h4 {
  color: var(--ink);
  font-size: 14px;
  letter-spacing: -0.01em;
  margin-bottom: 3px;
}

.target-sponsor-section-head p {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.5;
  max-width: 760px;
}

.target-sponsor-section-head > span {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 34px;
  height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 700;
}

.target-sponsor-card {
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border-radius: 16px;
  background:
    linear-gradient(135deg, color-mix(in oklab, var(--accent) 8%, transparent), transparent 42%),
    var(--surface-2);
  border: 1px solid var(--line-soft);
}

.target-sponsor-title {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.target-sponsor-title h4 {
  color: var(--ink);
  font-size: 15px;
  line-height: 1.2;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}

.target-sponsor-category {
  color: var(--muted);
  font-size: 12px;
  font-weight: 500;
}

.target-sponsor-score {
  flex: 0 0 auto;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 44px;
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--pos-soft);
  color: var(--pos);
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 700;
}

.target-sponsor-card.is-talent_read .target-sponsor-score {
  background: var(--gold);
  color: #15171c;
}

.target-sponsor-card.is-talent_read blockquote {
  border-left-color: var(--gold);
}

.target-sponsor-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.target-sponsor-tags span {
  padding: 4px 8px;
  border-radius: 999px;
  background: var(--surface-3);
  color: var(--ink-2);
  border: 1px solid var(--line-soft);
  font-size: 11px;
  font-weight: 600;
}

.target-sponsor-card blockquote {
  margin: 0;
  padding: 10px 12px;
  border-left: 3px solid var(--accent);
  border-radius: 10px;
  background: color-mix(in oklab, var(--surface) 72%, transparent);
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.55;
}

.target-sponsor-angle {
  margin-top: auto;
}

.target-sponsor-angle span {
  display: block;
  color: var(--muted);
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 4px;
}

.target-sponsor-angle p {
  color: var(--ink-2);
  font-size: 12.5px;
  line-height: 1.5;
}

/* Guest gallery */
.guest-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 8px;
}

.guest-card {
  padding: 10px 12px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.guest-card .name {
  font-size: 13px;
  font-weight: 600;
  color: var(--ink);
  margin-bottom: 2px;
}

.guest-card .role {
  font-size: 11.5px;
  color: var(--muted);
  line-height: 1.4;
}

/* ---------- Revenue ---------- */
.cpm-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

.cpm-table th {
  text-align: right;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
}

.cpm-table th:first-child {
  text-align: left;
}

.cpm-table td {
  padding: 12px;
  border-bottom: 1px solid var(--line-soft);
  font-family: var(--font-mono);
  text-align: right;
  font-variant-numeric: tabular-nums;
  color: var(--ink);
  letter-spacing: -0.01em;
}

.cpm-table td:first-child {
  font-family: var(--font-sans);
  text-align: left;
  color: var(--muted);
  font-weight: 600;
}

.cpm-table tbody tr:hover { background: var(--surface-2); }

.cpm-table tr.highlight {
  background: var(--accent-glow);
}

.cpm-table tr.highlight td {
  color: var(--ink);
}

.metric-stack {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.metric-stack .metric {
  padding: 14px;
  border-radius: 12px;
  border: 1px solid var(--line-soft);
  background: var(--surface-2);
}

.metric-stack .metric .label {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--muted);
  font-weight: 600;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.metric-stack .metric .value {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.03em;
  color: var(--ink);
  line-height: 1;
}

.metric-stack .metric .detail {
  font-size: 12px;
  color: var(--muted);
  margin-top: 4px;
}

/* ---------- Footer ---------- */
.appfoot {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 4px;
  font-size: 11.5px;
  color: var(--muted);
}

/* ---------- Auth ---------- */
.auth-pending .app {
  display: none;
}

.auth-root {
  min-height: 100vh;
  display: grid;
  place-items: center;
  padding: 24px;
}

.auth-root[hidden] {
  display: none;
}

.auth-card {
  width: min(420px, 100%);
  display: grid;
  gap: 14px;
  padding: 24px;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: color-mix(in oklab, var(--surface) 94%, transparent);
  box-shadow: var(--shadow-2);
}

.auth-brand {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 4px;
}

.auth-brand > div {
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.auth-brand strong {
  font-size: 18px;
  line-height: 1.1;
}

.auth-brand span:not(.brand-mark) {
  color: var(--muted);
  font-size: 13px;
}

.auth-copy {
  color: var(--muted);
}

.auth-field {
  display: grid;
  gap: 6px;
  color: var(--ink-2);
  font-weight: 600;
  font-size: 12px;
}

.auth-field input,
.invite-copy-field {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink);
  padding: 10px 12px;
  outline: none;
}

.auth-field input:focus,
.invite-copy-field:focus {
  border-color: color-mix(in oklab, var(--accent) 50%, var(--line));
  background: var(--surface);
}

.auth-submit {
  justify-content: center;
}

.auth-message {
  padding: 9px 11px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
}

.auth-message[hidden] {
  display: none;
}

.auth-message.is-neg {
  border-color: color-mix(in oklab, var(--neg) 35%, var(--line));
  background: var(--neg-soft);
  color: var(--ink);
}

.auth-message.is-pos {
  border-color: color-mix(in oklab, var(--pos) 35%, var(--line));
  background: var(--pos-soft);
  color: var(--ink);
}

.auth-loading {
  justify-items: center;
  text-align: center;
}

.loader-dot {
  width: 12px;
  height: 12px;
  border-radius: 999px;
  background: var(--accent);
  animation: pulseDot 900ms ease-in-out infinite;
}

@keyframes pulseDot {
  0%, 100% { transform: scale(0.8); opacity: 0.5; }
  50% { transform: scale(1.1); opacity: 1; }
}

.session-controls {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 260;
  display: flex;
  align-items: center;
  gap: 8px;
}

.admin-fab {
  box-shadow: var(--shadow-2);
}

.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 520;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background: rgba(8, 11, 19, 0.62);
  backdrop-filter: blur(5px);
  -webkit-backdrop-filter: blur(5px);
}

.modal-card {
  width: min(720px, 100%);
  max-height: calc(100vh - 48px);
  overflow: auto;
  border: 1px solid var(--line);
  border-radius: var(--radius-xl);
  background: var(--surface);
  box-shadow: var(--shadow-2);
}

.modal-head {
  position: sticky;
  top: 0;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 20px;
  border-bottom: 1px solid var(--line);
  background: color-mix(in oklab, var(--surface) 92%, transparent);
  backdrop-filter: blur(10px);
}

.modal-head .eyebrow {
  display: block;
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.modal-head h2 {
  font-size: 20px;
  line-height: 1.2;
}

.report-modal {
  width: min(1040px, 100%);
}

.report-modal-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.report-summary-box {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background:
    radial-gradient(circle at top left, color-mix(in oklab, var(--accent) 16%, transparent), transparent 42%),
    var(--surface-2);
}

.report-summary-box h3,
.report-panel h3 {
  margin: 2px 0 4px;
  font-size: 16px;
}

.report-summary-box p {
  max-width: 620px;
  color: var(--muted);
  font-size: 13px;
  line-height: 1.45;
}

.report-format-pills {
  display: flex;
  gap: 7px;
  flex-wrap: wrap;
}

.report-format-pills span {
  padding: 5px 9px;
  border-radius: 999px;
  background: var(--accent-glow);
  color: var(--accent);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.04em;
}

.report-amount-card {
  display: grid;
  gap: 12px;
  padding: 16px;
  border: 1px solid color-mix(in oklab, var(--accent) 28%, var(--line));
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.report-label {
  display: block;
  margin-bottom: 6px;
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.report-amount-row {
  display: flex;
  align-items: center;
  gap: 10px;
}

.report-dollar-input {
  width: 150px;
  font-size: 22px;
  font-weight: 800;
  letter-spacing: -0.03em;
}

.report-amount-note {
  color: var(--muted);
  font-weight: 600;
}

.report-amount-card input[type='range'] {
  width: 100%;
  accent-color: var(--accent);
}

.report-minimum {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  color: var(--muted);
  font-size: 13px;
}

.report-minimum strong {
  color: var(--ink);
}

.report-modal-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.8fr);
  gap: 16px;
}

.report-panel {
  min-width: 0;
  padding: 16px;
  border: 1px solid var(--line);
  border-radius: var(--radius-lg);
  background: var(--surface);
}

.report-panel-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 12px;
}

.report-mini-actions {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.report-mini-actions .ghost-btn {
  padding: 5px 8px;
  border-radius: 8px;
  font-size: 11px;
}

.report-section-list {
  display: grid;
  gap: 14px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.report-section-group {
  display: grid;
  gap: 7px;
}

.report-section-group-title {
  color: var(--muted);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.07em;
  text-transform: uppercase;
}

.report-check {
  display: grid;
  grid-template-columns: 18px 1fr;
  gap: 9px;
  align-items: center;
  min-height: 34px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 10px;
  background: var(--surface-2);
  color: var(--ink-2);
  font-size: 13px;
  cursor: pointer;
}

.report-check input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.report-check-box {
  width: 18px;
  height: 18px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--surface);
  box-shadow: inset 0 0 0 2px var(--surface);
}

.report-check input:checked + .report-check-box {
  border-color: var(--accent);
  background: linear-gradient(180deg, var(--accent), var(--accent-2));
}

.report-check input:checked + .report-check-box::after {
  content: '';
  display: block;
  width: 8px;
  height: 4px;
  margin: 5px 0 0 4px;
  border-left: 2px solid white;
  border-bottom: 2px solid white;
  transform: rotate(-45deg);
}

.report-variable-grid {
  display: grid;
  gap: 8px;
  max-height: 420px;
  overflow: auto;
  padding-right: 4px;
}

.report-variable {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 9px 10px;
  border-radius: 10px;
  background: var(--surface-2);
  font-size: 12px;
}

.report-variable span {
  color: var(--muted);
}

.report-variable strong {
  color: var(--ink);
  font-family: var(--font-mono);
  font-size: 11px;
  text-align: right;
}

.report-actions {
  display: flex;
  justify-content: flex-end;
  gap: 10px;
  padding-top: 2px;
}

.user-manager-body {
  display: grid;
  gap: 16px;
  padding: 20px;
}

.add-user-form {
  display: grid;
  grid-template-columns: 1fr auto;
  align-items: end;
  gap: 10px;
}

.add-user-form .auth-field {
  min-width: 0;
}

.invite-copy {
  display: grid;
  gap: 8px;
  padding: 12px;
  border: 1px solid color-mix(in oklab, var(--accent) 30%, var(--line));
  border-radius: var(--radius);
  background: var(--accent-glow);
}

.invite-copy-head,
.user-list-head {
  color: var(--muted);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
}

.invite-copy-field {
  min-height: 74px;
  resize: vertical;
  font-family: var(--font-mono);
  font-size: 12px;
}

.user-list {
  display: grid;
  gap: 8px;
}

.user-list-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 12px;
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
}

.user-row strong,
.user-row small {
  display: block;
}

.user-row small,
.muted-list {
  color: var(--muted);
}

.user-row-meta {
  min-width: 0;
}

.user-row-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex: 0 0 auto;
}

.user-badge {
  flex: 0 0 auto;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 700;
  background: var(--surface-3);
  color: var(--ink-2);
}

.danger-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 6px 10px;
  border-radius: 8px;
  border: 1px solid color-mix(in oklab, var(--neg) 35%, var(--line));
  background: var(--neg-soft);
  color: var(--neg);
  font-weight: 600;
  font-size: 12px;
  cursor: pointer;
  transition: background 140ms ease, border-color 140ms ease, color 140ms ease;
}

.danger-btn:hover {
  background: color-mix(in oklab, var(--neg) 18%, transparent);
  border-color: var(--neg);
}

.danger-btn:disabled {
  cursor: progress;
  opacity: 0.7;
}

.user-badge.is-ok {
  color: var(--pos);
  background: var(--pos-soft);
}

.user-badge.is-warn {
  color: var(--warn);
  background: var(--warn-soft);
}

@media (max-width: 640px) {
  .session-controls {
    left: 16px;
    right: 16px;
    bottom: 16px;
    justify-content: flex-end;
  }

  .add-user-form {
    grid-template-columns: 1fr;
  }

  .report-summary-box,
  .report-minimum {
    align-items: flex-start;
    flex-direction: column;
  }

  .report-modal-grid {
    grid-template-columns: 1fr;
  }

  .user-row {
    align-items: flex-start;
    flex-direction: column;
  }

  .user-row-actions {
    width: 100%;
    justify-content: space-between;
  }
}

/* ---------- Toasts ---------- */
.toast-host {
  position: fixed;
  inset: auto 24px 84px auto;
  z-index: 600;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toast {
  padding: 12px 16px;
  border-radius: 12px;
  background: var(--surface);
  border: 1px solid var(--line);
  color: var(--ink);
  box-shadow: var(--shadow-2);
  font-size: 13px;
  display: flex;
  align-items: center;
  gap: 10px;
  animation: toastIn 220ms cubic-bezier(0.4, 0, 0.2, 1) both;
}

.toast.is-pos { border-color: color-mix(in oklab, var(--pos) 30%, var(--line)); }
.toast.is-neg { border-color: color-mix(in oklab, var(--neg) 30%, var(--line)); }

.toast .toast-mark {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: var(--accent);
}

.toast.is-pos .toast-mark { background: var(--pos); }
.toast.is-neg .toast-mark { background: var(--neg); }

@keyframes toastIn {
  from { transform: translateY(8px); opacity: 0; }
  to { transform: translateY(0); opacity: 1; }
}

/* ---------- Skeletons ---------- */
.skeleton {
  display: block;
  border-radius: 8px;
  background: linear-gradient(90deg, var(--surface-2), var(--surface-3), var(--surface-2));
  background-size: 200% 100%;
  animation: shimmer 1.4s linear infinite;
}

@keyframes shimmer {
  from { background-position: 200% 0; }
  to { background-position: -200% 0; }
}

/* ---------- Empty / muted ---------- */
.muted {
  color: var(--muted);
  font-size: 13px;
  line-height: 1.5;
}

.empty {
  display: grid;
  place-items: center;
  padding: 32px 18px;
  text-align: center;
  color: var(--muted);
  border: 1px dashed var(--line);
  border-radius: var(--radius);
  background: var(--surface-2);
}

.empty strong {
  display: block;
  color: var(--ink);
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 4px;
}

/* ---------- Responsive ---------- */
@media (max-width: 1180px) {
  .kpi-strip { grid-template-columns: repeat(3, minmax(0, 1fr)); }
  .card-span-7, .card-span-5, .card-span-8, .card-span-4, .card-span-6 { grid-column: span 12; }
  .card-span-3 { grid-column: span 6; }
  .target-sponsor-stats { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 880px) {
  .topbar { flex-direction: column; align-items: stretch; gap: 10px; }
  .topbar-left { flex-direction: column; align-items: stretch; gap: 10px; }
  .tabs { width: 100%; justify-content: flex-start; }
  .topbar-actions { justify-content: flex-end; }

  .hero { grid-template-columns: 1fr; }
  .hero-art { width: 96px; height: 96px; }
  .hero-rank { min-width: 0; }

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

  .card-graph { min-height: 460px; }
  .target-sponsor-grid { grid-template-columns: 1fr; }
}

@media (max-width: 560px) {
  .app { padding-top: 8px; width: calc(100% - 16px); }
  .kpi-strip { grid-template-columns: 1fr; }
  .target-sponsor-stats { grid-template-columns: 1fr; }
  .data-table .title-cell { max-width: 240px; }
  .data-table .title-cell strong { max-width: 240px; }
  .hero-rank-value { font-size: 44px; }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.001ms !important;
    transition-duration: 0.001ms !important;
  }
}
