:root {
  --bg: #f3f6fb;
  --surface: #ffffff;
  --text: #1f2937;
  --muted: #6b7280;
  --line: #e5e7eb;
  --primary: #0f766e;
  --primary-2: #155e75;
  --danger: #b91c1c;
  --warning: #b45309;
  --success: #166534;
  --radius: 14px;
  --shadow: 0 10px 30px rgba(15, 23, 42, 0.08);
  --theme-gradient: linear-gradient(135deg, #dff6e8 0%, #c8ecd7 42%, #b2e3c8 100%);
  --theme-gradient-strong: linear-gradient(135deg, #66b086 0%, #4b9a72 45%, #3e875f 100%);
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  color: var(--text);
  background: #b7dcca;
  background-repeat: no-repeat;
  background-size: auto;
  background-position: initial;
  font-family: "Segoe UI", Tahoma, Geneva, Verdana, sans-serif;
}

.container {
  width: 100%;
  max-width: 1200px;
  margin: 0 auto;
  padding-left: 20px;
  padding-right: 20px;
}

.site-header {
  background:
    linear-gradient(rgba(21, 47, 31, 0.78), rgba(16, 40, 27, 0.76)),
    url('/images/whatsapp_leaf_bg.jpg'),
    url('https://images.unsplash.com/photo-1448375240586-882707db888b?auto=format&fit=crop&w=1800&q=80');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #fff;
  padding: 18px 0 14px;
  box-shadow: var(--shadow);
  border-bottom: 1px solid rgba(220, 252, 231, 0.22);
}

.topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 20px;
}

.topbar-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

.brand {
  display: flex;
  align-items: center;
  gap: 10px;
}

.brand h1 {
  margin: 0;
  font-size: 1.5rem;
}

.brand p {
  margin: 0;
  font-size: 0.9rem;
  opacity: 0.88;
  color: #dcfce7;
}

.nav {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.nav a {
  text-decoration: none;
  color: #fff;
  background: rgba(236, 253, 245, 0.14);
  padding: 8px 12px;
  border-radius: 999px;
  font-size: 0.88rem;
  border: 1px solid rgba(236, 253, 245, 0.28);
}

.theme-toggle-btn {
  width: 36px;
  height: 36px;
  border: 1px solid rgba(236, 253, 245, 0.4);
  background: rgba(17, 40, 26, 0.35);
  color: #fff;
  border-radius: 10px;
  padding: 0;
  font-size: 0.9rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle-btn:hover {
  background: rgba(17, 40, 26, 0.58);
}

.nav a:hover {
  background: rgba(236, 253, 245, 0.24);
}

.page-wrap {
  padding: 28px 0 40px;
}

.page-wrap > * + * {
  margin-top: 18px;
}

.hero-panel {
  background: linear-gradient(130deg, rgba(15, 118, 110, 0.96), rgba(21, 94, 117, 0.95));
  color: #fff;
  border-radius: 20px;
  box-shadow: var(--shadow);
  padding: 28px;
  margin-bottom: 20px;
}

.landing-hero {
  border-radius: 20px;
  overflow: hidden;
  box-shadow: var(--shadow);
  background:
    linear-gradient(rgba(20, 44, 29, 0.52), rgba(17, 40, 26, 0.56)),
    url('/images/whatsapp_leaf_bg.jpg'),
    url('https://images.unsplash.com/photo-1448375240586-882707db888b?auto=format&fit=crop&w=1800&q=80');
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  color: #ffffff;
  padding: 46px 32px;
}

.landing-hero h2 {
  margin: 0 0 12px;
  font-size: clamp(2rem, 4vw, 3rem);
}

.landing-hero p {
  margin: 0 0 16px;
  max-width: 760px;
  color: rgba(244, 244, 245, 0.95);
}

.hero-panel h2 {
  margin: 0 0 10px;
  font-size: 2rem;
}

.hero-panel p {
  margin: 0 0 16px;
  opacity: 0.95;
}

.stat-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(150px, 1fr));
  gap: 12px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.16);
  border: 1px solid rgba(255, 255, 255, 0.28);
  border-radius: 12px;
  padding: 12px;
}

.stat-card h4 {
  margin: 0;
  font-size: 1.4rem;
}

.stat-card p {
  margin: 3px 0 0;
  font-size: 0.85rem;
}

.page-title {
  margin: 0 0 8px;
  font-size: 1.8rem;
}

.page-subtitle {
  margin: 0 0 22px;
  color: var(--muted);
}

.panel {
  background: var(--surface);
  border: 1px solid var(--line);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 20px;
  margin-bottom: 20px;
}

.panel h3 {
  margin-top: 0;
}

.btn {
  border: 0;
  border-radius: 10px;
  padding: 10px 14px;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

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

.btn-secondary {
  background: #0ea5e9;
  color: #fff;
}

.btn-danger {
  background: #ef4444;
  color: #fff;
}

.form-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(220px, 1fr));
  gap: 14px;
}

.form-row-full {
  grid-column: 1 / -1;
}

label {
  display: block;
  margin-bottom: 6px;
  font-weight: 600;
}

input,
textarea,
select {
  width: 100%;
  border: 1px solid var(--line);
  border-radius: 10px;
  padding: 10px;
  font-size: 0.95rem;
}

textarea {
  min-height: 92px;
}

.grid-2 {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 18px;
}

.grid-cards {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 14px;
}

.card {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: #fff;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  height: 100%;
}

.card-head {
  background: #ecfeff;
  border-bottom: 1px solid var(--line);
  padding: 12px;
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 10px;
  min-height: 78px;
}

.card-body {
  padding: 14px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.badge {
  border-radius: 999px;
  padding: 4px 10px;
  font-size: 0.78rem;
  font-weight: 700;
}

.card-head .badge {
  flex-shrink: 0;
  margin-top: 2px;
}

.badge-low {
  background: #dcfce7;
  color: #166534;
}

.badge-medium {
  background: #fef3c7;
  color: #92400e;
}

.badge-high {
  background: #fee2e2;
  color: #991b1b;
}

.table-wrap {
  overflow: auto;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.92rem;
}

th,
td {
  border-bottom: 1px solid var(--line);
  text-align: left;
  padding: 9px 8px;
}

th {
  color: #334155;
  background: #f8fafc;
}

.notice {
  border-radius: 10px;
  padding: 10px;
  margin-bottom: 10px;
}

.notice-error {
  background: #fee2e2;
  color: #991b1b;
  border: 1px solid #fecaca;
}

.notice-success {
  background: #dcfce7;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.notice-warning {
  background: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

.muted {
  color: var(--muted);
}

.map-toolbar {
  display: flex;
  align-items: end;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 12px;
}

.map-toolbar label {
  margin: 0;
}

.map-toolbar select {
  width: min(360px, 100%);
  background: #fff;
}

.india-map {
  width: 100%;
  height: 560px;
  border-radius: 14px;
  border: 1px solid var(--line);
  overflow: hidden;
}

.cluster-icon-wrapper {
  background: transparent;
  border: 0;
}

.cluster-bubble {
  border-radius: 999px;
  display: grid;
  place-items: center;
  border: 2px solid rgba(255, 255, 255, 0.78);
  color: #042f2e;
  font-weight: 800;
  box-shadow: 0 8px 20px rgba(6, 78, 59, 0.28);
}

.products-rail {
  display: grid;
  grid-template-columns: 1fr;
  gap: 12px;
  max-height: 520px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
}

.rail-card {
  width: 100%;
}

.rail-title {
  margin: 0 0 6px;
  font-size: 1rem;
  line-height: 1.25;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.rail-desc {
  margin: 0 0 10px;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  min-height: 58px;
}

.image-preview-wrap {
  border: 1px solid var(--line);
  border-radius: 12px;
  padding: 10px;
  background: #f8fafc;
}

.image-preview {
  width: 100%;
  max-height: 280px;
  object-fit: contain;
  border-radius: 10px;
  border: 1px solid #dbe3ec;
  background: #ffffff;
}

.compact-disease-card .card-body p {
  margin: 0 0 10px;
}

.disease-card-title {
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.25;
}

.disease-summary {
  display: -webkit-box;
  -webkit-line-clamp: 7;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.card-actions {
  margin-top: auto;
  padding-top: 2px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.card-inline-form {
  margin: 0;
}

.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(2, 6, 23, 0.58);
  display: grid;
  place-items: center;
  z-index: 2000;
  padding: 18px;
}

.modal-card {
  width: min(820px, 96vw);
  max-height: 88vh;
  overflow: auto;
  background: #fff;
  border-radius: 14px;
  border: 1px solid var(--line);
  box-shadow: 0 20px 40px rgba(15, 23, 42, 0.24);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 10px;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  position: sticky;
  top: 0;
  background: #f8fafc;
}

.modal-header h3 {
  margin: 0;
}

.modal-body {
  padding: 16px;
}

html[data-theme="dark"] body {
  background: #0e1a16;
  color: #e5e7eb;
}

html[data-theme="dark"] .site-header {
  border-bottom-color: rgba(134, 239, 172, 0.24);
}

html[data-theme="dark"] .brand p {
  color: #bbf7d0;
}

html[data-theme="dark"] .theme-toggle-btn {
  border-color: rgba(187, 247, 208, 0.38);
  background: rgba(16, 36, 27, 0.82);
}

html[data-theme="dark"] .theme-toggle-btn:hover {
  background: rgba(25, 58, 42, 0.94);
}

html[data-theme="dark"] .panel,
html[data-theme="dark"] .card,
html[data-theme="dark"] .modal-card,
html[data-theme="dark"] .table-wrap table,
html[data-theme="dark"] input,
html[data-theme="dark"] textarea,
html[data-theme="dark"] select {
  background: #13221d;
  color: #e5e7eb;
  border-color: #294237;
}

html[data-theme="dark"] .card-head,
html[data-theme="dark"] .modal-header,
html[data-theme="dark"] th {
  background: #1b2f27;
  color: #e5e7eb;
  border-color: #355545;
}

html[data-theme="dark"] .muted,
html[data-theme="dark"] .page-subtitle,
html[data-theme="dark"] td {
  color: #b4c9c0;
}

html[data-theme="dark"] td,
html[data-theme="dark"] th {
  border-bottom-color: #2d473c;
}

html[data-theme="dark"] .notice-success {
  background: rgba(22, 101, 52, 0.25);
  color: #bbf7d0;
  border-color: rgba(34, 197, 94, 0.45);
}

html[data-theme="dark"] .notice-warning {
  background: rgba(146, 64, 14, 0.24);
  color: #fde68a;
  border-color: rgba(245, 158, 11, 0.4);
}

html[data-theme="dark"] .notice-error {
  background: rgba(127, 29, 29, 0.33);
  color: #fecaca;
  border-color: rgba(239, 68, 68, 0.5);
}

@media (max-width: 900px) {
  .container {
    padding-left: 14px;
    padding-right: 14px;
  }

  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .topbar-actions {
    width: 100%;
    justify-content: space-between;
  }

  .grid-2,
  .form-grid {
    grid-template-columns: 1fr;
  }
  .stat-grid {
    grid-template-columns: 1fr;
  }

  .india-map {
    height: 460px;
  }
}
