:root {
  --bg: #eef3ec;
  --paper: #fbfcf8;
  --paper-strong: #ffffff;
  --ink: #1e2a1f;
  --muted: #5d6c5f;
  --line: #d6ddd1;
  --accent: #2f6f45;
  --accent-soft: #dfeee2;
  --accent-warm: #d38a3d;
  --shadow: 0 18px 42px rgba(38, 56, 40, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Avenir Next", "Segoe UI", sans-serif;
  color: var(--ink);
  background:
    radial-gradient(circle at top left, rgba(97, 146, 95, 0.18), transparent 30%),
    linear-gradient(180deg, #f5f7f1 0%, #eef3ec 100%);
}

body.modal-open {
  overflow: hidden;
}

h1,
h2,
h3 {
  font-family: "Iowan Old Style", "Palatino Linotype", Georgia, serif;
  margin: 0;
}

p {
  margin: 0;
}

a {
  color: inherit;
}

.page-shell,
.guide-page-shell {
  width: min(1160px, calc(100% - 32px));
  margin: 32px auto 64px;
}

.hero,
.panel {
  background: rgba(251, 252, 248, 0.94);
  border: 1px solid rgba(214, 221, 209, 0.9);
  border-radius: 26px;
  box-shadow: var(--shadow);
}

.hero {
  padding: 32px;
  display: grid;
  grid-template-columns: 1.7fr 1fr;
  gap: 24px;
  margin-bottom: 20px;
}

.hero-copy {
  max-width: 760px;
  color: var(--muted);
  font-size: 1.05rem;
  line-height: 1.6;
  margin-top: 14px;
}

.hero-actions {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  justify-content: flex-end;
  flex-wrap: wrap;
}

.panel {
  padding: 26px;
  margin-bottom: 18px;
}

.section-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 20px;
  margin-bottom: 18px;
}

.section-note {
  max-width: 420px;
  color: var(--muted);
  line-height: 1.5;
}

.eyebrow {
  text-transform: uppercase;
  letter-spacing: 0.12em;
  font-size: 0.74rem;
  font-weight: 700;
  color: var(--accent);
  margin-bottom: 8px;
}

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

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

.field-span-2 {
  grid-column: span 2;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.field span {
  font-size: 0.93rem;
  font-weight: 600;
}

.field input,
.field select {
  width: 100%;
  min-height: 48px;
  padding: 12px 14px;
  border-radius: 14px;
  border: 1px solid var(--line);
  background: var(--paper-strong);
  color: var(--ink);
  font: inherit;
}

.field input:focus,
.field select:focus {
  outline: 2px solid rgba(47, 111, 69, 0.18);
  border-color: var(--accent);
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 44px;
  padding: 0 16px;
  border-radius: 999px;
  border: 1px solid transparent;
  font: inherit;
  font-weight: 600;
  text-decoration: none;
  cursor: pointer;
}

.button-primary {
  background: var(--accent);
  color: white;
}

.button-soft {
  background: var(--accent-soft);
  color: var(--accent);
}

.button-ghost {
  background: transparent;
  border-color: var(--line);
  color: var(--ink);
}

.button:disabled {
  cursor: not-allowed;
  opacity: 0.55;
}

.subpanel,
.note-block,
.insight-block {
  margin-top: 18px;
  padding: 18px;
  border-radius: 18px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.checkbox-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  font-weight: 600;
  line-height: 1.5;
}

.checkbox-row input {
  margin-top: 4px;
}

.results-panel .section-header {
  align-items: center;
}

.metric-grid {
  display: grid;
  grid-template-columns: repeat(5, minmax(0, 1fr));
  gap: 14px;
  margin: 20px 0;
}

.metric-card {
  padding: 16px;
  border-radius: 18px;
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.92), rgba(242, 246, 240, 0.96));
  border: 1px solid var(--line);
}

.metric-card.positive {
  background: linear-gradient(180deg, rgba(223, 238, 226, 0.92), rgba(248, 252, 248, 0.98));
}

.metric-card.negative {
  background: linear-gradient(180deg, rgba(255, 238, 228, 0.92), rgba(255, 249, 246, 0.98));
}

.metric-label {
  display: block;
  color: var(--muted);
  font-size: 0.88rem;
  margin-bottom: 6px;
}

.metric-value {
  font-size: 1.2rem;
}

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

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 13px 14px;
  border-bottom: 1px solid var(--line);
  text-align: left;
}

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

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

.guide-intro,
.guide-step {
  padding: 18px;
  border-radius: 20px;
  background: var(--paper);
  border: 1px solid var(--line);
}

.guide-step h3 {
  margin-bottom: 12px;
}

.guide-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: grid;
  gap: 12px;
}

.guide-list-item strong {
  display: block;
  margin-bottom: 4px;
}

.guide-list-item p {
  color: var(--muted);
  line-height: 1.6;
}

.guide-modal {
  position: fixed;
  inset: 0;
  z-index: 50;
}

.guide-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(16, 24, 18, 0.5);
}

.guide-modal-panel {
  position: relative;
  width: min(960px, calc(100% - 28px));
  max-height: calc(100vh - 36px);
  margin: 18px auto;
  background: var(--paper-strong);
  border-radius: 24px;
  border: 1px solid var(--line);
  box-shadow: 0 24px 64px rgba(18, 32, 20, 0.24);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.guide-modal-header,
.guide-modal-actions {
  padding: 18px 22px;
  border-bottom: 1px solid var(--line);
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.guide-modal-actions {
  justify-content: flex-start;
  flex-wrap: wrap;
}

.guide-modal-content {
  padding: 22px;
  overflow: auto;
}

@media (max-width: 960px) {
  .hero,
  .section-header {
    grid-template-columns: 1fr;
    display: block;
  }

  .hero-actions,
  .section-header {
    margin-top: 16px;
  }

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

@media (max-width: 680px) {
  .page-shell,
  .guide-page-shell {
    width: min(100% - 20px, 100%);
    margin: 20px auto 40px;
  }

  .hero,
  .panel {
    padding: 20px;
    border-radius: 22px;
  }

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

  .field-span-2 {
    grid-column: span 1;
  }

  .guide-modal-panel {
    width: calc(100% - 16px);
    margin: 8px auto;
    max-height: calc(100vh - 16px);
  }
}
