:root {
  --ink: #14211f;
  --muted: #64716d;
  --paper: #f4f1e9;
  --surface: #fffdf7;
  --surface-2: #eef3ed;
  --line: #d8d4c8;
  --field: #183832;
  --field-2: #2e6f64;
  --clay: #df6b3a;
  --moss: #6d873f;
  --plum: #67435f;
  --shadow: 0 16px 32px rgba(24, 56, 50, 0.12);
  font-family: "Red Hat Text", ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  color: var(--ink);
  background: var(--paper);
  min-height: 100vh;
}

button, input, textarea, select { font: inherit; }
button { cursor: pointer; }
button:focus-visible, textarea:focus-visible, select:focus-visible {
  outline: 3px solid rgba(46, 111, 100, 0.28);
  outline-offset: 2px;
}

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

.hero {
  padding: 18px 0 12px;
  border-bottom: 1px solid rgba(24, 56, 50, 0.14);
}

.topbar, .section-heading, .location-panel, .export-panel, .item-row, .hero-metrics, .top-actions {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
}

.top-actions { flex-wrap: wrap; justify-content: flex-end; }

h1, h2, p { margin: 0; }
h1 {
  color: var(--field);
  font-family: "Sofia Sans Extra Condensed", "Red Hat Text", ui-sans-serif, system-ui, sans-serif;
  font-size: clamp(3.2rem, 13vw, 5.9rem);
  line-height: 0.86;
  letter-spacing: 0;
  text-transform: uppercase;
}
h2 {
  color: var(--field);
  font-size: 1.18rem;
  line-height: 1.1;
  letter-spacing: 0;
}

.eyebrow {
  color: var(--clay);
  font-size: 0.72rem;
  font-weight: 800;
  letter-spacing: 0.12em;
  text-transform: uppercase;
}

.hero-copy {
  max-width: 39rem;
  margin-top: 10px;
  color: #3f534f;
  font-size: 1rem;
  line-height: 1.45;
}

.hero-metrics {
  margin-top: 14px;
  justify-content: flex-start;
  overflow-x: auto;
  padding-bottom: 2px;
}

.hero-metrics span, .badge {
  border: 1px solid rgba(24, 56, 50, 0.16);
  background: rgba(255, 253, 247, 0.86);
  border-radius: 8px;
  padding: 8px 10px;
  white-space: nowrap;
}

.hero-metrics strong { color: var(--field); }

main {
  display: grid;
  gap: 12px;
  padding-top: 14px;
}

.card {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 14px;
  box-shadow: var(--shadow);
}

.section-heading { margin-bottom: 14px; align-items: flex-start; }
.section-heading.compact { align-items: center; }
.badge {
  color: var(--muted);
  font-size: 0.75rem;
  padding: 7px 9px;
}

.photo-drop {
  min-height: 236px;
  border: 2px dashed #b8b09f;
  border-radius: 8px;
  background: #f8f6ee;
  display: grid;
  place-items: center;
  text-align: center;
  color: var(--muted);
  overflow: hidden;
  position: relative;
}

.photo-drop::before {
  content: "";
  width: 54px;
  height: 40px;
  border: 3px solid rgba(24, 56, 50, 0.24);
  border-radius: 7px;
  position: absolute;
  top: calc(50% - 54px);
}

.photo-drop::after {
  content: "";
  width: 16px;
  height: 16px;
  border: 3px solid rgba(24, 56, 50, 0.24);
  border-radius: 50%;
  position: absolute;
  top: calc(50% - 42px);
}

.photo-drop input { position: absolute; inset: 0; opacity: 0; }
.photo-drop img { width: 100%; height: 100%; object-fit: cover; position: absolute; inset: 0; }
.photo-drop span {
  z-index: 1;
  display: grid;
  gap: 5px;
  padding: 74px 18px 18px;
}
.photo-drop strong { color: var(--ink); font-size: 1.02rem; }
.photo-drop.has-photo::before, .photo-drop.has-photo::after { display: none; }
.photo-drop.has-photo span {
  align-self: end;
  width: 100%;
  color: white;
  text-shadow: 0 2px 12px rgba(0, 0, 0, 0.45);
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.62));
  padding-top: 56px;
}
.photo-drop.has-photo strong { color: white; }

fieldset { border: 0; padding: 0; margin: 16px 0 0; }
legend, .field span { font-weight: 800; margin-bottom: 9px; display: block; }
.pill-grid, .chip-grid { display: flex; flex-wrap: wrap; gap: 7px; }

.pill, .chip {
  min-height: 40px;
  border: 1px solid var(--line);
  background: #fbfaf5;
  color: var(--ink);
  border-radius: 8px;
  padding: 9px 11px;
  font-weight: 700;
}
.pill.active { color: white; border-color: transparent; }
.chip.active { background: var(--field); color: white; border-color: var(--field); }

.field { display: block; margin-top: 16px; }
textarea, select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
  padding: 12px;
  color: var(--ink);
}
textarea { resize: vertical; min-height: 106px; }

.location-panel, .export-panel {
  margin-top: 14px;
  padding: 12px;
  background: var(--surface-2);
  border: 1px solid rgba(24, 56, 50, 0.08);
  border-radius: 8px;
  align-items: center;
}
small { color: var(--muted); display: block; line-height: 1.35; }

.primary, .secondary, .ghost {
  border: 0;
  border-radius: 8px;
  padding: 12px 14px;
  font-weight: 800;
}
.primary {
  width: 100%;
  margin-top: 14px;
  color: white;
  background: var(--field);
  box-shadow: 0 10px 20px rgba(24, 56, 50, 0.2);
}
.secondary { color: white; background: var(--field-2); }
.ghost {
  color: var(--field);
  background: rgba(255, 253, 247, 0.86);
  border: 1px solid rgba(24, 56, 50, 0.18);
}
.small { padding: 8px 10px; font-size: 0.8rem; }

.tabs {
  position: sticky;
  top: 0;
  z-index: 5;
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 4px;
  padding: 5px;
  background: rgba(244, 241, 233, 0.92);
  border: 1px solid var(--line);
  border-radius: 8px;
}
.tab {
  min-height: 40px;
  border: 0;
  border-radius: 6px;
  padding: 9px 8px;
  background: transparent;
  color: var(--muted);
  font-weight: 800;
}
.tab.active { background: var(--field); color: white; }
.hidden { display: none !important; }

.map-canvas {
  height: 430px;
  border-radius: 8px;
  overflow: hidden;
  position: relative;
  background: #dce7e2;
  border: 1px solid #c4d0cb;
}

.map-canvas .leaflet-container { font: inherit; }
.map-canvas .leaflet-control-attribution { font-size: 0.65rem; }
.map-pin {
  width: 32px;
  height: 32px;
  border-radius: 50% 50% 50% 6px;
  border: 3px solid white;
  box-shadow: 0 8px 18px rgba(0, 0, 0, 0.24);
  transform: rotate(-45deg);
}
.map-pin::after {
  content: "";
  position: absolute;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: white;
  left: 50%;
  top: 50%;
  transform: translate(-50%, -50%);
}

.map-popup {
  display: grid;
  gap: 6px;
  max-width: 220px;
}
.map-popup img {
  width: 100%;
  height: 110px;
  object-fit: cover;
  border-radius: 8px;
  background: var(--surface-2);
}
.map-popup strong { color: var(--field); }
.map-popup p { color: #354641; }
.map-popup small { line-height: 1.35; }
.leaflet-popup-content-wrapper { border-radius: 8px; box-shadow: 0 16px 34px rgba(31, 48, 42, 0.2); }
.leaflet-popup-content { margin: 12px; }
.leaflet-control-zoom a { color: var(--field); }

.map-note {
  margin-top: 8px;
  color: var(--muted);
  font-size: 0.76rem;
  width: 100%;
}
.legend { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 10px; }
.legend span, .item-meta span {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: 1px solid var(--line);
  border-radius: 7px;
  padding: 6px 8px;
  background: #fbfaf5;
  font-size: 0.76rem;
}
.swatch, .category-dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; flex: 0 0 auto; }

.observation-list { display: grid; gap: 10px; }
.observation-item {
  display: grid;
  grid-template-columns: 82px 1fr;
  gap: 11px;
  padding: 9px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: #fbfaf5;
}
.item-photo { width: 82px; height: 82px; object-fit: cover; border-radius: 7px; background: var(--surface-2); }
.item-category { text-transform: capitalize; }
.item-date { margin-left: auto; white-space: nowrap; }
.item-comment { margin: 5px 0 8px; color: #294e5b; line-height: 1.38; }
.item-meta { display: flex; gap: 6px; flex-wrap: wrap; }

.dashboard-grid { display: grid; grid-template-columns: repeat(2, minmax(0, 1fr)); gap: 9px; }
.stat {
  min-height: 96px;
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 12px;
  background: #fbfaf5;
}
.stat strong { font-size: 1.7rem; line-height: 1.05; display: block; color: var(--field); }
.export-actions { display: flex; gap: 8px; flex-wrap: wrap; }
.empty { color: var(--muted); padding: 20px; text-align: center; }

@media (max-width: 420px) {
  .topbar { align-items: flex-start; }
  .location-panel, .export-panel { align-items: stretch; flex-direction: column; }
  .location-panel button, .export-actions button { width: 100%; }
  .section-heading { gap: 8px; }
  .badge { display: none; }
}

@media (min-width: 780px) {
  .app-shell { padding-inline: 24px; }
  .hero { padding-top: 24px; }
  main {
    grid-template-columns: minmax(330px, 0.82fr) minmax(0, 1.18fr);
    align-items: start;
    gap: 16px;
  }
  .composer { position: sticky; top: 14px; }
  .tabs, .view { grid-column: 2; }
  .tabs { top: 14px; }
  .dashboard-grid { grid-template-columns: repeat(4, minmax(0, 1fr)); }
}
