/* ═══════════════════════════════════════════════════════════
   Zahrádkář — Micro styl (green/earth palette)
   ═══════════════════════════════════════════════════════════ */

:root {
  color-scheme: light;
  font-family: "Inter", system-ui, -apple-system, sans-serif;
  font-size: 16px;
  line-height: 1.5;

  --surface: #f8faf8;
  --surface-elevated: #ffffff;
  --surface-card: #ffffff;
  --border: #d4ddd4;
  --text: #1a2e1a;
  --muted: #5c7a5c;
  --primary: #16a34a;
  --primary-hover: #15803d;
  --accent: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.12);
  --warning: #f59e0b;
  --danger: #ef4444;
  --info: #3b82f6;
  --radius: 6px;
  --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
  --shadow-md: 0 2px 8px rgba(0,0,0,0.06);
  --nav-h: 48px;
}

/* ── Dark mode ─────────────────────────────────────── */
[data-theme="dark"] {
  color-scheme: dark;
  --surface: #0b1a0b;
  --surface-elevated: #132213;
  --surface-card: #1a2e1a;
  --border: #2d4a2d;
  --text: #e0f0e0;
  --muted: #7da87d;
  --primary: #4ade80;
  --primary-hover: #22c55e;
  --accent: #4ade80;
  --accent-soft: rgba(74, 222, 128, 0.08);
  --warning: #fbbf24;
  --danger: #f87171;
  --info: #60a5fa;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.2);
  --shadow-md: 0 2px 10px rgba(0,0,0,0.3);
}

/* ── Reset ─────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; }
html { overflow-y: scroll; scrollbar-width: thin; scrollbar-color: #7da87d transparent; }
html::-webkit-scrollbar { width: 6px; }
html::-webkit-scrollbar-thumb { background: #7da87d; border-radius: 999px; }
html, body { margin: 0; padding: 0; background: var(--surface); color: var(--text); }
a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }
img { max-width: 100%; display: block; }
button { cursor: pointer; }

/* ── Nav ───────────────────────────────────────────── */
.nav {
  position: fixed; top: 0; left: 0; right: 0; z-index: 900;
  height: var(--nav-h);
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  backdrop-filter: blur(8px);
}
[data-theme="dark"] .nav {
  background: rgba(11, 26, 11, 0.92);
  border-bottom-color: rgba(74, 222, 128, 0.15);
}
.nav-inner {
  max-width: 100%; margin: 0; padding: 0 16px;
  display: flex; align-items: center; justify-content: space-between;
  height: 100%;
}
.nav-left, .nav-right { display: flex; align-items: center; gap: 10px; }
.nav-logo {
  display: flex; align-items: center; gap: 6px;
  font-size: 0.85rem; font-weight: 600; color: var(--text);
  text-decoration: none;
}
.nav-logo svg { color: var(--primary); }
.nav-link {
  font-size: 0.72rem; color: var(--text); padding: 4px 8px;
  border-radius: var(--radius); transition: background 0.15s;
  text-decoration: none;
}
.nav-link:hover { background: var(--accent-soft); text-decoration: none; }
.nav-link--muted { color: var(--muted); }
/* ── Hub trigger (same as Burzák) ─────────────────── */
.hub-trigger {
  display: flex; align-items: center; justify-content: center;
  width: 34px; height: 34px;
  border: none; border-radius: 7px;
  background: transparent; color: var(--muted);
  cursor: pointer; padding: 0; flex-shrink: 0;
  transition: color 0.15s, background 0.15s;
}
.hub-trigger:hover { color: var(--primary); background: var(--accent-soft); }
.hub-icon { display: block; }

/* Hub popup (same as Burzák) */
.hub-popup {
  display: none; position: absolute; top: calc(var(--nav-h) - 2px); left: 12px;
  z-index: 9999; width: 220px;
  background: linear-gradient(135deg, #f0f7f0, #e8f5e8);
  border: 1px solid rgba(74, 222, 128, 0.25);
  border-radius: 10px;
  box-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
  padding: 0.5rem;
  animation: hub-fade 0.12s ease;
}
.hub-popup.is-open { display: block; }
@keyframes hub-fade {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}
.hub-popup__head {
  display: flex; align-items: center; gap: 0.3rem;
  padding: 0.15rem 0.25rem 0.35rem;
  border-bottom: 1px solid rgba(74, 222, 128, 0.2);
  margin-bottom: 0.35rem;
}
.hub-popup__title {
  font-size: 0.6rem; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.04em;
  color: var(--muted);
}
.hub-popup__grid { display: grid; gap: 0.25rem; }
.hub-app {
  display: grid; grid-template-columns: 10px 1fr;
  grid-template-rows: auto auto;
  gap: 0 0.45rem; align-items: center;
  padding: 0.35rem 0.4rem; border-radius: 8px;
  text-decoration: none; color: inherit;
  transition: background 0.12s; position: relative;
}
.hub-app:hover { background: var(--accent-soft); text-decoration: none; }
.hub-app--active { background: var(--accent-soft); }
.hub-app--active::after {
  content: "✓"; position: absolute; right: 0.4rem; top: 50%;
  transform: translateY(-50%); font-size: 0.6rem; color: var(--primary);
}
.hub-app__dot {
  width: 10px; height: 10px; border-radius: 50%; grid-row: 1 / 3;
}
.hub-app__name {
  font-size: 0.72rem; font-weight: 600; color: var(--text); line-height: 1.1;
}
.hub-app__desc {
  font-size: 0.58rem; color: var(--muted); line-height: 1.2;
}
.hub-popup__foot {
  margin: 0.3rem 0 0; padding-top: 0.3rem;
  border-top: 1px solid rgba(74, 222, 128, 0.2);
  font-size: 0.52rem; color: var(--muted); text-align: center;
}

/* Hub dark mode */
[data-theme="dark"] .hub-trigger { color: #64748b; }
[data-theme="dark"] .hub-trigger:hover { color: #4ade80; background: rgba(74, 222, 128, 0.1); }
[data-theme="dark"] .hub-popup {
  background: var(--surface-card);
  border-color: rgba(74, 222, 128, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}
[data-theme="dark"] .hub-popup__head { border-bottom-color: var(--border); }
[data-theme="dark"] .hub-popup__title { color: #94a3b8; }
[data-theme="dark"] .hub-app:hover { background: rgba(74, 222, 128, 0.08); }
[data-theme="dark"] .hub-app--active { background: rgba(74, 222, 128, 0.06); }
[data-theme="dark"] .hub-app--active::after { color: #4ade80; }
[data-theme="dark"] .hub-app__name { color: var(--text); }
[data-theme="dark"] .hub-app__desc { color: var(--muted); }
[data-theme="dark"] .hub-popup__foot { border-top-color: var(--border); color: #64748b; }

/* ── Nav user identity (same pattern as Burzák) ──── */
.nav-meta-identity {
  display: flex; align-items: center; gap: 0.35rem;
}
.nav-meta-block {
  display: flex; flex-direction: column; line-height: 1.2; text-align: right;
}
.nav-meta-label {
  text-transform: lowercase; color: var(--muted);
  font-size: 0.6rem; font-weight: 500;
}
.nav-meta-value {
  font-weight: 600; color: var(--text); font-size: 0.78rem;
}
.nav-meta-separator {
  width: 1px; height: 24px;
  background: var(--border); display: inline-block;
}
.nav-avatar-circle {
  width: 32px; height: 32px; border-radius: 50%;
  overflow: hidden; flex-shrink: 0;
}
.nav-avatar-placeholder { width: 100%; height: 100%; border-radius: 50%; }
[data-theme="dark"] .nav-meta-label { color: var(--muted); }
[data-theme="dark"] .nav-meta-value { color: var(--text); }
[data-theme="dark"] .nav-meta-separator { background: var(--border); }
[data-theme="dark"] .nav-avatar-circle svg circle[fill="#cbd5e1"] { fill: #2d4a2d; }
[data-theme="dark"] .nav-avatar-circle svg circle[fill="#94a3b8"],
[data-theme="dark"] .nav-avatar-circle svg path[fill="#94a3b8"] { fill: #5c7a5c; }

/* ── Theme toggle ──────────────────────────────────── */
.theme-toggle {
  background: none; border: none; padding: 4px;
  color: var(--muted); display: flex; align-items: center;
  border-radius: var(--radius); transition: color 0.15s;
}
.theme-toggle:hover { color: var(--primary); }
.theme-icon-dark { display: none; }
[data-theme="dark"] .theme-icon-light { display: none; }
[data-theme="dark"] .theme-icon-dark { display: block; }

/* ── Container ─────────────────────────────────────── */
.container {
  max-width: 1100px; margin: 0 auto; padding: 0 12px;
}
main.container {
  padding-top: var(--nav-h);
  padding-bottom: 48px;
  min-height: calc(100vh - 40px);
}

/* ── Footer ────────────────────────────────────────── */
.footer {
  border-top: 1px solid var(--border);
  padding: 12px 0;
  text-align: center;
}
.footer-copy { font-size: 0.65rem; color: var(--muted); }

/* ── Typography ────────────────────────────────────── */
h1 { font-size: 1.1rem; font-weight: 600; margin: 0 0 8px; }
h2 { font-size: 0.95rem; font-weight: 600; margin: 0 0 6px; }
h3 { font-size: 0.8rem; font-weight: 600; margin: 0 0 4px; }
p { margin: 0 0 8px; font-size: 0.8rem; }
small, .text-sm { font-size: 0.72rem; }
.text-xs { font-size: 0.65rem; }
.text-muted { color: var(--muted); }

/* ── Cards ─────────────────────────────────────────── */
.card {
  background: var(--surface-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  box-shadow: var(--shadow-sm);
}
[data-theme="dark"] .card {
  border-color: rgba(74, 222, 128, 0.12);
}

/* ── Buttons ───────────────────────────────────────── */
.btn {
  display: inline-flex; align-items: center; gap: 4px;
  font-size: 0.72rem; font-weight: 500; padding: 6px 14px;
  border-radius: var(--radius); border: 1px solid transparent;
  cursor: pointer; transition: all 0.15s; text-decoration: none;
  font-family: inherit; line-height: 1.4;
}
.btn:hover { text-decoration: none; }
.btn-primary {
  background: var(--primary); color: #fff; border-color: var(--primary);
}
.btn-primary:hover {
  background: var(--primary-hover); border-color: var(--primary-hover);
}
.btn-ghost {
  background: transparent; color: var(--text);
  border-color: var(--border);
}
.btn-ghost:hover {
  background: var(--accent-soft); border-color: var(--primary);
  color: var(--primary);
}
.btn-danger {
  background: transparent; color: var(--danger);
  border-color: var(--danger);
}
.btn-danger:hover {
  background: var(--danger); color: #fff;
}
.btn-sm { font-size: 0.65rem; padding: 3px 8px; }
.btn-icon {
  padding: 4px; border: none; background: none;
  color: var(--muted); cursor: pointer;
}
.btn-icon:hover { color: var(--primary); }

/* ── Forms ─────────────────────────────────────────── */
.form-group { margin-bottom: 12px; }
.form-label {
  display: block; font-size: 0.7rem; font-weight: 500;
  margin-bottom: 3px; color: var(--text);
}
.form-input, .form-select {
  width: 100%; padding: 6px 10px;
  font-size: 0.75rem; font-family: inherit;
  background: var(--surface-elevated); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  transition: border-color 0.15s;
}
.form-input:focus, .form-select:focus {
  outline: none; border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(74, 222, 128, 0.15);
}
[data-theme="dark"] .form-input,
[data-theme="dark"] .form-select {
  background: var(--surface-elevated);
}

/* ── Tags / chips ──────────────────────────────────── */
.chip {
  display: inline-flex; align-items: center; gap: 3px;
  font-size: 0.62rem; font-weight: 500; padding: 2px 8px;
  border-radius: 999px; white-space: nowrap;
}
.chip-green { background: rgba(74, 222, 128, 0.15); color: #16a34a; }
.chip-amber { background: rgba(245, 158, 11, 0.15); color: #d97706; }
.chip-red { background: rgba(239, 68, 68, 0.15); color: #ef4444; }
.chip-blue { background: rgba(59, 130, 246, 0.15); color: #3b82f6; }
[data-theme="dark"] .chip-green { color: #4ade80; }
[data-theme="dark"] .chip-amber { color: #fbbf24; }
[data-theme="dark"] .chip-red { color: #f87171; }
[data-theme="dark"] .chip-blue { color: #60a5fa; }

/* ── Badge ─────────────────────────────────────────── */
.badge {
  display: inline-block; font-size: 0.58rem; font-weight: 600;
  padding: 1px 6px; border-radius: 999px;
  text-transform: uppercase; letter-spacing: 0.03em;
}
.badge-heavy { background: #ef4444; color: #fff; }
.badge-medium { background: #f59e0b; color: #fff; }
.badge-light { background: #3b82f6; color: #fff; }
.badge-enricher { background: #8b5cf6; color: #fff; }

/* ── Landing page ──────────────────────────────────── */
.landing-hero {
  text-align: center; padding: 60px 0 40px;
}
.landing-hero h1 {
  font-size: 1.5rem; font-weight: 700; margin-bottom: 8px;
}
.landing-hero p {
  font-size: 0.85rem; color: var(--muted); max-width: 440px;
  margin: 0 auto 20px;
}
.landing-features {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 12px; margin-bottom: 40px;
}
.feature-card {
  text-align: center; padding: 20px 16px;
}
.feature-card .feature-icon {
  font-size: 1.6rem; margin-bottom: 8px;
}
.feature-card h3 { font-size: 0.8rem; margin-bottom: 4px; }
.feature-card p { font-size: 0.7rem; color: var(--muted); margin: 0; }

/* ── Login ─────────────────────────────────────────── */
.login-wrap {
  max-width: 340px; margin: 60px auto 0; text-align: center;
}
.login-wrap h1 { margin-bottom: 16px; }
.login-wrap .card { text-align: left; }

/* ── Gardens list ──────────────────────────────────── */
.gardens-header {
  display: flex; align-items: center; justify-content: space-between;
  margin-bottom: 12px;
}
.garden-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 12px;
}
.garden-card {
  display: flex; flex-direction: column; gap: 6px;
  transition: border-color 0.15s;
}
.garden-card:hover { border-color: var(--primary); }
.garden-card-name {
  font-size: 0.85rem; font-weight: 600;
}
.garden-card-meta {
  font-size: 0.65rem; color: var(--muted);
}
.garden-card-beds {
  display: flex; flex-wrap: wrap; gap: 4px; margin-top: 4px;
}
.garden-card-bed {
  font-size: 0.6rem; padding: 1px 6px;
  border-radius: var(--radius); background: var(--accent-soft);
  color: var(--primary);
}

/* ── Weather bar ──────────────────────────────────── */
.weather-bar {
  background: linear-gradient(135deg, #1a5e2a 0%, #2d7a4a 30%, #3b8ea5 70%, #2d6a8a 100%);
  color: #fff;
  padding: 8px 16px;
  margin: 0 -10px 8px; /* negative margin to go edge-to-edge */
  display: flex; align-items: center; gap: 14px;
  overflow-x: auto; font-size: 12px;
  position: relative;
  min-height: 44px;
}
.weather-bar::before {
  content: ""; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 200 50'%3E%3Ccircle cx='160' cy='12' r='18' fill='rgba(255,255,255,0.08)'/%3E%3Ccircle cx='175' cy='20' r='12' fill='rgba(255,255,255,0.05)'/%3E%3Ccircle cx='30' cy='35' r='20' fill='rgba(255,255,255,0.04)'/%3E%3C/svg%3E") repeat-x center;
  pointer-events: none;
}
[data-theme="dark"] .weather-bar {
  background: linear-gradient(135deg, #0b1a0b 0%, #132213 30%, #0f2a3a 70%, #0b1a0b 100%);
}
.weather-loading { color: rgba(255,255,255,0.7); font-size: 11px; }
.weather-now {
  display: flex; align-items: center; gap: 8px;
  padding-right: 14px; border-right: 1px solid rgba(255,255,255,0.2);
  white-space: nowrap; position: relative; z-index: 1;
}
.weather-now-icon { font-size: 24px; line-height: 1; }
.weather-now-temp { font-size: 20px; font-weight: 700; color: #fff; }
.weather-now-detail { font-size: 11px; color: rgba(255,255,255,0.75); line-height: 1.3; }
.weather-sun {
  display: flex; align-items: center; gap: 6px;
  padding-right: 14px; border-right: 1px solid rgba(255,255,255,0.2);
  font-size: 11px; color: rgba(255,255,255,0.8); white-space: nowrap;
  position: relative; z-index: 1;
}
.weather-sun-icon { font-size: 14px; }
.weather-forecast {
  display: flex; gap: 6px; flex: 1; position: relative; z-index: 1;
}
.weather-day {
  display: flex; flex-direction: column; align-items: center;
  gap: 1px; min-width: 44px; text-align: center;
}
.weather-day-name { font-size: 10px; color: rgba(255,255,255,0.7); font-weight: 500; }
.weather-day-icon { font-size: 16px; }
.weather-day-temps { font-size: 10px; white-space: nowrap; }
.weather-day-hi { font-weight: 600; color: #fff; }
.weather-day-lo { color: rgba(255,255,255,0.6); }
.weather-day-rain { font-size: 9px; color: #93c5fd; }

/* ── Garden editor ─────────────────────────────────── */
/* Full-width override — garden editor uses entire viewport */
.editor-fullwidth {
  max-width: none; padding-left: 10px; padding-right: 10px;
}
.editor-header {
  display: flex; align-items: center; gap: 10px;
  margin-bottom: 8px; flex-wrap: wrap;
}
.year-nav {
  display: flex; align-items: center; gap: 4px;
  margin-left: auto;
  background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); padding: 2px 6px;
}
.editor-layout-3col {
  display: grid; grid-template-columns: 280px 1fr 300px;
  gap: 10px; min-height: calc(100vh - var(--nav-h) - 100px);
}
@media (max-width: 1400px) {
  .editor-layout-3col {
    grid-template-columns: 240px 1fr 260px;
  }
}
@media (max-width: 1000px) {
  .editor-layout-3col {
    grid-template-columns: 200px 1fr 220px;
  }
}
@media (max-width: 860px) {
  .editor-layout-3col {
    grid-template-columns: 1fr;
  }
}
.editor-map {
  border-radius: var(--radius);
  overflow: hidden; border: 1px solid var(--border);
  position: relative; min-height: 500px;
  height: calc(100vh - var(--nav-h) - 100px);
}
[data-theme="dark"] .editor-map {
  border-color: rgba(74, 222, 128, 0.2);
}
.editor-sidebar {
  display: flex; flex-direction: column; gap: 8px;
  overflow-y: auto; max-height: calc(100vh - var(--nav-h) - 100px);
}
.editor-sidebar-left { order: -1; }
.editor-sidebar-right { order: 1; }
.sidebar-section {
  padding: 10px;
}
.sidebar-section h3 {
  font-size: 0.72rem; margin-bottom: 6px;
  display: flex; align-items: center; justify-content: space-between;
}

/* ── Bed list in sidebar ───────────────────────────── */
.bed-list { list-style: none; padding: 0; margin: 0; }
.bed-table { width: 100%; border-collapse: collapse; }
.bed-item {
  cursor: pointer; transition: background 0.15s;
  font-size: 0.72rem;
  border-left: 3px solid transparent;
}
.bed-item td { padding: 3px 3px; vertical-align: middle; }
.bed-item:hover { background: var(--accent-soft); }
.bed-item.is-active {
  background: var(--accent-soft);
  border-left-color: var(--primary);
}
.bed-td-color { width: 14px; }
.bed-color {
  width: 8px; height: 8px; border-radius: 2px;
  display: inline-block;
}
.bed-td-name { font-weight: 500; white-space: nowrap; }
.bed-td-area { font-size: 0.6rem; color: var(--muted); white-space: nowrap; text-align: right; }
.bed-td-crops { font-size: 10px; }
.bed-td-edit { width: 20px; text-align: center; }
.bed-crop-chip {
  display: inline-flex; align-items: center; gap: 1px;
  font-size: 10px; white-space: nowrap;
}
.bed-crop-chip .crop-emoji { font-size: 11px; }
.bed-crop-yield { font-size: 9px; color: var(--muted); }
.bed-crop-stars { font-size: 9px; color: #f59e0b; letter-spacing: -1px; }
/* Bed soil/maintenance care */
.bed-care-seasonal {
  padding-bottom: 6px; margin-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.bed-care-row {
  display: flex; align-items: center; gap: 4px;
  font-size: 11px; margin-top: 8px;
}
.bed-care-row:first-child { margin-top: 0; }
.bed-care-color {
  width: 6px; height: 6px; border-radius: 2px; flex-shrink: 0;
}
.bed-care-tip {
  font-size: 11px; padding-left: 10px;
  line-height: 1.5;
}

/* ── Map search ────────────────────────────────────── */
.map-search-wrap {
  position: absolute; top: 8px; left: 8px; z-index: 500;
  width: 240px;
}
/* Move Leaflet zoom to bottom-left so it doesn't overlap search */
.editor-map .leaflet-top.leaflet-left { top: auto; bottom: 24px; }
.editor-map .leaflet-control-zoom { margin: 0 0 0 10px; }
.map-search {
  width: 100%; padding: 6px 10px 6px 30px;
  font-size: 0.72rem; font-family: inherit;
  background: var(--surface-elevated); color: var(--text);
  border: 1px solid var(--border); border-radius: var(--radius);
  box-shadow: var(--shadow-md);
}
.map-search:focus {
  outline: none; border-color: var(--primary);
}
.map-search::placeholder { color: var(--muted); opacity: 0.7; }
[data-theme="dark"] .map-search {
  background: var(--surface-card);
}
.map-search-icon {
  position: absolute; left: 9px; top: 50%; transform: translateY(-50%);
  color: var(--muted); pointer-events: none; z-index: 1;
}
.map-search-results {
  display: none; position: absolute; top: 100%; left: 0; right: 0;
  margin-top: 2px;
  background: var(--surface-elevated); border: 1px solid var(--border);
  border-radius: var(--radius); box-shadow: var(--shadow-md);
  max-height: 200px; overflow-y: auto;
}
[data-theme="dark"] .map-search-results {
  background: var(--surface-card);
  border-color: rgba(74, 222, 128, 0.2);
}
.search-item {
  padding: 6px 10px; cursor: pointer;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s;
}
.search-item:last-child { border-bottom: none; }
.search-item:hover { background: var(--accent-soft); }
.search-name { font-size: 0.7rem; display: block; }
.search-type {
  font-size: 0.58rem; color: var(--muted);
  text-transform: capitalize;
}
.search-empty {
  padding: 8px 10px; font-size: 0.68rem; color: var(--muted);
  text-align: center;
}

/* ── Map toolbar ───────────────────────────────────── */
.map-toolbar {
  position: absolute; top: 8px; right: 8px; z-index: 500;
  display: flex; align-items: center; gap: 4px;
}
.map-toolbar .btn {
  background: var(--surface-elevated);
  box-shadow: var(--shadow-md);
}
.map-toolbar .btn.btn-primary {
  background: var(--primary); color: #fff;
}
[data-theme="dark"] .map-toolbar .btn {
  background: var(--surface-card);
}
[data-theme="dark"] .map-toolbar .btn.btn-primary {
  background: var(--primary); color: #fff;
}
.draw-hint {
  position: absolute; bottom: 8px; left: 50%; transform: translateX(-50%);
  z-index: 500; font-size: 0.68rem; font-weight: 500;
  background: var(--surface-elevated); color: var(--text);
  padding: 5px 14px; border-radius: 999px;
  box-shadow: var(--shadow-md); white-space: nowrap;
  pointer-events: none;
}
[data-theme="dark"] .draw-hint { background: var(--surface-card); }
.sat-opacity-wrap {
  display: flex; align-items: center;
  background: var(--surface-elevated); border-radius: var(--radius);
  padding: 3px 8px; box-shadow: var(--shadow-md);
}
[data-theme="dark"] .sat-opacity-wrap {
  background: var(--surface-card);
}
.sat-opacity-slider {
  width: 70px; height: 3px;
  -webkit-appearance: none; appearance: none;
  background: var(--border); border-radius: 2px; outline: none;
  cursor: pointer;
}
.sat-opacity-slider::-webkit-slider-thumb {
  -webkit-appearance: none; appearance: none;
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); cursor: pointer;
  border: 2px solid var(--surface-elevated);
}
.sat-opacity-slider::-moz-range-thumb {
  width: 12px; height: 12px; border-radius: 50%;
  background: var(--primary); cursor: pointer;
  border: 2px solid var(--surface-elevated);
}

/* ── Planner ───────────────────────────────────────── */
.planner-header {
  display: flex; align-items: center; gap: 12px;
  margin-bottom: 12px; flex-wrap: wrap;
}
.planner-header h1 { margin: 0; }
.year-nav {
  display: flex; align-items: center; gap: 4px;
}
.year-nav .year-label {
  font-size: 0.85rem; font-weight: 600;
  min-width: 48px; text-align: center;
}

/* ── Planner grid ──────────────────────────────────── */
.planner-grid {
  display: grid; grid-template-columns: 140px 1fr;
  gap: 1px; background: var(--border);
  border: 1px solid var(--border); border-radius: var(--radius);
  overflow: hidden;
}
[data-theme="dark"] .planner-grid {
  border-color: rgba(74, 222, 128, 0.15);
  background: rgba(74, 222, 128, 0.08);
}
.pg-header {
  font-size: 0.65rem; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.03em; padding: 6px 8px;
  background: var(--surface-elevated); color: var(--muted);
}
.pg-bed-name {
  font-size: 0.72rem; font-weight: 500; padding: 8px;
  background: var(--surface-elevated);
  display: flex; align-items: center; gap: 6px;
}
.pg-bed-color {
  width: 8px; height: 8px; border-radius: 2px; flex-shrink: 0;
}
.pg-cell {
  background: var(--surface-card); padding: 6px 8px;
  display: flex; align-items: center; gap: 6px;
  cursor: pointer; transition: background 0.15s;
  min-height: 38px;
}
.pg-cell:hover {
  background: var(--accent-soft);
}
.pg-cell.has-crop {
  cursor: default;
}
.pg-crop-icon { font-size: 1rem; }
.pg-crop-name { font-size: 0.7rem; font-weight: 500; }
.pg-crop-family {
  font-size: 0.58rem; color: var(--muted);
  margin-left: auto; padding: 1px 5px;
  border-radius: 999px;
}
.pg-cell-empty {
  font-size: 0.65rem; color: var(--muted); font-style: italic;
}
.pg-cell-warning {
  color: var(--warning); font-size: 0.6rem;
  display: flex; align-items: center; gap: 2px;
}

/* ── Crop picker modal ─────────────────────────────── */
.modal-overlay {
  position: fixed; inset: 0; z-index: 1000;
  background: rgba(0, 0, 0, 0.4);
  display: none; align-items: center; justify-content: center;
  padding: 16px;
}
.modal-overlay.is-open { display: flex; }
[data-theme="dark"] .modal-overlay {
  background: rgba(0, 0, 0, 0.65);
}
.modal {
  background: var(--surface-elevated);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-md);
  max-width: 480px; width: 100%;
  max-height: 80vh; overflow-y: auto;
  padding: 16px;
}
[data-theme="dark"] .modal {
  border-color: rgba(74, 222, 128, 0.2);
}
.modal-title {
  font-size: 0.85rem; font-weight: 600; margin-bottom: 10px;
  display: flex; align-items: center; justify-content: space-between;
}
.modal-close {
  background: none; border: none; color: var(--muted);
  cursor: pointer; padding: 2px; font-size: 1.1rem;
}
.modal-close:hover { color: var(--text); }

/* ── Crop list (in modal) ──────────────────────────── */
.crop-search {
  margin-bottom: 8px;
}
.crop-list { list-style: none; padding: 0; margin: 0; }
.crop-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius);
  cursor: pointer; transition: background 0.15s;
  border: 1px solid transparent;
}
.crop-item:hover { background: var(--accent-soft); }
.crop-item.has-warning {
  border-color: rgba(245, 158, 11, 0.3);
}
.crop-item.has-violation {
  border-color: rgba(239, 68, 68, 0.3);
}
.crop-icon { font-size: 1.1rem; flex-shrink: 0; }
.crop-info { flex: 1; min-width: 0; }
.crop-name { font-size: 0.75rem; font-weight: 500; }
.crop-family-tag {
  font-size: 0.58rem; padding: 0 5px; border-radius: 999px;
  display: inline-block; margin-left: 4px;
}
.crop-demand { font-size: 0.6rem; color: var(--muted); }
.crop-score {
  font-size: 0.6rem; font-weight: 600;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  background: var(--accent-soft); color: var(--primary);
  flex-shrink: 0;
}
.crop-warnings {
  font-size: 0.6rem; color: var(--warning);
  padding: 2px 0 0 30px;
}

/* ── History panel ─────────────────────────────────── */
.history-panel {
  padding: 10px;
}
.history-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0; font-size: 0.7rem;
  border-bottom: 1px solid var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-year {
  font-weight: 600; min-width: 36px; color: var(--muted);
}
.history-crop { flex: 1; }
.history-family {
  font-size: 0.58rem; padding: 0 5px;
  border-radius: 999px;
}

/* ── Empty state ───────────────────────────────────── */
.empty-state {
  text-align: center; padding: 40px 20px;
  color: var(--muted);
}
.empty-state svg { margin: 0 auto 12px; opacity: 0.4; }
.empty-state p { font-size: 0.75rem; margin-bottom: 12px; }

/* ── Notifications / alerts ────────────────────────── */
.alert {
  font-size: 0.72rem; padding: 8px 12px;
  border-radius: var(--radius); border: 1px solid;
  margin-bottom: 12px;
}
.alert-success { background: rgba(74, 222, 128, 0.1); border-color: rgba(74, 222, 128, 0.3); color: var(--primary); }
.alert-warning { background: rgba(245, 158, 11, 0.1); border-color: rgba(245, 158, 11, 0.3); color: var(--warning); }
.alert-danger { background: rgba(239, 68, 68, 0.1); border-color: rgba(239, 68, 68, 0.3); color: var(--danger); }

/* ── Leaflet overrides ─────────────────────────────── */
.leaflet-container { background: #1a2e1a; font-family: inherit; }
[data-theme="dark"] .leaflet-control-zoom a {
  background: var(--surface-card); color: var(--text);
  border-color: var(--border);
}

/* ── Distance labels on draw ──────────────────────── */
.bed-tooltip-permanent {
  background: rgba(255,255,255,0.85); color: #1a2e1a;
  border: none; box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  font-size: 10px; font-weight: 500; padding: 2px 5px;
  border-radius: 3px; white-space: nowrap;
  pointer-events: none;
}
.bed-tooltip-permanent::before { display: none; }
[data-theme="dark"] .bed-tooltip-permanent {
  background: rgba(26,46,26,0.9); color: #e0f0e0;
}
.dist-label {
  background: rgba(0,0,0,0.7); color: #fff; border: none;
  font-size: 11px; font-weight: 600; padding: 2px 6px;
  border-radius: 4px; white-space: nowrap; box-shadow: none;
}
.dist-label::before { display: none; }
.dist-label-live { opacity: 0.8; }

/* ── Bed edit button ──────────────────────────────── */
.btn-edit-bed {
  background: none; border: none; cursor: pointer;
  padding: 2px 4px; opacity: 0; color: var(--text-muted);
  transition: opacity 0.15s, color 0.15s; flex-shrink: 0;
}
.bed-item:hover .btn-edit-bed { opacity: 0.6; }
.btn-edit-bed:hover { opacity: 1 !important; color: var(--primary); }

/* ── Modal overlay ───────────────────────────────── */
.modal-overlay {
  display: none; position: fixed; inset: 0; z-index: 1000;
  background: rgba(0,0,0,0.4); align-items: center; justify-content: center;
}
.modal-overlay.is-open { display: flex; }
.modal-card {
  background: var(--surface-card); border-radius: var(--radius-lg, 12px);
  padding: 20px; box-shadow: 0 8px 32px rgba(0,0,0,0.2);
  width: 90%; animation: modalIn 0.15s ease-out;
}
@keyframes modalIn {
  from { opacity: 0; transform: translateY(-10px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ── Integrated planner (sidebar) ─────────────────── */
.planner-current {
  display: flex; align-items: center; gap: 8px;
  padding: 8px 10px; border-radius: var(--radius);
  background: var(--primary-light); border: 1px solid var(--primary);
}
.planner-current strong { font-size: 13px; }
.planner-current #btnRemoveCrop { margin-left: auto; opacity: 0.5; }
.planner-current #btnRemoveCrop:hover { opacity: 1; }
.crop-icon-lg { font-size: 20px; }
/* Portion bar — visual split of bed */
.portion-bar {
  display: flex; height: 24px; border-radius: var(--radius);
  overflow: hidden; margin-bottom: 6px; border: 1px solid var(--border);
}
.portion-segment {
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; color: #fff; min-width: 20px;
  transition: width 0.2s;
}
.portion-segment + .portion-segment { border-left: 2px solid var(--surface-card); }

/* Multi-crop planting item */
.planner-current-item {
  display: flex; align-items: center; gap: 6px;
  padding: 4px 0; font-size: 13px;
}
.planner-current-item + .planner-current-item { border-top: 1px solid var(--border); }
.btn-remove-crop {
  background: none; border: none; cursor: pointer;
  color: var(--text-muted); font-size: 16px; padding: 0 4px;
  opacity: 0.4; transition: opacity 0.15s;
}
.btn-remove-crop:hover { opacity: 1; color: var(--danger); }

.crop-family-chip {
  display: inline-block; padding: 1px 6px; border-radius: 8px;
  font-size: 11px; font-weight: 500; margin-left: 4px;
}
.history-row {
  display: flex; align-items: center; gap: 6px;
  padding: 3px 0; font-size: 12px;
}
.history-row .history-year {
  font-weight: 600; color: var(--text-muted); min-width: 36px;
}

/* Crop picker inline */
.crop-pick-item {
  display: flex; align-items: center; gap: 8px;
  padding: 6px 8px; border-radius: var(--radius);
  cursor: pointer; transition: background 0.15s;
}
.crop-pick-item:hover { background: var(--surface-hover); }
.crop-pick-item.is-warn { background: #fef3c720; }
.crop-pick-item.is-bad { background: #fee2e220; opacity: 0.6; }
.crop-pick-icon { font-size: 18px; flex-shrink: 0; }
.crop-pick-info { flex: 1; min-width: 0; }
.crop-pick-name { font-size: 13px; font-weight: 500; }
.crop-pick-score {
  font-size: 11px; font-weight: 700; padding: 2px 6px;
  border-radius: 8px; background: var(--primary-light); color: var(--primary);
}

/* ── Rotation info modal ──────────────────────────── */
.btn-info-trigger {
  display: inline-flex; align-items: center; justify-content: center;
  width: 18px; height: 18px; border-radius: 50%; border: 1.5px solid var(--primary);
  background: transparent; color: var(--primary); font-size: 11px; font-weight: 700;
  cursor: pointer; margin-left: 4px; vertical-align: middle;
  transition: background 0.15s, color 0.15s;
}
.btn-info-trigger:hover { background: var(--primary); color: #fff; }
.info-section { margin-bottom: 16px; }
.info-section h4 { margin: 0 0 6px; font-size: 14px; color: var(--primary); }
.info-section p { margin: 0 0 6px; font-size: 13px; line-height: 1.5; }
.info-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 6px; }
.info-chip {
  font-size: 11px; padding: 3px 8px; border-radius: 12px;
  border: 1.5px solid; background: var(--surface-card);
}
.info-cycle {
  display: flex; align-items: center; gap: 6px; flex-wrap: wrap;
  margin: 6px 0;
}
.info-demand {
  padding: 3px 10px; border-radius: 8px; font-size: 12px; font-weight: 600;
}
.info-heavy { background: #fee2e2; color: #991b1b; }
.info-medium { background: #fef9c3; color: #854d0e; }
.info-light { background: #dcfce7; color: #166534; }
.info-enricher { background: #ede9fe; color: #5b21b6; }
.info-arrow { color: var(--text-muted); font-size: 14px; }
.info-table { width: 100%; font-size: 12px; border-collapse: collapse; }
.info-table td { padding: 4px 8px; border-bottom: 1px solid var(--border); }
.info-table .text-success { color: var(--success); font-weight: 500; }
.info-table .text-danger { color: var(--danger); font-weight: 500; }

/* ── Auto-distribute ──────────────────────────────── */
.dist-crop-chip {
  display: inline-flex; align-items: center; gap: 4px;
  padding: 3px 8px; border-radius: 12px; font-size: 12px; font-weight: 500;
  background: var(--primary-light); color: var(--text); border: 1px solid var(--primary);
}
.dist-crop-remove {
  background: none; border: none; cursor: pointer; font-size: 14px;
  color: var(--text-muted); padding: 0 2px; line-height: 1;
}
.dist-crop-remove:hover { color: var(--danger); }
.dist-result-row {
  display: flex; align-items: center; gap: 6px;
  padding: 5px 0; border-bottom: 1px solid var(--border);
}
.dist-result-row:last-child { border-bottom: none; }
.dist-result-info { flex: 1; font-size: 12px; }
.dist-result-bed { font-weight: 600; color: var(--primary); }
.dist-score {
  font-size: 11px; font-weight: 700; padding: 2px 6px;
  border-radius: 8px; min-width: 28px; text-align: center;
}
.dist-score.score-good { background: #dcfce7; color: #166534; }
.dist-score.score-ok { background: #fef9c3; color: #854d0e; }
.dist-score.score-bad { background: #fee2e2; color: #991b1b; }

/* ── Yield tracking ───────────────────────────────── */
.yield-row {
  display: flex; align-items: center; gap: 6px;
  padding: 2px 0 6px 40px; font-size: 12px;
}
.yield-stars { display: flex; gap: 1px; }
.yield-star {
  cursor: pointer; font-size: 14px; color: var(--border);
  transition: color 0.1s;
}
.yield-star.is-filled { color: #f59e0b; }
.yield-star:hover { color: #f59e0b; }
.yield-input {
  width: 52px; padding: 2px 4px; border: 1px solid var(--border);
  border-radius: var(--radius); font-size: 11px; text-align: right;
  background: var(--surface-card); color: var(--text);
}

/* ── Care timeline ────────────────────────────────── */
.care-timeline { font-size: 12px; }
.care-month {
  font-weight: 700; color: var(--primary); font-size: 12px;
  padding: 6px 0 2px; border-bottom: 1px solid var(--border);
  margin-bottom: 2px;
}
.care-task {
  display: flex; gap: 6px; padding: 3px 0 3px 4px;
  line-height: 1.4;
}
.care-icon { flex-shrink: 0; font-size: 13px; }
.care-detail { color: var(--text); }

/* ── Stats ────────────────────────────────────────── */
.stats-table { width: 100%; font-size: 11px; border-collapse: collapse; }
.stats-table th { text-align: left; font-weight: 600; color: var(--text-muted); padding: 3px 6px; border-bottom: 1px solid var(--border); }
.stats-table td { padding: 3px 6px; border-bottom: 1px solid var(--border); }
.stats-crop-row {
  display: flex; justify-content: space-between; align-items: center;
  padding: 3px 0; font-size: 12px;
}

/* ── Responsive ────────────────────────────────────── */
@media (max-width: 600px) {
  .landing-hero { padding: 36px 0 24px; }
  .landing-hero h1 { font-size: 1.2rem; }
  .planner-grid { grid-template-columns: 100px 1fr; }
  .pg-bed-name { font-size: 0.65rem; padding: 6px; }
  .pg-cell { padding: 4px 6px; }
}

/* ══ Crop database page ══════════════════════════════ */
.crops-hero {
  text-align: center; padding: 32px 0 20px;
}
.crops-hero h1 { font-size: 1.4rem; margin: 0 0 4px; }
.crops-hero p { color: var(--muted); font-size: 0.8rem; margin: 0; }
.crops-section { margin-bottom: 24px; }
.crops-section-header {
  display: flex; align-items: center; gap: 8px;
  margin-bottom: 10px; padding-bottom: 6px;
  border-bottom: 1px solid var(--border);
}
.crops-section-dot {
  width: 10px; height: 10px; border-radius: 50%; flex-shrink: 0;
}
.crops-section-header h2 { font-size: 0.9rem; margin: 0; }
.crops-section-meta { font-size: 0.65rem; color: var(--muted); }
/* Crop chip grid */
.crops-chip-grid {
  display: flex; flex-wrap: wrap; gap: 6px;
}
.crop-chip {
  display: inline-flex; align-items: center; gap: 5px;
  padding: 4px 10px 4px 6px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--surface-elevated);
  color: var(--text); text-decoration: none;
  font-size: 0.72rem; font-weight: 500;
  transition: background 0.12s, box-shadow 0.12s;
}
.crop-chip:hover {
  background: var(--accent-soft);
  box-shadow: var(--shadow-sm);
  text-decoration: none;
}
.crop-chip__icon { font-size: 1rem; line-height: 1; }
.crop-chip__name { white-space: nowrap; }
[data-theme="dark"] .crop-chip {
  background: var(--surface-card);
  border-color: var(--border);
}
[data-theme="dark"] .crop-chip:hover {
  background: rgba(74, 222, 128, 0.1);
}

/* ══ Crop detail page ════════════════════════════════ */
.crop-detail-layout {
  display: grid; grid-template-columns: 1fr; gap: 16px;
}
.crop-detail-hero {
  position: relative; border-radius: var(--radius);
  overflow: hidden; background: var(--surface-elevated);
  border: 1px solid var(--border);
}
.crop-detail-photo {
  width: 100%; height: 220px; object-fit: cover;
}
.crop-detail-photo-placeholder {
  width: 100%; height: 180px; display: flex;
  align-items: center; justify-content: center;
  font-size: 64px; background: linear-gradient(135deg, #dcfce7 0%, #d1fae5 100%);
}
[data-theme="dark"] .crop-detail-photo-placeholder {
  background: linear-gradient(135deg, #052e16 0%, #0b1a0b 100%);
}
.crop-detail-title {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 16px;
}
.crop-detail-icon { font-size: 32px; }
.crop-detail-cards {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
  gap: 10px;
}
.crop-info-card { padding: 12px; }
.crop-info-card h3 { font-size: 0.75rem; margin-bottom: 8px; }
.crop-info-table { width: 100%; font-size: 0.72rem; }
.crop-info-table td { padding: 3px 0; vertical-align: top; }
.crop-info-table td:first-child { color: var(--muted); width: 40%; white-space: nowrap; }
.crop-demand-badge {
  display: inline-block; font-size: 10px; padding: 1px 6px;
  border-radius: 3px; font-weight: 600;
}
.crop-description { font-size: 0.75rem; line-height: 1.6; }
.crop-companions {
  display: flex; flex-wrap: wrap; align-items: center; gap: 4px;
}
.crop-companion-chip {
  display: inline-flex; align-items: center; gap: 2px;
  font-size: 11px; padding: 2px 6px; border-radius: 3px;
  text-decoration: none; color: var(--text);
}
.crop-companion-chip.good { background: #dcfce7; }
.crop-companion-chip.bad { background: #fecaca; }
[data-theme="dark"] .crop-companion-chip.good { background: #052e16; }
[data-theme="dark"] .crop-companion-chip.bad { background: #450a0a; }
.crop-companion-chip:hover { text-decoration: none; opacity: 0.8; }
