:root {
  color-scheme: light;
  --ink: #17211b;
  --muted: #66726b;
  --surface: #ffffff;
  --canvas: #f3f6f2;
  --line: #dfe6df;
  --brand: #176b45;
  --brand-dark: #0d5032;
  --brand-soft: #e4f3e9;
  --success: #137a45;
  --warning: #a96c00;
  --critical: #b42318;
  --info: #175cd3;
  --shadow: 0 1px 2px rgba(20, 36, 27, 0.06), 0 8px 28px rgba(20, 36, 27, 0.04);
}

* { box-sizing: border-box; }

body {
  margin: 0;
  background:
    radial-gradient(circle at 90% -10%, rgba(91, 175, 118, 0.12), transparent 30rem),
    var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  font-size: 14px;
  line-height: 1.5;
}

button, input, select { font: inherit; }
a { color: inherit; }

.app-shell {
  width: min(1220px, calc(100% - 40px));
  margin: 0 auto;
  padding: 22px 0 64px;
}

.app-shell-narrow { width: min(900px, calc(100% - 40px)); }
.page-stack { display: grid; gap: 24px; }

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
  padding: 0 2px 22px;
}

.brand-lockup { display: flex; align-items: center; gap: 11px; }
.brand-lockup > div { display: grid; line-height: 1.25; }
.brand-lockup strong { font-size: 15px; letter-spacing: -0.01em; }
.brand-lockup span:not(.brand-mark) { color: var(--muted); font-size: 12px; }

.brand-mark {
  display: grid;
  width: 34px;
  height: 34px;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(145deg, #217b52, #0c4b2f);
  color: #fff;
  font-weight: 800;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.18);
}

.topnav { display: flex; align-items: center; gap: 5px; }
.topnav a { padding: 8px 12px; border-radius: 8px; color: var(--muted); font-weight: 650; text-decoration: none; }
.topnav a:hover, .topnav a.active { background: rgba(255, 255, 255, 0.75); color: var(--ink); }

.hero-row { display: flex; align-items: end; justify-content: space-between; gap: 28px; padding: 30px 0 8px; }
.hero-row.compact { padding-top: 18px; }
.hero-row h1 { max-width: 720px; margin: 4px 0 7px; font-size: clamp(28px, 4vw, 44px); line-height: 1.08; letter-spacing: -0.04em; }
.hero-row.compact h1 { font-size: 34px; }
.lede { max-width: 690px; margin: 0; color: var(--muted); font-size: 16px; }
.eyebrow { margin: 0 0 5px; color: var(--brand); font-size: 11px; font-weight: 800; letter-spacing: 0.11em; text-transform: uppercase; }
.subdued { color: var(--muted); }

.button {
  display: inline-flex;
  min-height: 39px;
  align-items: center;
  justify-content: center;
  border: 1px solid transparent;
  border-radius: 9px;
  padding: 8px 14px;
  font-weight: 720;
  text-decoration: none;
  cursor: pointer;
}

.button-primary { background: var(--brand); color: #fff; box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08); }
.button-primary:hover { background: var(--brand-dark); }
.button-primary:disabled { opacity: 0.55; cursor: wait; }
.button-secondary { border-color: var(--line); background: #fff; color: var(--ink); }

.card { border: 1px solid rgba(205, 217, 207, 0.9); border-radius: 16px; background: var(--surface); box-shadow: var(--shadow); }
.card-header { display: flex; align-items: center; justify-content: space-between; gap: 20px; padding: 20px 22px; border-bottom: 1px solid var(--line); }
.card-header h2, .section-heading h2, .scan-summary h2, .privacy-card h2 { margin: 0; font-size: 18px; letter-spacing: -0.02em; }

.banner { display: flex; align-items: center; justify-content: space-between; gap: 18px; border: 1px solid; border-radius: 12px; padding: 12px 14px; }
.banner > div { display: grid; }
.banner span { color: var(--muted); }
.banner-success { border-color: #a9d7b8; background: #ecf8f0; }
.banner-critical { border-color: #f0b5af; background: #fff0ee; color: #7a271a; }
.banner-info { border-color: #b8cdf5; background: #f1f6ff; }
.usage-pill { display: inline-flex; align-items: center; gap: 4px; border-radius: 99px; padding: 7px 11px; background: #fff; color: var(--brand); font-size: 12px; font-weight: 750; text-decoration: none; white-space: nowrap; }

.plan-grid { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 14px; align-items: stretch; }
.plan-card { display: flex; min-width: 0; flex-direction: column; padding: 22px; position: relative; }
.plan-card-featured { border-color: #69ae82; box-shadow: 0 0 0 2px rgba(23, 107, 69, 0.09), var(--shadow); }
.popular-badge { position: absolute; top: 14px; right: 14px; border-radius: 99px; padding: 4px 7px; background: var(--brand-soft); color: var(--brand); font-size: 10px; font-weight: 800; text-transform: uppercase; letter-spacing: .05em; }
.plan-card h2 { margin: 5px 0 8px; color: var(--muted); font-size: 14px; font-weight: 650; }
.plan-card h2 span { color: var(--ink); font-size: 30px; letter-spacing: -.04em; }
.plan-description { min-height: 66px; margin: 0; color: var(--muted); }
.plan-card ul { display: grid; gap: 9px; margin: 18px 0 24px; padding: 0; list-style: none; }
.plan-card li { padding-left: 20px; position: relative; }
.plan-card li::before { content: "✓"; position: absolute; left: 0; color: var(--success); font-weight: 850; }
.plan-card form, .plan-card form .button, .plan-card > .button { width: 100%; margin-top: auto; }
.button-disabled, .button:disabled { opacity: .58; cursor: not-allowed; }
.billing-footnote { margin: 0; color: var(--muted); font-size: 12px; text-align: center; }

.score-grid { display: grid; grid-template-columns: 1.25fr repeat(3, 1fr); gap: 14px; }
.score-card, .metric-card { min-height: 162px; border: 1px solid var(--line); border-radius: 16px; background: #fff; box-shadow: var(--shadow); padding: 21px; }
.score-card-primary { display: flex; align-items: center; justify-content: space-between; gap: 14px; background: linear-gradient(145deg, #163f2c, #0b2d1e); color: #fff; border: none; }
.metric-label { margin: 0; color: var(--muted); font-size: 12px; font-weight: 730; letter-spacing: 0.02em; }
.score-card-primary .metric-label { color: #b9d9c5; }
.score-number { margin: 8px 0 0; font-size: 46px; line-height: 1; font-weight: 780; letter-spacing: -0.05em; }
.score-number span, .metric-number span { margin-left: 4px; color: #b9d9c5; font-size: 14px; font-weight: 600; letter-spacing: 0; }
.metric-number { margin: 18px 0 6px; font-size: 29px; line-height: 1.05; font-weight: 760; letter-spacing: -0.04em; }
.metric-number span { color: var(--muted); }
.metric-note { margin: 0; color: var(--muted); font-size: 12px; }

.score-ring {
  --ring-color: #5ad18a;
  display: grid;
  width: 88px;
  height: 88px;
  flex: 0 0 auto;
  place-items: center;
  border-radius: 50%;
  background: conic-gradient(var(--ring-color) calc(var(--score) * 1%), rgba(255, 255, 255, 0.15) 0);
  position: relative;
}
.score-ring::after { content: ""; position: absolute; inset: 8px; border-radius: 50%; background: #123824; }
.score-ring span { z-index: 1; font-size: 22px; font-weight: 800; }

.content-grid { display: grid; grid-template-columns: minmax(0, 1.7fr) minmax(270px, 0.7fr); gap: 16px; }
.category-list { display: grid; gap: 16px; padding: 22px; }
.category-row { display: grid; grid-template-columns: 140px minmax(100px, 1fr) 34px; align-items: center; gap: 14px; }
.category-row > span { font-weight: 650; }
.category-row > strong { text-align: right; font-variant-numeric: tabular-nums; }
.progress { height: 8px; overflow: hidden; border-radius: 99px; background: #edf0ed; }
.progress span { display: block; height: 100%; border-radius: inherit; background: var(--success); }
.progress .tone-warning { background: #d69e2e; }
.progress .tone-critical { background: #d14b3d; }

.scan-summary { padding: 22px; }
.scan-summary dl { display: grid; gap: 0; margin: 18px 0; }
.scan-summary dl div, .evidence-list div { display: flex; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--line); }
.scan-summary dt, .evidence-list dt { color: var(--muted); }
.scan-summary dd, .evidence-list dd { margin: 0; font-weight: 720; text-align: right; }

.section-heading { display: flex; align-items: end; justify-content: space-between; gap: 18px; margin: 8px 0 14px; }
.ai-badge, .badge { display: inline-flex; align-items: center; border-radius: 99px; font-size: 11px; font-weight: 800; }
.ai-badge { padding: 6px 9px; background: #eee9ff; color: #5634a5; }
.finding-list { display: grid; gap: 12px; }
.finding { display: grid; grid-template-columns: 46px minmax(0, 1fr) 170px; overflow: hidden; }
.finding-rank { display: grid; place-items: start center; padding-top: 22px; background: #f8faf8; border-right: 1px solid var(--line); color: var(--muted); font-size: 15px; font-weight: 800; }
.finding-body { min-width: 0; padding: 19px 21px; }
.finding-body h3 { margin: 7px 0 5px; font-size: 17px; line-height: 1.3; letter-spacing: -0.015em; }
.finding-body > p { margin: 0; color: var(--muted); }
.finding-meta { display: flex; flex-wrap: wrap; align-items: center; gap: 7px; color: var(--muted); font-size: 12px; }
.badge { padding: 3px 7px; text-transform: uppercase; letter-spacing: 0.05em; }
.badge-critical { background: #fee4e2; color: #912018; }
.badge-high { background: #ffead5; color: #93370d; }
.badge-medium { background: #fef0c7; color: #854a0e; }
.badge-low { background: #e8eef9; color: #344b73; }
.recommendation { display: grid; gap: 2px; margin-top: 13px; padding: 11px 13px; border-left: 3px solid #54a975; border-radius: 0 8px 8px 0; background: #f3f9f5; }
.recommendation strong { font-size: 11px; color: var(--brand); text-transform: uppercase; letter-spacing: 0.06em; }
.recommendation span { color: #34423a; }
.finding-impact { display: flex; flex-direction: column; align-items: flex-end; padding: 20px; border-left: 1px solid var(--line); background: #fcfdfc; text-align: right; }
.finding-impact > span { color: var(--muted); font-size: 11px; }
.finding-impact > strong { margin-top: 4px; font-size: 18px; }
.finding-impact > small { color: var(--muted); }
.finding-impact form { width: 100%; margin-top: auto; padding-top: 18px; }
.status-select { width: 100%; border: 1px solid var(--line); border-radius: 8px; background: #fff; padding: 7px 9px; color: var(--ink); }

.fix-panel { margin-top: 12px; border-top: 1px solid var(--line); padding-top: 10px; }
.fix-panel summary { width: fit-content; color: var(--brand); font-weight: 750; cursor: pointer; }
.fix-panel > p { color: var(--muted); }
.fix-panel ol { margin: 10px 0; padding-left: 20px; }
.copy-block { margin: 12px 0; border: 1px solid #d8d0f0; border-radius: 10px; padding: 12px; background: #faf8ff; }
.copy-block > span { display: block; margin-bottom: 5px; color: #6840b6; font-size: 11px; font-weight: 800; text-transform: uppercase; letter-spacing: 0.06em; }
.copy-block p { margin: 0; }
.caution { padding: 9px 11px; border-radius: 8px; background: #fff8e8; color: #725316 !important; }
.evidence-list { display: grid; max-width: 580px; margin: 12px 0 0; font-size: 12px; }
.evidence-list div { padding: 6px 0; }

.empty-state { display: grid; max-width: 760px; justify-items: center; margin: 34px auto; padding: 50px 40px; text-align: center; }
.empty-state h2 { max-width: 520px; margin: 2px 0 8px; font-size: 28px; letter-spacing: -0.035em; }
.empty-state > p:not(.eyebrow) { max-width: 570px; margin: 0 0 22px; color: var(--muted); }
.empty-illustration { display: flex; align-items: end; gap: 7px; width: 100px; height: 76px; margin-bottom: 20px; padding: 14px; border-radius: 22px; background: var(--brand-soft); }
.empty-illustration span { flex: 1; border-radius: 5px 5px 2px 2px; background: var(--brand); }
.empty-illustration span:nth-child(1) { height: 35%; opacity: .5; }
.empty-illustration span:nth-child(2) { height: 62%; opacity: .72; }
.empty-illustration span:nth-child(3) { height: 100%; }

.scan-state { display: flex; align-items: center; gap: 26px; max-width: 780px; margin: 40px auto; padding: 34px; }
.scan-state h2 { margin: 2px 0 7px; font-size: 25px; }
.scan-state p:last-child { margin: 0; color: var(--muted); }
.scanner { display: grid; width: 78px; height: 78px; flex: 0 0 auto; place-items: center; border-radius: 20px; background: var(--brand-soft); overflow: hidden; position: relative; }
.scanner::before { content: ""; width: 35px; height: 45px; border: 3px solid var(--brand); border-radius: 4px; }
.scanner span { position: absolute; width: 58px; height: 2px; background: #49b974; box-shadow: 0 0 12px #49b974; animation: scan 1.8s ease-in-out infinite; }
@keyframes scan { 0%, 100% { transform: translateY(-24px); } 50% { transform: translateY(24px); } }

.settings-card { padding: 24px; }
.field { display: grid; gap: 8px; }
.field > label { font-weight: 750; }
.field > p { margin: 0; color: var(--muted); font-size: 12px; }
.money-input { display: flex; max-width: 420px; overflow: hidden; border: 1px solid #b9c3bb; border-radius: 9px; background: #fff; }
.money-input span { display: grid; place-items: center; padding: 0 12px; border-right: 1px solid var(--line); background: #f5f7f5; color: var(--muted); font-weight: 700; }
.money-input input { width: 100%; border: 0; padding: 11px 12px; outline: 0; }
.money-input:focus-within { border-color: var(--brand); box-shadow: 0 0 0 3px rgba(23, 107, 69, 0.12); }
.form-actions { display: flex; justify-content: flex-end; gap: 9px; margin-top: 24px; padding-top: 18px; border-top: 1px solid var(--line); }
.privacy-card { padding: 22px; }
.privacy-card p:last-child { margin-bottom: 0; color: var(--muted); }

.legal-shell { width: min(820px, calc(100% - 40px)); margin: 0 auto; padding: 54px 0 80px; }
.legal-shell h1 { margin: 5px 0 10px; font-size: 38px; letter-spacing: -0.04em; }
.legal-shell h2 { margin-top: 30px; font-size: 19px; }
.legal-shell p, .legal-shell li { color: var(--muted); line-height: 1.7; }
.legal-nav { display: flex; gap: 16px; margin: 24px 0; padding: 14px 0; border-block: 1px solid var(--line); }
.legal-nav a { color: var(--brand); font-weight: 700; }

@media (max-width: 900px) {
  .plan-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .score-grid { grid-template-columns: repeat(2, 1fr); }
  .content-grid { grid-template-columns: 1fr; }
  .finding { grid-template-columns: 40px minmax(0, 1fr); }
  .finding-impact { grid-column: 2; flex-direction: row; align-items: center; gap: 8px; border-top: 1px solid var(--line); border-left: 0; text-align: left; }
  .finding-impact form { width: auto; min-width: 140px; margin-left: auto; padding-top: 0; }
}

@media (max-width: 640px) {
  .app-shell, .app-shell-narrow { width: min(100% - 24px, 1220px); padding-top: 14px; }
  .topbar { align-items: flex-start; flex-direction: column; gap: 12px; padding-bottom: 12px; }
  .topnav { width: 100%; }
  .topnav a { flex: 1; text-align: center; }
  .hero-row { align-items: stretch; flex-direction: column; padding-top: 20px; }
  .hero-row form, .hero-row .button { width: 100%; }
  .score-grid { grid-template-columns: 1fr; }
  .plan-grid { grid-template-columns: 1fr; }
  .plan-description { min-height: 0; }
  .score-card, .metric-card { min-height: 132px; }
  .score-card-primary { min-height: 150px; }
  .category-row { grid-template-columns: 105px minmax(70px, 1fr) 30px; gap: 9px; }
  .card-header, .section-heading { align-items: flex-start; flex-direction: column; }
  .finding { grid-template-columns: 32px minmax(0, 1fr); }
  .finding-rank { padding-top: 19px; }
  .finding-body { padding: 16px 14px; }
  .finding-impact { grid-column: 1 / -1; flex-wrap: wrap; padding: 13px 14px; }
  .finding-impact form { width: 100%; margin: 6px 0 0; }
  .scan-state { align-items: flex-start; flex-direction: column; }
  .banner { align-items: flex-start; flex-direction: column; }
  .banner .button { width: 100%; }
}
