:root {
  color-scheme: light;
  --ink: #14201c;
  --muted: #5f6f67;
  --panel: #ffffff;
  --line: #d8e1dc;
  --wash: #edf3f0;
  --brand: #176b54;
  --brand-dark: #10251f;
  --accent: #d88c32;
  --blue: #426d9f;
  --shadow: 0 14px 40px rgba(16, 37, 31, 0.1);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: linear-gradient(180deg, #f7faf8 0%, #e8efec 100%);
  color: var(--ink);
  font-family:
    Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select {
  font: inherit;
}

button,
select {
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--brand);
  color: #ffffff;
  cursor: pointer;
}

button {
  padding: 0 16px;
  font-weight: 700;
}

button.secondary,
select {
  background: #ffffff;
  color: var(--ink);
}

.app-header,
main {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
}

.app-header {
  display: flex;
  justify-content: space-between;
  gap: 24px;
  padding: 32px 0 20px;
}

.app-header h1 {
  max-width: 760px;
  margin: 0;
  font-size: clamp(32px, 6vw, 56px);
  line-height: 1.02;
}

.app-header p {
  margin: 10px 0 0;
  color: var(--muted);
  font-size: 18px;
}

.eyebrow {
  margin: 0 0 8px !important;
  color: var(--accent) !important;
  font-size: 13px !important;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

.header-actions {
  display: grid;
  grid-template-columns: repeat(2, minmax(110px, 1fr));
  gap: 10px;
  align-self: start;
}

.header-actions label {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
}

.header-actions select {
  padding: 0 12px;
}

.toolbar,
.panel,
.scenario-card,
.summary-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.9);
  box-shadow: var(--shadow);
}

.toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  padding: 12px;
}

.toolbar div {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.scenario-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 14px;
  margin-top: 14px;
}

.scenario-card {
  padding: 16px;
}

.card-top {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.card-top h2,
.panel-heading h2 {
  margin: 0;
  font-size: 20px;
  line-height: 1.2;
}

.icon-button {
  width: 42px;
  padding: 0;
  background: #fff7ef;
  color: #a74d11;
  font-size: 22px;
}

.field-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 10px;
}

.field {
  display: grid;
  gap: 6px;
}

.field span {
  min-height: 32px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.input-shell {
  display: flex;
  align-items: center;
  min-height: 44px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
}

.input-shell input {
  width: 100%;
  min-width: 0;
  border: 0;
  outline: 0;
  padding: 10px 8px 10px 10px;
  background: transparent;
  color: var(--ink);
}

.input-shell em {
  flex: 0 0 auto;
  padding-right: 10px;
  color: var(--muted);
  font-size: 12px;
  font-style: normal;
  font-weight: 700;
}

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

.summary-card {
  padding: 16px;
}

.summary-card span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 800;
}

.summary-card strong {
  display: block;
  margin-top: 8px;
  color: var(--blue);
  font-size: 22px;
}

.panel {
  margin-top: 14px;
  padding: 16px;
}

.panel-heading {
  display: flex;
  justify-content: space-between;
  align-items: end;
  gap: 16px;
  margin-bottom: 12px;
}

.panel-heading p {
  margin: 0;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

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

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

th,
td {
  border-bottom: 1px solid var(--line);
  padding: 12px 10px;
  text-align: right;
  vertical-align: top;
}

th:first-child,
td:first-child {
  text-align: left;
}

thead th {
  color: var(--muted);
  font-size: 12px;
  line-height: 1.2;
}

tbody th,
tbody td {
  font-size: 14px;
}

th small {
  display: block;
  margin-top: 4px;
  color: var(--accent);
  font-weight: 800;
}

.formula-list {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
  gap: 10px;
}

.formula-list article {
  display: grid;
  gap: 8px;
  min-height: 86px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: var(--wash);
}

.formula-list span {
  font-weight: 800;
}

code {
  overflow-wrap: anywhere;
  color: var(--brand-dark);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 13px;
}

@media (max-width: 760px) {
  .app-header {
    display: grid;
    padding-top: 22px;
  }

  .header-actions,
  .summary-grid {
    grid-template-columns: 1fr;
  }

  .toolbar,
  .panel-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .toolbar div {
    display: grid;
    grid-template-columns: 1fr;
  }

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