:root {
  --bg: #0a0a0a;
  --card: #111111;
  --card-soft: rgba(17, 17, 17, 0.72);
  --text: #f4f4f5;
  --muted: #9ca3af;
  --accent: #ff3c78;
  --accent-soft: rgba(255, 60, 120, 0.15);
  --border: rgba(255, 255, 255, 0.1);
  --high: #ef4444;
  --medium: #f97316;
  --low: #facc15;
  --none: #22c55e;
  --unknown: #94a3b8;
  --radius-lg: 22px;
  --radius-md: 16px;
}

* {
  box-sizing: border-box;
}

html,
body {
  margin: 0;
  padding: 0;
  background: var(--bg);
  color: var(--text);
  font-family: Inter, -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  scroll-behavior: smooth;
}

body {
  min-height: 100vh;
  position: relative;
  overflow-x: hidden;
}

.bg-orb {
  position: fixed;
  width: 520px;
  height: 520px;
  border-radius: 50%;
  filter: blur(70px);
  z-index: -3;
  opacity: 0.23;
}

.bg-orb-1 {
  top: -160px;
  left: -120px;
  background: #ff3c78;
  animation: drift 18s ease-in-out infinite;
}

.bg-orb-2 {
  bottom: -160px;
  right: -120px;
  background: #0ea5e9;
  animation: drift 22s ease-in-out infinite reverse;
}

.bg-grid {
  position: fixed;
  inset: 0;
  z-index: -2;
  background-image: linear-gradient(rgba(255, 255, 255, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(255, 255, 255, 0.04) 1px, transparent 1px);
  background-size: 36px 36px;
  mask-image: radial-gradient(ellipse at center, rgba(0, 0, 0, 0.9), transparent 75%);
}

.topbar {
  max-width: 1200px;
  margin: 0 auto;
  padding: 18px 22px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.brand {
  color: var(--text);
  text-decoration: none;
  font-weight: 700;
  letter-spacing: 0.2px;
  display: inline-flex;
  align-items: center;
  gap: 10px;
}

.brand-dot {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--accent);
  box-shadow: 0 0 18px var(--accent);
}

.brand-sub {
  color: var(--muted);
  font-size: 0.9rem;
}

.top-links {
  display: inline-flex;
  align-items: center;
  gap: 14px;
}

.top-links a {
  color: var(--text);
  text-decoration: none;
  font-weight: 600;
  font-size: 0.92rem;
}

.top-links a:hover {
  color: var(--accent);
}

main {
  max-width: 1200px;
  margin: 0 auto;
  padding: 10px 20px 90px;
}

.hero {
  padding: 52px 8px 34px;
  text-align: left;
}

.hero h1 {
  margin: 0;
  font-size: clamp(2rem, 5vw, 3.6rem);
  line-height: 1.05;
}

.hero p {
  color: var(--muted);
  max-width: 700px;
  margin-top: 14px;
  font-size: clamp(1rem, 2vw, 1.2rem);
}

.kicker {
  color: var(--accent);
  font-weight: 700;
  letter-spacing: 0.08em;
  font-size: 0.76rem;
  margin-bottom: 16px;
  text-transform: uppercase;
}

.card-grid {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
}

.hero-actions {
  margin-top: 22px;
}

.compare-cta,
.compare-link {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  color: #fff;
  background: linear-gradient(135deg, #ff3c78, #e11d58);
  border: 1px solid rgba(255, 60, 120, 0.6);
  border-radius: 12px;
  font-weight: 700;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.compare-cta {
  padding: 11px 16px;
}

.compare-link {
  padding: 10px 14px;
}

.compare-card-link {
  margin-top: 10px;
}

.compare-cta:hover,
.compare-link:hover {
  transform: translateY(-2px);
  box-shadow: 0 12px 24px rgba(255, 60, 120, 0.24);
}

.compare-card {
  margin-bottom: 16px;
}

.glass-card {
  background: linear-gradient(160deg, rgba(255, 255, 255, 0.04), rgba(255, 255, 255, 0.015));
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(14px);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.07), 0 14px 40px rgba(0, 0, 0, 0.36);
}

.brand-card {
  padding: 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 18px;
  text-decoration: none;
  color: inherit;
  transition: transform 0.28s ease, border-color 0.28s ease;
}

.brand-card:hover {
  transform: translateY(-5px);
  border-color: rgba(255, 60, 120, 0.5);
}

.brand-card h3 {
  margin: 0 0 6px;
  font-size: 1.2rem;
  text-transform: capitalize;
}

.brand-card p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.ring {
  position: relative;
  width: 104px;
  height: 104px;
  flex: 0 0 auto;
}

.ring svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.ring-bg,
.ring-progress {
  fill: none;
  stroke-width: 9;
}

.ring-bg {
  stroke: rgba(255, 255, 255, 0.08);
}

.ring-progress {
  stroke: var(--accent);
  stroke-linecap: round;
  transition: stroke-dashoffset 1.3s cubic-bezier(0.2, 0.9, 0.2, 1);
}

.ring-value {
  position: absolute;
  inset: 0;
  display: grid;
  place-items: center;
  font-weight: 800;
  font-size: 1.2rem;
}

.report-header {
  margin: 14px 0 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}

.back-link {
  color: var(--muted);
  text-decoration: none;
}

.back-link:hover {
  color: var(--text);
}

.section {
  padding: 20px;
  margin-top: 16px;
}

.section h2 {
  margin-top: 0;
  margin-bottom: 12px;
  font-size: 1.13rem;
}

.section-sub {
  margin-top: -4px;
  color: var(--muted);
  font-size: 0.92rem;
}

.narrative-text {
  margin: 0;
  color: var(--text);
  line-height: 1.72;
  font-size: 0.98rem;
}

.insight-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
}

.insight-card {
  margin: 0;
  padding: 13px 14px;
  border-radius: var(--radius-md);
  border: 1px solid rgba(255, 60, 120, 0.25);
  background: linear-gradient(165deg, rgba(255, 60, 120, 0.08), rgba(255, 255, 255, 0.03));
  color: var(--text);
  line-height: 1.55;
}

.sales-hook {
  border-color: rgba(255, 60, 120, 0.45);
  box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.08), 0 20px 36px rgba(255, 60, 120, 0.12);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 12px;
}

.metric {
  padding: 12px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border);
  background: rgba(255, 255, 255, 0.02);
}

.metric-label {
  color: var(--muted);
  font-size: 0.78rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.metric-value {
  margin-top: 8px;
  font-size: 1.16rem;
  font-weight: 700;
}

.chart-wrap {
  min-height: 280px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

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

.badge {
  display: inline-flex;
  align-items: center;
  padding: 4px 9px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
}

.badge-high {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.55);
}

.badge-medium {
  color: #fed7aa;
  background: rgba(249, 115, 22, 0.16);
  border: 1px solid rgba(249, 115, 22, 0.55);
}

.badge-low {
  color: #fef08a;
  background: rgba(250, 204, 21, 0.16);
  border: 1px solid rgba(250, 204, 21, 0.55);
}

.badge-none {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.55);
}

.badge-unknown {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.55);
}

.table-controls {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  margin-bottom: 12px;
}

.table-controls select {
  background: rgba(255, 255, 255, 0.04);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 8px 10px;
}

.table-scroll {
  overflow: auto;
  border-radius: 14px;
  border: 1px solid var(--border);
}

table {
  width: 100%;
  border-collapse: collapse;
  min-width: 860px;
}

th,
td {
  text-align: left;
  padding: 11px 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  vertical-align: top;
  font-size: 0.9rem;
}

th {
  color: var(--muted);
  font-size: 0.76rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

.empty {
  padding: 24px;
  color: var(--muted);
  text-align: center;
}

.trending-grid {
  margin-top: 14px;
  display: grid;
  gap: 14px;
  grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.trending-card {
  padding: 16px;
}

.trending-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
}

.trending-top h3 {
  margin: 0 0 5px;
  font-size: 1.05rem;
}

.trending-top p {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.trending-badges {
  display: inline-flex;
  gap: 8px;
  flex-wrap: wrap;
}

.trending-metrics {
  margin-top: 12px;
}

.badge-fast {
  color: #d1fae5;
  background: rgba(16, 185, 129, 0.14);
  border: 1px solid rgba(16, 185, 129, 0.55);
}

.badge-license-cleared {
  color: #bbf7d0;
  background: rgba(34, 197, 94, 0.16);
  border: 1px solid rgba(34, 197, 94, 0.55);
}

.badge-license-unlicensed {
  color: #fecaca;
  background: rgba(239, 68, 68, 0.16);
  border: 1px solid rgba(239, 68, 68, 0.55);
}

.badge-license-original {
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.14);
  border: 1px solid rgba(14, 165, 233, 0.5);
}

.badge-license-unknown {
  color: #cbd5e1;
  background: rgba(148, 163, 184, 0.16);
  border: 1px solid rgba(148, 163, 184, 0.55);
}

.trending-risk {
  margin: 10px 0 0;
  font-size: 0.83rem;
  font-weight: 700;
  letter-spacing: 0.02em;
}

.trending-risk.risk-high {
  color: #fecaca;
}

.trending-risk.risk-low {
  color: #bbf7d0;
}

.rank-grid {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
}

.rank-card {
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 12px;
  background: rgba(255, 255, 255, 0.02);
}

.rank-card h3 {
  margin: 10px 0 6px;
}

.rank-card p {
  margin: 0;
  color: var(--muted);
}

.rank-pill {
  display: inline-flex;
  padding: 4px 9px;
  border-radius: 999px;
  border: 1px solid rgba(255, 60, 120, 0.6);
  color: #fecdd3;
  font-size: 0.74rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  background: rgba(255, 60, 120, 0.14);
}

.mini-head {
  margin: 0 0 10px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted);
}

.vulnerability {
  border-color: rgba(239, 68, 68, 0.4);
  background: linear-gradient(165deg, rgba(239, 68, 68, 0.12), rgba(255, 255, 255, 0.03));
}

.footer {
  text-align: center;
  padding: 24px 16px 38px;
  color: var(--muted);
}

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

.fade-in {
  opacity: 0;
  transform: translateY(12px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.fade-in.visible {
  opacity: 1;
  transform: translateY(0);
}

@keyframes drift {
  0%,
  100% {
    transform: translate(0, 0);
  }
  50% {
    transform: translate(24px, 14px);
  }
}

@media (max-width: 980px) {
  .two-col,
  .three-col {
    grid-template-columns: 1fr;
  }

  .report-header {
    align-items: flex-start;
  }
}

@media (max-width: 640px) {
  main {
    padding: 8px 14px 72px;
  }

  .topbar {
    padding: 15px 14px;
  }

  .brand-sub {
    display: none;
  }

  .top-links {
    gap: 10px;
  }

  .top-links a {
    font-size: 0.85rem;
  }

  .section {
    padding: 16px;
  }

  .ring {
    width: 92px;
    height: 92px;
  }
}

/* --- Cleared Replacement Recommendations (remediation MVP) --- */
.rollup-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 12px;
  margin-top: 8px;
}
.metric-foot {
  font-size: 12px;
  color: #999;
  margin-top: 2px;
}
.rec-list {
  display: flex;
  flex-direction: column;
  gap: 14px;
  margin-top: 18px;
}
.rec-card {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px;
  background: rgba(255, 255, 255, 0.02);
}
.rec-card-head {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}
.rec-risk {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.5px;
  padding: 3px 8px;
  border-radius: 6px;
  color: #0a0a0a;
}
.rec-risk-high { background: #ff3c78; }
.rec-risk-medium { background: #ffb03c; }
.rec-risk-low,
.rec-risk-unknown { background: #888; }
.rec-flagged { font-weight: 600; color: #fff; }
.rec-link { margin-left: auto; color: #ff3c78; font-size: 13px; text-decoration: none; }
.rec-reason { color: #999; font-size: 13px; margin: 8px 0 4px; }
.rec-options {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 10px;
  margin-top: 10px;
}
.rec-option {
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 10px;
  padding: 12px;
  background: rgba(255, 60, 120, 0.04);
}
.rec-option-head {
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  gap: 6px 10px;
  margin-bottom: 6px;
}
.rec-title { font-weight: 700; color: #fff; }
.rec-source { font-size: 11px; color: #ff8db0; }
.rec-score { margin-left: auto; font-size: 11px; color: #999; }
.rec-why { font-size: 13px; color: #ddd; margin: 4px 0; }
.rec-safe { font-size: 12px; color: #8fd19e; margin: 4px 0; }
.rec-action { font-size: 12px; color: #fff; font-weight: 600; margin: 6px 0 0; }
.disclaimer-text {
  margin-top: 16px;
  font-size: 11px;
  color: #777;
  line-height: 1.5;
}

/* --- Audience Sonic Fit --- */
.sonic-fit-section {
  border-color: rgba(14, 165, 233, 0.34);
}
.fit-rollup {
  margin-top: 16px;
}
.fit-lanes,
.fit-index-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  margin-top: 16px;
}
.fit-lane,
.fit-index-card,
.fit-mini {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px;
  background: rgba(255, 255, 255, 0.025);
}
.fit-index-card {
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.fit-lane-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 10px;
}
.fit-lane h3,
.fit-index-card h3 {
  margin: 0;
  font-size: 1rem;
}
.fit-lane p,
.fit-index-card p,
.fit-mini p {
  color: #ddd;
  line-height: 1.55;
  margin: 8px 0 0;
  font-size: 0.92rem;
}
.fit-confidence,
.fit-mini-label {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 3px 8px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}
.fit-confidence-high { color: #bbf7d0; background: rgba(34, 197, 94, 0.15); border: 1px solid rgba(34, 197, 94, 0.45); }
.fit-confidence-medium { color: #fde68a; background: rgba(250, 204, 21, 0.13); border: 1px solid rgba(250, 204, 21, 0.42); }
.fit-confidence-low { color: #cbd5e1; background: rgba(148, 163, 184, 0.16); border: 1px solid rgba(148, 163, 184, 0.45); }
.fit-range {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}
.fit-range span {
  padding: 4px 8px;
  border-radius: 8px;
  color: #cbd5e1;
  background: rgba(14, 165, 233, 0.1);
  border: 1px solid rgba(14, 165, 233, 0.28);
  font-size: 12px;
}
.fit-evidence {
  margin: 10px 0 0;
  padding-left: 18px;
  color: #9ca3af;
  font-size: 0.82rem;
  line-height: 1.45;
}
.fit-columns {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
  margin-top: 18px;
}
.fit-mini-list,
.fit-tests {
  display: grid;
  gap: 10px;
}
.fit-mini-label {
  color: #bae6fd;
  background: rgba(14, 165, 233, 0.13);
  border: 1px solid rgba(14, 165, 233, 0.42);
  margin-bottom: 8px;
}
.fit-mini strong {
  display: block;
  color: #fff;
}
.fit-mini small {
  display: block;
  margin-top: 8px;
  color: #9ca3af;
  line-height: 1.4;
}
.fit-candidates {
  display: flex;
  flex-direction: column;
  gap: 5px;
  margin-top: 9px;
}
.fit-candidates span {
  color: #8fd19e;
  font-size: 12px;
}
.fit-date {
  font-size: 1rem;
}

/* Rollup metric cards (renderRemediation uses .metric-card, distinct from .metric) */
.metric-card {
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 12px;
  padding: 14px 16px;
}
.metric-card .metric-label {
  font-size: 12px;
  color: #999;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}
.metric-card .metric-value {
  font-size: 26px;
  font-weight: 700;
  color: #fff;
  margin-top: 4px;
}

@media (max-width: 980px) {
  .fit-columns {
    grid-template-columns: 1fr;
  }
}
