:root {
  color-scheme: light;
  --ink: #172026;
  --muted: #5a6872;
  --soft: #eef4f1;
  --panel: #ffffff;
  --line: #d8e2df;
  --line-strong: #b9cac4;
  --accent: #0f766e;
  --accent-strong: #0a5b55;
  --gold: #b7791f;
  --coral: #c2412d;
  --blue: #2f6f9f;
  --green: #237a4b;
  --shadow: 0 18px 45px rgba(23, 32, 38, 0.08);
}

* {
  box-sizing: border-box;
}

html {
  scroll-behavior: smooth;
}

body {
  margin: 0;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--ink);
  background: #f6f8f7;
  line-height: 1.5;
}

a {
  color: var(--accent-strong);
}

button,
input,
select {
  font: inherit;
}

button {
  cursor: pointer;
}

.wrap {
  width: min(1440px, calc(100% - 40px));
  margin: 0 auto;
}

.app-header {
  position: sticky;
  top: 0;
  z-index: 20;
  background: rgba(255, 255, 255, 0.94);
  border-bottom: 1px solid var(--line);
  backdrop-filter: blur(14px);
}

.header-inner {
  min-height: 68px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  color: var(--ink);
  text-decoration: none;
  font-weight: 760;
}

.brand-mark {
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 8px;
  background: var(--accent);
  color: #ffffff;
}

.site-nav {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
  margin-right: auto;
}

.site-nav a {
  color: #314148;
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover {
  color: var(--accent-strong);
}

.header-actions,
.scenario-buttons {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 10px;
}

.primary-button,
.ghost-button,
.chip-button {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 7px;
  border: 1px solid var(--line-strong);
  padding: 0 14px;
  background: #ffffff;
  color: var(--ink);
  font-weight: 650;
}

.primary-button {
  border-color: var(--accent);
  background: var(--accent);
  color: #ffffff;
}

.ghost-button:hover,
.chip-button:hover {
  border-color: var(--accent);
  color: var(--accent-strong);
}

.primary-button:hover {
  background: var(--accent-strong);
}

.link-button {
  text-decoration: none;
}

.app-shell {
  padding: 26px 0 48px;
}

.intro-panel {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(280px, 400px);
  gap: 22px;
  align-items: end;
  padding: 26px;
  margin-bottom: 20px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.eyebrow {
  margin: 0 0 8px;
  color: var(--accent-strong);
  font-size: 13px;
  font-weight: 780;
  text-transform: uppercase;
}

h1,
h2,
h3,
p {
  margin-top: 0;
}

h1 {
  margin-bottom: 10px;
  font-size: 40px;
  line-height: 1.08;
  letter-spacing: 0;
}

h2 {
  margin-bottom: 8px;
  font-size: 22px;
  line-height: 1.2;
  letter-spacing: 0;
}

h3 {
  margin-bottom: 8px;
  font-size: 17px;
  line-height: 1.25;
  letter-spacing: 0;
}

.intro-copy {
  max-width: 860px;
  margin-bottom: 0;
  color: var(--muted);
  font-size: 16px;
}

.scenario-panel {
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  background: var(--soft);
}

.scenario-label {
  display: block;
  margin-bottom: 10px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(320px, 430px) minmax(0, 1fr);
  gap: 20px;
  align-items: start;
  min-width: 0;
}

.controls-panel,
.results-panel,
.chart-card,
.detail-card,
.table-card,
.method-card,
.metric-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  min-width: 0;
}

.controls-panel {
  position: sticky;
  top: 88px;
  max-height: calc(100vh - 108px);
  overflow: auto;
}

.control-group {
  padding: 20px;
  border-bottom: 1px solid var(--line);
}

.control-group:last-child {
  border-bottom: 0;
}

.group-heading {
  margin-bottom: 14px;
}

.group-heading h2 {
  margin-bottom: 4px;
  font-size: 18px;
}

.group-heading span,
.card-heading span,
.metric-card small {
  color: var(--muted);
  font-size: 13px;
}

label {
  display: grid;
  gap: 7px;
  margin-bottom: 13px;
  color: #26343b;
  font-size: 13px;
  font-weight: 720;
}

input,
select {
  width: 100%;
  min-height: 42px;
  border: 1px solid var(--line-strong);
  border-radius: 7px;
  padding: 8px 10px;
  background: #ffffff;
  color: var(--ink);
}

input:focus,
select:focus,
button:focus {
  outline: 3px solid rgba(15, 118, 110, 0.18);
  outline-offset: 1px;
}

.field-grid {
  display: grid;
  gap: 12px;
}

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

.field-grid.three {
  grid-template-columns: repeat(3, minmax(0, 1fr));
}

.range-label strong {
  color: var(--accent-strong);
}

input[type="range"] {
  min-height: 28px;
  padding: 0;
  accent-color: var(--accent);
}

.results-panel {
  padding: 20px;
}

.result-topline {
  display: flex;
  align-items: start;
  justify-content: space-between;
  gap: 20px;
  padding-bottom: 18px;
  margin-bottom: 18px;
  border-bottom: 1px solid var(--line);
}

.result-topline h2 {
  font-size: 28px;
}

#recommendationSummary {
  max-width: 920px;
  margin-bottom: 0;
  color: var(--muted);
}

.recommendation-badge {
  flex: 0 0 auto;
  min-width: 120px;
  border-radius: 8px;
  padding: 10px 12px;
  background: #173f3b;
  color: #ffffff;
  text-align: center;
  font-weight: 760;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.metric-card {
  min-height: 126px;
  padding: 16px;
}

.metric-card span {
  display: block;
  margin-bottom: 8px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 750;
  text-transform: uppercase;
}

.metric-card strong {
  display: block;
  margin-bottom: 4px;
  font-size: 28px;
  line-height: 1.15;
  letter-spacing: 0;
}

.visual-grid,
.details-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 16px;
  margin-bottom: 16px;
}

.chart-card,
.detail-card,
.table-card,
.method-card {
  padding: 16px;
}

.chart-card {
  overflow: hidden;
}

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

canvas {
  display: block;
  width: 100%;
  max-width: 100%;
  min-height: 220px;
  border-radius: 6px;
  background: #fbfcfc;
}

.spec-list {
  margin: 0;
}

.spec-list div {
  display: flex;
  justify-content: space-between;
  gap: 18px;
  padding: 10px 0;
  border-bottom: 1px solid #edf2f0;
}

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

.spec-list dt {
  color: var(--muted);
  font-weight: 700;
}

.spec-list dd {
  margin: 0;
  text-align: right;
  font-weight: 760;
}

.reason-list {
  margin: 0;
  padding-left: 20px;
  color: var(--muted);
}

.reason-list li {
  margin: 0 0 8px;
}

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

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

th,
td {
  padding: 11px 10px;
  border-bottom: 1px solid var(--line);
  text-align: left;
  vertical-align: top;
  font-size: 14px;
}

th {
  background: #eef5f3;
  color: #26343b;
  font-size: 12px;
  text-transform: uppercase;
}

tr.recommended-row td {
  background: #f2faf7;
  font-weight: 700;
}

.fit-warning {
  color: var(--coral);
  font-weight: 760;
}

.fit-ok {
  color: var(--green);
  font-weight: 760;
}

.method-card {
  margin-top: 16px;
}

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

.method-grid p {
  margin-bottom: 0;
  color: var(--muted);
}

.resource-shell {
  padding: 28px 0 48px;
}

.resource-hero {
  margin-bottom: 20px;
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #ffffff;
  box-shadow: var(--shadow);
}

.resource-hero p {
  max-width: 880px;
  color: var(--muted);
}

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

.resource-card {
  min-width: 0;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
  background: #ffffff;
}

.resource-card strong {
  display: block;
  margin-bottom: 6px;
  color: var(--accent-strong);
  font-size: 14px;
  text-transform: uppercase;
}

.resource-card p,
.resource-card li {
  color: var(--muted);
}

.resource-card a {
  font-weight: 750;
}

.resource-card ul {
  margin: 10px 0 0;
  padding-left: 20px;
}

.scenario-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  margin-top: 18px;
}

.scenario-result-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.scenario-content-grid {
  display: grid;
  grid-template-columns: minmax(0, 1.35fr) repeat(2, minmax(230px, 0.7fr));
  gap: 16px;
  margin-bottom: 16px;
}

.scenario-table {
  margin-top: 16px;
}

.scenario-library-grid {
  align-items: stretch;
}

.scenario-card h2 a {
  color: var(--ink);
  text-decoration: none;
}

.scenario-card h2 a:hover {
  color: var(--accent-strong);
}

.status-line {
  min-height: 24px;
  margin: 14px 0 0;
  color: var(--accent-strong);
  font-weight: 700;
}

.site-footer {
  border-top: 1px solid var(--line);
  background: #ffffff;
}

.footer-inner {
  min-height: 70px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  color: var(--muted);
  font-size: 14px;
}

@media (max-width: 1100px) {
  .workspace,
  .intro-panel,
  .visual-grid,
  .details-grid,
  .method-grid,
  .resource-grid,
  .scenario-result-grid,
  .scenario-content-grid {
    grid-template-columns: 1fr;
  }

  .controls-panel {
    position: static;
    max-height: none;
  }

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

@media (max-width: 720px) {
  .wrap {
    width: min(100% - 24px, 1440px);
  }

  .header-inner,
  .result-topline,
  .footer-inner,
  .card-heading {
    align-items: stretch;
    flex-direction: column;
  }

  .site-nav {
    margin-right: 0;
  }

  .header-actions {
    width: 100%;
  }

  .header-actions button {
    flex: 1 1 130px;
  }

  .intro-panel,
  .results-panel,
  .control-group {
    padding: 16px;
  }

  h1 {
    font-size: 30px;
  }

  .result-topline h2 {
    font-size: 23px;
  }

  .field-grid.two,
  .field-grid.three,
  .metric-grid {
    grid-template-columns: 1fr;
  }

  .metric-card strong {
    font-size: 24px;
  }
}

@media print {
  .app-header,
  .controls-panel,
  .site-footer,
  .scenario-panel,
  .method-card,
  .status-line {
    display: none;
  }

  body {
    background: #ffffff;
  }

  .wrap {
    width: 100%;
  }

  .app-shell {
    padding: 0;
  }

  .intro-panel,
  .workspace,
  .results-panel {
    display: block;
    border: 0;
    box-shadow: none;
  }
}
