:root {
  --bg: #f5f5f7;
  --surface: rgba(255, 255, 255, 0.72);
  --surface-solid: #ffffff;
  --surface-2: rgba(255, 255, 255, 0.5);
  --ink: #1d1d1f;
  --muted: #6e6e73;
  --line: rgba(0, 0, 0, 0.08);
  --glass-border: rgba(255, 255, 255, 0.6);
  --accent: #1d1d1f;
  --accent-hover: #333336;
  --accent-soft: rgba(0, 0, 0, 0.04);
  --accent-line: rgba(0, 0, 0, 0.1);
  --good: #34c759;
  --warn: #ff9f0a;
  --bad: #ff3b30;
  --radius: 14px;
  --shadow: 0 2px 16px rgba(0, 0, 0, 0.06);
  --glass-shadow: 0 8px 32px rgba(0, 0, 0, 0.08);
  --font: "Inter", -apple-system, BlinkMacSystemFont, "SF Pro Text", "Segoe UI", system-ui, sans-serif;
  --max: 1080px;
  --blur: blur(20px) saturate(180%);
}

*, *::before, *::after { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body.saas-body {
  margin: 0;
  font-family: var(--font);
  color: var(--ink);
  background: var(--bg);
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}
.container { width: min(calc(100% - 2.5rem), var(--max)); margin-inline: auto; }
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }

/* Header */
.saas-header {
  position: sticky; top: 0; z-index: 100;
  background: rgba(245, 245, 247, 0.72);
  backdrop-filter: var(--blur);
  border-bottom: 1px solid var(--line);
}
.header-row {
  display: flex; align-items: center; justify-content: space-between;
  gap: 1rem; padding: 1rem 0;
}
.logo img { display: block; height: 32px; width: auto; }
.nav { display: flex; gap: 1.25rem; align-items: center; }
.nav a {
  color: var(--muted); font-weight: 500; font-size: .875rem;
  text-decoration: none; letter-spacing: -.01em;
}
.nav a:hover { color: var(--ink); }
.nav-auth-mobile { display: none; }
.nav-toggle {
  display: none; background: none; border: none; cursor: pointer;
  padding: .35rem; margin-left: auto; margin-right: .25rem;
}
.nav-toggle-bar {
  display: block; width: 20px; height: 2px; background: var(--ink);
  margin: 5px 0; border-radius: 1px; transition: .2s;
}
.auth-actions { display: flex; gap: .5rem; align-items: center; }
.guest-actions, .logged-in-actions { display: flex; gap: .5rem; align-items: center; }
.guest-actions[hidden], .logged-in-actions[hidden] { display: none !important; }
.user-pill {
  font-size: .78rem; background: var(--surface-solid); color: var(--ink);
  padding: .4rem .75rem; border-radius: 8px; font-weight: 600;
  border: 1px solid var(--line);
}
.user-pill-mobile {
  font-size: .78rem; font-weight: 600; color: var(--muted);
  padding: .35rem 0;
}
.usage-dropdown-inline {
  display: flex; flex-direction: column; gap: .2rem;
  min-width: 100px; padding: 0 .25rem;
}
.usage-dropdown-inline .usage-dropdown-text { font-size: .68rem; color: var(--muted); font-weight: 600; }
.paywall-actions { display: flex; flex-direction: column; gap: .5rem; margin-bottom: .5rem; }
.paywall-actions[hidden] { display: none !important; }
.modal-paywall { width: min(100%, 420px); }

.usage-tracker {
  display: flex; align-items: center; gap: .5rem;
  background: var(--surface);
  backdrop-filter: var(--blur);
  border: 1px solid var(--line);
  border-radius: 999px;
  padding: .3rem .65rem .3rem .5rem;
  font-size: .72rem; font-weight: 600; color: var(--muted);
}
.usage-tracker-bar {
  width: 48px; height: 4px; background: rgba(0,0,0,.08);
  border-radius: 99px; overflow: hidden;
}
.usage-tracker-bar span, .usage-dropdown-bar span {
  display: block; height: 100%; background: linear-gradient(90deg, #0071e3, #34c759);
  border-radius: 99px; transition: width .4s ease;
}
.usage-dropdown {
  padding: .65rem .75rem; border-bottom: 1px solid var(--line);
  margin-bottom: .25rem;
}
.usage-dropdown-label { font-size: .68rem; text-transform: uppercase; letter-spacing: .06em; color: var(--muted); margin: 0 0 .4rem; }
.usage-dropdown-bar { height: 5px; background: rgba(0,0,0,.08); border-radius: 99px; overflow: hidden; margin-bottom: .35rem; }
.usage-dropdown-text { font-size: .78rem; color: var(--ink); margin: 0; font-weight: 600; }
.usage-tracker.at-limit .usage-tracker-bar span { background: var(--bad); }

/* Buttons */
.btn {
  display: inline-flex; align-items: center; justify-content: center; gap: .4rem;
  border-radius: 8px; font-weight: 600; font-family: var(--font);
  border: none; cursor: pointer; text-decoration: none; transition: .15s;
  font-size: .875rem; letter-spacing: -.01em;
}
.btn-primary { background: #0071e3; color: #fff; padding: .7rem 1.15rem; }
.btn-primary:hover { background: #0077ed; color: #fff; }
.btn-primary:disabled { opacity: .5; cursor: not-allowed; }
.btn-ghost {
  background: var(--surface); color: var(--ink);
  padding: .55rem .95rem; border: 1px solid var(--line);
}
.btn-ghost:hover { background: var(--surface-2); }
.btn-sm { padding: .45rem .8rem; font-size: .8125rem; }

/* Hero */
.hero {
  padding: 5rem 0 3rem;
  border-bottom: 1px solid var(--line);
}
.hero-grid {
  display: grid; grid-template-columns: 1.1fr .9fr; gap: 4rem; align-items: center;
}
.hero h1 {
  font-family: var(--font);
  font-size: clamp(2.25rem, 4vw, 3.25rem);
  font-weight: 700;
  line-height: 1.12; margin: .75rem 0 1.25rem;
  letter-spacing: -.02em;
}
.hero-lead { color: var(--muted); font-size: 1.05rem; max-width: 34rem; line-height: 1.65; }
.eyebrow {
  text-transform: uppercase; letter-spacing: .12em;
  font-size: .68rem; font-weight: 700; color: var(--muted);
}

/* Audit form */
.audit-form { margin-top: 2rem; }
.audit-input-row {
  display: flex; gap: .5rem; flex-wrap: wrap;
  background: var(--surface);
  backdrop-filter: var(--blur);
  border: 1px solid var(--glass-border);
  border-radius: 16px;
  padding: .4rem;
  box-shadow: var(--shadow);
}
.audit-input-row:focus-within { border-color: rgba(0,113,227,.35); box-shadow: 0 0 0 4px rgba(0,113,227,.1); }
.audit-input-row input {
  flex: 1; min-width: 200px; border: none; outline: none;
  padding: .85rem 1rem; font-size: .95rem; background: transparent;
  font-family: var(--font);
}
.audit-hint { font-size: .8rem; color: var(--muted); margin: .6rem 0 0; }

/* Progress */
.audit-progress { margin-top: 1.5rem; }

/* Results */
.audit-results { margin-top: 1.5rem; }
.audit-results.lab-enter { animation: labFadeIn .5s ease; }
body.audit-active .container { width: min(calc(100% - 2rem), 1200px); }
body.audit-active .hero-visual { display: none; }
body.audit-active .hero-grid { grid-template-columns: 1fr; }
body.audit-active .hero { padding-bottom: 1.5rem; }

.mock-lab-preview { padding: .5rem 0; }
.hero-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.25rem; box-shadow: var(--shadow);
}
.hero-card-head {
  display: flex; align-items: center; gap: .5rem;
  font-size: .75rem; font-weight: 700; text-transform: uppercase;
  letter-spacing: .08em; color: var(--muted); margin-bottom: 1rem;
}
.hero-card-note { color: var(--muted); font-size: .85rem; margin: .75rem 0 0; }
.mock-heat { display: grid; grid-template-columns: repeat(4, 1fr); gap: .5rem; }
.mock-cell {
  border-radius: 8px; padding: .75rem .5rem; text-align: center;
  font-weight: 700; font-size: 1.15rem; border: 1px solid var(--line);
  background: var(--surface-2);
}
.mock-cell.good { border-color: #bbf7d0; background: #f0fdf4; color: #15803d; }
.mock-cell.warn { border-color: #fef08a; background: #fefce8; color: #a16207; }
.mock-cell.bad { border-color: #fecaca; background: #fef2f2; color: #b91c1c; }
.mock-cell span { display: block; font-size: .6rem; font-weight: 600; text-transform: uppercase; color: inherit; opacity: .7; margin-top: .2rem; letter-spacing: .06em; }

.section { padding: 5rem 0; }
.section h2 {
  font-family: var(--font); font-weight: 700;
  font-size: clamp(1.75rem, 3vw, 2.25rem);
  letter-spacing: -.02em; margin-bottom: 2rem;
}
.feature-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1px; background: var(--line); border: 1px solid var(--line); border-radius: var(--radius); overflow: hidden; }
.feature-card {
  background: var(--surface); padding: 1.5rem;
}
.feature-card h3 {
  font-size: .9rem; font-weight: 700; margin: 0 0 .5rem;
  text-transform: uppercase; letter-spacing: .06em;
}
.feature-card p { margin: 0; font-size: .88rem; color: var(--muted); line-height: 1.55; }

.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; }
.price-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 1.75rem;
}
.price-card.featured { border-color: var(--ink); }

.saas-footer {
  border-top: 1px solid var(--line); padding: 3rem 0 2rem;
  margin-top: 4rem; background: var(--surface);
}
.footer-grid { display: grid; grid-template-columns: 1.4fr 1fr 1fr 1fr; gap: 2rem; }
.footer-grid ul { list-style: none; padding: 0; margin: 0; }
.footer-grid a { color: var(--muted); text-decoration: none; font-size: .875rem; }

/* Modal */
.modal-overlay {
  position: fixed; inset: 0; background: rgba(9, 9, 11, 0.55);
  display: flex; align-items: center; justify-content: center;
  z-index: 200; padding: 1rem;
  backdrop-filter: blur(4px);
}
.modal-overlay[hidden] { display: none; }
.modal {
  background: var(--surface); border-radius: 14px;
  padding: 2rem; width: min(100%, 400px);
  border: 1px solid var(--line);
  position: relative;
  box-shadow: 0 24px 48px rgba(0,0,0,.12);
}
.modal-close {
  position: absolute; top: .75rem; right: .75rem;
  background: none; border: none; font-size: 1.5rem; line-height: 1;
  color: var(--muted); cursor: pointer; padding: .25rem .5rem;
}
.modal-close:hover { color: var(--ink); }
.modal-brand {
  display: flex; align-items: center; gap: .5rem;
  font-weight: 700; font-size: .9rem; margin-bottom: 1rem;
}
.modal h2 { margin: 0 0 .35rem; font-family: var(--font); font-weight: 700; font-size: 1.35rem; }
.modal-sub { color: var(--muted); font-size: .9rem; margin: 0 0 1.25rem; }
.modal-form { display: flex; flex-direction: column; gap: .5rem; }
.field-label { font-size: .75rem; font-weight: 600; color: var(--muted); margin-top: .25rem; }
.modal input {
  width: 100%; padding: .7rem .85rem;
  border: 1px solid var(--line); border-radius: 8px; font-size: .95rem;
  font-family: var(--font); transition: border-color .15s;
}
.modal input:focus { outline: none; border-color: var(--ink); box-shadow: 0 0 0 3px rgba(9,9,11,.06); }
.modal-foot { margin-top: 1rem; text-align: center; font-size: .85rem; }
.modal-foot.muted { color: var(--muted); font-size: .78rem; margin-top: .75rem; }
.modal-error { color: var(--bad); font-size: .85rem; margin: 0 0 .5rem; min-height: 1.2em; }
.link-btn { background: none; border: none; color: var(--ink); font-weight: 600; cursor: pointer; font-family: var(--font); text-decoration: underline; font-size: .85rem; }
.pro-perks { list-style: none; padding: 0; margin: 0 0 1.25rem; font-size: .88rem; color: var(--muted); }
.pro-perks li { padding: .35rem 0 .35rem 1.25rem; position: relative; }
.pro-perks li::before { content: "✓"; position: absolute; left: 0; color: var(--good); font-weight: 700; }

/* Toast */
.toast {
  position: fixed; bottom: 1.5rem; left: 50%; transform: translateX(-50%);
  background: var(--ink); color: #fff; padding: .75rem 1.25rem;
  border-radius: 8px; font-size: .875rem; font-weight: 500;
  z-index: 300; box-shadow: var(--shadow);
  animation: toastIn .3s ease;
}
.toast[hidden] { display: none; }
@keyframes toastIn { from { opacity: 0; transform: translateX(-50%) translateY(8px); } }

/* Page hero */
.page-hero { padding: 4rem 0 2rem; border-bottom: 1px solid var(--line); }
.page-hero h1 { font-family: var(--font); font-weight: 700; font-size: clamp(2rem, 4vw, 2.75rem); margin: .5rem 0; letter-spacing: -.02em; }
.page-lead { color: var(--muted); max-width: 32rem; font-size: 1.05rem; margin: 0; }

/* Pricing */
.pricing-section { padding-top: 2.5rem; }
.pricing-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 1rem; align-items: stretch; }
.price-card {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: 14px; padding: 1.75rem; display: flex; flex-direction: column;
  position: relative;
}
.price-card.featured { border-color: var(--ink); box-shadow: 0 8px 32px rgba(0,0,0,.06); }
.plan-badge {
  position: absolute; top: -10px; left: 1.5rem;
  background: var(--ink); color: #fff; font-size: .65rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: .08em; padding: .25rem .6rem; border-radius: 4px;
}
.plan-label { font-size: .75rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em; color: var(--muted); margin: 0 0 .5rem; }
.plan-price { font-size: 2.25rem; font-weight: 700; letter-spacing: -.03em; margin-bottom: .35rem; }
.plan-price span { font-size: 1rem; font-weight: 500; color: var(--muted); }
.plan-desc { color: var(--muted); font-size: .9rem; margin: 0 0 1.25rem; }
.plan-features { list-style: none; padding: 0; margin: 0 0 1.5rem; flex: 1; font-size: .88rem; color: var(--muted); }
.plan-features li { padding: .4rem 0; border-bottom: 1px solid var(--line); }
.plan-features li:last-child { border-bottom: none; }
.plan-cta { width: 100%; margin-top: auto; }
.plan-note { font-size: .75rem; color: var(--muted); text-align: center; margin: .6rem 0 0; }
.stripe-badge {
  display: inline-flex; align-items: center; gap: .35rem;
  font-size: .72rem; color: var(--muted); margin-top: .5rem;
}
.stripe-badge svg { opacity: .7; }

.footer-bottom { margin-top: 2rem; padding-top: 1.5rem; border-top: 1px solid var(--line); color: var(--muted); font-size: .82rem; }
.footer-address { margin: .35rem 0 0; font-size: .75rem; opacity: .8; }
.footer-legal { font-size: .78rem; margin-top: .5rem; }
.footer-grid h2 { font-size: .75rem; text-transform: uppercase; letter-spacing: .08em; color: var(--muted); margin: 0 0 .75rem; }
.footer-grid p { color: var(--muted); font-size: .88rem; max-width: 22rem; }

/* Prose / legal pages */
.prose-section { padding: 2rem 0 5rem; }
.prose-wrap { max-width: 42rem; }
.prose-wrap h2 { font-size: 1.25rem; font-weight: 700; margin: 2rem 0 .75rem; letter-spacing: -.02em; }
.prose-wrap p, .prose-wrap li { color: var(--muted); line-height: 1.65; font-size: .95rem; }
.prose-wrap a { color: #0071e3; }
.contact-card { padding: 2rem; }
.contact-email { font-size: 1.15rem; font-weight: 600; color: #0071e3; text-decoration: none; }
.contact-card .muted { font-size: .88rem; }

@media (max-width: 900px) {
  .pricing-grid { grid-template-columns: 1fr; }
  .price-card.featured { order: -1; }
}

/* Legacy report bits */
.report-header { display: grid; grid-template-columns: auto 1fr; gap: 1.5rem; }
.category-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: .75rem; }
.cat-card { background: var(--surface-2); border-radius: 8px; padding: .85rem; text-align: center; border: 1px solid var(--line); }
.fix-card {
  background: var(--surface); border: 1px solid var(--line);
  border-left: 3px solid var(--ink);
  border-radius: var(--radius); padding: 1.25rem; margin-bottom: 1rem;
}
.copy-block {
  position: relative; background: #18181b; color: #e4e4e7;
  border-radius: 8px; padding: 1rem; font-family: ui-monospace, monospace;
  font-size: .78rem; overflow-x: auto; margin-top: .75rem; white-space: pre-wrap;
}
.copy-btn {
  position: absolute; top: .5rem; right: .5rem;
  background: rgba(255,255,255,.1); color: #fff;
  border: none; border-radius: 6px; padding: .3rem .6rem;
  font-size: .72rem; cursor: pointer;
}

@media (max-width: 900px) {
  .hero-grid, .category-grid, .feature-grid, .pricing-grid, .footer-grid { grid-template-columns: 1fr; }
  .nav-toggle { display: block; }
  .guest-actions { display: none !important; }
  .logged-in-actions { display: none !important; }
  .usage-dropdown-inline { display: none !important; }
  .nav {
    display: none; position: absolute; top: 100%; left: 0; right: 0;
    flex-direction: column; align-items: stretch; gap: 0;
    background: var(--bg); border-bottom: 1px solid var(--line);
    padding: .75rem 1.25rem 1rem; box-shadow: var(--shadow);
  }
  .nav.is-open { display: flex; }
  .nav a { padding: .65rem 0; border-bottom: 1px solid var(--line); }
  .nav-auth-mobile {
    display: flex; gap: .5rem; padding-top: .75rem;
  }
  .saas-header .container { position: relative; }
  .header-row { flex-wrap: wrap; }
}
