/* ── Design tokens ─────────────────────────────────────────── */
:root {
  --color-primary: #2e7d32;
  --color-primary-dk: #1b5e20;
  --color-bg: #f5f5f5;
  --color-surface: #ffffff;
  --color-text: #212121;
  --color-muted: #757575;
  --color-error: #c62828;
  --color-success: #2e7d32;
  --radius: 8px;
  --shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  --header-h: 56px;
}

/* ── Reset & base ───────────────────────────────────────────── */
*,
*::before,
*::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: system-ui, sans-serif;
  background: var(--color-bg);
  color: var(--color-text);
  line-height: 1.5;
}

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

/* ── Layout helpers ─────────────────────────────────────────── */
.hidden {
  display: none !important;
}

.container {
  max-width: 480px;
  margin: 2rem auto;
  padding: 0 1rem;
}

/* ── Header ─────────────────────────────────────────────────── */
#app-header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: var(--color-primary);
  color: #fff;
  z-index: 1000;
  box-shadow: var(--shadow);
}

.header-inner {
  max-width: 1200px;
  margin: 0 auto;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 1rem;
}

.brand {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.2rem;
  font-weight: 700;
  color: #fff;
  text-decoration: none;
}

/* Parish logo in the header bar */
.nav-logo {
  height: 36px;
  width: auto;
  max-width: 120px;
  object-fit: contain;
  border-radius: 6px;
  background: #fff;
  padding: 3px 6px;
  flex-shrink: 0;
}

#nav-parish-name {
  font-size: 0.9rem;
  opacity: 0.85;
  margin-right: 1rem;
}

/* ── Buttons ────────────────────────────────────────────────── */
button,
.btn {
  cursor: pointer;
  border: none;
  border-radius: var(--radius);
  padding: 0.5rem 1.2rem;
  font-size: 1rem;
  font-family: inherit;
  background: var(--color-primary);
  color: #fff;
  transition: background 0.15s;
}

button:hover,
.btn:hover {
  background: var(--color-primary-dk);
}

button.secondary {
  background: transparent;
  color: var(--color-primary);
  border: 1px solid var(--color-primary);
}

/* ── Landing page ───────────────────────────────────────────── */
.landing {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.landing-hero {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1.5rem 2.5rem;
  text-align: center;
  color: #fff;
}

.landing-logo {
  max-width: 180px;
  max-height: 180px;
  object-fit: contain;
  margin-bottom: 1.75rem;
  border-radius: 16px;
  background: #fff;
  padding: 1rem 1.25rem;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.22);
}

.landing-logo-placeholder {
  width: 100px;
  height: 100px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 2.75rem;
  margin-bottom: 1.75rem;
  color: rgba(255, 255, 255, 0.9);
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
}

.landing-name {
  font-size: 2rem;
  font-weight: 700;
  margin: 0 0 0.35rem;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.landing-tagline {
  font-size: 0.85rem;
  opacity: 0.85;
  margin: 0;
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.landing-body {
  padding-top: 2rem;
  padding-bottom: 3rem;
}

.landing-stats {
  display: flex;
  gap: 1rem;
  justify-content: center;
  margin-bottom: 1.75rem;
}

.landing-stat {
  flex: 1;
  max-width: 120px;
  background: var(--color-surface);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 0.85rem 0.5rem;
  text-align: center;
  box-shadow: var(--shadow);
}

.landing-stat-value {
  display: block;
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--color-primary);
  line-height: 1;
  margin-bottom: 0.3rem;
}

.landing-stat-label {
  display: block;
  font-size: 0.75rem;
  color: var(--color-muted);
}

.landing-intro {
  text-align: center;
  color: var(--color-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
  line-height: 1.6;
}

.landing-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.landing-btn-primary {
  width: 100%;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius);
  color: #fff;
  border: none;
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: filter 0.15s;
}

.landing-btn-primary:hover {
  filter: brightness(0.9);
}

.landing-btn-secondary {
  width: 100%;
  padding: 0.8rem 1.5rem;
  font-size: 1rem;
  border-radius: var(--radius);
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  cursor: pointer;
  font-family: inherit;
  font-weight: 600;
  transition: background 0.15s;
}

.landing-btn-secondary:hover {
  background: #f0f4f0;
}

/* ── Auth box ───────────────────────────────────────────────── */
.auth-box {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-top: 3rem;
}

.auth-box h1 {
  font-size: 1.6rem;
  color: var(--color-primary);
  margin-bottom: 0.5rem;
}

/* ── Tabs ───────────────────────────────────────────────────── */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin: 1.25rem 0 1rem;
}

.tab-btn {
  background: transparent;
  color: var(--color-muted);
  border: 1px solid #ddd;
  padding: 0.35rem 0.9rem;
  font-size: 0.9rem;
}

.tab-btn.active {
  background: var(--color-primary);
  color: #fff;
  border-color: var(--color-primary);
}

/* ── Forms ──────────────────────────────────────────────────── */
.auth-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.auth-form label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.auth-form input {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}

.auth-form input:focus {
  outline: 2px solid var(--color-primary);
  border-color: transparent;
}

.auth-form button[type="submit"] {
  margin-top: 0.25rem;
}

/* ── Feedback ───────────────────────────────────────────────── */
.error {
  color: var(--color-error);
  font-size: 0.9rem;
}
.success {
  color: var(--color-success);
  font-size: 0.9rem;
}

/* ── Map ────────────────────────────────────────────────────── */
#map {
  height: calc(100vh - var(--header-h));
  width: 100%;
}

#map-toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: #323232;
  color: #fff;
  padding: 0.6rem 1.2rem;
  border-radius: var(--radius);
  font-size: 0.9rem;
  z-index: 3000;
  pointer-events: none;
  animation: fadein 0.2s ease;
}

@keyframes fadein {
  from {
    opacity: 0;
    transform: translateX(-50%) translateY(8px);
  }
}

.map-hint {
  background: rgba(255, 255, 255, 0.85);
  padding: 0.4rem 0.8rem;
  border-radius: var(--radius);
  font-size: 0.85rem;
  color: var(--color-muted);
}

/* ── Tree markers ───────────────────────────────────────────── */
.tree-pin {
  width: 36px;
  height: 42px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50% 50% 50% 0;
  transform: rotate(-45deg);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  font-size: 1rem;
  color: #fff;
  background: var(--color-primary);
}

.tree-pin i {
  transform: rotate(45deg);
}

.health-pin-good {
  background: #2e7d32;
}
.health-pin-fair {
  background: #f57f17;
}
.health-pin-poor {
  background: #bf360c;
}
.health-pin-dead {
  background: #757575;
}

/* ── Cluster icon ────────────────────────────────────────────── */
.tree-cluster {
  width: 48px;
  height: 48px;
  background: var(--color-primary);
  border-radius: 50%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 0.95rem;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  border: 3px solid rgba(255, 255, 255, 0.6);
  gap: 1px;
}

.cluster-count {
  font-size: 0.65rem;
  font-weight: 700;
  line-height: 1;
}

/* ── Tree picker modal ───────────────────────────────────────── */
.tree-picker-modal h2 {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.tree-picker-list {
  list-style: none;
  margin: 1rem 0;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  overflow: hidden;
  max-height: 55vh;
  overflow-y: auto;
}

.tree-picker-list li + li {
  border-top: 1px solid #e0e0e0;
}

.tree-picker-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--color-text);
  gap: 1rem;
  transition: background 0.1s;
}

.tree-picker-item:hover {
  background: #f5f9f5;
}

.tree-picker-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}
.tree-picker-name {
  font-weight: 600;
  font-size: 0.95rem;
}
.tree-picker-nick {
  font-size: 0.8rem;
  color: var(--color-muted);
  font-style: italic;
}

/* ── Tree detail page ───────────────────────────────────────── */
.tree-page {
  padding-bottom: 3rem;
}

.breadcrumb {
  margin: 1rem 0;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* ── QR code modal ───────────────────────────────────────────── */
.qr-modal {
  text-align: center;
}
.qr-modal h2 {
  justify-content: center;
}

.qr-img {
  display: block;
  margin: 1rem auto;
  border-radius: var(--radius);
}

.qr-url {
  font-family: monospace;
  font-size: 0.72rem;
  color: var(--color-muted);
  word-break: break-all;
  margin: 0.25rem 0 0.75rem;
}

.back-link {
  color: var(--color-primary);
  text-decoration: none;
  font-size: 0.9rem;
}

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

.tree-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  margin-bottom: 1rem;
}

.tree-header h1 {
  font-size: 1.6rem;
  margin: 0;
}

.tree-nickname {
  color: var(--color-muted);
  font-style: italic;
  margin: 0.2rem 0 0;
}

.health-badge {
  padding: 0.3rem 0.8rem;
  border-radius: 999px;
  font-size: 0.8rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.health-good {
  background: #e8f5e9;
  color: #2e7d32;
}
.health-fair {
  background: #fff8e1;
  color: #f57f17;
}
.health-poor {
  background: #fbe9e7;
  color: #bf360c;
}
.health-dead {
  background: #f5f5f5;
  color: #757575;
}

.tree-photo {
  width: 100%;
  max-height: 280px;
  object-fit: cover;
  border-radius: var(--radius);
  margin-bottom: 1.25rem;
}

.tree-meta {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  background: var(--color-surface);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 1rem;
  margin-bottom: 1.25rem;
}

.tree-meta > div {
  display: flex;
  gap: 0.75rem;
  font-size: 0.9rem;
}

.meta-label {
  min-width: 80px;
  font-weight: 600;
  color: var(--color-muted);
}

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

/* ── Adopt button ───────────────────────────────────────────── */
.adopt-section {
  margin-bottom: 1.5rem;
}

/* ── Maintenance timeline ───────────────────────────────────── */
.maintenance-section,
.log-section {
  margin-top: 1.75rem;
}

.maintenance-section h2,
.log-section h2 {
  font-size: 1.1rem;
  margin-bottom: 0.75rem;
  padding-bottom: 0.4rem;
  border-bottom: 2px solid #e0e0e0;
}

.maintenance-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.maintenance-entry {
  background: var(--color-surface);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.entry-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.35rem;
}

.entry-type {
  font-weight: 600;
  font-size: 0.95rem;
}
.entry-date {
  font-size: 0.8rem;
  color: var(--color-muted);
}
.entry-notes {
  font-size: 0.9rem;
  color: var(--color-text);
  margin: 0;
}

.entry-photo {
  margin-top: 0.6rem;
  width: 100%;
  max-height: 200px;
  object-fit: cover;
  border-radius: calc(var(--radius) - 2px);
}

/* ── Log form ───────────────────────────────────────────────── */
.log-section form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.log-section label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.log-section input,
.log-section select,
.log-section textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
}

.log-section input:focus,
.log-section select:focus,
.log-section textarea:focus {
  outline: 2px solid var(--color-primary);
  border-color: transparent;
}

.log-section textarea {
  resize: vertical;
}

/* ── Parish picker ──────────────────────────────────────────── */
.picker-box {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 2rem;
  margin-top: 3rem;
}

.picker-box h1 {
  font-size: 1.6rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.picker-box p {
  color: var(--color-muted);
  margin-bottom: 1rem;
}

.picker-box input[type="search"] {
  width: 100%;
  padding: 0.6rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  margin-bottom: 0.75rem;
}

.picker-box input[type="search"]:focus {
  outline: 2px solid var(--color-primary);
  border-color: transparent;
}

.parish-list {
  list-style: none;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  overflow: hidden;
}

.parish-list li + li {
  border-top: 1px solid #e0e0e0;
}

a.parish-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  text-decoration: none;
  color: var(--color-text);
  transition: background 0.1s;
}

a.parish-item:hover {
  background: #f0f4f0;
}

.parish-name {
  font-weight: 500;
}

.parish-slug {
  font-size: 0.8rem;
  color: var(--color-muted);
  font-family: monospace;
}

.parish-empty {
  padding: 0.75rem 1rem;
  color: var(--color-muted);
  font-size: 0.9rem;
}

/* ── Modal ──────────────────────────────────────────────────── */
#modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
}

.modal {
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.75rem;
  width: min(480px, 92vw);
  max-height: 90vh;
  overflow-y: auto;
}

.modal h2 {
  font-size: 1.25rem;
  color: var(--color-primary);
  margin-bottom: 0.25rem;
}

.modal-coords {
  font-size: 0.8rem;
  color: var(--color-muted);
  margin-bottom: 1rem;
  font-family: monospace;
}

.modal form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.modal label {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  font-size: 0.9rem;
  font-weight: 500;
}

.modal input,
.modal select,
.modal textarea {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}

.modal input:focus,
.modal select:focus,
.modal textarea:focus {
  outline: 2px solid var(--color-primary);
  border-color: transparent;
}

.modal textarea {
  resize: vertical;
}

.modal-actions {
  display: flex;
  gap: 0.75rem;
  justify-content: flex-end;
  margin-top: 0.25rem;
}

/* ── Google button ──────────────────────────────────────────── */
.btn-google {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  width: 100%;
  background: #fff;
  color: #3c4043;
  border: 1px solid #dadce0;
  font-weight: 500;
  padding: 0.6rem 1rem;
  margin-top: 0.25rem;
}

.btn-google:hover {
  background: #f8f9fa;
}

.auth-divider {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  color: var(--color-muted);
  font-size: 0.85rem;
  margin: 1rem 0 0.5rem;
}

.auth-divider::before,
.auth-divider::after {
  content: "";
  flex: 1;
  height: 1px;
  background: #e0e0e0;
}

.auth-forgot {
  margin: 0.5rem 0 0;
  font-size: 0.85rem;
  text-align: right;
}

.auth-forgot a {
  color: var(--color-muted);
  text-decoration: underline;
}

/* ── Nav link (dashboard etc.) ──────────────────────────────── */
.nav-link {
  color: rgba(255, 255, 255, 0.85);
  text-decoration: none;
  font-size: 0.85rem;
  margin-right: 1rem;
}

.nav-link:hover {
  color: #fff;
}

/* ── Admin settings page ────────────────────────────────────── */
.admin-page {
  padding-bottom: 3rem;
}

.admin-title {
  font-size: 1.5rem;
  margin: 1rem 0 1.5rem;
}

.admin-section {
  background: var(--color-surface);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 1.25rem 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.admin-section h2 {
  font-size: 1rem;
  font-weight: 700;
  color: var(--color-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e0e0e0;
}

.admin-section label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  font-weight: 500;
  margin-bottom: 0.85rem;
}

.admin-section label:last-child {
  margin-bottom: 0;
}

.admin-section input[type="text"],
.admin-section input[type="number"] {
  padding: 0.5rem 0.75rem;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  font-size: 1rem;
  font-family: inherit;
  width: 100%;
}

.admin-section input[type="text"]:focus,
.admin-section input[type="number"]:focus {
  outline: 2px solid var(--color-primary);
  border-color: transparent;
}

.label-hint {
  font-size: 0.8rem;
  font-weight: 400;
  color: var(--color-muted);
}

/* Colour picker row */
.colour-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-top: 0.1rem;
}

input[type="color"] {
  width: 44px;
  height: 36px;
  padding: 2px;
  border: 1px solid #ccc;
  border-radius: var(--radius);
  cursor: pointer;
  background: none;
}

.colour-swatch {
  width: 36px;
  height: 36px;
  border-radius: var(--radius);
  border: 1px solid rgba(0, 0, 0, 0.1);
  flex-shrink: 0;
  transition: background 0.1s;
}

.colour-row code {
  font-size: 0.9rem;
  color: var(--color-muted);
}

/* Logo field */
.logo-field {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

.logo-field-label {
  font-size: 0.9rem;
  font-weight: 500;
}

.logo-preview-img {
  max-width: 160px;
  max-height: 100px;
  object-fit: contain;
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 0.5rem;
  background: #fafafa;
}

.logo-preview-empty {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.75rem 1rem;
  border: 1px dashed #ccc;
  border-radius: var(--radius);
  color: var(--color-muted);
  font-size: 0.9rem;
  width: fit-content;
}

.btn-upload {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.45rem 1rem;
  background: transparent;
  color: var(--color-primary);
  border: 1.5px solid var(--color-primary);
  border-radius: var(--radius);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  width: fit-content;
  transition: background 0.1s;
}

.btn-upload:hover {
  background: #f0f4f0;
}

/* Save row */
.admin-save-row {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

/* ── Moderator dashboard ────────────────────────────────────── */
.mod-page {
  padding-bottom: 3rem;
}

.mod-title {
  font-size: 1.5rem;
  margin: 1rem 0 0.25rem;
}

.mod-tabs-bar {
  display: flex;
  padding: 0 1rem;
  max-width: 480px;
  margin: 0.75rem auto 0;
}

.mod-tabs-bar .tab-btn {
  background: transparent;
  color: var(--color-muted);
  border: none;
  border-bottom: 2px solid transparent;
  border-radius: 0;
  padding: 0.55rem 1rem;
  margin-bottom: -2px;
  font-size: 0.9rem;
}

.mod-tabs-bar .tab-btn.active {
  color: var(--color-primary);
  border-bottom-color: var(--color-primary);
}

.mod-tabs-bar .tab-btn:hover:not(.active) {
  background: #f5f5f5;
}

.mod-content {
  margin-top: 1.25rem;
}

.mod-pending-notice {
  background: #fff8e1;
  border: 1px solid #ffe082;
  border-radius: var(--radius);
  padding: 0.6rem 1rem;
  font-size: 0.9rem;
  color: #f57f17;
  margin-bottom: 1rem;
}

.mod-list {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.mod-row {
  background: var(--color-surface);
  border: 1px solid #e0e0e0;
  border-radius: var(--radius);
  padding: 0.85rem 1rem;
}

.mod-row-main {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 0.3rem;
}

.mod-row-title {
  font-weight: 600;
  font-size: 0.95rem;
  display: block;
}
.mod-row-sub {
  font-size: 0.8rem;
  color: var(--color-muted);
  display: block;
  margin-top: 0.1rem;
}

.mod-row-meta {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  font-size: 0.8rem;
  margin-bottom: 0.45rem;
}

.mod-coords {
  color: var(--color-muted);
  font-family: monospace;
}

.mod-row-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  align-items: center;
  margin-top: 0.5rem;
}

/* Tags */
.tag {
  display: inline-block;
  padding: 0.15rem 0.5rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: #f0f0f0;
  color: var(--color-muted);
}

.tag-adopted {
  background: #e8f5e9;
  color: #2e7d32;
}

/* Role badges */
.role-badge {
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  white-space: nowrap;
  flex-shrink: 0;
}

.role-pending {
  background: #fff8e1;
  color: #f57f17;
}
.role-volunteer {
  background: #e3f2fd;
  color: #1565c0;
}
.role-moderator {
  background: #f3e5f5;
  color: #6a1b9a;
}
.role-admin {
  background: #e8f5e9;
  color: #2e7d32;
}

/* Small and danger buttons */
.btn-sm {
  font-size: 0.8rem;
  padding: 0.3rem 0.75rem;
}

button.danger {
  background: var(--color-error);
  color: #fff;
}
button.danger:hover {
  background: #8e0000;
}

/* Text link button */
.btn-link {
  font-size: 0.85rem;
  color: var(--color-primary);
  text-decoration: none;
}

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

/* ── Logout button (in header) ──────────────────────────────── */
#btn-logout {
  background: rgba(255, 255, 255, 0.2);
  border: 1px solid rgba(255, 255, 255, 0.5);
  font-size: 0.85rem;
  padding: 0.3rem 0.9rem;
}

#btn-logout:hover {
  background: rgba(255, 255, 255, 0.35);
}

/* ── Reports tab ────────────────────────────────────────────── */
.report-section {
  margin-top: 2rem;
}

.report-section + .report-section {
  border-top: 1px solid #e0e0e0;
  padding-top: 2rem;
}

.report-heading {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 1.05rem;
  font-weight: 600;
  margin-bottom: 1rem;
  color: var(--color-text);
}

.report-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.5rem;
  height: 1.5rem;
  padding: 0 0.4rem;
  border-radius: 999px;
  background: var(--color-primary);
  color: #fff;
  font-size: 0.75rem;
  font-weight: 700;
  margin-left: 0.25rem;
}

/* Health breakdown bar chart */
.health-breakdown {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
}

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

.health-bar-wrap {
  flex: 1;
  height: 10px;
  background: #e0e0e0;
  border-radius: 999px;
  overflow: hidden;
}

.health-bar {
  height: 100%;
  background: var(--color-primary);
  border-radius: 999px;
  transition: width 0.3s ease;
  min-width: 2px;
}

.health-bar-count {
  font-size: 0.85rem;
  color: var(--color-muted);
  min-width: 1.5rem;
  text-align: right;
}

/* Volunteer leaderboard */
.leaderboard {
  list-style: none;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.leaderboard-row {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem;
  background: var(--color-surface);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
}

.leaderboard-rank {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--color-muted);
  min-width: 1.25rem;
  text-align: center;
}

.leaderboard-row:nth-child(1) .leaderboard-rank {
  color: #f9a825;
}
.leaderboard-row:nth-child(2) .leaderboard-rank {
  color: #9e9e9e;
}
.leaderboard-row:nth-child(3) .leaderboard-rank {
  color: #8d6e63;
}

.leaderboard-name {
  flex: 1;
  font-size: 0.9rem;
}

.leaderboard-count {
  font-size: 0.8rem;
  color: var(--color-muted);
}

/* ── Hamburger button ───────────────────────────────────────── */
#btn-nav-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.45);
  color: #fff;
  padding: 0.35rem 0.6rem;
  font-size: 1rem;
  border-radius: var(--radius);
  line-height: 1;
}

#btn-nav-toggle:hover {
  background: rgba(255, 255, 255, 0.15);
}

/* Desktop: nav is a flex row (current behaviour) */
#nav-menu {
  display: flex;
  align-items: center;
  gap: 1rem;
}

/* ── Mobile nav ─────────────────────────────────────────────── */
@media (max-width: 640px) {
  /* Show hamburger, hide inline nav */
  #btn-nav-toggle {
    display: flex;
  }

  #nav-menu {
    display: none;
    position: absolute;
    top: var(--header-h);
    left: 0;
    right: 0;
    flex-direction: column;
    align-items: stretch;
    gap: 0;
    background: var(--color-primary);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
    z-index: 999;
    padding-bottom: 0.75rem;
  }

  /* Open state toggled by JS */
  #app-header.nav-open #nav-menu {
    display: flex;
  }

  /* Parish name — top of dropdown */
  #nav-parish-name {
    display: block;
    padding: 0.75rem 1.25rem 0.6rem;
    margin-right: 0;
    font-size: 0.95rem;
    font-weight: 600;
    opacity: 1;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  }

  /* Nav links */
  .nav-link {
    display: block;
    padding: 0.8rem 1.25rem;
    margin-right: 0;
    font-size: 1rem;
    color: rgba(255, 255, 255, 0.9);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-link:hover {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
  }

  /* Sign out button in dropdown */
  #btn-logout {
    display: block;
    width: calc(100% - 2.5rem);
    margin: 0.75rem 1.25rem 0;
    text-align: center;
    font-size: 0.9rem;
  }

  /* ── General mobile tweaks ─────────────────────────────────── */

  /* Full-width container on small screens */
  .container {
    max-width: 100%;
  }

  /* Tighter page margins */
  .tree-page,
  .admin-page {
    margin-top: 1rem;
  }

  /* Modals: full width with small side margin */
  .modal {
    width: calc(100vw - 2rem);
    max-height: 90vh;
    overflow-y: auto;
  }

  /* Tree header: stack on very small screens */
  .tree-header {
    flex-wrap: wrap;
    gap: 0.5rem;
  }

  /* Moderator dashboard: tighter row actions */
  .mod-row-actions {
    flex-wrap: wrap;
    gap: 0.4rem;
  }

  /* Health breakdown: smaller text */
  .health-bar-wrap {
    min-width: 60px;
  }

  /* Admin save row: stack on mobile */
  .admin-save-row {
    flex-direction: column;
    align-items: flex-start;
  }
}
