:root {
  --bg: #f3efe3;
  --panel: #fffdf7;
  --panel-strong: #f6f0e4;
  --text: #183229;
  --muted: #5d6f66;
  --line: #d9cebb;
  --accent: #1f7a4f;
  --accent-dark: #155437;
  --danger: #b64d3d;
  --shadow: 0 18px 40px rgba(45, 57, 43, 0.12);
  font-family: "Manrope", sans-serif;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background:
    radial-gradient(circle at top left, rgba(99, 150, 92, 0.25), transparent 32%),
    linear-gradient(180deg, #ebe5d4 0%, var(--bg) 50%, #efe9da 100%);
  color: var(--text);
  overflow-x: clip;
}

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

button {
  min-width: 0;
}

.app-shell {
  width: min(100%, 1180px);
  margin: 0 auto;
  padding: clamp(18px, 3vw, 32px) clamp(14px, 3vw, 28px) 36px;
}

.topbar,
.card-header,
.sample-counter,
.toggle-row,
.cta-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
}

.topbar > *,
.card-header > *,
.sample-counter > *,
.cta-row > * {
  min-width: 0;
}

.topbar {
  margin-bottom: 16px;
}

.eyebrow {
  margin: 0 0 4px;
  color: var(--muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

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

h1 {
  font-size: 1.8rem;
  line-height: 1;
}

h2 {
  font-size: 1.45rem;
  line-height: 1.1;
}

h3 {
  font-size: 1rem;
}

.step-pill,
.chip,
.map-chip {
  padding: 8px 12px;
  border-radius: 999px;
  background: rgba(31, 122, 79, 0.1);
  color: var(--accent-dark);
  font-weight: 700;
  font-size: 0.82rem;
}

.chip {
  white-space: nowrap;
  flex-shrink: 0;
}

.list-card.chip {
  margin-top: 12px;
}

.progress {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  margin-bottom: 18px;
}

.progress-step {
  min-width: 0;
  border: 1px solid var(--line);
  background: rgba(255, 255, 255, 0.7);
  border-radius: 14px;
  padding: 11px 8px;
  color: var(--muted);
  overflow-wrap: anywhere;
}

.progress-step.is-active {
  background: var(--text);
  color: white;
  border-color: var(--text);
}

.screen {
  display: none;
  gap: 14px;
  align-items: start;
}

.screen.is-active {
  display: grid;
}

.hero-card,
.action-card,
.list-card,
.mini-map-card,
.form-card,
.summary-card {
  background: var(--panel);
  border: 1px solid rgba(217, 206, 187, 0.8);
  border-radius: 24px;
  box-shadow: var(--shadow);
  min-width: 0;
}

.hero-card,
.action-card,
.list-card,
.mini-map-card,
.form-card,
.summary-card {
  padding: 18px;
}

.hero-copy,
.action-card,
.form-card,
.summary-card {
  display: grid;
  gap: 12px;
}

.hero-save-button {
  margin-top: 14px;
}

.save-feedback {
  min-height: 1.2em;
  color: var(--accent);
  font-size: 0.9rem;
  font-weight: 700;
}

.save-feedback.is-visible {
  animation: save-fade 4s ease;
}

.status-line {
  color: var(--accent);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-size: 0.82rem;
}

.status-line.is-warning {
  color: #a56a00;
}

.status-line.is-error {
  color: var(--danger);
}

.map-frame {
  position: relative;
}

.map-sketch {
  height: clamp(300px, 42vh, 480px);
  overflow: hidden;
  border-radius: 20px;
  background: #d7e5d0;
}

.map-crosshair {
  position: absolute;
  left: 50%;
  top: 50%;
  z-index: 450;
  width: 34px;
  height: 34px;
  transform: translate(-50%, -50%);
  pointer-events: none;
  display: grid;
  place-items: center;
}

.crosshair-icon {
  position: relative;
  width: 26px;
  height: 26px;
  border: 2px solid rgba(201, 63, 45, 0.95);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.2);
  box-shadow: 0 0 0 2px rgba(255, 255, 255, 0.8);
}

.crosshair-icon::before,
.crosshair-icon::after {
  content: "";
  position: absolute;
  background: rgba(201, 63, 45, 0.95);
}

.crosshair-icon::before {
  width: 2px;
  height: 30px;
  left: 50%;
  top: -4px;
  transform: translateX(-50%);
}

.crosshair-icon::after {
  width: 30px;
  height: 2px;
  left: -4px;
  top: 50%;
  transform: translateY(-50%);
}

.map-crosshair::after {
  content: "";
  position: absolute;
  width: 6px;
  height: 6px;
  border-radius: 999px;
  background: rgba(201, 63, 45, 1);
}

.mini-map {
  height: clamp(220px, 32vh, 360px);
}

.map-overlay-stack {
  position: absolute;
  left: 12px;
  top: 12px;
  z-index: 500;
  display: grid;
  gap: 8px;
}

.map-recenter-button {
  position: absolute;
  left: 10px;
  top: 78px;
  z-index: 500;
  width: 34px;
  height: 34px;
  display: grid;
  place-items: center;
  padding: 0;
  border-radius: 4px;
  border: 2px solid rgba(0, 0, 0, 0.2);
  background: #fff;
  color: var(--text);
  box-shadow: 0 1px 5px rgba(0, 0, 0, 0.35);
}

.target-icon {
  position: relative;
  width: 18px;
  height: 18px;
  border: 2px solid #2f3b34;
  border-radius: 999px;
}

.target-icon::before,
.target-icon::after {
  content: "";
  position: absolute;
  background: #2f3b34;
}

.target-icon::before {
  width: 2px;
  height: 18px;
  left: 50%;
  top: -2px;
  transform: translateX(-50%);
}

.target-icon::after {
  width: 18px;
  height: 2px;
  left: -2px;
  top: 50%;
  transform: translateY(-50%);
}

.map-recenter-button::after {
  content: "";
  position: absolute;
  width: 4px;
  height: 4px;
  border-radius: 999px;
  background: #2f3b34;
}

.counter-label,
.sample-meta,
.summary-copy,
.form-copy {
  color: var(--muted);
  font-size: 0.92rem;
}

.location-summary {
  display: grid;
  gap: 4px;
  margin-top: 10px;
  padding: 14px 16px;
  background: rgba(246, 240, 228, 0.65);
  border-radius: 14px;
}

@keyframes save-fade {
  0% { opacity: 0; transform: translateY(4px); }
  15% { opacity: 1; transform: translateY(0); }
  75% { opacity: 1; transform: translateY(0); }
  100% { opacity: 0; transform: translateY(-2px); }
}

label {
  display: grid;
  gap: 8px;
  font-weight: 700;
}

.inline-field {
  grid-template-columns: auto 1fr;
  align-items: center;
  gap: 12px;
  margin-top: 14px;
}

input,
select,
textarea {
  width: 100%;
  min-width: 0;
  border-radius: 16px;
  border: 1px solid var(--line);
  background: #fff;
  padding: 14px 16px;
  color: var(--text);
}

.toggle-row {
  align-items: stretch;
}

.toggle {
  flex: 1;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 14px;
  border: 1px solid var(--line);
  background: var(--panel-strong);
  border-radius: 16px;
  font-weight: 700;
}

.toggle input {
  width: auto;
  margin: 0;
}

.toggle-static {
  justify-content: center;
}

.primary-button,
.secondary-button,
.ghost-button {
  width: 100%;
  border-radius: 16px;
  padding: 15px 16px;
  border: 0;
  font-weight: 800;
}

.primary-button {
  background: var(--accent);
  color: white;
}

.primary-button:disabled {
  background: #90b8a3;
}

.secondary-button {
  background: var(--panel-strong);
  color: var(--text);
  border: 1px solid var(--line);
}

.ghost-button {
  width: auto;
  padding: 8px 10px;
  background: transparent;
  color: var(--danger);
  border: 1px solid rgba(182, 77, 61, 0.25);
}

.sample-list,
.review-list {
  list-style: none;
  padding: 0;
  margin: 14px 0 0;
  display: grid;
  gap: 10px;
}

.sample-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 14px;
  background: var(--panel-strong);
  border-radius: 16px;
}

.sample-main {
  display: grid;
  gap: 4px;
  min-width: 0;
}

.sample-actions {
  display: grid;
  gap: 8px;
  justify-items: end;
  text-align: right;
}

.sample-title,
.sample-meta,
.sample-coords {
  overflow-wrap: anywhere;
}

.sample-coords {
  color: var(--muted);
  font-size: 0.86rem;
}

.empty-state {
  padding: 18px;
  border-radius: 16px;
  background: var(--panel-strong);
  color: var(--muted);
  text-align: center;
}

.summary-copy {
  display: grid;
  gap: 8px;
}

.cta-grid {
  display: grid;
  gap: 10px;
}

.leaflet-container {
  font: inherit;
}

.sample-location-pin,
.saved-sample-pin {
  border-radius: 999px;
}

.sample-location-pin {
  width: 18px;
  height: 18px;
  background: #1e6ce3;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(30, 108, 227, 0.2);
}

.saved-sample-pin {
  width: 18px;
  height: 18px;
  background: #c93f2d;
  border: 3px solid #fff;
  box-shadow: 0 0 0 4px rgba(201, 63, 45, 0.25);
}

@media (max-width: 420px) {
  .app-shell {
    padding-inline: 12px;
  }

  .progress {
    grid-template-columns: 1fr;
  }

  .toggle-row,
  .cta-row {
    flex-direction: column;
  }

  .inline-field {
    grid-template-columns: 1fr;
    align-items: stretch;
  }

  .sample-row {
    display: grid;
    grid-template-columns: 1fr;
    align-items: start;
  }

  .sample-actions {
    justify-items: start;
    text-align: left;
  }
}

@media (min-width: 700px) {
  .topbar {
    margin-bottom: 20px;
  }

  .progress {
    gap: 10px;
    margin-bottom: 22px;
  }

  .progress-step {
    padding: 14px 16px;
  }

  #screen-sampling {
    grid-template-columns: minmax(0, 1.7fr) minmax(240px, 0.9fr);
  }

  #screen-review,
  #screen-order {
    grid-template-columns: minmax(0, 1.2fr) minmax(280px, 0.95fr);
  }

  .action-card,
  .mini-map-card,
  .summary-card {
    position: sticky;
    top: 24px;
  }

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

  .cta-row {
    display: grid;
    grid-column: 1 / -1;
  }

  .inline-field {
    grid-template-columns: minmax(84px, auto) minmax(0, 1fr);
  }
}

@media (min-width: 960px) {
  .app-shell {
    padding-bottom: 48px;
  }

  .topbar {
    align-items: end;
  }

  #screen-sampling {
    grid-template-columns: minmax(0, 1.85fr) minmax(280px, 0.8fr);
  }

  #screen-review,
  #screen-order {
    grid-template-columns: minmax(0, 1.3fr) minmax(320px, 0.9fr);
    gap: 18px;
  }

  .hero-card,
  .action-card,
  .list-card,
  .mini-map-card,
  .form-card,
  .summary-card {
    padding: 22px;
  }

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

  .cta-grid > :last-child {
    grid-column: 1 / -1;
  }
}
