/* =============================================
   DONKEY TRENDRADAR · DESIGN SYSTEM
   ============================================= */

:root {
  /* Surfaces */
  --bg-page: #F5F4EE;
  --bg-card: #FFFFFF;
  --bg-elevated: #FBFBF8;
  --bg-tint: #EFEDE5;
  --bg-deep: #1A1A1A;

  /* Text */
  --text-1: #1A1A1A;
  --text-2: #5C5C5C;
  --text-3: #9B9A93;
  --text-on-deep: #FAFAF7;

  /* Lines */
  --line: #E6E4DA;
  --line-soft: #EDEBE2;
  --line-strong: #D4D2C7;

  /* Accents */
  --accent: #FF5E3A;        /* Donkey-ish coral */
  --accent-soft: #FFE7E0;
  --accent-deep: #E14E2C;
  --accent-text: #8C2A14;

  --hot: #FF3B47;
  --warm: #F59E0B;
  --cool: #3B82F6;
  --positive: #10B981;
  --info: #6366F1;

  /* Pastel tags */
  --tag-pink: #FFE4E1;
  --tag-pink-text: #9B3A5A;
  --tag-blue: #E0F2FE;
  --tag-blue-text: #0C5A86;
  --tag-green: #DCFCE7;
  --tag-green-text: #166534;
  --tag-yellow: #FEF3C7;
  --tag-yellow-text: #854D0E;
  --tag-purple: #F3E8FF;
  --tag-purple-text: #6B21A8;
  --tag-orange: #FFEDD5;
  --tag-orange-text: #9A3412;

  /* Type */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  --font-display: 'Fraunces', Georgia, serif;
  --font-mono: 'JetBrains Mono', 'SF Mono', monospace;

  /* Radii */
  --r-xs: 4px;
  --r-sm: 6px;
  --r-md: 10px;
  --r-lg: 14px;
  --r-xl: 20px;
  --r-2xl: 28px;
  --r-pill: 999px;

  /* Shadow */
  --shadow-sm: 0 1px 2px rgba(20, 20, 20, 0.04);
  --shadow-md: 0 4px 14px rgba(20, 20, 20, 0.06);
  --shadow-lg: 0 16px 40px rgba(20, 20, 20, 0.10);
  --shadow-xl: 0 24px 60px rgba(20, 20, 20, 0.18);
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font-sans);
  font-size: 14px;
  line-height: 1.5;
  color: var(--text-1);
  background: var(--bg-page);
  -webkit-font-smoothing: antialiased;
  text-rendering: optimizeLegibility;
}

button {
  font-family: inherit;
  cursor: pointer;
  border: none;
  background: none;
  color: inherit;
}

input, textarea, select {
  font-family: inherit;
  font-size: inherit;
  color: inherit;
}

a { color: inherit; }

::selection { background: var(--accent-soft); color: var(--accent-text); }

/* =============================================
   APP LAYOUT
   ============================================= */

#app {
  display: grid;
  grid-template-rows: 64px 1fr;
  grid-template-columns: minmax(0, 100%);
  height: 100vh;
  width: 100%;
  overflow: hidden;
}
#app > * { min-width: 0; }

#screen-container {
  overflow-y: auto;
  overflow-x: hidden;
  background: var(--bg-page);
  position: relative;
  min-width: 0;
}

.screen {
  display: none;
  padding: 28px 36px 60px;
  max-width: 1600px;
  margin: 0 auto;
  width: 100%;
  min-width: 0;
  box-sizing: border-box;
  animation: screenIn 280ms cubic-bezier(0.2, 0.8, 0.2, 1);
}

.radar-layout, .explore-layout, .scout-layout, .report-grid, .stats-row, .form-grid, .reco-grid, .visual-cluster, .related-row, .meta-grid {
  min-width: 0;
}
.radar-layout > *, .explore-layout > *, .scout-layout > *, .report-grid > * {
  min-width: 0;
}
.screen.active { display: block; }

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

/* =============================================
   TOPBAR
   ============================================= */

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  background: var(--bg-card);
  border-bottom: 1px solid var(--line);
  z-index: 50;
  position: relative;
  min-width: 0;
  overflow-x: auto;
}
.topbar::-webkit-scrollbar { display: none; }
.topbar-left, .topbar-right { flex-shrink: 0; }

.topbar-left, .topbar-right {
  display: flex;
  align-items: center;
  gap: 28px;
}

.logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding-right: 18px;
  border-right: 1px solid var(--line);
  height: 64px;
}

.logo-mark {
  width: 32px;
  height: 32px;
  background: var(--bg-deep);
  color: var(--accent);
  border-radius: var(--r-md);
  display: grid;
  place-items: center;
  position: relative;
  overflow: hidden;
}
.logo-mark::after {
  content: '';
  position: absolute;
  inset: 0;
  background: conic-gradient(from 0deg, transparent, rgba(255, 94, 58, 0.4), transparent 30%);
  animation: radarSweep 6s linear infinite;
}
.logo-mark svg { width: 18px; height: 18px; position: relative; z-index: 1; }

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

.logo-title {
  font-weight: 600;
  font-size: 14px;
  letter-spacing: -0.01em;
}
.logo-accent {
  color: var(--accent);
  font-family: var(--font-display);
  font-style: italic;
  font-weight: 600;
}
.logo-sub {
  font-size: 10.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  margin-top: 1px;
}

.main-nav {
  display: flex;
  gap: 4px;
  align-items: center;
  height: 64px;
}

.nav-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-2);
  transition: all 160ms ease;
}
.nav-btn:hover {
  color: var(--text-1);
  background: var(--bg-tint);
}
.nav-btn.active {
  background: var(--bg-deep);
  color: var(--text-on-deep);
}
.nav-btn.active svg { color: var(--accent); }

.quick-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 7px 12px;
  background: var(--bg-tint);
  border-radius: var(--r-pill);
  width: 320px;
  color: var(--text-3);
}
.quick-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-1);
}
.quick-search input::placeholder { color: var(--text-3); }
.quick-search kbd {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: var(--bg-card);
  padding: 1px 6px;
  border-radius: var(--r-xs);
  color: var(--text-3);
  border: 1px solid var(--line);
}

.icon-btn {
  width: 34px;
  height: 34px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  color: var(--text-2);
  transition: all 160ms ease;
  position: relative;
}
.icon-btn:hover {
  background: var(--bg-tint);
  color: var(--text-1);
}
.icon-btn .dot {
  position: absolute;
  top: 8px;
  right: 9px;
  width: 6px;
  height: 6px;
  background: var(--accent);
  border-radius: 50%;
  border: 2px solid var(--bg-card);
}

.avatar {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: linear-gradient(135deg, #FFB7C5, #FF5E3A);
  color: white;
  display: grid;
  place-items: center;
  font-weight: 600;
  font-size: 11px;
  letter-spacing: 0.02em;
}
.avatar.small { width: 24px; height: 24px; font-size: 9.5px; }

/* =============================================
   SCREEN HEADER
   ============================================= */

.screen-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  margin-bottom: 24px;
  gap: 20px;
}

.breadcrumb {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.12em;
  margin-bottom: 6px;
  font-weight: 600;
}

.screen-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 38px;
  margin: 0;
  letter-spacing: -0.025em;
  line-height: 1.05;
}
.muted { color: var(--text-3); font-weight: 400; }
.muted-light { color: var(--text-2); font-weight: 400; font-style: italic; }

.screen-sub {
  margin: 6px 0 0;
  color: var(--text-2);
  font-size: 14px;
  max-width: 720px;
}

.header-actions {
  display: flex;
  gap: 8px;
  flex-shrink: 0;
}

/* =============================================
   BUTTONS
   ============================================= */

.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  border-radius: var(--r-pill);
  font-size: 13px;
  font-weight: 500;
  transition: all 160ms ease;
  border: 1px solid transparent;
}
.btn-primary {
  background: var(--bg-deep);
  color: var(--text-on-deep);
}
.btn-primary:hover {
  background: #2a2a2a;
  transform: translateY(-1px);
  box-shadow: var(--shadow-md);
}
.btn-ghost {
  background: var(--bg-card);
  color: var(--text-1);
  border-color: var(--line);
}
.btn-ghost:hover {
  background: var(--bg-elevated);
  border-color: var(--line-strong);
}

.text-btn {
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
}
.text-btn:hover { color: var(--accent); }

/* =============================================
   FILTER BAR
   ============================================= */

.filter-bar {
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 14px 18px;
  margin-bottom: 20px;
  box-shadow: var(--shadow-sm);
  flex-wrap: wrap;
}

.chip-group {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.filter-group label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.chip {
  padding: 5px 11px;
  font-size: 12px;
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-weight: 500;
  transition: all 140ms ease;
  border: 1px solid transparent;
}
.chip:hover { background: var(--bg-tint); color: var(--text-1); }
.chip.active {
  background: var(--bg-deep);
  color: var(--text-on-deep);
}

.divider-v {
  width: 1px;
  height: 24px;
  background: var(--line);
}

/* =============================================
   STATS ROW
   ============================================= */

.stats-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 20px;
}

.stat-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 18px;
  box-shadow: var(--shadow-sm);
}

.stat-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 8px;
}
.stat-value {
  font-family: var(--font-display);
  font-size: 32px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.hot-badge {
  color: var(--hot);
  font-size: 14px;
  animation: pulse 1.6s ease-in-out infinite;
}
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}
.stat-trend {
  font-size: 11.5px;
  margin-top: 6px;
  font-weight: 500;
}
.stat-trend.up { color: var(--positive); }
.stat-trend.down { color: var(--hot); }
.stat-trend.neutral { color: var(--text-3); }

/* =============================================
   RADAR LAYOUT
   ============================================= */

.radar-layout {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 16px;
  margin-bottom: 16px;
}

.radar-panel, .trends-panel, .timeline-panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}

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

.panel-title {
  font-weight: 600;
  font-size: 15px;
  letter-spacing: -0.01em;
}
.panel-sub {
  font-size: 12px;
  color: var(--text-3);
  margin-top: 3px;
}

.legend {
  display: flex;
  gap: 14px;
  align-items: center;
  flex-wrap: wrap;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-2);
}
.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.legend-dot.hot { background: var(--hot); }
.legend-dot.warm { background: var(--warm); }
.legend-dot.cool { background: var(--cool); }

/* RADAR STAGE (SVG) */
.radar-stage {
  position: relative;
  aspect-ratio: 1.05 / 1;
  width: 100%;
  background: radial-gradient(circle at center, #FCFBF6 0%, #F8F7F0 100%);
  border-radius: var(--r-md);
  overflow: hidden;
}
.radar-stage svg { width: 100%; height: 100%; display: block; }

.radar-bubble {
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.radar-bubble:hover .radar-bubble-circle {
  filter: brightness(1.05);
  stroke-width: 2.5;
}
.radar-bubble:hover .radar-bubble-label {
  font-weight: 600;
}
.radar-bubble-pulse {
  animation: bubblePulse 2.4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes bubblePulse {
  0%, 100% { opacity: 0.3; transform: scale(1); }
  50% { opacity: 0; transform: scale(1.6); }
}

/* Radar sweep — transform-origin set inline to (cx, cy) in SVG user units.
   transform-box: view-box keeps that origin in the SVG's coordinate space
   (the default in many browsers but explicit here for correctness). */
.radar-sweep {
  transform-box: view-box;
  animation: radarSweepRotate 8s linear infinite;
}
@keyframes radarSweepRotate {
  to { transform: rotate(360deg); }
}

/* TRENDS PANEL */
.trend-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-height: 480px;
  overflow-y: auto;
  margin: 0 -8px;
  padding: 0 8px;
}

.trend-item {
  display: grid;
  grid-template-columns: 36px 1fr auto;
  gap: 12px;
  padding: 10px 8px;
  border-radius: var(--r-md);
  cursor: pointer;
  align-items: center;
  transition: background 140ms ease;
}
.trend-item:hover { background: var(--bg-tint); }

.trend-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 18px;
}

.trend-info { min-width: 0; }
.trend-name {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-1);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  letter-spacing: -0.01em;
}
.trend-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.trend-meta .dot-sep { width: 2px; height: 2px; background: var(--text-3); border-radius: 50%; display: inline-block; }

.trend-stat {
  text-align: right;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--positive);
  font-weight: 600;
}
.trend-stat.down { color: var(--hot); }

/* =============================================
   TIMELINE
   ============================================= */
.timeline-stage {
  position: relative;
  height: 200px;
  width: 100%;
}
.timeline-stage svg { width: 100%; height: 100%; }

/* =============================================
   EXPLORE
   ============================================= */

.explore-search-row {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  align-items: center;
}

.explore-search {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 10px 18px;
  box-shadow: var(--shadow-sm);
  transition: all 160ms ease;
}
.explore-search:focus-within {
  border-color: var(--text-1);
  box-shadow: 0 0 0 4px rgba(26, 26, 26, 0.05);
}
.explore-search svg { color: var(--text-3); }
.explore-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 14px;
}
.ai-hint {
  display: flex;
  align-items: center;
  gap: 5px;
  background: var(--accent-soft);
  color: var(--accent-text);
  padding: 4px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
}

.view-switch {
  display: flex;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 3px;
  gap: 2px;
}
.vs-btn {
  width: 32px;
  height: 32px;
  border-radius: var(--r-pill);
  display: grid;
  place-items: center;
  color: var(--text-3);
}
.vs-btn.active {
  background: var(--bg-deep);
  color: var(--text-on-deep);
}

.suggestion-row {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 18px;
  flex-wrap: wrap;
}
.suggestion-label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-right: 6px;
}
.suggestion-pill {
  padding: 5px 11px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  font-size: 12px;
  color: var(--text-2);
  font-weight: 500;
  transition: all 140ms ease;
}
.suggestion-pill:hover {
  background: var(--bg-deep);
  color: var(--text-on-deep);
  border-color: var(--bg-deep);
}

.explore-layout {
  display: grid;
  grid-template-columns: 240px 1fr;
  gap: 20px;
}

/* FILTER PANEL */
.filter-panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  align-self: start;
  position: sticky;
  top: 16px;
}
.filter-section {
  padding: 14px 0;
  border-bottom: 1px solid var(--line-soft);
}
.filter-section:last-child { border-bottom: none; padding-bottom: 0; }
.filter-section:first-child { padding-top: 0; }
.filter-title {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 10px;
}

.color-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 6px;
}
.color-swatch {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  border: 1px solid var(--line);
  transition: all 160ms ease;
  position: relative;
}
.color-swatch:hover {
  transform: scale(1.1);
  box-shadow: var(--shadow-md);
}
.color-swatch.active::after {
  content: '';
  position: absolute;
  inset: -3px;
  border: 2px solid var(--text-1);
  border-radius: 50%;
}

.checkbox-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}
.checkbox-list label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12.5px;
  color: var(--text-2);
  cursor: pointer;
  padding: 3px 0;
}
.checkbox-list input { accent-color: var(--text-1); }

.range-input {
  width: 100%;
  accent-color: var(--accent);
}
.range-labels {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 4px;
}

/* GRID */
.explore-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 14px;
  grid-auto-flow: dense;
}

.explore-card {
  background: var(--bg-card);
  border-radius: var(--r-md);
  overflow: hidden;
  cursor: pointer;
  position: relative;
  transition: all 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  border: 1px solid var(--line);
}
.explore-card:hover {
  transform: translateY(-3px);
  box-shadow: var(--shadow-lg);
  border-color: var(--line-strong);
}

.explore-card.tall { grid-row: span 2; }
.explore-card.wide { grid-column: span 2; }

.card-media {
  width: 100%;
  position: relative;
  display: grid;
  place-items: center;
  font-size: 56px;
  overflow: hidden;
}
.card-media.h-1 { aspect-ratio: 1 / 1; }
.card-media.h-2 { aspect-ratio: 1 / 1.4; }
.card-media.h-3 { aspect-ratio: 1.6 / 1; }

.card-media .video-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.4), transparent 50%);
  display: flex;
  align-items: flex-end;
  padding: 10px;
}
.card-media .play-icon {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 28px;
  height: 28px;
  background: rgba(0,0,0,0.6);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: white;
  backdrop-filter: blur(6px);
}
.card-source {
  position: absolute;
  top: 8px;
  left: 8px;
  font-size: 10px;
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(6px);
  padding: 3px 8px;
  border-radius: var(--r-pill);
  color: var(--text-1);
  font-weight: 600;
  letter-spacing: 0.02em;
}
.card-score {
  position: absolute;
  bottom: 8px;
  right: 8px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: rgba(26, 26, 26, 0.85);
  color: var(--text-on-deep);
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 4px;
}
.card-score::before {
  content: '';
  width: 5px;
  height: 5px;
  background: var(--accent);
  border-radius: 50%;
}

.card-body {
  padding: 10px 12px 12px;
}
.card-title {
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-1);
  line-height: 1.3;
  letter-spacing: -0.01em;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.card-tags {
  display: flex;
  gap: 4px;
  margin-top: 7px;
  flex-wrap: wrap;
}
.card-tags .tag { font-size: 10px; padding: 1px 7px; }

/* =============================================
   TAGS
   ============================================= */

.tag {
  display: inline-block;
  padding: 2px 9px;
  font-size: 11px;
  border-radius: var(--r-pill);
  background: var(--bg-tint);
  color: var(--text-2);
  font-weight: 500;
}
.tag.pink { background: var(--tag-pink); color: var(--tag-pink-text); }
.tag.blue { background: var(--tag-blue); color: var(--tag-blue-text); }
.tag.green { background: var(--tag-green); color: var(--tag-green-text); }
.tag.yellow { background: var(--tag-yellow); color: var(--tag-yellow-text); }
.tag.purple { background: var(--tag-purple); color: var(--tag-purple-text); }
.tag.orange { background: var(--tag-orange); color: var(--tag-orange-text); }
.tag.interactive { cursor: pointer; padding-right: 18px; position: relative; }
.tag.interactive::after {
  content: '×';
  position: absolute;
  right: 6px;
  top: 50%;
  transform: translateY(-50%);
  opacity: 0.5;
}

/* =============================================
   DETAIL PANEL
   ============================================= */

.detail-overlay {
  position: fixed;
  inset: 0;
  background: rgba(20, 20, 20, 0.35);
  opacity: 0;
  pointer-events: none;
  transition: opacity 240ms ease;
  z-index: 90;
  backdrop-filter: blur(2px);
}
.detail-overlay.active {
  opacity: 1;
  pointer-events: all;
}

.detail-panel {
  position: fixed;
  top: 0;
  right: 0;
  width: 720px;
  max-width: 92vw;
  height: 100vh;
  background: var(--bg-card);
  z-index: 100;
  transform: translateX(100%);
  transition: transform 320ms cubic-bezier(0.2, 0.8, 0.2, 1);
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-xl);
}
.detail-panel.active { transform: translateX(0); }

.detail-head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 18px;
  border-bottom: 1px solid var(--line);
  flex-shrink: 0;
}
.detail-title-row {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
}
.detail-actions {
  display: flex;
  gap: 4px;
}
.detail-body {
  flex: 1;
  overflow-y: auto;
}

.detail-hero {
  width: 100%;
  aspect-ratio: 16 / 9;
  display: grid;
  place-items: center;
  font-size: 110px;
  position: relative;
  overflow: hidden;
}
.detail-hero .play-big {
  position: absolute;
  width: 64px;
  height: 64px;
  background: rgba(255, 255, 255, 0.92);
  border-radius: 50%;
  display: grid;
  place-items: center;
  color: var(--text-1);
  backdrop-filter: blur(6px);
  box-shadow: var(--shadow-lg);
}

.detail-content {
  padding: 24px 28px 32px;
}

.detail-eyebrow {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 8px;
}
.detail-eyebrow .source-pill {
  background: var(--bg-tint);
  padding: 2px 8px;
  border-radius: var(--r-pill);
  text-transform: none;
  letter-spacing: 0;
  font-weight: 500;
  color: var(--text-2);
}

.detail-title {
  font-family: var(--font-display);
  font-size: 28px;
  letter-spacing: -0.02em;
  margin: 0 0 6px;
  line-height: 1.15;
}
.detail-desc {
  color: var(--text-2);
  font-size: 14px;
  margin: 8px 0 18px;
}

.score-row {
  display: grid;
  grid-template-columns: 2fr 1fr 1fr;
  gap: 12px;
  margin: 18px 0;
  padding: 16px;
  background: var(--bg-elevated);
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.score-block .score-label {
  font-size: 10.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 6px;
}
.score-bar {
  position: relative;
  height: 8px;
  background: var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
  margin-top: 10px;
}
.score-bar-fill {
  position: absolute;
  inset: 0;
  background: linear-gradient(to right, var(--warm), var(--accent), var(--hot));
  border-radius: var(--r-pill);
}
.score-block .score-num {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
}

.meta-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 12px 18px;
  margin: 20px 0;
}
.meta-item {
  border-bottom: 1px dashed var(--line);
  padding-bottom: 10px;
}
.meta-label {
  font-size: 10.5px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 4px;
}
.meta-value {
  font-size: 13px;
  color: var(--text-1);
}
.meta-value .tag-row {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  margin-top: 4px;
}

.detail-section {
  margin: 24px 0;
}
.detail-section h3 {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
  margin: 0 0 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.transcript-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}
.transcript-item {
  display: grid;
  grid-template-columns: 60px 1fr;
  gap: 12px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--r-sm);
  font-size: 13px;
  align-items: start;
  border-left: 3px solid var(--line);
}
.transcript-item.highlighted {
  background: var(--accent-soft);
  border-left-color: var(--accent);
}
.transcript-time {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  font-weight: 500;
}
.transcript-item mark {
  background: var(--accent-soft);
  padding: 1px 4px;
  border-radius: 3px;
  font-weight: 600;
  color: var(--accent-text);
}

.related-row {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
}
.related-thumb {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 28px;
  cursor: pointer;
  transition: transform 160ms ease;
}
.related-thumb:hover { transform: scale(1.04); }

/* =============================================
   REPORT VIEW
   ============================================= */

.report-hero {
  display: grid;
  grid-template-columns: 1fr 360px;
  gap: 40px;
  padding: 36px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-xl);
  margin-bottom: 28px;
  box-shadow: var(--shadow-sm);
  align-items: center;
}

.report-tag {
  display: inline-block;
  font-size: 11px;
  color: var(--accent-text);
  background: var(--accent-soft);
  padding: 4px 12px;
  border-radius: var(--r-pill);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 18px;
}

.report-title {
  font-family: var(--font-display);
  font-size: 44px;
  font-weight: 600;
  letter-spacing: -0.025em;
  line-height: 1.05;
  margin: 0 0 16px;
}

.report-lead {
  font-size: 16px;
  color: var(--text-2);
  line-height: 1.55;
  margin: 0 0 18px;
  max-width: 620px;
}

.report-byline {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: var(--text-3);
  margin-bottom: 22px;
}

.report-actions {
  display: flex;
  gap: 8px;
}

.report-hero-viz {
  background: linear-gradient(135deg, #FFE4E1 0%, #FEF3C7 50%, #F3E8FF 100%);
  border-radius: var(--r-lg);
  aspect-ratio: 1;
  position: relative;
  overflow: hidden;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  grid-template-rows: repeat(3, 1fr);
  gap: 4px;
  padding: 4px;
}
.report-hero-viz > div {
  background: rgba(255, 255, 255, 0.5);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 36px;
  backdrop-filter: blur(2px);
}

.report-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.report-section {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}
.report-section.full { grid-column: span 2; }

.rs-eyebrow {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 500;
  margin-bottom: 8px;
}
.rs-title {
  font-family: var(--font-display);
  font-size: 24px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 0 0 18px;
  line-height: 1.15;
}

.driver-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
}
.driver-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 14px;
  padding: 12px 14px;
  background: var(--bg-elevated);
  border-radius: var(--r-md);
  align-items: start;
}
.driver-icon {
  width: 36px;
  height: 36px;
  background: var(--bg-card);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 18px;
  border: 1px solid var(--line);
}
.driver-name {
  font-weight: 600;
  font-size: 13.5px;
  margin-bottom: 2px;
}
.driver-desc {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.45;
}

.visual-cluster {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
  margin-bottom: 14px;
}
.visual-cluster .vc-tile {
  aspect-ratio: 1;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 28px;
}
.cluster-tags {
  display: flex;
  gap: 4px;
  flex-wrap: wrap;
}

.reco-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.reco-card {
  padding: 22px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  position: relative;
  transition: all 200ms ease;
}
.reco-card:hover {
  border-color: var(--accent);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.reco-num {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--accent);
  font-weight: 600;
  margin-bottom: 6px;
  letter-spacing: 0.04em;
}
.reco-card h3 {
  font-family: var(--font-display);
  font-size: 18px;
  margin: 0 0 8px;
  letter-spacing: -0.015em;
  line-height: 1.2;
}
.reco-card p {
  font-size: 13px;
  color: var(--text-2);
  line-height: 1.5;
  margin: 0 0 14px;
}
.reco-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 11px;
  color: var(--text-3);
  padding-top: 12px;
  border-top: 1px dashed var(--line);
}
.confidence {
  font-weight: 600;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.confidence.high { background: var(--tag-green); color: var(--tag-green-text); }
.confidence.med { background: var(--tag-yellow); color: var(--tag-yellow-text); }

.risk-list {
  margin: 0;
  padding-left: 18px;
  font-size: 14px;
  color: var(--text-2);
  line-height: 1.7;
}
.risk-list li { margin-bottom: 6px; }
.risk-list strong { color: var(--text-1); }

/* =============================================
   SCOUT INPUT
   ============================================= */

.scout-layout {
  display: grid;
  grid-template-columns: 1fr 320px;
  gap: 20px;
}

.scout-form {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 28px;
  box-shadow: var(--shadow-sm);
}

.upload-zone {
  border: 2px dashed var(--line-strong);
  border-radius: var(--r-md);
  padding: 36px;
  display: flex;
  align-items: center;
  gap: 18px;
  background: var(--bg-elevated);
  margin-bottom: 24px;
  transition: all 160ms ease;
  cursor: pointer;
}
.upload-zone:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
}
.upload-icon {
  color: var(--text-3);
}
.upload-text strong {
  display: block;
  font-size: 14px;
  margin-bottom: 4px;
}
.upload-text span {
  font-size: 12px;
  color: var(--text-3);
}
.upload-text a { color: var(--accent); font-weight: 600; }

.form-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px 20px;
}
.form-field { display: flex; flex-direction: column; gap: 6px; }
.form-field.full { grid-column: span 2; }
.form-field label {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.form-field input,
.form-field textarea,
.form-field select {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  padding: 10px 12px;
  border-radius: var(--r-sm);
  font-size: 13px;
  outline: none;
  transition: all 140ms ease;
}
.form-field input:focus,
.form-field textarea:focus,
.form-field select:focus {
  border-color: var(--text-1);
  background: var(--bg-card);
}
.form-field textarea { resize: vertical; min-height: 80px; }

.tag-input {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  padding: 8px 10px;
  border-radius: var(--r-sm);
  align-items: center;
}
.tag-input input {
  flex: 1;
  min-width: 100px;
  border: none;
  background: transparent;
  outline: none;
  font-size: 12.5px;
  padding: 4px 0;
}

.mood-picker { display: flex; gap: 6px; flex-wrap: wrap; }
.mood-btn {
  padding: 7px 12px;
  font-size: 12.5px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  color: var(--text-2);
  font-weight: 500;
  transition: all 140ms ease;
}
.mood-btn:hover { background: var(--bg-tint); }
.mood-btn.active {
  background: var(--bg-deep);
  color: var(--text-on-deep);
  border-color: var(--bg-deep);
}

.form-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 28px;
  padding-top: 22px;
  border-top: 1px solid var(--line);
}

.scout-side {
  display: flex;
  flex-direction: column;
  gap: 12px;
}
.side-card {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
}
.side-card-title {
  font-size: 11px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  margin-bottom: 14px;
}
.ai-suggestion {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px dashed var(--line);
}
.ai-suggestion:last-child { border-bottom: none; padding-bottom: 0; }
.ai-icon {
  width: 28px;
  height: 28px;
  background: var(--bg-elevated);
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 14px;
}
.ai-title { font-size: 12.5px; line-height: 1.4; margin-bottom: 2px; }
.ai-desc { font-size: 11.5px; color: var(--text-3); }

.recent-item {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  align-items: center;
}
.recent-item:last-child { border-bottom: none; }
.recent-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.recent-title {
  font-size: 12.5px;
  font-weight: 500;
  line-height: 1.3;
  margin-bottom: 2px;
}
.recent-meta { font-size: 11px; color: var(--text-3); }

/* =============================================
   SCROLLBAR
   ============================================= */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--line-strong); border-radius: var(--r-pill); border: 2px solid var(--bg-page); }
::-webkit-scrollbar-thumb:hover { background: var(--text-3); }

/* =============================================
   BLUE OCEAN MAP
   ============================================= */

.bluemap-panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 18px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}
.bluemap-controls {
  display: flex;
  gap: 8px;
  align-items: center;
}
.bluemap-stage {
  width: 100%;
  aspect-ratio: 1000 / 480;
  position: relative;
  overflow: hidden;
  border-radius: var(--r-md);
  background: linear-gradient(135deg, #FAFAF7 0%, #F5F4EE 100%);
}
.bluemap-stage svg { width: 100%; height: 100%; display: block; }
.bluemap-bubble {
  cursor: pointer;
  transition: transform 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.bluemap-bubble:hover circle {
  filter: brightness(1.05) drop-shadow(0 4px 14px rgba(0, 0, 0, 0.18));
  stroke-width: 3;
}

.bluemap-foot {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line-soft);
}
.bluemap-legend-item {
  font-size: 11.5px;
  color: var(--text-2);
  display: flex;
  flex-direction: column;
  gap: 4px;
}

/* Ocean classification pill */
.ocean-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 10px;
  border-radius: var(--r-pill);
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.01em;
}
.ocean-pill.large {
  font-size: 13px;
  padding: 6px 14px;
  font-weight: 600;
}
.ocean-pill.blue   { background: #DBEAFE; color: #1E40AF; }
.ocean-pill.red    { background: #FEE2E2; color: #991B1B; }
.ocean-pill.niche  { background: #DCFCE7; color: #166534; }
.ocean-pill.avoid  { background: #F3F4F6; color: #4B5563; }

/* Stat card variant */
.stat-card-bos {
  background: linear-gradient(135deg, #FFFFFF 0%, #EFF6FF 100%);
  border-color: #BFDBFE;
}

/* =============================================
   MARKET OPPORTUNITY (Trend Detail)
   ============================================= */

.market-opportunity {
  margin-top: 24px;
  padding: 20px;
  background: linear-gradient(135deg, #F8FAFC 0%, #FAFAF7 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
}
.mo-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
  margin-bottom: 14px;
}
.mo-eyebrow {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 4px;
}
.mo-title {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.015em;
  margin: 0;
  line-height: 1.2;
}

.bos-hero {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 18px;
  padding: 14px 16px;
  background: var(--bg-card);
  border-radius: var(--r-sm);
  margin-bottom: 16px;
  align-items: center;
  border: 1px solid var(--line);
}
.bos-number-block { text-align: left; min-width: 90px; }
.bos-label {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 4px;
}
.bos-number {
  font-family: var(--font-display);
  font-size: 42px;
  font-weight: 600;
  line-height: 1;
  letter-spacing: -0.025em;
  color: var(--text-1);
}
.bos-suffix { font-size: 18px; color: var(--text-3); font-weight: 500; }
.bos-desc-block {
  font-size: 12.5px;
  color: var(--text-2);
  line-height: 1.55;
}

.bos-meters {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-bottom: 18px;
}
.bos-meter {
  background: var(--bg-card);
  padding: 12px 14px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.bos-meter-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}
.bos-meter-name {
  font-size: 12.5px;
  font-weight: 600;
}
.bos-meter-val {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-1);
}
.bos-meter-bar {
  height: 8px;
  background: var(--bg-tint);
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
}
.bos-meter-bar.inverted { background: linear-gradient(to right, #DCFCE7 0%, #FEE2E2 100%); }
.bos-meter-bar.inverted .bos-meter-fill {
  background: rgba(255, 255, 255, 0);
  border-right: 2px solid #1A1A1A;
  border-radius: 0;
}
.bos-meter-fill {
  height: 100%;
  border-radius: var(--r-pill);
}
.bos-meter-fill.demand     { background: linear-gradient(to right, #93C5FD, #3B82F6); }
.bos-meter-fill.competition{ background: linear-gradient(to right, #FCA5A5, #EF4444); }
.bos-meter-fill.velocity   { background: linear-gradient(to right, #86EFAC, #10B981); }
.bos-meter-foot {
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  margin-top: 6px;
  font-size: 10.5px;
  color: var(--text-3);
  font-family: var(--font-mono);
}
.bos-meter-foot span:nth-child(2) { font-weight: 600; color: var(--text-1); }
.bos-meter-foot span:last-child { text-align: right; }

/* Keyword table */
.kw-table {
  background: var(--bg-card);
  padding: 14px 16px;
  border-radius: var(--r-sm);
  border: 1px solid var(--line);
}
.kw-table-head { margin-bottom: 8px; }
.kw-rows {
  display: flex;
  flex-direction: column;
}
.kw-row {
  display: grid;
  grid-template-columns: 1fr 100px 70px 24px;
  gap: 10px;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
  font-size: 12.5px;
}
.kw-row:last-child { border-bottom: none; }
.kw-row.header {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  color: var(--text-3);
  border-bottom: 1px solid var(--line);
  padding-bottom: 6px;
}
.kw-row.header .kw-vol, .kw-row.header .kw-cpc { font-family: inherit; }
.kw-name { font-family: var(--font-mono); font-size: 12px; }
.kw-vol, .kw-cpc { text-align: right; color: var(--text-2); }
.kw-trend { text-align: center; }
.kw-up { color: var(--positive); font-weight: 700; }
.kw-down { color: var(--hot); font-weight: 700; }
.kw-flat { color: var(--text-3); font-weight: 700; }

/* =============================================
   SOURCES MODULE
   ============================================= */

.nav-divider {
  width: 1px;
  height: 18px;
  background: var(--line);
  margin: 0 4px;
}

.sub-screen { display: none; }
.sub-screen.active { display: block; animation: screenIn 220ms cubic-bezier(0.2, 0.8, 0.2, 1); }

.sources-subnav {
  display: flex;
  gap: 2px;
  margin-bottom: 20px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-pill);
  padding: 4px;
  box-shadow: var(--shadow-sm);
  width: fit-content;
  max-width: 100%;
  overflow-x: auto;
}
.sources-subnav::-webkit-scrollbar { display: none; }

.subnav-btn {
  display: flex;
  align-items: center;
  gap: 7px;
  padding: 7px 14px;
  border-radius: var(--r-pill);
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  white-space: nowrap;
  transition: all 160ms ease;
  flex-shrink: 0;
}
.subnav-btn:hover {
  background: var(--bg-tint);
  color: var(--text-1);
}
.subnav-btn.active {
  background: var(--bg-deep);
  color: var(--text-on-deep);
}
.subnav-btn.active svg { color: var(--accent); }

.subnav-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  background: rgba(255, 255, 255, 0.08);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-weight: 600;
  color: var(--text-3);
  letter-spacing: 0.02em;
}
.subnav-btn:not(.active) .subnav-count {
  background: var(--bg-tint);
  color: var(--text-3);
}
.subnav-btn.active .subnav-count {
  background: rgba(255, 255, 255, 0.12);
  color: var(--text-on-deep);
}
.subnav-count.active-pulse {
  color: var(--accent) !important;
  background: var(--accent-soft) !important;
}

.error-value { color: var(--hot); }
.stat-value-mono {
  font-family: var(--font-mono);
  font-size: 22px;
  font-weight: 600;
  letter-spacing: -0.02em;
  line-height: 1;
}

/* Generic panel */
.panel {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 20px 22px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 16px;
}

/* Alerts */
.alerts-strip {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 16px;
}
.alert-item {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 12px;
  align-items: center;
  padding: 12px 16px;
  border-radius: var(--r-md);
  border: 1px solid transparent;
  font-size: 13px;
}
.alert-item.error {
  background: #FEE2E2;
  border-color: #FECACA;
  color: #7F1D1D;
}
.alert-item.warning {
  background: #FEF3C7;
  border-color: #FDE68A;
  color: #78350F;
}
.alert-item.info {
  background: #DBEAFE;
  border-color: #BFDBFE;
  color: #1E3A8A;
}
.alert-icon {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, 0.6);
  flex-shrink: 0;
}
.alert-text strong {
  font-weight: 600;
  margin-right: 6px;
}
.alert-text .alert-meta {
  font-size: 11.5px;
  opacity: 0.8;
  margin-top: 2px;
}
.alert-action {
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--r-pill);
  background: rgba(255, 255, 255, 0.7);
  border: 1px solid currentColor;
  color: inherit;
  cursor: pointer;
}

/* Source Type Cards */
.source-type-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}
.source-type-card {
  padding: 18px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  cursor: pointer;
  transition: all 200ms cubic-bezier(0.2, 0.8, 0.2, 1);
  position: relative;
}
.source-type-card:hover {
  border-color: var(--text-1);
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}
.source-type-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 14px;
}
.source-type-icon {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 18px;
  background: var(--bg-card);
  border: 1px solid var(--line);
}
.status-pill {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  padding: 3px 8px;
  border-radius: var(--r-pill);
  font-weight: 600;
  letter-spacing: 0.01em;
}
.status-pill::before {
  content: '';
  width: 6px;
  height: 6px;
  border-radius: 50%;
}
.status-pill.ok { background: var(--tag-green); color: var(--tag-green-text); }
.status-pill.ok::before { background: var(--positive); }
.status-pill.warning { background: var(--tag-yellow); color: var(--tag-yellow-text); }
.status-pill.warning::before { background: var(--warm); }
.status-pill.error { background: #FEE2E2; color: #991B1B; }
.status-pill.error::before { background: var(--hot); }
.status-pill.paused { background: var(--bg-tint); color: var(--text-2); }
.status-pill.paused::before { background: var(--text-3); }
.status-pill.running { background: #DBEAFE; color: #1E3A8A; }
.status-pill.running::before { background: var(--cool); animation: pulse 1.4s ease-in-out infinite; }
.status-pill.partial { background: var(--tag-orange); color: var(--tag-orange-text); }
.status-pill.partial::before { background: var(--accent); }

.source-type-name {
  font-size: 16px;
  font-weight: 600;
  letter-spacing: -0.01em;
  margin-bottom: 4px;
}
.source-type-meta {
  font-size: 11.5px;
  color: var(--text-3);
}

.source-type-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  padding-top: 12px;
  border-top: 1px dashed var(--line);
  margin-top: 14px;
}
.source-type-stat {
  font-size: 11px;
}
.source-type-stat .num {
  font-family: var(--font-display);
  font-size: 18px;
  font-weight: 600;
  letter-spacing: -0.02em;
  display: block;
  line-height: 1.1;
}
.source-type-stat .lbl {
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  font-size: 9.5px;
  margin-top: 2px;
  display: block;
}

/* Runs Table */
.runs-table {
  display: flex;
  flex-direction: column;
  gap: 1px;
  background: var(--line-soft);
  border-radius: var(--r-sm);
  overflow: hidden;
}
.runs-row {
  display: grid;
  grid-template-columns: 14px 2fr 1fr 90px 90px 90px 30px;
  gap: 12px;
  align-items: center;
  padding: 11px 14px;
  background: var(--bg-card);
  cursor: pointer;
  transition: background 140ms ease;
  font-size: 12.5px;
}
.runs-row:hover { background: var(--bg-elevated); }
.runs-row.header {
  background: var(--bg-elevated);
  cursor: default;
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 9px 14px;
}
.runs-row.selected {
  background: var(--bg-tint);
  border-left: 3px solid var(--accent);
}

.run-status-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  flex-shrink: 0;
}
.run-status-dot.running { background: var(--cool); animation: pulse 1.4s ease-in-out infinite; }
.run-status-dot.success { background: var(--positive); }
.run-status-dot.failed { background: var(--hot); }
.run-status-dot.partial { background: var(--warm); }

.run-source {
  display: flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}
.run-source-icon {
  width: 20px;
  height: 20px;
  border-radius: 4px;
  display: grid;
  place-items: center;
  font-size: 11px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.run-source-name {
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.run-source-url {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
}

.runs-row .mono {
  font-family: var(--font-mono);
  font-size: 11.5px;
}
.runs-row .num-cell {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 500;
}
.runs-row .num-cell.success { color: var(--positive); }
.runs-row .num-cell.failed { color: var(--hot); }

.row-arrow {
  color: var(--text-3);
  display: grid;
  place-items: center;
}

/* Health Grid */
.health-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
.health-item {
  background: var(--bg-elevated);
  padding: 16px;
  border-radius: var(--r-md);
  border: 1px solid var(--line);
}
.health-name {
  font-size: 12.5px;
  font-weight: 600;
  margin-bottom: 4px;
}
.health-desc {
  font-size: 11.5px;
  color: var(--text-3);
  margin-bottom: 12px;
}
.health-bar {
  height: 6px;
  background: var(--line);
  border-radius: var(--r-pill);
  overflow: hidden;
  position: relative;
}
.health-bar-fill {
  height: 100%;
  border-radius: var(--r-pill);
}
.health-bar-fill.high { background: var(--positive); }
.health-bar-fill.med { background: var(--warm); }
.health-bar-fill.low { background: var(--hot); }
.health-foot {
  display: flex;
  justify-content: space-between;
  margin-top: 8px;
  font-size: 11px;
  color: var(--text-2);
}
.health-foot strong { color: var(--text-1); font-family: var(--font-mono); }

/* SourceType Layout (with tabs) */
.sourcetype-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
  align-items: start;
}
.sourcetype-sidebar {
  position: sticky;
  top: 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 10px;
  box-shadow: var(--shadow-sm);
}
.st-list-item {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 10px;
  padding: 10px;
  border-radius: var(--r-md);
  cursor: pointer;
  align-items: center;
  transition: background 140ms ease;
}
.st-list-item:hover { background: var(--bg-tint); }
.st-list-item.active {
  background: var(--bg-deep);
  color: var(--text-on-deep);
}
.st-list-item.active .st-list-meta { color: var(--text-3); }
.st-list-icon {
  width: 32px;
  height: 32px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 16px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
}
.st-list-item.active .st-list-icon { background: rgba(255,255,255,0.1); border-color: rgba(255,255,255,0.15); }
.st-list-name { font-size: 13px; font-weight: 600; }
.st-list-meta { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }

.sourcetype-detail {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.sourcetype-head {
  padding: 24px 26px;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 16px;
}
.sourcetype-title {
  font-family: var(--font-display);
  font-size: 28px;
  font-weight: 600;
  letter-spacing: -0.02em;
  margin: 6px 0 4px;
  line-height: 1.1;
}
.sourcetype-sub {
  font-size: 13px;
  color: var(--text-2);
  max-width: 540px;
}

.sourcetype-tabs {
  display: flex;
  gap: 0;
  padding: 0 26px;
  border-bottom: 1px solid var(--line);
  background: var(--bg-elevated);
}
.st-tab {
  padding: 12px 16px;
  font-size: 12.5px;
  font-weight: 500;
  color: var(--text-2);
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
  transition: all 140ms ease;
  display: flex;
  align-items: center;
  gap: 6px;
}
.st-tab:hover { color: var(--text-1); }
.st-tab.active {
  color: var(--text-1);
  border-bottom-color: var(--accent);
  font-weight: 600;
}
.st-tab-count {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-tint);
  padding: 1px 6px;
  border-radius: var(--r-pill);
  color: var(--text-3);
  font-weight: 500;
}

.st-tab-content { padding: 24px 26px; }
.st-tab-pane { display: none; }
.st-tab-pane.active { display: block; animation: screenIn 200ms ease; }

/* Schema Builder */
.schema-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 12px;
  flex-wrap: wrap;
}
.schema-toolbar h3 {
  margin: 0;
  font-size: 14px;
  font-weight: 600;
}
.schema-toolbar-actions { display: flex; gap: 6px; }

.schema-fields {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.schema-field {
  display: grid;
  grid-template-columns: 24px 1.4fr 110px 90px 1fr 30px;
  gap: 12px;
  padding: 12px 14px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  background: var(--bg-card);
  font-size: 13px;
  transition: background 120ms ease;
}
.schema-field:last-child { border-bottom: none; }
.schema-field:hover { background: var(--bg-elevated); }
.schema-field.header {
  background: var(--bg-elevated);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 9px 14px;
}
.schema-field .drag-handle {
  color: var(--text-3);
  cursor: grab;
  display: grid;
  place-items: center;
}
.schema-field-name {
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
}
.type-badge {
  display: inline-block;
  font-family: var(--font-mono);
  font-size: 10.5px;
  padding: 2px 8px;
  border-radius: var(--r-pill);
  font-weight: 600;
}
.type-badge.string { background: var(--tag-blue); color: var(--tag-blue-text); }
.type-badge.number { background: var(--tag-green); color: var(--tag-green-text); }
.type-badge.array { background: var(--tag-purple); color: var(--tag-purple-text); }
.type-badge.enum { background: var(--tag-orange); color: var(--tag-orange-text); }
.type-badge.boolean { background: var(--tag-pink); color: var(--tag-pink-text); }
.type-badge.date { background: var(--tag-yellow); color: var(--tag-yellow-text); }
.type-badge.object { background: var(--bg-tint); color: var(--text-2); }

.required-pill {
  font-size: 9.5px;
  font-weight: 700;
  color: var(--accent);
  background: var(--accent-soft);
  padding: 2px 7px;
  border-radius: var(--r-pill);
  letter-spacing: 0.04em;
  display: inline-block;
}
.field-desc { color: var(--text-2); font-size: 12px; }
.field-extraction {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
}
.field-extraction-icon {
  width: 14px;
  height: 14px;
  display: grid;
  place-items: center;
  border-radius: 3px;
  background: var(--accent-soft);
  color: var(--accent-text);
  font-size: 9px;
  font-weight: 600;
}

.schema-preview {
  margin-top: 18px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.code-block {
  background: #1A1A1A;
  border-radius: var(--r-md);
  padding: 14px;
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: #E5E5E5;
  line-height: 1.55;
  overflow-x: auto;
  max-height: 380px;
  overflow-y: auto;
}
.code-block::-webkit-scrollbar-thumb { background: #404040; }
.code-block .key { color: #93C5FD; }
.code-block .str { color: #FCA5A5; }
.code-block .num { color: #FDE68A; }
.code-block .bool { color: #C4B5FD; }
.code-block .punct { color: #9CA3AF; }
.code-block .comment { color: #71717A; font-style: italic; }
.code-block-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 6px;
}
.code-block-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-3);
}
.copy-btn {
  font-size: 10.5px;
  color: var(--text-3);
  font-weight: 500;
}
.copy-btn:hover { color: var(--text-1); }

/* Test extraction box */
.test-extract {
  margin-top: 22px;
  padding: 16px;
  background: var(--bg-elevated);
  border: 1px dashed var(--line-strong);
  border-radius: var(--r-md);
}
.test-extract-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 10px;
}
.test-extract h4 {
  margin: 0;
  font-size: 12.5px;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 6px;
}
.test-extract-input {
  display: flex;
  gap: 6px;
}
.test-extract-input input {
  flex: 1;
  padding: 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  font-size: 12.5px;
  font-family: var(--font-mono);
  outline: none;
}

/* Sources List */
.sources-toolbar {
  display: flex;
  gap: 10px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}
.toolbar-search {
  flex: 1;
  min-width: 240px;
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 8px 12px;
  color: var(--text-3);
}
.toolbar-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-1);
}
.toolbar-filters {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
}
.select-input {
  padding: 8px 28px 8px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-card);
  font-size: 12.5px;
  outline: none;
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%239B9A93' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'><polyline points='6 9 12 15 18 9'></polyline></svg>");
  background-position: right 9px center;
  background-repeat: no-repeat;
}

.sources-table {
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  overflow: hidden;
}
.source-row {
  display: grid;
  grid-template-columns: 28px 2fr 110px 1.4fr 100px 110px 100px;
  gap: 12px;
  padding: 12px 14px;
  align-items: center;
  border-bottom: 1px solid var(--line-soft);
  font-size: 12.5px;
}
.source-row:last-child { border-bottom: none; }
.source-row:hover:not(.header) { background: var(--bg-elevated); }
.source-row.header {
  background: var(--bg-elevated);
  font-size: 10.5px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  padding: 9px 14px;
}
.source-name { font-weight: 600; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.source-url {
  font-size: 11px;
  color: var(--text-3);
  font-family: var(--font-mono);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 1px;
}
.source-actions {
  display: flex;
  gap: 4px;
  justify-content: flex-end;
}
.action-btn {
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: var(--r-sm);
  color: var(--text-3);
  transition: all 120ms ease;
}
.action-btn:hover {
  background: var(--bg-tint);
  color: var(--text-1);
}
.action-btn.danger:hover { color: var(--hot); }

/* Runs Layout (split view) */
.runs-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.runs-panel { margin-bottom: 0; max-height: calc(100vh - 280px); overflow-y: auto; }
.run-detail-panel { margin-bottom: 0; min-height: 420px; }

.runs-table.compact .runs-row {
  grid-template-columns: 14px 2fr 90px 90px 30px;
}
.runs-table.compact .runs-row.header {
  grid-template-columns: 14px 2fr 90px 90px 30px;
}

.empty-state {
  padding: 60px 20px;
  text-align: center;
  color: var(--text-3);
}
.empty-state svg { color: var(--text-3); margin-bottom: 12px; }
.empty-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--text-1);
  margin-bottom: 4px;
}
.empty-desc {
  font-size: 12.5px;
  color: var(--text-3);
  max-width: 320px;
  margin: 0 auto;
}

/* Run timeline */
.run-detail-body { padding-top: 4px; }
.run-overview {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 12px;
  margin-bottom: 18px;
  padding: 14px;
  background: var(--bg-elevated);
  border-radius: var(--r-md);
}
.run-overview-item .lbl {
  font-size: 10px;
  color: var(--text-3);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  font-weight: 600;
  margin-bottom: 3px;
}
.run-overview-item .val {
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 600;
}

.run-timeline {
  position: relative;
  padding-left: 0;
  margin-bottom: 22px;
}
.timeline-step {
  display: grid;
  grid-template-columns: 32px 1fr auto;
  gap: 14px;
  padding: 10px 0;
  position: relative;
}
.timeline-step:not(:last-child)::before {
  content: '';
  position: absolute;
  left: 15px;
  top: 30px;
  bottom: -10px;
  width: 1px;
  background: var(--line);
}
.timeline-marker {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  display: grid;
  place-items: center;
  background: var(--bg-card);
  border: 2px solid var(--line);
  font-size: 13px;
  z-index: 1;
}
.timeline-step.success .timeline-marker { border-color: var(--positive); background: #DCFCE7; color: var(--positive); }
.timeline-step.failed .timeline-marker { border-color: var(--hot); background: #FEE2E2; color: var(--hot); }
.timeline-step.running .timeline-marker { border-color: var(--cool); background: #DBEAFE; color: var(--cool); animation: pulse 1.4s ease-in-out infinite; }
.timeline-step.skipped .timeline-marker { border-color: var(--line); background: var(--bg-tint); color: var(--text-3); }

.timeline-step-name {
  font-size: 13px;
  font-weight: 600;
  margin-bottom: 1px;
}
.timeline-step-detail {
  font-size: 11.5px;
  color: var(--text-3);
}
.timeline-step-duration {
  font-family: var(--font-mono);
  font-size: 11.5px;
  color: var(--text-2);
  font-weight: 500;
}

.logs-viewer {
  background: #1A1A1A;
  border-radius: var(--r-md);
  padding: 12px 14px;
  font-family: var(--font-mono);
  font-size: 11px;
  line-height: 1.65;
  max-height: 240px;
  overflow-y: auto;
  color: #E5E5E5;
  margin-bottom: 16px;
}
.logs-viewer::-webkit-scrollbar-thumb { background: #404040; }
.log-line { display: grid; grid-template-columns: 80px 60px 1fr; gap: 10px; }
.log-line .log-ts { color: #71717A; }
.log-line .log-level { font-weight: 700; }
.log-line.info .log-level { color: #93C5FD; }
.log-line.debug .log-level { color: #A3A3A3; }
.log-line.warn .log-level { color: #FDE68A; }
.log-line.error .log-level { color: #FCA5A5; }
.log-line .log-msg { color: #E5E5E5; }
.log-line .log-msg .hl { color: #FDE68A; }

.run-items-preview {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 8px;
}
.run-item-card {
  display: grid;
  grid-template-columns: 36px 1fr;
  gap: 10px;
  padding: 10px 12px;
  background: var(--bg-elevated);
  border-radius: var(--r-sm);
  font-size: 12px;
  align-items: center;
}
.run-item-thumb {
  width: 36px;
  height: 36px;
  border-radius: var(--r-sm);
  display: grid;
  place-items: center;
  font-size: 18px;
}
.run-item-title {
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.run-item-meta { font-size: 10.5px; color: var(--text-3); margin-top: 1px; }

.detail-section-title {
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-3);
  margin: 18px 0 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Playground */
.playground-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  align-items: start;
}
.playground-input, .playground-output { margin-bottom: 0; min-height: 540px; }

.playground-tabs {
  display: flex;
  gap: 2px;
  margin-bottom: 12px;
  background: var(--bg-elevated);
  border-radius: var(--r-pill);
  padding: 3px;
  width: fit-content;
}
.pg-tab {
  padding: 5px 12px;
  font-size: 11.5px;
  font-weight: 500;
  border-radius: var(--r-pill);
  color: var(--text-2);
}
.pg-tab.active {
  background: var(--bg-card);
  color: var(--text-1);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.pg-url-input {
  width: 100%;
  padding: 10px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  font-size: 12.5px;
  font-family: var(--font-mono);
  outline: none;
}

.pg-prompt {
  width: 100%;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  background: var(--bg-elevated);
  font-size: 12.5px;
  font-family: var(--font-mono);
  resize: vertical;
  outline: none;
  line-height: 1.5;
}

.panel-divider {
  height: 1px;
  background: var(--line-soft);
  margin: 18px 0;
}

.playground-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 16px;
}

.btn-sm { padding: 5px 11px; font-size: 12px; }

.output-tabs {
  display: flex;
  gap: 2px;
  background: var(--bg-elevated);
  border-radius: var(--r-pill);
  padding: 3px;
}
.out-tab {
  padding: 5px 12px;
  font-size: 11.5px;
  border-radius: var(--r-pill);
  color: var(--text-2);
}
.out-tab.active {
  background: var(--bg-card);
  color: var(--text-1);
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

.playground-output-body {
  margin-top: 12px;
}

.run-spinner {
  display: inline-block;
  width: 12px;
  height: 12px;
  border: 2px solid var(--accent-soft);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin-right: 6px;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Confidence chip in extraction output */
.confidence-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-weight: 600;
}
.confidence-chip.high { background: var(--tag-green); color: var(--tag-green-text); }
.confidence-chip.med { background: var(--tag-yellow); color: var(--tag-yellow-text); }
.confidence-chip.low { background: #FEE2E2; color: #991B1B; }

.struct-tree {
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.7;
}
.struct-row {
  display: grid;
  grid-template-columns: 180px 1fr auto;
  gap: 10px;
  padding: 6px 10px;
  border-bottom: 1px dashed var(--line);
  align-items: start;
}
.struct-row:last-child { border-bottom: none; }
.struct-key { color: var(--text-2); font-weight: 500; }
.struct-val { color: var(--text-1); word-break: break-word; }
.struct-val.array { display: flex; gap: 4px; flex-wrap: wrap; }
.struct-val.array .tag { font-family: var(--font-sans); font-size: 11px; }

/* =============================================
   RESPONSIVE
   ============================================= */
@media (max-width: 1280px) {
  .radar-layout { grid-template-columns: 1fr 320px; }
  .explore-grid { grid-template-columns: repeat(3, 1fr); }
  .stats-row { grid-template-columns: repeat(4, 1fr); }
  .reco-grid { grid-template-columns: repeat(2, 1fr); }
  .source-type-grid { grid-template-columns: repeat(2, 1fr); }
  .health-grid { grid-template-columns: repeat(2, 1fr); }
}
@media (max-width: 960px) {
  .radar-layout, .explore-layout, .scout-layout, .report-hero, .report-grid,
  .sourcetype-layout, .runs-layout, .playground-layout {
    grid-template-columns: 1fr;
  }
  .report-section.full { grid-column: span 1; }
  .explore-grid { grid-template-columns: repeat(2, 1fr); }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .form-grid { grid-template-columns: 1fr; }
  .form-field.full { grid-column: span 1; }
  .source-type-grid, .health-grid, .bluemap-foot { grid-template-columns: 1fr; }
  .bos-hero { grid-template-columns: 1fr; gap: 8px; }
  .mo-head { flex-direction: column; }
  .sourcetype-sidebar { position: static; }
  .runs-table:not(.compact) .runs-row { grid-template-columns: 14px 2fr 70px 60px 60px 60px 16px; font-size: 11.5px; gap: 8px; }
  .runs-table.compact .runs-row { grid-template-columns: 12px minmax(0, 1fr) 60px 50px 14px; font-size: 11.5px; gap: 8px; }
  .runs-table.compact .run-source-url { display: none; }
  .runs-row .run-source-name { min-width: 0; }
  .source-row { grid-template-columns: 28px 2fr 80px 80px; gap: 8px; }
  .source-row .col-url, .source-row .col-last, .source-row .col-actions { display: none; }
  .schema-field { grid-template-columns: 24px 1.4fr 80px 60px 30px; }
  .schema-field .col-desc { display: none; }
  .schema-preview { grid-template-columns: 1fr; }
  .run-overview { grid-template-columns: repeat(2, 1fr); }
  .run-items-preview { grid-template-columns: 1fr; }
  .graph-layout { grid-template-columns: 1fr; height: auto; }
  .graph-sidebar { display: none; }
}

/* =============================================
   KNOWLEDGE GRAPH (D3 force layout)
   ============================================= */

.graph-filter-bar {
  margin-bottom: 16px;
}

.graph-search {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 12px;
  border-radius: var(--r-pill);
  background: var(--bg-tint);
  min-width: 240px;
  color: var(--text-3);
}
.graph-search input {
  flex: 1;
  border: none;
  background: transparent;
  outline: none;
  font-size: 13px;
  color: var(--text-1);
}
.graph-search input::placeholder { color: var(--text-3); }

.graph-layout {
  display: grid;
  grid-template-columns: 240px minmax(0, 1fr);
  gap: 16px;
  height: calc(100vh - 280px);
  min-height: 520px;
}

.graph-sidebar {
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  padding: 16px 14px;
  box-shadow: var(--shadow-sm);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 18px;
}

.sidebar-section {
  border-bottom: 1px solid var(--line-soft);
  padding-bottom: 14px;
}
.sidebar-section:last-child { border-bottom: none; padding-bottom: 0; }

.sidebar-title {
  font-size: 10.5px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
  color: var(--text-3);
  margin-bottom: 10px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.pinned-count {
  background: var(--bg-tint);
  color: var(--text-2);
  padding: 1px 7px;
  border-radius: var(--r-pill);
  font-family: var(--font-mono);
  letter-spacing: 0;
}

.legend-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.legend-row {
  display: grid;
  grid-template-columns: 14px 1fr auto;
  gap: 9px;
  align-items: center;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  cursor: pointer;
  font-size: 12px;
  color: var(--text-2);
  transition: background 140ms ease;
}
.legend-row:hover { background: var(--bg-tint); color: var(--text-1); }
.legend-row.muted { opacity: 0.42; }
.legend-row .legend-swatch {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  border: 1.5px solid white;
  box-shadow: 0 0 0 1px var(--line-strong);
}
.legend-row .legend-count {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-3);
}

.empty-state {
  font-size: 11.5px;
  color: var(--text-3);
  font-style: italic;
  line-height: 1.5;
}

.graph-selection {
  font-size: 12.5px;
  color: var(--text-1);
}
.gs-eyebrow {
  font-size: 10px;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-3);
  font-weight: 600;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 6px;
}
.gs-name {
  font-weight: 600;
  font-size: 13px;
  letter-spacing: -0.01em;
  margin-bottom: 6px;
  line-height: 1.3;
}
.gs-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-bottom: 10px;
  font-family: var(--font-mono);
}
.gs-actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.gs-action {
  padding: 5px 9px;
  text-align: left;
  font-size: 11.5px;
  border-radius: var(--r-sm);
  background: var(--bg-tint);
  color: var(--text-1);
  font-weight: 500;
  transition: all 120ms ease;
}
.gs-action:hover {
  background: var(--text-1);
  color: var(--text-on-deep);
}

.graph-pinned { display: flex; flex-direction: column; gap: 4px; }
.pinned-item {
  display: grid;
  grid-template-columns: 10px 1fr 14px;
  gap: 8px;
  padding: 5px 6px;
  border-radius: var(--r-sm);
  font-size: 11.5px;
  align-items: center;
}
.pinned-item .pinned-swatch {
  width: 8px;
  height: 8px;
  border-radius: 50%;
}
.pinned-item .pinned-name {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.pinned-item .pinned-unpin {
  font-family: var(--font-mono);
  cursor: pointer;
  color: var(--text-3);
  text-align: center;
}
.pinned-item .pinned-unpin:hover { color: var(--hot); }

.kbd-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}
.kbd-list li {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  color: var(--text-2);
}
.kbd-list kbd {
  font-family: var(--font-mono);
  font-size: 10px;
  background: var(--bg-tint);
  padding: 2px 6px;
  border-radius: var(--r-xs);
  color: var(--text-1);
  border: 1px solid var(--line);
  font-weight: 500;
  min-width: 64px;
  text-align: center;
}

/* === Stage === */
.graph-stage {
  position: relative;
  background: radial-gradient(circle at center, #FCFBF6 0%, #F2F0E7 100%);
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
}
.graph-stage svg {
  width: 100%;
  height: 100%;
  display: block;
  cursor: grab;
}
.graph-stage svg.grabbing { cursor: grabbing; }
.graph-stage svg:active { cursor: grabbing; }

/* Subtle dotted background grid */
.graph-stage::before {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(circle, rgba(20, 20, 20, 0.06) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  opacity: 0.6;
}

.graph-zoom-controls {
  position: absolute;
  bottom: 16px;
  right: 16px;
  display: flex;
  flex-direction: column;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-md);
  box-shadow: var(--shadow-md);
  overflow: hidden;
}
.zoom-btn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  font-size: 16px;
  color: var(--text-2);
  font-family: var(--font-mono);
  border-bottom: 1px solid var(--line);
  transition: background 140ms ease;
}
.zoom-btn:last-child { border-bottom: none; }
.zoom-btn:hover { background: var(--bg-tint); color: var(--text-1); }

.graph-stats {
  position: absolute;
  bottom: 16px;
  left: 16px;
  display: flex;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--text-2);
  background: var(--bg-card);
  padding: 7px 12px;
  border-radius: var(--r-pill);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--line);
  align-items: center;
}
.graph-stats span { display: inline-flex; align-items: center; gap: 5px; }
.graph-stats .dot {
  width: 6px;
  height: 6px;
  background: var(--positive);
  border-radius: 50%;
}
.graph-stats .dot.active { animation: pulse 1.6s ease-in-out infinite; }

.graph-toast {
  position: absolute;
  top: 16px;
  left: 50%;
  transform: translateX(-50%) translateY(-8px);
  padding: 8px 16px;
  background: var(--text-1);
  color: var(--text-on-deep);
  border-radius: var(--r-pill);
  font-size: 12px;
  font-weight: 500;
  box-shadow: var(--shadow-lg);
  opacity: 0;
  pointer-events: none;
  transition: all 240ms ease;
}
.graph-toast.active {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* === Nodes & Links === */
.graph-link {
  stroke: #C9C5B5;
  stroke-opacity: 0.55;
  stroke-width: 1;
  pointer-events: none;
  transition: stroke-opacity 200ms ease, stroke 200ms ease;
}
.graph-link.dim { stroke-opacity: 0.10; }
.graph-link.highlight {
  stroke: var(--text-1);
  stroke-opacity: 0.75;
  stroke-width: 1.5;
}

.graph-node-circle {
  cursor: pointer;
  stroke: white;
  stroke-width: 1.8;
  transition: stroke-width 160ms ease, opacity 200ms ease, filter 200ms ease;
}
.graph-node-circle:hover {
  stroke-width: 2.5;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.18));
}
.graph-node-circle.dim {
  opacity: 0.18;
}
.graph-node-circle.selected {
  stroke: var(--text-1);
  stroke-width: 3;
}
.graph-node-circle.pinned {
  stroke-dasharray: 0;
}

.graph-node-pulse {
  fill: none;
  stroke-width: 2;
  pointer-events: none;
  animation: graphHotPulse 2.4s ease-in-out infinite;
  transform-origin: center;
  transform-box: fill-box;
}
@keyframes graphHotPulse {
  0%, 100% { opacity: 0; transform: scale(1); }
  50% { opacity: 0.4; transform: scale(1.5); }
}

.graph-node-label {
  pointer-events: none;
  font-family: var(--font-sans);
  font-size: 11px;
  fill: var(--text-1);
  font-weight: 500;
  paint-order: stroke;
  stroke: white;
  stroke-width: 3px;
  stroke-linecap: round;
  stroke-linejoin: round;
  transition: opacity 200ms ease, font-size 160ms ease, font-weight 160ms ease;
  letter-spacing: -0.01em;
}
.graph-node-label.trend  { font-weight: 600; font-size: 12px; }
.graph-node-label.tag    { font-style: italic; fill: var(--text-2); }
.graph-node-label.dim    { opacity: 0.18; }
.graph-node-label.hidden { opacity: 0; }
.graph-node-label.selected, .graph-node-label.hovered {
  font-weight: 700;
  font-size: 13px;
}

.graph-pin-indicator {
  pointer-events: none;
  fill: var(--accent);
  stroke: white;
  stroke-width: 1.5;
}

.graph-context-menu {
  position: fixed;
  background: var(--bg-card);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  box-shadow: var(--shadow-lg);
  padding: 4px;
  z-index: 200;
  min-width: 180px;
  font-size: 12.5px;
}
.graph-context-menu button {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
  padding: 7px 10px;
  text-align: left;
  border-radius: var(--r-xs);
  color: var(--text-1);
  font-weight: 500;
  transition: background 120ms ease;
}
.graph-context-menu button:hover { background: var(--bg-tint); }
.graph-context-menu .menu-divider {
  height: 1px;
  background: var(--line);
  margin: 4px 2px;
}
.graph-context-menu .menu-icon {
  width: 14px;
  display: inline-block;
  font-size: 11px;
  color: var(--text-3);
  text-align: center;
}

/* Detail panel narrowing while graph is active so canvas stays visible */
body.graph-active .detail-panel { width: 480px; }

/* Tag detail-panel custom block */
.tag-overview-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  margin: 16px 0;
}
.tag-stat-block {
  background: var(--bg-elevated);
  border: 1px solid var(--line);
  border-radius: var(--r-sm);
  padding: 10px 12px;
}
.tag-related-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.tag-related-row {
  display: grid;
  grid-template-columns: 28px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 8px 10px;
  border-radius: var(--r-sm);
  cursor: pointer;
  transition: background 140ms ease;
}
.tag-related-row:hover { background: var(--bg-elevated); }
.tag-related-row .tr-thumb {
  width: 28px;
  height: 28px;
  border-radius: var(--r-xs);
  display: grid;
  place-items: center;
  font-size: 14px;
}
.tag-related-row .tr-meta {
  font-size: 11px;
  color: var(--text-3);
  margin-top: 2px;
  font-family: var(--font-mono);
}
.tag-related-row .tr-name {
  font-size: 13px;
  font-weight: 600;
}

