/* ==================== WOODSY THEME ==================== */
:root {
  --pine: #1a3a2a;
  --forest: #2d5a3d;
  --sage: #5a8a6a;
  --meadow: #7ab88a;
  --moss: #8fbc8f;
  --bark: #5c3a1e;
  --wood: #8B6914;
  --cabin: #d4a953;
  --parchment: #f5f0e4;
  --cream: #faf8f2;
  --stone: #6b6b6b;
  --river: #4a7c8a;
  --snow: #ffffff;
  --ember: #c45a3a;
  --shadow: rgba(0, 0, 0, 0.15);
  --wood-bg: #6b4226;
  /* Compatibility aliases — many components reference these names.
     Previously undefined → backgrounds rendered transparent and wallpaper
     bled through. Defining them here fixes readability across every tab. */
  --card-bg: #faf8f2;
  --border: rgba(90, 138, 106, 0.28);
  --text-secondary: #6b6b6b;
  --accent-green: var(--forest);
}

/* Wood grain texture on body */
* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Georgia', 'Times New Roman', serif;
  background: url('bg-wood.png') center/cover fixed var(--wood-bg);
  color: var(--pine);
  min-height: 100vh;
}

/* ==================== HEADER ==================== */
header {
  background: linear-gradient(135deg, var(--pine) 0%, var(--forest) 50%, #1a4a30 100%);
  color: var(--cream);
  padding: 0;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  position: sticky;
  top: 0;
  z-index: 100;
}
.header-inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 16px 24px 0;
}
.header-top {
  display: flex;
  align-items: flex-start;
  margin-bottom: 12px;
}
.header-right {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 6px;
  margin-left: auto;
  flex-shrink: 0;
  padding-top: 2px;
}
.logo {
  display: flex;
  align-items: center;
  gap: 14px;
}
.logo-icon { font-size: 2.4em; }
.logo h1 {
  font-size: 1.5em;
  font-weight: 700;
  letter-spacing: 0.5px;
  text-shadow: 0 2px 4px rgba(0,0,0,0.3);
}
.tagline {
  font-size: 0.85em;
  opacity: 0.8;
  font-style: italic;
}
.state-selector {
}
.state-selector select {
  background: rgba(255,255,255,0.12);
  color: white;
  border: 2px solid rgba(255,255,255,0.3);
  padding: 8px 14px;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.95em;
  cursor: pointer;
  min-width: 180px;
  appearance: auto;
}
.state-selector select:hover { border-color: var(--cabin); }
.state-selector select:focus { outline: none; border-color: var(--cabin); }
.state-selector select option { background: var(--pine); color: white; }
/* ==================== NAV (grouped dropdowns + hamburger) ==================== */
.wld-nav {
  position: relative;
  display: flex;
  align-items: stretch;
  gap: 2px;
}
.wld-nav-items {
  display: flex;
  align-items: stretch;
  gap: 2px;
  flex-wrap: nowrap;
}
.wld-nav-hamburger {
  display: none;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 12px;
  width: 44px;
  height: 44px;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  gap: 4px;
}
.wld-nav-hamburger span {
  display: block;
  width: 22px;
  height: 2px;
  background: rgba(255,255,255,0.9);
  border-radius: 2px;
  transition: all 0.25s ease;
}
.wld-nav-hamburger[aria-expanded="true"] span:nth-child(1) { transform: translateY(6px) rotate(45deg); }
.wld-nav-hamburger[aria-expanded="true"] span:nth-child(2) { opacity: 0; }
.wld-nav-hamburger[aria-expanded="true"] span:nth-child(3) { transform: translateY(-6px) rotate(-45deg); }

.nav-btn,
.wld-nav-group-trigger {
  background: transparent;
  border: none;
  color: rgba(255,255,255,0.78);
  padding: 10px 16px;
  font-size: 0.9em;
  font-family: inherit;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  white-space: nowrap;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}
.nav-btn:hover,
.wld-nav-group-trigger:hover { color: white; background: rgba(255,255,255,0.06); }
.nav-btn.active {
  color: var(--cabin);
  border-bottom-color: var(--cabin);
  background: rgba(255,255,255,0.10);
}
.wld-nav-group-trigger.has-active {
  color: var(--cabin);
  border-bottom-color: var(--cabin);
  background: rgba(255,255,255,0.10);
}
.wld-nav-group-trigger .caret {
  font-size: 0.75em;
  margin-left: 2px;
  opacity: 0.7;
  transition: transform 0.2s;
}
.wld-nav-group[aria-expanded="true"] .wld-nav-group-trigger .caret { transform: rotate(180deg); }

.wld-nav-group { position: relative; }
.wld-nav-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  min-width: 220px;
  background: linear-gradient(135deg, #1a3a2a 0%, #2d5a3d 100%);
  border: 1px solid rgba(255,255,255,0.12);
  border-top: none;
  border-radius: 0 0 10px 10px;
  box-shadow: 0 8px 22px rgba(0,0,0,0.28);
  padding: 6px 0;
  z-index: 1000;
  flex-direction: column;
}
.wld-nav-group[aria-expanded="true"] .wld-nav-dropdown {
  display: flex;
}
.wld-nav-dropdown .nav-btn {
  text-align: left;
  border-bottom: none;
  border-left: 3px solid transparent;
  padding: 9px 16px;
  width: 100%;
  justify-content: flex-start;
}
.wld-nav-dropdown .nav-btn:hover { background: rgba(255,255,255,0.08); }
.wld-nav-dropdown .nav-btn.active {
  border-bottom: none;
  border-left-color: var(--cabin);
  background: rgba(255,255,255,0.10);
}

/* Notification badge on nav buttons (e.g., SUM Sync count of items ready to bill). */
.nav-badge {
  display: inline-block;
  min-width: 18px;
  height: 18px;
  padding: 0 6px;
  margin-left: 6px;
  background: linear-gradient(135deg, #d97706, #b45309);
  color: #fff;
  font-size: 0.72em;
  font-weight: 700;
  line-height: 18px;
  border-radius: 9px;
  text-align: center;
  box-shadow: 0 1px 3px rgba(0,0,0,0.25);
  vertical-align: middle;
}

/* ==================== MAIN ==================== */
main {
  max-width: 1400px;
  margin: 0 auto;
  padding: 24px;
  min-height: calc(100vh - 200px);
}
.tab-content { display: none; }
.tab-content.active { display: block; animation: fadeIn 0.3s ease; }
@keyframes fadeIn { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: translateY(0); } }

.page-title {
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
  background: var(--parchment);
  padding: 16px 20px;
  border-radius: 12px;
  box-shadow: 0 2px 12px var(--shadow);
}
.page-title h2 { font-size: 1.6em; color: var(--pine); }
.page-title p { color: var(--stone); font-size: 0.95em; flex: 1; }

/* ==================== BUTTONS ==================== */
.btn-primary {
  background: linear-gradient(135deg, var(--forest), var(--sage));
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  font-size: 0.95em;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
  box-shadow: 0 2px 8px rgba(45,90,61,0.3);
}
.btn-primary:hover { transform: translateY(-1px); box-shadow: 0 4px 12px rgba(45,90,61,0.4); }
.btn-secondary {
  background: var(--cream);
  color: var(--forest);
  border: 2px solid var(--sage);
  padding: 8px 18px;
  border-radius: 8px;
  font-size: 0.9em;
  font-family: inherit;
  cursor: pointer;
  transition: all 0.2s;
}
.btn-secondary:hover { background: var(--sage); color: white; }

/* ==================== STATS GRID ==================== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 18px;
  margin-bottom: 28px;
}
.stat-card {
  background: linear-gradient(180deg, #fffaf0 0%, var(--cream) 100%);
  border-radius: 14px;
  padding: 26px 20px;
  text-align: center;
  box-shadow: 0 4px 16px var(--shadow);
  border: 1px solid rgba(45, 90, 61, 0.12);
  border-top: 5px solid var(--sage);
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  min-height: 150px;
}
.stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 22px rgba(45, 90, 61, 0.18);
}
.stat-card .stat-icon { font-size: 2.1em; margin-bottom: 8px; line-height: 1; }
.stat-card .stat-value {
  font-family: 'Playfair Display', Georgia, serif;
  font-size: 2.4em;
  font-weight: 700;
  color: var(--forest);
  line-height: 1.1;
  margin: 4px 0;
}
.stat-card .stat-label {
  font-size: 0.78em;
  color: var(--stone);
  margin-top: 6px;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}
.stat-card.accent { border-top-color: var(--wood); }
.stat-card.river { border-top-color: var(--river); }
.stat-card.ember { border-top-color: var(--ember); }

@media (max-width: 900px) and (min-width: 601px) {
  .stats-grid { grid-template-columns: repeat(3, minmax(0, 1fr)); gap: 12px; }
  .stat-card { padding: 20px 12px; min-height: 130px; }
  .stat-card .stat-value { font-size: 1.9em; }
}

/* ==================== CHARTS ==================== */
.dashboard-charts, .analytics-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
}
.chart-card {
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border: 1px solid rgba(90, 138, 106, 0.28);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.chart-card h3 {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fdfaf2 0%, #f3ebd8 100%);
  color: var(--pine);
  padding: 7px 14px;
  border-radius: 8px;
  border: 1px solid rgba(45, 90, 61, 0.22);
  border-left: 4px solid var(--sage);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
  font-size: 0.95em;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 14px;
  max-width: 100%;
}
.chart-card.wide { grid-column: 1 / -1; }
.chart-card canvas { max-height: 320px; }

/* ==================== FILTERS ==================== */
.filters-bar {
  display: flex;
  gap: 12px;
  margin-bottom: 20px;
  flex-wrap: wrap;
  background: var(--parchment);
  padding: 14px 18px;
  border-radius: 10px;
  box-shadow: 0 2px 8px var(--shadow);
}
.filters-bar select, .search-input {
  padding: 8px 14px;
  border: 2px solid #d0c9b8;
  border-radius: 8px;
  font-size: 0.9em;
  font-family: inherit;
  background: var(--cream);
  color: var(--pine);
  min-width: 160px;
}
.filters-bar select:focus, .search-input:focus { border-color: var(--sage); outline: none; }

/* ==================== CARD GRID ==================== */
.card-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(340px, 1fr)); gap: 20px; }

/* Polished survey card — solid panel, prominent stat, clean hierarchy */
.survey-card {
  background: linear-gradient(180deg, #fffdf6 0%, var(--cream) 100%);
  border-radius: 14px;
  padding: 0;
  box-shadow: 0 4px 16px rgba(0,0,0,0.18), 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid rgba(45,90,61,0.18);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  display: flex;
  flex-direction: column;
}
.survey-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0,0,0,0.24), 0 2px 6px rgba(0,0,0,0.12);
}

/* Top accent strip — colored by survey type */
.survey-card__strip { height: 6px; background: var(--sage); }
.survey-card.type-aerial .survey-card__strip { background: linear-gradient(90deg, #4a7c8a, #6ba0b0); }
.survey-card.type-ground .survey-card__strip { background: linear-gradient(90deg, var(--forest), var(--sage)); }
.survey-card.type-camera .survey-card__strip { background: linear-gradient(90deg, #b85c2a, var(--cabin)); }

.survey-card__body { padding: 18px 20px 16px; flex: 1; display: flex; flex-direction: column; }

.survey-card__head {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.survey-card__title {
  color: var(--pine);
  font-size: 1.05em;
  font-weight: 700;
  line-height: 1.25;
  margin: 0;
  flex: 1;
}
.survey-card__date {
  font-size: 0.78em;
  color: var(--stone);
  font-weight: 600;
  white-space: nowrap;
  background: rgba(90,138,106,0.1);
  padding: 4px 9px;
  border-radius: 8px;
}

.survey-card__badges {
  display: flex;
  gap: 6px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.survey-card__badges .badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 12px;
  font-size: 0.72em;
  font-weight: 700;
  letter-spacing: 0.3px;
  text-transform: uppercase;
}

/* Hero stat block — animals counted, big and bold */
.survey-card__stat {
  background: linear-gradient(135deg, rgba(45,90,61,0.08) 0%, rgba(90,138,106,0.12) 100%);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  display: flex;
  align-items: baseline;
  gap: 10px;
  border-left: 3px solid var(--forest);
}
.survey-card__stat-number {
  font-size: 2em;
  font-weight: 800;
  color: var(--forest);
  line-height: 1;
  font-family: 'Georgia', serif;
}
.survey-card__stat-label {
  font-size: 0.82em;
  color: var(--stone);
  font-weight: 600;
}

.survey-card__meta {
  display: grid;
  grid-template-columns: 1fr;
  gap: 6px;
  margin-bottom: 12px;
  font-size: 0.85em;
}
.survey-card__meta-row {
  display: flex;
  align-items: center;
  gap: 8px;
  color: var(--pine);
}
.survey-card__meta-icon {
  width: 20px;
  text-align: center;
  opacity: 0.75;
}
.survey-card__meta-label {
  color: var(--stone);
  min-width: 70px;
  font-size: 0.92em;
}
.survey-card__meta-value {
  color: var(--pine);
  font-weight: 600;
}

.survey-card__notes {
  background: rgba(212,169,83,0.1);
  border-left: 3px solid var(--cabin);
  border-radius: 4px;
  padding: 8px 12px;
  font-size: 0.82em;
  color: var(--bark);
  font-style: italic;
  margin-bottom: 12px;
  line-height: 1.4;
}

.survey-card__actions {
  display: flex;
  justify-content: flex-end;
  margin-top: auto;
  padding-top: 8px;
  border-top: 1px solid rgba(45,90,61,0.1);
}
.survey-card__sum-btn {
  background: linear-gradient(135deg, var(--forest), #1f4530);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(45,90,61,0.3);
  transition: transform 0.1s, box-shadow 0.2s;
}
.survey-card__sum-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(45,90,61,0.4);
}

.badge-aerial { background: #e3f2fd; color: #0d47a1; }
.badge-ground { background: #e8f5e9; color: #1b5e20; }
.badge-camera { background: #fff3e0; color: #bf360c; }
.badge-complete { background: #e8f5e9; color: #1b5e20; }
.badge-planned { background: #fff3e0; color: #bf360c; }
.badge-in-progress { background: #e3f2fd; color: #0d47a1; }

/* ===== Shared SUM button + queue-state chip ===== */
.wld-sum-btn {
  background: linear-gradient(135deg, #2d5a3d, #1f4530);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 6px 14px;
  cursor: pointer;
  font-size: 0.8em;
  font-weight: 700;
  letter-spacing: 0.3px;
  font-family: inherit;
  box-shadow: 0 2px 6px rgba(45,90,61,0.3);
  transition: transform 0.1s, box-shadow 0.2s;
}
.wld-sum-btn:hover { transform: translateY(-1px); box-shadow: 0 4px 10px rgba(45,90,61,0.4); }
.wld-sum-btn--sm { padding: 4px 10px; font-size: 11px; border-radius: 6px; margin-right: 4px; }

.wld-sum-chip {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.3px;
  vertical-align: middle;
  white-space: nowrap;
}
.wld-sum-chip--synced  { background: #e8f5e9; color: #1b5e20; border: 1px solid #a5d6a7; }
.wld-sum-chip--pending { background: #fff8e1; color: #8d6e00; border: 1px solid #ffe082; }
.wld-sum-chip--failed  { background: #ffebee; color: #b71c1c; border: 1px solid #ef9a9a; }

/* ==================== SPECIES GRID ==================== */
.species-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(300px, 1fr)); gap: 16px; }
.species-card {
  background: linear-gradient(180deg, #fffdf6 0%, var(--cream) 100%);
  border-radius: 14px;
  padding: 16px 18px;
  box-shadow: 0 4px 14px rgba(0,0,0,0.16), 0 1px 3px rgba(0,0,0,0.08);
  border: 1px solid rgba(45,90,61,0.16);
  display: flex;
  align-items: center;
  gap: 14px;
  transition: transform 0.2s, box-shadow 0.2s;
  position: relative;
  overflow: hidden;
}
.species-card::before {
  content: '';
  position: absolute;
  top: 0; left: 0; bottom: 0;
  width: 5px;
  background: var(--sage);
}
.species-card[data-cat="Mammal"]::before { background: linear-gradient(180deg, var(--forest), var(--sage)); }
.species-card[data-cat="Bird"]::before    { background: linear-gradient(180deg, #4a7c8a, #6ba0b0); }
.species-card[data-cat="Fish"]::before    { background: linear-gradient(180deg, #1d6f8e, #4a99b8); }
.species-card[data-cat="Reptile"]::before { background: linear-gradient(180deg, #6b5a2a, var(--cabin)); }
.species-card[data-cat="Amphibian"]::before { background: linear-gradient(180deg, #4a7c2a, #7ab84a); }

.species-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0,0,0,0.2); }
.species-card .sp-icon {
  font-size: 2.2em;
  background: rgba(45,90,61,0.06);
  width: 54px; height: 54px;
  border-radius: 12px;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
}
.species-card .sp-info { flex: 1; min-width: 0; }
.species-card .sp-info h4 {
  font-size: 1em;
  color: var(--pine);
  margin-bottom: 3px;
  font-weight: 700;
}
.species-card .sp-info .sci-name {
  font-style: italic;
  font-size: 0.82em;
  color: var(--stone);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.species-card .sp-info .sp-category {
  font-size: 0.7em;
  color: var(--forest);
  margin-top: 5px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  font-weight: 700;
}
.species-card .sp-status {
  margin-left: auto;
  font-size: 0.68em;
  padding: 4px 10px;
  border-radius: 12px;
  white-space: nowrap;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}
.status-lc { background: #e8f5e9; color: #2e7d32; }
.status-nt { background: #fff3e0; color: #e65100; }
.status-t { background: #fce4ec; color: #c62828; }
.status-e { background: #f8d7da; color: #721c24; }
.status-sc { background: #fff8e1; color: #f9a825; }

/* ==================== TABLE ==================== */
.table-wrapper { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; background: var(--cream); border-radius: 12px; overflow: hidden; box-shadow: 0 2px 10px var(--shadow); }
th { background: var(--forest); color: white; padding: 12px 14px; text-align: left; font-size: 0.85em; font-weight: 600; }
td { padding: 10px 14px; border-bottom: 1px solid #e0d9c8; font-size: 0.88em; }
tr:hover { background: #f0ece0; }

/* ==================== IMPORT ==================== */
.import-panel { display: grid; grid-template-columns: 1fr 1fr; gap: 20px; }
.import-card {
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border: 1px solid rgba(90, 138, 106, 0.28);
  border-radius: 14px;
  padding: 24px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.import-card h3 { color: var(--forest); margin-bottom: 12px; }
.code-block {
  background: var(--pine);
  color: var(--meadow);
  padding: 12px 16px;
  border-radius: 8px;
  font-family: monospace;
  font-size: 0.82em;
  margin: 12px 0;
  overflow-x: auto;
  white-space: pre;
}
.import-form { margin-top: 16px; }
.form-group { margin-bottom: 14px; }
.form-group label { display: block; font-size: 0.85em; color: var(--forest); font-weight: 600; margin-bottom: 4px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%;
  padding: 8px 12px;
  border: 2px solid #d0c9b8;
  border-radius: 8px;
  font-size: 0.9em;
  font-family: inherit;
  background: white;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--sage); outline: none; }
.form-row { display: grid; grid-template-columns: 1fr 1fr; gap: 12px; }
.import-result { margin-top: 16px; padding: 12px; border-radius: 8px; display: none; }
.import-result.success { display: block; background: #e8f5e9; color: #2e7d32; }
.import-result.error { display: block; background: #fce4ec; color: #c62828; }
.coming-soon-list { list-style: none; padding: 0; }
.coming-soon-list li { padding: 8px 0; border-bottom: 1px solid #e0d9c8; font-size: 0.9em; color: var(--stone); }

/* ==================== AGE/SEX CARDS ==================== */
.age-sex-card {
  background: var(--parchment);
  border-radius: 8px;
  padding: 12px;
  margin-bottom: 10px;
}
.age-sex-card h4 { font-size: 0.9em; color: var(--pine); margin-bottom: 8px; }
.ratio-bar { display: flex; height: 24px; border-radius: 6px; overflow: hidden; margin: 4px 0; }
.ratio-bar .male { background: var(--river); }
.ratio-bar .female { background: var(--ember); }
.ratio-bar .unknown { background: #ccc; }
.ratio-labels { display: flex; justify-content: space-between; font-size: 0.75em; color: var(--stone); }

/* ==================== REPORTS ==================== */
.report-panel { background: var(--cream); border-radius: 12px; padding: 24px; box-shadow: 0 2px 12px var(--shadow); }
.report-controls { display: flex; gap: 12px; margin-bottom: 20px; }
.report-output { font-size: 0.9em; line-height: 1.7; }
.report-output h3 { color: var(--forest); margin: 20px 0 10px; border-bottom: 2px solid var(--parchment); padding-bottom: 6px; }
.report-output table { margin: 12px 0; }

/* ==================== MODALS ==================== */
.modal { display: none; position: fixed; top: 0; left: 0; width: 100%; height: 100%; background: rgba(0,0,0,0.5); z-index: 200; align-items: center; justify-content: center; }
.modal.show { display: flex; }
.modal-content {
  background: var(--cream);
  border-radius: 16px;
  padding: 28px;
  max-width: 600px;
  width: 90%;
  max-height: 85vh;
  overflow-y: auto;
  box-shadow: 0 10px 40px rgba(0,0,0,0.3);
}
.modal-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 20px; }
.modal-header h3 { color: var(--pine); }
.modal-close { background: none; border: none; font-size: 1.4em; cursor: pointer; color: var(--stone); }

/* ==================== MEDIA / FIELD PHOTOS ==================== */
.exif-features { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; margin: 14px 0; }
.exif-feature { font-size: 0.88em; padding: 8px 12px; background: var(--parchment); border-radius: 6px; }
.drop-zone {
  border: 3px dashed var(--sage);
  border-radius: 12px;
  padding: 40px 20px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(90, 138, 106, 0.05);
  margin-top: 12px;
}
.drop-zone:hover, .drop-zone.dragover {
  border-color: var(--forest);
  background: rgba(90, 138, 106, 0.12);
  transform: scale(1.01);
}
.drop-icon { font-size: 3em; display: block; margin-bottom: 8px; }
.drop-zone p { color: var(--stone); font-size: 0.95em; }
.drop-zone small { color: var(--sage); }

.media-card {
  background: var(--parchment);
  border-radius: 10px;
  padding: 14px;
  margin-bottom: 12px;
  display: grid;
  grid-template-columns: 100px 1fr;
  gap: 14px;
  align-items: start;
}
.media-card img {
  width: 100px;
  height: 80px;
  object-fit: cover;
  border-radius: 8px;
  box-shadow: 0 2px 6px rgba(0,0,0,0.15);
}
.media-card .media-video {
  width: 100px;
  height: 80px;
  background: var(--pine);
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  color: white;
  font-size: 2em;
}
.media-meta { font-size: 0.82em; color: var(--stone); line-height: 1.6; }
.media-meta strong { color: var(--pine); }
.media-meta .exif-tag {
  display: inline-block;
  background: #e8f5e9;
  color: var(--forest);
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 0.9em;
  margin: 2px 2px;
}
.media-meta .no-gps { background: #fff3e0; color: #e65100; }
.media-species-select {
  margin-top: 6px;
  padding: 4px 8px;
  border: 1px solid #d0c9b8;
  border-radius: 6px;
  font-size: 0.85em;
  font-family: inherit;
  width: 100%;
}
.media-count-input {
  width: 60px;
  padding: 4px 8px;
  border: 1px solid #d0c9b8;
  border-radius: 6px;
  font-size: 0.85em;
  margin-left: 8px;
}
.file-count-badge {
  display: inline-block;
  background: var(--forest);
  color: white;
  padding: 2px 10px;
  border-radius: 12px;
  font-size: 0.8em;
  margin-left: 8px;
}

/* ==================== FOOTER ==================== */
footer {
  text-align: center;
  padding: 24px;
  color: var(--stone);
  font-size: 0.85em;
  margin-top: 40px;
}
.footer-sub { font-size: 0.8em; margin-top: 4px; opacity: 0.7; }
.footer-tagline { font-style: italic; font-size: 0.95em; color: var(--moss, #8fbc8f); margin: 0 0 8px; }
.footer-divider { border: none; border-top: 1px solid #d0c9b8; width: 60px; margin: 6px auto 8px; }
.footer-copyright { font-size: 0.8em; color: rgba(255,255,255,0.65); margin: 0; }
.footer-copyright a { color: inherit; text-decoration-color: rgba(255,255,255,0.4); }

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  .dashboard-charts, .analytics-grid, .import-panel { grid-template-columns: 1fr; }
  .chart-card.wide { grid-column: 1; }
  .stats-grid { grid-template-columns: repeat(2, minmax(0, 1fr)); }
  .card-grid { grid-template-columns: 1fr; }
  .form-row { grid-template-columns: 1fr; }
  .wld-nav { gap: 0; }
}

/* Hamburger drawer kicks in for iPad portrait + phones. */
@media (max-width: 980px) {
  .wld-nav { justify-content: flex-end; padding: 6px 0; }
  .wld-nav-hamburger { display: flex; }
  .wld-nav-items {
    display: none;
    position: absolute;
    top: 100%;
    right: 0;
    left: 0;
    flex-direction: column;
    flex-wrap: nowrap;
    background: linear-gradient(180deg, #1a3a2a 0%, #2d5a3d 100%);
    border-top: 1px solid rgba(255,255,255,0.08);
    box-shadow: 0 12px 28px rgba(0,0,0,0.35);
    padding: 8px 0;
    z-index: 1000;
    max-height: calc(100vh - 120px);
    overflow-y: auto;
  }
  .wld-nav.is-open .wld-nav-items { display: flex; }
  .wld-nav-items > .nav-btn,
  .wld-nav-group { width: 100%; }
  .wld-nav-items > .nav-btn {
    text-align: left;
    border-bottom: none;
    border-left: 3px solid transparent;
    padding: 12px 20px;
  }
  .wld-nav-items > .nav-btn.active {
    border-bottom: none;
    border-left-color: var(--cabin);
  }
  .wld-nav-group-trigger {
    width: 100%;
    text-align: left;
    justify-content: space-between;
    padding: 12px 20px;
    border-bottom: none;
    border-left: 3px solid transparent;
  }
  .wld-nav-group-trigger.has-active {
    border-bottom: none;
    border-left-color: var(--cabin);
  }
  .wld-nav-dropdown {
    position: static;
    width: 100%;
    min-width: 0;
    background: rgba(0,0,0,0.18);
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 4px 0;
  }
  .wld-nav-dropdown .nav-btn { padding-left: 44px; }
}

/* iOS / tablet wallpaper + width fix.
   Desktop keeps background-attachment: fixed. On touch devices iOS Safari
   renders fixed backgrounds at full document size — wallpaper looks zoomed
   and blurry, and can push the page wider than the viewport (content ends
   up jammed in the left third). Scrolling background + locked viewport
   width restores centered, crisp layout. */
@media (max-width: 1024px) {
  html, body {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
  }
  body {
    background: url('bg-wood.png') center top / cover no-repeat var(--wood-bg);
    background-attachment: scroll;
  }
  header, main, footer { width: 100%; }
  .header-inner { max-width: 100%; }
}

/* iPhone-grade fix: lock everything to viewport width, tile the wallpaper at a
   sensible natural size so it doesn't zoom + blur, and force common overflow
   culprits (min-width selects, wide grids) to behave. Desktop untouched. */
@media (max-width: 600px) {
  html, body {
    width: 100vw !important;
    max-width: 100vw !important;
    overflow-x: hidden !important;
  }
  body {
    /* Repeat-tile the wood at natural size — no more cover-stretch blur */
    background: var(--wood-bg) url('bg-wood.png') 0 0 / 480px auto repeat !important;
    background-attachment: scroll !important;
  }
  header, main, footer, section, .tab-content {
    width: 100%;
    max-width: 100vw;
    box-sizing: border-box;
    min-width: 0;
  }
  main { padding-left: 12px !important; padding-right: 12px !important; }
  .header-inner { padding-left: 12px; padding-right: 12px; }
  /* Single column for everything on phones */
  .feature-grid,
  .steps-grid,
  .resource-grid,
  .security-grid,
  .stats-grid,
  .dashboard-charts,
  .analytics-grid,
  .trend-charts-grid {
    grid-template-columns: 1fr !important;
  }
  /* Kill min-widths that force horizontal overflow */
  .fp-trend-controls select,
  .filters-bar select,
  .filters-bar input { min-width: 0 !important; max-width: 100%; }
  /* Tables get their own scroll region instead of pushing the page wide */
  .table-wrapper { overflow-x: auto; max-width: 100%; }
  /* Map respects viewport */
  #fauna-map, #flight-path-map { max-width: 100%; }
  /* Hero text scales down */
  .welcome-hero h1 { font-size: 2em; }
  .welcome-section { padding: 18px; }
}

/* ==================== WELCOME / HOME ==================== */
.welcome-hero {
  text-align: center;
  padding: 50px 30px 40px;
  background: linear-gradient(135deg, rgba(26,58,42,0.92), rgba(45,90,61,0.88)), url('bg-wood.png') center/cover;
  border-radius: 16px;
  color: white;
  margin-bottom: 24px;
  box-shadow: 0 6px 30px rgba(0,0,0,0.3);
}
.hero-icon { font-size: 4em; margin-bottom: 10px; }
.welcome-hero h1 { font-size: 2.8em; letter-spacing: 1px; margin-bottom: 8px; text-shadow: 0 3px 8px rgba(0,0,0,0.3); }
.hero-tagline { font-size: 1.2em; font-style: italic; opacity: 0.9; margin-bottom: 14px; }
.hero-sub { font-size: 0.95em; opacity: 0.8; max-width: 600px; margin: 0 auto; line-height: 1.6; }

.welcome-section {
  background: var(--cream);
  border-radius: 14px;
  padding: 30px;
  margin-bottom: 20px;
  box-shadow: 0 3px 16px var(--shadow);
}
.welcome-section h2 {
  font-size: 1.4em;
  color: var(--forest);
  margin-bottom: 16px;
  padding-bottom: 10px;
  border-bottom: 2px solid var(--parchment);
}
.welcome-section h3 {
  font-size: 1.1em;
  color: var(--forest);
  margin-bottom: 12px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(90, 138, 106, 0.22);
  letter-spacing: 0.02em;
  font-weight: 700;
}
.welcome-section p { margin-bottom: 12px; line-height: 1.7; }

/* Feature Grid */
.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
  margin-top: 16px;
}
.feature-card {
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border: 1px solid rgba(90, 138, 106, 0.28);
  border-radius: 12px;
  padding: 20px;
  border-left: 4px solid var(--sage);
  transition: transform 0.2s, box-shadow 0.2s;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.10);
}
.feature-card:hover { transform: translateY(-2px); box-shadow: 0 6px 16px rgba(0, 0, 0, 0.16); }
.feature-icon { font-size: 1.8em; display: block; margin-bottom: 8px; }
.feature-card h3 {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: linear-gradient(135deg, #fdfaf2 0%, #f3ebd8 100%);
  color: var(--pine);
  padding: 5px 12px;
  border-radius: 7px;
  border: 1px solid rgba(45, 90, 61, 0.20);
  border-left: 3px solid var(--sage);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
  font-size: 0.95em;
  font-weight: 700;
  margin: 0 0 8px;
  max-width: 100%;
}
.feature-card p { font-size: 0.88em; color: var(--stone); margin: 0; }

/* Mission */
.welcome-section.mission blockquote {
  font-size: 1.1em;
  font-style: italic;
  color: var(--forest);
  border-left: 4px solid var(--cabin);
  padding: 16px 20px;
  margin: 0 0 16px;
  background: rgba(212,169,83,0.08);
  border-radius: 0 10px 10px 0;
}

/* Steps Grid — balanced 2x2 on desktop (4 cards) */
.steps-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 16px;
  margin-top: 16px;
}
.step-card {
  background: var(--parchment);
  border-radius: 12px;
  padding: 20px;
  text-align: center;
  position: relative;
}
.step-number {
  width: 40px;
  height: 40px;
  background: var(--forest);
  color: white;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2em;
  font-weight: 700;
  margin: 0 auto 12px;
}
.step-card h3 { font-size: 0.95em; color: var(--forest); margin-bottom: 6px; }
.step-card p { font-size: 0.85em; color: var(--stone); margin: 0; }

/* Resource Grid */
.resource-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 16px;
  margin-top: 16px;
}
.resource-card {
  background: var(--parchment);
  border-radius: 12px;
  padding: 20px;
  text-decoration: none;
  color: inherit;
  border: 2px solid transparent;
  transition: all 0.2s;
  display: block;
}
.resource-card:hover { border-color: var(--sage); transform: translateY(-2px); }
.resource-icon { font-size: 2em; display: block; margin-bottom: 8px; }
.resource-card h3 { font-size: 1em; color: var(--forest); margin-bottom: 6px; }
.resource-card p { font-size: 0.85em; color: var(--stone); margin-bottom: 8px; }
.resource-link { font-size: 0.82em; color: var(--sage); font-weight: 600; font-style: italic; }

/* Security Grid — balanced 2x2 (was auto-fit which packed 3+1) */
.security-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  grid-auto-rows: 1fr;
  gap: 16px;
  margin-top: 16px;
}
.security-item {
  background: var(--parchment);
  border-radius: 12px;
  padding: 20px;
  border-top: 4px solid var(--forest);
}
.security-icon { font-size: 1.6em; display: block; margin-bottom: 8px; }
.security-item h3 { font-size: 0.95em; color: var(--pine); margin-bottom: 6px; }
.security-item p { font-size: 0.85em; color: var(--stone); margin: 0; line-height: 1.6; }

/* Terms */
.terms-content { font-size: 0.9em; }
.terms-content ul { margin: 12px 0 12px 20px; }
.terms-content li { margin: 8px 0; line-height: 1.6; color: var(--stone); }
.terms-content li strong { color: var(--pine); }

/* Dev Status */
.dev-status {
  display: flex;
  gap: 20px;
  align-items: flex-start;
}
.status-badge {
  padding: 8px 20px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.9em;
  letter-spacing: 1px;
  white-space: nowrap;
}
.status-badge.beta { background: #e8a838; color: white; }
.status-info p { margin-bottom: 8px; }
.status-version { font-size: 0.82em; color: var(--stone); font-style: italic; margin-top: 12px; }

/* CTA */
.welcome-cta {
  text-align: center;
  background: linear-gradient(135deg, rgba(26,58,42,0.92), rgba(45,90,61,0.88));
  color: white;
  border-radius: 14px;
  padding: 36px 30px;
  margin-bottom: 20px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
}
.welcome-cta h2 { font-size: 1.4em; margin-bottom: 10px; border: none; padding: 0; color: white; }
.welcome-cta p { opacity: 0.9; margin-bottom: 6px; }
.cta-sub { font-size: 0.88em; opacity: 0.7; }

/* ==================== MAP ==================== */
#fauna-map { z-index: 1; }
.map-stats {
  display: flex;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}
.map-stat {
  background: var(--cream);
  border-radius: 10px;
  padding: 10px 18px;
  box-shadow: 0 2px 8px var(--shadow);
  font-size: 0.9em;
  display: flex;
  align-items: center;
  gap: 8px;
}
.map-stat strong { color: var(--forest); font-size: 1.2em; }
.map-legend {
  background: var(--cream);
  border-radius: 10px;
  padding: 14px 20px;
  margin-top: 16px;
  box-shadow: 0 2px 8px var(--shadow);
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
  font-size: 0.85em;
}
.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
}
.legend-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid rgba(0,0,0,0.2);
}
.leaflet-popup-content { font-family: Georgia, serif; font-size: 0.9em; line-height: 1.5; }
.leaflet-popup-content strong { color: var(--forest); }
.popup-count { font-size: 1.3em; font-weight: 700; color: var(--forest); }

/* ==================== FLIGHT PATHS TAB ==================== */
/* Reusable section-header pill — floats on the wallpaper like a name tag.
   Apply with class="wld-section-header" on h3 sub-titles. */
.wld-section-header {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  background: linear-gradient(135deg, #fdfaf2 0%, #f3ebd8 100%);
  color: var(--pine);
  padding: 12px 26px;
  border-radius: 12px;
  border: 1px solid rgba(45, 90, 61, 0.28);
  border-left: 5px solid var(--forest);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.22);
  font-size: 1.15em;
  font-weight: 700;
  letter-spacing: 0.02em;
  margin: 0 0 16px;
  max-width: 100%;
}
.wld-section-header__hint {
  font-size: 0.72em;
  font-weight: 500;
  color: var(--stone);
  font-style: italic;
  letter-spacing: 0;
}

/* Reusable mini sub-title — smaller cousin of .wld-section-header for
   chart/feature titles, table sub-heads, or any sub-title that needs to
   read against the woodgrain wallpaper without competing with the main
   section header. Auto-applies to chart-card and feature-card h3s below. */
.wld-mini-title {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: linear-gradient(135deg, #fdfaf2 0%, #f3ebd8 100%);
  color: var(--pine);
  padding: 7px 16px;
  border-radius: 8px;
  border: 1px solid rgba(45, 90, 61, 0.22);
  border-left: 4px solid var(--sage);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.14);
  font-size: 0.98em;
  font-weight: 700;
  letter-spacing: 0.01em;
  margin: 0 0 10px;
  max-width: 100%;
}

/* Cream callout for empty-state and helper messages that would otherwise
   sit naked on the woodgrain wallpaper. */
.wld-empty-state {
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border: 1px solid rgba(90, 138, 106, 0.28);
  border-radius: 12px;
  padding: 28px 24px;
  text-align: center;
  color: var(--stone);
  font-style: italic;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
  margin: 8px 0;
}

/* Reusable section-card surface — wraps the content under each header
   so tables / legends / forms sit on cream instead of on woodgrain. */
.wld-section-card {
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border: 1px solid rgba(90, 138, 106, 0.28);
  border-radius: 14px;
  padding: 22px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}

.flightpath-controls { margin-bottom: 24px; }
.fp-upload-panel {
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border-radius: 14px;
  padding: 24px;
  border: 1px solid rgba(90, 138, 106, 0.28);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
}
.fp-upload-panel h3 { color: var(--forest); margin-bottom: 16px; font-size: 1.2em; }

.fp-map-section,
.fp-list-section,
.fp-campaigns-section,
.fp-trends-section,
.fp-templates-section {
  margin: 26px 0;
  background: linear-gradient(180deg, rgba(252, 248, 238, 0.86) 0%, rgba(245, 240, 228, 0.82) 100%);
  border: 1px solid rgba(45, 90, 61, 0.22);
  border-radius: 16px;
  padding: 22px 22px 18px;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(2px);
}
.fp-map-section h3 { color: var(--forest); margin-bottom: 12px; font-size: 1.2em; }
.fp-map-controls {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  margin-bottom: 12px;
  padding: 12px 16px;
  background: rgba(250, 248, 242, 0.92);
  border: 1px solid rgba(90, 138, 106, 0.22);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.fp-map-controls select { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px; background: var(--card-bg); color: var(--pine); }
.fp-map-controls label { color: var(--pine) !important; font-weight: 500; }

.fp-stats {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-bottom: 14px;
}
.fp-stat-card {
  flex: 1 1 160px;
  position: relative;
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border: 1px solid rgba(90, 138, 106, 0.28);
  border-radius: 12px;
  padding: 18px 22px 16px;
  text-align: center;
  min-width: 150px;
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.12);
  transition: transform 0.18s ease, box-shadow 0.18s ease;
  overflow: hidden;
}
.fp-stat-card::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--forest), var(--sage));
}
.fp-stat-card:hover { transform: translateY(-2px); box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18); }
.fp-stat-value { font-family: Georgia, 'Times New Roman', serif; font-size: 2em; font-weight: 700; color: var(--forest); line-height: 1.1; }
.fp-stat-label { font-size: 0.72em; color: var(--stone); margin-top: 6px; text-transform: uppercase; letter-spacing: 0.08em; font-weight: 600; }

.fp-legend {
  display: flex;
  gap: 16px;
  flex-wrap: wrap;
  margin-top: 12px;
  padding: 12px 16px;
  background: rgba(250, 248, 242, 0.95);
  border-radius: 10px;
  border: 1px solid rgba(90, 138, 106, 0.25);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.fp-legend strong { color: var(--pine) !important; }
.fp-legend-item { display: flex; align-items: center; gap: 6px; font-size: 13px; color: var(--pine); }
.fp-color { width: 14px; height: 4px; border-radius: 2px; display: inline-block; }

.fp-list-section h3 { color: var(--forest); margin-bottom: 12px; font-size: 1.2em; }
.fp-list-section .table-wrapper {
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border: 1px solid rgba(90, 138, 106, 0.28);
  border-radius: 14px;
  padding: 12px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.12);
  overflow-x: auto;
}
.fp-list-section table { background: transparent; }
.fp-list-section table th { color: var(--pine); background: rgba(245, 240, 228, 0.6); }
.fp-list-section table td { color: var(--pine); }

.fp-templates-section > h3:not(.wld-section-header) { color: var(--forest); margin-bottom: 8px; font-size: 1.2em; }
/* Bare-paragraph subtitle pill — applied wherever a <p> sits as a direct child
   of a Flight-Paths section, so it reads against the woodgrain wallpaper. */
.fp-templates-section > p,
.fp-campaigns-section > p,
.fp-trends-section > p,
#tab-flightpaths > .page-title + p,
.fp-map-section > p {
  background: linear-gradient(135deg, #faf8f2 0%, #f5f0e4 100%);
  display: inline-block;
  padding: 7px 16px;
  border-radius: 8px;
  border-left: 3px solid var(--sage);
  color: var(--pine);
  font-style: italic;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.10);
  max-width: 100%;
}

#gpx-drop-zone {
  border: 2px dashed var(--sage);
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  cursor: pointer;
  transition: all 0.3s;
  background: rgba(90,138,106,0.05);
}
#gpx-drop-zone:hover, #gpx-drop-zone.drag-over {
  border-color: var(--forest);
  background: rgba(90,138,106,0.12);
}
#gpx-drop-zone .drop-icon { font-size: 2em; }

@media (max-width: 768px) {
  .fp-map-controls { flex-direction: column; }
  .fp-stats { flex-direction: column; }
}

/* ==================== CAMPAIGNS & TRENDS ==================== */
.fp-campaigns-section h3, .fp-trends-section h3 { color: var(--forest); margin-bottom: 8px; font-size: 1.2em; }
.fp-campaigns-section > p, .fp-trends-section > p {
  background: rgba(250, 248, 242, 0.86);
  display: inline-block;
  padding: 6px 14px;
  border-radius: 8px;
  border-left: 3px solid var(--sage);
  color: var(--pine);
  font-style: italic;
  margin-bottom: 14px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.fp-campaign-filters {
  display: flex; gap: 10px; flex-wrap: wrap; margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(250, 248, 242, 0.92);
  border: 1px solid rgba(90, 138, 106, 0.22);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}
.fp-campaign-filters select { padding: 8px 12px; border-radius: 8px; border: 1px solid var(--border); font-size: 13px; background: var(--card-bg); color: var(--pine); }

.fp-trend-controls {
  margin-bottom: 16px;
  padding: 12px 16px;
  background: rgba(250, 248, 242, 0.92);
  border: 1px solid rgba(90, 138, 106, 0.22);
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  display: inline-flex;
  gap: 10px;
  align-items: center;
}
.fp-trend-controls select { padding: 10px 14px; border-radius: 8px; border: 1px solid var(--border); font-size: 14px; background: var(--card-bg); min-width: 300px; color: var(--pine); }

.trend-charts-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 20px;
}
.trend-charts-grid .chart-card {
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border: 1px solid rgba(90, 138, 106, 0.28);
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
}
.trend-charts-grid .chart-card.wide { grid-column: 1 / -1; }
/* inherit pill style from .chart-card h3 above; only override spacing */
.trend-charts-grid .chart-card h3 { margin-bottom: 12px; }

@media (min-width: 769px) {
  .trend-charts-grid { grid-template-columns: 1fr 1fr; }
}

/* (legacy .survey-card override removed — used undefined CSS vars and was making
   cards transparent against the wood wallpaper. Polished rules now live above.) */
.survey-card .survey-header {
  display: flex; justify-content: space-between; align-items: flex-start; gap: 10px;
}

.hd-map-label { background: none !important; border: none !important; box-shadow: none !important; }

/* FWP-style Flight Survey Report — formal serif layout (preview pane) */
.fwp-report { font-family: "Times New Roman", Georgia, serif; color: #1a1a1a; line-height: 1.5; padding: 24px; background: #fdfcf8; border: 1px solid #d9d4c4; border-radius: 6px; }
.fwp-titlebar { text-align: center; margin: 0 0 18px; }
.fwp-title { font-size: 1.3rem; font-weight: 700; letter-spacing: 0.5px; margin: 0; color: #000; text-transform: uppercase; }
.fwp-district { font-size: 1.1rem; font-weight: 700; letter-spacing: 0.5px; margin: 4px 0 0; color: #000; text-transform: uppercase; }
.fwp-meta { width: auto; border: none; margin: 8px 0 18px; font-size: 0.95rem; background: none; }
.fwp-meta td { border: none !important; padding: 2px 14px 2px 0 !important; background: none !important; }
.fwp-meta tr:nth-child(even) td { background: none !important; }
.fwp-section-head { font-weight: 700; letter-spacing: 0.5px; }
.fwp-para { margin: 10px 0; text-align: justify; text-justify: inter-word; }
.fwp-lit { margin: 4px 0; padding-left: 28px; text-indent: -28px; font-size: 0.95rem; }
.fwp-figure { margin: 18px 0; text-align: center; }
.fwp-figure svg, .fwp-figure img { display: block; margin: 0 auto; }
.fwp-figure-caption { font-size: 0.9rem; margin: 6px 0 0; text-align: center; font-style: italic; color: #333; }
.fwp-footer { margin-top: 24px; padding-top: 10px; border-top: 1px solid #ccc; font-size: 0.8em; color: #666; }

/* ==================== CAMPAIGN CLASSIFICATION BLOCK ==================== */
.campaign-classification {
  background: linear-gradient(135deg, rgba(212,169,83,0.10) 0%, rgba(139,105,20,0.06) 100%);
  border-radius: 10px;
  padding: 12px 14px;
  margin-bottom: 14px;
  border-left: 3px solid var(--cabin);
}
.campaign-class-row {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
  text-align: center;
  margin-bottom: 10px;
}
.campaign-class-row > div { display: flex; flex-direction: column; gap: 2px; }
.campaign-class-row strong {
  font-size: 1.4em;
  color: var(--pine);
  font-family: 'Georgia', serif;
  font-weight: 700;
}
.campaign-class-row span {
  font-size: 0.7em;
  color: var(--stone);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-weight: 600;
}
.campaign-class-ratios {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 6px;
  font-size: 0.78em;
  color: var(--bark);
  text-align: center;
  border-top: 1px dashed rgba(139,105,20,0.3);
  padding-top: 8px;
}
.campaign-class-ratios strong { color: var(--forest); font-weight: 700; }
.campaign-class-yearlings {
  text-align: center;
  font-size: 0.78em;
  color: var(--bark);
  margin-top: 6px;
  padding-top: 6px;
  border-top: 1px dashed rgba(139,105,20,0.3);
}
.campaign-class-yearlings strong { color: var(--forest); }

/* ==================== POLISHED TABLE PANEL (Sightings) ==================== */
#sightings-table {
  background: linear-gradient(180deg, #fffdf6 0%, var(--cream) 100%);
  box-shadow: 0 4px 16px rgba(0,0,0,0.18), 0 1px 3px rgba(0,0,0,0.1);
  border: 1px solid rgba(45,90,61,0.18);
}
#sightings-table thead th {
  background: linear-gradient(180deg, var(--forest) 0%, var(--pine) 100%);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  font-size: 0.78em;
  padding: 14px 14px;
}
#sightings-table tbody tr { transition: background 0.15s; }
#sightings-table tbody tr:nth-child(even) { background: rgba(212,169,83,0.05); }
#sightings-table tbody tr:hover { background: rgba(90,138,106,0.15); }
#sightings-table tbody td { font-size: 0.86em; }
#sightings-table tbody td:nth-child(2) strong { color: var(--pine); font-weight: 700; }
#sightings-table tbody td:nth-child(3) { font-family: 'Georgia', serif; font-size: 1.05em; font-weight: 700; color: var(--forest); }

/* ==================== "Ready to Bill" staging panel ==================== */
.sum-ready-group { margin-top: 12px; }
.sum-ready-group:first-child { margin-top: 0; }
.sum-ready-group__title {
  font-weight: 700;
  color: var(--pine);
  font-size: 0.82rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 8px;
  padding-bottom: 6px;
  border-bottom: 1px solid rgba(90, 138, 106, 0.18);
}
.sum-ready-row {
  display: grid;
  grid-template-columns: 36px 1fr 100px 110px 160px;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 10px;
  background: linear-gradient(180deg, #faf8f2 0%, #f5f0e4 100%);
  border: 1px solid rgba(90, 138, 106, 0.22);
  margin-bottom: 8px;
  transition: box-shadow 0.15s ease, transform 0.15s ease;
}
.sum-ready-row:hover {
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.10);
  transform: translateY(-1px);
}
.sum-ready-row__icon {
  font-size: 1.4em;
  text-align: center;
}
.sum-ready-row__title {
  font-weight: 700;
  color: var(--pine);
  font-size: 0.95em;
  margin-bottom: 2px;
}
.sum-ready-row__meta {
  font-size: 0.78em;
  color: var(--stone);
}
.sum-ready-row__date {
  font-size: 0.85em;
  color: var(--text-secondary);
  text-align: right;
  font-variant-numeric: tabular-nums;
}
.wld-sum-amount {
  display: inline-block;
  padding: 4px 10px;
  border-radius: 999px;
  background: rgba(45, 90, 61, 0.12);
  color: var(--forest);
  font-weight: 700;
  font-size: 0.85em;
  font-variant-numeric: tabular-nums;
}
.wld-sum-amount--unset {
  background: rgba(212, 169, 83, 0.18);
  color: #8a6d2a;
  font-weight: 600;
  font-style: italic;
}
@media (max-width: 820px) {
  .sum-ready-row {
    grid-template-columns: 32px 1fr;
    grid-template-rows: auto auto auto;
  }
  .sum-ready-row__date { grid-column: 2 / 3; text-align: left; font-size: 0.78em; }
  .sum-ready-row__amount { grid-column: 1 / -1; }
  .sum-ready-row button { grid-column: 1 / -1; }
}

/* SUM UI visibility toggle */
.wld-sum-hidden { display: none !important; }
