:root {
  --ink: #0b1d14;
  --paper: #f6f4ee;
  --paper-2: #ecead9;
  --moss: #2f5d3a;
  --moss-2: #3f7a4c;
  --river: #2563eb;
  --rule: #d8d4c2;
  --muted: #5b6357;
  --shadow: 0 1px 2px rgba(11,29,20,.06), 0 8px 24px rgba(11,29,20,.08);
}

* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  color: var(--ink);
  background: var(--paper);
  -webkit-font-smoothing: antialiased;
}

a { color: var(--moss); }
a:hover { color: var(--moss-2); }

.app-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: .75rem 1.25rem;
  background: var(--paper);
  border-bottom: 1px solid var(--rule);
  position: sticky; top: 0; z-index: 1000;
}

.brand { display: flex; align-items: center; gap: .75rem; color: var(--moss); }
.brand .logo { width: 36px; height: 36px; }
.brand h1 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 1.25rem;
  margin: 0;
  letter-spacing: -0.01em;
  color: var(--ink);
}
.tagline { margin: 0; color: var(--muted); font-size: .78rem; letter-spacing: .02em; }

.header-actions { display: flex; gap: .5rem; }

.btn-ghost, .btn-primary {
  font: inherit; font-size: .85rem; font-weight: 500;
  padding: .5rem .85rem;
  border-radius: .5rem;
  cursor: pointer;
  transition: background .15s ease, transform .1s ease;
}
.btn-ghost { background: transparent; color: var(--ink); border: 1px solid var(--rule); }
.btn-ghost:hover { background: var(--paper-2); }
.btn-primary {
  background: var(--moss); color: white; border: 1px solid var(--moss);
  width: 100%; margin-bottom: .4rem;
}
.btn-primary:hover { background: var(--moss-2); }

.app-shell {
  display: grid;
  grid-template-columns: 340px 1fr;
  height: calc(100vh - 64px);
  height: calc(100dvh - 64px);
}

.panel {
  overflow-y: auto;
  background: var(--paper);
  border-right: 1px solid var(--rule);
  padding: 1rem 1.1rem 2rem;
}

.panel-section { padding: .5rem 0 1rem; border-bottom: 1px solid var(--rule); }
.panel-section:last-of-type { border-bottom: 0; }
.panel-section h2 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 500;
  font-size: .8rem;
  text-transform: uppercase;
  letter-spacing: .12em;
  color: var(--muted);
  margin: .25rem 0 .75rem;
}

.row {
  display: flex; align-items: center; justify-content: space-between;
  gap: .6rem;
  padding: .4rem 0;
  font-size: .92rem;
  cursor: pointer;
}
.row input[type="checkbox"] {
  width: 16px; height: 16px; accent-color: var(--moss);
}

.month-picker { margin-top: .6rem; display: flex; flex-direction: column; gap: .3rem; }
.month-picker label { font-size: .82rem; color: var(--muted); }
.month-picker select {
  font: inherit; font-size: .9rem;
  padding: .45rem .6rem;
  border: 1px solid var(--rule);
  border-radius: .4rem;
  background: white;
}

.legend { display: grid; gap: .4rem; font-size: .85rem; }
.legend > div { display: flex; align-items: center; gap: .55rem; }
.swatch { width: 22px; height: 4px; border-radius: 2px; display: inline-block; }
.dot { width: 10px; height: 10px; border-radius: 50%; display: inline-block; }

.export-buttons { display: flex; flex-direction: column; gap: .3rem; margin-top: .25rem; }
.muted { color: var(--muted); font-size: .82rem; margin: .25rem 0 .75rem; }
.muted.small { font-size: .75rem; }

.panel-footer { font-size: .75rem; color: var(--muted); margin-top: 1rem; line-height: 1.5; }

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

/* Leaflet popups — restyled */
.leaflet-popup-content-wrapper {
  border-radius: 8px;
  box-shadow: var(--shadow);
}
.leaflet-popup-content {
  font-family: 'Inter', system-ui, sans-serif;
  font-size: .88rem;
  line-height: 1.45;
  margin: .8rem 1rem;
  max-width: 280px;
}
.leaflet-popup-content h3 {
  font-family: 'Fraunces', Georgia, serif;
  font-weight: 700;
  font-size: 1rem;
  margin: 0 0 .35rem;
  color: var(--ink);
}
.leaflet-popup-content .pill {
  display: inline-block;
  font-size: .68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .06em;
  padding: 2px 7px;
  border-radius: 999px;
  margin: 0 .25rem .35rem 0;
}
.pill.green { background: #dcfce7; color: #166534; }
.pill.blue { background: #dbeafe; color: #1e40af; }
.pill.purple { background: #ede9fe; color: #5b21b6; }
.pill.amber { background: #fef3c7; color: #92400e; }
.pill.gray { background: #f1f5f9; color: #475569; }

.leaflet-popup-content dl { margin: .35rem 0 0; display: grid; grid-template-columns: auto 1fr; gap: .15rem .5rem; }
.leaflet-popup-content dt { color: var(--muted); font-size: .75rem; }
.leaflet-popup-content dd { margin: 0; font-size: .82rem; }

.mobile-only { display: none; }

/* Mobile */
@media (max-width: 820px) {
  .app-shell {
    grid-template-columns: 1fr;
  }
  .panel {
    position: fixed;
    inset: 64px 0 auto 0;
    height: calc(100dvh - 64px);
    z-index: 900;
    transform: translateX(-100%);
    transition: transform .25s ease;
    border-right: 0;
    border-bottom: 1px solid var(--rule);
  }
  .panel.open { transform: translateX(0); }
  .mobile-only { display: inline-flex; }
  .brand h1 { font-size: 1.1rem; }
}

/* Pulse for "currently stocked" highlight */
@keyframes pulse {
  0% { stroke-opacity: 1; }
  50% { stroke-opacity: .35; }
  100% { stroke-opacity: 1; }
}
.river-stocked-pulse {
  animation: pulse 1.8s ease-in-out infinite;
}
