:root {
  --bg: #f3f6ee;
  --panel: #ffffff;
  --text: #21301c;
  --muted: #5f6b57;
  --border: #dde6d2;
  --accent: #3f7d3a;
  --accent-dark: #2c5a28;
  --accent-deep: #1d3d1a;
  --clay: #c4703b;
  --clay-dark: #a85a2c;
  --bloom: #c2569a;
  --shadow: 0 1px 3px rgba(31, 53, 27, 0.08);
  --shadow-lift: 0 10px 24px -12px rgba(31, 53, 27, 0.35);
  --font-display: "Fraunces", Georgia, "Times New Roman", serif;
  --leaf-white: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='64' height='64' viewBox='0 0 24 24'%3E%3Cpath fill='%23ffffff' fill-opacity='0.07' d='M6.05 8.05c-2.73 2.73-2.73 7.17 0 9.9C7.42 19.32 9.21 20 11 20s3.58-.68 4.95-2.05C19.43 14.47 20 4 20 4S9.53 4.57 6.05 8.05z'/%3E%3C/svg%3E");
  --leaf-green: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 24 24'%3E%3Cpath fill='%233f7d3a' d='M6.05 8.05c-2.73 2.73-2.73 7.17 0 9.9C7.42 19.32 9.21 20 11 20s3.58-.68 4.95-2.05C19.43 14.47 20 4 20 4S9.53 4.57 6.05 8.05z'/%3E%3C/svg%3E");
  --leaf-faint: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='120' height='120' viewBox='0 0 24 24'%3E%3Cpath fill='%233f7d3a' fill-opacity='0.05' d='M6.05 8.05c-2.73 2.73-2.73 7.17 0 9.9C7.42 19.32 9.21 20 11 20s3.58-.68 4.95-2.05C19.43 14.47 20 4 20 4S9.53 4.57 6.05 8.05z'/%3E%3C/svg%3E");
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg);
  background-image: var(--leaf-faint);
  background-attachment: fixed;
  color: var(--text);
  line-height: 1.5;
}

.site-header {
  position: relative;
  background: linear-gradient(135deg, var(--accent-deep) 0%, var(--accent) 55%, var(--accent-dark) 100%);
  background-image: var(--leaf-white),
    linear-gradient(135deg, var(--accent-deep) 0%, var(--accent) 55%, var(--accent-dark) 100%);
  color: #fff;
  padding: 2.4rem 1.25rem 2.6rem;
  text-align: center;
  overflow: hidden;
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: -1px;
  height: 18px;
  background: var(--bg);
  -webkit-mask: radial-gradient(14px at 50% 0, transparent 98%, #000) repeat-x;
  mask: radial-gradient(14px at 16px -8px, transparent 98%, #000) repeat-x;
  -webkit-mask-size: 32px 18px;
  mask-size: 32px 18px;
}

.site-header h1 {
  margin: 0 0 0.3rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: clamp(1.7rem, 4vw, 2.4rem);
  letter-spacing: 0.3px;
  text-shadow: 0 1px 0 rgba(0, 0, 0, 0.15);
}

.site-header h1::before,
.site-header h1::after {
  content: "\1F33F";
  margin: 0 0.5rem;
  font-size: 0.8em;
  vertical-align: 0.05em;
  filter: drop-shadow(0 1px 1px rgba(0, 0, 0, 0.25));
}

.site-header h1::after {
  display: inline-block;
  transform: scaleX(-1);
}

.tagline {
  margin: 0;
  opacity: 0.92;
  font-size: 1.02rem;
}

.weather-widget {
  position: absolute;
  top: 0.9rem;
  right: 0.9rem;
  z-index: 2;
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 0.1rem;
  padding: 0.45rem 0.7rem;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.18);
  border: 1px solid rgba(255, 255, 255, 0.45);
  backdrop-filter: blur(4px);
  text-align: right;
  line-height: 1.1;
}

.weather-widget .weather-temp {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.35rem;
}

.weather-widget .weather-hum {
  font-size: 0.85rem;
  opacity: 0.92;
}

@media (max-width: 540px) {
  .weather-widget {
    top: 0.6rem;
    right: 0.6rem;
    padding: 0.35rem 0.55rem;
  }

  .weather-widget .weather-temp {
    font-size: 1.1rem;
  }
}

.site-nav {
  margin-top: 0.85rem;
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.site-nav a {
  display: inline-block;
  color: #fff;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.95rem;
  padding: 0.3rem 0.8rem;
  border: 1px solid rgba(255, 255, 255, 0.55);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.12);
  transition: background 0.12s ease, transform 0.12s ease;
}

.site-nav a:hover {
  background: rgba(255, 255, 255, 0.22);
  transform: translateY(-1px);
}

.site-nav a.nav-btn {
  background: #fff;
  color: var(--text);
  border-color: #fff;
}

.site-nav a.nav-btn:hover {
  background: rgba(255, 255, 255, 0.85);
}

.sensor-strip {
  max-width: 1100px;
  margin: 1.25rem auto -0.25rem;
  padding: 0 1.25rem;
}

.sensor-strip-head {
  display: flex;
  align-items: baseline;
  gap: 0.5rem;
  margin-bottom: 0.5rem;
  flex-wrap: wrap;
}

.sensor-strip-title {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.sensor-strip-sub {
  color: var(--muted);
  font-size: 0.85rem;
}

.sensor-strip-inner {
  display: flex;
  gap: 0.6rem;
  overflow-x: auto;
  padding-bottom: 0.25rem;
}

.sensor-tile {
  flex: 1 0 auto;
  min-width: 150px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent);
  border-radius: 10px;
  background: var(--panel);
  box-shadow: var(--shadow);
  padding: 0.6rem 0.75rem;
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
}

.sensor-tile.offline {
  border-left-color: var(--muted);
  opacity: 0.75;
}

.sensor-loc {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--muted);
}

.sensor-readout {
  display: flex;
  align-items: baseline;
  gap: 0.6rem;
}

.sensor-temp {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.4rem;
  color: var(--accent-deep);
}

.sensor-hum {
  font-size: 0.95rem;
  color: var(--clay-dark);
}

.sensor-status {
  font-size: 0.85rem;
  color: var(--muted);
  font-style: italic;
}

.layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.map-panel,
.list-panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
  overflow: hidden;
}

.map-panel::before,
.list-panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--bloom), var(--clay));
  opacity: 0.85;
}

h2 {
  margin-top: 0;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
  display: flex;
  align-items: center;
  gap: 0.45rem;
}

h2::before {
  content: "";
  width: 1.1em;
  height: 1.1em;
  background: var(--leaf-green) center / contain no-repeat;
  flex: none;
}

.hint {
  color: var(--muted);
  font-size: 0.9rem;
  margin-top: -0.25rem;
}

/* Full-bleed hero map */
.home-top {
  min-height: 100svh;
  display: flex;
  flex-direction: column;
}

.home-top .site-header {
  flex: none;
}

.hero {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #e8eae6;
}

/* Map */
.map {
  width: 100%;
  height: 380px;
  border-radius: 8px;
  overflow: hidden;
  border: 1px solid var(--border);
  background: #e8eae6;
  z-index: 0;
}

.hero .map {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  border: 0;
  border-radius: 0;
}

/* Soft edge scrim + vignette over the map (non-interactive) */
.hero-scrim {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  background:
    linear-gradient(to bottom, rgba(29, 61, 26, 0.32) 0%, rgba(29, 61, 26, 0) 16%),
    linear-gradient(to top, rgba(29, 61, 26, 0.42) 0%, rgba(29, 61, 26, 0) 22%);
  box-shadow: inset 0 0 140px rgba(20, 40, 18, 0.4);
}

/* Scroll-to-plants cue */
.hero-scroll {
  position: absolute;
  left: 50%;
  bottom: 1.1rem;
  transform: translateX(-50%);
  z-index: 600;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.15rem;
  padding: 0.5rem 1.1rem 0.4rem;
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: 999px;
  background: rgba(29, 61, 26, 0.55);
  -webkit-backdrop-filter: blur(6px);
  backdrop-filter: blur(6px);
  color: #fff;
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.2px;
  cursor: pointer;
  box-shadow: var(--shadow-lift);
  transition: background 0.15s ease, transform 0.15s ease;
}

.hero-scroll:hover {
  background: rgba(29, 61, 26, 0.72);
}

.hero-scroll-chevron {
  font-size: 1.05rem;
  line-height: 1;
  animation: hero-bob 1.8s ease-in-out infinite;
}

@keyframes hero-bob {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(4px); }
}

@media (prefers-reduced-motion: reduce) {
  .hero-scroll-chevron { animation: none; }
}

/* Leaflet image-map background (shows through the ortho's transparent edges) */
.leaflet-container {
  background: #e8eae6;
}

/* Greenhouse markers (Leaflet divIcon) */
.gh-marker {
  background: transparent;
  border: 0;
}

.gh-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  color: #fff;
  font-weight: 700;
  font-size: 0.95rem;
  border: 3px solid #fff;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5), 0 0 0 1px rgba(0, 0, 0, 0.15);
  box-sizing: border-box;
  transition: transform 0.12s ease, box-shadow 0.12s ease;
  cursor: pointer;
}

.gh-pin:hover {
  transform: scale(1.12);
}

.gh-pin.active {
  transform: scale(1.22);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(255, 255, 255, 0.85);
  animation: pin-pulse 1.6s ease-in-out infinite;
}

@keyframes pin-pulse {
  0%, 100% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 0 4px rgba(255, 255, 255, 0.85); }
  50% { box-shadow: 0 4px 14px rgba(0, 0, 0, 0.55), 0 0 0 9px rgba(255, 255, 255, 0.25); }
}

@media (prefers-reduced-motion: reduce) {
  .gh-pin.active { animation: none; }
}

.gh-pin.section {
  width: 30px;
  height: 30px;
  font-size: 0.82rem;
}

.gh-pin.draft {
  background: #1b2a17;
  border-style: dashed;
  border-color: #fff;
  font-size: 1.3rem;
  line-height: 1;
}

.admin-map {
  height: 380px;
  width: 100%;
  border-radius: 8px;
  border: 1px solid var(--border);
  margin: 0.5rem 0 1rem;
}

.sub-title {
  margin: 1.4rem 0 0.4rem;
  font-size: 1.05rem;
}

.layout-banner {
  margin: 0.25rem 0 0;
  padding: 0.55rem 0.8rem;
  border-radius: 6px;
  background: #fef3c7;
  border: 1px solid #f1d68a;
  color: #6b4e00;
  font-weight: 600;
}

.admin-table tr.row-highlight td {
  background: #fff7da;
  transition: background 0.2s ease;
}

.admin-table input[type="color"] {
  padding: 0.1rem;
  height: 2rem;
  cursor: pointer;
}

/* Greenhouse filter chips */
.greenhouse-filter {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin: 0.75rem 0 0.25rem;
}

.greenhouse-chip {
  border: 2px solid var(--border);
  background: transparent;
  border-radius: 999px;
  padding: 0.3rem 0.7rem;
  font: inherit;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: transform 0.1s ease;
}

.greenhouse-chip {
  font-weight: 600;
}

.greenhouse-chip:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow);
}

.greenhouse-chip:focus-visible {
  outline: 3px solid #1b2a17;
  outline-offset: 2px;
}

.greenhouse-chip.section-chip {
  font-size: 0.82rem;
  padding: 0.2rem 0.55rem;
  border-style: dashed;
  margin-left: 0.1rem;
}

.greenhouse-chip.section-chip::before {
  content: "\21B3";
  margin-right: 0.15rem;
  opacity: 0.6;
}

.badge.section-badge {
  filter: brightness(1.12);
  opacity: 0.92;
}

.greenhouse-chip .chip-count {
  font-size: 0.75rem;
  background: rgba(0, 0, 0, 0.12);
  border-radius: 999px;
  padding: 0 0.4rem;
}

.greenhouse-chip.active .chip-count {
  background: rgba(255, 255, 255, 0.3);
}

/* List */
.list-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
}

.controls {
  display: flex;
  gap: 0.5rem;
}

#search {
  padding: 0.45rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
}

#show-all {
  padding: 0.45rem 0.85rem;
  border: 1px solid var(--accent-dark);
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

#show-all:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

#search {
  transition: border-color 0.12s ease, box-shadow 0.12s ease;
}

#search:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(63, 125, 58, 0.18);
}

.active-filter {
  color: var(--muted);
  font-size: 0.9rem;
  min-height: 1.2em;
  margin: 0.5rem 0;
}

.plant-list {
  display: grid;
  gap: 0.6rem;
}

.plant-card {
  position: relative;
  border: 1px solid var(--border);
  border-left-width: 6px;
  border-radius: 10px;
  padding: 0.75rem 0.9rem;
  background: #fff;
  box-shadow: var(--shadow);
  overflow: hidden;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.plant-card::after {
  content: "";
  position: absolute;
  right: -18px;
  bottom: -22px;
  width: 90px;
  height: 90px;
  background: var(--leaf-green) center / contain no-repeat;
  opacity: 0.06;
  transform: rotate(-18deg);
  pointer-events: none;
}

.plant-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lift);
}

.plant-card h3 {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.05rem;
}

.plant-card-head {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 0.5rem;
}

.plant-card-head .price {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--clay-dark);
  background: rgba(196, 112, 59, 0.12);
  border-radius: 999px;
  padding: 0.1rem 0.55rem;
  white-space: nowrap;
}

.plant-meta {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  margin-bottom: 0.3rem;
}

.badge {
  font-size: 0.72rem;
  font-weight: 600;
  letter-spacing: 0.2px;
  padding: 0.12rem 0.55rem;
  border-radius: 999px;
  color: #fff;
  white-space: nowrap;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

.badge.type {
  background: #eef2e6;
  color: var(--muted);
  box-shadow: inset 0 0 0 1px var(--border);
}

.badge.qty {
  background: #2f6f4f;
  color: #fff;
  box-shadow: inset 0 0 0 1px rgba(255, 255, 255, 0.25);
}

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

.empty {
  color: var(--muted);
  font-style: italic;
}

.site-footer {
  text-align: center;
  color: var(--muted);
  padding: 1.75rem 1.5rem 2.25rem;
  font-size: 0.9rem;
}

.site-footer::before {
  content: "\1F33F";
  display: block;
  font-size: 1.3rem;
  margin-bottom: 0.35rem;
  opacity: 0.8;
}

@media (max-width: 720px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

/* ---------------- Admin panel ---------------- */
.admin-main {
  max-width: 1100px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.admin-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-bottom: 1rem;
}

.admin-bar .who {
  color: var(--muted);
  font-size: 0.95rem;
}

.panel {
  position: relative;
  background: var(--panel);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 1.4rem;
  box-shadow: var(--shadow);
  margin-bottom: 1.25rem;
  overflow: hidden;
}

.panel::before {
  content: "";
  position: absolute;
  inset: 0 0 auto 0;
  height: 4px;
  background: linear-gradient(90deg, var(--accent), var(--bloom), var(--clay));
  opacity: 0.85;
}

.login-wrap {
  max-width: 380px;
  margin: 3rem auto;
}

.field {
  display: flex;
  flex-direction: column;
  gap: 0.3rem;
  margin-bottom: 0.85rem;
}

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

.field input,
.field select,
.field textarea {
  padding: 0.5rem 0.6rem;
  border: 1px solid var(--border);
  border-radius: 6px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.field textarea {
  min-height: 3rem;
  resize: vertical;
}

.btn {
  padding: 0.5rem 0.9rem;
  border: 1px solid var(--accent-dark);
  background: linear-gradient(180deg, var(--accent), var(--accent-dark));
  color: #fff;
  border-radius: 8px;
  cursor: pointer;
  font: inherit;
  transition: transform 0.12s ease, box-shadow 0.12s ease, filter 0.12s ease;
}

.btn:hover {
  filter: brightness(1.05);
  transform: translateY(-1px);
  box-shadow: var(--shadow-lift);
}

.btn.secondary {
  background: transparent;
  color: var(--text);
  border-color: var(--border);
}

.btn.danger {
  background: #b3261e;
  border-color: #b3261e;
}

.btn.small {
  padding: 0.3rem 0.6rem;
  font-size: 0.85rem;
}

.admin-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.admin-table th,
.admin-table td {
  text-align: left;
  padding: 0.45rem 0.5rem;
  border-bottom: 1px solid var(--border);
  vertical-align: middle;
}

.admin-table input,
.admin-table select,
.admin-table textarea {
  width: 100%;
  padding: 0.35rem 0.4rem;
  border: 1px solid var(--border);
  border-radius: 5px;
  font: inherit;
  background: #fff;
  color: var(--text);
}

.admin-table .row-actions {
  display: flex;
  gap: 0.35rem;
  white-space: nowrap;
}

.add-form {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(140px, 1fr));
  gap: 0.6rem;
  align-items: end;
}

.notice {
  padding: 0.6rem 0.8rem;
  border-radius: 6px;
  margin-bottom: 1rem;
  font-size: 0.9rem;
}

.notice.error {
  background: #fbe9e7;
  color: #8c1d18;
  border: 1px solid #f3c2bd;
}

.notice.success {
  background: #e7f4e8;
  color: #1e4620;
  border: 1px solid #bfe0c1;
}

.hidden {
  display: none !important;
}

.section-title {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.section-title h2 {
  margin: 0;
}

/* ---------------- UV index page ---------------- */
.uv-main {
  max-width: 720px;
  margin: 1.5rem auto;
  padding: 0 1.25rem;
}

.uv-form {
  display: flex;
  flex-wrap: wrap;
  align-items: end;
  gap: 0.6rem;
  margin-top: 0.5rem;
}

.uv-form .field {
  margin-bottom: 0;
}

.uv-form select {
  min-width: 9rem;
}

.uv-result {
  margin-top: 1.25rem;
}

.uv-date {
  margin: 0 0 0.2rem;
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 1.3rem;
}

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

.metric-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 0.75rem;
}

.metric-card {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  gap: 0.3rem;
  padding: 1rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: 12px;
  background: #fff;
  box-shadow: var(--shadow);
}

.metric-value {
  font-family: var(--font-display);
  font-weight: 600;
  font-size: 2rem;
  line-height: 1;
  color: var(--accent-deep);
}

.metric-label {
  font-size: 0.78rem;
  letter-spacing: 0.4px;
  text-transform: uppercase;
  color: var(--muted);
}

.metric-sub {
  font-size: 0.85rem;
  color: var(--muted);
}

.uv-category {
  display: inline-block;
  color: #fff;
  font-weight: 600;
  font-size: 0.78rem;
  padding: 0.12rem 0.6rem;
  border-radius: 999px;
}

.uv-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 1.25rem;
  font-size: 0.9rem;
}

.uv-table th,
.uv-table td {
  text-align: left;
  padding: 0.4rem 0.5rem;
  border-bottom: 1px solid var(--border);
}

.uv-table th {
  color: var(--muted);
  font-weight: 600;
}

.uv-muted {
  color: var(--muted);
  font-style: italic;
}
