:root {
  --app-bg: #f4f9f4;
  --app-panel: #ffffff;
  --app-panel-border: #dde8e1;
  --app-text: #1f2937;
  --app-muted: #6b7d72;
  --app-sidebar: #1a3a2a;
  --app-sidebar-text: #9dbfad;
  --app-primary: #2d7a4f;
  --app-primary-soft: #e8f5ee;
  --app-success-soft: #d4edda;
  --app-warning-soft: #fff3cd;
  --app-info-soft: #dff4e8;
  --app-shadow: 0 12px 30px rgba(20, 60, 35, 0.08);
  --sidebar-width: 264px;
  --topbar-height: 74px;
}

html,
body {
  min-height: 100%;
}

body {
  margin: 0;
  font-family: "Trebuchet MS", "Segoe UI Variable", "Candara", sans-serif;
  color: var(--app-text);
  background:
    radial-gradient(circle at top left, rgba(45, 122, 79, 0.08), transparent 20rem),
    linear-gradient(180deg, #f6fbf7 0%, var(--app-bg) 100%);
}

a {
  text-decoration: none;
}

.app-layout {
  min-height: 100vh;
}

.app-sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sidebar-width);
  background: linear-gradient(180deg, rgba(255, 255, 255, 0.02), transparent), var(--app-sidebar);
  padding: 1rem 0.95rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  border-right: 1px solid rgba(255, 255, 255, 0.05);
}

.app-sidebar-brand {
  padding: 0.25rem 0.5rem 1rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.app-sidebar-kicker {
  display: block;
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: rgba(255, 255, 255, 0.55);
  margin-bottom: 0.85rem;
}

.app-sidebar-logo,
.public-brand {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  color: #fff;
}

.app-sidebar-logo strong,
.public-brand strong {
  display: block;
  font-size: 1rem;
}

.app-sidebar-logo small,
.public-brand small {
  display: block;
  color: var(--app-sidebar-text);
  font-size: 0.78rem;
}

.app-logo-mark {
  width: 2.4rem;
  height: 2.4rem;
  border-radius: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--app-primary), #5aaa7a);
  color: #fff;
  box-shadow: 0 10px 25px rgba(45, 122, 79, 0.35);
}

.app-logo-img {
  width: 2.4rem;
  height: 2.4rem;
  object-fit: contain;
  flex-shrink: 0;
}

.app-nav-group {
  display: flex;
  flex-direction: column;
  gap: 0;
}

.app-nav-title {
  padding: 0 0.55rem;
  margin-bottom: 0.35rem;
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: rgba(255, 255, 255, 0.45);
}

button.app-nav-title {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  background: none;
  border: none;
  cursor: pointer;
  outline: none;
}

button.app-nav-title:focus-visible {
  outline: 2px solid rgba(255, 255, 255, 0.25);
  border-radius: 0.4rem;
}

.app-nav-chevron {
  font-size: 0.65rem;
  color: rgba(255, 255, 255, 0.35);
  transition: transform 0.22s ease;
  flex-shrink: 0;
}

.app-nav-toggle.nav-closed .app-nav-chevron {
  transform: rotate(-90deg);
}

.app-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  overflow: hidden;
  max-height: 600px;
  opacity: 1;
  transition: max-height 0.28s ease, opacity 0.2s ease;
}

.app-nav-links.nav-closed {
  max-height: 0;
  opacity: 0;
}

.app-nav-link {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  padding: 0.8rem 0.9rem;
  border-radius: 0.9rem;
  color: var(--app-sidebar-text);
  transition: 0.18s ease;
}

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

.app-nav-link.active {
  color: #fff;
  background: linear-gradient(90deg, var(--app-primary), #3d9460);
  box-shadow: 0 8px 20px rgba(45, 122, 79, 0.28);
}

.app-nav-link-danger {
  color: #ffb1b1;
}

.app-main {
  margin-left: var(--sidebar-width);
  min-height: 100vh;
}

.app-topbar {
  position: sticky;
  top: 0;
  z-index: 20;
  height: var(--topbar-height);
  padding: 0 1.5rem;
  background: rgba(255, 255, 255, 0.88);
  backdrop-filter: blur(18px);
  border-bottom: 1px solid var(--app-panel-border);
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.app-sidebar-toggle {
  display: none;
  flex-shrink: 0;
}

.app-search {
  min-width: min(34rem, 52vw);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: #fff;
  border: 1px solid var(--app-panel-border);
  border-radius: 0.85rem;
  padding: 0.85rem 1rem;
  box-shadow: var(--app-shadow);
}

.app-search input {
  border: 0;
  background: transparent;
  width: 100%;
  color: var(--app-muted);
  font-size: 0.95rem;
}

.app-search input:focus {
  outline: 0;
}

.app-icon-btn {
  width: 2.5rem;
  height: 2.5rem;
  border: 1px solid var(--app-panel-border);
  background: #fff;
  border-radius: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  color: var(--app-muted);
  box-shadow: var(--app-shadow);
}

.app-user-chip {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.app-user-chip strong,
.app-user-chip small {
  display: block;
}

.app-user-chip small {
  color: var(--app-muted);
}

.app-user-avatar {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a3a2a, #3d6b4f);
  color: #fff;
  font-weight: 700;
}

.app-user-chip-btn {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: none;
  border: none;
  padding: 0.25rem 0.4rem;
  border-radius: 0.9rem;
  cursor: pointer;
  transition: background 0.15s ease;
}

.app-user-chip-btn:hover {
  background: rgba(0, 0, 0, 0.04);
}

.app-user-chip-btn strong,
.app-user-chip-btn small {
  display: block;
  text-align: left;
}

.app-user-chip-btn small {
  color: var(--app-muted);
}

.app-user-chevron {
  font-size: 0.7rem;
  color: var(--app-muted);
  margin-left: 0.1rem;
  transition: transform 0.2s ease;
}

.app-user-chip-btn[aria-expanded="true"] .app-user-chevron {
  transform: rotate(180deg);
}

.app-user-dropdown {
  min-width: 220px;
  border: 1px solid var(--app-panel-border);
  border-radius: 1rem;
  padding: 0.5rem;
  margin-top: 0.4rem;
}

.app-user-dropdown-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.6rem 0.75rem 0.75rem;
}

.app-user-dropdown-header strong {
  display: block;
  font-size: 0.9rem;
  color: var(--app-text);
}

.app-user-dropdown-header small {
  display: block;
  font-size: 0.78rem;
  color: var(--app-muted);
}

.app-user-avatar-lg {
  width: 2.8rem;
  height: 2.8rem;
  font-size: 1rem;
  flex-shrink: 0;
}

.app-user-dropdown .dropdown-item {
  border-radius: 0.65rem;
  padding: 0.55rem 0.8rem;
  font-size: 0.9rem;
  color: var(--app-text);
  display: flex;
  align-items: center;
  gap: 0.6rem;
}

.app-user-dropdown .dropdown-item:hover {
  background: var(--app-primary-soft);
  color: var(--app-primary);
}

.app-user-dropdown .dropdown-item i {
  font-size: 1rem;
  width: 1.2rem;
  text-align: center;
}

.app-user-dropdown-logout {
  color: #c0392b !important;
}

.app-user-dropdown-logout:hover {
  background: #fdecea !important;
  color: #c0392b !important;
}

.app-alerts,
.app-content {
  padding-left: 1.5rem;
  padding-right: 1.5rem;
}

.app-alerts {
  padding-top: 1rem;
}

.app-content {
  padding-top: 1.25rem;
  padding-bottom: 2rem;
}

.app-breadcrumb {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  color: var(--app-muted);
  font-size: 0.92rem;
  margin-bottom: 1rem;
}

.card,
.app-panel {
  border: 1px solid var(--app-panel-border);
  border-radius: 1.15rem;
  box-shadow: var(--app-shadow);
  background: var(--app-panel);
}

.metric-card {
  height: 100%;
  padding: 1.1rem 1.15rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
}

.metric-card .d-flex {
  height: 100%;
}

.metric-card .metric-icon {
  width: 3rem;
  height: 3rem;
  border-radius: 0.9rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 1.15rem;
}

.metric-card .metric-label {
  color: var(--app-muted);
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 0.5rem;
}

.metric-card .metric-value {
  font-size: 2rem;
  font-weight: 700;
  line-height: 1;
  margin-bottom: 0.4rem;
}

.metric-card .metric-note {
  color: var(--app-muted);
  font-size: 0.88rem;
}

.metric-primary .metric-icon { background: var(--app-primary-soft); color: var(--app-primary); }
.metric-success .metric-icon { background: var(--app-success-soft); color: #2f9f65; }
.metric-warning .metric-icon { background: var(--app-warning-soft); color: #d39400; }
.metric-info .metric-icon { background: var(--app-info-soft); color: #169ad9; }

.panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1.2rem 1.25rem 0;
}

.panel-body {
  padding: 1.1rem 1.25rem 1.25rem;
}

.panel-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
}

.panel-subtitle {
  margin: 0.15rem 0 0;
  color: var(--app-muted);
  font-size: 0.9rem;
}

.soft-chart {
  min-height: 20rem;
  border-radius: 1rem;
  border: 1px solid var(--app-panel-border);
  background:
    linear-gradient(180deg, rgba(45, 122, 79, 0.04), transparent 30%),
    repeating-linear-gradient(to bottom, #fff 0, #fff 2.9rem, rgba(20, 60, 35, 0.05) 2.9rem, rgba(20, 60, 35, 0.05) 3rem);
  position: relative;
  overflow: hidden;
}

.soft-chart::after {
  content: "";
  position: absolute;
  inset: auto 2rem 3.2rem 2rem;
  height: 2px;
  background: linear-gradient(90deg, #2d7a4f, #2d7a4f);
  box-shadow: 140px 0 0 0 #2d7a4f, 280px 0 0 0 #2d7a4f, 420px 0 0 0 #2d7a4f, 560px 0 0 0 #2d7a4f;
}

.soft-chart .chart-note {
  position: absolute;
  right: 1rem;
  top: 1rem;
  display: flex;
  gap: 0.4rem;
}

.soft-chart .chart-note span {
  border: 1px solid var(--app-panel-border);
  background: #fff;
  color: var(--app-muted);
  border-radius: 0.55rem;
  padding: 0.2rem 0.55rem;
  font-size: 0.78rem;
}

.chart-tab-btn {
  border: 1px solid var(--app-panel-border);
  background: #fff;
  color: var(--app-muted);
  border-radius: 0.55rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: 0.15s ease;
}

.chart-tab-btn:hover {
  background: var(--app-primary-soft);
  color: var(--app-primary);
  border-color: var(--app-primary-soft);
}

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

.app-list {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.app-list-item {
  display: flex;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.05rem;
  border: 1px solid var(--app-panel-border);
  border-radius: 0.95rem;
  background: #fbfcfe;
  color: var(--app-text);
}

.app-list-item small {
  color: var(--app-muted);
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  border-radius: 999px;
  padding: 0.35rem 0.7rem;
  background: var(--app-primary-soft);
  color: var(--app-primary);
  font-size: 0.78rem;
  font-weight: 700;
}

.quick-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.quick-card {
  display: flex;
  align-items: center;
  gap: 0.9rem;
  padding: 1.1rem;
  border-radius: 1rem;
  border: 1px solid var(--app-panel-border);
  background: #fff;
  color: var(--app-text);
  box-shadow: var(--app-shadow);
}

.quick-card i {
  width: 2.7rem;
  height: 2.7rem;
  border-radius: 0.8rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--app-primary-soft);
  color: var(--app-primary);
}

/* ─── Seasonal Card ───────────────────────────────────────────────────── */
.season-card {
  border-radius: 1.4rem;
  overflow: hidden;
  position: relative;
  min-height: 24rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--app-shadow);
}

/* Sky backgrounds per season */
.season-harvest .sc-sky  { background: linear-gradient(180deg, #f4a14a 0%, #f7c97e 55%, #ffe5a0 100%); }
.season-prep     .sc-sky { background: linear-gradient(180deg, #5ab4e0 0%, #a8daf5 55%, #d6eefc 100%); }
.season-early_wet .sc-sky { background: linear-gradient(180deg, #4a90a4 0%, #82c9b0 55%, #c2e8d8 100%); }
.season-late_wet  .sc-sky { background: linear-gradient(180deg, #607d8b 0%, #8fa8b4 55%, #c5d8e0 100%); }

.sc-sky {
  position: relative;
  flex: 1;
  min-height: 16rem;
  overflow: hidden;
}

/* Sun */
.sc-sun {
  position: absolute;
  top: 1.6rem;
  right: 2.5rem;
  width: 4.5rem;
  height: 4.5rem;
  border-radius: 50%;
  animation: sc-pulse 4s ease-in-out infinite;
}
.season-harvest  .sc-sun { background: radial-gradient(circle, #ffe066, #ff9f1c); box-shadow: 0 0 40px 12px rgba(255,180,30,0.45); }
.season-prep     .sc-sun { background: radial-gradient(circle, #fff6a0, #ffd700); box-shadow: 0 0 50px 16px rgba(255,215,0,0.35); }
.season-early_wet .sc-sun { background: radial-gradient(circle, #fffde0, #f0c040); box-shadow: 0 0 30px 8px rgba(240,192,64,0.25); opacity: 0.75; }
.season-late_wet  .sc-sun { opacity: 0; }

@keyframes sc-pulse {
  0%, 100% { transform: scale(1); }
  50%       { transform: scale(1.06); }
}

/* Clouds */
.sc-cloud {
  position: absolute;
  border-radius: 999px;
  animation: sc-float linear infinite;
}
.sc-cloud::before, .sc-cloud::after {
  content: "";
  position: absolute;
  border-radius: 50%;
}

.season-harvest .sc-cloud, .season-prep .sc-cloud {
  background: rgba(255,255,255,0.85);
}
.season-early_wet .sc-cloud, .season-late_wet .sc-cloud {
  background: rgba(200,220,230,0.9);
}

.sc-cloud-1 { width: 7rem; height: 2.2rem; top: 2.8rem; left: -8rem; animation-duration: 22s; animation-delay: 0s; }
.sc-cloud-1::before { width: 3rem; height: 3rem; background: inherit; top: -1.4rem; left: 1rem; }
.sc-cloud-1::after  { width: 2rem; height: 2rem; background: inherit; top: -0.9rem; left: 3.5rem; }

.sc-cloud-2 { width: 5rem; height: 1.6rem; top: 4.5rem; left: -6rem; animation-duration: 30s; animation-delay: -10s; opacity: 0.7; }
.sc-cloud-2::before { width: 2.2rem; height: 2.2rem; background: inherit; top: -1rem; left: 0.8rem; }
.sc-cloud-2::after  { width: 1.6rem; height: 1.6rem; background: inherit; top: -0.7rem; left: 2.8rem; }

@keyframes sc-float {
  from { transform: translateX(0); }
  to   { transform: translateX(calc(100vw + 12rem)); }
}

/* Rain (wet seasons only) */
.sc-rain {
  position: absolute;
  inset: 0;
  pointer-events: none;
}
.sc-rain span {
  position: absolute;
  top: -1.5rem;
  width: 2px;
  border-radius: 2px;
  animation: sc-rain-fall linear infinite;
}
.season-early_wet .sc-rain span { background: rgba(120,180,220,0.55); }
.season-late_wet  .sc-rain span { background: rgba(90,140,180,0.65); }

/* Stagger 18 rain drops */
.sc-rain span:nth-child(1)  { left:5%;   height:1.2rem; animation-duration:1.1s; animation-delay:0s;    }
.sc-rain span:nth-child(2)  { left:10%;  height:0.9rem; animation-duration:0.9s; animation-delay:0.3s;  }
.sc-rain span:nth-child(3)  { left:17%;  height:1.4rem; animation-duration:1.3s; animation-delay:0.1s;  }
.sc-rain span:nth-child(4)  { left:24%;  height:1.0rem; animation-duration:1.0s; animation-delay:0.7s;  }
.sc-rain span:nth-child(5)  { left:31%;  height:1.3rem; animation-duration:1.2s; animation-delay:0.2s;  }
.sc-rain span:nth-child(6)  { left:38%;  height:0.8rem; animation-duration:0.8s; animation-delay:0.5s;  }
.sc-rain span:nth-child(7)  { left:45%;  height:1.5rem; animation-duration:1.4s; animation-delay:0.0s;  }
.sc-rain span:nth-child(8)  { left:52%;  height:1.1rem; animation-duration:1.0s; animation-delay:0.4s;  }
.sc-rain span:nth-child(9)  { left:59%;  height:0.9rem; animation-duration:0.9s; animation-delay:0.6s;  }
.sc-rain span:nth-child(10) { left:65%;  height:1.3rem; animation-duration:1.2s; animation-delay:0.15s; }
.sc-rain span:nth-child(11) { left:71%;  height:1.0rem; animation-duration:1.1s; animation-delay:0.35s; }
.sc-rain span:nth-child(12) { left:77%;  height:1.4rem; animation-duration:1.3s; animation-delay:0.55s; }
.sc-rain span:nth-child(13) { left:83%;  height:0.8rem; animation-duration:0.85s; animation-delay:0.2s; }
.sc-rain span:nth-child(14) { left:89%;  height:1.2rem; animation-duration:1.05s; animation-delay:0.45s;}
.sc-rain span:nth-child(15) { left:94%;  height:1.0rem; animation-duration:0.95s; animation-delay:0.1s; }
.sc-rain span:nth-child(16) { left:13%;  height:1.1rem; animation-duration:1.15s; animation-delay:0.8s; }
.sc-rain span:nth-child(17) { left:56%;  height:0.7rem; animation-duration:0.75s; animation-delay:0.65s;}
.sc-rain span:nth-child(18) { left:42%;  height:1.3rem; animation-duration:1.25s; animation-delay:0.9s; }

@keyframes sc-rain-fall {
  from { transform: translateY(-2rem); opacity: 0; }
  20%  { opacity: 1; }
  to   { transform: translateY(20rem); opacity: 0; }
}

/* Ground */
.sc-ground {
  height: 6rem;
  position: relative;
  display: flex;
  align-items: flex-end;
}
.season-harvest   .sc-ground { background: linear-gradient(180deg, #c8a86b, #8b6914); }
.season-prep      .sc-ground { background: linear-gradient(180deg, #a0784a, #6b4c28); }
.season-early_wet .sc-ground { background: linear-gradient(180deg, #4a7c3f, #2d5a27); }
.season-late_wet  .sc-ground { background: linear-gradient(180deg, #3a6e32, #1e4a18); }

/* Crops */
.sc-crops {
  display: flex;
  align-items: flex-end;
  gap: 0.9rem;
  padding: 0 1.8rem 0.5rem;
  width: 100%;
}
.sc-crop {
  flex: 1;
  border-radius: 3px 3px 0 0;
  animation: sc-sway 3s ease-in-out infinite;
  transform-origin: bottom center;
}
.sc-crop:nth-child(even) { animation-delay: -1.5s; }
.sc-crop:nth-child(3n)   { animation-delay: -0.8s; }

.season-harvest   .sc-crop { height: 3.2rem; background: linear-gradient(180deg, #f5c842, #c8922a); }
.season-prep      .sc-crop { height: 1.2rem; background: linear-gradient(180deg, #6db35a, #3a7a28); }
.season-early_wet .sc-crop { height: 3.8rem; background: linear-gradient(180deg, #5dc95a, #2d7a2a); }
.season-late_wet  .sc-crop { height: 4.8rem; background: linear-gradient(180deg, #3aaa3a, #1a5a1a); }

@keyframes sc-sway {
  0%, 100% { transform: rotate(-2deg); }
  50%       { transform: rotate(2deg); }
}

/* ─── Moon Phase Widget ───────────────────────────────────────────────── */
.sc-moon-widget {
  position: absolute;
  top: 1rem;
  left: 1.25rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: rgba(0, 0, 0, 0.22);
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.18);
  border-radius: 999px;
  padding: 0.45rem 1rem 0.45rem 0.45rem;
  z-index: 5;
}

.sc-moon-body {
  width: 2.8rem;
  height: 2.8rem;
  border-radius: 50%;
  background: radial-gradient(circle at 35% 35%, #fffde4, #f0d060 50%, #c8a830);
  box-shadow:
    inset -4px -4px 10px rgba(0,0,0,0.25),
    0 0 14px rgba(255, 230, 80, 0.35);
  position: relative;
  overflow: hidden;
  animation: sc-moon-glow 5s ease-in-out infinite;
  flex-shrink: 0;
}

@keyframes sc-moon-glow {
  0%, 100% { box-shadow: inset -4px -4px 10px rgba(0,0,0,0.25), 0 0 14px rgba(255,230,80,0.35); }
  50%       { box-shadow: inset -4px -4px 10px rgba(0,0,0,0.25), 0 0 28px rgba(255,230,80,0.55); }
}

/* Shadow overlay — JS sets its transform based on cycle_pos */
.sc-moon-shadow {
  position: absolute;
  inset: 0;
  border-radius: 50%;
  background: rgba(15, 25, 45, 0.82);
  transform-origin: center;
  transition: transform 0.6s ease;
}

/* Craters / face features */
.sc-moon-eye {
  position: absolute;
  width: 0.38rem;
  height: 0.38rem;
  border-radius: 50%;
  background: rgba(180, 140, 20, 0.6);
  box-shadow: inset 1px 1px 2px rgba(0,0,0,0.3);
}
.sc-moon-eye-l { top: 38%; left: 28%; }
.sc-moon-eye-r { top: 34%; left: 55%; width: 0.28rem; height: 0.28rem; }

.sc-moon-smile {
  position: absolute;
  bottom: 30%;
  left: 28%;
  width: 1rem;
  height: 0.45rem;
  border-bottom: 2px solid rgba(180, 140, 20, 0.5);
  border-radius: 0 0 50% 50%;
}

.sc-moon-info {
  display: flex;
  flex-direction: column;
  gap: 0.05rem;
}
.sc-moon-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: #fff;
  line-height: 1.2;
}
.sc-moon-ill {
  font-size: 0.68rem;
  color: rgba(255, 230, 120, 0.9);
}
.sc-moon-tip {
  display: none; /* shown on hover via JS / kept for screen readers */
}

/* Info overlay */
.sc-info {
  position: absolute;
  bottom: 6.5rem;
  left: 1.25rem;
  right: 1.25rem;
  background: rgba(10, 30, 20, 0.48);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 1rem;
  padding: 0.9rem 1.1rem 1rem;
}
.sc-badge {
  display: inline-block;
  background: rgba(255, 255, 255, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 999px;
  padding: 0.2rem 0.8rem;
  font-size: 0.72rem;
  font-weight: 700;
  color: rgba(255, 255, 255, 0.92);
  letter-spacing: 0.06em;
  text-transform: uppercase;
  margin-bottom: 0.5rem;
}
.sc-title {
  font-size: 1.5rem;
  font-weight: 800;
  color: #ffffff;
  text-shadow: 0 1px 4px rgba(0, 0, 0, 0.4);
  margin-bottom: 0.35rem;
  line-height: 1.2;
}
.sc-tip {
  font-size: 0.86rem;
  color: rgba(255, 255, 255, 0.9);
  text-shadow: none;
  margin: 0;
  max-width: 28rem;
  line-height: 1.5;
}

.login-shell {
  min-height: calc(100vh - 80px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem 1rem;
  background:
    radial-gradient(circle at top left, rgba(45, 122, 79, 0.12), transparent 28rem),
    radial-gradient(circle at bottom right, rgba(90, 170, 122, 0.08), transparent 24rem),
    linear-gradient(180deg, #f0f8f3 0%, #f4f9f4 100%);
}

.login-wrap {
  width: 100%;
  max-width: 420px;
}

.login-card {
  background: #fff;
  border: 1px solid var(--app-panel-border);
  border-radius: 1.4rem;
  padding: 2.25rem 2rem;
  box-shadow: 0 20px 60px rgba(20, 34, 66, 0.1);
}

.login-brand {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  margin-bottom: 1.75rem;
}

.login-brand strong {
  display: block;
  font-size: 1rem;
  color: var(--app-text);
}

.login-brand small {
  display: block;
  color: var(--app-muted);
  font-size: 0.78rem;
}

.login-title {
  font-size: 1.45rem;
  font-weight: 700;
  margin-bottom: 0.35rem;
}

.login-sub {
  color: var(--app-muted);
  margin-bottom: 1.5rem;
  font-size: 0.95rem;
}

.public-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid rgba(24, 39, 75, 0.08);
  background: rgba(255, 255, 255, 0.92);
  backdrop-filter: blur(14px);
}

.public-brand {
  color: var(--app-text);
}

.public-brand small {
  color: var(--app-muted);
}

.public-links {
  display: flex;
  align-items: center;
  gap: 1rem;
}

.public-links a {
  color: var(--app-text);
  font-weight: 600;
}

.public-main {
  min-height: calc(100vh - 80px);
}

.public-footer {
  border-top: 1px solid var(--app-panel-border);
  padding: 1.1rem 0;
  background: var(--app-panel);
}

.public-footer-inner {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--app-muted);
}

.public-footer-divider {
  color: var(--app-panel-border);
}

.public-footer-link {
  color: var(--app-primary);
  font-weight: 600;
}

.public-footer-link:hover {
  text-decoration: underline;
}

.license-body {
  font-size: 0.9rem;
  line-height: 1.7;
  color: var(--app-text);
}

.license-body ol {
  padding-left: 1.25rem;
}

#farm-map {
  height: 480px;
  border-radius: 1rem;
  border: 1px solid var(--app-panel-border);
}

.table-responsive-auto {
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
}

.plot-card {
  border-left: 4px solid var(--app-primary);
}

.harvest-chip {
  display: inline-block;
  background: var(--app-success-soft);
  color: #0e6b42;
  border-radius: 999px;
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  font-weight: 700;
}

@media (max-width: 1199.98px) {
  .quick-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 991.98px) {
  .app-sidebar {
    transform: translateX(-100%);
    transition: transform 0.22s ease;
    z-index: 1040;
  }

  .app-sidebar.sidebar-open {
    transform: translateX(0);
  }

  .app-sidebar-toggle {
    display: inline-flex;
  }

  .app-main {
    margin-left: 0;
  }

  .app-topbar {
    padding: 0 1rem;
  }

  .app-search {
    min-width: 0;
    width: 100%;
  }
}

.sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  z-index: 1039;
}

.sidebar-backdrop.show {
  display: block;
}

@media (max-width: 767.98px) {
  .app-content,
  .app-alerts {
    padding-left: 1rem;
    padding-right: 1rem;
  }

  .quick-grid {
    grid-template-columns: 1fr;
  }

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

  .public-links {
    width: 100%;
    justify-content: space-between;
  }
}

/* ─── AI Chat Assistant (Caci) ───────────────────────────────────────────────── */

.caci-panel {
  max-width: 860px;
}

.caci-log {
  min-height: 28rem;
  max-height: 56vh;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  scroll-behavior: smooth;
}

.chat-message {
  display: flex;
  align-items: flex-end;
  gap: 0.6rem;
}

.chat-message-user      { flex-direction: row-reverse; }
.chat-message-assistant { flex-direction: row; }

.chat-bubble {
  max-width: 72%;
  padding: 0.7rem 1rem;
  border-radius: 1.1rem;
  font-size: 0.94rem;
  line-height: 1.55;
  word-break: break-word;
}

.chat-bubble-user {
  background: var(--app-primary);
  color: #fff;
  border-bottom-right-radius: 0.2rem;
}

.chat-bubble-assistant {
  background: var(--app-primary-soft);
  color: var(--app-text);
  border: 1px solid var(--app-panel-border);
  border-bottom-left-radius: 0.2rem;
}

.chat-bubble-error {
  background: #fff3cd;
  color: #664d03;
  border: 1px solid #ffecb5;
  border-bottom-left-radius: 0.2rem;
}

.chat-avatar {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.82rem;
  font-weight: 700;
  flex-shrink: 0;
}

.chat-avatar-user {
  background: var(--app-primary);
  color: #fff;
}

.chat-avatar-assistant {
  background: var(--app-primary-soft);
  color: var(--app-primary);
  border: 1px solid var(--app-panel-border);
}

.chat-avatar-error {
  background: #fff3cd;
  color: #997404;
  border: 1px solid #ffecb5;
}

.caci-input-bar {
  background: #fafcfa;
  border-radius: 0 0 1.15rem 1.15rem;
}

/* Typing dots animation */
.typing-dot {
  display: inline-block;
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--app-muted);
  margin: 0 2px;
  animation: caci-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.2s; }
.typing-dot:nth-child(3) { animation-delay: 0.4s; }

@keyframes caci-bounce {
  0%, 80%, 100% { transform: translateY(0);   opacity: 0.4; }
  40%           { transform: translateY(-6px); opacity: 1;   }
}
