:root {
  color-scheme: light;
  --ink: #17211c;
  --muted: #5e6b66;
  --line: #cfd8d2;
  --field: #ffffff;
  --surface: #f5f7f4;
  --band: #ffffff;
  --green: #1f6b50;
  --green-strong: #15523c;
  --amber: #b56b22;
  --blue: #2f5f87;
  --focus: #2a7b5c;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  background: var(--surface);
  color: var(--ink);
  font-family: Arial, Helvetica, sans-serif;
}

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

.site-header-inner {
  width: min(1180px, calc(100% - 32px));
  min-height: 68px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 24px;
}

.site-brand {
  color: var(--ink);
  display: flex;
  flex-direction: column;
  font-size: 22px;
  font-weight: 700;
  line-height: 1.1;
  text-decoration: none;
}

.site-brand small {
  margin-top: 4px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 400;
}

.site-nav {
  display: flex;
  align-items: center;
  gap: 22px;
}

.site-nav a {
  color: var(--blue);
  font-size: 14px;
  font-weight: 700;
  text-decoration: none;
}

.site-nav a:hover,
.site-nav a:focus-visible {
  color: var(--green-strong);
  text-decoration: underline;
}

.app-shell {
  width: min(1180px, calc(100% - 32px));
  margin: 0 auto;
  padding: 22px 0 42px;
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
  padding: 14px 0 18px;
  border-bottom: 2px solid var(--line);
}

h1,
h2,
p {
  margin: 0;
}

h1 {
  font-size: 30px;
  line-height: 1.15;
  font-weight: 700;
}

.subhead {
  margin-top: 5px;
  color: var(--muted);
  font-size: 14px;
}

.actions,
.key-row {
  display: flex;
  align-items: end;
  gap: 10px;
  flex-wrap: wrap;
}

.information-box {
  margin-top: 18px;
  padding: 18px 20px;
  border: 1px solid #b8d6cf;
  border-left: 5px solid var(--green);
  border-radius: 8px;
  background: #edf7f4;
  color: #1d3028;
  line-height: 1.5;
}

.information-box h2 {
  font-size: 20px;
  line-height: 1.25;
}

.information-box p {
  margin-top: 10px;
}

.information-box a {
  color: var(--blue);
  font-weight: 700;
}

.action-step-title p {
  margin-top: 6px;
  color: var(--muted);
  font-size: 16px;
  line-height: 1.4;
}

.action-step-title a {
  color: var(--blue);
  font-weight: 700;
}

.email-pdf-instruction {
  color: var(--ink) !important;
}

.attachment-note {
  margin: -2px 0 14px;
  color: var(--muted);
  font-size: 14px;
}

button {
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--ink);
  font: inherit;
  font-weight: 700;
  padding: 0 14px;
  cursor: pointer;
}

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

button:focus-visible,
input:focus-visible,
select:focus-visible {
  outline: 3px solid color-mix(in srgb, var(--focus) 35%, transparent);
  outline-offset: 1px;
}

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

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

button.quiet {
  color: var(--blue);
}

button[disabled] {
  cursor: progress;
  opacity: 0.65;
}

.button-link {
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #ffffff;
  color: var(--blue);
  font: inherit;
  font-weight: 700;
  padding: 0 14px;
  text-decoration: none;
}

.button-link:hover {
  border-color: var(--green);
}

.pdf-download {
  min-height: 46px;
  background: #075c9d;
  border-color: #075c9d;
  color: #ffffff;
  font-size: 16px;
}

.pdf-download:hover {
  background: #034777;
  border-color: #034777;
  color: #ffffff;
}

.pdf-download.is-disabled,
.pdf-download.is-disabled:hover {
  background: #5b7890;
  border-color: #49687e;
  color: #ffffff;
  cursor: not-allowed;
}

.status-row {
  min-height: 34px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  padding: 10px 0 0;
  color: var(--muted);
  font-size: 14px;
}

.status-row a {
  color: var(--green-strong);
  font-weight: 700;
}

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

.application-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 14px;
}

.application-table th,
.application-table td {
  border-bottom: 1px solid var(--line);
  padding: 10px 8px;
  text-align: left;
  vertical-align: top;
}

.application-table th {
  color: var(--muted);
  font-size: 12px;
  text-transform: uppercase;
}

.application-links {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

.application-links a {
  color: var(--green-strong);
  font-weight: 700;
}

.band {
  margin-top: 18px;
  background: var(--band);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 18px;
}

.workflow-step {
  background: var(--step-background);
  border-left: 5px solid var(--step-accent);
}

.step-project { --step-background: #eef5fb; --step-accent: #2f5f87; }
.step-wimas { --step-background: #eef7f7; --step-accent: #23746b; }
.step-mapping { --step-background: #edf7f1; --step-accent: #1f6b50; }
.step-system { --step-background: #fff7e6; --step-accent: #b56b22; }
.step-pivot { --step-background: #eaf7f6; --step-accent: #23746b; }
.step-energy { --step-background: #fff0ed; --step-accent: #b65c45; }
.step-crop { --step-background: #f4f8e9; --step-accent: #63822f; }
.step-landowner { --step-background: #eef1fb; --step-accent: #4e6fb3; }
.step-applicant { --step-background: #f8f1e9; --step-accent: #9a6833; }
.step-generate { --step-background: #eaf4ef; --step-accent: #15523c; }
.step-download { --step-background: #edf4f8; --step-accent: #2f5f87; }

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

.section-title h2 {
  font-size: 18px;
  line-height: 1.25;
}

.action-step-title {
  align-items: center;
  margin-bottom: 0;
}

.packet-instructions {
  margin: 10px 0 0;
  padding-left: 24px;
  color: var(--ink);
  font-size: 16px;
  line-height: 1.5;
}

.packet-instructions li + li {
  margin-top: 10px;
}

.packet-action {
  margin-top: 8px;
}

.packet-action .pdf-download {
  min-width: 180px;
}

.applicant-action {
  margin: -2px 0 14px;
}

.wimas-title {
  display: grid;
  gap: 7px;
  max-width: 680px;
}

.wimas-help {
  margin: 0;
  padding: 0;
  list-style: none;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.wimas-help li {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
  margin-top: 6px;
  padding: 8px 10px;
  border: 1px solid var(--line);
  border-radius: 6px;
}

.wimas-step-number {
  color: var(--green-strong);
  font-weight: 700;
}

.wimas-help li:nth-child(1) { background: #edf7f1; }
.wimas-help li:nth-child(2) { background: #eef5fb; }
.wimas-help li:nth-child(3) { background: #fff7e6; }
.wimas-help li:nth-child(4) { background: #f1f5fb; }
.wimas-help li:nth-child(5) { background: #eaf7f6; }
.wimas-help li:nth-child(6) { background: #fff0ed; }
.wimas-help li:nth-child(7) { background: #f4f8e9; }
.wimas-help li:nth-child(8) { background: #eef1fb; }
.wimas-help li:nth-child(9) { background: #f7f2eb; }

.wimas-note {
  width: 100%;
  color: var(--ink);
  font-weight: 700;
}

.wimas-help .capture-page {
  margin-left: auto;
}

.mapping-help {
  margin: 0 0 16px;
  padding-left: 22px;
  color: var(--muted);
  font-size: 15px;
  line-height: 1.4;
}

.mapping-help li + li {
  margin-top: 12px;
}

.mapping-help li::marker {
  color: var(--green-strong);
  font-weight: 700;
}

.mapping-step-action {
  display: flex;
  align-items: end;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 7px;
}

button.capture-page {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

button.capture-page:hover {
  background: #244d70;
  border-color: #244d70;
}

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

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

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

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

label,
.elev-row strong {
  display: grid;
  gap: 6px;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  line-height: 1.2;
}

input,
select {
  width: 100%;
  min-width: 0;
  min-height: 40px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: var(--field);
  color: var(--ink);
  font: inherit;
  font-size: 14px;
  padding: 8px 10px;
}

input[readonly] {
  background: #eef1ee;
  color: var(--muted);
  cursor: not-allowed;
}

select {
  appearance: auto;
}

.api-key {
  width: min(280px, 100%);
}

.wimas-frame-shell {
  width: 100%;
  height: min(72vh, 760px);
  min-height: 520px;
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
  background: #ffffff;
}

.capture-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 10px;
  min-height: 0;
}

.capture-chip {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-height: 32px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #fbfcfb;
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 4px 8px;
}

.capture-summary {
  display: inline-flex;
  align-items: center;
  min-height: 32px;
  color: var(--green-strong);
  font-size: 12px;
  font-weight: 700;
  padding-right: 4px;
}

.capture-chip button {
  min-height: 24px;
  padding: 0 7px;
  font-size: 12px;
}

.upload-panel {
  display: grid;
  gap: 10px;
  margin-top: 14px;
  padding-top: 14px;
  border-top: 1px solid var(--line);
}

.upload-panel label {
  max-width: 520px;
}

.attachment-list {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  min-height: 0;
}

#wimasFrame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
  background: #ffffff;
}

.address-search {
  display: grid;
  grid-template-columns: minmax(260px, 1fr) auto;
  gap: 10px;
  align-items: end;
  width: min(100%, 640px);
  margin: 0;
}

.elevation-table {
  display: grid;
  gap: 8px;
}

.coordinate-table {
  margin-top: 14px;
}

.elev-head,
.elev-row {
  display: grid;
  grid-template-columns: 1.15fr repeat(3, minmax(120px, 1fr));
  gap: 8px;
  align-items: center;
}

.elev-head {
  color: var(--muted);
  font-size: 12px;
  font-weight: 700;
  padding: 0 2px;
}

.elev-row {
  padding: 8px;
  border: 1px solid #e3e8e4;
  border-radius: 8px;
  background: #fbfcfb;
}

.elev-row strong {
  color: var(--ink);
  font-size: 13px;
}

.map-panel {
  margin-top: 14px;
  display: grid;
  gap: 10px;
}

.map-panel-actions {
  display: flex;
  justify-content: flex-end;
}

.circle-metrics {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  border: 1px solid var(--line);
  background: #ffffff;
}

.circle-metric {
  min-width: 0;
  padding: 10px 14px;
}

.circle-metric + .circle-metric {
  border-left: 1px solid var(--line);
}

.circle-metric span {
  display: block;
  color: var(--muted);
  font-size: 13px;
  font-weight: 700;
}

.circle-metric output {
  display: block;
  margin-top: 2px;
  color: var(--ink);
  font-size: 18px;
  font-weight: 700;
}

.map-mode.active {
  background: var(--blue);
  border-color: var(--blue);
  color: #ffffff;
}

.elevation-map {
  height: 420px;
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #e8ede9;
  overflow: hidden;
  cursor: grab;
}

.elevation-map.map-selection-active {
  cursor: crosshair;
}

.elevation-map:empty::before {
  content: "Map";
  display: grid;
  height: 100%;
  place-items: center;
  color: var(--muted);
  font-weight: 700;
}

.status-ok {
  color: var(--green-strong);
}

.status-warn {
  color: var(--amber);
}

@media (max-width: 860px) {
  .site-header-inner {
    width: min(100% - 20px, 720px);
    min-height: 0;
    align-items: flex-start;
    flex-direction: column;
    gap: 14px;
    padding: 14px 0;
  }

  .site-nav {
    gap: 16px;
    flex-wrap: wrap;
  }

  .app-shell {
    width: min(100% - 20px, 720px);
    padding-top: 10px;
  }

  .topbar,
  .section-title {
    align-items: stretch;
    flex-direction: column;
  }

  .actions,
  .key-row {
    align-items: stretch;
  }

  .actions button,
  .key-row button,
  .button-link {
    flex: 1 1 140px;
  }

  .wimas-frame-shell {
    height: 560px;
    min-height: 420px;
  }

  .address-search {
    grid-template-columns: 1fr;
  }

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

  .elev-head {
    display: none;
  }

  .elev-row {
    grid-template-columns: 1fr;
  }

  .elevation-map {
    height: 340px;
  }

  .circle-metrics {
    grid-template-columns: 1fr;
  }

  .circle-metric + .circle-metric {
    border-top: 1px solid var(--line);
    border-left: 0;
  }
}
