:root {
  color-scheme: light;
  font-family: Inter, Arial, Helvetica, sans-serif;
  color: #20242a;
  background: #eef2f5;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
}

button,
input,
select {
  font: inherit;
}

button {
  min-height: 44px;
  padding: 0 18px;
  border: 0;
  border-radius: 6px;
  color: #ffffff;
  background: #006b5f;
  cursor: pointer;
}

button:hover {
  background: #005449;
}

button:disabled {
  color: #64707d;
  background: #d7dee6;
  cursor: not-allowed;
}

.secondary-button {
  color: #006053;
  border: 1px solid #9bb8b2;
  background: #f4fbf9;
}

.secondary-button:hover {
  background: #e2f2ef;
}

.secondary-button:disabled {
  color: #64707d;
  border-color: #c5ced8;
  background: #eef2f5;
}

.app-shell {
  width: min(1280px, 100%);
  margin: 0 auto;
  padding: 24px;
}

.tool-layout,
.results-stack {
  display: grid;
  gap: 16px;
}

.app-header {
  display: flex;
  align-items: end;
  justify-content: space-between;
  gap: 16px;
}

.eyebrow {
  margin: 0 0 8px;
  font-size: 0.78rem;
  font-weight: 700;
  color: #006b5f;
  text-transform: uppercase;
}

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

h1 {
  margin-bottom: 0;
  font-size: 2rem;
  line-height: 1.1;
}

h2 {
  margin-bottom: 0;
  font-size: 1rem;
}

h3 {
  margin-bottom: 10px;
  font-size: 0.95rem;
}

.panel {
  padding: 16px;
  border: 1px solid #cfd8e2;
  border-radius: 8px;
  background: #ffffff;
}

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

.panel-actions,
.button-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: flex-end;
  gap: 8px;
}

.panel-actions button,
.button-row button {
  min-height: 38px;
}

.panel-note {
  margin-bottom: 12px;
  color: #596675;
  font-size: 0.86rem;
}

.stale-status.is-stale {
  color: #8a4b14;
}

.origin-chip {
  display: inline-flex;
  min-height: 24px;
  align-items: center;
  padding: 0 8px;
  border-radius: 999px;
  font-size: 0.74rem;
  font-weight: 700;
  color: #30515a;
  background: #e1edf0;
}

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

.segmented label {
  position: relative;
}

.segmented input {
  position: absolute;
  opacity: 0;
}

.segmented span {
  display: inline-flex;
  min-height: 40px;
  align-items: center;
  padding: 0 14px;
  border: 1px solid #b9c6d2;
  border-radius: 6px;
  background: #f7fafc;
}

.segmented input:checked + span {
  border-color: #006b5f;
  color: #003f37;
  background: #d8f0ea;
}

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

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

.field,
.check-row {
  display: grid;
  gap: 6px;
  font-size: 0.84rem;
  font-weight: 700;
  color: #4a5563;
}

.field input,
.field select {
  width: 100%;
  min-height: 42px;
  padding: 8px 10px;
  border: 1px solid #b9c6d2;
  border-radius: 6px;
  color: #20242a;
  background: #ffffff;
}

.check-row {
  grid-template-columns: 18px minmax(0, 1fr);
  align-items: center;
  margin-top: 12px;
  font-weight: 600;
}

.results-stack {
  margin-top: 16px;
}

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

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

th,
td {
  padding: 10px;
  border-bottom: 1px solid #e2e8f0;
  text-align: right;
  white-space: nowrap;
}

th:first-child,
td:first-child,
th:nth-child(2),
td:nth-child(2) {
  text-align: left;
}

th {
  font-size: 0.78rem;
  color: #4a5563;
  text-transform: uppercase;
}

.flow-table-wrap {
  max-height: 520px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
}

.flow-table {
  min-width: 980px;
}

.flow-table th {
  position: sticky;
  top: 0;
  z-index: 1;
  background: #f7fafc;
}

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

.flow-column {
  min-width: 0;
}

.flow-column ol {
  display: grid;
  gap: 6px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.flow-column li {
  display: grid;
  grid-template-columns: 32px minmax(96px, 1fr) minmax(120px, 1fr);
  gap: 8px;
  align-items: center;
  min-height: 36px;
  padding: 6px 8px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  background: #f9fbfc;
}

.flow-column small {
  color: #596675;
  text-align: right;
}

details {
  min-width: 0;
}

summary {
  cursor: pointer;
  font-weight: 700;
}

dl {
  display: grid;
  grid-template-columns: minmax(120px, max-content) minmax(0, 1fr);
  gap: 8px 12px;
}

dt {
  font-weight: 700;
  color: #4a5563;
}

dd {
  margin: 0;
}

details ul,
.limitations {
  display: grid;
  gap: 8px;
  padding-left: 18px;
}

.notice {
  margin-top: 14px;
  padding: 12px;
  border: 1px solid #d8e4ec;
  border-radius: 6px;
  background: #f7fafc;
}

.notice p,
.error-panel p {
  margin-bottom: 0;
}

.export-panel {
  border-color: #b8ccd4;
}

.export-options {
  display: flex;
  flex-wrap: wrap;
  gap: 16px;
  margin-bottom: 14px;
}

.error-panel {
  border-color: #d77a61;
  background: #fff7f4;
}

@media (max-width: 900px) {
  .app-header,
  .scenario-grid,
  .flow-grid,
  .assumption-grid {
    grid-template-columns: 1fr;
  }

  .app-header {
    display: grid;
    align-items: stretch;
  }

  .panel-heading {
    display: grid;
    align-items: stretch;
  }

  .panel-actions,
  .button-row {
    justify-content: flex-start;
  }
}

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

  .form-grid,
  dl {
    grid-template-columns: 1fr;
  }

  .flow-column li {
    grid-template-columns: 28px minmax(0, 1fr);
  }

  .flow-column small {
    grid-column: 2;
    text-align: left;
  }
}

@media print {
  body {
    background: #ffffff;
  }

  .app-header button,
  .mode-panel,
  .scenario-grid,
  .export-panel,
  .panel-actions button {
    display: none;
  }

  .app-shell {
    width: 100%;
    padding: 0;
  }

  .panel {
    break-inside: avoid;
    border-color: #8c99a5;
  }
}
