/* Ensure [hidden] always wins — many components use display:flex/grid which
   would otherwise override the browser default `[hidden] { display: none }`. */
[hidden] { display: none !important; }

/* ---------- Base ---------- */
:root {
  --bg: #fafaf7;
  --surface: #ffffff;
  --ink: #0f1115;
  --ink-2: #3a3f4a;
  --muted: #6b7280;
  --line: #e7e5df;
  --brand: #1a7a4a;
  --brand-dark: #156138;
  --brand-ink: #ffffff;
  --accent: #c8e87d;
  --danger: #CE2B37;
  --danger-bg: #fdecee;
  --danger-border: #f3c2c7;
  --good: #166534;
  --good-bg: #ecf6ee;
  --warn: #a16207;
  --shadow: 0 1px 2px rgba(15,17,21,.04), 0 8px 24px rgba(15,17,21,.06);
  --radius: 14px;
}

* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; }
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  color: var(--ink);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  line-height: 1.55;
}
h1, h2, h3, h4 { letter-spacing: -0.02em; color: var(--ink); margin: 0; }
h1 { font-size: clamp(2.2rem, 5vw, 3.6rem); font-weight: 800; line-height: 1.05; }
h2 { font-size: clamp(1.6rem, 3vw, 2.1rem); font-weight: 700; }
h3 { font-size: 1.15rem; font-weight: 600; }
h4 { font-size: 0.95rem; font-weight: 600; }
p  { margin: 0; color: var(--ink-2); }
a  { color: inherit; text-decoration: none; }
.muted { color: var(--muted); font-size: 0.9rem; }
.container { max-width: 1120px; margin: 0 auto; padding: 0 24px; }

/* ---------- Buttons ---------- */
.btn {
  font: inherit;
  font-weight: 600;
  padding: 10px 18px;
  border-radius: 10px;
  border: 1px solid transparent;
  cursor: pointer;
  transition: transform .06s ease, background .15s ease, border-color .15s ease, color .15s ease;
  display: inline-flex; align-items: center; justify-content: center; gap: 8px;
}
.btn:active { transform: translateY(1px); }
.btn-primary { background: var(--brand); color: var(--brand-ink); }
.btn-primary:hover { background: var(--brand-dark); }
.btn-ghost { background: transparent; color: var(--ink); border-color: var(--line); }
.btn-ghost:hover { background: #f1efe9; }
.btn-ghost[disabled] { color: var(--muted); cursor: default; background: transparent; }
.btn-lg { padding: 14px 22px; font-size: 1rem; }
.btn-block { width: 100%; }

/* ---------- Nav ---------- */
.nav {
  position: sticky; top: 0; z-index: 10;
  background: rgba(250,250,247,.8);
  backdrop-filter: saturate(140%) blur(8px);
  border-bottom: 1px solid var(--line);
}
.nav-inner { display: flex; justify-content: space-between; align-items: center; padding: 14px 24px; }
.brand {
  display: inline-flex; align-items: center; gap: 10px;
  color: var(--ink);
  transition: transform .15s ease, opacity .15s ease;
}
.brand:hover { opacity: .9; }
.brand:active { transform: translateY(1px); }
.brand-mark {
  display: inline-grid; place-items: center;
  width: 34px; height: 34px;
  border-radius: 10px;
  background: linear-gradient(135deg, #22a05f 0%, #0f5a35 100%);
  box-shadow:
    0 1px 2px rgba(15,90,53,.25),
    0 4px 10px rgba(15,90,53,.18),
    inset 0 1px 0 rgba(255,255,255,.18);
}
.brand-mark svg { display: block; }
.brand-wordmark {
  display: inline-flex; align-items: baseline;
  font-size: 1.25rem; font-weight: 800; letter-spacing: -0.025em;
  line-height: 1;
}
.brand-vero { color: var(--brand); }
.brand-job { color: var(--ink); }
.nav-links { display: flex; align-items: center; gap: 22px; }
.nav-links a { color: var(--ink-2); font-size: 0.95rem; }
.nav-links a:hover { color: var(--ink); }
.nav-user { display: flex; align-items: center; gap: 10px; }
.nav-avatar-wrap { position: relative; width: 30px; height: 30px; flex-shrink: 0; }
.nav-avatar { width: 30px; height: 30px; border-radius: 50%; object-fit: cover; border: 2px solid var(--line); display: block; }
.nav-avatar-initial {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  background: #1a7a4a;
  color: #fff;
  font-size: 0.78rem;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0;
  text-align: center;
  user-select: none;
  box-sizing: border-box;
}
.nav-user-name { font-size: 0.9rem; color: var(--ink-2); max-width: 120px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav-logout { font-size: 0.88rem; color: var(--muted); border-bottom: 1px solid transparent; }
.nav-logout:hover { color: var(--danger); border-bottom-color: var(--danger); }

/* ---------- Developer testing chip (admin-only) ----------
   Deliberately loud — this control should never look like a regular UI element.
   Only ever rendered for allowlisted admin emails; server gates the endpoint. */
.dev-chip {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  font: inherit;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.04em;
  color: #7a4a00;
  background: #fff3d6;
  border: 1px solid #f0c24b;
  border-radius: 999px;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.15s ease, border-color 0.15s ease;
}
.dev-chip:hover { background: #ffe9a8; border-color: #e5a82a; }
.dev-chip:disabled { opacity: 0.5; cursor: wait; }
.dev-chip[data-pro="1"] {
  color: #0f5a35;
  background: #d9f2e3;
  border-color: #7ec9a0;
}
.dev-chip[data-pro="1"]:hover { background: #bfe8ce; border-color: #4ea877; }
.dev-chip-dot {
  width: 6px; height: 6px; border-radius: 50%;
  background: #e5a82a;
  box-shadow: 0 0 0 2px rgba(229,168,42,0.2);
}
.dev-chip[data-pro="1"] .dev-chip-dot {
  background: #1a7a4a;
  box-shadow: 0 0 0 2px rgba(26,122,74,0.2);
}

/* ---------- Post-upgrade welcome toast ---------- */
.pro-welcome {
  position: fixed;
  top: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: linear-gradient(135deg, #22a05f 0%, #0f5a35 100%);
  color: #ffffff;
  border-radius: 12px;
  padding: 14px 22px;
  box-shadow: 0 6px 28px rgba(15,17,21,0.18);
  z-index: 2000;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  max-width: min(92vw, 440px);
  text-align: center;
  animation: proWelcomeIn 0.35s ease;
}
.pro-welcome strong { font-size: 1rem; font-weight: 700; letter-spacing: -0.01em; }
.pro-welcome span { font-size: 0.88rem; opacity: 0.92; }
.pro-welcome-out {
  opacity: 0;
  transform: translateX(-50%) translateY(-10px);
  transition: opacity 0.4s ease, transform 0.4s ease;
}
@keyframes proWelcomeIn {
  from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ---------- Hero ---------- */
.hero { padding: 88px 0 56px; }
.eyebrow {
  display: inline-block; padding: 6px 12px; border-radius: 999px;
  background: #e4f4ea; color: var(--brand-dark);
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.02em;
  margin-bottom: 20px;
}
.hero h1 { max-width: 760px; }
.lede { max-width: 640px; font-size: 1.1rem; margin: 20px 0 28px; color: var(--ink-2); }
.trust-row { margin-top: 24px; display: flex; flex-wrap: wrap; gap: 22px; color: var(--muted); font-size: 0.9rem; }

/* ---------- Analyzer ---------- */
.analyzer { padding: 48px 0 64px; }
.analyzer-grid {
  display: grid; gap: 24px;
  grid-template-columns: 1fr 1fr;
}
@media (max-width: 920px) {
  .analyzer-grid { grid-template-columns: 1fr; }
}
.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  padding: 24px;
  box-shadow: var(--shadow);
}
.card-head { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 14px; }
.url-form { display: flex; flex-direction: column; gap: 14px; }
.url-row {
  display: flex; align-items: center; gap: 10px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fdfcf9;
  padding: 4px 14px;
  transition: border-color .15s, box-shadow .15s;
}
.url-row:focus-within {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(31,59,45,.12);
}
.url-prefix { color: var(--muted); font-size: 0.95rem; }
#url-input {
  flex: 1; min-width: 0; border: 0; background: transparent; outline: none;
  font: inherit; font-size: 1rem; color: var(--ink);
  padding: 14px 0;
}
#url-input::placeholder { color: #9aa0a6; }
.input-actions { display: flex; justify-content: space-between; align-items: center; }
.hint { margin-top: 10px; color: var(--muted); font-size: 0.85rem; }

/* Button states */
.btn-sm { padding: 6px 12px; font-size: 0.85rem; }
.btn-spinner {
  display: none;
  width: 14px; height: 14px;
  border: 2px solid rgba(255,255,255,.4);
  border-top-color: #fff;
  border-radius: 999px;
  animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.btn.is-loading .btn-label { opacity: 0.7; }
.btn.is-loading .btn-spinner { display: inline-block; }
.btn.is-loading { pointer-events: none; }

/* Status pill */
#status-pill { font-size: 0.8rem; padding: 4px 10px; border-radius: 999px; background: #f1efe9; color: var(--muted); }
#status-pill.loading { background: #fef6e0; color: var(--warn); }
#status-pill.ok      { background: var(--good-bg); color: var(--good); }
#status-pill.err     { background: var(--danger-bg); color: var(--danger); }

/* Manual-paste fallback */
.fallback {
  margin-top: 14px;
  border: 1px solid var(--danger-border);
  background: var(--danger-bg);
  border-radius: 10px;
  padding: 14px;
  animation: pop .2s ease-out;
}
.fallback-head { display: flex; flex-direction: column; gap: 2px; margin-bottom: 10px; }
.fallback-head strong { color: var(--danger); font-size: 0.95rem; }
#fallback-text {
  width: 100%; min-height: 200px; resize: vertical;
  border: 1px solid var(--line); border-radius: 8px;
  padding: 12px 14px; font: inherit; font-size: 0.92rem;
  background: #fff; color: var(--ink); line-height: 1.55;
}
#fallback-text:focus { outline: 2px solid var(--brand); outline-offset: 1px; }
.fallback-actions { display: flex; justify-content: flex-end; gap: 8px; margin-top: 10px; }

/* Indeed-friendly fallback (not error-red) */
.fallback.indeed-notice {
  border-color: var(--line);
  background: #f5f8fa;
}
.fallback.indeed-notice .fallback-head strong {
  color: var(--ink);
}
.fallback.indeed-notice .fallback-head .indeed-badge {
  display: inline-flex; align-items: center; gap: 6px;
  font-size: 0.8rem; font-weight: 600; letter-spacing: 0.01em;
  color: var(--brand); margin-top: 6px;
}

/* Upgrade gate overlay (paywall within result card) */
.upgrade-gate {
  position: relative;
  margin-top: -4px;
}
.upgrade-gate-blur {
  position: absolute; top: -60px; left: 0; right: 0; height: 60px;
  background: linear-gradient(to bottom, transparent, var(--surface));
  pointer-events: none; z-index: 1;
}
.upgrade-gate-content {
  position: relative; z-index: 2;
  text-align: center;
  border: 1px dashed var(--line);
  border-radius: 12px;
  padding: 28px 20px;
  background: #fafaf7;
}
.upgrade-gate-icon {
  width: 52px; height: 52px; border-radius: 14px;
  background: #e4f4ea; color: var(--brand);
  display: grid; place-items: center;
  margin: 0 auto 12px;
}
.upgrade-gate-content h4 { font-size: 1.05rem; margin-bottom: 6px; }
.upgrade-gate-content p { font-size: 0.9rem; color: var(--ink-2); max-width: 340px; margin: 0 auto 16px; }

/* Scraped preview */
.scraped-preview {
  margin-top: 14px;
  border: 1px solid var(--line); border-radius: 10px;
  background: #fdfcf9;
  overflow: hidden;
}
.scraped-head {
  display: flex; align-items: center; justify-content: space-between; gap: 12px;
  padding: 12px 14px;
}
.scraped-head strong { display: block; font-size: 0.95rem; }
.scraped-head .muted { font-size: 0.85rem; }
.scraped-text {
  margin: 0; padding: 14px;
  border-top: 1px solid var(--line);
  background: #fff;
  max-height: 260px; overflow: auto;
  font-family: ui-monospace, SFMono-Regular, Menlo, monospace;
  font-size: 0.82rem; line-height: 1.55;
  white-space: pre-wrap; color: var(--ink-2);
}

/* Result */
.result-card { min-height: 440px; display: flex; flex-direction: column; }
.result-empty { margin: auto; text-align: center; padding: 24px; color: var(--muted); max-width: 320px; }
.result-empty-icon { font-size: 2rem; color: var(--brand); margin-bottom: 12px; }
.result-empty h3 { margin-bottom: 8px; color: var(--ink); }

.score-head { display: flex; align-items: center; gap: 20px; margin-bottom: 22px; }
.score-ring { position: relative; width: 130px; height: 130px; flex-shrink: 0; }
.score-ring svg { width: 100%; height: 100%; transform: rotate(-90deg); }
.ring-bg { fill: none; stroke: var(--line); stroke-width: 8; }
.ring-fg {
  fill: none; stroke: var(--brand); stroke-width: 8;
  stroke-linecap: round;
  stroke-dasharray: 326.7;
  stroke-dashoffset: 326.7;
  transition: stroke-dashoffset .8s cubic-bezier(.2,.8,.2,1), stroke .3s;
}
.score-value {
  position: absolute; inset: 0;
  display: flex; flex-direction: column;
  align-items: center; justify-content: center;
  text-align: center;
  line-height: 1;
}
.score-value span {
  display: block;
  font-weight: 800; font-size: 2.4rem;
  letter-spacing: -0.03em;
}
.score-value small {
  display: block;
  font-size: 0.72rem;
  font-weight: 500;
  color: var(--muted);
  margin-top: 2px;
  letter-spacing: 0.01em;
}
.score-summary { flex: 1; }
.score-label {
  display: inline-block; padding: 4px 10px; border-radius: 999px;
  font-size: 0.75rem; font-weight: 600; letter-spacing: 0.02em;
  background: var(--good-bg); color: var(--good);
  margin-bottom: 8px;
}
.score-label.warn { background: #fef6e0; color: #d4a017; }
.score-label.bad  { background: var(--danger-bg); color: var(--danger); }
#score-headline { margin-bottom: 4px; }

.findings h4 { margin-top: 16px; margin-bottom: 8px; text-transform: uppercase; font-size: 0.75rem; letter-spacing: 0.08em; color: var(--muted); }
.findings-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 8px; }
.finding {
  display: flex; gap: 12px; align-items: flex-start;
  padding: 12px 14px; border-radius: 10px;
  border: 1px solid var(--line); background: #fdfcf9;
}
.finding.bad  { border-color: var(--danger-border); background: var(--danger-bg); }
.finding.good { border-color: #cfe5d2; background: var(--good-bg); }
.finding-dot { flex-shrink: 0; width: 8px; height: 8px; border-radius: 999px; margin-top: 8px; background: var(--muted); }
.finding.bad .finding-dot  { background: var(--danger); }
.finding.good .finding-dot { background: var(--good); }
.finding-body strong { display: block; font-weight: 600; margin-bottom: 2px; font-size: 0.95rem; }
.finding-body span   { color: var(--ink-2); font-size: 0.88rem; }
.findings-list:empty::before {
  content: "None detected.";
  display: block; color: var(--muted); font-size: 0.88rem; padding: 6px 2px;
}

/* ---------- How it works (3-step landing section) ---------- */
.how-it-works {
  padding: 72px 0;
  border-top: 1px solid var(--line);
  background: var(--bg);
}
.how-it-works h2 { margin-bottom: 10px; }
.section-intro {
  color: var(--ink-2);
  font-size: 1.05rem;
  margin-bottom: 36px;
  max-width: 560px;
}
.steps {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 20px;
}
.step {
  position: relative;
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 14px;
  padding: 28px 24px 24px;
  box-shadow: 0 1px 3px rgba(15,17,21,.03);
  transition: box-shadow .15s ease, transform .05s ease;
}
.step:hover { box-shadow: var(--shadow); }
.step-num {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 38px; height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #22a05f 0%, #0f5a35 100%);
  color: #fff;
  font-size: 1rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  margin-bottom: 14px;
  box-shadow: 0 1px 2px rgba(15,90,53,.25), 0 4px 10px rgba(15,90,53,.12);
}
.step h3 {
  font-size: 1.1rem;
  font-weight: 700;
  margin-bottom: 8px;
}
.step p {
  font-size: 0.94rem;
  color: var(--ink-2);
  line-height: 1.55;
  margin: 0;
}

/* How / Signal guide */
.how { padding: 80px 0; border-top: 1px solid var(--line); background: #f5f3ec; }
.how h2 { margin-bottom: 10px; }
.how .eyebrow { margin-bottom: 14px; }
.how-intro { max-width: 680px; font-size: 1.05rem; margin-bottom: 36px; color: var(--ink-2); line-height: 1.6; }

/* Section sub-headers */
.how-section-head {
  font-size: 1.1rem;
  font-weight: 700;
  margin: 32px 0 14px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--line);
}
.how-section-head:first-of-type { margin-top: 0; }
.how-section-bad  { color: var(--danger); border-bottom-color: var(--danger); }
.how-section-good { color: var(--brand);  border-bottom-color: var(--brand); }

/* 2-column signal grid */
.signal-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 14px;
  margin-bottom: 8px;
}

.signal-card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 16px 18px;
  box-shadow: 0 1px 3px rgba(15,17,21,.03);
  transition: box-shadow .15s;
}
.signal-card:hover { box-shadow: var(--shadow); }
.signal-card.signal-bad  { border-left: 4px solid var(--danger); }
.signal-card.signal-good { border-left: 4px solid var(--brand); }

.signal-card h4 {
  font-size: 0.93rem;
  font-weight: 700;
  margin-bottom: 4px;
}
.signal-card p {
  font-size: 0.85rem;
  line-height: 1.5;
  color: var(--ink-2);
  margin-bottom: 6px;
}
.signal-example {
  display: block;
  font-size: 0.8rem;
  font-style: italic;
  color: var(--muted);
  line-height: 1.4;
}

.how-footer {
  text-align: center;
  margin-top: 28px;
  font-size: 0.9rem;
  color: var(--muted);
}

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

/* Pricing */
.pricing { padding: 72px 0; }
.pricing h2 { margin-bottom: 28px; }
.plans { display: grid; gap: 20px; grid-template-columns: 1fr 1fr; max-width: 760px; }
@media (max-width: 620px) { .plans { grid-template-columns: 1fr; } }
.plan {
  background: var(--surface); border: 1px solid var(--line);
  border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow);
  position: relative;
}
.plan-featured { border-color: var(--brand); }
.plan-tag {
  position: absolute; top: -12px; left: 24px;
  background: var(--brand); color: var(--brand-ink);
  font-size: 0.72rem; font-weight: 600; letter-spacing: 0.04em;
  padding: 4px 10px; border-radius: 999px;
}
.price { margin: 10px 0 18px; display: flex; align-items: baseline; gap: 6px; }
.price span { font-size: 2.2rem; font-weight: 800; letter-spacing: -0.02em; }
.price small { color: var(--muted); }
.plan ul { list-style: none; padding: 0; margin: 0 0 22px; display: flex; flex-direction: column; gap: 8px; }
.plan li { font-size: 0.94rem; color: var(--ink-2); padding-left: 22px; position: relative; }
.plan li::before {
  content: "✓"; position: absolute; left: 0; top: 0;
  color: var(--brand); font-weight: 700;
}

/* ---------- Legal pages (Privacy / Terms) ---------- */
.legal-page { padding: 60px 0 80px; }
.legal-container { max-width: 760px; }
.legal-page .eyebrow { margin-bottom: 14px; }
.legal-page h1 {
  font-size: clamp(1.9rem, 4vw, 2.6rem);
  margin-bottom: 10px;
}
.legal-updated {
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 32px;
}
.legal-intro {
  font-size: 1.1rem;
  color: var(--ink-2);
  padding: 18px 22px;
  background: var(--surface);
  border-left: 3px solid var(--brand);
  border-radius: 0 8px 8px 0;
  margin: 0 0 36px;
}
.legal-page h2 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 32px 0 10px;
  color: var(--ink);
}
.legal-page p,
.legal-page li {
  color: var(--ink-2);
  font-size: 1rem;
  line-height: 1.65;
}
.legal-page p { margin: 0 0 14px; }
.legal-page ul {
  padding-left: 20px;
  margin: 0 0 14px;
}
.legal-page ul li { margin-bottom: 6px; }
.legal-page a {
  color: var(--brand);
  border-bottom: 1px solid transparent;
  transition: border-color .15s ease;
}
.legal-page a:hover { border-bottom-color: var(--brand); }
.legal-page strong { color: var(--ink); font-weight: 600; }

@media (max-width: 640px) {
  .legal-page { padding: 36px 0 56px; }
  .legal-intro { font-size: 1rem; padding: 14px 16px; }
  .legal-page h2 { font-size: 1.15rem; margin: 26px 0 8px; }
  .legal-page p, .legal-page li { font-size: 0.95rem; }
}

/* Footer */
.footer { border-top: 1px solid var(--line); padding: 32px 0; margin-top: 20px; background: var(--bg); }
.footer-inner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 20px;
  color: var(--muted);
  font-size: 0.9rem;
}
.footer-brand { display: flex; flex-direction: column; gap: 2px; }
.footer-brand > span:first-child { color: var(--ink-2); }
.footer-links { display: inline-flex; align-items: center; gap: 10px; }
.footer-links a {
  color: var(--ink-2);
  font-size: 0.9rem;
  border-bottom: 1px solid transparent;
  transition: color .15s ease, border-color .15s ease;
}
.footer-links a:hover { color: var(--brand); border-bottom-color: var(--brand); }
.footer-sep { color: var(--line); }

/* Modal */
.modal { position: fixed; inset: 0; z-index: 50; display: grid; place-items: center; padding: 20px; }
.modal[hidden] { display: none; }
.modal-backdrop { position: absolute; inset: 0; background: rgba(15,17,21,.5); backdrop-filter: blur(2px); }
.modal-card {
  position: relative; background: var(--surface); border-radius: 16px;
  padding: 32px; max-width: 440px; width: 100%;
  box-shadow: 0 30px 80px rgba(15,17,21,.25); text-align: center;
  animation: pop .2s ease-out;
}
@keyframes pop { from { transform: scale(.96); opacity: 0; } to { transform: scale(1); opacity: 1; } }
.modal-close {
  position: absolute; top: 12px; right: 14px;
  background: none; border: 0; font-size: 1.6rem; color: var(--muted);
  cursor: pointer; line-height: 1;
}
.modal-icon {
  width: 56px; height: 56px; border-radius: 14px; margin: 0 auto 14px;
  background: #e4f4ea; color: var(--brand); font-size: 1.6rem;
  display: grid; place-items: center;
}
.modal-card h3 { font-size: 1.4rem; margin-bottom: 8px; }
.modal-price { margin: 18px 0 10px; }
.modal-price-main { font-size: 2rem; font-weight: 800; letter-spacing: -0.02em; }
.modal-list { list-style: none; padding: 0; margin: 14px 0 22px; text-align: left; display: flex; flex-direction: column; gap: 6px; }
.modal-list li { padding-left: 22px; position: relative; color: var(--ink-2); font-size: 0.94rem; }
.modal-list li::before { content: "✓"; position: absolute; left: 0; color: var(--brand); font-weight: 700; }
.modal-card .btn + .btn { margin-top: 10px; }

/* ---------- Result actions (PDF export button) ---------- */
.result-actions {
  display: flex; justify-content: flex-end;
  margin: 4px 0 14px;
  gap: 8px;
}
#export-pdf-btn {
  display: inline-flex; align-items: center; gap: 6px;
}
#export-pdf-btn svg { flex-shrink: 0; }

/* ---------- History section ---------- */
.history { padding: 64px 0 56px; background: #f5f3ed; border-top: 1px solid var(--line); }
.history-head {
  display: flex; align-items: flex-end; justify-content: space-between;
  gap: 16px; margin-bottom: 24px; flex-wrap: wrap;
}
.history-head h2 { margin-bottom: 6px; }
.history-intro { color: var(--muted); max-width: 560px; }
.history-list {
  display: flex; flex-direction: column; gap: 10px;
}
.history-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center; gap: 16px;
  padding: 14px 18px;
  background: #fff;
  border: 1px solid var(--line);
  border-radius: 12px;
  width: 100%;
  text-align: left;
  cursor: pointer;
  font-family: inherit;
  transition: border-color .15s ease, box-shadow .15s ease, transform .05s ease;
}
.history-row:hover { border-color: #c7c2b4; box-shadow: var(--shadow); }
.history-row:active { transform: translateY(1px); }
.history-score {
  width: 48px; height: 48px; border-radius: 10px;
  display: grid; place-items: center;
  font-weight: 800; font-size: 1.1rem;
  color: #fff;
  flex-shrink: 0;
}
.history-score.hist-good { background: #1a7a4a; }
.history-score.hist-warn { background: #d4a017; }
.history-score.hist-bad  { background: #CE2B37; }
.history-main { min-width: 0; }
.history-title {
  font-weight: 700; color: var(--ink);
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
  margin-bottom: 2px;
}
.history-sub {
  color: var(--muted); font-size: 0.88rem;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.history-date {
  color: var(--muted); font-size: 0.82rem; white-space: nowrap;
}
.history-arrow {
  color: var(--muted); font-size: 1.6rem; line-height: 1;
  padding-left: 4px;
}
.history-empty {
  text-align: center; padding: 40px 20px; color: var(--muted);
  background: #fff; border: 1px dashed var(--line); border-radius: 12px;
}
.history-empty-icon { font-size: 2rem; color: var(--brand); margin-bottom: 10px; }
.history-empty h3 { color: var(--ink); margin-bottom: 6px; }
@media (max-width: 640px) {
  .history-row { grid-template-columns: auto 1fr auto; gap: 12px; padding: 12px 14px; }
  .history-date { display: none; }
  .history-score { width: 42px; height: 42px; font-size: 1rem; }
}

/* ==========================================================
   Responsive / Mobile
   Tested against 375px (iPhone SE) → 920px (tablet landscape).
   Strategy:
     • ≤900px: reduce section padding so the phone isn't mostly whitespace.
     • ≤640px: single column everywhere, full-width primary buttons,
               44px touch targets, stacked score head, compact nav.
     • ≤380px: further shrink brand + score ring for iPhone SE.
   ========================================================== */

@media (max-width: 900px) {
  .hero     { padding: 60px 0 40px; }
  .analyzer { padding: 32px 0 44px; }
  .how      { padding: 56px 0; }
  .pricing  { padding: 52px 0; }
  .history  { padding: 48px 0 40px; }
}

@media (max-width: 640px) {
  /* Container padding tightens so content uses more of the viewport */
  .container { padding: 0 16px; }
  .nav-inner { padding: 12px 16px; }

  /* Global: grow touch targets. Apple HIG = 44px, Material = 48px.
     We use 44 as the floor for all interactive controls. */
  .btn          { min-height: 44px; padding: 12px 18px; }
  .btn-sm       { min-height: 38px; padding: 8px 14px; }
  .btn-lg       { min-height: 50px; padding: 14px 22px; font-size: 1rem; }

  /* --- Nav ---------------------------------------------------- */
  /* In-page anchor links (How it works / History / Pricing) are
     the main source of nav overflow on mobile. Hide them — users
     can scroll to reach each section. Keep auth + avatar visible. */
  .nav-links > a[href^="#"] { display: none; }
  .nav-links        { gap: 10px; }
  .brand-wordmark   { font-size: 1.1rem; }
  .brand-mark       { width: 30px; height: 30px; }
  .brand-mark svg   { width: 22px; height: 22px; }
  /* Free up horizontal space in the nav */
  .nav-user         { gap: 8px; }
  .nav-user-name    { display: none; }
  .nav-logout       { font-size: 0.85rem; }
  #nav-cta          { padding: 8px 14px; min-height: 38px; }
  .dev-chip         { font-size: 0.68rem; padding: 3px 8px; letter-spacing: 0.02em; }

  /* --- Hero --------------------------------------------------- */
  .hero             { padding: 36px 0 28px; }
  .hero h1          { font-size: clamp(1.75rem, 7vw, 2.4rem); max-width: 100%; }
  .lede             { font-size: 1rem; margin: 14px 0 22px; }
  .hero .btn-lg     { width: 100%; }
  .trust-row        { gap: 12px 18px; font-size: 0.85rem; margin-top: 18px; }
  .eyebrow          { margin-bottom: 12px; font-size: 0.75rem; }

  /* --- Analyzer input card ----------------------------------- */
  .card             { padding: 18px; }
  .analyzer         { padding: 20px 0 36px; }
  .card-head        { margin-bottom: 12px; }
  .card-head h2     { font-size: 1.25rem; }
  .url-row          { padding: 2px 12px; }

  /* Analyze button: full width, pinned below the URL row */
  .input-actions    { display: block; }
  #analyze-btn      { width: 100%; }

  /* Scraped preview */
  .scraped-head     { padding: 10px 12px; }
  .scraped-text     { max-height: 200px; font-size: 0.78rem; padding: 10px 12px; }

  /* --- Fallback (manual paste) ------------------------------- */
  .fallback         { padding: 12px; }
  #fallback-text    { min-height: 160px; font-size: 0.9rem; }
  .fallback-actions {
    flex-direction: column-reverse;  /* primary action on top */
    align-items: stretch;
    gap: 8px;
  }
  .fallback-actions .btn { width: 100%; }

  /* --- Result card: stack score-ring + summary --------------- */
  .result-card      { min-height: 0; padding: 18px; }
  .score-head {
    flex-direction: column;
    align-items: center;
    text-align: center;
    gap: 14px;
    margin-bottom: 18px;
  }
  .score-summary    { flex: none; width: 100%; }
  .score-ring       { width: 120px; height: 120px; }
  .score-value span { font-size: 2.1rem; }

  /* Result actions / PDF button */
  .result-actions   { justify-content: center; margin: 0 0 14px; }
  #export-pdf-btn   { width: 100%; }

  /* Findings */
  .finding          { padding: 10px 12px; gap: 10px; }
  .finding-body strong { font-size: 0.93rem; }
  .finding-body span   { font-size: 0.86rem; }

  /* Upgrade gate (preview-mode paywall) */
  .upgrade-gate-content  { padding: 22px 16px; }
  .upgrade-gate-content p { font-size: 0.88rem; }
  .upgrade-gate-content .btn { width: 100%; }

  /* --- How-it-works signal cards ----------------------------- */
  .how              { padding: 44px 0; }
  .how h2           { font-size: 1.5rem; }
  .how-intro        { font-size: 0.98rem; margin-bottom: 24px; }
  .how-section-head { font-size: 1rem; margin: 26px 0 12px; }
  .signal-grid      { gap: 12px; }
  .signal-card      { padding: 14px 16px; }

  /* --- Pricing ----------------------------------------------- */
  .pricing          { padding: 44px 0; }
  .pricing h2       { margin-bottom: 22px; font-size: 1.5rem; }
  .plans            { gap: 14px; }
  .plan             { padding: 22px 20px; }
  .plan .btn        { width: 100%; }
  .price span       { font-size: 1.9rem; }

  /* --- History ----------------------------------------------- */
  .history          { padding: 36px 0 28px; }
  .history-head     { gap: 10px; margin-bottom: 18px; }
  .history-head h2  { font-size: 1.5rem; }
  .history-intro    { font-size: 0.92rem; }

  /* --- Modal (paywall) ---------------------------------------
     Top-align vertically so the card stays visible even if it's
     taller than the viewport (keyboards on iOS push the modal up). */
  .modal            { padding: 16px; align-items: start; padding-top: 40px; }
  .modal-card       { padding: 24px 22px; border-radius: 14px; max-height: calc(100vh - 80px); overflow-y: auto; }
  .modal-card h3    { font-size: 1.25rem; }
  .modal-price-main { font-size: 1.7rem; }
  .modal-icon       { width: 44px; height: 44px; margin-bottom: 10px; font-size: 1.3rem; }
  .modal-close {
    top: 6px; right: 8px;
    width: 40px; height: 40px;       /* bigger touch target */
    display: flex; align-items: center; justify-content: center;
  }
  .modal-list li    { font-size: 0.9rem; }

  /* --- Pro welcome toast ------------------------------------- */
  .pro-welcome      { top: 12px; padding: 12px 18px; max-width: calc(100vw - 24px); }
  .pro-welcome strong { font-size: 0.95rem; }
  .pro-welcome span   { font-size: 0.82rem; }

  /* --- Footer ------------------------------------------------- */
  .footer           { padding: 24px 0; margin-top: 0; }
  .footer-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 12px;
    font-size: 0.85rem;
  }
  .footer-links a   { font-size: 0.85rem; }

  /* --- How it works step cards on mobile --------------------- */
  .how-it-works     { padding: 48px 0; }
  .how-it-works h2  { font-size: 1.5rem; }
  .section-intro    { font-size: 0.98rem; margin-bottom: 24px; }
  .steps            { grid-template-columns: 1fr; gap: 14px; }
  .step             { padding: 22px 20px; }
  .step-num         { width: 34px; height: 34px; font-size: 0.95rem; }
}

/* Very small phones (iPhone SE, etc). Mostly shrinks ornaments. */
@media (max-width: 380px) {
  .container        { padding: 0 14px; }
  .nav-inner        { padding: 10px 14px; }

  .brand-wordmark   { font-size: 1rem; }
  .brand-mark       { width: 28px; height: 28px; }
  .brand-mark svg   { width: 20px; height: 20px; }

  .hero h1          { font-size: 1.65rem; }
  .lede             { font-size: 0.95rem; }

  .card             { padding: 14px; }
  .result-card      { padding: 14px; }

  .score-ring       { width: 108px; height: 108px; }
  .score-value span { font-size: 1.85rem; }

  .modal            { padding: 12px; padding-top: 30px; }
  .modal-card       { padding: 20px 18px; }

  .dev-chip         { padding: 3px 6px; }
}

/* ---------- Print / PDF layout ---------- */
/* Hidden off-screen in normal view; only shown during print */
.print-sheet {
  position: absolute;
  left: -10000px; top: 0;
  width: 8.5in;
  visibility: hidden;
}

@media print {
  /* Hide everything in normal flow */
  body > * { display: none !important; }
  /* Show only the print sheet */
  body > .print-sheet {
    display: block !important;
    visibility: visible !important;
    position: static !important;
    left: auto !important;
    width: 100% !important;
  }

  @page { size: Letter; margin: 0.6in; }

  html, body {
    background: #ffffff !important;
    color: #111111 !important;
    font-family: 'Inter', -apple-system, Segoe UI, sans-serif;
  }

  .print-sheet {
    color: #111111;
    font-size: 11pt;
    line-height: 1.45;
  }

  .print-header {
    display: flex; justify-content: space-between; align-items: center;
    padding-bottom: 14px;
    border-bottom: 2px solid #1a7a4a;
    margin-bottom: 22px;
  }
  .print-brand { display: flex; align-items: center; gap: 10px; }
  .print-brand-mark {
    display: inline-grid; place-items: center;
    width: 36px; height: 36px; border-radius: 10px;
    background: linear-gradient(135deg, #22a05f 0%, #0f5a35 100%);
  }
  .print-brand-text {
    font-size: 18pt; font-weight: 800; letter-spacing: -0.025em;
    color: #111;
  }
  .print-brand-vero { color: #1a7a4a; }
  .print-date {
    color: #555; font-size: 10pt;
  }

  .print-job { margin-bottom: 22px; }
  .print-job-title {
    font-size: 18pt; font-weight: 800; color: #111;
    letter-spacing: -0.02em; margin-bottom: 4px;
  }
  .print-job-company {
    font-size: 12pt; color: #444; margin-bottom: 4px;
  }
  .print-job-url {
    font-size: 9pt; color: #888; word-break: break-all;
  }

  .print-score {
    display: flex; align-items: center; gap: 20px;
    padding: 18px 22px;
    background: #f7f6f1;
    border-radius: 10px;
    margin-bottom: 22px;
    page-break-inside: avoid;
  }
  .print-score-number {
    font-size: 42pt; font-weight: 800; letter-spacing: -0.03em;
    line-height: 1;
    min-width: 110px;
  }
  .print-score-number::after {
    content: " / 100";
    font-size: 14pt; font-weight: 600; color: #888;
    letter-spacing: 0;
  }
  .print-score-good { color: #1a7a4a; }
  .print-score-warn { color: #b8860b; }
  .print-score-bad  { color: #CE2B37; }
  .print-score-meta { flex: 1; }
  .print-score-label {
    display: inline-block;
    font-size: 9pt; font-weight: 700;
    text-transform: uppercase; letter-spacing: 0.08em;
    padding: 3px 10px; border-radius: 999px;
    background: #e7e5df; color: #333;
    margin-bottom: 8px;
  }
  .print-score-headline {
    font-size: 14pt; font-weight: 700; color: #111;
  }

  .print-findings { }
  .print-section-head {
    font-size: 12pt; font-weight: 700;
    margin: 18px 0 10px;
    padding-bottom: 6px;
    border-bottom: 1.5px solid #ddd;
  }
  .print-head-bad  { color: #CE2B37; border-bottom-color: #CE2B37; }
  .print-head-good { color: #1a7a4a; border-bottom-color: #1a7a4a; }

  .print-list {
    list-style: none; padding: 0; margin: 0;
  }
  .print-item {
    padding: 10px 12px 10px 16px;
    border-left: 3px solid #ddd;
    margin-bottom: 8px;
    page-break-inside: avoid;
  }
  .print-item-bad  { border-left-color: #CE2B37; background: #fdf2f3; }
  .print-item-good { border-left-color: #1a7a4a; background: #edf6f0; }
  .print-item-empty {
    color: #888; background: none; border-left-color: #e7e5df;
    font-style: italic;
  }
  .print-item-title {
    font-weight: 700; color: #111; margin-bottom: 3px;
    font-size: 11pt;
  }
  .print-item-detail {
    color: #333; font-size: 10pt; line-height: 1.45;
  }

  .print-footer {
    margin-top: 30px;
    padding-top: 12px;
    border-top: 1px solid #ddd;
    color: #888; font-size: 9pt; text-align: center;
  }

  /* Force print color rendering (otherwise backgrounds may be dropped) */
  * {
    -webkit-print-color-adjust: exact !important;
    print-color-adjust: exact !important;
  }
}
