/* ============================================================
   Austin Treasure Map — Base Theme & Layout
   ============================================================ */

@import url('https://fonts.googleapis.com/css2?family=Pirata+One&family=Lora:ital,wght@0,400;0,600;0,700;1,400&family=Inter:wght@400;500;600&display=swap');

:root {
  --gold: #c4883c;
  --gold-light: #d4a054;
  --gold-dark: #8b6914;
  --brown-dark: #2c1810;
  --brown-mid: #5d4037;
  --brown-light: #8b7355;
  --parchment: #f4e8d1;
  --parchment-dark: #e8d5b5;
  --ink: #1a0f0a;
  --cream: #faf5eb;
  --font-display: 'Pirata One', cursive;
  --font-body: 'Lora', Georgia, serif;
  --font-ui: 'Inter', -apple-system, sans-serif;
  --nav-width: 260px;
}

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

html, body {
  height: 100%;
  overflow: hidden;
  font-family: var(--font-body);
  color: var(--ink);
  background: var(--parchment);
}

/* ═══ App Layout: Sidebar + Map ═══ */
#app {
  display: flex;
  height: 100vh;
  height: 100dvh; /* iOS Safari: avoids content hidden behind toolbar */
  position: relative;
}

/* ═══ Left Nav Sidebar ═══ */
#nav-sidebar {
  width: var(--nav-width);
  flex-shrink: 0;
  background: linear-gradient(180deg, var(--cream) 0%, var(--parchment) 100%);
  border-right: 2px solid rgba(196,136,60,0.2);
  z-index: 500;
  display: flex;
  flex-direction: column;
  position: relative;
}

.nav-sidebar__scroll {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 0 16px 16px;
  scrollbar-width: thin;
  scrollbar-color: var(--gold) transparent;
}

.nav-sidebar__scroll::-webkit-scrollbar {
  width: 4px;
}

.nav-sidebar__scroll::-webkit-scrollbar-thumb {
  background: var(--gold);
  border-radius: 2px;
}

/* Title */
.nav-sidebar__header {
  padding: 20px 0 12px;
  text-align: center;
  border-bottom: 1px solid rgba(196,136,60,0.15);
  margin-bottom: 16px;
}

.nav-sidebar__title {
  font-family: var(--font-display);
  font-size: 1.25rem;
  color: var(--gold-dark);
  letter-spacing: 1px;
  line-height: 1.3;
  text-shadow: 1px 1px 2px rgba(0,0,0,0.1);
}

/* Search */
.nav-sidebar__search {
  margin-bottom: 16px;
  position: relative;
}

.search-wrapper {
  position: relative;
}

.search-icon {
  position: absolute;
  left: 10px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 0.8rem;
  opacity: 0.5;
  pointer-events: none;
}

#search-input,
#mobile-search-input {
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 8px 12px 8px 30px;
  border: 1px solid rgba(139,105,20,0.25);
  border-radius: 20px;
  background: white;
  color: var(--ink);
  width: 100%;
  outline: none;
  transition: all 0.2s;
}

#search-input:focus,
#mobile-search-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(196,136,60,0.15);
}

/* Search Results */
.search-results,
.mobile-search-results {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: white;
  border: 1px solid rgba(139,105,20,0.25);
  border-radius: 10px;
  margin-top: 4px;
  box-shadow: 0 4px 16px rgba(0,0,0,0.12);
  z-index: 1100;
  max-height: 300px;
  overflow-y: auto;
  display: none;
}

.mobile-search-results {
  position: relative;
  margin-top: 12px;
  display: block;
  box-shadow: none;
  border: none;
  max-height: none;
}

.search-result-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  transition: background 0.15s;
}

.search-result-item:hover {
  background: var(--parchment);
}

.search-result-item strong {
  font-family: var(--font-body);
  font-size: 0.85rem;
  display: block;
}

.search-result-item small {
  color: var(--brown-light);
  font-family: var(--font-ui);
  font-size: 0.7rem;
}

.search-result-icon {
  font-size: 1.2rem;
}

.search-no-results {
  padding: 12px 14px;
  color: var(--brown-light);
  font-family: var(--font-ui);
  font-size: 0.8rem;
}

/* ═══ Category Group Buttons ═══ */
.nav-sidebar__filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 20px;
}

.group-btn {
  flex: 1 1 calc(50% - 3px);
  min-width: 0;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 8px 6px;
  border: 2px solid transparent;
  border-radius: 12px;
  background: white;
  color: var(--brown-mid);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
}

.group-btn.active {
  border-color: var(--group-color, var(--gold));
  color: var(--ink);
  box-shadow: 0 0 8px rgba(196,136,60,0.2);
}

.group-btn:not(.active) {
  opacity: 0.55;
}

.group-btn:hover {
  opacity: 1;
  transform: translateY(-1px);
}

.group-btn__icon {
  font-size: 1rem;
  display: block;
  margin-bottom: 2px;
}

.group-btn__count {
  font-size: 0.6rem;
  opacity: 0.6;
  margin-left: 2px;
}

/* "All" button spans full width */
.group-btn--all {
  flex: 1 1 100%;
  font-weight: 700;
}

/* ═══ Gamification Widget ═══ */
.nav-sidebar__gamification {
  padding: 16px 0;
  border-bottom: 1px solid rgba(196,136,60,0.15);
  margin-bottom: 16px;
  text-align: center;
}

.mobile-gamification {
  padding: 16px 0;
  text-align: center;
}

/* ── ASCII Treasure Chest ── */
.ascii-chest {
  font-family: monospace;
  font-size: 0.75rem;
  line-height: 1.3;
  color: var(--gold);
  white-space: pre;
  text-align: center;
  margin: 0 auto 14px;
}

body.dark-mode .ascii-chest {
  color: var(--gold-light);
}

/* ── XP Explanation ── */
.xp-explanation {
  font-family: var(--font-ui);
  font-size: 0.62rem;
  color: var(--brown-light);
  text-align: center;
  margin-bottom: 6px;
}

body.dark-mode .xp-explanation {
  color: #888;
}

/* ── XP Bar ── */
.xp-bar {
  position: relative;
  width: 100%;
  height: 14px;
  background: var(--parchment-dark);
  border-radius: 7px;
  overflow: hidden;
  margin-bottom: 10px;
}

.xp-bar__fill {
  height: 100%;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-light));
  border-radius: 7px;
  transition: width 0.6s ease;
  position: relative;
  overflow: hidden;
  min-width: 0;
}

.xp-bar__shimmer {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255,255,255,0.3) 50%,
    transparent 100%
  );
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% { transform: translateX(-100%); }
  100% { transform: translateX(100%); }
}

.xp-bar__label {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 600;
  color: var(--ink);
  text-shadow: 0 0 3px rgba(255,255,255,0.6);
  white-space: nowrap;
  pointer-events: none;
}

/* ── Rank Display ── */
.rank-display {
  text-align: center;
  margin-bottom: 6px;
}

.rank-display__title {
  font-family: var(--font-display);
  font-size: 1rem;
  color: var(--gold-dark);
  line-height: 1.3;
}

.rank-display__next {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--brown-light);
  font-style: italic;
  margin-top: 2px;
}

/* ── Discovery Count ── */
.discovery-count {
  font-family: var(--font-ui);
  font-size: 0.75rem;
  color: var(--brown-light);
  text-align: center;
}

/* ═══ Quest Card ═══ */
.nav-sidebar__quest {
  margin-bottom: 16px;
}

.quest-card {
  background: white;
  border: 1px solid rgba(196,136,60,0.2);
  border-radius: 12px;
  padding: 14px;
  position: relative;
  overflow: hidden;
}

.quest-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  background: linear-gradient(90deg, var(--gold-dark), var(--gold), var(--gold-dark));
}

.quest-card--complete {
  text-align: center;
  padding: 20px 14px;
}

.quest-card--complete .quest-card__icon {
  font-size: 2rem;
  margin-bottom: 8px;
}

.quest-card--complete .quest-card__title {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold-dark);
  margin-bottom: 4px;
}

.quest-card--complete .quest-card__hint {
  font-family: var(--font-body);
  font-size: 0.8rem;
  color: var(--brown-light);
  font-style: italic;
}

.quest-card__header {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: 10px;
}

.quest-card__icon {
  font-size: 1.1rem;
}

.quest-card__title {
  font-family: var(--font-display);
  font-size: 0.95rem;
  color: var(--brown-dark);
}

.quest-card__hint {
  font-family: var(--font-body);
  font-size: 0.82rem;
  font-style: italic;
  color: var(--brown-mid);
  line-height: 1.5;
  margin-bottom: 10px;
}

.quest-card__meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-family: var(--font-ui);
  font-size: 0.7rem;
  color: var(--brown-light);
  margin-bottom: 10px;
}

.quest-card__group {
  background: rgba(196,136,60,0.08);
  padding: 2px 8px;
  border-radius: 8px;
}

.quest-card__distance {
  font-weight: 500;
}

.quest-card__actions {
  display: flex;
  gap: 8px;
}

.quest-card__btn {
  flex: 1;
  font-family: var(--font-ui);
  font-size: 0.72rem;
  font-weight: 600;
  padding: 7px 10px;
  border: 1px solid rgba(196,136,60,0.25);
  border-radius: 8px;
  background: white;
  color: var(--brown-mid);
  cursor: pointer;
  transition: all 0.2s;
}

.quest-card__btn:hover {
  background: var(--parchment);
  border-color: var(--gold);
}

.quest-card__btn--reveal {
  background: var(--gold);
  color: white;
  border-color: var(--gold);
}

.quest-card__btn--reveal:hover {
  background: var(--gold-dark);
}

/* ═══ Nav Footer Actions ═══ */
.nav-sidebar__footer {
  padding: 12px 0;
  border-top: 1px solid rgba(196,136,60,0.12);
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-top: auto;
}

.nav-btn {
  flex: 1 1 calc(50% - 3px);
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 7px 8px;
  border: 1px solid rgba(196,136,60,0.2);
  border-radius: 8px;
  background: white;
  color: var(--brown-mid);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
}

.nav-btn:hover {
  background: var(--parchment);
  border-color: var(--gold);
}

.nav-btn--add {
  position: relative;
}

.pending-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #d32f2f;
  color: white;
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* ═══ Map Area ═══ */
#map-area {
  flex: 1;
  position: relative;
  min-width: 0;
}

#map {
  width: 100%;
  height: 100%;
}

/* Mobile floating search (hidden on desktop) */
.mobile-map-search {
  display: none;
}

/* Mobile filter chips (floating over map) */
.mobile-filter-chips {
  display: none;
}

/* ═══ Mobile Bottom Tabs ═══ */
.mobile-tabs {
  display: none;
}

.mobile-tab {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 8px 4px 6px;
  border: none;
  background: none;
  color: var(--brown-light);
  cursor: pointer;
  transition: color 0.2s;
  font-size: 0;
}

.mobile-tab--active {
  color: var(--gold-dark);
}

.mobile-tab__icon {
  font-size: 1.2rem;
}

.mobile-tab__label {
  font-family: var(--font-ui);
  font-size: 0.6rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* ═══ Mobile Tab Panels ═══ */
.mobile-panels {
  display: none;
}

.mobile-panel {
  display: none;
  width: 100%;
  height: 100%;
  flex-direction: column;
}

.mobile-panel--active {
  display: flex;
}

.mobile-panel__header {
  padding: 16px 16px 12px;
  border-bottom: 1px solid rgba(196,136,60,0.12);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.mobile-panel__header h2 {
  font-family: var(--font-display);
  font-size: 1.2rem;
  color: var(--gold-dark);
}

.mobile-panel__close {
  width: 32px;
  height: 32px;
  border: 1px solid rgba(196,136,60,0.2);
  border-radius: 50%;
  background: white;
  color: var(--brown-mid);
  font-size: 1rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 0.2s;
}

.mobile-panel__close:hover {
  background: var(--parchment);
  border-color: var(--gold);
}

body.dark-mode .mobile-panel__close {
  background: #2a2a2a;
  border-color: #444;
  color: #ccc;
}

.mobile-panel__body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
}

.mobile-profile-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 20px;
}

.mobile-profile-actions .nav-btn {
  flex: 1 1 calc(50% - 4px);
}

/* (mobile-gamification styles are above in Gamification Widget section) */

/* ═══ Mastery List ═══ */
.mastery-list {
  margin-top: 16px;
}

.mastery-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 12px;
  background: white;
  border: 1px solid rgba(196,136,60,0.1);
  border-radius: 8px;
  margin-bottom: 6px;
  font-family: var(--font-ui);
  font-size: 0.78rem;
}

.mastery-item--complete {
  background: rgba(196,136,60,0.08);
  border-color: var(--gold);
}

.mastery-item__name {
  font-weight: 600;
  color: var(--brown-dark);
}

.mastery-item--complete .mastery-item__name {
  color: var(--gold-dark);
}

.mastery-item__progress {
  color: var(--brown-light);
  font-size: 0.7rem;
}

.mastery-item--complete .mastery-item__progress {
  color: var(--gold);
  font-weight: 600;
}

/* ═══ Toast ═══ */
.toast {
  position: fixed;
  bottom: 30px;
  left: 50%;
  transform: translateX(-50%) translateY(20px);
  background: var(--brown-dark);
  color: var(--gold-light);
  font-family: var(--font-ui);
  font-size: 0.85rem;
  padding: 12px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.3);
  opacity: 0;
  transition: all 0.3s ease;
  z-index: 3000;
  pointer-events: none;
}

.toast.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Milestone toast */
.milestone-toast {
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: white;
  font-weight: 600;
  font-size: 1rem;
  padding: 16px 28px;
  border-radius: 12px;
  box-shadow: 0 4px 24px rgba(196,136,60,0.5);
}

/* ═══ Loading Screen ═══ */
#loading {
  position: fixed;
  inset: 0;
  background: var(--brown-dark);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  transition: opacity 0.5s ease;
}

#loading.loaded {
  opacity: 0;
  pointer-events: none;
}

.loading-compass {
  width: 60px;
  height: 60px;
  border: 3px solid var(--gold);
  border-radius: 50%;
  position: relative;
  animation: compass-spin 2s ease-in-out infinite;
}

.loading-compass::before {
  content: '▲';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -70%);
  color: var(--gold);
  font-size: 1.3rem;
}

@keyframes compass-spin {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(30deg); }
  75% { transform: rotate(-30deg); }
}

.loading-text {
  font-family: var(--font-display);
  color: var(--gold);
  font-size: 1.2rem;
  margin-top: 16px;
  letter-spacing: 2px;
}

/* ═══ Share Mode ═══ */
.share-mode #nav-sidebar .nav-sidebar__quest,
.share-mode #nav-sidebar .nav-sidebar__gamification,
.share-mode #nav-sidebar .nav-sidebar__footer {
  display: none;
}

.share-banner {
  background: linear-gradient(90deg, var(--gold-dark), var(--gold));
  padding: 8px 20px;
  text-align: center;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
}

.share-banner-link {
  color: white;
  font-weight: 600;
  text-decoration: underline;
}

/* ═══ Sepia / Dark Mode ═══ */
body.sepia-mode .leaflet-tile-pane {
  filter: sepia(0.15) saturate(0.9);
}

body.dark-mode #nav-sidebar {
  background: linear-gradient(180deg, #1a1a1a 0%, #111 100%);
  border-color: #333;
}

body.dark-mode .nav-sidebar__title {
  color: var(--gold-light);
}

body.dark-mode #search-input,
body.dark-mode #mobile-search-input {
  background: #2a2a2a;
  border-color: #444;
  color: #ddd;
}

body.dark-mode .group-btn {
  background: #2a2a2a;
  color: #aaa;
}

body.dark-mode .quest-card {
  background: #1e1e1e;
  border-color: #333;
}

body.dark-mode .quest-card__title {
  color: #ddd;
}

body.dark-mode .quest-card__hint {
  color: #aaa;
}

body.dark-mode .quest-card__btn {
  background: #2a2a2a;
  border-color: #444;
  color: #ccc;
}

body.dark-mode .nav-btn {
  background: #2a2a2a;
  border-color: #444;
  color: #ccc;
}

body.dark-mode .mastery-item {
  background: #1e1e1e;
  border-color: #333;
}

body.dark-mode .mastery-item__name {
  color: #ddd;
}

/* Dark mode: Gamification */
body.dark-mode .nav-sidebar__gamification {
  border-color: #333;
}

body.dark-mode .xp-bar {
  background: #333;
}

body.dark-mode .xp-bar__label {
  color: #eee;
  text-shadow: 0 0 3px rgba(0,0,0,0.6);
}

body.dark-mode .rank-display__title {
  color: var(--gold-light);
}

body.dark-mode .rank-display__next {
  color: #888;
}

body.dark-mode .discovery-count {
  color: #888;
}

/* ═══ Style Picker ═══ */
.style-picker {
  margin-bottom: 16px;
}

.style-picker__label {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--brown-light);
  margin-bottom: 8px;
}

.style-picker__grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

/* ═══ Map Top Bar (floating over map, desktop) ═══ */
.map-top-bar {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  z-index: 400;
  background: var(--cream);
  border-bottom: 1px solid rgba(196,136,60,0.15);
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  padding: 8px 12px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.map-top-bar__label {
  font-family: var(--font-ui);
  font-size: 0.55rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 1.5px;
  color: var(--brown-light);
}

body.dark-mode .map-top-bar__label {
  color: #888;
}

.map-top-bar__row {
  display: flex;
  gap: 4px;
  align-items: center;
}

/* All buttons in top bar stretch equally */
.map-top-bar__row > .style-picker__btn,
.map-top-bar__row > .group-btn {
  flex: 1;
  min-width: 0;
  text-align: center;
  padding: 6px 4px;
  font-size: 0.72rem;
  border-radius: 8px;
}

/* Override the "All" button full-width rule inside top bar */
.map-top-bar__row .group-btn--all {
  flex: 1;
}

.map-top-bar__row .group-btn__icon {
  display: inline;
  font-size: 0.85rem;
  margin-bottom: 0;
  margin-right: 2px;
}

/* Dark mode top bar */
body.dark-mode .map-top-bar {
  background: #1a1a1a;
  border-color: #333;
}

.style-picker__btn {
  font-family: var(--font-ui);
  font-size: 0.7rem;
  font-weight: 500;
  padding: 8px 4px;
  border: 2px solid rgba(196,136,60,0.15);
  border-radius: 10px;
  background: white;
  color: var(--brown-mid);
  cursor: pointer;
  transition: all 0.2s;
  text-align: center;
  white-space: nowrap;
}

.style-picker__btn:hover {
  border-color: var(--gold-light);
  background: var(--parchment);
}

.style-picker__btn--active {
  border-color: var(--gold);
  color: var(--gold-dark);
  background: rgba(196,136,60,0.08);
  box-shadow: 0 0 8px rgba(196,136,60,0.2);
  font-weight: 600;
}

/* Dark mode variants */
body.dark-mode .style-picker__btn {
  background: #2a2a2a;
  border-color: #444;
  color: #aaa;
}

body.dark-mode .style-picker__btn:hover {
  border-color: var(--gold-light);
  background: #333;
}

body.dark-mode .style-picker__btn--active {
  border-color: var(--gold);
  color: var(--gold-light);
  background: rgba(196,136,60,0.12);
}

body.dark-mode .style-picker__label {
  color: #888;
}

/* Mobile style picker visual separation */
.style-picker--mobile {
  border-bottom: 1px solid rgba(196,136,60,0.12);
  padding-bottom: 16px;
  margin-bottom: 16px;
}

body.dark-mode .style-picker--mobile {
  border-color: #333;
}

/* ═══ Modal & Add Place Form ═══ */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5000;
  padding: 20px;
}

.modal-card {
  background: var(--cream);
  border-radius: 16px;
  padding: 20px;
  width: 100%;
  max-width: 400px;
  max-height: 80vh;
  overflow-y: auto;
  box-shadow: 0 8px 32px rgba(0,0,0,0.25);
}

body.dark-mode .modal-card {
  background: #1e1e1e;
}

.modal-card__header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
}

.modal-card__header h3 {
  font-family: var(--font-display);
  font-size: 1.1rem;
  color: var(--gold-dark);
}

body.dark-mode .modal-card__header h3 {
  color: var(--gold-light);
}

.modal-card__close {
  width: 28px;
  height: 28px;
  border: 1px solid rgba(196,136,60,0.2);
  border-radius: 50%;
  background: white;
  color: var(--brown-mid);
  font-size: 0.9rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

body.dark-mode .modal-card__close {
  background: #2a2a2a;
  border-color: #444;
  color: #ccc;
}

.form-label {
  display: block;
  font-family: var(--font-ui);
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--brown-mid);
  margin-bottom: 12px;
}

body.dark-mode .form-label {
  color: #bbb;
}

.form-required {
  color: #d32f2f;
}

.form-input {
  display: block;
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  padding: 8px 12px;
  margin-top: 4px;
  border: 1px solid rgba(139,105,20,0.25);
  border-radius: 8px;
  background: white;
  color: var(--ink);
  outline: none;
  transition: border-color 0.2s;
}

.form-input:focus {
  border-color: var(--gold);
  box-shadow: 0 0 0 2px rgba(196,136,60,0.15);
}

body.dark-mode .form-input {
  background: #2a2a2a;
  border-color: #444;
  color: #ddd;
}

.form-textarea {
  resize: vertical;
  min-height: 60px;
}

.form-submit {
  width: 100%;
  font-family: var(--font-ui);
  font-size: 0.8rem;
  font-weight: 600;
  padding: 10px;
  border: none;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--gold-dark), var(--gold));
  color: white;
  cursor: pointer;
  transition: opacity 0.2s;
}

.form-submit:hover {
  opacity: 0.9;
}

/* Pending review items */
.pending-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pending-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  padding: 10px 12px;
  background: white;
  border: 1px solid rgba(196,136,60,0.15);
  border-radius: 10px;
  transition: opacity 0.2s, transform 0.2s;
}

body.dark-mode .pending-item {
  background: #2a2a2a;
  border-color: #444;
}

.pending-item__info {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  flex: 1;
  min-width: 0;
}

.pending-item__icon {
  font-size: 1.2rem;
  flex-shrink: 0;
}

.pending-item__text {
  min-width: 0;
}

.pending-item__text strong {
  font-family: var(--font-body);
  font-size: 0.85rem;
  display: block;
}

body.dark-mode .pending-item__text strong {
  color: #ddd;
}

.pending-item__text p {
  font-family: var(--font-ui);
  font-size: 0.72rem;
  color: var(--brown-mid);
  margin-top: 2px;
  line-height: 1.4;
}

body.dark-mode .pending-item__text p {
  color: #aaa;
}

.pending-item__text small {
  font-family: var(--font-ui);
  font-size: 0.65rem;
  color: var(--brown-light);
}

body.dark-mode .pending-item__text small {
  color: #888;
}

.pending-item__actions {
  display: flex;
  gap: 6px;
  flex-shrink: 0;
}

.pending-btn {
  width: 30px;
  height: 30px;
  border: 1px solid rgba(196,136,60,0.2);
  border-radius: 50%;
  background: white;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

body.dark-mode .pending-btn {
  background: #333;
  border-color: #555;
}

.pending-btn--approve {
  color: #2e7d32;
}

.pending-btn--approve:hover {
  background: #e8f5e9;
  border-color: #2e7d32;
}

body.dark-mode .pending-btn--approve:hover {
  background: #1b5e20;
}

.pending-btn--reject {
  color: #c62828;
}

.pending-btn--reject:hover {
  background: #ffebee;
  border-color: #c62828;
}

body.dark-mode .pending-btn--reject:hover {
  background: #b71c1c;
}

/* ═══ Responsive: Mobile ═══ */
@media (max-width: 768px) {
  #app {
    flex-direction: column;
  }

  /* Hide nav sidebar on mobile */
  #nav-sidebar {
    display: none;
  }

  /* Hide map top bar on mobile (uses mobile-filter-chips + Profile tab picker instead) */
  .map-top-bar {
    display: none;
  }

  /* Map goes full width, min-height prevents overflow past tabs */
  #map-area {
    flex: 1;
    min-height: 0;
    overflow: hidden;
  }

  /* Show mobile floating search */
  .mobile-map-search {
    display: block;
    position: absolute;
    top: 8px;
    left: 8px;
    right: 60px;
    z-index: 401;
  }

  .mobile-map-search .search-wrapper {
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    border-radius: 20px;
  }

  .mobile-map-search .mobile-search-results {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    margin-top: 4px;
    background: white;
    border: 1px solid rgba(139,105,20,0.25);
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0,0,0,0.15);
    max-height: 260px;
    overflow-y: auto;
    display: none;
    z-index: 402;
  }

  /* Show mobile filter chips — below search bar */
  .mobile-filter-chips {
    display: flex;
    position: absolute;
    top: 48px;
    left: 8px;
    right: 60px; /* avoid overlapping map controls */
    z-index: 400;
    gap: 5px;
    overflow-x: auto;
    scrollbar-width: none;
    padding: 2px;
  }

  .mobile-filter-chips::-webkit-scrollbar {
    display: none;
  }

  .mobile-filter-chips .group-btn {
    flex: 0 0 auto;
    min-width: auto;
    padding: 5px 8px;
    font-size: 0.65rem;
    border-radius: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    background: white;
  }

  .mobile-filter-chips .group-btn__count {
    display: none;
  }

  .mobile-filter-chips .group-btn.active {
    box-shadow: 0 2px 8px rgba(196,136,60,0.3);
  }

  /* Show bottom tabs */
  .mobile-tabs {
    display: flex;
    background: white;
    border-top: 1px solid rgba(196,136,60,0.15);
    z-index: 500;
    padding-bottom: env(safe-area-inset-bottom, 0px);
  }

  /* Mobile panels */
  .mobile-panels {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 56px; /* tab bar height */
    background: var(--cream);
    z-index: 1100;
  }

  .mobile-panels--visible {
    display: flex;
  }

  /* Toast above tab bar */
  .toast {
    bottom: 80px;
  }

  .milestone-toast {
    bottom: 80px;
  }
}
