:root {
  color-scheme: light;
  --ink: #17211d;
  --muted: #5e6863;
  --line: #d8dfda;
  --panel: #ffffff;
  --paper: #f4f3ed;
  --green: #236b4a;
  --green-2: #6ca58a;
  --blue: #2f6f8f;
  --amber: #c88719;
  --red: #b44736;
  --shadow: 0 18px 45px rgba(29, 43, 37, 0.12);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: Inter, ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background:
    linear-gradient(180deg, rgba(255,255,255,0.4), rgba(255,255,255,0)),
    var(--paper);
  color: var(--ink);
}

button,
input,
select {
  font: inherit;
}

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

.hero {
  min-height: 280px;
  display: grid;
  grid-template-columns: minmax(0, 1.25fr) minmax(300px, 0.75fr);
  gap: 22px;
  align-items: stretch;
}

.eyebrow {
  margin: 18px 0 10px;
  color: var(--green);
  font-size: 0.78rem;
  font-weight: 800;
  letter-spacing: 0;
  text-transform: uppercase;
}

h1 {
  margin: 0;
  max-width: 780px;
  font-size: clamp(2.5rem, 5vw, 5.3rem);
  line-height: 0.96;
  letter-spacing: 0;
}

.lede {
  max-width: 720px;
  margin: 20px 0 0;
  font-size: 1.15rem;
  line-height: 1.55;
  color: var(--muted);
}

.hero-panel {
  min-height: 420px;
  display: flex;
}

.map-card {
  position: relative;
  flex: 1;
  min-height: 420px;
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: 8px;
  background:
    linear-gradient(180deg, rgba(255, 255, 255, 0.34), rgba(255, 255, 255, 0)),
    #dfe9de;
  box-shadow: var(--shadow);
}

.airfield-svg-map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  min-height: 420px;
}

.map-grid-line {
  stroke: rgba(23, 33, 29, 0.1);
  stroke-width: 1;
  vector-effect: non-scaling-stroke;
}

.map-grid-label {
  fill: rgba(23, 33, 29, 0.46);
  font-size: 20px;
  font-weight: 800;
}

.south-sudan-boundary {
  fill: rgba(108, 165, 138, 0.48);
  stroke: rgba(35, 107, 74, 0.92);
  stroke-width: 5;
  stroke-linejoin: round;
  vector-effect: non-scaling-stroke;
}

.airfield-map-dot {
  fill: var(--blue);
  stroke: #fff;
  stroke-width: 2;
  cursor: pointer;
  filter: drop-shadow(0 2px 4px rgba(23, 33, 29, 0.26));
  vector-effect: non-scaling-stroke;
}

.airfield-map-dot.selected {
  fill: var(--red);
  stroke-width: 4;
  filter: drop-shadow(0 0 7px rgba(180, 71, 54, 0.55));
}

.map-location-card {
  position: absolute;
  left: 18px;
  bottom: 18px;
  max-width: calc(100% - 36px);
  padding: 10px 12px;
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.82);
  box-shadow: 0 10px 24px rgba(23, 33, 29, 0.13);
  z-index: 700;
}

.map-location-label,
#selectedMapCoords {
  display: block;
  color: var(--muted);
  font-size: 0.76rem;
  font-weight: 800;
  text-transform: uppercase;
}

#selectedMapName {
  display: block;
  margin: 2px 0;
  font-size: 1rem;
  line-height: 1.15;
}

.verification-link {
  display: inline-block;
  margin-top: 9px;
  color: #fff;
  background: var(--blue);
  border-radius: 6px;
  padding: 7px 9px;
  font-size: 0.78rem;
  font-weight: 900;
  text-decoration: none;
}

.verification-link:hover {
  background: #245b75;
}

.controls,
.custom-strip,
.status-row,
.black-cotton-panel,
.workspace,
.airstrip-grid {
  margin-top: 18px;
}

.controls,
.custom-strip {
  display: grid;
  grid-template-columns: 1.4fr 0.8fr 1fr 1fr auto;
  gap: 10px;
  align-items: end;
  padding: 14px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: rgba(255,255,255,0.74);
}

label {
  display: grid;
  gap: 7px;
  color: var(--muted);
  font-size: 0.82rem;
  font-weight: 800;
}

select,
input {
  width: 100%;
  min-height: 42px;
  border: 1px solid #cbd4ce;
  border-radius: 6px;
  background: #fff;
  color: var(--ink);
  padding: 0 11px;
}

button {
  min-height: 42px;
  border: 0;
  border-radius: 6px;
  background: var(--green);
  color: #fff;
  padding: 0 14px;
  font-weight: 800;
  cursor: pointer;
}

button:hover {
  background: #1b573b;
}

.secondary-button {
  border: 1px solid var(--line);
  background: #fff;
  color: var(--ink);
}

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

.custom-strip {
  grid-template-columns: 1.4fr 1fr 0.8fr 0.8fr auto auto;
}

.custom-strip-note p {
  margin: 4px 0 0;
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.35;
}

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

.metric,
.panel,
.strip-card {
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--panel);
  box-shadow: 0 8px 26px rgba(29, 43, 37, 0.07);
}

.metric {
  min-height: 124px;
  padding: 16px;
  display: grid;
  align-content: space-between;
}

.metric.primary {
  border-color: rgba(35, 107, 74, 0.45);
}

.metric-label,
.timestamp {
  color: var(--muted);
  font-size: 0.78rem;
  font-weight: 800;
  text-transform: uppercase;
}

.metric strong {
  display: block;
  margin-top: 8px;
  font-size: 2rem;
  line-height: 1;
}

.metric span:last-child {
  color: var(--muted);
  font-size: 0.9rem;
}

.black-cotton-panel {
  display: grid;
  grid-template-columns: minmax(0, 1.15fr) minmax(280px, 0.85fr);
  gap: 12px;
  padding: 14px;
  border: 1px solid rgba(180, 71, 54, 0.34);
  border-radius: 8px;
  background: #fff;
  box-shadow: 0 8px 26px rgba(29, 43, 37, 0.07);
}

.black-cotton-panel[hidden] {
  display: none;
}

.black-cotton-summary {
  display: grid;
  gap: 12px;
}

.risk-warning {
  width: fit-content;
  border-radius: 999px;
  padding: 6px 10px;
  background: #f8e7c2;
  color: #7a4b09;
  font-size: 0.78rem;
  font-weight: 900;
}

#blackCottonCategory {
  display: inline-block;
  margin-top: 6px;
  border-radius: 6px;
  padding: 8px 10px;
  background: #e7ece8;
  color: var(--ink);
  font-size: 1.25rem;
}

#blackCottonCategory.go { background: #dcebdd; color: #1f5f3b; }
#blackCottonCategory.caution { background: #f8e7c2; color: #7a4b09; }
#blackCottonCategory.high-risk { background: #f1d5bd; color: #7f3e08; }
#blackCottonCategory.no-go { background: #f0d4cf; color: #7b271c; }

#blackCottonReason {
  margin: 8px 0 0;
  color: var(--muted);
  line-height: 1.45;
}

#blackCottonFactors {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
  font-size: 0.9rem;
  line-height: 1.45;
}

.field-condition-controls {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
  align-content: start;
}

.check-control {
  min-height: 42px;
  display: flex;
  align-items: center;
  gap: 8px;
  border: 1px solid var(--line);
  border-radius: 6px;
  background: #f9faf7;
  padding: 8px 10px;
  color: var(--ink);
  font-size: 0.88rem;
  font-weight: 800;
}

.check-control input {
  width: auto;
  min-height: auto;
}

.workspace {
  display: grid;
  grid-template-columns: minmax(0, 1.45fr) minmax(280px, 0.55fr);
  gap: 14px;
}

.panel {
  padding: 16px;
  min-width: 0;
}

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

h2 {
  margin: 0 0 4px;
  font-size: 1.05rem;
}

.panel p {
  margin: 0;
  color: var(--muted);
  font-size: 0.92rem;
}

.timeline {
  height: 280px;
  display: grid;
  grid-template-columns: 54px minmax(0, 1fr);
  gap: 8px;
  padding-top: 20px;
  border-top: 1px solid var(--line);
  overflow: hidden;
}

.timeline-y-axis {
  position: relative;
  height: 218px;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.timeline-y-axis span {
  position: absolute;
  right: 0;
  transform: translateY(50%);
  white-space: nowrap;
}

.timeline-plot {
  position: relative;
  min-width: 0;
  height: 252px;
  padding-bottom: 34px;
  overflow: hidden;
}

.timeline-grid {
  position: absolute;
  inset: 0 0 34px;
  pointer-events: none;
}

.timeline-grid span {
  position: absolute;
  left: 0;
  width: 100%;
  border-top: 1px solid rgba(23, 33, 29, 0.12);
}

.timeline-bars {
  position: absolute;
  inset: 0 0 34px;
  display: grid;
  grid-template-columns: repeat(var(--bar-count, 48), minmax(1px, 1fr));
  gap: var(--bar-gap, 3px);
  align-items: end;
}

.rain-bar {
  min-height: 3px;
  border-radius: 3px 3px 0 0;
  background: var(--blue);
  position: relative;
}

.timeline-x-axis {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 28px;
  border-top: 1px solid rgba(23, 33, 29, 0.12);
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 800;
}

.timeline-x-axis span {
  position: absolute;
  top: 7px;
  transform: translateX(-50%);
  white-space: nowrap;
}

.timeline-x-axis span:first-child {
  transform: translateX(0);
}

.timeline-x-axis span:last-child {
  transform: translateX(-100%);
}

.rain-bar.dry {
  background: #d7ded9;
}

.rain-bar.heavy {
  background: var(--red);
}

.daily-bars {
  display: grid;
  gap: 12px;
}

.day-row {
  display: grid;
  grid-template-columns: 82px minmax(80px, 1fr) 58px;
  gap: 10px;
  align-items: center;
  color: var(--muted);
  font-size: 0.88rem;
}

.day-track {
  height: 12px;
  border-radius: 999px;
  background: #e3e8e4;
  overflow: hidden;
}

.day-fill {
  height: 100%;
  border-radius: inherit;
  background: var(--blue);
}

.airstrip-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 12px;
}

.strip-card {
  padding: 14px;
  display: grid;
  gap: 10px;
  cursor: pointer;
}

.strip-card.active {
  outline: 3px solid rgba(35, 107, 74, 0.28);
}

.strip-top {
  display: flex;
  justify-content: space-between;
  gap: 8px;
}

.strip-name {
  font-weight: 900;
}

.badge {
  align-self: start;
  border-radius: 999px;
  padding: 4px 8px;
  background: #e7ece8;
  color: var(--muted);
  font-size: 0.72rem;
  font-weight: 900;
}

.badge.watch { background: #f8e7c2; color: #7a4b09; }
.badge.wet { background: #d8e8f0; color: #164f6a; }
.badge.heavy { background: #f0d4cf; color: #7b271c; }
.badge.local { background: #e7ece8; color: #3d4842; }

.strip-rain {
  font-size: 1.55rem;
  font-weight: 900;
}

.strip-meta,
.source-note {
  color: var(--muted);
  font-size: 0.84rem;
  line-height: 1.45;
}

.source-note {
  margin: 18px 0 0;
}

.error {
  color: var(--red);
  font-weight: 800;
}

@media (max-width: 820px) {
  .hero,
  .workspace,
  .status-row,
  .black-cotton-panel,
  .controls,
  .custom-strip {
    grid-template-columns: 1fr;
  }

  .field-condition-controls {
    grid-template-columns: 1fr;
  }

  h1 {
    font-size: 3rem;
  }

  .timeline {
    grid-template-columns: 46px minmax(0, 1fr);
  }

  .timeline-y-axis,
  .timeline-x-axis {
    font-size: 0.66rem;
  }

  .panel-heading {
    flex-direction: column;
  }
}
