:root {
  --text: #1e241c;
  --accent: #2d6a4f;
  --border: #d8e0d4;
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, sans-serif;
  line-height: 1.5;
  color: var(--text);
  background: #f7f9f6;
}

header {
  padding: 0.75rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
}

header a {
  font-weight: 600;
  text-decoration: none;
  color: var(--accent);
}

main {
  max-width: 42rem;
  margin: 0 auto;
  padding: 2rem 1.25rem 3rem;
}

h1 {
  margin: 0 0 0.75rem;
}

h4 {
  margin: 1rem 0 0 0;
}

a {
  color: var(--accent);
}

nav {
  margin: 0 0 1rem;
}

nav a {
  color: inherit;
}

nav a:hover {
  color: var(--accent);
}

p {
  margin: 0 0 1rem;
}

p[role="alert"] {
  padding: 0.75rem 1rem;
  color: #5c1f1f;
  background: #fdeaea;
  border: 1px solid #e8b4b4;
  border-radius: 6px;
}

form {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-end;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

form.miss-form {
  flex-direction: column;
  align-items: stretch;
}

form.miss-form > * {
  flex: 0 0 auto;
  width: 100%;
  min-width: 0;
}

form.miss-form [data-taxon-select] {
  flex: 0 0 auto;
  width: 100%;
}

form.miss-form button[type="submit"].miss-form__submit--pending {
  background: #6b7b76;
  cursor: wait;
}

form.miss-form button[type="submit"].miss-form__submit--pending:hover {
  background: #6b7b76;
}

label {
  font-weight: 600;
}

input,
select,
button {
  font: inherit;
}

input[type="number"] {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

input[type="text"],
select {
  display: block;
  width: 100%;
  margin-top: 0.25rem;
  padding: 0.5rem 0.65rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  background: #fff;
}

input[type="number"]:focus,
input:focus,
select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

button[type="submit"] {
  padding: 0.5rem 1rem;
  font-weight: 600;
  color: #fff;
  background: var(--accent);
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

button[type="submit"]:hover {
  background: #1b4332;
}

/* Taxon autocomplete (classes/ids used by taxon_select.js) */
[data-taxon-select] {
  position: relative;
  flex: 1 1 12rem;
  min-width: 0;
}

.taxon-select__query-wrap {
  position: relative;
}

.taxon-select--loading .taxon-select__query-wrap::after {
  content: "";
  position: absolute;
  right: 0.5rem;
  top: calc(50% - 0.45rem);
  width: 0.9rem;
  height: 0.9rem;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: taxon-select-spin 0.7s linear infinite;
  pointer-events: none;
}

@keyframes taxon-select-spin {
  to {
    transform: rotate(360deg);
  }
}

.taxon-select__suggestions {
  position: absolute;
  z-index: 1200;
  left: 0;
  right: 0;
  top: 100%;
  margin: 0.2rem 0 0;
  padding: 0;
  list-style: none;
  max-height: 14rem;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 4px;
}

.taxon-select__suggestion {
  border-bottom: 1px solid var(--border);
}

.taxon-select__suggestion:last-child {
  border-bottom: none;
}

.taxon-select__suggestion button {
  display: block;
  width: 100%;
  padding: 0.45rem 0.65rem;
  text-align: left;
  color: inherit;
  background: transparent;
  border: none;
  cursor: pointer;
}

.taxon-select__suggestion button:hover {
  background: #eef3eb;
}

[data-year-select] {
  flex: 0 0 auto;
}

[data-year-select] select {
  width: auto;
  min-width: 9rem;
}

main > div:has(table) {
  overflow-x: auto;
  background: #fff;
  border: 1px solid var(--border);
  border-radius: 6px;
}

table {
  width: 100%;
  border-collapse: collapse;
}

th,
td {
  padding: 0.6rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

thead th {
  font-weight: 600;
  text-transform: uppercase;
  background: #eef3eb;
}

tbody tr:last-child td {
  border-bottom: none;
}

td[colspan] {
  color: var(--muted);
  font-style: italic;
}

/* coord_radius_map.js — map + rectangles */
.coord-radius-map {
  margin: 0 0 1rem;
}

.coord-radius-map__viewport {
  height: min(55vh, 22rem);
  width: 100%;
  border: 1px solid var(--border);
  border-radius: 6px;
  overflow: hidden;
  background: #e8ebe6;
}

.coord-radius-map__viewport .leaflet-container {
  font: inherit;
}

.coord-radius-map__grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.coord-radius-map__hint {
  margin: 0.5rem 0 0;
  font-size: 0.9rem;
  color: #5c1f1f;
}

body.miss-map-page main {
  max-width: min(100%, 52rem);
}

footer {
  border-top: 1px solid var(--border);
  padding: 1rem 1.25rem;
}
