:root {
  color-scheme: light;
  --ink: #0b1714;
  --muted: #5d6d67;
  --line: #dbe6e1;
  --canvas: #f3f7f4;
  --card: rgba(255, 255, 255, .94);
  --forest: #071a16;
  --green: #0b7a53;
  --mint: #c8f3df;
  --lime: #c8f05d;
  --amber: #f0b44d;
  --red: #cf554c;
  --blue: #3178c6;
  --shadow: 0 18px 50px rgba(7, 26, 22, .09);
  --radius: 24px;
}

* { box-sizing: border-box; }
html { scroll-behavior: smooth; }
body {
  margin: 0;
  min-width: 320px;
  background:
    radial-gradient(circle at 8% 0%, rgba(200, 240, 93, .16), transparent 28rem),
    radial-gradient(circle at 95% 18%, rgba(49, 120, 198, .12), transparent 30rem),
    var(--canvas);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button, textarea, select { font: inherit; }
button, a { -webkit-tap-highlight-color: transparent; }
a { color: inherit; text-decoration: none; }

.topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  align-items: center;
  gap: 24px;
  min-height: 72px;
  padding: 12px clamp(18px, 5vw, 72px);
  border-bottom: 1px solid rgba(219, 230, 225, .9);
  background: rgba(243, 247, 244, .88);
  backdrop-filter: blur(18px);
}

.brand { display: inline-flex; align-items: center; gap: 11px; justify-self: start; }
.brand-mark {
  display: grid;
  width: 42px;
  aspect-ratio: 1;
  place-items: center;
  border-radius: 14px;
  background: var(--forest);
  color: var(--lime);
  font-weight: 900;
  letter-spacing: -.05em;
}
.brand strong, .brand small { display: block; }
.brand strong { font-size: 15px; }
.brand small { color: var(--muted); margin-top: 2px; }
.topbar nav { display: flex; gap: 24px; color: #3c4f48; font-size: 14px; font-weight: 700; }
.topbar nav a:hover { color: var(--green); }

.install-button, .primary-button {
  border: 0;
  border-radius: 14px;
  background: var(--forest);
  color: white;
  font-weight: 850;
  cursor: pointer;
}
.install-button { justify-self: end; padding: 11px 16px; }
.primary-button { min-height: 52px; padding: 0 20px; align-self: end; }
.primary-button span { color: var(--lime); padding-left: 8px; }

main { width: min(1480px, calc(100% - 36px)); margin: 0 auto; padding: 30px 0 72px; }
.hero {
  display: grid;
  grid-template-columns: minmax(0, 1fr) auto;
  gap: 32px;
  align-items: end;
  padding: clamp(30px, 5vw, 68px);
  border-radius: 32px;
  overflow: hidden;
  background:
    linear-gradient(115deg, rgba(7, 26, 22, .97), rgba(10, 65, 48, .93)),
    var(--forest);
  color: white;
  box-shadow: var(--shadow);
}
.eyebrow { margin: 0 0 12px; color: var(--green); font-size: 11px; font-weight: 900; letter-spacing: .14em; }
.hero .eyebrow { color: var(--lime); }
.hero h1 { max-width: 980px; margin: 0; font-size: clamp(36px, 5vw, 72px); line-height: .98; letter-spacing: -.065em; }
.hero-copy { max-width: 850px; margin: 22px 0 0; color: #d2e4dc; font-size: clamp(16px, 1.5vw, 20px); line-height: 1.55; }
.hero-status {
  display: flex;
  gap: 11px;
  min-width: 220px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, .15);
  border-radius: 18px;
  background: rgba(255, 255, 255, .08);
}
.hero-status strong, .hero-status small { display: block; }
.hero-status small { margin-top: 4px; color: #b7ccc3; }
.status-dot { width: 10px; height: 10px; margin-top: 5px; border-radius: 50%; background: var(--lime); box-shadow: 0 0 0 6px rgba(200, 240, 93, .12); }

.studio-grid { display: grid; grid-template-columns: minmax(0, 1.65fr) minmax(300px, .7fr); gap: 22px; margin-top: 22px; align-items: start; }
.workspace, .evidence-column { min-width: 0; }
.evidence-column { position: sticky; top: 94px; }
.panel {
  margin-bottom: 20px;
  padding: clamp(20px, 3vw, 30px);
  border: 1px solid rgba(219, 230, 225, .95);
  border-radius: var(--radius);
  background: var(--card);
  box-shadow: 0 12px 36px rgba(7, 26, 22, .055);
}
.panel-heading { display: flex; justify-content: space-between; gap: 18px; align-items: center; margin-bottom: 20px; }
.panel-heading > div { display: flex; align-items: center; gap: 12px; }
.panel-heading h2, .event-title h2 { margin: 0; font-size: clamp(19px, 2vw, 25px); letter-spacing: -.035em; }
.panel-heading.compact { align-items: flex-start; }
.step-number { display: grid; width: 36px; height: 36px; place-items: center; border-radius: 12px; background: var(--forest); color: var(--lime); font-size: 12px; font-weight: 900; }
.privacy-pill, .visual-badge, .policy-pill { border-radius: 999px; padding: 7px 10px; font-size: 11px; font-weight: 850; }
.privacy-pill { background: #e9f7f0; color: #196547; }
.visual-badge { background: #eef2ff; color: #354e97; }
.policy-pill { background: #eaf6ef; color: var(--green); }

label { display: block; margin: 0 0 8px; color: var(--muted); font-size: 12px; font-weight: 850; letter-spacing: .055em; text-transform: uppercase; }
textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: #fbfdfc;
  color: var(--ink);
  outline: none;
}
textarea { min-height: 104px; padding: 16px; resize: vertical; font-size: 18px; line-height: 1.45; }
select { min-height: 52px; padding: 0 14px; }
textarea:focus, select:focus { border-color: var(--green); box-shadow: 0 0 0 4px rgba(11, 122, 83, .1); }
.form-row { display: grid; grid-template-columns: minmax(180px, 1fr) auto; gap: 12px; margin-top: 14px; }
.quick-questions { display: flex; flex-wrap: wrap; gap: 8px; margin-top: 17px; }
.quick-questions button, .outcome-actions button {
  border: 1px solid var(--line);
  border-radius: 999px;
  background: white;
  color: #385048;
  padding: 9px 12px;
  font-weight: 800;
  cursor: pointer;
}
.quick-questions button:hover, .outcome-actions button:hover { border-color: var(--green); color: var(--green); }

.visual-reason { margin: -10px 0 18px; color: var(--muted); line-height: 1.5; }
.visual-stage { min-height: 390px; border: 1px solid var(--line); border-radius: 20px; background: linear-gradient(180deg, #fbfdfc, #f3f8f5); overflow: hidden; }
.loading-state { display: grid; min-height: 390px; place-content: center; justify-items: center; color: var(--muted); }
.loading-state span { width: 34px; height: 34px; border: 3px solid #dce9e3; border-top-color: var(--green); border-radius: 50%; animation: spin .8s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }
.error-state { padding: 28px; color: #912f2b; }

.bars { padding: 22px; }
.bar-item { display: grid; grid-template-columns: minmax(100px, 180px) 1fr auto; gap: 12px; align-items: center; margin: 15px 0; }
.bar-item span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; font-size: 13px; font-weight: 750; }
.bar-track { height: 13px; overflow: hidden; border-radius: 999px; background: #e3ece7; }
.bar-track i { display: block; height: 100%; border-radius: inherit; background: linear-gradient(90deg, var(--green), #48b88c); }
.bar-item strong { min-width: 92px; text-align: right; font-size: 13px; }

.district-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; padding: 20px; }
.district-card { position: relative; min-height: 140px; padding: 18px; border: 1px solid var(--line); border-radius: 18px; overflow: hidden; background: white; }
.district-card::after { content: ""; position: absolute; right: -20px; bottom: -24px; width: var(--bubble-size); height: var(--bubble-size); border-radius: 50%; background: color-mix(in srgb, var(--green) 18%, transparent); }
.district-card strong, .district-card span, .district-card small { position: relative; z-index: 1; display: block; }
.district-card strong { font-size: 17px; }
.district-card span { margin-top: 18px; font-size: 28px; font-weight: 900; }
.district-card small { margin-top: 5px; color: var(--muted); }

.scatter-wrap { padding: 18px; }
.scatter-legend { display: flex; flex-wrap: wrap; gap: 14px; margin-bottom: 12px; color: var(--muted); font-size: 12px; }
.scatter { width: 100%; height: auto; min-height: 340px; }
.scatter text { font-family: inherit; fill: #536760; font-size: 10px; }
.scatter .grid-line { stroke: #dce7e2; stroke-width: 1; }
.scatter circle { stroke: white; stroke-width: 2; opacity: .9; }

.matrix-scroll { overflow-x: auto; }
.matrix { width: 100%; border-collapse: collapse; min-width: 680px; }
.matrix th, .matrix td { padding: 14px; border-bottom: 1px solid var(--line); text-align: left; }
.matrix th { background: #f2f7f4; color: var(--muted); font-size: 11px; letter-spacing: .06em; text-transform: uppercase; }
.matrix td:first-child { font-weight: 850; }
.score-chip { display: inline-flex; min-width: 42px; justify-content: center; border-radius: 999px; padding: 5px 8px; background: #ddf4e8; color: #176241; font-weight: 900; }

.recommendation-card { display: grid; grid-template-columns: 1fr auto; gap: 18px; padding: 22px; border: 1px solid #b9dfcf; border-radius: 20px; background: linear-gradient(135deg, #ecfaf3, #f7fbf9); }
.recommendation-card h3 { margin: 5px 0 7px; font-size: clamp(24px, 3vw, 34px); letter-spacing: -.045em; }
.recommendation-card p { margin: 0; color: var(--muted); }
.recommendation-rank { display: grid; width: 64px; height: 64px; place-items: center; border-radius: 18px; background: var(--forest); color: var(--lime); font-size: 22px; font-weight: 900; }
.recommendation-metrics { display: grid; grid-template-columns: repeat(4, minmax(0, 1fr)); gap: 10px; margin-top: 18px; }
.recommendation-metrics div { padding: 12px; border-radius: 14px; background: white; }
.recommendation-metrics span, .recommendation-metrics strong { display: block; }
.recommendation-metrics span { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.recommendation-metrics strong { margin-top: 5px; }
.policy-explanation { margin-top: 15px; padding: 13px 15px; border-left: 4px solid var(--green); border-radius: 12px; background: #f3f8f5; color: #3c554c; line-height: 1.5; }
.outcome-actions { display: flex; align-items: center; flex-wrap: wrap; gap: 9px; margin-top: 16px; }
.outcome-actions span { margin-right: auto; color: var(--muted); font-weight: 750; }

.phase-card { padding: 17px; border-radius: 18px; background: var(--forest); color: white; }
.phase-card span, .phase-card strong { display: block; }
.phase-card span { color: #a9c1b7; font-size: 11px; font-weight: 850; text-transform: uppercase; }
.phase-card strong { margin: 7px 0; color: var(--lime); font-size: 27px; }
.phase-card p { margin: 0; color: #d2e3db; line-height: 1.45; font-size: 13px; }
.metric-block { margin-top: 20px; }
.metric-label { display: flex; justify-content: space-between; gap: 12px; font-size: 13px; }
.metric-label span { color: var(--muted); }
.progress { height: 9px; margin: 9px 0 7px; overflow: hidden; border-radius: 999px; background: #e2ebe6; }
.progress i { display: block; width: 0; height: 100%; border-radius: inherit; background: var(--green); transition: width .5s ease; }
.progress.challenger i { background: var(--blue); }
.metric-block small { color: var(--muted); }
.guardrail { margin-top: 22px; padding-top: 18px; border-top: 1px solid var(--line); }
.guardrail span, .guardrail strong { display: block; }
.guardrail span { color: var(--muted); font-size: 11px; font-weight: 850; text-transform: uppercase; }
.guardrail strong { margin-top: 5px; }
.guardrail p { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.45; }

.ai-decision { background: linear-gradient(145deg, #fffdf6, white); }
.ai-decision h2 { margin: 0 0 17px; font-size: 26px; letter-spacing: -.04em; }
.decision-compare { display: grid; grid-template-columns: 1fr 1fr; gap: 9px; }
.decision-compare div { padding: 13px; border: 1px solid var(--line); border-radius: 14px; background: white; }
.decision-compare span, .decision-compare strong, .decision-compare small { display: block; }
.decision-compare span { color: var(--muted); font-size: 10px; font-weight: 850; text-transform: uppercase; }
.decision-compare strong { margin: 7px 0; font-size: 14px; }
.decision-compare small { color: var(--muted); }
.decision-note { margin-bottom: 0; color: var(--muted); font-size: 13px; line-height: 1.5; }

.event-title { display: flex; justify-content: space-between; gap: 12px; }
.event-title span { display: grid; min-width: 30px; height: 30px; place-items: center; border-radius: 999px; background: var(--forest); color: var(--lime); font-weight: 900; }
#eventLedger { display: grid; gap: 9px; max-height: 260px; margin: 17px 0 0; padding: 0; overflow-y: auto; list-style: none; }
#eventLedger li { display: grid; grid-template-columns: 8px 1fr auto; gap: 9px; align-items: center; padding: 10px; border-radius: 12px; background: #f4f8f6; font-size: 12px; }
#eventLedger li::before { content: ""; width: 7px; height: 7px; border-radius: 50%; background: var(--green); }
#eventLedger time { color: var(--muted); }
#eventLedger .empty-event { display: block; color: var(--muted); }
#eventLedger .empty-event::before { display: none; }

.registry-section { margin-top: 34px; padding: clamp(24px, 4vw, 42px); border-radius: 30px; background: white; border: 1px solid var(--line); }
.registry-section > h2 { margin: 0 0 24px; font-size: clamp(28px, 4vw, 48px); letter-spacing: -.055em; }
.registry-grid { display: grid; grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
.registry-grid article { padding: 20px; border: 1px solid var(--line); border-radius: 18px; background: #fbfdfc; }
.registry-icon { display: grid; width: 42px; height: 42px; place-items: center; border-radius: 13px; background: var(--forest); color: var(--lime); font-weight: 900; }
.registry-grid h3 { min-height: 48px; margin: 17px 0 8px; font-size: 17px; }
.registry-grid strong { color: var(--green); }
.registry-grid p { margin-bottom: 0; color: var(--muted); line-height: 1.45; font-size: 13px; }

dialog { width: min(520px, calc(100% - 28px)); border: 0; border-radius: 24px; padding: 28px; color: var(--ink); box-shadow: 0 30px 90px rgba(7, 26, 22, .32); }
dialog::backdrop { background: rgba(7, 26, 22, .66); backdrop-filter: blur(5px); }
.dialog-close { float: right; border: 0; background: #eef4f1; border-radius: 10px; width: 34px; height: 34px; cursor: pointer; font-size: 20px; }
dialog h2 { font-size: 30px; letter-spacing: -.045em; }
dialog li { margin: 12px 0; line-height: 1.5; }

@media (max-width: 1100px) {
  .topbar { grid-template-columns: 1fr auto; }
  .topbar nav { display: none; }
  .studio-grid { grid-template-columns: 1fr; }
  .evidence-column { position: static; display: grid; grid-template-columns: 1fr 1fr; gap: 18px; }
  .event-panel { grid-column: 1 / -1; }
  .registry-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

@media (max-width: 720px) {
  main { width: min(100% - 20px, 1480px); padding-top: 10px; }
  .topbar { min-height: 64px; padding: 9px 12px; }
  .brand small { display: none; }
  .install-button { padding: 10px 12px; }
  .hero { grid-template-columns: 1fr; gap: 24px; padding: 28px 22px; border-radius: 24px; }
  .hero h1 { font-size: 40px; }
  .hero-status { min-width: 0; }
  .panel { padding: 18px; border-radius: 20px; }
  .panel-heading { align-items: flex-start; }
  .privacy-pill { display: none; }
  .form-row { grid-template-columns: 1fr; }
  .primary-button { width: 100%; }
  .visual-stage, .loading-state { min-height: 330px; }
  .district-grid { grid-template-columns: 1fr 1fr; padding: 12px; }
  .bar-item { grid-template-columns: 92px 1fr; }
  .bar-item strong { grid-column: 2; text-align: left; }
  .recommendation-card { grid-template-columns: 1fr; }
  .recommendation-rank { width: 52px; height: 52px; }
  .recommendation-metrics { grid-template-columns: 1fr 1fr; }
  .evidence-column { grid-template-columns: 1fr; }
  .event-panel { grid-column: auto; }
  .registry-grid { grid-template-columns: 1fr; }
  .registry-grid h3 { min-height: 0; }
}

@media (prefers-reduced-motion: reduce) {
  *, *::before, *::after { scroll-behavior: auto !important; animation-duration: .01ms !important; transition-duration: .01ms !important; }
}

