:root {
  --ink: #10231a;
  --canopy: #267349;
  --ember: #c94a1a;
  --paper: #eaf2e9;
  --sheet: #fdfefb;
  --line: #bcd0c0;
  --muted: #496451;
  --leaf: #77b96a;
}

* {
  box-sizing: border-box;
}

html, body {
  margin: 0;
  padding: 0;
  background-color: var(--paper);
  color: var(--ink);
  font-family: 'IBM Plex Sans', system-ui, sans-serif;
  line-height: 1.45;
  overflow-x: hidden;
}

.hidden {
  display: none !important;
}

/* HERO */
.cm-bleed {
  width: 100%;
  margin-bottom: 24px;
  border-bottom: 1px solid var(--line);
}

.cm-hero {
  position: relative;
  min-height: 360px;
  overflow: hidden;
  background: #12301f;
}

.cm-image-pair {
  position: absolute;
  inset: 0;
  z-index: 0;
  display: grid;
  grid-template-columns: 1fr 1fr;
}

.cm-image {
  position: relative;
  height: 100%;
  margin: 0;
  overflow: hidden;
}

.cm-image img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  filter: saturate(1.18) contrast(1.05);
  transition: transform 0.65s cubic-bezier(.2,.7,.2,1);
}

.cm-image:hover img {
  transform: scale(1.045);
}

.cm-scrim {
  position: absolute;
  inset: 0;
  z-index: 1;
  pointer-events: none;
  background: linear-gradient(180deg, rgba(10, 22, 16, 0.62) 0%, rgba(10, 22, 16, 0.18) 42%, rgba(10, 22, 16, 0.72) 100%);
}

.cm-top {
  position: relative;
  z-index: 3;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 6%;
  border-bottom: 1px solid rgba(255,255,255,0.15);
  background: rgba(10, 22, 16, 0.65);
}

.cm-brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  font-weight: 700;
  font-size: 1.05rem;
  color: #ffffff;
  letter-spacing: 0.02em;
}

.cm-mark {
  width: 28px;
  height: 28px;
}

.cm-spec-tag {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.75rem;
  color: rgba(255,255,255,0.9);
}

.cm-year {
  position: absolute;
  z-index: 3;
  top: 68px;
  display: flex;
  flex-direction: column;
  gap: 2px;
  padding: 6px 10px;
  border-radius: 2px;
  background: rgba(10, 22, 16, 0.88);
  border: 1px solid rgba(255,255,255,0.35);
  color: #ffffff;
  line-height: 1.2;
}

.cm-year b {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.88rem;
}

.cm-year span {
  font-size: 0.74rem;
  opacity: 0.9;
}

.cm-y1 { left: 6%; }
.cm-y2 { right: 6%; border-left: 3px solid var(--ember); }

.cm-split {
  position: absolute;
  z-index: 3;
  top: 53px;
  bottom: 0;
  left: 50%;
  width: 1px;
  background: #ffffff;
  pointer-events: none;
}

.cm-copy {
  position: absolute;
  z-index: 3;
  left: 6%;
  bottom: 28px;
  max-width: 560px;
}

.cm-h {
  font-weight: 700;
  font-size: clamp(1.5rem, 2.8vw, 2.25rem);
  line-height: 1.15;
  color: #ffffff;
  margin: 0 0 8px 0;
}

.cm-sub {
  font-size: 0.92rem;
  color: rgba(255, 255, 255, 0.94);
  margin: 0;
}

.cm-facts {
  background: var(--ink);
  color: #ffffff;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  border-top: 1px solid rgba(255,255,255,0.15);
}

.cm-fact {
  padding: 12px 24px;
  border-left: 1px solid rgba(255,255,255,0.14);
}

.cm-fact:first-child {
  border-left: none;
  padding-left: 6%;
}

.cm-fact b {
  display: block;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.82rem;
  margin-bottom: 2px;
  letter-spacing: 0.03em;
}

.cm-fact span {
  font-size: 0.8rem;
  opacity: 0.82;
}

/* CONTAINER */
.container {
  max-width: 1240px;
  margin: 0 auto;
  padding: 0 20px;
}

.cm-workbench-head {
  display: flex;
  justify-content: space-between;
  align-items: flex-end;
  gap: 16px;
  margin-bottom: 14px;
}

.cm-workbench-kicker {
  color: var(--muted);
  font: 0.68rem 'IBM Plex Mono', monospace;
  letter-spacing: 0.11em;
}

.cm-workbench-title {
  margin: 4px 0 0;
  font-size: 1.45rem;
  font-weight: 600;
}

.cm-workbench-status {
  display: flex;
  align-items: center;
  gap: 7px;
  color: var(--canopy);
  font: 0.68rem 'IBM Plex Mono', monospace;
  letter-spacing: 0.04em;
}

.cm-workbench-status i {
  width: 7px;
  height: 7px;
  display: inline-block;
  background: var(--leaf);
  box-shadow: 0 0 0 3px rgba(119,185,106,0.2);
}

/* CONFIG CARD */
.config-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-bottom: 14px;
}

.config-grid {
  display: grid;
  grid-template-columns: 1.1fr 1fr 1fr;
}

.config-col {
  padding: 16px;
  border-right: 1px solid var(--line);
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.config-col:last-child {
  border-right: none;
}

.p-label {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 600;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.p-num {
  color: var(--canopy);
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.78rem;
}

.p-state {
  margin-left: auto;
  padding: 2px 6px;
  border: 1px solid var(--line);
  color: var(--muted);
  font: 0.65rem 'IBM Plex Mono', monospace;
}

label {
  display: block;
  color: var(--muted);
  font-size: 0.74rem;
  font-weight: 500;
  margin-bottom: 2px;
}

input[type="text"],
input[type="number"],
select,
textarea {
  width: 100%;
  padding: 7px 9px;
  color: var(--ink);
  background: #fcfdfc;
  border: 1px solid var(--line);
  border-radius: 2px;
  font-family: inherit;
  font-size: 0.82rem;
}

input:focus, select:focus, textarea:focus {
  outline: 2px solid var(--canopy);
  outline-offset: -1px;
}

.search-row {
  display: flex;
  gap: 6px;
}

.coords-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.two-col {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

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

.field-caption {
  margin: 0;
  font-size: 0.76rem;
  color: #1c3d2b;
}

.warn-caption {
  color: #9e3f16;
}

.months-head {
  display: flex;
  justify-content: space-between;
  font-size: 0.74rem;
  color: var(--muted);
  margin-top: 4px;
}

.months-head span:last-child {
  color: var(--canopy);
  font-family: 'IBM Plex Mono', monospace;
}

.checks-row {
  display: flex;
  gap: 14px;
  margin: 6px 0;
}

.check-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 0.82rem;
  color: var(--ink);
  cursor: pointer;
}

input[type="checkbox"], input[type="range"] {
  accent-color: var(--canopy);
}

/* BUTTONS */
.btn-primary, .btn-secondary {
  border-radius: 2px;
  font-weight: 600;
  font-size: 0.86rem;
  padding: 9px 14px;
  cursor: pointer;
  font-family: inherit;
  transition: transform 0.15s ease, background-color 0.15s ease;
}

.btn-primary {
  background: var(--canopy);
  color: #ffffff;
  border: 1px solid var(--ink);
  width: 100%;
  margin-top: auto;
}

.btn-primary:hover:not(:disabled) {
  background: var(--ink);
}

.btn-primary:disabled {
  opacity: 0.65;
  cursor: wait;
}

.btn-secondary {
  background: var(--sheet);
  color: var(--ink);
  border: 1px solid var(--ink);
}

.btn-secondary:hover {
  background: #e9efe9;
}

.btn-sm {
  padding: 6px 12px;
  font-size: 0.78rem;
}

/* EXPANDER */
.expander {
  background: var(--sheet);
  border: 1px solid var(--line);
  border-radius: 2px;
  margin-bottom: 14px;
}

.expander summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 0.86rem;
  font-weight: 600;
}

.expander-body {
  padding: 12px 14px 16px;
  border-top: 1px solid var(--line);
}

.expander-body input[type="range"] {
  width: 100%;
}

/* CAVEAT & TELEMETRY */
.caveat-box {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  background: #fff7e8;
  border: 1px solid #e8d09c;
  border-left: 3px solid #c18a34;
  padding: 10px 12px;
  margin-bottom: 14px;
  font-size: 0.8rem;
}

.caveat-mark {
  display: grid;
  place-items: center;
  width: 18px;
  height: 18px;
  flex: 0 0 18px;
  border: 1px solid var(--ember);
  color: var(--ember);
  font: 0.76rem 'IBM Plex Mono', monospace;
}

.caveat-copy p {
  margin: 2px 0 0;
  color: #654a3e;
}

.caveat-meta {
  margin-left: auto;
  white-space: nowrap;
  color: #a95330;
  font: 0.65rem 'IBM Plex Mono', monospace;
}

.t-strip {
  background: #e9efe9;
  border: 1px solid var(--line);
  border-left: 3px solid var(--canopy);
  padding: 10px 14px;
  margin-bottom: 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 8px;
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.8rem;
}

.t-strip a {
  color: var(--canopy);
  font-weight: 600;
}

/* MAP */
.map-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 14px;
  margin-bottom: 16px;
}

#map {
  height: 440px;
  width: 100%;
  border: 1px solid var(--line);
}

/* STATUS */
.status-box {
  padding: 12px 16px;
  margin-bottom: 16px;
  border: 1px solid var(--line);
  border-left: 4px solid var(--canopy);
  background: var(--sheet);
  font-size: 0.88rem;
}

.status-box.error {
  border-left-color: var(--ember);
  background: #fff5f2;
  color: #7c1f0c;
}

/* METRICS & RESULTS */
.metrics-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.metrics-grid.four-col {
  grid-template-columns: repeat(4, 1fr);
}

.metric-card {
  background: #e8f2e8;
  border: 1px solid var(--line);
  border-top: 3px solid #367d53;
  padding: 10px 12px;
}

.metric-label {
  font-size: 0.74rem;
  font-weight: 600;
  color: var(--muted);
  text-transform: uppercase;
}

.metric-val {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 1.5rem;
  font-weight: 600;
  color: #206342;
  margin-top: 4px;
}

.summary-card, .empty-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 16px;
}

.tabs-bar {
  display: flex;
  gap: 4px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.tab-btn {
  background: transparent;
  border: none;
  border-bottom: 2px solid transparent;
  padding: 10px 14px;
  font-family: inherit;
  font-size: 0.86rem;
  font-weight: 600;
  color: var(--muted);
  cursor: pointer;
}

.tab-btn.active {
  color: var(--canopy);
  border-bottom-color: var(--canopy);
}

.tab-panel {
  display: none;
  background: var(--sheet);
  border: 1px solid var(--line);
  padding: 16px;
  margin-bottom: 16px;
}

.tab-panel.active {
  display: block;
}

.result-img {
  width: 100%;
  height: auto;
  display: block;
  border: 1px solid var(--line);
}

.img-caption {
  font-size: 0.78rem;
  color: var(--muted);
  margin: 6px 0 0;
}

/* SWIPE SLIDER */
.swipe-wrap {
  position: relative;
  width: 100%;
  max-width: 960px;
  margin: 0 auto 16px;
  border: 1px solid var(--line);
  overflow: hidden;
  user-select: none;
}

.swipe-wrap img {
  display: block;
  width: 100%;
  height: auto;
  pointer-events: none;
}

#swipe-before {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  clip-path: inset(0 50% 0 0);
}

.swipe-line {
  position: absolute;
  top: 0;
  bottom: 0;
  left: 50%;
  width: 2px;
  background: #ffffff;
  transform: translateX(-50%);
  pointer-events: none;
  z-index: 4;
}

.swipe-handle {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  padding: 4px 8px;
  background: var(--ink);
  border: 1px solid #ffffff;
  color: #ffffff;
  font-size: 10px;
  font-weight: 600;
  pointer-events: none;
  z-index: 5;
}

.swipe-label {
  position: absolute;
  top: 10px;
  padding: 4px 10px;
  background: rgba(16,35,26,0.9);
  color: #f8fafc;
  font-size: 11px;
  font-weight: 600;
  z-index: 6;
  pointer-events: none;
}

.swipe-label.left { left: 10px; }
.swipe-label.right { right: 10px; }

.swipe-range {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  opacity: 0;
  cursor: ew-resize;
  z-index: 10;
  margin: 0;
}

.side-by-side {
  margin-top: 12px;
}

.chart-wrap {
  margin: 16px 0;
  max-height: 320px;
}

.info-box {
  background: #e9f2f7;
  border: 1px solid #b5d1e2;
  padding: 12px 14px;
  margin: 12px 0;
  font-size: 0.84rem;
}

.info-box ul {
  margin: 6px 0 0;
  padding-left: 18px;
}

.download-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-bottom: 24px;
}

/* FOOTER */
.cm-foot {
  margin-top: 48px;
  background: var(--ink);
  color: #ffffff;
  border-top: 2px solid var(--canopy);
}

.cm-foot-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr 1fr;
  gap: 32px;
  padding: 32px 6%;
}

.cm-foot-copy {
  font-family: 'IBM Plex Mono', monospace;
  font-size: 0.85rem;
  color: rgba(255,255,255,0.85);
  margin-bottom: 10px;
}

.cm-foot-note {
  font-size: 0.82rem;
  color: rgba(255,255,255,0.8);
  max-width: 380px;
}

.cm-foot-head {
  font-family: 'IBM Plex Mono', monospace;
  font-weight: 600;
  font-size: 0.85rem;
  margin-bottom: 8px;
  text-transform: uppercase;
}

.cm-link {
  display: block;
  padding: 2px 0;
  font-size: 0.82rem;
  color: rgba(255,255,255,0.85);
  text-decoration: none;
}

.cm-link:hover {
  text-decoration: underline;
}

/* MODAL */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(16, 35, 26, 0.72);
  display: grid;
  place-items: center;
  z-index: 9999;
  padding: 20px;
}

.modal-card {
  background: var(--sheet);
  border: 1px solid var(--line);
  max-width: 680px;
  width: 100%;
  max-height: 85vh;
  overflow-y: auto;
  padding: 24px;
  position: relative;
}

.modal-close {
  position: absolute;
  top: 12px;
  right: 14px;
  background: none;
  border: none;
  font-size: 1.6rem;
  cursor: pointer;
  color: var(--ink);
}

@media (max-width: 900px) {
  .config-grid, .cm-facts, .cm-foot-grid, .metrics-grid, .download-grid, .three-col {
    grid-template-columns: 1fr;
  }
  .config-col {
    border-right: none;
    border-bottom: 1px solid var(--line);
  }
  .metrics-grid.four-col {
    grid-template-columns: 1fr 1fr;
  }
}
