/* "Modern Digital Fort Knox" brand tokens (#568) — SSOT: docs/brand-guidelines.md,
 * assets/design-tokens.json. This file (public/design-tokens.css) is a synced copy
 * (see scripts/sync-brand-to-tokens.cjs); never hand-edit it. */
@import url('design-tokens.css');

:root {
  /* Dark theme — matching mobile.css ScanGuard aesthetic.
   * Values are now token-driven: every var below points at an --fk-* brand
   * token instead of a hardcoded hex, so the two stay in lockstep by
   * construction. Variable names are kept as-is for backward compatibility
   * with every existing selector in this file / public/*.html. */
  --bg: var(--fk-color-semantic-bg-page);
  --bg-card: var(--fk-color-semantic-bg-card);
  --bg-card-hover: var(--fk-color-semantic-bg-card-hover);
  --bg-elevated: var(--fk-color-semantic-bg-elevated);
  --bg-input: var(--fk-color-semantic-bg-input);
  --border: var(--fk-color-semantic-border-default);
  --border-focus: var(--fk-color-semantic-border-focus);
  --text: var(--fk-color-semantic-text-primary);
  --text-secondary: var(--fk-color-semantic-text-secondary);
  --text-muted: var(--fk-color-semantic-text-muted);
  --accent: var(--fk-color-semantic-accent);
  --accent-light: var(--fk-color-semantic-accent-hover);
  --accent-glow: var(--fk-color-semantic-accent-glow);
  --green: var(--fk-color-semantic-severity-good);
  --amber: var(--fk-color-semantic-severity-warn);
  --red: var(--fk-color-semantic-severity-bad);
  --orange: var(--fk-color-semantic-severity-info);
  --radius-sm: var(--fk-radius-sm);
  --radius-md: var(--fk-radius-md);
  --radius-lg: var(--fk-radius-lg);
  --radius-xl: var(--fk-radius-xl);
  --font-mono: var(--fk-font-mono);
  --font-serif: var(--fk-font-serif);
  --font-sans: var(--fk-font-sans);

  /* Legacy refs kept for compatibility (unchanged hex values, now sourced
   * from the same primitive scale in assets/design-tokens.json) */
  --navy-950: #0f172a;
  --navy-900: var(--fk-color-primitive-vault-900);
  --blue-800: #1e40af;
  --blue-700: var(--fk-color-primitive-steel-700);
  --blue-600: var(--fk-color-primitive-steel-600);
  --blue-500: var(--fk-color-primitive-steel-500);
  --slate-50: #f8fafc;
  --slate-100: var(--fk-color-primitive-vault-50);
  --slate-200: var(--fk-color-primitive-vault-100);
  --slate-400: var(--fk-color-primitive-vault-200);
  --slate-500: var(--fk-color-primitive-vault-300);
  --slate-700: var(--fk-color-primitive-vault-500);
  --slate-800: var(--fk-color-primitive-vault-600);
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* Serif headings + monospace data (#66) */
h1, h2, h3, .score-value, .grade-display {
  font-family: var(--font-serif);
}
.scan-domain, .ip-address, .hash-value, .technical-data, pre, code {
  font-family: var(--font-mono);
}
h1,
h2,
h3,
.heading-serif {
  font-family: var(--font-serif);
}

/* ---- Enterprise color scheme ---- */
.btn-primary {
  background: var(--accent);
  color: #fff;
  border: none;
  cursor: pointer;
  transition: background 0.15s, box-shadow 0.15s, transform 0.15s;
  font-weight: 600;
}
.btn-primary:hover {
  background: var(--accent-light);
  box-shadow: 0 4px 16px rgba(59, 130, 246, 0.35);
  transform: translateY(-1px);
}

.btn-secondary {
  background: transparent;
  color: var(--text-secondary);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-secondary:hover {
  background: var(--bg-card-hover);
  color: var(--text);
  border-color: var(--text-muted);
}

/* Card base */
.card-white {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.2);
}

[hidden],
.hidden {
  display: none !important;
}
body.state-landing #landing-state {
  display: block;
}
body.state-scanning #scanning-state {
  display: block;
}
body.state-results #results-state {
  display: block;
}

.grade-A-plus,
.grade-A {
  color: #22c55e;
}
.grade-B {
  color: #84cc16;
}
.grade-C {
  color: #f59e0b;
}
.grade-D {
  color: #f97316;
}
.grade-F {
  color: #ef4444;
}
.grade-na {
  color: #64748b;
}

/* ── Tab navigation (#63) ── */
.tab-nav-wrapper {
  position: relative;
  margin-bottom: 1.5rem;
}

#tab-nav {
  gap: 0;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
  padding-bottom: 0;
}
#tab-nav::-webkit-scrollbar {
  display: none;
}

/* Fade indicators on both sides when tabs overflow */
.tab-nav-wrapper::before,
.tab-nav-wrapper::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 36px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.2s;
}
.tab-nav-wrapper::before {
  left: 0;
  background: linear-gradient(to left, transparent, var(--bg));
}
.tab-nav-wrapper::after {
  right: 0;
  background: linear-gradient(to right, transparent, var(--bg));
}
.tab-nav-wrapper.overflow-left::before,
.tab-nav-wrapper.overflow-right::after {
  opacity: 1;
}

.tab-btn {
  padding: 0.625rem 1rem;
  border: none;
  border-bottom: 3px solid transparent;
  background: transparent;
  color: var(--text-muted);
  font-size: 0.875rem;
  font-weight: 500;
  cursor: pointer;
  white-space: nowrap;
  transition: color 0.15s, border-color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  flex-shrink: 0;
  border-radius: 0;
  position: relative;
}
.tab-btn:hover {
  color: var(--text);
}
.tab-btn.active {
  color: var(--accent);
  border-bottom-color: var(--accent);
  font-weight: 600;
  background: transparent;
}
/* Animated underline indicator */
.tab-btn.active::after {
  content: '';
  position: absolute;
  bottom: -3px;
  left: 0;
  right: 0;
  height: 3px;
  background: var(--accent);
  border-radius: 3px 3px 0 0;
  animation: tab-underline-in 0.3s ease-out;
}
@keyframes tab-underline-in {
  from { transform: scaleX(0); opacity: 0; }
  to { transform: scaleX(1); opacity: 1; }
}

/* Severity count badge inside a tab */
.tab-badge {
  font-size: 0.65rem;
  padding: 0.1rem 0.4rem;
  border-radius: 999px;
  background: rgba(239,68,68,0.15);
  color: #fca5a5;
  font-weight: 600;
  line-height: 1.4;
}

/* ── Mobile & responsive design ── */

/* ── Desktop Scanner Type Selector ── */
.desktop-scanner-selector {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 20px;
  flex-wrap: wrap;
}
.dss-btn {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 10px 16px;
  background: var(--bg-card);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all 0.2s;
  min-width: 72px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-muted);
  -webkit-tap-highlight-color: transparent;
}
.dss-btn:hover { border-color: var(--text-muted); background: var(--bg-card-hover); }
.dss-btn:active { transform: scale(0.95); }
.dss-btn.active {
  border-color: var(--accent);
  background: rgba(59,130,246,0.1);
  color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.dss-btn span:first-child { font-size: 22px; line-height: 1; }

.desktop-scanner-group { margin-bottom: 8px; }
.dss-info-card {
  display: flex;
  gap: 14px;
  padding: 16px 20px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-width: 540px;
  margin: 0 auto 12px;
  align-items: flex-start;
  text-align: left;
}
.dss-info-icon { font-size: 32px; flex-shrink: 0; }
.dss-info-card strong { display: block; font-size: 15px; color: var(--text); margin-bottom: 4px; }
.dss-info-card p { font-size: 13px; color: var(--text-secondary); line-height: 1.5; margin: 0; }

/* Base mobile breakpoint: phones */
@media (max-width: 640px) {
  /* Header tighter */
  header .max-w-5xl {
    padding-left: 0.5rem;
    padding-right: 0.5rem;
  }
  header span {
    font-size: 0.9rem;
  }

  /* Hero section */
  #landing-state h1 {
    font-size: 1.5rem !important;
    line-height: 1.3;
  }
  #landing-state p {
    font-size: 0.9rem;
  }
  #landing-state form {
    flex-direction: column;
    gap: 0.75rem;
  }
  #landing-state #domain-input {
    width: 100%;
    font-size: 1rem;
    padding: 0.75rem 1rem;
  }
  #landing-state button[type="submit"] {
    width: 100%;
    justify-content: center;
  }

  /* Feature badges: stack smaller on mobile */
  .landing-feature-badges {
    gap: 0.5rem;
    margin: 1rem 0 1.5rem;
  }
  .landing-feature-badge {
    font-size: 0.7rem;
    padding: 0.3rem 0.75rem;
  }

  /* Features row: wrap tighter on mobile */
  .landing-features-row {
    gap: 0.5rem;
    margin-top: 1.5rem;
  }
  .landing-feature-item {
    font-size: 0.75rem;
    padding: 0.4rem 0.75rem;
  }

  /* Trust bar stacks */
  #landing-state .mt-12 {
    margin-top: 2rem;
    gap: 0.75rem;
  }
  #landing-state .mt-12 span {
    font-size: 0.7rem;
  }

  /* Feature chips: 2 columns, compact */
  #feature-chips .grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 0.375rem;
  }
  .feature-chip {
    padding: 0.5rem 0.5rem;
    font-size: 0.7rem;
    gap: 0.375rem;
  }
  .feature-chip span.text-base {
    font-size: 0.8rem;
  }
  .feature-chip span.font-medium {
    font-size: 0.65rem;
  }

  /* Scanning state */
  #scanning-state {
    padding: 2rem 1rem;
  }
  #scanning-state .text-xl {
    font-size: 1.1rem;
  }
  .scan-check-item {
    font-size: 0.75rem;
    padding: 0.375rem 0.5rem;
  }

  /* Results: gauge smaller */
  .score-gauge,
  #score-gauge {
    width: 120px !important;
    height: 120px !important;
  }
  #score-gauge-text {
    font-size: 32px !important;
  }
  #score-gauge-grade {
    font-size: 14px !important;
  }

  /* Results: actions stack */
  #results-state .flex.flex-wrap.justify-center {
    flex-direction: column;
    gap: 0.5rem;
  }
  #results-state .flex.flex-wrap.justify-center button {
    width: 100%;
  }

  /* Finding cards compact */
  .finding-card {
    padding: 0.75rem;
  }
  .finding-card .font-medium {
    font-size: 0.85rem;
  }

  /* Cert badges wrap tighter */
  .cert-badge {
    font-size: 0.7rem;
    padding: 0.375rem 0.5rem;
  }

  /* Modal full-width */
  #lead-modal form {
    margin: 0.5rem;
    padding: 1.25rem;
    border-radius: 1rem;
  }
}

/* Tablet breakpoint */
@media (min-width: 641px) and (max-width: 1024px) {
  #landing-state h1 {
    font-size: 2rem !important;
  }
  #feature-chips .grid {
    grid-template-columns: repeat(3, 1fr) !important;
  }
  #results-state .flex.flex-wrap.justify-center {
    gap: 0.5rem;
  }
}

/* PC: auto-adjust max-width containers */
@media (min-width: 1280px) {
  main section:not(#results-state) {
    max-width: 64rem;
    margin-left: auto;
    margin-right: auto;
  }
  #results-state {
    max-width: 72rem;
  }
  #feature-chips {
    max-width: 72rem;
  }
}

/* Touch-friendly: larger tap targets on touch devices */
@media (hover: none) and (pointer: coarse) {
  button, .tab-btn, .feature-chip, input[type="checkbox"] {
    min-height: 44px;
  }
  input[type="text"], input[type="email"] {
    min-height: 48px;
  }
  .tab-btn {
    padding-top: 0.875rem;
    padding-bottom: 0.875rem;
  }
}

/* Monospace for technical data (domains, IPs, ports, tech names) */
.mono, .domain, .ip, .tech-name {
  font-family: 'Courier New', 'Consolas', 'SF Mono', monospace;
  font-size: 0.9em;
}

/* ---- Score gauge (#61) ---- */
.score-gauge {
  width: 140px;
  height: 140px;
  margin: 0 auto;
}
.score-gauge circle {
  transition: stroke-dashoffset 1s ease-out;
}
.score-gauge .score-text {
  font-size: 2rem;
  font-weight: 700;
  fill: currentColor;
}
.score-gauge .score-label {
  font-size: 0.7rem;
  fill: #64748b;
}

/* ---- Enterprise Dark Color Scheme enhancements (#62) ---- */
/* Gradient backgrounds for cards */
.card-white,
#results-state .card-white,
.weight-row,
.score-comp-row,
.history-item {
  background: linear-gradient(135deg, rgba(15,20,40,0.9), rgba(10,14,26,0.95));
}

/* Border glow on hover for interactive cards */
.finding-card:hover,
.weight-row:hover,
.score-comp-row:hover,
.history-item:hover {
  border-color: rgba(59,130,246,0.3);
  box-shadow: 0 0 20px rgba(59,130,246,0.08), 0 4px 20px rgba(0,0,0,0.25);
}

/* Sidebar cards — subtle gradient */
#security-sidebar {
  background: linear-gradient(180deg, rgba(15,20,40,0.98), rgba(10,14,26,0.95)) !important;
}

/* Header glass enhancement */
header[style*="backdrop-filter"] {
  background: linear-gradient(180deg, rgba(10,14,26,0.95), rgba(10,14,26,0.85)) !important;
}

/* Ensure WCAG AA contrast — text-secondary on bg-card */
.text-slate-400, .text-slate-500 {
  color: #94a3b8 !important; /* #94a3b8 on #0a0e1a = ~7.5:1 contrast ratio */
}

/* Large score numerals — tabular-nums keeps digits aligned */
#score-gauge-text {
  font-size: 52px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  font-family: 'Courier New', 'Consolas', 'SF Mono', monospace;
}

/* Score display in stat contexts (dashboard, overview) */
.stat-value,
[class*="score"] {
  font-variant-numeric: tabular-nums;
}

/* Feature chips on landing page */
.feature-chip {
  background: var(--bg-card);
  border: 1px solid var(--border);
  transition: box-shadow 0.15s, transform 0.15s;
}
.feature-chip:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.2);
  transform: translateY(-1px);
}

/* Landing page feature badges (#67) */
.landing-feature-badges {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 0.75rem;
  margin: 1.5rem 0 2rem;
}
.landing-feature-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  background: rgba(59,130,246,0.08);
  border: 1px solid rgba(59,130,246,0.2);
  border-radius: 999px;
  padding: 0.4rem 1rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--accent-light);
  white-space: nowrap;
  transition: background 0.15s, border-color 0.15s;
}
.landing-feature-badge:hover {
  background: rgba(59,130,246,0.15);
  border-color: rgba(59,130,246,0.4);
}

/* CTA button glow (#67) */
.btn-primary.cta-glow {
  position: relative;
  box-shadow: 0 0 24px rgba(59,130,246,0.4), 0 4px 16px rgba(59,130,246,0.2);
  animation: cta-pulse 3s ease-in-out infinite;
}
@keyframes cta-pulse {
  0%, 100% { box-shadow: 0 0 24px rgba(59,130,246,0.4), 0 4px 16px rgba(59,130,246,0.2); }
  50% { box-shadow: 0 0 40px rgba(59,130,246,0.6), 0 6px 24px rgba(59,130,246,0.35); }
}

/* Trust row (#569): real signals + sample grade badge, Fort Knox tone — no gimmicks */
.trust-row {
  display: flex;
  align-items: center;
  gap: 1.25rem;
  max-width: 34rem;
  margin: 0 auto 1.75rem;
  padding: 1rem 1.25rem;
  background: var(--fk-color-semantic-bg-card, #111827);
  border: 1px solid var(--fk-color-semantic-border-default, #1e293b);
  border-radius: var(--fk-radius-lg, 16px);
  text-align: left;
}
.trust-grade-badge {
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 4.25rem;
  height: 4.25rem;
  border-radius: 999px;
  background: rgba(59,130,246,0.08);
  border: 2px solid var(--fk-color-semantic-accent, #3b82f6);
}
.trust-grade-letter {
  font-weight: 700;
  font-size: 1.5rem;
  color: var(--fk-color-semantic-text-primary, #f1f5f9);
  line-height: 1;
}
.trust-grade-caption {
  font-size: 0.55rem;
  color: var(--fk-color-semantic-text-muted, #475569);
  text-transform: uppercase;
  letter-spacing: 0.04em;
  margin-top: 0.15rem;
}
.trust-signal-list {
  list-style: none;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  color: var(--fk-color-semantic-text-secondary, #94a3b8);
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}
.trust-signal-list li {
  position: relative;
  padding-left: 1.1rem;
}
.trust-signal-list li::before {
  content: "✓";
  position: absolute;
  left: 0;
  color: var(--fk-color-semantic-severity-good, #22c55e);
  font-weight: 700;
}
@media (max-width: 480px) {
  .trust-row {
    flex-direction: column;
    text-align: center;
  }
  .trust-signal-list li { padding-left: 0; }
  .trust-signal-list li::before { content: ""; }
}

/* Landing page features row ("Trusted by" style) */
.landing-features-row {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 1.5rem;
  margin-top: 2.5rem;
}
.landing-feature-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--text-secondary);
  padding: 0.5rem 1rem;
  background: rgba(15,20,40,0.6);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
}
.landing-feature-item .lf-icon {
  font-size: 1.2rem;
}

/* Hero background gradient + animated particles (#67) */
body.state-landing #landing-state {
  position: relative;
  overflow: hidden;
}
body.state-landing #landing-state::before {
  content: '';
  position: absolute;
  inset: -80px -40px -40px;
  background:
    radial-gradient(ellipse 600px 300px at 50% 0%, rgba(59,130,246,0.08), transparent),
    radial-gradient(ellipse 300px 400px at 20% 80%, rgba(99,102,241,0.05), transparent),
    radial-gradient(ellipse 300px 400px at 80% 80%, rgba(34,197,94,0.04), transparent);
  pointer-events: none;
  z-index: -1;
  animation: hero-bg-shift 8s ease-in-out infinite alternate;
}
body.state-landing #landing-state::after {
  content: '';
  position: absolute;
  inset: -80px -40px -40px;
  background: radial-gradient(ellipse 600px 300px at 50% 0%, rgba(59,130,246,0.08), transparent);
  pointer-events: none;
  z-index: -1;
}
@keyframes hero-bg-shift {
  0% { opacity: 0.7; }
  100% { opacity: 1; }
}

/* Responsive chip grid — Tailwind classes handle columns */

/* ---- Finding cards (#65) — full bordered cards with severity accent ---- */
.finding-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-left: 4px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1rem;
  margin-bottom: 0.75rem;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.15);
  transition: box-shadow 0.15s, border-color 0.15s;
}
.finding-card:hover {
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.25);
  border-color: var(--text-muted);
}
.finding-card-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.375rem;
}
.finding-severity-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.03em;
  color: var(--text-secondary);
  background: rgba(148,163,184,0.1);
  border-radius: 999px;
  padding: 0.15rem 0.6rem;
}
/* Severity-colored left accent + subtle border tint */
.finding-critical {
  border-left: 4px solid #7f1d1d;
  border-color: rgba(127,29,29,0.3);
}
.finding-high {
  border-left: 4px solid #ef4444;
  border-color: rgba(239,68,68,0.25);
}
.finding-medium {
  border-left: 4px solid #f59e0b;
  border-color: rgba(245,158,11,0.25);
}
.finding-low {
  border-left: 4px solid #22c55e;
  border-color: rgba(34,197,94,0.25);
}

/* Collapsible remediation */
.finding-remediation-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.8rem;
  font-weight: 500;
  color: var(--blue-600);
  cursor: pointer;
  user-select: none;
  margin-top: 0.5rem;
  background: none;
  border: none;
  padding: 0.125rem 0;
}
.finding-remediation-toggle:hover {
  color: var(--blue-800);
  text-decoration: underline;
}
.finding-remediation-body {
  display: none;
  margin-top: 0.5rem;
  padding: 0.625rem 0.75rem;
  background: rgba(148,163,184,0.06);
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  color: var(--text-secondary);
  border: 1px solid var(--border);
}
.finding-remediation-body.open {
  display: block;
}

/* ---- Cert-badge grade chips (#64) ---- */
.cert-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.375rem 0.875rem;
  font-size: 0.875rem;
  margin: 0.25rem;
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
  transition: box-shadow 0.15s, transform 0.15s;
}
.cert-badge:hover {
  box-shadow: 0 4px 16px rgba(0,0,0,0.25);
  transform: translateY(-1px);
}

/* Grade chip — rounded pill badge (#64) */
.grade-chip {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 2.5rem;
  padding: 0.2rem 0.65rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 700;
  letter-spacing: 0.02em;
  line-height: 1.5;
  text-align: center;
}
.grade-chip.grade-A-plus,
.grade-chip.grade-A {
  background: rgba(34,197,94,0.15);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.3);
}
.grade-chip.grade-B {
  background: rgba(59,130,246,0.15);
  color: #60a5fa;
  border: 1px solid rgba(59,130,246,0.3);
}
.grade-chip.grade-C {
  background: rgba(245,158,11,0.15);
  color: #fbbf24;
  border: 1px solid rgba(245,158,11,0.3);
}
.grade-chip.grade-D,
.grade-chip.grade-F {
  background: rgba(239,68,68,0.15);
  color: #f87171;
  border: 1px solid rgba(239,68,68,0.3);
}
.grade-chip.grade-na {
  background: rgba(100,116,139,0.15);
  color: #94a3b8;
  border: 1px solid rgba(100,116,139,0.3);
}
.cert-badge-name {
  color: var(--text);
}
.cert-badge-impact {
  color: var(--text-muted);
  font-size: 0.75rem;
  font-weight: 500;
  margin-left: 0.25rem;
}

.tech-chip {
  display: inline-block;
  background: rgba(148,163,184,0.08);
  border: 1px solid var(--border);
  border-radius: 999px;
  padding: 0.25rem 0.75rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
}
.tech-chip-category {
  color: var(--text-muted);
  font-size: 0.75rem;
}

/* Weight impact display — scored category breakdown bars */
.weight-panel {
  margin-bottom: 0.5rem;
}
.weight-row {
  margin-bottom: 1rem;
}
.weight-row-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.25rem;
}
.weight-bar-container {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.weight-bar-bg {
  flex: 1;
  height: 1rem;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.weight-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.5s ease-out;
}
.weight-row-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.125rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* ── Score Composition tab ── */
.score-composition-panel {
  max-width: 720px;
}
.score-comp-row {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-bottom: 0.75rem;
}
.score-comp-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.375rem;
}
.score-comp-bar-wrap {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}
.score-comp-bar-bg {
  flex: 1;
  height: 0.875rem;
  background: var(--border);
  border-radius: 999px;
  overflow: hidden;
}
.score-comp-bar-fill {
  height: 100%;
  border-radius: 999px;
  transition: width 0.6s ease-out;
}
.score-comp-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 0.25rem;
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Share button */
.share-btn {
  cursor: pointer;
}
.share-btn.copied {
  background: var(--green);
  color: white;
  border-color: var(--green);
}
.share-toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  background: var(--bg-card);
  color: var(--text);
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
  z-index: 50;
  animation: toast-in 0.3s ease-out;
}
@keyframes toast-in {
  from {
    opacity: 0;
    transform: translateY(0.5rem);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* Scan history list */
.history-panel {
  margin-bottom: 1rem;
}
.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin-bottom: 0.375rem;
  cursor: pointer;
  transition: background 0.15s;
  background: var(--bg-card);
}
.history-item:hover {
  background: var(--bg-card-hover);
}

/* ── Scan progress bar ── */
.scan-progress-container {
  height: 6px;
  background: var(--border);
  border-radius: 6px;
  overflow: hidden;
}

.scan-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent), var(--accent-light));
  border-radius: 6px;
  transition: width 0.3s ease-out;
  position: relative;
}

.scan-progress-bar::after {
  content: '';
  position: absolute;
  top: 0; right: 0; bottom: 0;
  width: 40px;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  animation: scanShimmer 1.5s ease-in-out infinite;
}

@keyframes scanShimmer {
  0%, 100% { opacity: 0.3; }
  50% { opacity: 0.8; }
}

/* ── Check list ── */
.scan-check-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.75rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  color: var(--slate-400);
  transition: color 0.3s, background 0.3s;
}

.scan-check-item.scan-check-active {
  color: var(--blue-600);
  background: rgba(37, 99, 235, 0.05);
}

.scan-check-item.scan-check-done {
  color: #16a34a;
}

.scan-check-icon {
  width: 18px;
  text-align: center;
  font-size: 0.875rem;
  flex-shrink: 0;
}

.scan-check-active .scan-check-icon {
  animation: checkPulse 0.8s ease-in-out infinite;
}

@keyframes checkPulse {
  0%, 100% { opacity: 0.4; }
  50% { opacity: 1; }
}

.scan-check-done .scan-check-icon {
  animation: none;
  opacity: 1;
}

/* ── Sidebar layout ── */
#security-sidebar { min-width: 260px; }
.sidebar-card {
  display: flex;
  cursor: pointer;
  color: inherit;
  text-decoration: none;
}
.sidebar-card:hover {
  background: rgba(59,130,246,0.08) !important;
}

/* Sidebar accordion groups */
.sidebar-group-header {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  color: inherit;
}
.sidebar-group-body {
  overflow: hidden;
  transition: max-height 0.3s ease, opacity 0.2s ease;
  max-height: 600px;
  opacity: 1;
}
.sidebar-group-collapsed .sidebar-group-body {
  max-height: 0;
  opacity: 0;
}
.sidebar-group-collapsed .sidebar-group-chevron {
  transform: rotate(-90deg);
}

/* Google Sign-In sidebar section */
#g_id_signin { margin-top: 2px; }
.gsi-btn {
  font-family: 'Google Sans', Roboto, Arial, sans-serif;
  cursor: pointer;
}
.gsi-btn:hover { box-shadow: 0 1px 3px rgba(0,0,0,0.15); }

/* ── Auth user card & GS tease ── */
.auth-user-card {
  padding: 8px 10px;
  background: rgba(17,24,39,0.5);
  border: 1px solid rgba(148,163,184,0.06);
  border-radius: 10px;
}
.gs-tease { }
.gs-feature-card {
  padding: 4px 6px;
  border-radius: 6px;
  background: rgba(148,163,184,0.02);
  border: 1px solid rgba(148,163,184,0.03);
  transition: background 0.15s, border-color 0.15s;
}
.gs-feature-card:hover {
  background: rgba(148,163,184,0.05);
  border-color: rgba(148,163,184,0.08);
}
.gs-upgrade-btn {
  display: block;
  text-align: center;
  padding: 4px 0;
  font-size: 10px;
  font-weight: 600;
  color: #fbbf24;
  text-decoration: none;
  border-radius: 6px;
  background: rgba(251,191,36,0.08);
  border: 1px solid rgba(251,191,36,0.15);
  transition: all 0.15s;
}
.gs-upgrade-btn:hover {
  background: rgba(251,191,36,0.15);
  color: #fcd34d;
}

/* ── Sidebar hover popover ── */
/* Premium slide-in card appearing to the right of the sidebar on hover.
   Inspired by Apple HIG tooltips, Linear hover cards, Notion previews. */
.sidebar-popover {
  position: fixed;
  z-index: 100;
  width: 320px;
  max-width: calc(100vw - 300px);
  max-height: 80vh;
  overflow-y: auto;
  pointer-events: none;
  opacity: 0;
  transform: translateX(-12px) scale(0.96);
  transition: opacity 0.25s cubic-bezier(0.16,1,0.3,1),
              transform 0.3s cubic-bezier(0.16,1,0.3,1);
  background: rgba(17,24,39,0.92);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid rgba(148,163,184,0.12);
  border-radius: 14px;
  box-shadow: 0 20px 60px rgba(0,0,0,0.5), 0 0 1px rgba(59,130,246,0.15);
  scrollbar-width: thin;
  scrollbar-color: rgba(148,163,184,0.2) transparent;
}
.sidebar-popover::-webkit-scrollbar { width: 4px; }
.sidebar-popover::-webkit-scrollbar-track { background: transparent; }
.sidebar-popover::-webkit-scrollbar-thumb {
  background: rgba(148,163,184,0.2);
  border-radius: 99px;
}
.sidebar-popover.active {
  opacity: 1;
  transform: translateX(0) scale(1);
  pointer-events: auto;
}
.sidebar-popover-inner { padding: 18px 20px; }

.popover-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 14px;
}
.popover-icon { font-size: 24px; }
.popover-name {
  font-size: 15px;
  font-weight: 700;
  color: #f1f5f9;
  letter-spacing: -0.2px;
}
.popover-section {
  margin-bottom: 12px;
  padding: 12px 14px;
  border-radius: 10px;
  border: 1px solid rgba(148,163,184,0.08);
}
.popover-risk {
  background: rgba(239,68,68,0.07);
  border-color: rgba(239,68,68,0.15);
}
.popover-breach {
  background: rgba(245,158,11,0.07);
  border-color: rgba(245,158,11,0.15);
}
.popover-section-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 6px;
  color: rgba(148,163,184,0.9);
}
.popover-risk .popover-section-label { color: rgba(252,165,165,0.85); }
.popover-breach .popover-section-label { color: rgba(252,211,77,0.85); }
.popover-section-text {
  font-size: 12px;
  line-height: 1.6;
  color: rgba(203,213,225,0.85);
}
.popover-footer {
  margin-top: 14px;
  padding-top: 10px;
  border-top: 1px solid rgba(148,163,184,0.08);
}
.popover-cta {
  font-size: 12px;
  font-weight: 500;
  color: #60a5fa;
  text-decoration: none;
  transition: color 0.15s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.popover-cta:hover { color: #93c5fd; }

/* ── Speed-test gauge ── */
#speed-gauge-arc { transition: stroke-dashoffset 0.3s ease-out; }

/* ── Info modal ── */
#info-modal-content h2 { margin-top: 0; color: var(--text); }
#info-modal-content .bg-red-50 { border-radius: 0.75rem; }
#info-modal-content p { color: var(--text-secondary); }

/* ── Mobile chips ── */
#mobile-chips { -webkit-overflow-scrolling: touch; scrollbar-width: none; }
#mobile-chips::-webkit-scrollbar { display: none; }

/* Remove old check-list styles (replaced by speed gauge) */
.scan-check-item, .scan-progress-container, .scan-progress-bar,
.scan-check-active, .scan-check-done, .scan-check-icon,
@keyframes scanShimmer, @keyframes checkPulse { /* overridden */ }

/* ── FinOps: cache-friendly static assets ── */
/* Static assets served with Cache-Control: public, max-age=3600
   by express.static in server/src/index.js */

/* Persistent Guardian Shield header */
#site-header {
  position: sticky;
  top: 0;
  z-index: 40;
  backdrop-filter: blur(12px);
  background: linear-gradient(180deg, rgba(10,14,26,0.98), rgba(10,14,26,0.9));
  border-bottom: 1px solid rgba(51,65,85,0.3);
}
#site-header .header-brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: #e2e8f0;
}

/* ── Password Strength Meter ── */
.pw-strength-bar {
  display: flex;
  gap: 4px;
  margin: 0.5rem 0;
}
.pw-strength-segment {
  flex: 1;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  transition: background 0.2s;
}
.pw-strength-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}
.pw-checks {
  list-style: none;
  padding: 0;
  margin: 0.375rem 0 0.75rem;
}
.pw-checks li {
  font-size: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.125rem 0;
}

/* ── Auth Modal ── */
#auth-modal input::placeholder {
  color: #64748b;
}
#auth-modal input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25);
}

/* ── Account Page ── */
.account-section {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}
.account-section h2 {
  font-family: Georgia, 'Times New Roman', serif;
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 1rem;
  color: var(--text);
}
.session-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 0;
  border-bottom: 1px solid var(--border);
}
.session-row:last-child {
  border-bottom: none;
}
.session-info {
  flex: 1;
  min-width: 0;
}
.session-device {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.session-meta {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.125rem;
}
.session-current-badge {
  display: inline-block;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: 999px;
  background: rgba(34,197,94,0.12);
  color: #22c55e;
  border: 1px solid rgba(34,197,94,0.25);
  margin-left: 0.5rem;
}
.btn-revoke {
  font-size: 0.75rem;
  padding: 0.375rem 0.75rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
  cursor: pointer;
  transition: all 0.15s;
  white-space: nowrap;
}
.btn-revoke:hover {
  background: rgba(239,68,68,0.1);
  border-color: rgba(239,68,68,0.3);
  color: #ef4444;
}
.btn-danger {
  font-size: 0.8rem;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  background: transparent;
  color: #ef4444;
  border: 1px solid rgba(239,68,68,0.3);
  cursor: pointer;
  transition: all 0.15s;
}
.btn-danger:hover {
  background: rgba(239,68,68,0.1);
  border-color: #ef4444;
}
.password-input-group {
  margin-bottom: 1rem;
}
.password-input-group label {
  display: block;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.375rem;
}
.password-input-group input {
  width: 100%;
  padding: 0.625rem 0.875rem;
  background: var(--bg-input);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  color: var(--text);
  font-size: 0.9rem;
  transition: border-color 0.15s;
}
.password-input-group input:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 2px var(--accent-glow);
}
.pw-match-error {
  font-size: 0.75rem;
  color: #ef4444;
  margin-top: 0.25rem;
  display: none;
}
.empty-state {
  text-align: center;
  padding: 2rem;
  color: var(--text-muted);
  font-size: 0.875rem;
}
.toast {
  position: fixed;
  bottom: 1.5rem;
  right: 1.5rem;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 500;
  z-index: 100;
  animation: toast-in 0.3s ease-out;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}
.toast-success { background: rgba(34,197,94,0.9); color: #000; }
.toast-error { background: rgba(239,68,68,0.9); color: #fff; }
.toast-info { background: rgba(59,130,246,0.9); color: #fff; }

/* ═══════════════════════════════════════════════════════════════════
   Responsive — Mobile / Tablet / Desktop (capital-underwriting pattern)
   ═══════════════════════════════════════════════════════════════════
   Single codebase adapts to viewport. No separate mobile.css override
   needed — media queries handle breakpoints. Pattern: mobile-first
   with min-width breakpoints for larger screens.
   ═══════════════════════════════════════════════════════════════════ */

/* Mobile view toggle — hidden by default; shown only under the
   max-width:767px query below (small viewports get a link to the
   dedicated mobile scan surface, public/mobile.html). #570 parity. */
.mobile-toggle { display: none; }

/* ── Tablet (≥768px) ───────────────────────────────────────────── */
@media (min-width: 768px) {
  .container, main, .max-w-4xl {
    max-width: 720px;
    margin-left: auto;
    margin-right: auto;
  }
  .grid-2 { grid-template-columns: repeat(2, 1fr); }
  .grid-3 { grid-template-columns: repeat(2, 1fr); }
}

/* ── Desktop (≥1024px) ──────────────────────────────────────────── */
@media (min-width: 1024px) {
  .container, main, .max-w-4xl {
    max-width: 960px;
  }
  .grid-3 { grid-template-columns: repeat(3, 1fr); }
  .grid-4 { grid-template-columns: repeat(4, 1fr); }
}

/* ── Wide (≥1280px) ─────────────────────────────────────────────── */
@media (min-width: 1280px) {
  .container, main, .max-w-4xl {
    max-width: 1120px;
  }
}

/* ── Mobile-first defaults (all screens <768px) ────────────────── */
@media (max-width: 767px) {
  /* Touch-friendly tap targets — minimum 44px (WCAG 2.5.5) */
  button, .btn, a.btn, [role="button"], input[type="submit"] {
    min-height: 44px;
    min-width: 44px;
    padding: 0.625rem 1rem;
  }

  /* Form inputs — full width, comfortable spacing */
  input[type="text"],
  input[type="email"],
  input[type="url"],
  input[type="password"],
  input[type="search"],
  textarea,
  select {
    width: 100%;
    font-size: 16px; /* prevents iOS zoom on focus */
    padding: 0.75rem;
  }

  /* Stack cards vertically */
  .grid-2, .grid-3, .grid-4 {
    grid-template-columns: 1fr;
    gap: 0.75rem;
  }

  /* Reduce padding on small screens */
  body { padding: 0 0.75rem; }

  /* Full-width containers */
  .card, .result-card, .scanner-card, .finding-card {
    margin-left: -0.75rem;
    margin-right: -0.75rem;
    border-radius: 0;
    width: calc(100% + 1.5rem);
  }

  /* Adjust typography for mobile */
  h1 { font-size: 1.5rem; }
  h2 { font-size: 1.25rem; }
  h3 { font-size: 1.1rem; }
  .score-value { font-size: 2.5rem; }
  .grade-display { font-size: 1.5rem; }

  /* Toast — bottom center, full width */
  .toast {
    left: 0.75rem;
    right: 0.75rem;
    bottom: calc(1rem + env(safe-area-inset-bottom, 0px));
    text-align: center;
  }

  /* Hide decorative elements on small screens */
  .desktop-only { display: none !important; }

  /* Mobile view toggle link */
  .mobile-toggle {
    display: block;
    text-align: center;
    padding: 0.5rem;
    font-size: 0.75rem;
    color: var(--text-muted);
    text-decoration: none;
  }
  .mobile-toggle:hover { color: var(--accent); }
}

/* ── Desktop-only elements ──────────────────────────────────────── */
@media (min-width: 768px) {
  .mobile-only { display: none !important; }
}

/* ── Safe area insets (notched phones) ──────────────────────────── */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
  body {
    padding-bottom: env(safe-area-inset-bottom);
    padding-top: env(safe-area-inset-top);
  }
}

/* ── Reduced motion preference ──────────────────────────────────── */
@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after {
    animation-duration: 0.01ms !important;
    animation-iteration-count: 1 !important;
    transition-duration: 0.01ms !important;
  }
}

/* ── Dark mode (default) + light mode support ───────────────────── */
@media (prefers-color-scheme: light) {
  /* Light theme overrides — opt-in via system preference */
  /* Not enforcing; default is dark theme for security context */
}
