:root {
  color-scheme: light;
  --bg: #f5f7f2;
  --ink: #07100c;
  --muted: #748078;
  --soft: #eef2ec;
  --panel: #ffffff;
  --line: #dde5dd;
  --lime: #b9ff2c;
  --lime-strong: #91ef00;
  --green: #073b28;
  --gold: #b77b00;
  --pink: #ffd7df;
  --red: #db564b;
  --shadow: 0 20px 70px rgba(23, 38, 30, 0.1);
  --control-height: 48px;
}

* {
  box-sizing: border-box;
}

body {
  background:
    radial-gradient(circle at 76% 16%, rgba(185, 255, 44, 0.1), transparent 18rem),
    linear-gradient(180deg, #f7f9f5 0%, var(--bg) 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  letter-spacing: 0;
  margin: 0;
  min-height: 100vh;
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.app-shell {
  margin: 0 auto;
  max-width: 1540px;
  min-height: 100vh;
  padding: 28px clamp(20px, 4vw, 52px) 52px;
}

.topbar {
  align-items: center;
  border-bottom: 1px solid var(--line);
  display: flex;
  justify-content: space-between;
  padding-bottom: 24px;
}

.brand {
  align-items: center;
  display: flex;
  gap: 14px;
}

.brand-mark {
  align-items: center;
  background: var(--ink);
  border-radius: 10px;
  color: var(--lime);
  display: grid;
  font-size: 1.45rem;
  font-weight: 900;
  height: 44px;
  place-items: center;
  transform: rotate(-3deg);
  width: 44px;
}

.brand strong {
  display: block;
  font-size: 1.15rem;
  line-height: 1;
}

.brand span,
.status-pill span,
.eyebrow,
.card-label,
.fine-print {
  color: var(--muted);
}

.brand span,
.eyebrow,
.card-label {
  font-size: 0.76rem;
  font-weight: 820;
  letter-spacing: 0.18em;
  text-transform: uppercase;
}

.status-pill {
  align-items: center;
  display: flex;
  gap: 10px;
  font-size: 0.88rem;
}

.status-dot {
  background: var(--lime-strong);
  border-radius: 50%;
  box-shadow: 0 0 0 6px rgba(145, 239, 0, 0.12);
  height: 9px;
  width: 9px;
}

.hero {
  align-items: center;
  display: grid;
  gap: 28px;
  grid-template-columns: minmax(0, 1fr) 280px;
  min-height: 350px;
  padding: 44px 0 34px;
}

.eyebrow,
.card-label,
.fine-print {
  margin: 0;
}

h1,
h2 {
  line-height: 0.96;
  margin: 0;
}

h1 {
  font-size: clamp(3.5rem, 8vw, 7.2rem);
  font-weight: 900;
  max-width: 880px;
  text-wrap: balance;
}

h2 {
  font-size: 1.8rem;
}

.hero-copy {
  color: var(--muted);
  font-size: clamp(1.05rem, 1.8vw, 1.45rem);
  line-height: 1.45;
  margin: 28px 0 0;
  max-width: 700px;
}

.refresh-orbit {
  align-items: center;
  background: transparent;
  border: 0;
  color: var(--ink);
  display: grid;
  gap: 14px;
  justify-items: center;
  justify-self: center;
  min-height: 250px;
  position: relative;
  width: 250px;
}

.refresh-orbit::before,
.refresh-orbit::after {
  border: 1px solid #d5ded5;
  border-radius: 50%;
  content: "";
  height: 210px;
  left: 20px;
  position: absolute;
  top: 4px;
  width: 210px;
}

.refresh-orbit::after {
  border-style: dashed;
  height: 150px;
  left: 50px;
  top: 34px;
  width: 150px;
}

.refresh-orbit strong {
  align-items: center;
  background: var(--green);
  border-radius: 50%;
  color: var(--lime);
  display: grid;
  font-size: 2.35rem;
  height: 108px;
  margin-top: 30px;
  place-items: center;
  position: relative;
  width: 108px;
  z-index: 1;
}

.refresh-orbit small {
  color: var(--muted);
  font-size: 0.75rem;
  font-weight: 900;
  letter-spacing: 0.16em;
  position: relative;
  text-transform: uppercase;
  z-index: 1;
}

.orbit-dot {
  border-radius: 50%;
  height: 12px;
  position: absolute;
  width: 12px;
  z-index: 2;
}

.orbit-dot-a {
  background: var(--lime-strong);
  left: 54px;
  top: 36px;
}

.orbit-dot-b {
  background: var(--ink);
  bottom: 82px;
  right: 46px;
}

.bot-strip {
  align-items: center;
  display: flex;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 24px;
}

.bot-chip,
.nav-tabs {
  align-items: center;
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 14px;
  box-shadow: 0 10px 30px rgba(23, 38, 30, 0.06);
  display: flex;
}

.bot-chip {
  color: var(--muted);
  gap: 14px;
  min-height: 66px;
  padding: 0 20px;
}

.bot-chip.active {
  background: var(--ink);
  border-color: var(--ink);
  color: var(--panel);
}

.chip-icon {
  align-items: center;
  background: var(--soft);
  border-radius: 9px;
  color: var(--ink);
  display: grid;
  font-weight: 900;
  height: 36px;
  place-items: center;
  width: 36px;
}

.bot-chip.active .chip-icon {
  background: var(--panel);
}

.bot-chip strong {
  font-size: 1rem;
}

.bot-chip em {
  background: #e8eee7;
  border-radius: 999px;
  color: var(--muted);
  font-size: 0.65rem;
  font-style: normal;
  font-weight: 900;
  padding: 6px 8px;
}

.bot-chip.active em {
  background: var(--lime);
  color: var(--ink);
}

.nav-tabs {
  margin-left: auto;
  padding: 4px;
}

.nav-tab {
  background: transparent;
  border: 0;
  border-radius: 10px;
  color: var(--muted);
  min-height: 44px;
  padding: 0 16px;
}

.nav-tab.active {
  background: var(--lime);
  color: var(--ink);
  font-weight: 800;
}

.view {
  display: none;
}

.view.active {
  display: grid;
  gap: 18px;
}

#calculator-view {
  grid-template-columns: 1fr;
}

.control-panel,
.result-card,
.table-card {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 18px;
  box-shadow: var(--shadow);
}

.calculator-flow {
  display: grid;
  gap: 18px;
  grid-template-columns: 1fr;
}

.calculator-top-row,
.calculator-epc-row,
.chart-row {
  align-items: stretch;
  display: grid;
  gap: 18px;
}

.calculator-top-row {
  grid-template-columns: minmax(300px, 0.85fr) minmax(420px, 1.15fr);
}

.calculator-epc-row {
  grid-template-columns: minmax(280px, 0.95fr) minmax(260px, 0.8fr) minmax(360px, 1.25fr);
}

.control-panel {
  align-self: stretch;
  display: grid;
  gap: 16px;
  grid-template-rows: auto;
  padding: 24px;
}

.control-panel h2,
.recommendation-heading h2 {
  font-size: clamp(1.35rem, 2vw, 2rem);
  line-height: 1.04;
  margin-top: 10px;
}

.field-row {
  display: grid;
  gap: 12px;
  grid-template-columns: 1fr 1fr;
}

label {
  color: var(--muted);
  display: grid;
  gap: 8px;
  font-size: 0.82rem;
  font-weight: 760;
}

.optional-panel .field-row label {
  align-content: start;
  grid-template-rows: minmax(34px, auto) auto;
}

.optional-panel .field-row label > span {
  line-height: 1.25;
}

input,
select {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 10px;
  color: var(--ink);
  height: var(--control-height);
  min-height: var(--control-height);
  outline: 0;
  padding: 0 12px;
  width: 100%;
}

input:focus,
select:focus {
  border-color: var(--lime-strong);
  box-shadow: 0 0 0 4px rgba(145, 239, 0, 0.18);
}

.input-suffix {
  align-items: center;
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 10px;
  display: flex;
  height: var(--control-height);
  min-height: var(--control-height);
  overflow: hidden;
}

.input-suffix input {
  background: transparent;
  border: 0;
  box-shadow: none;
}

.input-suffix span {
  color: var(--muted);
  padding-right: 12px;
}

.primary-action {
  background: var(--lime);
  border: 0;
  border-radius: 12px;
  color: var(--ink);
  font-weight: 900;
  height: 52px;
  min-height: 52px;
}

.fine-print {
  font-size: 0.78rem;
  line-height: 1.4;
}

.results-grid {
  display: grid;
  gap: 18px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.result-card,
.table-card {
  height: 100%;
  padding: 24px;
}

.result-card.highlight {
  background: #f0f4ee;
}

.result-card.fit-good {
  background: var(--lime);
}

.result-card.fit-bad {
  background: var(--pink);
}

.result-card-heading {
  align-items: center;
  display: flex;
  gap: 12px;
  justify-content: space-between;
}

.fit-label {
  background: rgba(7, 16, 12, 0.08);
  border-radius: 999px;
  color: rgba(7, 16, 12, 0.72);
  font-size: 0.72rem;
  font-weight: 900;
  padding: 8px 10px;
  text-transform: uppercase;
  white-space: nowrap;
}

.fit-good .fit-label {
  background: rgba(7, 16, 12, 0.12);
}

.fit-bad .fit-label {
  background: rgba(219, 86, 75, 0.14);
  color: #8e1f19;
}

.recommendation-card {
  background:
    radial-gradient(circle at 88% 10%, rgba(255, 255, 255, 0.42), transparent 12rem),
    var(--lime);
  display: grid;
  gap: 16px;
  position: relative;
}

.recommendation-heading {
  align-items: start;
  display: flex;
  gap: 18px;
  justify-content: space-between;
}

.recommendation-heading > span {
  align-items: center;
  background: rgba(7, 16, 12, 0.08);
  border-radius: 999px;
  color: rgba(7, 16, 12, 0.7);
  display: inline-flex;
  font-size: 0.74rem;
  font-weight: 860;
  gap: 8px;
  padding: 8px 10px;
  text-align: right;
}

.recommendation-card.is-loading .recommendation-heading > span::before {
  animation: spin 0.8s linear infinite;
  border: 2px solid rgba(7, 16, 12, 0.16);
  border-top-color: var(--ink);
  border-radius: 50%;
  content: "";
  height: 12px;
  width: 12px;
}

.result-card > strong,
#effective-profit {
  color: var(--ink);
  display: block;
  font-size: clamp(2.2rem, 4vw, 4rem);
  line-height: 1;
  margin-top: 18px;
}

.result-card > span {
  color: var(--muted);
  display: block;
  margin-top: 14px;
}

.highlight > span,
.highlight .card-label {
  color: rgba(7, 16, 12, 0.62);
}

.stacked-text {
  color: var(--ink);
  display: grid;
  gap: 10px;
  line-height: 1.45;
  margin-top: 16px;
}

.stacked-text strong {
  display: inline;
  font-size: 1rem;
  margin: 0;
}

.effective-divider {
  background: rgba(7, 16, 12, 0.12);
  height: 1px;
  margin: 18px 0 0;
}

.effective-current {
  margin-top: 16px;
}

.effective-current .stacked-text {
  margin-top: 10px;
}

.insight-card {
  display: grid;
  gap: 16px;
}

.drawdown-card {
  grid-column: 1 / -1;
}

.drawdown-card h2 {
  font-size: clamp(1.45rem, 2vw, 2rem);
  margin-top: 10px;
}

.drawdown-chart {
  display: grid;
  gap: 16px;
  margin-top: 18px;
}

.drawdown-summary {
  display: grid;
  gap: 12px;
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.drawdown-summary > div,
.empty-chart {
  background: #fbfcfa;
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 14px;
}

.drawdown-summary span,
.empty-chart span {
  color: var(--muted);
  display: block;
  font-size: 0.78rem;
  font-weight: 760;
}

.drawdown-summary strong,
.empty-chart strong {
  color: var(--ink);
  display: block;
  font-size: 1.28rem;
  line-height: 1.1;
  margin-top: 8px;
}

.empty-chart {
  min-height: 154px;
}

.empty-chart span {
  line-height: 1.45;
  margin-top: 8px;
}

.drawdown-scroll {
  overflow-x: auto;
  padding-bottom: 4px;
}

.drawdown-svg {
  display: block;
  min-width: 760px;
  width: 100%;
}

.chart-bg {
  fill: #fbfcfa;
  stroke: var(--line);
}

.price-level line {
  stroke: #dbe4db;
  stroke-width: 1;
}

.price-level.current line {
  stroke: var(--ink);
  stroke-width: 2;
}

.coverage-arrow {
  stroke: var(--lime-strong);
  stroke-linecap: round;
  stroke-width: 4;
}

.arrow-head {
  fill: var(--lime-strong);
}

.price-level text {
  fill: var(--muted);
  font-size: 13px;
  font-weight: 780;
}

.price-level.current text {
  fill: var(--ink);
  font-weight: 900;
}

.coverage-label {
  fill: var(--green);
  font-size: 14px;
  font-weight: 860;
}

.drawdown-arrow-label {
  fill: var(--green);
  font-size: 13px;
  font-weight: 900;
}

.settings-list {
  display: grid;
  gap: 0;
  margin-top: 16px;
}

.featured-settings {
  background: rgba(255, 255, 255, 0.48);
  border: 1px solid rgba(7, 16, 12, 0.1);
  border-radius: 14px;
  margin-top: 0;
  overflow: hidden;
}

.setting-row {
  align-items: center;
  border-bottom: 1px solid rgba(7, 16, 12, 0.1);
  display: flex;
  gap: 12px;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
}

.setting-row span {
  color: rgba(7, 16, 12, 0.58);
}

.setting-row strong {
  color: var(--ink);
  font-size: 1.08rem;
  margin: 0;
  text-align: right;
}

.setting-value {
  align-items: center;
  display: flex;
  gap: 8px;
  min-width: 0;
}

.copy-setting {
  align-items: center;
  background: rgba(7, 16, 12, 0.08);
  border: 0;
  border-radius: 8px;
  color: rgba(7, 16, 12, 0.68);
  display: inline-grid;
  flex: 0 0 auto;
  height: 30px;
  justify-items: center;
  padding: 0;
  position: relative;
  width: 30px;
}

.copy-setting:hover,
.copy-setting.copied {
  background: var(--ink);
  color: var(--lime);
}

.copy-setting svg {
  fill: none;
  height: 16px;
  stroke: currentColor;
  stroke-linecap: round;
  stroke-linejoin: round;
  stroke-width: 2;
  width: 16px;
}

.loading-row {
  align-items: center;
  border-bottom: 1px solid rgba(7, 16, 12, 0.1);
  display: flex;
  justify-content: space-between;
  min-height: 44px;
  padding: 0 14px;
}

.loading-row span,
.loading-row strong {
  animation: shimmer 1s ease-in-out infinite alternate;
  background: rgba(7, 16, 12, 0.14);
  border-radius: 999px;
  display: block;
  height: 12px;
}

.loading-row span {
  width: 34%;
}

.loading-row strong {
  width: 24%;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes shimmer {
  from {
    opacity: 0.38;
  }

  to {
    opacity: 0.9;
  }
}

.notice {
  color: var(--gold);
  font-weight: 760;
}

.table-card {
  display: grid;
  gap: 18px;
}

.table-heading {
  align-items: center;
  display: flex;
  justify-content: space-between;
}

.table-heading span {
  color: var(--muted);
  font-size: 0.9rem;
  font-weight: 760;
}

.table-wrap {
  overflow-x: auto;
}

table {
  border-collapse: collapse;
  min-width: 780px;
  width: 100%;
}

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 16px 10px;
  text-align: left;
  white-space: nowrap;
}

th {
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 900;
  letter-spacing: 0.08em;
  text-transform: uppercase;
}

.sort-header {
  align-items: center;
  background: transparent;
  border: 0;
  color: inherit;
  cursor: pointer;
  display: inline-flex;
  font: inherit;
  gap: 6px;
  letter-spacing: inherit;
  padding: 0;
  text-transform: inherit;
}

.sort-header:hover,
.sort-header.active {
  color: var(--ink);
}

.sort-indicator {
  color: var(--lime-strong);
  display: inline-block;
  font-size: 0.78rem;
  line-height: 1;
  min-width: 10px;
}

td {
  color: var(--ink);
  font-size: 0.92rem;
  font-weight: 740;
}

@media (max-width: 960px) {
  .hero {
    grid-template-columns: 1fr;
    min-height: auto;
  }

  .refresh-orbit {
    justify-self: start;
  }

  #calculator-view,
  .calculator-flow,
  .calculator-top-row,
  .calculator-epc-row,
  .results-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 680px) {
  .app-shell {
    padding: 18px;
  }

  .topbar,
  .field-row,
  .drawdown-summary {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
  }

  .status-pill {
    justify-content: space-between;
  }

  h1 {
    font-size: clamp(3rem, 17vw, 4.8rem);
  }

  .bot-strip,
  .nav-tabs {
    align-items: stretch;
    display: grid;
    grid-template-columns: 1fr;
    width: 100%;
  }

  .nav-tabs {
    margin-left: 0;
  }

  .nav-tab {
    width: 100%;
  }

  .refresh-orbit {
    display: none;
  }
}
