/* =========================================
   ALLGOOD MARKETING — AUDIT DASHBOARD v2
   Futuristic Dark Theme
   Brand: #e5352d | Cyan: #00d4ff | Electric: #3b82f6
   ========================================= */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700;800;900&display=swap');

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  /* Core brand */
  --red:           #e5352d;
  --red2:          #c42b24;
  --red-glow:      rgba(229,53,45,0.35);
  --red-glow-sm:   rgba(229,53,45,0.15);

  /* New accent colors */
  --cyan:          #00d4ff;
  --cyan-dim:      rgba(0,212,255,0.7);
  --cyan-glow:     rgba(0,212,255,0.3);
  --cyan-glow-sm:  rgba(0,212,255,0.12);
  --electric:      #3b82f6;
  --electric-glow: rgba(59,130,246,0.3);

  /* Dark backgrounds */
  --bg:            #080b12;
  --bg2:           #0d1117;
  --bg3:           #111827;
  --bg4:           #1a2235;

  /* Compatibility aliases (keep existing JS from breaking) */
  --dark:          #e8edf8;  /* text color — light on dark bg */
  --dark2:         #111827;
  --cream:         rgba(255,255,255,0.03);
  --white:         rgba(255,255,255,0.05);
  --light:         rgba(255,255,255,0.08);

  /* Text */
  --text:          #e8edf8;
  --text-muted:    rgba(232,237,248,0.55);
  --gray:          #8892a4;

  /* Glass */
  --glass:         rgba(255,255,255,0.04);
  --glass-hover:   rgba(255,255,255,0.07);
  --glass-border:  rgba(255,255,255,0.1);
  --glass-border2: rgba(0,212,255,0.2);

  /* State */
  --success:       #22c55e;
  --success-glow:  rgba(34,197,94,0.25);
  --warn:          #f59e0b;
  --warn-glow:     rgba(245,158,11,0.25);

  --font:          'Inter', system-ui, sans-serif;
  --radius:        12px;
  --radius-lg:     16px;
  --shadow:        0 4px 24px rgba(0,0,0,0.4);
  --shadow2:       0 8px 48px rgba(0,0,0,0.6);
}

html { font-size: 16px; scroll-behavior: smooth; }
body {
  font-family: var(--font);
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  overflow-x: hidden;
}

/* Animated gradient bg */
body::before {
  content: '';
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 50% at 20% -10%, rgba(0,212,255,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 60% 40% at 80% 110%, rgba(229,53,45,0.06) 0%, transparent 60%),
    radial-gradient(ellipse 50% 50% at 50% 50%, rgba(59,130,246,0.04) 0%, transparent 70%);
  pointer-events: none;
  z-index: 0;
}

/* Dot grid overlay */
body::after {
  content: '';
  position: fixed;
  inset: 0;
  background-image: radial-gradient(circle, rgba(255,255,255,0.04) 1px, transparent 1px);
  background-size: 28px 28px;
  pointer-events: none;
  z-index: 0;
}

/* ---- HEADER ---- */
.header {
  position: sticky;
  top: 0;
  z-index: 1000;
  background: rgba(8,11,18,0.92);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,212,255,0.1);
  padding: 0 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 68px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 32px rgba(0,0,0,0.5), 0 1px 0 rgba(0,212,255,0.08);
}
.header-logo { display: flex; align-items: center; gap: 12px; }
.header-logo img { height: 36px; width: auto; object-fit: contain; }
.header-tagline {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-weight: 500;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.header-badge {
  background: linear-gradient(135deg, var(--red), #ff5549);
  color: #fff;
  font-size: 11px;
  font-weight: 800;
  padding: 10px 20px;
  border-radius: 20px;
  letter-spacing: 1px;
  text-transform: uppercase;
  box-shadow: 0 0 12px var(--red-glow-sm);
}

/* ---- HERO ---- */
.hero {
  position: relative;
  z-index: 0;
  background: linear-gradient(180deg, #0a0e18 0%, #080b12 100%);
  padding: 100px 32px 72px;
  text-align: center;
  overflow: hidden;
}

/* Grid lines in hero */
.hero-bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(0,212,255,0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(0,212,255,0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  pointer-events: none;
}

/* Ambient glows */
.hero-glow {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  pointer-events: none;
  animation: glowPulse 6s ease-in-out infinite;
}
.hero-glow-1 {
  width: 500px; height: 300px;
  top: -100px; left: -100px;
  background: radial-gradient(ellipse, rgba(0,212,255,0.12), transparent 70%);
  animation-delay: 0s;
}
.hero-glow-2 {
  width: 400px; height: 300px;
  top: -80px; right: -100px;
  background: radial-gradient(ellipse, rgba(229,53,45,0.1), transparent 70%);
  animation-delay: 3s;
}
@keyframes glowPulse {
  0%, 100% { opacity: 0.6; transform: scale(1); }
  50% { opacity: 1; transform: scale(1.1); }
}

.hero-content { position: relative; z-index: 1; }

.hero-eyebrow {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2.5px;
  text-transform: uppercase;
  color: var(--cyan);
  background: linear-gradient(135deg, rgba(0,212,255,0.08), rgba(59,130,246,0.06));
  border: 1px solid rgba(0,212,255,0.2);
  padding: 6px 18px;
  border-radius: 24px;
  margin-bottom: 24px;
  box-shadow: 0 0 20px rgba(0,212,255,0.08);
}
.hero-eyebrow::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: blink 2s ease-in-out infinite;
}
@keyframes blink { 0%,100%{opacity:1} 50%{opacity:0.3} }

.hero h1 {
  font-size: clamp(36px, 5vw, 64px);
  font-weight: 900;
  color: #fff;
  line-height: 1.05;
  margin-bottom: 20px;
  letter-spacing: -2px;
}
.hero h1 span {
  background: linear-gradient(135deg, var(--red), #ff6b35, var(--red));
  background-size: 200% 100%;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  animation: auditPulse 3s ease-in-out infinite, auditGradient 4s ease infinite;
}
@keyframes auditPulse {
  0%, 100% { filter: drop-shadow(0 0 15px rgba(229,53,45,0.3)) drop-shadow(0 0 5px rgba(229,53,45,0.2)); }
  50% { filter: drop-shadow(0 0 50px rgba(229,53,45,0.7)) drop-shadow(0 0 100px rgba(229,53,45,0.35)) drop-shadow(0 0 150px rgba(229,53,45,0.15)); }
}
@keyframes auditGradient {
  0%, 100% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
}
.hero p {
  color: rgba(255,255,255,0.5);
  font-size: 17px;
  margin-bottom: 40px;
  max-width: 520px;
  margin-left: auto;
  margin-right: auto;
  line-height: 1.6;
}
.input-row {
  display: flex;
  gap: 10px;
  max-width: 700px;
  margin: 0 auto 24px;
  flex-wrap: wrap;
  justify-content: center;
}
.input-row input {
  flex: 1;
  min-width: 200px;
  padding: 18px 24px;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  background: rgba(255,255,255,0.04);
  backdrop-filter: blur(20px);
  color: #fff;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 500;
  outline: none;
  transition: border-color .3s, box-shadow .3s, background .3s;
  box-shadow: 0 2px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
}
.input-row input::placeholder { color: rgba(255,255,255,0.3); }
.input-row input:focus {
  border-color: var(--cyan);
  background: rgba(0,212,255,0.06);
  box-shadow: 0 0 0 3px rgba(0,212,255,0.1), 0 0 20px rgba(0,212,255,0.08);
}

/* RUN AUDIT BUTTON — pulsing glow */
.btn-audit {
  position: relative;
  background: linear-gradient(135deg, var(--red), #ff4d3d);
  color: #fff;
  border: none;
  padding: 18px 44px;
  border-radius: 12px;
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  cursor: pointer;
  transition: transform .2s, box-shadow .3s;
  white-space: nowrap;
  letter-spacing: 0.5px;
  overflow: hidden;
  text-transform: uppercase;
  box-shadow: 0 0 20px var(--red-glow-sm), 0 4px 16px rgba(229,53,45,0.3);
  animation: btnPulse 3s ease-in-out infinite;
}
@keyframes btnPulse {
  0%,100% { box-shadow: 0 0 20px var(--red-glow-sm), 0 4px 16px rgba(229,53,45,0.3); }
  50%      { box-shadow: 0 0 35px var(--red-glow), 0 4px 24px rgba(229,53,45,0.45); }
}
.btn-audit::after {
  content: '';
  position: absolute;
  top: -50%; left: -60%;
  width: 40%; height: 200%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.15), transparent);
  transform: skewX(-20deg);
  transition: left .5s;
}
.btn-audit:hover::after { left: 120%; }
.btn-audit:hover { transform: translateY(-2px); box-shadow: 0 0 40px var(--red-glow), 0 8px 24px rgba(229,53,45,0.5); animation: none; }
.btn-audit:active { transform: translateY(0); }
.btn-audit:disabled { opacity: .5; cursor: not-allowed; transform: none; animation: none; }

.hero-trust {
  display: flex;
  gap: 28px;
  justify-content: center;
  flex-wrap: wrap;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
  font-weight: 600;
  letter-spacing: 0.5px;
  text-transform: uppercase;
}
.hero-trust span { display: flex; align-items: center; gap: 6px; }
.hero-trust span::before { content: ''; width: 4px; height: 4px; border-radius: 50%; background: var(--cyan); opacity: 0.5; }

/* Hero bottom gradient line */
.hero::after {
  content: '';
  position: absolute;
  bottom: 0; left: 10%; right: 10%;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(0,212,255,0.3), rgba(229,53,45,0.3), transparent);
}
@keyframes fadeUp{from{opacity:0;transform:translateY(12px)}to{opacity:1;transform:translateY(0)}}

/* ---- PREVIEW SECTION ---- */
.preview-section {
  position: relative;
  padding: 48px 32px;
  background: linear-gradient(180deg, #080b12 0%, #0d1117 50%, #080b12 100%);
  z-index: 1;
}

/* Horizontal scan line decoration */
.preview-section::before {
  content: '';
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, var(--cyan), var(--electric), var(--red), transparent);
  opacity: 0.4;
}

.preview-container { max-width: 1100px; margin: 0 auto; }

.preview-header {
  text-align: center;
  margin-bottom: 24px;
}
.preview-badge-label {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 2px;
  text-transform: uppercase;
  color: var(--cyan);
  margin-bottom: 16px;
}
.badge-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: blink 1.5s ease-in-out infinite;
}
.preview-title {
  font-size: clamp(26px, 3.5vw, 40px);
  font-weight: 900;
  color: #fff;
  letter-spacing: -0.5px;
  margin-bottom: 12px;
}
.preview-subtitle {
  font-size: 16px;
  color: rgba(255,255,255,0.45);
}

/* Preview main grid */
.preview-main {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 24px;
  align-items: start;
  margin-bottom: 0;
}

/* Glass card base */
.glass-card {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.09);
  border-radius: var(--radius-lg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
.glass-card:hover {
  border-color: rgba(0,212,255,0.25);
  box-shadow: 0 0 30px rgba(0,212,255,0.08), 0 8px 32px rgba(0,0,0,0.4);
  transform: translateY(-2px);
}

/* Sample score card */
.preview-score-card {
  padding: 28px 24px;
  text-align: center;
  position: relative;
  overflow: hidden;
}
.preview-score-domain {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 12px;
  font-weight: 600;
  color: rgba(255,255,255,0.5);
  margin-bottom: 20px;
  letter-spacing: 0.3px;
}
.domain-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: var(--success);
  box-shadow: 0 0 6px var(--success);
}
.preview-gauge-wrap {
  position: relative;
  width: 180px;
  height: 180px;
  margin: 0 auto 16px;
}
.preview-gauge-wrap canvas { display: block; }
.preview-gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.preview-gauge-score {
  font-size: 52px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  font-variant-numeric: tabular-nums;
}
.preview-gauge-sublabel {
  font-size: 14px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}
.preview-score-label {
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 14px;
}
.preview-score-status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  background: rgba(229,53,45,0.1);
  border: 1px solid rgba(229,53,45,0.2);
  padding: 5px 14px;
  border-radius: 20px;
}
.status-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  flex-shrink: 0;
}
.status-critical { background: var(--red); box-shadow: 0 0 6px var(--red); animation: blink 1s ease-in-out infinite; }

/* Scan line animation on score card */
.scan-line {
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 2px;
  background: linear-gradient(90deg, transparent, var(--cyan), transparent);
  opacity: 0;
  animation: scanDown 4s ease-in-out infinite 2s;
}
@keyframes scanDown {
  0%   { top: 0; opacity: 0; }
  5%   { opacity: 0.6; }
  95%  { opacity: 0.6; }
  100% { top: 100%; opacity: 0; }
}

/* Insight cards grid */
.preview-insights-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
}
.insight-card {
  padding: 18px 20px;
  display: flex;
  gap: 16px;
  align-items: flex-start;
}
.insight-icon-wrap {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}
.insight-red  { background: rgba(229,53,45,0.15); color: #ff6b5b; border: 1px solid rgba(229,53,45,0.25); }
.insight-orange { background: rgba(245,158,11,0.15); color: #fbbf24; border: 1px solid rgba(245,158,11,0.25); }
.insight-cyan { background: rgba(0,212,255,0.12); color: var(--cyan); border: 1px solid rgba(0,212,255,0.25); }
.insight-content { flex: 1; min-width: 0; }
.insight-metric {
  font-size: 24px;
  font-weight: 900;
  color: #fff;
  line-height: 1.1;
  margin-bottom: 4px;
}
.insight-money .insight-metric { font-size: 20px; }
.insight-money-val span { font-size: 14px; color: var(--cyan); }
.insight-label {
  font-size: 12px;
  color: rgba(255,255,255,0.5);
  line-height: 1.5;
  font-weight: 500;
}

/* Last insight card spans full width */
.insight-card:last-child {
  grid-column: 1 / -1;
  background: rgba(0,212,255,0.04);
  border-color: rgba(0,212,255,0.15);
}
.insight-card:last-child .insight-metric { color: var(--cyan); }
.insight-card:last-child:hover {
  border-color: rgba(0,212,255,0.4);
  box-shadow: 0 0 30px rgba(0,212,255,0.1), 0 8px 32px rgba(0,0,0,0.4);
}

/* Scroll reveal animations */
.reveal {
  opacity: 0;
  transform: translateY(24px);
  transition: opacity 0.6s ease, transform 0.6s ease;
  transition-delay: calc(var(--stagger, 0) * 0.1s);
}
.reveal.in-view {
  opacity: 1;
  transform: translateY(0);
}

/* Preview CTA */
.preview-cta-wrap { text-align: center; }
.btn-cta-preview {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, rgba(0,212,255,0.1), rgba(59,130,246,0.1));
  border: 1px solid rgba(0,212,255,0.35);
  color: var(--cyan);
  font-family: var(--font);
  font-size: 16px;
  font-weight: 800;
  padding: 16px 40px;
  border-radius: 12px;
  cursor: pointer;
  text-decoration: none;
  transition: all .25s;
  letter-spacing: 0.3px;
  box-shadow: 0 0 20px rgba(0,212,255,0.08);
}
.btn-cta-preview:hover {
  background: rgba(0,212,255,0.15);
  border-color: var(--cyan);
  box-shadow: 0 0 40px rgba(0,212,255,0.2), 0 4px 20px rgba(0,212,255,0.15);
  transform: translateY(-2px);
  color: #fff;
}
.cta-arrow { font-size: 18px; transition: transform .25s; }
.btn-cta-preview:hover .cta-arrow { transform: translateX(4px); }
.preview-cta-note {
  margin-top: 12px;
  font-size: 12px;
  color: rgba(255,255,255,0.3);
}

/* ---- LOADING ---- */
.loading-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(8,11,18,0.95);
  backdrop-filter: blur(8px);
  z-index: 200;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 28px;
}
.loading-overlay.active { display: flex; }

/* Futuristic spinner with dual rings */
.spinner {
  width: 60px;
  height: 60px;
  position: relative;
}
.spinner::before, .spinner::after {
  content: '';
  position: absolute;
  border-radius: 50%;
  border: 2px solid transparent;
}
.spinner::before {
  inset: 0;
  border-top-color: var(--cyan);
  border-right-color: var(--cyan);
  animation: spin .7s linear infinite;
  box-shadow: 0 0 12px var(--cyan-glow);
}
.spinner::after {
  inset: 8px;
  border-bottom-color: var(--red);
  border-left-color: var(--red);
  animation: spin .9s linear infinite reverse;
}
@keyframes spin { to { transform: rotate(360deg); } }

.loading-steps { display: flex; flex-direction: column; gap: 12px; }
.loading-step {
  display: flex;
  align-items: center;
  gap: 14px;
  color: rgba(255,255,255,0.3);
  font-size: 13px;
  font-weight: 600;
  transition: color .3s;
  letter-spacing: 0.3px;
}
.loading-step.active { color: #fff; }
.loading-step.done { color: var(--success); }
.step-dot {
  width: 8px; height: 8px;
  border-radius: 50%;
  background: rgba(255,255,255,0.15);
  flex-shrink: 0;
  transition: background .3s, box-shadow .3s;
}
.loading-step.active .step-dot {
  background: var(--cyan);
  box-shadow: 0 0 8px var(--cyan);
  animation: pulse 1s infinite;
}
.loading-step.done .step-dot {
  background: var(--success);
  box-shadow: 0 0 6px var(--success-glow);
  animation: none;
}
@keyframes pulse { 0%,100% { transform: scale(1); } 50% { transform: scale(1.6); } }

/* ---- MAIN LAYOUT ---- */
#dashboard { display: none; background: var(--bg); }
#dashboard.visible { display: block; }
.container { max-width: 1200px; margin: 0 auto; padding: 0 24px; }

/* ---- VIEW TOGGLE ---- */
.view-bar {
  background: rgba(8,11,18,0.9);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid rgba(0,212,255,0.08);
  padding: 16px 32px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
  position: sticky;
  top: 68px;
  z-index: 90;
}
.view-toggle { display: flex; gap: 6px; }
.btn-view {
  background: transparent;
  color: rgba(255,255,255,0.4);
  border: 1px solid rgba(255,255,255,0.1);
  padding: 8px 20px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  letter-spacing: 0.8px;
  text-transform: uppercase;
}
.btn-view.active {
  background: rgba(229,53,45,0.15);
  color: var(--red);
  border-color: rgba(229,53,45,0.4);
  box-shadow: 0 0 12px var(--red-glow-sm);
}
#btn-deep.active {
  background: rgba(0,212,255,0.15);
  color: var(--cyan);
  border-color: rgba(0,212,255,0.4);
  box-shadow: 0 0 12px var(--cyan-glow);
}
.btn-view:hover:not(.active) {
  border-color: rgba(255,255,255,0.25);
  color: rgba(255,255,255,0.7);
  background: rgba(255,255,255,0.04);
}
.domain-label { color: rgba(255,255,255,0.45); font-size: 13px; font-weight: 500; }
.domain-label strong { color: var(--cyan); }
.btn-pdf {
  background: transparent;
  color: rgba(255,255,255,0.5);
  border: 1px solid rgba(255,255,255,0.12);
  padding: 8px 18px;
  border-radius: 8px;
  font-family: var(--font);
  font-size: 12px;
  font-weight: 700;
  cursor: pointer;
  transition: all .2s;
  display: flex;
  align-items: center;
  gap: 8px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.btn-pdf:hover {
  background: rgba(0,212,255,0.08);
  color: var(--cyan);
  border-color: rgba(0,212,255,0.3);
  box-shadow: 0 0 12px rgba(0,212,255,0.1);
}

/* ---- SCORE BANNER ---- */
.score-banner {
  background: linear-gradient(135deg, #0d1117, #111827);
  border-bottom: 1px solid rgba(255,255,255,0.06);
  padding: 44px 32px;
  position: relative;
  overflow: hidden;
}
.score-banner::before {
  content: '';
  position: absolute;
  top: -50%; left: -20%;
  width: 400px; height: 400px;
  background: radial-gradient(ellipse, rgba(0,212,255,0.05), transparent 70%);
  pointer-events: none;
}
.score-banner .container {
  display: grid;
  grid-template-columns: auto 1fr;
  gap: 48px;
  align-items: center;
  position: relative;
}
.gauge-wrap { position: relative; width: 180px; height: 180px; flex-shrink: 0; }
.gauge-wrap canvas { display: block; }
.gauge-center {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
}
.gauge-score {
  font-size: 52px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  text-shadow: 0 0 30px rgba(255,255,255,0.3);
}
.gauge-label {
  font-size: 11px;
  color: rgba(255,255,255,0.4);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
}
.score-meta h2 { font-size: 22px; font-weight: 800; color: #fff; margin-bottom: 8px; }
.score-meta p { color: rgba(255,255,255,0.45); font-size: 14px; line-height: 1.7; max-width: 480px; margin-bottom: 20px; }
.score-pills { display: flex; gap: 10px; flex-wrap: wrap; }
.score-pill {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 8px;
  padding: 8px 14px;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 12px;
  color: rgba(255,255,255,0.6);
  font-weight: 500;
  transition: border-color .2s, box-shadow .2s;
}
.score-pill:hover {
  border-color: rgba(0,212,255,0.2);
  box-shadow: 0 0 12px rgba(0,212,255,0.06);
}
.score-pill .pill-val { font-weight: 900; color: #fff; font-size: 15px; }
.score-pill .pill-val.red { color: var(--red); text-shadow: 0 0 10px var(--red-glow-sm); }
.score-pill .pill-val.green { color: var(--success); text-shadow: 0 0 10px var(--success-glow); }
.score-pill .pill-val.yellow { color: var(--warn); }

/* ---- SECTION ---- */
.section { padding: 36px 0; }
.section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 10px;
}
.section-title::before {
  content: '';
  display: inline-block;
  width: 3px;
  height: 14px;
  background: linear-gradient(180deg, var(--cyan), var(--electric));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--cyan-glow-sm);
}

/* ---- CARDS ---- */
.cards-grid {
  display: grid;
  gap: 14px;
}
.cards-grid.cols-2 { grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); }
.cards-grid.cols-3 { grid-template-columns: repeat(auto-fit, minmax(220px, 1fr)); }
.cards-grid.cols-4 { grid-template-columns: repeat(auto-fit, minmax(180px, 1fr)); }

.card {
  background: linear-gradient(145deg, rgba(255,255,255,0.05), rgba(255,255,255,0.02));
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: var(--radius);
  padding: 24px;
  backdrop-filter: blur(16px);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2), inset 0 1px 0 rgba(255,255,255,0.04);
  transition: border-color .3s, box-shadow .3s, transform .3s;
}
.card:hover {
  border-color: rgba(0,212,255,0.25);
  box-shadow: 0 0 30px rgba(0,212,255,0.08), 0 8px 40px rgba(0,0,0,0.35), inset 0 1px 0 rgba(255,255,255,0.06);
  transform: translateY(-2px);
  transform: translateY(-2px);
}
.card-dark {
  background: rgba(255,255,255,0.03);
  border-color: rgba(255,255,255,0.07);
}
.card-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: rgba(255,255,255,0.35);
  margin-bottom: 10px;
}
.card-value {
  font-size: 34px;
  font-weight: 900;
  line-height: 1;
  margin-bottom: 6px;
  color: #fff;
}
.card-sub {
  font-size: 12px;
  color: rgba(255,255,255,0.35);
  font-weight: 500;
}
.trend-up { color: var(--success); }
.trend-down { color: var(--red); }

/* ---- SCORE BARS ---- */
.score-bar-row {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
}
.score-bar-label { font-size: 13px; font-weight: 600; width: 120px; flex-shrink: 0; color: rgba(255,255,255,0.7); }
.score-bar-track {
  flex: 1;
  height: 6px;
  background: rgba(255,255,255,0.06);
  border-radius: 3px;
  overflow: hidden;
}
.score-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: linear-gradient(90deg, var(--red), #ff6b35);
  width: 0;
  transition: width 1.2s cubic-bezier(.4,0,.2,1);
  box-shadow: 0 0 8px var(--red-glow-sm);
}
.score-bar-fill.green {
  background: linear-gradient(90deg, var(--success), #4ade80);
  box-shadow: 0 0 8px var(--success-glow);
}
.score-bar-fill.yellow {
  background: linear-gradient(90deg, var(--warn), #fbbf24);
  box-shadow: 0 0 8px var(--warn-glow);
}
.score-bar-val { font-size: 13px; font-weight: 800; width: 32px; text-align: right; color: rgba(255,255,255,0.7); }

/* ---- TABLES ---- */
.data-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}
.data-table th {
  text-align: left;
  padding: 12px 16px;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
  border-bottom: 1px solid rgba(0,212,255,0.12);
  background: rgba(0,212,255,0.03);
}
.data-table td {
  padding: 11px 16px;
  border-bottom: 1px solid rgba(255,255,255,0.04);
  font-weight: 500;
  vertical-align: middle;
  color: rgba(255,255,255,0.75);
}
.data-table tr:last-child td { border-bottom: none; }
.data-table tr:hover td {
  background: rgba(0,212,255,0.04);
  color: #fff;
}
.pos-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 28px; height: 28px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 800;
}
.pos-1-3  { background: rgba(245,158,11,0.2); color: #fbbf24; border: 1px solid rgba(245,158,11,0.3); }
.pos-4-10 { background: rgba(34,197,94,0.15); color: #4ade80; border: 1px solid rgba(34,197,94,0.25); }
.pos-11-20{ background: rgba(245,158,11,0.12); color: #f59e0b; border: 1px solid rgba(245,158,11,0.2); }
.pos-21   { background: rgba(229,53,45,0.12); color: #ff6b5b; border: 1px solid rgba(229,53,45,0.2); }

/* ---- ISSUES LIST ---- */
.issues-list { display: flex; flex-direction: column; gap: 8px; }
.issue-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  line-height: 1.5;
  border: 1px solid;
  backdrop-filter: blur(8px);
  transition: transform .2s;
}
.issue-item:hover { transform: translateX(4px); }
.issue-item.high {
  background: rgba(229,53,45,0.08);
  border-color: rgba(229,53,45,0.2);
  color: #fca5a5;
}
.issue-item.medium {
  background: rgba(245,158,11,0.08);
  border-color: rgba(245,158,11,0.2);
  color: #fde68a;
}
.issue-item.low {
  background: rgba(34,197,94,0.07);
  border-color: rgba(34,197,94,0.2);
  color: #86efac;
}
.issue-badge {
  font-size: 9px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  padding: 2px 8px;
  border-radius: 4px;
  flex-shrink: 0;
  margin-top: 2px;
  border: 1px solid currentColor;
  opacity: 0.9;
}

/* ---- CWV GRID (overrides for dark theme) ---- */
#cwv-grid > div > div:first-child {
  color: #fff !important;
}

/* ---- ACTION PLAN ---- */
.plan-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 14px;
  align-items: start;
}
.plan-month {
  border-radius: var(--radius);
  overflow: hidden;
  border: 1px solid rgba(255,255,255,0.08);
  backdrop-filter: blur(10px);
  transition: border-color .25s, box-shadow .25s;
}
.plan-month:hover { border-color: rgba(255,255,255,0.14); box-shadow: 0 8px 32px rgba(0,0,0,0.3); }
.plan-month-header {
  padding: 14px 20px;
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: #fff;
  position: relative;
  overflow: hidden;
}
.plan-month-header::after {
  content: '';
  position: absolute;
  right: -20px; top: -20px;
  width: 80px; height: 80px;
  border-radius: 50%;
  background: rgba(255,255,255,0.08);
}
.plan-month-header.m1 { background: linear-gradient(135deg, var(--red), #c42b24); box-shadow: inset 0 -1px 0 rgba(255,255,255,0.1); }
.plan-month-header.m2 { background: linear-gradient(135deg, #1d4ed8, #1e40af); box-shadow: inset 0 -1px 0 rgba(255,255,255,0.1); }
.plan-month-header.m3 { background: linear-gradient(135deg, #15803d, #166534); box-shadow: inset 0 -1px 0 rgba(255,255,255,0.1); }
.plan-month-body {
  background: rgba(255,255,255,0.03);
  border-top: none;
  padding: 16px 20px;
}
.plan-item-wrap {
  border-bottom: 1px solid rgba(255,255,255,0.04);
}
.plan-item-wrap:last-child { border-bottom: none; }
.plan-item {
  display: flex;
  gap: 10px;
  padding: 8px 0;
  font-size: 13px;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
  line-height: 1.5;
}
.plan-item-toggle {
  cursor: pointer;
  transition: color .2s;
}
.plan-item-toggle:hover { color: rgba(255,255,255,0.95); }
.plan-chevron {
  flex-shrink: 0;
  margin-left: auto;
  margin-top: 2px;
  color: rgba(255,255,255,0.3);
  transition: transform .25s ease, color .25s;
}
.plan-item-wrap.open .plan-chevron {
  transform: rotate(180deg);
  color: var(--cyan);
}
.plan-why {
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  padding: 0 0 0 26px;
  font-size: 12px;
  line-height: 1.6;
  color: rgba(255,255,255,0.5);
  background: rgba(255,255,255,0.02);
  border-radius: 6px;
  transition: max-height .3s ease, opacity .3s ease, padding .3s ease;
}
.plan-item-wrap.open .plan-why {
  max-height: 200px;
  opacity: 1;
  padding: 10px 12px 10px 26px;
  margin-bottom: 4px;
}
.plan-why strong {
  color: var(--cyan);
  font-weight: 700;
}
.plan-check {
  width: 16px; height: 16px;
  border-radius: 4px;
  border: 1px solid rgba(255,255,255,0.2);
  flex-shrink: 0;
  margin-top: 2px;
  background: rgba(255,255,255,0.03);
}

/* ---- REVENUE ESTIMATE ---- */
.revenue-card {
  background: linear-gradient(145deg, rgba(13,17,23,0.9), rgba(17,24,39,0.9));
  border: 1px solid rgba(0,212,255,0.15);
  border-radius: var(--radius-lg);
  padding: 48px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  gap: 32px;
  align-items: center;
  box-shadow: 0 4px 40px rgba(0,0,0,0.3), inset 0 1px 0 rgba(255,255,255,0.05);
  position: relative;
  overflow: hidden;
}
.revenue-card::before {
  content: '';
  position: absolute;
  bottom: -40%; right: -10%;
  width: 300px; height: 300px;
  background: radial-gradient(ellipse, rgba(34,197,94,0.06), transparent 70%);
  pointer-events: none;
}
.revenue-item { text-align: center; position: relative; }
.revenue-val {
  font-size: 48px;
  font-weight: 900;
  color: #fff;
  line-height: 1;
  margin-bottom: 8px;
  letter-spacing: -1px;
}
.revenue-val.green {
  color: var(--success);
  text-shadow: 0 0 40px rgba(34,197,94,0.4), 0 0 80px rgba(34,197,94,0.15);
}
.revenue-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: rgba(255,255,255,0.3);
}
.revenue-divider {
  width: 1px;
  background: linear-gradient(180deg, transparent, rgba(0,212,255,0.3), transparent);
  height: 80px;
  margin: 0 auto;
}

/* ---- ERROR / EMPTY ---- */
.error-card {
  background: rgba(229,53,45,0.08);
  border: 1px solid rgba(229,53,45,0.2);
  border-radius: var(--radius);
  padding: 20px 24px;
  color: #fca5a5;
  font-size: 14px;
  font-weight: 500;
}
.empty-state {
  text-align: center;
  padding: 40px;
  color: rgba(255,255,255,0.25);
  font-size: 14px;
}

/* ---- QUICK/DEEP TOGGLE ---- */
.deep-only { display: none; }
body.deep-mode .deep-only {
  display: block;
  animation: fadeSlideIn 0.4s ease-out;
}
body.deep-mode .quick-only { display: none; }
@keyframes fadeSlideIn {
  from { opacity: 0; transform: translateY(16px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---- FOOTER ---- */
.dash-footer {
  background: var(--bg2);
  border-top: 1px solid rgba(0,212,255,0.06);
  color: rgba(255,255,255,0.2);
  text-align: center;
  padding: 20px;
  font-size: 12px;
  margin-top: 0;
}
.dash-footer a { color: rgba(255,255,255,0.3); text-decoration: none; transition: color .2s; }
.dash-footer a:hover { color: var(--cyan); }

/* CTA section inside dashboard */
#dashboard .section:last-of-type h2 { color: #fff; }
#dashboard .section:last-of-type p { color: rgba(255,255,255,0.45); }

/* ---- SPEED LOADING DOT ---- */
.speed-loading-dot {
  display: inline-block;
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--cyan);
  box-shadow: 0 0 6px var(--cyan);
  animation: pulse 1s ease-in-out infinite;
  margin-right: 6px;
  vertical-align: middle;
}

.perf-loading-spinner {
  display: inline-block;
  width: 48px; height: 48px;
  border: 4px solid rgba(255,255,255,0.1);
  border-top-color: var(--cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ---- DATA SOURCE BADGES ---- */
.src-badge {
  padding: 4px 10px;
  border-radius: 6px;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-transform: uppercase;
  border: 1px solid;
  transition: all .3s;
}
.src-active {
  color: var(--success);
  border-color: rgba(34,197,94,0.3);
  background: rgba(34,197,94,0.08);
}
.src-inactive {
  color: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.06);
  background: transparent;
  text-decoration: line-through;
}

/* ---- SECTION INSIGHT CAPTIONS (sales call talking points) ---- */
.section-insight {
  margin-top: 14px;
  padding: 14px 18px;
  border-radius: 10px;
  background: rgba(0,212,255,0.04);
  border-left: 3px solid var(--cyan);
  font-size: 13px;
  line-height: 1.65;
  color: rgba(255,255,255,0.7);
  font-weight: 500;
  animation: fadeSlideIn 0.4s ease-out;
}
.section-insight strong {
  color: #fff;
  font-weight: 800;
}
.section-insight .insight-warn {
  color: var(--red);
  font-weight: 700;
}
.section-insight .insight-good {
  color: var(--success);
  font-weight: 700;
}
.section-insight .insight-highlight {
  color: var(--cyan);
  font-weight: 700;
}

/* ---- TOAST NOTIFICATION ---- */
#toast {
  position: fixed;
  bottom: 32px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: rgba(229,53,45,0.95);
  color: #fff;
  padding: 12px 24px;
  border-radius: 10px;
  font-family: var(--font);
  font-size: 14px;
  font-weight: 700;
  box-shadow: 0 4px 24px rgba(229,53,45,0.4), 0 0 0 1px rgba(255,255,255,0.1);
  z-index: 300;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s, transform 0.3s;
  white-space: nowrap;
}
#toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* ---- INPUT ERROR STATE ---- */
.input-error {
  border-color: var(--red) !important;
  box-shadow: 0 0 0 3px rgba(229,53,45,0.2), 0 0 12px rgba(229,53,45,0.15) !important;
  animation: shake 0.4s ease-out;
}
@keyframes shake {
  0%, 100% { transform: translateX(0); }
  20% { transform: translateX(-6px); }
  40% { transform: translateX(6px); }
  60% { transform: translateX(-4px); }
  80% { transform: translateX(4px); }
}

/* ---- PDF TARGET ---- */
#pdf-target { font-family: var(--font) !important; }
#pdf-target.pdf-compact .section { padding: 16px 0; }
#pdf-target.pdf-compact .card { padding: 14px; }
#pdf-target.pdf-compact .plan-month-body { padding: 10px 14px; }
#pdf-target.pdf-compact .plan-item { padding: 4px 0; font-size: 11px; }
#pdf-target.pdf-compact .plan-why { display: none; }
#pdf-target.pdf-compact .plan-chevron { display: none; }
#pdf-target.pdf-compact .section-title { margin-bottom: 10px; }
#pdf-target.pdf-compact .score-banner { padding: 20px 16px; }
#pdf-target.pdf-compact .revenue-card { padding: 20px; }
#pdf-target.pdf-compact .cards-grid { gap: 10px; }
#pdf-target.pdf-compact .plan-grid { gap: 10px; }
#pdf-target.pdf-compact .data-table th,
#pdf-target.pdf-compact .data-table td { padding: 6px 10px; }
#pdf-target.pdf-compact .section-insight { font-size: 11px; padding: 10px 14px; margin-top: 8px; }

/* ---- RESPONSIVE ---- */
@media (max-width: 900px) {
  .preview-main { grid-template-columns: 1fr; }
  .preview-score-card { max-width: 320px; margin: 0 auto; }
  .preview-insights-grid { grid-template-columns: 1fr; }
  .insight-card:last-child { grid-column: auto; }
  .cards-grid.cols-2 { grid-template-columns: 1fr; }
  .cards-grid.cols-4 { grid-template-columns: 1fr 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
}
@media (max-width: 768px) {
  /* Header */
  .header { padding: 0 12px; gap: 8px; }
  .header-badge { font-size: 8px; padding: 4px 10px; white-space: nowrap; }
  .header-tagline { display: none; }
  .header-logo img { height: 22px; }

  /* Hero */
  .hero { padding: 40px 16px 36px; }
  .hero h1 { font-size: 28px !important; letter-spacing: -1px !important; }
  .hero-eyebrow { font-size: 10px; padding: 6px 14px; }
  .hero-subtitle { font-size: 14px; }
  .input-row { flex-direction: column; gap: 10px; }
  .input-row input { width: 100%; min-width: 0; flex: none; padding: 14px 18px; }
  .input-row .btn-audit { width: 100%; padding: 14px 18px; }
  .hero-trust { font-size: 10px; gap: 12px; flex-wrap: wrap; justify-content: center; }
  .hero-stats { gap: 24px; flex-wrap: wrap; justify-content: center; }
  .hero-stat-num { font-size: 28px; }

  /* Preview */
  .preview-section { padding: 32px 16px; }
  .preview-title { font-size: 24px; }
  .preview-insights-grid { grid-template-columns: 1fr; }

  /* Dashboard */
  .view-bar { padding: 10px 12px; top: 48px; flex-wrap: wrap; gap: 8px; }
  .view-bar .btn-view { font-size: 11px; padding: 6px 14px; }
  .score-banner { padding: 24px 16px; }
  .score-banner .container { grid-template-columns: 1fr; gap: 20px; text-align: center; }
  .gauge-wrap { margin: 0 auto; }
  .score-pills { justify-content: center; flex-wrap: wrap; }
  .container { padding: 0 12px; }
  .section { padding: 20px 0; }
  .section-title { font-size: 14px; }

  /* Revenue */
  .revenue-card { grid-template-columns: 1fr; padding: 24px 16px; }
  .revenue-divider { display: none; }
  .revenue-val { font-size: 32px !important; }

  /* Cards */
  .cards-grid { grid-template-columns: 1fr !important; }
  .card { padding: 16px; }

  /* Tables */
  .data-table { font-size: 12px; }
  .data-table th, .data-table td { padding: 8px 10px; }

  /* Action Plan */
  .plan-grid { grid-template-columns: 1fr; }
  .plan-month-body { padding: 12px 14px; }
  .plan-item { font-size: 12px; }
  .plan-why { font-size: 11px; }

  /* Deep Dive */
  .deep-grid { grid-template-columns: 1fr !important; }

  /* Modal */
  #lead-modal > div { padding: 28px 20px; width: 95%; }

  /* Footer */
  .dash-footer { font-size: 11px; padding: 20px 16px; }

  /* Trend chart */
  .trend-bars { gap: 2px; }
}

@media (max-width: 480px) {
  .hero h1 { font-size: 24px !important; }
  .hero-stats { gap: 16px; }
  .hero-stat-num { font-size: 24px; }
  .preview-title { font-size: 20px; }
  .score-banner h2 { font-size: 18px; }
  .revenue-val { font-size: 26px !important; }
  .header-badge { font-size: 7px; padding: 3px 8px; }
}
