:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #60716a;
  --line: #d7dfd8;
  --panel: #fbfcf8;
  --soft: #eef3ea;
  --green: #266f48;
  --green-2: #70a35a;
  --gold: #bf8a31;
  --blue: #356c8a;
  --red: #a94732;
  --bg: #e8eee7;
  --shadow: 0 18px 50px rgba(39, 55, 45, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input {
  font: inherit;
}

button {
  cursor: pointer;
}

.shell {
  display: grid;
  grid-template-columns: minmax(280px, 340px) minmax(0, 1fr);
  min-height: 100vh;
}

.rail {
  padding: 24px;
  border-right: 1px solid var(--line);
  background: #f7f9f2;
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 2px 0 8px;
}

.mark {
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  background: var(--ink);
  color: #f4f7ef;
  font-weight: 800;
}

.brand p,
.topbar p,
.hero-copy p {
  margin: 0 0 3px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0;
  text-transform: uppercase;
}

.brand h1 {
  margin: 0;
  font-size: 18px;
  line-height: 1.1;
}

.workspace {
  min-width: 0;
  padding: 24px;
}

.topbar {
  min-height: 54px;
  display: flex;
  justify-content: space-between;
  gap: 18px;
  align-items: center;
  margin-bottom: 18px;
}

.topbar h2 {
  margin: 0;
  font-size: 26px;
  line-height: 1.15;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}

.scenario,
.tabs {
  display: inline-flex;
  gap: 4px;
  padding: 4px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.55);
}

.scenario-btn,
.tab {
  min-height: 36px;
  border: 0;
  border-radius: 6px;
  padding: 0 14px;
  color: var(--muted);
  background: transparent;
  font-weight: 700;
}

.scenario-btn.active,
.tab.active {
  color: #f8fbf5;
  background: var(--ink);
}

.user-menu {
  min-height: 46px;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 12px 6px 7px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.62);
}

.avatar {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #f8fbf5;
  background: var(--green);
  font-size: 12px;
  font-weight: 900;
}

.user-menu span,
.user-menu strong {
  display: block;
  white-space: nowrap;
}

.user-menu span {
  color: var(--muted);
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
}

.user-menu strong {
  font-size: 14px;
}

.panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: var(--shadow);
}

.rail .panel {
  box-shadow: none;
}

.section-title {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  align-items: center;
  padding: 16px 16px 12px;
  border-bottom: 1px solid var(--line);
}

.section-title span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.section-title strong {
  color: var(--green);
  font-size: 13px;
}

.doc {
  display: flex;
  gap: 10px;
  padding: 13px 16px;
  border-bottom: 1px solid var(--line);
}

.doc:last-child {
  border-bottom: 0;
}

.doc > span {
  flex: 0 0 auto;
  width: 38px;
  height: 28px;
  display: grid;
  place-items: center;
  border-radius: 6px;
  color: #f8fbf5;
  background: var(--blue);
  font-size: 11px;
  font-weight: 800;
}

.doc.active > span {
  background: var(--green);
}

.doc strong,
.doc small {
  display: block;
}

.doc strong {
  font-size: 14px;
}

.doc small,
.facts dd {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.35;
}

.facts {
  margin: 0;
  padding: 4px 16px 16px;
}

.facts div {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 10px;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.facts div:last-child {
  border-bottom: 0;
}

.facts dt,
.facts dd {
  margin: 0;
}

.facts dt {
  color: var(--ink);
  font-size: 12px;
  font-weight: 800;
}

.hero {
  position: relative;
  min-height: 280px;
  overflow: hidden;
  border-radius: 8px;
  background: #1d2a25;
  box-shadow: var(--shadow);
}

.hero img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  opacity: 0.9;
}

.hero::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, rgba(9, 20, 15, 0.82), rgba(9, 20, 15, 0.3) 58%, rgba(9, 20, 15, 0.08));
}

.hero-copy,
.score-card {
  position: absolute;
  z-index: 1;
}

.hero-copy {
  left: clamp(20px, 4vw, 42px);
  bottom: 34px;
  max-width: 660px;
  color: #f8fbf5;
}

.hero-copy p {
  color: #b9d1c4;
}

.hero-copy h3 {
  margin: 0 0 10px;
  font-size: clamp(28px, 4vw, 50px);
  line-height: 1.02;
}

.hero-copy span {
  display: block;
  max-width: 620px;
  color: #e0ece3;
  font-size: 15px;
  line-height: 1.45;
}

.score-card {
  right: 22px;
  top: 22px;
  width: 156px;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  background: rgba(248, 251, 245, 0.9);
}

.score-card span,
.score-card small {
  display: block;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.score-card strong {
  display: block;
  margin: 4px 0;
  color: var(--green);
  font-size: 54px;
  line-height: 0.95;
}

.tabs {
  margin: 18px 0;
}

.view {
  display: none;
}

.view.active {
  display: block;
}

.grid {
  display: grid;
  gap: 16px;
}

.grid.two {
  grid-template-columns: repeat(2, minmax(0, 1fr));
}

.thesis,
.trace,
#frameworkEvidence {
  margin: 0;
  padding: 14px 18px 18px 34px;
}

.thesis li,
#frameworkEvidence li {
  margin: 0 0 10px;
  color: var(--muted);
  line-height: 1.45;
}

.thesis strong {
  color: var(--ink);
}

.trace {
  list-style: none;
  padding-left: 18px;
}

.trace li {
  position: relative;
  margin: 0 0 14px;
  padding-left: 22px;
  color: var(--muted);
  line-height: 1.35;
}

.trace li span {
  position: absolute;
  left: 0;
  top: 4px;
  width: 10px;
  height: 10px;
  border-radius: 999px;
  background: var(--green-2);
}

.metrics {
  display: grid;
  grid-template-columns: repeat(6, minmax(120px, 1fr));
  gap: 12px;
  margin-top: 16px;
}

.metric {
  min-height: 120px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
}

.metric span,
.investor span,
.gap span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin: 8px 0;
  font-size: 32px;
}

.metric small {
  color: var(--muted);
  line-height: 1.35;
}

.framework-layout,
.capital-layout {
  display: grid;
  grid-template-columns: minmax(260px, 360px) minmax(0, 1fr);
  gap: 16px;
}

.framework-list {
  display: grid;
  gap: 10px;
}

.framework-item {
  width: 100%;
  display: flex;
  justify-content: space-between;
  align-items: center;
  min-height: 64px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--ink);
  background: var(--panel);
  text-align: left;
}

.framework-item.active {
  border-color: var(--green);
  background: #edf5e9;
}

.framework-item span {
  color: var(--muted);
  font-size: 12px;
  font-weight: 800;
}

.framework-detail {
  min-height: 364px;
}

.framework-detail p {
  margin: 0;
  padding: 18px 18px 6px;
  color: var(--muted);
  line-height: 1.5;
}

.bar {
  height: 12px;
  margin: 12px 18px;
  overflow: hidden;
  border-radius: 999px;
  background: var(--soft);
}

.bar span {
  display: block;
  height: 100%;
  width: 0;
  border-radius: inherit;
  background: linear-gradient(90deg, var(--gold), var(--green));
  transition: width 220ms ease;
}

.chips {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 4px 18px 8px;
}

.chip {
  padding: 7px 10px;
  border-radius: 999px;
  color: var(--green);
  background: #e7f1e3;
  font-size: 12px;
  font-weight: 800;
}

.framework-detail h4 {
  margin: 12px 18px 0;
  font-size: 14px;
}

.gap-list,
.investors,
.timeline {
  padding: 14px;
}

.gap {
  display: grid;
  grid-template-columns: 1fr auto;
  gap: 10px;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.gap + .gap,
.investor + .investor,
.timeline div + div {
  margin-top: 10px;
}

.gap strong,
.gap p,
.investor strong,
.investor p,
.timeline p {
  margin: 0;
}

.gap p,
.investor p,
.timeline p,
.memo p {
  color: var(--muted);
  line-height: 1.45;
}

.gap button {
  width: 34px;
  height: 34px;
  border: 1px solid var(--line);
  border-radius: 8px;
  color: var(--green);
  background: var(--soft);
  font-weight: 900;
}

.gap.closed {
  opacity: 0.58;
}

.gap.closed button {
  color: #fff;
  background: var(--green);
}

.memo {
  display: flex;
  flex-direction: column;
}

.memo p {
  margin: 0;
  padding: 18px;
}

.memo-actions {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-top: auto;
  padding: 0 18px 18px;
}

.memo-actions button {
  border: 0;
  border-radius: 8px;
  padding: 10px 14px;
  color: #f8fbf5;
  background: var(--ink);
  font-weight: 800;
}

#copyState {
  color: var(--green);
  font-size: 13px;
  font-weight: 800;
}

.investor {
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fff;
}

.investor header {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-bottom: 8px;
}

.probability {
  flex: 0 0 auto;
  color: #fff;
  border-radius: 999px;
  padding: 5px 8px;
  font-size: 12px;
  font-weight: 800;
}

.probability.high {
  background: var(--green);
}

.probability.medium {
  background: var(--gold);
}

.probability.low {
  background: var(--red);
}

.timeline div {
  display: grid;
  grid-template-columns: 42px 1fr;
  gap: 12px;
  padding: 12px;
  border-radius: 8px;
  background: #fff;
  border: 1px solid var(--line);
}

.timeline span {
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  color: #fff;
  background: var(--blue);
  font-size: 12px;
  font-weight: 900;
}

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

  .workspace {
    order: 1;
  }

  .rail {
    order: 2;
  }

  .rail {
    border-right: 0;
    border-bottom: 1px solid var(--line);
  }

  .metrics {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 760px) {
  .workspace,
  .rail {
    padding: 16px;
  }

  .topbar,
  .grid.two,
  .framework-layout,
  .capital-layout {
    grid-template-columns: 1fr;
    display: grid;
  }

  .topbar {
    align-items: stretch;
  }

  .topbar-actions {
    display: grid;
    gap: 8px;
  }

  .scenario,
  .tabs {
    width: 100%;
    overflow-x: auto;
  }

  .user-menu {
    justify-content: flex-start;
    width: 100%;
  }

  .scenario-btn,
  .tab {
    flex: 1 0 auto;
  }

  .hero {
    min-height: 430px;
  }

  .hero::after {
    background: linear-gradient(180deg, rgba(9, 20, 15, 0.35), rgba(9, 20, 15, 0.84));
  }

  .score-card {
    left: auto;
    right: 18px;
    top: 18px;
  }

  .hero-copy {
    left: 18px;
    right: 18px;
    bottom: 22px;
  }

  .hero-copy h3 {
    font-size: 32px;
  }

  .metrics {
    grid-template-columns: 1fr 1fr;
  }
}

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

  .facts div {
    grid-template-columns: 1fr;
    gap: 2px;
  }
}
