:root {
  color-scheme: light;
  --ink: #18222f;
  --muted: #5a6675;
  --line: #d9e2e8;
  --panel: #ffffff;
  --page: #f4f7f6;
  --teal: #147f78;
  --blue: #2859a8;
  --amber: #c7841e;
  --red: #bb3f44;
  --green: #2f8a52;
  --shadow: 0 14px 36px rgba(26, 38, 56, 0.09);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--page);
  color: var(--ink);
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

button,
input,
select,
textarea {
  font: inherit;
}

button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  cursor: pointer;
}

button:hover {
  border-color: var(--teal);
}

button svg {
  width: 18px;
  height: 18px;
}

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

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

.topbar h1,
.section-heading h2,
.panel h2 {
  margin: 0;
  letter-spacing: 0;
}

.topbar h1 {
  font-size: clamp(28px, 4vw, 52px);
  line-height: 1.02;
}

.topbar-actions {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: flex-end;
}

.eyebrow {
  margin: 0 0 7px;
  color: var(--teal);
  font-weight: 760;
  text-transform: uppercase;
  font-size: 12px;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(330px, 420px) minmax(0, 1fr);
  gap: 18px;
  padding-top: 18px;
}

.input-panel,
.panel,
.score-band {
  background: var(--panel);
  border: 1px solid var(--line);
  border-radius: 8px;
  box-shadow: var(--shadow);
}

.input-panel {
  padding: 18px;
  align-self: start;
}

.section-heading,
.panel-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.section-heading {
  margin-bottom: 16px;
}

.status-chip {
  display: inline-flex;
  align-items: center;
  min-height: 28px;
  padding: 0 10px;
  border-radius: 999px;
  background: #eaf5ef;
  color: #23633e;
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
}

form {
  display: grid;
  gap: 14px;
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

input,
select,
textarea {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  padding: 10px 11px;
}

textarea {
  resize: vertical;
}

input[type="range"] {
  padding: 0;
  accent-color: var(--teal);
}

.two-col,
.three-col {
  display: grid;
  gap: 12px;
}

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

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

.checkbox-row {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 11px;
  border: 1px solid var(--line);
  border-radius: 6px;
  color: var(--ink);
}

.checkbox-row input {
  width: 18px;
  height: 18px;
}

.range-readout {
  color: var(--ink);
  font-size: 12px;
}

.dashboard {
  display: grid;
  gap: 18px;
}

.score-band {
  display: grid;
  grid-template-columns: minmax(220px, 0.8fr) minmax(300px, 1.2fr);
  gap: 16px;
  padding: 18px;
}

.score-block {
  display: grid;
  align-content: center;
  gap: 14px;
}

.score-line {
  display: flex;
  align-items: baseline;
  gap: 14px;
}

#risk-score {
  font-size: clamp(56px, 9vw, 104px);
  font-weight: 840;
  line-height: 0.9;
}

#risk-label {
  color: var(--muted);
  font-size: 20px;
  font-weight: 800;
}

.gauge {
  width: 100%;
  height: 14px;
  overflow: hidden;
  border-radius: 999px;
  background: #e7ecef;
}

.gauge span {
  display: block;
  width: 42%;
  height: 100%;
  border-radius: inherit;
  background: var(--amber);
}

#watershed-map {
  width: 100%;
  height: auto;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #eef5f4;
}

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

.panel {
  padding: 18px;
}

.panel-title {
  justify-content: flex-start;
  margin-bottom: 14px;
}

.panel-title svg {
  width: 20px;
  height: 20px;
  color: var(--blue);
}

.panel h2 {
  font-size: 18px;
}

.signal-list,
.action-list {
  margin: 0;
  padding-left: 20px;
  color: var(--ink);
}

.signal-list li,
.action-list li {
  margin: 0 0 10px;
  line-height: 1.45;
}

.wide p {
  margin: 0;
  color: var(--ink);
  line-height: 1.55;
}

pre {
  min-height: 160px;
  max-height: 260px;
  overflow: auto;
  margin: 0;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #111827;
  color: #e8f3ef;
  font-size: 12px;
  line-height: 1.5;
}

@media (max-width: 980px) {
  .workspace,
  .score-band,
  .insight-grid {
    grid-template-columns: 1fr;
  }

  .topbar {
    align-items: flex-start;
    flex-direction: column;
  }
}

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

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

  .topbar-actions {
    width: 100%;
  }

  .topbar-actions button {
    flex: 1;
  }
}
