:root {
  --primary: #2e7d32;
  --primary-light: #4caf50;
  --primary-dark: #1b5e20;
  --secondary: #00695c;
  --accent: #ff8f00;
  --success: #43a047;
  --warning: #fbc02d;
  --error: #e53935;
  --info: #1e88e5;
  --neutral-50: #fafafa;
  --neutral-100: #f5f5f5;
  --neutral-200: #eeeeee;
  --neutral-300: #e0e0e0;
  --neutral-400: #bdbdbd;
  --neutral-500: #9e9e9e;
  --neutral-600: #757575;
  --neutral-700: #616161;
  --neutral-800: #424242;
  --neutral-900: #212121;
  --white: #ffffff;
  --sidebar-w: 260px;
  --header-h: 64px;
  --radius: 12px;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.08);
  --shadow-md: 0 4px 12px rgba(0,0,0,0.1);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  font-family: 'Inter', system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  line-height: 1.5;
  color: var(--neutral-800);
  background-color: var(--neutral-100);
}

* { box-sizing: border-box; margin: 0; padding: 0; }

body { overflow-x: hidden; }

/* ===== Sidebar ===== */
.sidebar {
  position: fixed;
  top: 0; left: 0;
  width: var(--sidebar-w);
  height: 100vh;
  background: linear-gradient(180deg, var(--primary-dark) 0%, var(--primary) 100%);
  color: var(--white);
  display: flex;
  flex-direction: column;
  z-index: 1000;
  transition: transform var(--transition);
  overflow-y: auto;
}

.sidebar-header {
  padding: 20px 16px;
  text-align: center;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}

.sidebar-header .logo {
  width: 56px; height: 56px;
  margin: 0 auto 8px;
  background: rgba(255,255,255,0.15);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
}

.sidebar-header h2 {
  font-size: 15px;
  font-weight: 600;
  line-height: 1.3;
}

.sidebar-header p {
  font-size: 11px;
  opacity: 0.7;
  margin-top: 4px;
}

.nav-menu {
  list-style: none;
  padding: 8px 0;
  flex: 1;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 20px;
  cursor: pointer;
  transition: background var(--transition);
  font-size: 14px;
  font-weight: 500;
  color: rgba(255,255,255,0.8);
  border-left: 3px solid transparent;
}

.nav-item:hover {
  background: rgba(255,255,255,0.1);
  color: var(--white);
}

.nav-item.active {
  background: rgba(255,255,255,0.15);
  color: var(--white);
  border-left-color: var(--accent);
}

.nav-item i { width: 20px; text-align: center; font-size: 16px; }

.sidebar-footer {
  padding: 12px 16px;
  border-top: 1px solid rgba(255,255,255,0.12);
  font-size: 11px;
  opacity: 0.6;
  text-align: center;
}

/* ===== Main Layout ===== */
.main-content {
  margin-left: var(--sidebar-w);
  min-height: 100vh;
  transition: margin var(--transition);
}

/* ===== Header ===== */
.header {
  position: sticky;
  top: 0;
  height: var(--header-h);
  background: var(--white);
  display: flex;
  align-items: center;
  padding: 0 24px;
  box-shadow: var(--shadow-sm);
  z-index: 100;
  gap: 16px;
}

.header .menu-toggle {
  display: none;
  font-size: 22px;
  cursor: pointer;
  color: var(--neutral-700);
}

.header-title {
  font-size: 18px;
  font-weight: 600;
  color: var(--neutral-800);
  flex: 1;
}

.header .search-box {
  position: relative;
  width: 280px;
  max-width: 40vw;
}

.header .search-box input {
  width: 100%;
  padding: 8px 12px 8px 36px;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  transition: border var(--transition);
}

.header .search-box input:focus { border-color: var(--primary-light); }
.header .search-box i {
  position: absolute;
  left: 12px; top: 50%;
  transform: translateY(-50%);
  color: var(--neutral-400);
  font-size: 14px;
}

.header .user-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 14px;
  background: var(--neutral-100);
  border-radius: 20px;
  font-size: 13px;
  font-weight: 500;
}

.header .user-badge i { color: var(--primary); }

/* ===== Page Content ===== */
.page-content { padding: 24px; }

.page { display: none; }
.page.active { display: block; animation: fadeIn 0.3s ease; }

@keyframes fadeIn {
  from { opacity: 0; transform: translateY(8px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ===== Cards / Stats ===== */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 16px;
  margin-bottom: 24px;
}

.stat-card {
  background: var(--white);
  border-radius: var(--radius);
  padding: 20px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  gap: 16px;
  transition: box-shadow var(--transition), transform var(--transition);
}

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

.stat-card .stat-icon {
  width: 52px; height: 52px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  flex-shrink: 0;
}

.stat-card .stat-info h3 {
  font-size: 28px;
  font-weight: 700;
  color: var(--neutral-900);
  line-height: 1.1;
}

.stat-card .stat-info p {
  font-size: 12px;
  color: var(--neutral-600);
  margin-top: 2px;
}

.bg-green { background: #e8f5e9; color: var(--primary); }
.bg-teal { background: #e0f2f1; color: var(--secondary); }
.bg-amber { background: #fff8e1; color: var(--accent); }
.bg-blue { background: #e3f2fd; color: var(--info); }
.bg-red { background: #ffebee; color: var(--error); }
.bg-purple { background: #f3e5f5; color: #8e24aa; }

/* ===== Panel ===== */
.panel {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  margin-bottom: 20px;
  overflow: hidden;
}

.panel-header {
  padding: 16px 20px;
  border-bottom: 1px solid var(--neutral-200);
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
}

.panel-header h3 {
  font-size: 16px;
  font-weight: 600;
  color: var(--neutral-800);
  display: flex;
  align-items: center;
  gap: 8px;
}

.panel-header h3 i { color: var(--primary); }

.panel-body { padding: 20px; }

.panel-body.no-pad { padding: 0; }

/* ===== Charts ===== */
.charts-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 20px;
  margin-bottom: 20px;
}

.chart-container { position: relative; height: 280px; }

/* ===== Table ===== */
.table-wrap { overflow-x: auto; }

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

table thead th {
  background: var(--neutral-100);
  padding: 12px 14px;
  text-align: left;
  font-weight: 600;
  color: var(--neutral-700);
  white-space: nowrap;
  border-bottom: 2px solid var(--neutral-200);
}

table tbody td {
  padding: 10px 14px;
  border-bottom: 1px solid var(--neutral-200);
  color: var(--neutral-700);
  white-space: nowrap;
}

table tbody tr { transition: background var(--transition); }
table tbody tr:hover { background: var(--neutral-50); }

table tbody tr.clickable { cursor: pointer; }

/* ===== Badges ===== */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}

.badge-green { background: #e8f5e9; color: var(--primary-dark); }
.badge-amber { background: #fff8e1; color: #e65100; }
.badge-blue { background: #e3f2fd; color: #1565c0; }
.badge-red { background: #ffebee; color: #c62828; }
.badge-grey { background: var(--neutral-200); color: var(--neutral-600); }
.badge-teal { background: #e0f2f1; color: var(--secondary); }

/* ===== Buttons ===== */
.btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border: none;
  border-radius: 8px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: all var(--transition);
  font-family: inherit;
}

.btn-primary { background: var(--primary); color: var(--white); }
.btn-primary:hover { background: var(--primary-dark); }

.btn-outline {
  background: transparent;
  border: 1px solid var(--neutral-300);
  color: var(--neutral-700);
}
.btn-outline:hover { border-color: var(--primary); color: var(--primary); }

.btn-sm { padding: 5px 10px; font-size: 12px; }

/* ===== Filters ===== */
.filters-row {
  display: flex;
  gap: 12px;
  flex-wrap: wrap;
  margin-bottom: 16px;
}

.filter-group { flex: 1; min-width: 140px; }

.filter-group label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--neutral-600);
  margin-bottom: 4px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.filter-group select,
.filter-group input {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border var(--transition);
}

.filter-group select:focus,
.filter-group input:focus { border-color: var(--primary-light); }

/* ===== LGA Grid ===== */
.lga-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
  gap: 12px;
}

.lga-card {
  background: var(--white);
  border: 1px solid var(--neutral-200);
  border-radius: var(--radius);
  padding: 16px;
  cursor: pointer;
  transition: all var(--transition);
  text-align: center;
}

.lga-card:hover {
  border-color: var(--primary-light);
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.lga-card .lga-icon {
  width: 40px; height: 40px;
  margin: 0 auto 8px;
  background: #e8f5e9;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--primary);
  font-size: 18px;
}

.lga-card h4 { font-size: 14px; font-weight: 600; color: var(--neutral-800); }
.lga-card .lga-count { font-size: 22px; font-weight: 700; color: var(--primary); margin-top: 4px; }
.lga-card .lga-label { font-size: 11px; color: var(--neutral-500); }

/* ===== Commodity Cards ===== */
.commodity-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
  gap: 16px;
}

.commodity-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
}

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

.commodity-card .com-header {
  padding: 20px;
  color: var(--white);
  display: flex;
  align-items: center;
  gap: 12px;
}

.commodity-card .com-header i { font-size: 32px; }
.commodity-card .com-header h4 { font-size: 18px; font-weight: 600; }

.commodity-card .com-body { padding: 16px 20px; }

.commodity-card .com-stat {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--neutral-200);
  font-size: 13px;
}

.commodity-card .com-stat:last-child { border-bottom: none; }
.commodity-card .com-stat span:first-child { color: var(--neutral-600); }
.commodity-card .com-stat span:last-child { font-weight: 600; color: var(--neutral-800); }

/* ===== Modal / Farmer Detail ===== */
.modal-overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.5);
  z-index: 2000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.modal-overlay.active { display: flex; animation: fadeIn 0.2s ease; }

.modal {
  background: var(--white);
  border-radius: var(--radius);
  width: 100%;
  max-width: 700px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
}

.modal-header {
  padding: 20px 24px;
  background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%);
  color: var(--white);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 10;
}

.modal-header h3 { font-size: 18px; font-weight: 600; }
.modal-header .close-btn {
  background: rgba(255,255,255,0.2);
  border: none;
  color: var(--white);
  width: 32px; height: 32px;
  border-radius: 50%;
  cursor: pointer;
  font-size: 16px;
  transition: background var(--transition);
}
.modal-header .close-btn:hover { background: rgba(255,255,255,0.3); }

.modal-body { padding: 24px; }

.detail-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.detail-item {
  padding: 10px 0;
  border-bottom: 1px solid var(--neutral-200);
}

.detail-item label {
  display: block;
  font-size: 11px;
  font-weight: 600;
  color: var(--neutral-500);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 2px;
}

.detail-item span {
  font-size: 14px;
  color: var(--neutral-800);
  font-weight: 500;
}

.detail-section-title {
  font-size: 14px;
  font-weight: 600;
  color: var(--primary-dark);
  margin: 20px 0 8px;
  padding-bottom: 6px;
  border-bottom: 2px solid var(--primary-light);
  display: flex;
  align-items: center;
  gap: 8px;
}

/* ===== Pagination ===== */
.pagination {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  margin-top: 16px;
  flex-wrap: wrap;
}

.pagination button {
  padding: 6px 12px;
  border: 1px solid var(--neutral-300);
  background: var(--white);
  border-radius: 6px;
  cursor: pointer;
  font-size: 13px;
  color: var(--neutral-700);
  transition: all var(--transition);
}

.pagination button:hover { border-color: var(--primary); color: var(--primary); }
.pagination button.active { background: var(--primary); color: var(--white); border-color: var(--primary); }
.pagination button:disabled { opacity: 0.4; cursor: not-allowed; }

/* ===== Misc ===== */
.empty-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--neutral-500);
}

.empty-state i { font-size: 48px; margin-bottom: 12px; opacity: 0.3; }
.empty-state p { font-size: 14px; }

.loading-state {
  text-align: center;
  padding: 48px 20px;
  color: var(--neutral-500);
}

.loading-state i { font-size: 32px; color: var(--primary); margin-bottom: 12px; }

.result-count {
  font-size: 13px;
  color: var(--neutral-600);
  margin-bottom: 12px;
}

.result-count strong { color: var(--primary); }

.quick-actions {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-bottom: 20px;
}

.quick-action-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 14px;
  background: var(--white);
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all var(--transition);
  color: var(--neutral-700);
}

.quick-action-btn:hover { border-color: var(--primary); color: var(--primary); }
.quick-action-btn.active { background: var(--primary); color: var(--white); border-color: var(--primary); }

/* ===== Mobile ===== */
.overlay {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0,0,0,0.4);
  z-index: 999;
  display: none;
}

.overlay.active { display: block; }

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

@media (max-width: 768px) {
  :root { --sidebar-w: 240px; }

  .sidebar { transform: translateX(-100%); }
  .sidebar.open { transform: translateX(0); }
  .main-content { margin-left: 0; }

  .header .menu-toggle { display: block; }
  .header .search-box { width: 200px; }
  .header .user-badge { display: none; }

  .page-content { padding: 16px; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); gap: 10px; }
  .stat-card { padding: 14px; }
  .stat-card .stat-icon { width: 40px; height: 40px; font-size: 18px; }
  .stat-card .stat-info h3 { font-size: 22px; }

  .detail-grid { grid-template-columns: 1fr; }
  .panel-header { padding: 14px 16px; }
  .panel-body { padding: 16px; }

  .filters-row { flex-direction: column; }
  .filter-group { min-width: 100%; }

  .header-title { font-size: 16px; }
  .header { padding: 0 12px; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .header .search-box { display: none; }
  .header-title { font-size: 15px; }
  .lga-grid { grid-template-columns: repeat(2, 1fr); }
  .commodity-grid { grid-template-columns: 1fr; }
  .officer-grid { grid-template-columns: 1fr; }
  .news-grid { grid-template-columns: 1fr; }
  .price-ticker-track { animation-duration: 20s !important; }
}

/* ===== Officer Cards ===== */
.officer-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 16px;
}

.officer-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  padding: 20px;
  transition: all var(--transition);
  cursor: pointer;
  border-left: 4px solid var(--primary);
}

.officer-card:hover { box-shadow: var(--shadow-md); transform: translateY(-2px); }
.officer-card.inactive { border-left-color: var(--neutral-400); opacity: 0.75; }

.officer-card .officer-top {
  display: flex;
  align-items: center;
  gap: 14px;
  margin-bottom: 14px;
}

.officer-avatar {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary), var(--primary-dark));
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--white);
  font-size: 20px;
  flex-shrink: 0;
}

.officer-card h4 { font-size: 15px; font-weight: 600; color: var(--neutral-900); }
.officer-card .officer-role { font-size: 12px; color: var(--neutral-500); margin-top: 2px; }

.officer-card .officer-info {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
  font-size: 12px;
}

.officer-info-item { display: flex; align-items: center; gap: 6px; color: var(--neutral-600); }
.officer-info-item i { color: var(--primary); font-size: 12px; width: 14px; text-align: center; }

/* ===== Market Price Ticker ===== */
.price-ticker {
  background: linear-gradient(135deg, var(--primary-dark) 0%, var(--secondary) 100%);
  border-radius: var(--radius);
  padding: 12px 20px;
  margin-bottom: 20px;
  overflow: hidden;
  position: relative;
}

.price-ticker-label {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  display: flex;
  align-items: center;
  padding: 0 16px;
  background: rgba(0,0,0,0.2);
  color: var(--white);
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  z-index: 2;
  gap: 6px;
}

.price-ticker-track {
  display: flex;
  gap: 40px;
  white-space: nowrap;
  animation: tickerScroll 30s linear infinite;
  padding-left: 140px;
}

@keyframes tickerScroll {
  0% { transform: translateX(0); }
  100% { transform: translateX(-50%); }
}

.ticker-item {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: var(--white);
  font-size: 13px;
}

.ticker-item .ticker-commodity { font-weight: 600; }
.ticker-item .ticker-price { opacity: 0.9; }
.ticker-item .ticker-change-up { color: #81c784; font-size: 11px; }
.ticker-item .ticker-change-down { color: #e57373; font-size: 11px; }

/* ===== Price Table ===== */
.price-up { color: var(--success); font-weight: 600; }
.price-down { color: var(--error); font-weight: 600; }
.price-flat { color: var(--neutral-500); font-weight: 600; }

/* ===== News Cards ===== */
.news-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(340px, 1fr));
  gap: 16px;
}

.news-card {
  background: var(--white);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
  overflow: hidden;
  transition: all var(--transition);
  cursor: pointer;
  display: flex;
  flex-direction: column;
}

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

.news-card .news-banner {
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 13px;
  font-weight: 600;
}

.news-banner.high { background: linear-gradient(135deg, #e53935 0%, #c62828 100%); color: var(--white); }
.news-banner.normal { background: linear-gradient(135deg, var(--primary) 0%, var(--primary-dark) 100%); color: var(--white); }
.news-banner.low { background: var(--neutral-200); color: var(--neutral-700); }

.news-banner i { font-size: 18px; }

.news-card .news-body { padding: 16px 20px; flex: 1; }
.news-card h4 { font-size: 15px; font-weight: 600; color: var(--neutral-900); margin-bottom: 8px; line-height: 1.4; }
.news-card .news-summary { font-size: 13px; color: var(--neutral-600); line-height: 1.5; margin-bottom: 12px; }

.news-card .news-meta {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 11px;
  color: var(--neutral-500);
  border-top: 1px solid var(--neutral-200);
  padding-top: 12px;
}

.news-card .news-meta .news-cat {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 2px 8px;
  border-radius: 12px;
  background: var(--neutral-100);
  color: var(--neutral-700);
  font-weight: 500;
}

/* ===== Add Form ===== */
.add-form {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 16px;
}

.form-field { display: flex; flex-direction: column; gap: 4px; }
.form-field label {
  font-size: 11px;
  font-weight: 600;
  color: var(--neutral-600);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}
.form-field input,
.form-field select,
.form-field textarea {
  padding: 8px 12px;
  border: 1px solid var(--neutral-300);
  border-radius: 8px;
  font-size: 13px;
  outline: none;
  font-family: inherit;
  transition: border var(--transition);
}
.form-field input:focus,
.form-field select:focus,
.form-field textarea:focus { border-color: var(--primary-light); }
.form-field textarea { resize: vertical; min-height: 60px; }
.form-field.full { grid-column: 1 / -1; }
