:root {
  --header-bg: #0c1b50;
  --accent-teal: #009688;
  --accent-green: #748938;
  --accent-slate: #4b6576;
  --text: #1f2937;
  --muted: #64748b;
  --panel-bg: #ffffff;
  --panel-border: rgba(0, 0, 0, 0.08);
  --panel-shadow: 0 10px 30px rgba(15, 23, 42, 0.12);
  --map-bg: #e5e7eb;
}

* {
  box-sizing: border-box;
}

html {
  font-size: clamp(14px, 0.35vw + 12px, 18px);
}

body {
  margin: 0;
  font-family: "Poppins", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
  background: #e5e7eb;
  color: var(--text);
}

.api-key-gate {
  position: fixed;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  background: rgba(15, 23, 42, 0.68);
  z-index: 9999;
}

.api-key-gate[hidden] {
  display: none !important;
}

.api-key-card {
  width: min(36rem, 92vw);
  position: relative;
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 1rem;
}

.api-key-card a {
  color: #93c5fd;
  text-decoration: underline;
  word-break: break-all;
}

.api-key-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(2, 6, 23, 0.72);
  color: rgba(226, 232, 240, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  z-index: 1;
}

.api-key-close-btn:active {
  transform: translateY(1px);
}

.api-key-card h2 {
  margin: 0 0 0.85rem;
  font-size: 1.1rem;
}

.api-key-field {
  display: grid;
  gap: 0.4rem;
  margin: 0;
}

.api-key-input-row {
  display: flex;
  gap: 0.6rem;
  align-items: center;
}

.api-key-input {
  width: 100%;
  padding: 0.55rem 0.65rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(2, 6, 23, 0.72);
  color: #ffffff;
}

.api-key-input::placeholder {
  color: rgba(226, 232, 240, 0.55);
}

.api-key-actions {
  display: flex;
  gap: 0.6rem;
  align-items: center;
  margin-top: 0.9rem;
}

.api-key-actions button {
  white-space: nowrap;
}

.api-key-visibility-btn {
  width: 2.6rem;
  min-width: 2.6rem;
  height: 2.6rem;
  padding: 0;
  border-radius: 10px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(2, 6, 23, 0.72);
  color: rgba(226, 232, 240, 0.92);
}

.api-key-visibility-btn svg {
  width: 1.1rem;
  height: 1.1rem;
}

.api-key-notes {
  margin: 0.9rem 0 0;
  padding-left: 1.1rem;
  color: rgba(226, 232, 240, 0.82);
  font-size: 0.82rem;
  line-height: 1.45;
}

.api-key-error {
  margin: 0.7rem 0 0;
  min-height: 1.1rem;
  color: #fecaca;
  font-size: 0.85rem;
}

h1,
h2,
h3,
h4,
h5,
h6 {
  font-family: "Nunito Sans", system-ui, -apple-system, Segoe UI, Roboto, Helvetica, Arial, sans-serif;
}

.app {
  min-height: 100vh;
  background: #e5e7eb;
  color: var(--text);
}

.appFull {
  display: flex;
  flex-direction: column;
}

.topbar {
  width: 100%;
  box-sizing: border-box;
  min-height: 4.375rem;
  padding: 0 1.25rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid rgba(15, 23, 42, 0.25);
  font-weight: 700;
  font-size: 1.75rem;
  line-height: 1.15;
  background: var(--header-bg);
  color: #f8fafc;
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.25);
}

.topbarTitle {
  padding-right: 0.625rem;
  display: flex;
  flex-direction: column;
  gap: 0.375rem;
}

.appTitle {
  font-size: 1.875rem;
  line-height: 1.15;
  font-weight: 400;
  cursor: pointer;
  user-select: none;
}

.brandName {
  font-style: italic;
  font-weight: 800;
}

.brandTagline {
  font-style: normal;
  font-weight: 400;
}

.topbarInfoBtn {
  border: 1px solid rgba(255, 255, 255, 0.28);
  background: rgba(2, 6, 23, 0.25);
  color: rgba(248, 250, 252, 0.95);
  border-radius: 10px;
  padding: 0.45rem 0.75rem;
  font-weight: 700;
  font-size: 1rem;
  cursor: pointer;
}

.topbarInfoBtn:active {
  transform: translateY(1px);
}

.about-modal {
  position: fixed;
  inset: 0;
  z-index: 9998;
}

.about-modal[hidden] {
  display: none !important;
}

.about-modal-backdrop {
  position: absolute;
  inset: 0;
  background: rgba(15, 23, 42, 0.68);
}

.about-modal-card {
  position: absolute;
  left: 50%;
  top: 14vh;
  transform: translateX(-50%);
  width: min(44rem, calc(100vw - 2rem));
  background: #0f172a;
  color: #ffffff;
  border: 1px solid rgba(148, 163, 184, 0.25);
  border-radius: 12px;
  padding: 1rem 1rem 0.9rem;
  box-shadow: 0 20px 48px rgba(15, 23, 42, 0.45);
}

.about-modal-card h2 {
  margin: 0 0 0.65rem;
  font-size: 1.1rem;
}

.about-modal-card p {
  margin: 0.5rem 0;
  color: rgba(226, 232, 240, 0.9);
}

.about-modal-card ul {
  margin: 0.5rem 0 0;
  padding-left: 1.15rem;
  color: rgba(226, 232, 240, 0.85);
}

.about-muted {
  margin-top: 0.8rem;
  color: rgba(226, 232, 240, 0.75);
  font-size: 0.95rem;
}

.about-close-btn {
  position: absolute;
  top: 0.5rem;
  right: 0.5rem;
  width: 2.15rem;
  height: 2.15rem;
  border-radius: 10px;
  border: 1px solid rgba(148, 163, 184, 0.45);
  background: rgba(2, 6, 23, 0.72);
  color: rgba(226, 232, 240, 0.9);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  line-height: 1;
  cursor: pointer;
}

.appBody {
  --panel-width: 35%;
  flex: 1;
  min-height: 0;
  display: grid;
  grid-template-columns: var(--panel-width) 0.5rem minmax(0, 1fr);
  background: #e5e7eb;
}

.panel-resizer {
  cursor: col-resize;
  position: relative;
  background: transparent;
}

.panel-resizer::before {
  content: "";
  position: absolute;
  left: 50%;
  top: 0;
  transform: translateX(-50%);
  width: 2px;
  height: 100%;
  background: rgba(15, 23, 42, 0.12);
}

.panel-resizer:hover::before,
.panel-resizer:focus-visible::before,
.panel-resizer.is-dragging::before {
  background: rgba(15, 23, 42, 0.32);
}

.panel-resizer:focus-visible {
  outline: none;
}

#map {
  min-width: 0;
  min-height: 0;
  height: 100%;
  position: relative;
}
.map-controls {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 1000;
  width: clamp(14rem, 18vw, 18rem);
  max-height: calc(100% - 2rem);
  overflow: auto;
  padding: 0.75rem;
  border-radius: 0.75rem;
  background: #ffffff;
  border: 1px solid var(--panel-border);
  box-shadow: var(--panel-shadow);
}

.map-controls h2 {
  margin: 0 0 0.625rem;
  font-size: 1rem;
  color: var(--text);
}

.map-controls .layer-group label {
  color: var(--muted);
}

.debug-size-badge {
  position: fixed;
  right: 0.75rem;
  bottom: 0.75rem;
  z-index: 11000;
  padding: 0.28rem 0.5rem;
  border-radius: 0.35rem;
  background: rgba(15, 23, 42, 0.88);
  color: #f8fafc;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  line-height: 1.2;
  pointer-events: none;
  box-shadow: 0 4px 10px rgba(15, 23, 42, 0.24);
  white-space: nowrap;
}

.leaflet-container {
  background: var(--map-bg);
}

.leaflet-tile {
  outline: 1px solid transparent;
  backface-visibility: hidden;
}

.leaflet-tile-container {
  will-change: transform;
}

.custom-pin-icon {
  background: transparent;
  border: none;
}

.county-label {
  background: transparent;
  border: none;
}

.county-label-text {
  padding: 0.25rem 0.625rem;
  border-radius: 999px;
  background: rgba(55, 65, 81, 0.95);
  color: #ffffff;
  font-weight: 600;
  font-size: 0.85rem;
  letter-spacing: 0.02em;
  box-shadow: 0 4px 12px rgba(15, 23, 42, 0.3);
  white-space: nowrap;
}


.panel {
  min-width: 0;
  background: #e5e7eb;
  border-right: 1px solid var(--panel-border);
  display: flex;
  flex-direction: column;
  min-height: 0;
}

.panel-content {
  flex: 1;
  min-height: 0;
  overflow: auto;
  padding: 0.625rem 1.125rem 0.75rem;
  color: var(--text);
  display: flex;
  flex-direction: column;
}

.section-title {
  margin: 4px 0 12px;
  font-size: 0.85rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: rgba(30, 41, 59, 0.7);
}


.support-card {
  margin: 0 1.125rem 0.625rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  flex: 0 0 auto;
  background: #222;
  border-color: rgba(255, 255, 255, 0.1);
}

.panel-intro {
  margin: 0 0 16px;
  color: var(--muted);
  line-height: 1.6;
}

.sponsorButton {
  display: inline-block;
  text-decoration: none;
}

.bmcButton {
  height: 2.75rem;
  width: auto;
  display: block;
}

.footerCopyright {
  color: #ffffff;
  font-size: 0.95rem;
  font-weight: 500;
  text-align: right;
  margin-left: auto;
}

.controls {
  margin-top: 1.25rem;
  display: grid;
  gap: 1rem;
}

.controls-block {
  margin-top: 0;
}

.controls-compact {
  gap: 0.625rem;
  margin-top: 0;
}

.controls-compact .control-group label {
  font-size: 0.85rem;
  margin-bottom: 4px;
}

.controls-compact .control-group select {
  padding: 0.375rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.9rem;
}

.controls-compact .range-row span {
  font-size: 0.85rem;
}

.controls-compact .control-actions button {
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  font-size: 0.9rem;
}

.select-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.slider-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(0, 1fr);
  gap: 0.75rem;
}

.control-group label {
  display: block;
  font-size: 0.95rem;
  margin-bottom: 0.375rem;
  color: var(--text);
}

.control-group select,
.control-group input[type="range"] {
  width: 100%;
}

.checkbox-row label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.95rem;
}

.checkbox-row input[type="checkbox"] {
  width: 18px;
  height: 18px;
  accent-color: var(--accent-teal);
}

.control-group select {
  padding: 0.5rem 0.625rem;
  border-radius: 0.5rem;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: #ffffff;
  color: var(--text);
}

.range-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.range-row span {
  min-width: 1.5rem;
  text-align: center;
  color: var(--accent-teal);
  font-weight: 600;
}

.control-actions {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.control-actions button {
  flex: 1 1 8.75rem;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background: #f1f5f9;
  color: var(--text);
  font-weight: 600;
  cursor: pointer;
}

.control-actions button:hover {
  background: #e2e8f0;
}

.status {
  margin: 0;
  color: var(--muted);
  font-size: 0.9rem;
}

.status-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 0.72rem;
  font-weight: 700;
  border: 1px solid transparent;
  white-space: nowrap;
}

.status-confirmed {
  color: #14532d;
  background: #dcfce7;
  border-color: #86efac;
}

.status-unconfirmed {
  color: #7f1d1d;
  background: #fee2e2;
  border-color: #fca5a5;
}

.stats {
  display: grid;
  gap: 8px;
}

.stat {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  padding: 0.625rem 0.75rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(15, 23, 42, 0.08);
  background: #f8fafc;
}

.stat-label {
  font-size: 0.85rem;
  color: var(--muted);
}

.stat-value {
  font-size: 1.4rem;
  color: var(--accent-teal);
  font-weight: 700;
}

.info-block {
  margin-top: 12px;
  padding: 1rem;
  border-radius: 0.75rem;
  background: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.08);
  box-shadow: 0 8px 20px rgba(15, 23, 42, 0.06);
  color: var(--text);
}

.info-block.support-card {
  background: #222;
  border-color: rgba(255, 255, 255, 0.1);
  color: #ffffff;
}

.panel-content .info-block:first-child {
  margin-top: 6px;
}

.info-block.table-block {
  flex: 1 1 0;
  min-width: 0;
  min-height: 0;
  display: flex;
  flex-direction: column;
}

.info-block.table-block.table-empty {
  flex: 0 0 auto;
  min-height: auto;
}

.info-block.table-block.table-compact {
  flex: 0 0 auto;
  min-height: auto;
}

.info-block h2 {
  margin: 0 0 8px;
  font-size: 1.1rem;
  color: var(--accent-slate);
}

.table-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 8px;
}

.table-filters {
  display: inline-flex;
  align-items: center;
  gap: 0.875rem;
  flex: 0 0 auto;
}

.table-slider {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  color: var(--muted);
  font-size: 0.85rem;
}

.table-slider label {
  font-size: 0.85rem;
  color: var(--muted);
  white-space: nowrap;
}

.table-slider input[type="range"] {
  width: 7.5rem;
}

.table-slider span {
  min-width: 18px;
  text-align: center;
  color: var(--accent-teal);
  font-weight: 700;
}

.table-header h2 {
  margin-bottom: 0;
  display: flex;
  align-items: center;
  gap: 0.3em;
}

.table-heading-link {
  color: inherit;
  text-decoration: none;
}
.table-heading-link:hover {
  text-decoration: underline;
}

.table-count-badge {
  font-size: inherit;
  font-weight: 700;
  color: #7c3aed;
}

.table-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  color: var(--muted);
}

.table-toggle input[type="checkbox"] {
  width: 1rem;
  height: 1rem;
  accent-color: var(--accent-teal);
}

.google-map-btn {
  padding: 0.25rem 0.625rem;
  background: #4285f4;
  color: #ffffff;
  border: none;
  border-radius: 0.25rem;
  font-size: 0.74rem;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s;
}

.google-map-btn:hover {
  background: #1a73e8;
}

.google-map-btn:active {
  background: #1765cc;
}

.info-block ul {
  margin: 0;
  padding-left: 18px;
  color: var(--muted);
}

.layer-controls {
  display: grid;
  gap: 16px;
}

.layer-group h3 {
  margin: 0 0 8px;
  font-size: 0.9rem;
  color: var(--accent-slate);
}

.layer-group label {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  color: var(--muted);
  margin-bottom: 6px;
}

.aba-filter {
  margin-top: 8px;
  display: grid;
  gap: 6px;
}

.aba-filter label {
  font-size: 0.85rem;
  color: var(--muted);
}

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

.layer-group input[type="checkbox"],
.layer-group input[type="radio"] {
  width: 16px;
  height: 16px;
  accent-color: var(--accent-teal);
}

.table-wrap {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  overflow: auto;
  border-radius: 10px;
  border: 1px solid rgba(15, 23, 42, 0.08);
  max-height: none;
}

.info-block.table-block.table-empty .table-wrap,
.info-block.table-block.table-compact .table-wrap {
  flex: 0 0 auto;
  min-height: auto;
  max-height: min(44vh, 24rem);
}

.sightings-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.85rem;
  table-layout: fixed;
}

.sightings-table th,
.sightings-table td {
  text-align: left;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(15, 23, 42, 0.08);
  vertical-align: middle;
}

.sightings-table th {
  position: sticky;
  top: 0;
  background: #f1f5f9;
  color: var(--text);
  font-weight: 600;
  padding-top: 4px;
  padding-bottom: 4px;
  line-height: 1.1;
}

.sightings-table td {
  color: var(--muted);
}

.sightings-table .col-species {
  width: 39%;
}

.sightings-table .col-location {
  width: 34%;
}

.sightings-table .col-state {
  width: 2rem;
  text-align: left;
}

.sightings-table .col-county {
  width: 7.2rem;
}

.sightings-table .col-date {
  width: 3.25rem;
  text-align: left;
  white-space: nowrap;
}

.sightings-table .col-reports {
  width: 1.55rem;
  text-align: left;
}

.sightings-table .col-status {
  width: 1.2rem;
  text-align: left;
}

.sightings-table td.col-status {
  position: relative;
  padding: 0 8px;
}

.sightings-table .col-checkbox {
  width: 1.65rem;
  text-align: left;
}

.sightings-table .col-map {
  width: 2rem;
  text-align: center;
}

.sightings-table td.col-state,
.sightings-table th.col-state,
.sightings-table td.col-date,
.sightings-table th.col-date,
.sightings-table td.col-reports,
.sightings-table th.col-reports,
.sightings-table td.col-checkbox,
.sightings-table th.col-checkbox,
.sightings-table td.col-map,
.sightings-table th.col-map,
.sightings-table td.col-status,
.sightings-table th.col-status {
  padding-left: 4px;
  padding-right: 4px;
}

.sightings-table .col-checkbox input[type="checkbox"] {
  cursor: pointer;
  margin: 0;
}

.sightings-table th.col-checkbox {
  text-align: left;
}

.sightings-table th.col-status {
  text-align: left;
}

.sightings-table th.col-state,
.sightings-table th.col-date,
.sightings-table th.col-reports {
  text-align: left;
}

.sightings-table th.col-map,
.sightings-table td.col-map {
  text-align: center;
}

.county-cluster-label {
  background: transparent;
  border: none;
  pointer-events: none;
}

.county-cluster-label-text {
  transform: translateX(-50%);
  white-space: nowrap;
  font-size: 0.68rem;
  font-weight: 600;
  color: #f9fafb;
  text-shadow:
    0 0 3px rgba(0,0,0,0.9),
    0 1px 3px rgba(0,0,0,0.8),
    -1px 0 2px rgba(0,0,0,0.7),
    1px 0 2px rgba(0,0,0,0.7);
  letter-spacing: 0.02em;
  line-height: 1;
  padding-top: 2px;
}

.col-map-kml-btn {  border: none;
  background: transparent;
  color: var(--muted);
  padding: 0;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.col-map-kml-btn:hover {
  color: var(--accent-teal, #4285f4);
}

.col-map-kml-btn:active {
  color: var(--text);
}

.row-map-btn {
  border: none;
  background: transparent;
  color: var(--muted);
  font-size: 0.82rem;
  line-height: 1;
  padding: 0;
  cursor: pointer;
}

.row-map-btn:hover {
  color: var(--text);
}

.row-map-btn:focus-visible {
  outline: 2px solid rgba(66, 133, 244, 0.55);
  outline-offset: 2px;
  border-radius: 2px;
}

.sightings-table td.col-county,
.sightings-table th.col-county {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.sightings-table td,
.sightings-table th {
  white-space: nowrap;
}

.sightings-table td a {
  color: inherit !important;
  text-decoration: underline;
}

.sightings-table td a:hover {
  color: var(--text) !important;
}

.sightings-table tr:hover td {
  color: var(--text);
}

.legend {
  background: #ffffff;
  color: var(--text);
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.85rem;
  border: 1px solid rgba(15, 23, 42, 0.12);
  margin-bottom: 10px;
}

.legend-title {
  font-weight: 600;
  margin-bottom: 6px;
}

.legend-swatch {
  display: inline-block;
  width: 12px;
  height: 12px;
  border-radius: 50%;
  margin-right: 6px;
}

.legend-swatch.not-reviewed {
  background: #ff9500;
}

.legend-swatch.lower48 {
  background: #ef4444;
}

.legend-swatch.notable {
  background: #fb923c;
}

.legend-swatch.accepted {
  background: #ff3b30;
}

.species-cell {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
  max-width: 100%;
  white-space: nowrap;
}

.date-bubble {
  display: inline-block;
  padding: 1px 8px;
  border-radius: 999px;
  font-size: 0.78rem;
  font-weight: 400;
  line-height: 1.35;
  border: 1px solid rgba(15, 23, 42, 0.25);
}

.date-bubble-neutral {
  background: rgba(226, 232, 240, 0.42);
  border-color: rgba(148, 163, 184, 0.28);
  color: #1f2937;
}

.date-bubble-green-dark {
  background: #67AD6A;
  border-color: #67AD6A;
  color: #ffffff;
}

.date-bubble-green-light {
  background: #8DDF97;
  border-color: #8DDF97;
  color: #14532d;
}

.date-bubble-yellow {
  background: rgba(254, 249, 195, 0.52);
  border-color: rgba(250, 204, 21, 0.35);
  color: #713f12;
}

/* Both first & last reported today — brand-new species */
.date-bubble-new-today {
  background: #ef4444;
  border-color: #dc2626;
  color: #ffffff;
}

.status-dot {
  display: inline-block;
  width: 6px;
  height: 18px;
  position: absolute;
  left: 8px;
  top: 50%;
  transform: translateY(-50%);
  border-radius: 2px;
  border: 1px solid rgba(15, 23, 42, 0.25);
  flex: 0 0 auto;
}

.status-dot-confirmed {
  background: #22c55e;
}

.status-dot-pending {
  background: #f97316;
}

.species-name {
  display: inline-block;
}

.species-link {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  display: inline-block;
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.county-link {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

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

.state-link {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
}

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

.location-link {
  border: none;
  background: transparent;
  padding: 0;
  margin: 0;
  color: inherit;
  font: inherit;
  cursor: pointer;
  text-align: left;
  display: inline-block;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

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

.county-label {
  background: transparent;
  border: none;
}

.county-label-text {
  background: rgba(17, 24, 39, 0.7);
  color: #f9fafb;
  font-size: 0.8rem;
  font-weight: 600;
  padding: 4px 8px;
  border-radius: 999px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.25);
}

.aba-code-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 20px;
  height: 20px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
  color: #ffffff;
  border: 1px solid rgba(15, 23, 42, 0.2);
  flex: 0 0 auto;
}

.aba-code-1 { background: #16a34a; }
.aba-code-2 { background: #4ade80; color: #1a2e1a; }
.aba-code-3 { background: #facc15; color: #3b2e00; }
.aba-code-4 { background: #fb923c; }
.aba-code-5 { background: #ef4444; }
.aba-code-6 { background: #ef4444; }

.aba-code-unknown {
  background: #4b5563;
}

/* ABA-coded left border on table rows */
tr[data-aba="1"] { border-left: 3px solid #16a34a; }
tr[data-aba="2"] { border-left: 3px solid #4ade80; }
tr[data-aba="3"] { border-left: 3px solid #facc15; }
tr[data-aba="4"] { border-left: 3px solid #fb923c; }
tr[data-aba="5"] { border-left: 3px solid #ef4444; }
tr[data-aba="6"] { border-left: 3px solid #ef4444; }

@media (min-width: 901px) and (max-width: 1280px) {
  .map-controls {
    width: clamp(13rem, 20vw, 16rem);
  }

  .sightings-table {
    font-size: 0.8rem;
  }

  .sightings-table th,
  .sightings-table td {
    padding: 5px 7px;
  }

  .sightings-table th {
    padding-top: 3px;
    padding-bottom: 3px;
  }
}

@media (min-width: 1281px) and (max-width: 1800px) {
}

@media (min-width: 1801px) {
  .map-controls {
    width: clamp(15rem, 16vw, 19rem);
  }
}

@media (max-width: 900px) {
  .appBody {
    grid-template-columns: 1fr;
    grid-template-rows: minmax(50vh, 60vh) auto;
  }

  .panel-resizer {
    display: none;
  }

  #map {
    min-height: 50vh;
  }

  .panel {
    border-right: none;
    border-top: 1px solid var(--panel-border);
  }

  .slider-row {
    grid-template-columns: 1fr;
  }

  .select-row {
    grid-template-columns: 1fr;
  }

  /* Table header: wrap title + filters to separate lines on narrow screens */
  .table-header {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  .table-filters {
    width: 100%;
    justify-content: flex-start;
  }

  .table-slider input[type="range"] {
    width: 5rem;
  }

  /* Tighter table text on small screens */
  .sightings-table {
    font-size: 0.78rem;
  }

  .sightings-table th,
  .sightings-table td {
    padding: 5px 5px;
  }

  /* Hide permanent map labels on mobile — map is too small; tap markers for popups */
  .species-label {
    display: none !important;
  }
}

/* Ensure tooltips and popups appear above all markers */
.leaflet-tooltip-pane {
  z-index: 9998 !important;
}

.leaflet-popup-pane {
  z-index: 9999 !important;
}

.leaflet-tooltip {
  z-index: 9998 !important;
}

.species-label {
  background: rgba(255, 255, 255, 0.95) !important;
  border: 1px solid rgba(0, 0, 0, 0.2) !important;
  border-radius: 4px !important;
  padding: 2px 6px !important;
  font-size: 0.75rem !important;
  font-weight: 500 !important;
  color: #1f2937 !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.12) !important;
  white-space: nowrap !important;
}

.species-label::before {
  display: none !important;
}

.species-label-multi div {
  line-height: 1.4;
}

.leaflet-popup {
  z-index: 9999 !important;
}
