/* =========================================================================
   NMF Waste Management — Shared Design System
   One stylesheet, linked by every template, so the whole app reads as one
   consistent product. Component class names match what each page's inline
   <script> already hooks into (sidebar, modal, flash, filter-select, etc.)
   so no HTML/JS had to change — this file only changes how things look.
   ========================================================================= */

/* ---------- Design tokens ---------- */
:root {
  /* Brand ramp (blue) */
  --brand-50:  #eaf2fd;
  --brand-100: #cde2fb;
  --brand-200: #9ec5f4;
  --brand-300: #6da7ec;
  --brand-400: #3987e5;
  --brand-500: #2a78d6;
  --brand-600: #256abf;
  --brand-700: #1c5cab;
  --brand-800: #184f95;
  --brand-900: #104281;
  --brand-950: #0d366b;

  /* Accent (aqua/emerald) */
  --accent-400: #22c59a;
  --accent-500: #1baf7a;
  --accent-600: #199e70;
  --accent-700: #14805a;

  /* Status (fixed, never themed) */
  --status-good: #0ca30c;
  --status-good-bg: #e4f7e4;
  --status-warning: #b9790a;
  --status-warning-bg: #fef3d9;
  --status-serious: #c1522c;
  --status-serious-bg: #fbe6dd;
  --status-critical: #d03b3b;
  --status-critical-bg: #fbe2e2;

  /* Categorical chart palette — fixed order, never cycled/reassigned */
  --chart-1: #2a78d6; /* blue */
  --chart-2: #1baf7a; /* aqua */
  --chart-3: #c98500; /* yellow (darkened for contrast) */
  --chart-4: #008300; /* green */
  --chart-5: #4a3aa7; /* violet */
  --chart-6: #e34948; /* red */
  --chart-7: #c85d84; /* magenta (darkened for contrast) */
  --chart-8: #eb6834; /* orange */

  /* Neutrals / surfaces */
  --page-bg: #f4f6f9;
  --surface: #ffffff;
  --surface-sunken: #f8fafc;
  --text-primary: #0f172a;
  --text-secondary: #52586b;
  --text-muted: #8a8f9e;
  --border: rgba(15, 23, 42, 0.09);
  --border-strong: rgba(15, 23, 42, 0.16);
  --gridline: #e7eaf0;

  /* Sidebar (dark shell, distinct from brand ramp for contrast) */
  --sidebar-bg-1: #0b1220;
  --sidebar-bg-2: #131c30;
  --sidebar-bg-3: #1a2547;
  --sidebar-text: #aab2c8;
  --sidebar-text-active: #ffffff;

  /* Elevation */
  --shadow-sm: 0 1px 2px rgba(15, 23, 42, 0.06);
  --shadow-md: 0 4px 16px rgba(15, 23, 42, 0.08);
  --shadow-lg: 0 12px 32px rgba(15, 23, 42, 0.14);

  /* Radii */
  --radius-sm: 8px;
  --radius-md: 12px;
  --radius-lg: 18px;
  --radius-pill: 999px;

  --font-sans: 'Inter', system-ui, -apple-system, "Segoe UI", sans-serif;
}

/* ---------- Reset & base ---------- */
* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: var(--font-sans);
  background:
    radial-gradient(60% 40% at 100% 0%, rgba(42, 120, 214, 0.06) 0%, rgba(42, 120, 214, 0) 60%),
    radial-gradient(50% 35% at 0% 100%, rgba(27, 175, 122, 0.05) 0%, rgba(27, 175, 122, 0) 60%),
    var(--page-bg);
  background-attachment: fixed;
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; }

/* ---------- App shell / layout ---------- */
.container {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: 84px;
  background:
    radial-gradient(120% 40% at 100% 0%, rgba(42, 120, 214, 0.35) 0%, rgba(42, 120, 214, 0) 60%),
    radial-gradient(100% 35% at 0% 100%, rgba(27, 175, 122, 0.3) 0%, rgba(27, 175, 122, 0) 60%),
    linear-gradient(180deg, var(--sidebar-bg-1) 0%, var(--sidebar-bg-3) 55%, var(--sidebar-bg-2) 100%);
  color: var(--sidebar-text);
  position: fixed;
  height: 100vh;
  overflow-y: auto;
  overflow-x: hidden;
  transition: width 0.28s cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 1000;
  scrollbar-width: thin;
  box-shadow: 4px 0 24px rgba(0, 0, 0, 0.25);
}

.sidebar:hover { width: 258px; }

.sidebar-header {
  text-align: center;
  padding: 26px 15px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  position: relative;
}

.logo {
  width: 44px;
  height: 44px;
  margin: 0 auto 12px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.logo img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  filter: drop-shadow(0 2px 6px rgba(0, 0, 0, 0.35));
}

.org-name {
  font-size: 0.92rem;
  font-weight: 700;
  color: #fff;
  margin-bottom: 4px;
  opacity: 0;
  transform: translateX(-16px);
  transition: all 0.28s ease;
  white-space: nowrap;
}

.dashboard-title {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--sidebar-text);
  opacity: 0;
  transform: translateX(-16px);
  transition: all 0.28s ease;
  white-space: nowrap;
}

.sidebar:hover .org-name,
.sidebar:hover .dashboard-title {
  opacity: 1;
  transform: translateX(0);
}

.sidebar-menu {
  list-style: none;
  padding: 14px 10px;
}

.menu-item { margin-bottom: 4px; }

.menu-link {
  display: flex;
  align-items: center;
  padding: 13px 12px;
  color: var(--sidebar-text);
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
  font-weight: 500;
  position: relative;
}

.menu-link:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
}

.menu-link.active {
  background: linear-gradient(135deg, var(--brand-600) 0%, var(--accent-500) 100%);
  color: #fff;
  box-shadow: var(--shadow-sm);
}

.menu-icon {
  font-size: 1.2rem;
  min-width: 22px;
  text-align: center;
}

.menu-text {
  margin-left: 14px;
  opacity: 0;
  transform: translateX(-16px);
  transition: all 0.28s ease;
  white-space: nowrap;
  font-size: 0.9rem;
}

.sidebar:hover .menu-text { opacity: 1; transform: translateX(0); }

.logout-section {
  margin-top: auto;
  padding: 16px 10px;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
}

.logout-link {
  display: flex;
  align-items: center;
  padding: 13px 12px;
  color: #f6a8a8;
  text-decoration: none;
  border-radius: var(--radius-sm);
  transition: all 0.2s ease;
}

.logout-link:hover { background: rgba(208, 59, 59, 0.14); color: #ffb4b4; }

.logout-text {
  margin-left: 14px;
  opacity: 0;
  transform: translateX(-16px);
  transition: all 0.28s ease;
  white-space: nowrap;
}

.sidebar:hover .logout-text { opacity: 1; transform: translateX(0); }

/* ---------- Main content ---------- */
.main-content {
  flex: 1;
  margin-left: 84px;
  padding: 32px;
  transition: margin-left 0.28s ease;
  min-height: 100vh;
}

.content-header {
  background:
    linear-gradient(120deg, rgba(42, 120, 214, 0.08) 0%, rgba(27, 175, 122, 0.05) 60%, rgba(255, 255, 255, 0) 100%),
    var(--surface);
  padding: 22px 28px;
  border-radius: var(--radius-md);
  margin-bottom: 26px;
  box-shadow: var(--shadow-sm);
  border-left: 4px solid var(--brand-500);
  animation: fade-up 0.35s ease both;
}

.page-title {
  font-size: 1.8rem;
  font-weight: 800;
  margin-bottom: 6px;
  letter-spacing: -0.01em;
  background: linear-gradient(90deg, var(--brand-800) 0%, var(--brand-400) 55%, var(--accent-500) 100%);
  -webkit-background-clip: text;
  background-clip: text;
  color: transparent;
}

.page-subtitle { color: var(--text-secondary); font-size: 0.95rem; }

/* ---------- Motion ---------- */
@keyframes fade-up {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ---------- Cards ---------- */
.content-grid { display: grid; gap: 24px; }

.card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-top: 3px solid var(--brand-400);
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  animation: fade-up 0.35s ease both;
}

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

/* Colorful card accents — fixed hue per entity, matches the stat-card/chart colors */
.card-accent-aqua   { border-top-color: var(--chart-2); }
.card-accent-violet { border-top-color: var(--chart-5); }
.card-accent-orange { border-top-color: var(--chart-8); }

.card-accent-aqua .card-icon   { background: linear-gradient(135deg, var(--accent-600) 0%, var(--accent-400) 100%); box-shadow: 0 6px 14px rgba(27, 175, 122, 0.35); }
.card-accent-violet .card-icon { background: linear-gradient(135deg, #3d2f8a 0%, #6f5cd6 100%); box-shadow: 0 6px 14px rgba(74, 58, 167, 0.35); }
.card-accent-orange .card-icon { background: linear-gradient(135deg, #c8501f 0%, var(--chart-8) 100%); box-shadow: 0 6px 14px rgba(235, 104, 52, 0.35); }

.card-header {
  display: flex;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gridline);
}

.card-icon {
  font-size: 1.15rem;
  color: #ffffff;
  margin-right: 12px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-400) 100%);
  box-shadow: 0 6px 14px rgba(42, 120, 214, 0.35);
  border-radius: var(--radius-sm);
}

.card-title { font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }

/* ---------- Stat tiles ---------- */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 18px;
  margin-bottom: 26px;
}

.stat-card {
  background: var(--surface);
  padding: 22px;
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-top: 4px solid var(--chart-1);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: fade-up 0.35s ease both;
}

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

.stat-icon {
  font-size: 1.3rem;
  margin-bottom: 14px;
  color: #ffffff;
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-400) 100%);
  box-shadow: 0 8px 18px rgba(42, 120, 214, 0.35);
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Colorful stat-card accents — one fixed hue per metric identity, never per rank */
.stat-card-blue   { border-top-color: var(--chart-1); }
.stat-card-aqua   { border-top-color: var(--chart-2); }
.stat-card-violet { border-top-color: var(--chart-5); }
.stat-card-orange { border-top-color: var(--chart-8); }

.stat-card-blue   .stat-icon { background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-400) 100%); box-shadow: 0 8px 18px rgba(42, 120, 214, 0.35); }
.stat-card-aqua   .stat-icon { background: linear-gradient(135deg, var(--accent-600) 0%, var(--accent-400) 100%); box-shadow: 0 8px 18px rgba(27, 175, 122, 0.35); }
.stat-card-violet .stat-icon { background: linear-gradient(135deg, #3d2f8a 0%, #6f5cd6 100%); box-shadow: 0 8px 18px rgba(74, 58, 167, 0.35); }
.stat-card-orange .stat-icon { background: linear-gradient(135deg, #c8501f 0%, var(--chart-8) 100%); box-shadow: 0 8px 18px rgba(235, 104, 52, 0.35); }

/* Per-waste-type stat cards - same scheme used everywhere else in the app:
   Dry = Blue, Wet = Green, Sanitary = Red, Special Care = Black */
.stat-card-waste-dry      { border-top-color: #2563eb; }
.stat-card-waste-wet      { border-top-color: #16a34a; }
.stat-card-waste-sanitary { border-top-color: #dc2626; }
.stat-card-waste-special  { border-top-color: #111827; }

.stat-card-waste-dry      .stat-icon { background: linear-gradient(135deg, #1d4ed8 0%, #2563eb 100%); box-shadow: 0 8px 18px rgba(37, 99, 235, 0.35); }
.stat-card-waste-wet      .stat-icon { background: linear-gradient(135deg, #15803d 0%, #16a34a 100%); box-shadow: 0 8px 18px rgba(22, 163, 74, 0.35); }
.stat-card-waste-sanitary .stat-icon { background: linear-gradient(135deg, #b91c1c 0%, #dc2626 100%); box-shadow: 0 8px 18px rgba(220, 38, 38, 0.35); }
.stat-card-waste-special  .stat-icon { background: linear-gradient(135deg, #000000 0%, #374151 100%); box-shadow: 0 8px 18px rgba(17, 24, 39, 0.35); }

.stat-value {
  font-size: 1.9rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 4px;
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.stat-label { color: var(--text-secondary); font-size: 0.88rem; font-weight: 500; }

/* ---------- Chart cards ---------- */
.chart-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(360px, 1fr));
  gap: 20px;
  margin-bottom: 26px;
}

.chart-grid.chart-grid-wide { grid-template-columns: 2fr 1fr; }

.chart-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  animation: fade-up 0.4s ease both;
  min-width: 0;
}

.chart-card-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 6px;
}

.chart-card-title { font-size: 1.02rem; font-weight: 700; color: var(--text-primary); }
.chart-card-subtitle { font-size: 0.8rem; color: var(--text-muted); }

.chart-card-heading { display: flex; flex-direction: column; gap: 2px; }

.chart-card-actions { display: flex; gap: 6px; flex-wrap: wrap; }

.chart-action-btn {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 5px 10px;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--surface);
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.15s ease;
}

.chart-action-btn:hover {
  background: var(--chart-2, #1baf7a);
  color: #fff;
  border-color: transparent;
}

.chart-card-body { position: relative; height: 260px; }
.chart-card-body.chart-tall { height: 320px; }

.chart-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: 0.88rem;
  text-align: center;
  padding: 20px;
}

/* ---------- Live weather widget ---------- */
.weather-card {
  margin-bottom: 26px;
  border-top-color: var(--chart-3);
  background:
    linear-gradient(120deg, rgba(201, 133, 0, 0.06) 0%, rgba(42, 120, 214, 0.05) 100%),
    var(--surface);
}

.weather-body {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 28px;
  min-height: 90px;
}

.weather-main {
  display: flex;
  align-items: center;
  gap: 16px;
}

.weather-icon {
  font-size: 2.6rem;
  width: 68px;
  height: 68px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: linear-gradient(135deg, #c9850a 0%, #f3b93a 100%);
  box-shadow: 0 8px 18px rgba(201, 133, 10, 0.35);
}

.weather-temp {
  font-size: 2.2rem;
  font-weight: 800;
  color: var(--text-primary);
  letter-spacing: -0.02em;
  font-variant-numeric: tabular-nums;
}

.weather-condition { font-size: 0.9rem; color: var(--text-secondary); font-weight: 600; }

.weather-details {
  display: flex;
  flex-wrap: wrap;
  gap: 18px;
  color: var(--text-secondary);
  font-size: 0.88rem;
}

.weather-detail { display: flex; align-items: center; gap: 7px; }
.weather-detail i { color: var(--brand-500); }

@media (max-width: 640px) {
  .weather-body { gap: 16px; }
  .weather-details { gap: 12px; }
}

/* ---------- Zone / ward stat grids ---------- */
.zone-stats {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  margin-bottom: 26px;
  border: 1px solid var(--border);
}

.zone-stats h3 { color: var(--text-primary); margin-bottom: 18px; font-size: 1.15rem; }

.zone-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
}

.zone-item {
  background: var(--surface-sunken);
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  border-left: 3px solid var(--accent-500);
}

.zone-name { font-weight: 700; color: var(--text-primary); margin-bottom: 4px; }
.zone-details { font-size: 0.88rem; color: var(--text-secondary); }

/* ---------- Tables ---------- */
.table-container {
  overflow-x: auto;
  max-height: 420px;
  margin-top: 14px;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

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

th, td {
  padding: 12px 10px;
  text-align: left;
  border-bottom: 1px solid var(--gridline);
}

th {
  background: linear-gradient(180deg, var(--surface-sunken) 0%, #eef1f7 100%);
  font-weight: 700;
  color: var(--brand-800);
  text-transform: uppercase;
  font-size: 0.72rem;
  letter-spacing: 0.04em;
  padding: 13px 10px;
  text-align: center;
  position: sticky;
  top: 0;
  border-bottom: 2px solid var(--brand-100);
}

td { color: var(--text-primary); }
tbody tr:hover { background: var(--surface-sunken); }

/* ---------- Buttons ---------- */
.btn {
  padding: 9px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  font-family: inherit;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: transform 0.15s ease, box-shadow 0.15s ease, opacity 0.15s ease;
  box-shadow: var(--shadow-sm);
}

.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.btn:active { transform: translateY(0); }
.btn:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-primary { background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-400) 100%); color: #fff; box-shadow: 0 6px 16px rgba(42, 120, 214, 0.4); }
.btn-success { background: linear-gradient(135deg, var(--accent-700) 0%, var(--accent-400) 100%); color: #fff; box-shadow: 0 6px 16px rgba(27, 175, 122, 0.4); }
.btn-danger  { background: linear-gradient(135deg, #971f1f 0%, var(--status-critical) 100%); color: #fff; box-shadow: 0 6px 16px rgba(208, 59, 59, 0.4); }
.btn-warning { background: linear-gradient(135deg, #c9820a 0%, #f8c34a 100%); color: #2b1c00; box-shadow: 0 6px 16px rgba(201, 130, 10, 0.35); }
.btn-info    { background: linear-gradient(135deg, #3d2f8a 0%, #6f5cd6 100%); color: #fff; box-shadow: 0 6px 16px rgba(74, 58, 167, 0.4); }
.btn-secondary { background: linear-gradient(135deg, #4d5568 0%, #6b7488 100%); color: #fff; }
.btn-secondary:hover { background: linear-gradient(135deg, #3c4354 0%, #565f70 100%); }
.btn-sm { padding: 6px 12px; font-size: 0.76rem; }
.btn-large { padding: 13px 24px; font-size: 0.95rem; }

/* ---------- Flash messages ---------- */
.flash-messages { margin-bottom: 20px; }

.flash {
  padding: 13px 18px;
  border-radius: var(--radius-sm);
  margin-bottom: 10px;
  font-weight: 500;
  border-left: 4px solid;
  animation: fade-up 0.25s ease both;
}

.flash-success { background: var(--status-good-bg); color: #0a5c0a; border-left-color: var(--status-good); }
.flash-error   { background: var(--status-critical-bg); color: #8f2323; border-left-color: var(--status-critical); }

/* ---------- Badges ---------- */
.role-badge {
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  background: var(--brand-700);
  color: #fff;
  display: inline-block;
}

.validation-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 4px 12px;
  border-radius: var(--radius-pill);
  font-size: 0.72rem;
  font-weight: 700;
}

.badge-accurate { background: var(--status-good-bg); color: #0a5c0a; }
.badge-problem  { background: var(--status-critical-bg); color: #8f2323; }
.badge-pending  { background: var(--status-warning-bg); color: #7a4e07; }

/* ---------- Forms ---------- */
.form-group { margin-bottom: 20px; }

.form-label {
  display: block;
  margin-bottom: 7px;
  font-weight: 700;
  color: var(--text-primary);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
}

.form-input, .filter-select, .filter-input {
  width: 100%;
  padding: 11px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  font-family: inherit;
  transition: all 0.2s ease;
  background: var(--surface-sunken);
  color: var(--text-primary);
}

.form-input:focus, .filter-select:focus, .filter-input:focus {
  outline: none;
  border-color: var(--brand-400);
  background: var(--surface);
  box-shadow: 0 0 0 3px rgba(42, 120, 214, 0.15);
}

.filter-select:disabled { background: var(--surface-sunken); color: var(--text-muted); cursor: not-allowed; }

.password-wrapper { position: relative; width: 100%; }

.password-input {
  width: 100%;
  padding: 11px 44px 11px 14px;
  border: 1.5px solid var(--border-strong);
  border-radius: var(--radius-sm);
  font-size: 0.88rem;
  background: var(--surface-sunken);
  font-family: inherit;
}

.password-toggle {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  font-size: 1rem;
}

.form-actions, .modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* ---------- Filters ---------- */
.filter-container {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  margin-bottom: 26px;
}

.filter-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gridline);
  flex-wrap: wrap;
  gap: 10px;
}

.filter-header h3 { color: var(--text-primary); font-size: 1.15rem; font-weight: 700; }

.filter-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 18px;
  align-items: end;
}

.filter-group { display: flex; flex-direction: column; }

.filter-group label, .filter-label {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 7px;
}

.filter-actions { display: flex; align-items: end; gap: 10px; }
.date-range-group { display: flex; gap: 8px; }
.date-range-group .filter-input { width: 50%; }

/* ---------- Modals ---------- */
.modal {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(11, 18, 32, 0.55);
  z-index: 3000;
  backdrop-filter: blur(2px);
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: var(--surface);
  padding: 28px;
  border-radius: var(--radius-lg);
  width: 90%;
  max-width: 500px;
  box-shadow: var(--shadow-lg);
  animation: fade-up 0.25s ease both;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gridline);
}

.modal-title { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }

.close-btn {
  background: none;
  border: none;
  font-size: 1.4rem;
  cursor: pointer;
  color: var(--text-muted);
  transition: color 0.2s ease;
  line-height: 1;
}

.close-btn:hover { color: var(--status-critical); }

/* ---------- Pagination ---------- */
.pagination-container { margin-top: 26px; padding-top: 18px; border-top: 1px solid var(--gridline); }

.pagination {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 16px;
  flex-wrap: wrap;
}

.pagination .btn { min-width: 96px; justify-content: center; }
.pagination .btn:disabled, .pagination .btn.disabled { opacity: 0.5; cursor: not-allowed; pointer-events: none; }

.page-numbers { display: flex; gap: 6px; align-items: center; }

.page-link {
  background: var(--surface-sunken);
  color: var(--text-secondary);
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  text-decoration: none;
  transition: all 0.2s ease;
  font-weight: 600;
  font-size: 0.85rem;
}

.page-link:hover { background: var(--brand-50); color: var(--brand-700); }

.page-current {
  background: var(--brand-500);
  color: #fff;
  padding: 8px 15px;
  border-radius: var(--radius-sm);
  font-weight: 700;
  font-size: 0.85rem;
}

.page-ellipsis { color: var(--text-muted); padding: 8px; }

.pagination-info { text-align: center; margin-top: 14px; color: var(--text-muted); font-size: 0.85rem; }

.per-page-selector { display: flex; justify-content: flex-end; align-items: center; gap: 10px; margin-bottom: 14px; }
.per-page-selector label { color: var(--text-secondary); font-size: 0.85rem; font-weight: 600; }

/* ---------- Submission cards (reports) ---------- */
/* ---------- List containers (submissions / vendors / collectors) ---------- */
.submissions-container,
.vendors-container,
.collectors-container {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-top: 4px solid var(--brand-400);
  margin-bottom: 26px;
  transition: box-shadow 0.2s ease, transform 0.2s ease;
  animation: fade-up 0.35s ease both;
}

.vendors-container { border-top-color: var(--chart-1); }
.collectors-container { border-top-color: var(--chart-2); }

.submissions-container:hover,
.vendors-container:hover,
.collectors-container:hover {
  box-shadow: var(--shadow-md);
}

.submissions-header,
.vendors-header,
.collectors-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 22px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--gridline);
  flex-wrap: wrap;
  gap: 10px;
}

.submissions-title, .vendors-title, .collectors-title { display: flex; align-items: center; }

.submissions-icon, .vendors-icon, .collectors-icon {
  font-size: 1.1rem;
  margin-right: 12px;
  width: 42px;
  height: 42px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-400) 100%);
  box-shadow: 0 8px 18px rgba(42, 120, 214, 0.35);
}

.vendors-icon { background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-400) 100%); box-shadow: 0 8px 18px rgba(42, 120, 214, 0.35); }
.collectors-icon { background: linear-gradient(135deg, var(--accent-600) 0%, var(--accent-400) 100%); box-shadow: 0 8px 18px rgba(27, 175, 122, 0.35); }

.submissions-title-text, .vendors-title-text, .collectors-title-text {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
}

.submissions-count, .vendors-count, .collectors-count {
  background: var(--brand-50);
  color: var(--brand-700);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-size: 0.82rem;
  font-weight: 700;
}

.vendors-count { background: rgba(42, 120, 214, 0.12); color: var(--chart-1); }
.collectors-count { background: rgba(27, 175, 122, 0.12); color: var(--chart-2); }

.vendors-table-wrapper, .collectors-table-wrapper {
  overflow-x: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
}

.vendors-table, .collectors-table { width: 100%; border-collapse: collapse; font-size: 0.88rem; }

.vendors-table th, .collectors-table th {
  background: linear-gradient(180deg, var(--surface-sunken) 0%, #eef1f7 100%);
  color: var(--brand-800);
  text-transform: uppercase;
  font-size: 0.7rem;
  letter-spacing: 0.04em;
  font-weight: 700;
  padding: 13px 10px;
  text-align: left;
  white-space: nowrap;
  border-bottom: 2px solid var(--brand-100);
}

.vendors-table td, .collectors-table td {
  padding: 12px 10px;
  border-bottom: 1px solid var(--gridline);
  color: var(--text-primary);
}

.vendors-table tr:hover td, .collectors-table tr:hover td { background: var(--surface-sunken); }

.summary-container {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 24px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  border-top: 3px solid var(--chart-5);
  margin-top: 20px;
}

.summary-container h2 { margin-bottom: 15px; font-size: 1.15rem; font-weight: 700; color: var(--text-primary); }

.submission-cards { display: grid; gap: 18px; }

.submission-card {
  background: var(--surface-sunken);
  border-radius: var(--radius-md);
  padding: 20px;
  border-left: 4px solid var(--brand-400);
  transition: all 0.2s ease;
}

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

.submission-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 14px; flex-wrap: wrap; gap: 8px; }
.submission-id { font-weight: 700; color: var(--text-primary); font-size: 1.05rem; }
.submission-time { color: var(--text-muted); font-size: 0.85rem; }

.submission-details {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 14px;
  margin-bottom: 14px;
}

.detail-group { background: var(--surface); padding: 12px; border-radius: var(--radius-sm); border: 1px solid var(--border); }
.detail-label { font-size: 0.72rem; color: var(--text-muted); text-transform: uppercase; font-weight: 700; letter-spacing: 0.03em; margin-bottom: 4px; }
.detail-value { font-size: 0.92rem; color: var(--text-primary); font-weight: 600; }

.collection-details { display: grid; grid-template-columns: 1fr 1fr; gap: 18px; margin-bottom: 18px; }
.manual-details, .auto-details { background: var(--surface); border-radius: var(--radius-sm); padding: 14px; border: 1px solid var(--border); }
.manual-details { border-left: 3px solid var(--brand-700); }
.auto-details { border-left: 3px solid var(--accent-500); }

.section-title { font-size: 0.82rem; font-weight: 700; text-transform: uppercase; letter-spacing: 0.03em; margin-bottom: 10px; padding-bottom: 7px; border-bottom: 1px solid var(--gridline); }
.manual-title { color: var(--brand-700); }
.auto-title { color: var(--accent-600); }

.weight-values { display: flex; justify-content: space-between; gap: 12px; flex-wrap: wrap; }
.weight-item { flex: 1; text-align: center; padding: 8px; background: var(--surface-sunken); border-radius: var(--radius-sm); min-width: 80px; }
.weight-label { font-size: 0.68rem; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.03em; }
.weight-number { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); font-variant-numeric: tabular-nums; }

.weight-diff { background: var(--surface-sunken); padding: 8px 12px; border-radius: var(--radius-sm); font-size: 0.85rem; text-align: center; margin-bottom: 14px; }

.photo-thumbnails { display: flex; gap: 10px; flex-wrap: wrap; margin-top: 10px; }
.photo-thumb { position: relative; width: 76px; height: 76px; border-radius: var(--radius-sm); overflow: hidden; border: 2px solid var(--border); cursor: pointer; transition: all 0.2s ease; }
.photo-thumb:hover { transform: scale(1.05); border-color: var(--brand-400); box-shadow: var(--shadow-md); }
.photo-thumb img { width: 100%; height: 100%; object-fit: cover; }
.photo-count-badge { position: absolute; bottom: 0; right: 0; background: rgba(15, 23, 42, 0.7); color: #fff; padding: 2px 6px; font-size: 10px; border-radius: 4px 0 0 0; }

.submission-actions { display: flex; gap: 10px; align-items: center; flex-wrap: wrap; margin-top: 14px; }

/* ---------- Image gallery / lightbox ---------- */
.gallery-container { position: relative; width: 90%; max-width: 1200px; margin: 2% auto; background: var(--surface); border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-lg); }
.gallery-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 18px; padding-bottom: 10px; border-bottom: 1px solid var(--gridline); }
.gallery-header h3 { color: var(--text-primary); font-size: 1.2rem; }
.gallery-counter { background: var(--brand-700); color: #fff; padding: 5px 14px; border-radius: var(--radius-pill); font-size: 0.85rem; font-weight: 600; }
.gallery-main { position: relative; display: flex; align-items: center; justify-content: center; background: var(--surface-sunken); border-radius: var(--radius-sm); margin-bottom: 18px; min-height: 400px; }
.gallery-main-image { max-width: 100%; max-height: 500px; object-fit: contain; border-radius: var(--radius-sm); }
.gallery-nav { position: absolute; top: 50%; transform: translateY(-50%); background: rgba(15, 23, 42, 0.65); color: #fff; border: none; width: 46px; height: 46px; border-radius: 50%; font-size: 22px; cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all 0.2s ease; z-index: 10; }
.gallery-nav:hover { background: rgba(15, 23, 42, 0.85); transform: translateY(-50%) scale(1.08); }
.gallery-prev { left: 18px; }
.gallery-next { right: 18px; }
.gallery-actions { display: flex; justify-content: center; gap: 14px; margin-bottom: 18px; flex-wrap: wrap; }
.gallery-thumbnails { display: grid; grid-template-columns: repeat(auto-fill, minmax(76px, 1fr)); gap: 10px; max-height: 150px; overflow-y: auto; padding: 10px; background: var(--surface-sunken); border-radius: var(--radius-sm); border: 1px solid var(--border); }
.gallery-thumbnail { width: 100%; aspect-ratio: 1; object-fit: cover; border-radius: 4px; cursor: pointer; border: 2px solid transparent; transition: all 0.2s ease; }
.gallery-thumbnail:hover { transform: scale(1.05); box-shadow: var(--shadow-md); }
.gallery-thumbnail.active { border-color: var(--brand-400); transform: scale(1.05); }

.image-modal { display: none; position: fixed; z-index: 4000; inset: 0; background: rgba(11, 18, 32, 0.95); }
.image-modal-content { max-width: 100%; max-height: 80vh; object-fit: contain; cursor: pointer; }
.image-modal-close { position: absolute; top: 15px; right: 30px; color: #f1f1f1; font-size: 40px; font-weight: bold; cursor: pointer; z-index: 4001; }
.image-modal-close:hover { color: #bbb; }

/* ---------- Download reports card ---------- */
.download-card {
  background: var(--surface);
  border-radius: var(--radius-md);
  padding: 22px 26px;
  border: 1px solid var(--border);
  border-left: 4px solid var(--accent-500);
  box-shadow: var(--shadow-sm);
}

.download-header { display: flex; align-items: center; margin-bottom: 16px; padding-bottom: 13px; border-bottom: 1px solid var(--gridline); }
.download-icon { font-size: 1.3rem; color: var(--accent-500); margin-right: 10px; }
.download-title { font-size: 1.2rem; font-weight: 700; color: var(--text-primary); }
.download-subtitle { color: var(--text-muted); font-size: 0.85rem; margin-bottom: 20px; }

.report-filters { display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px; margin-bottom: 20px; }
.report-actions { display: flex; justify-content: flex-end; gap: 12px; margin-top: 16px; padding-top: 16px; border-top: 1px solid var(--gridline); }

.btn-reset-report, .btn-download-report {
  padding: 9px 20px;
  border: none;
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 7px;
  transition: all 0.2s ease;
}

.btn-reset-report { background: #667085; color: #fff; }
.btn-reset-report:hover { background: #4d5568; }
.btn-download-report { background: linear-gradient(135deg, var(--accent-700) 0%, var(--accent-500) 100%); color: #fff; box-shadow: var(--shadow-sm); }
.btn-download-report:hover { transform: translateY(-1px); box-shadow: var(--shadow-md); }

#report_date_range { display: none; }

/* ---------- Auth / standalone pages (home, logins) ---------- */
.auth-body {
  background: linear-gradient(160deg, var(--sidebar-bg-1) 0%, var(--brand-950) 60%, var(--brand-800) 100%);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 30px;
  color: #fff;
}

.header { text-align: center; margin-bottom: 50px; width: 100%; max-width: 600px; display: flex; flex-direction: column; align-items: center; }
.organization-name { font-size: 2.6rem; font-weight: 800; color: #fff; margin-bottom: 10px; letter-spacing: -0.01em; }
.collaboration-text { font-size: 1.3rem; color: var(--brand-100); font-weight: 600; margin-bottom: 10px; }
.system-title { font-size: 1.2rem; color: rgba(255,255,255,0.72); font-weight: 500; }

.login-btn {
  display: flex;
  align-items: center;
  gap: 18px;
  padding: 16px 20px;
  border: none;
  border-radius: var(--radius-md);
  text-decoration: none;
  color: #fff;
  font-weight: 600;
  transition: all 0.2s ease;
  box-shadow: var(--shadow-sm);
}

.login-btn:hover { transform: translateY(-2px); box-shadow: var(--shadow-lg); }
.login-btn.admin { background: linear-gradient(135deg, var(--brand-700) 0%, var(--brand-400) 100%); }
.login-btn.collector { background: linear-gradient(135deg, var(--accent-700) 0%, var(--accent-400) 100%); }
.login-btn.bwg { background: linear-gradient(135deg, #6d3aa7 0%, #9d6ee0 100%); }

.btn-icon { font-size: 1.4rem; }
.btn-title { font-weight: 700; font-size: 1.15rem; margin-bottom: 2px; }
.btn-desc { font-weight: 400; font-size: 0.88rem; opacity: 0.82; }

/* ---------- Mobile shell (topbar + slide-in sidebar) ---------- */
.mobile-topbar, .mobile-sidebar-overlay, .mobile-sidebar-close { display: none; }

@media (max-width: 768px) {
  body { padding-top: 64px; overflow-x: hidden; }

  .mobile-topbar {
    display: flex;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 64px;
    background: var(--sidebar-bg-1);
    color: #fff;
    z-index: 3500;
    align-items: center;
    justify-content: space-between;
    padding: 0 16px;
    box-shadow: var(--shadow-md);
  }

  .mobile-topbar-title { font-size: 1rem; font-weight: 700; }

  .mobile-menu-btn {
    width: 42px; height: 42px;
    border: none; border-radius: 10px;
    background: rgba(255,255,255,0.12);
    color: #fff; font-size: 1.3rem;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
  }

  .mobile-sidebar-overlay {
    display: none;
    position: fixed; inset: 0;
    background: rgba(11, 18, 32, 0.6);
    z-index: 2999;
  }

  .mobile-sidebar-overlay.active { display: block; }

  .sidebar {
    position: fixed !important;
    top: 0 !important; left: -285px !important;
    width: 280px !important; height: 100vh !important;
    z-index: 3000 !important;
    transition: left 0.28s ease-in-out !important;
    box-shadow: 6px 0 24px rgba(0,0,0,0.3);
  }

  .sidebar.mobile-open { left: 0 !important; }
  .sidebar:hover { width: 280px !important; }

  .mobile-sidebar-close {
    display: flex;
    position: absolute; top: 14px; right: 14px;
    width: 36px; height: 36px;
    border: none; border-radius: 10px;
    background: rgba(255,255,255,0.12);
    color: #fff;
    align-items: center; justify-content: center;
    font-size: 1.1rem; cursor: pointer;
  }

  .sidebar-header { padding-top: 58px; }

  .org-name, .dashboard-title, .menu-text, .logout-text {
    opacity: 1 !important; transform: translateX(0) !important;
  }

  .sidebar-menu { padding: 12px; }
  .container { display: block; min-height: auto; }
  .main-content { margin-left: 0 !important; padding: 16px !important; width: 100%; }
  .content-header { padding: 16px 18px; }
  .page-title { font-size: 1.3rem; }
  .table-container { max-height: 300px; }
  .collection-details { grid-template-columns: 1fr; }
  .report-filters { grid-template-columns: 1fr; }
  .chart-grid.chart-grid-wide { grid-template-columns: 1fr; }
}

@media (min-width: 769px) and (max-width: 1024px) {
  .sidebar:hover { width: 220px; }
  .filter-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (min-width: 1200px) {
  .main-content { padding: 40px; }
}
