/* ============================================
   NGO DASHBOARD — PREMIUM DESIGN SYSTEM
   Font: Plus Jakarta Sans + DM Serif Display
   Palette: Alpine Frost + NGO Green
   ============================================ */

:root {
  --bg-primary: #F0F4F8;
  --bg-secondary: #FFFFFF;
  --bg-tertiary: #E8EEF4;
  --sidebar-bg: #0A1929;
  --sidebar-hover: #132F4C;
  --sidebar-active: #1565C0;
  --sidebar-text: #B0BEC5;
  --sidebar-text-active: #FFFFFF;
  --text-primary: #0A1929;
  --text-secondary: #546E7A;
  --text-muted: #90A4AE;
  --border: #DDE3EA;
  --accent: #1976D2;
  --accent-light: #E3F2FD;

  /* KPI Card Colors */
  --income-bg: linear-gradient(135deg, #1565C0 0%, #1976D2 100%);
  --expenditure-bg: linear-gradient(135deg, #00695C 0%, #00897B 100%);
  --team-bg: linear-gradient(135deg, #4527A0 0%, #5E35B1 100%);
  --beneficiary-bg: linear-gradient(135deg, #AD1457 0%, #D81B60 100%);
  --assets-bg: linear-gradient(135deg, #E65100 0%, #F57C00 100%);
  --liabilities-bg: linear-gradient(135deg, #37474F 0%, #546E7A 100%);
  --programs-bg: linear-gradient(135deg, #1B5E20 0%, #2E7D32 100%);
  --donors-bg: linear-gradient(135deg, #880E4F 0%, #AD1457 100%);

  --shadow-sm: 0 1px 3px rgba(10,25,41,0.08), 0 1px 2px rgba(10,25,41,0.04);
  --shadow-md: 0 4px 16px rgba(10,25,41,0.10), 0 2px 6px rgba(10,25,41,0.06);
  --shadow-lg: 0 10px 40px rgba(10,25,41,0.12), 0 4px 12px rgba(10,25,41,0.08);
  --radius-sm: 8px;
  --radius-md: 14px;
  --radius-lg: 20px;
  --sidebar-width: 260px;
  --topbar-height: 68px;
  --transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
}

[data-theme="dark"] {
  --bg-primary: #0A1929;
  --bg-secondary: #132F4C;
  --bg-tertiary: #1A3A5C;
  --sidebar-bg: #050E1A;
  --sidebar-hover: #0D2137;
  --sidebar-active: #1565C0;
  --text-primary: #E8F4FD;
  --text-secondary: #90CAF9;
  --text-muted: #546E7A;
  --border: #1E3A5F;
  --accent: #42A5F5;
  --accent-light: #0D2137;
  --shadow-sm: 0 1px 3px rgba(0,0,0,0.3);
  --shadow-md: 0 4px 16px rgba(0,0,0,0.4);
  --shadow-lg: 0 10px 40px rgba(0,0,0,0.5);
}

/* ============ RESET & BASE ============ */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

html { scroll-behavior: smooth; }

body {
  font-family: 'Plus Jakarta Sans', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  display: flex;
  min-height: 100vh;
  overflow-x: hidden;
  transition: background 0.3s ease, color 0.3s ease;
}

/* ============ SIDEBAR ============ */
.sidebar {
  width: var(--sidebar-width);
  background: var(--sidebar-bg);
  height: 100vh;
  position: fixed;
  left: 0;
  top: 0;
  display: flex;
  flex-direction: column;
  z-index: 100;
  transition: var(--transition);
  overflow-y: auto;
  overflow-x: hidden;
}

.sidebar::-webkit-scrollbar { width: 4px; }
.sidebar::-webkit-scrollbar-track { background: transparent; }
.sidebar::-webkit-scrollbar-thumb { background: #1E3A5F; border-radius: 4px; }

.sidebar-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 24px 20px;
  border-bottom: 1px solid rgba(255,255,255,0.06);
}

.logo-icon {
  width: 44px;
  height: 44px;
  background: rgba(25, 118, 210, 0.15);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.logo-text { display: flex; flex-direction: column; }
.logo-name {
  font-family: 'DM Serif Display', serif;
  font-size: 18px;
  color: #FFFFFF;
  line-height: 1.1;
  letter-spacing: 0.3px;
}
.logo-sub {
  font-size: 10px;
  color: var(--sidebar-text);
  text-transform: uppercase;
  letter-spacing: 1.5px;
  font-weight: 600;
}

.sidebar-nav {
  flex: 1;
  padding: 16px 12px;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.nav-section-label {
  font-size: 9.5px;
  font-weight: 700;
  letter-spacing: 1.8px;
  color: var(--sidebar-text);
  opacity: 0.5;
  padding: 16px 8px 6px;
  text-transform: uppercase;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: var(--radius-sm);
  color: var(--sidebar-text);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 500;
  transition: var(--transition);
  cursor: pointer;
  position: relative;
}

.nav-item:hover {
  background: var(--sidebar-hover);
  color: #FFFFFF;
}

.nav-item.active {
  background: var(--sidebar-active);
  color: var(--sidebar-text-active);
  font-weight: 600;
  box-shadow: 0 4px 12px rgba(21, 101, 192, 0.4);
}

.nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: #90CAF9;
  border-radius: 0 3px 3px 0;
}

.sidebar-footer {
  padding: 16px 12px;
  border-top: 1px solid rgba(255,255,255,0.06);
}

.user-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: rgba(255,255,255,0.04);
}

.user-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--sidebar-active);
  color: white;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 700;
  flex-shrink: 0;
}

.user-info { display: flex; flex-direction: column; }
.user-name { font-size: 13px; font-weight: 600; color: #FFFFFF; }
.user-role { font-size: 11px; color: var(--sidebar-text); }

/* ============ MAIN CONTENT ============ */
.main-content {
  margin-left: var(--sidebar-width);
  flex: 1;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  transition: var(--transition);
}

/* ============ TOPBAR ============ */
.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 28px;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
  transition: background 0.3s ease;
}

.topbar-left { display: flex; align-items: center; gap: 16px; }

.sidebar-toggle {
  width: 36px;
  height: 36px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}
.sidebar-toggle:hover { background: var(--accent-light); color: var(--accent); }

.page-title h1 {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--text-primary);
  line-height: 1.2;
}
.breadcrumb {
  font-size: 11.5px;
  color: var(--text-muted);
  font-weight: 500;
}

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

.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 8px 14px;
  transition: var(--transition);
}
.search-box:focus-within {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
}
.search-box svg { color: var(--text-muted); flex-shrink: 0; }
.search-box input {
  border: none;
  background: transparent;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  color: var(--text-primary);
  outline: none;
  width: 160px;
}
.search-box input::placeholder { color: var(--text-muted); }

.date-filter select {
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  padding: 8px 12px;
  border-radius: var(--radius-sm);
  cursor: pointer;
  outline: none;
  transition: var(--transition);
}
.date-filter select:focus { border-color: var(--accent); }

.theme-toggle {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: var(--transition);
}
.theme-toggle:hover { background: var(--accent-light); color: var(--accent); }
[data-theme="light"] .moon-icon { display: none; }
[data-theme="dark"] .sun-icon { display: none; }

.notif-btn {
  width: 36px;
  height: 36px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  position: relative;
  transition: var(--transition);
}
.notif-btn:hover { background: var(--accent-light); color: var(--accent); }
.notif-dot {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 7px;
  height: 7px;
  background: #EF5350;
  border-radius: 50%;
  border: 2px solid var(--bg-secondary);
}

/* ============ PAGE CONTENT ============ */
.page {
  display: none;
  padding: 28px;
  flex-direction: column;
  gap: 24px;
  animation: fadeIn 0.3s ease;
}
.page.active { display: flex; }

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

/* ============ KPI CARDS ============ */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}

.kpi-card {
  border-radius: var(--radius-md);
  padding: 20px;
  color: white;
  display: flex;
  align-items: flex-start;
  gap: 14px;
  position: relative;
  overflow: hidden;
  box-shadow: var(--shadow-md);
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  cursor: default;
}

.kpi-card::before {
  content: '';
  position: absolute;
  top: -30px;
  right: -30px;
  width: 100px;
  height: 100px;
  background: rgba(255,255,255,0.08);
  border-radius: 50%;
}
.kpi-card::after {
  content: '';
  position: absolute;
  bottom: -20px;
  right: 20px;
  width: 60px;
  height: 60px;
  background: rgba(255,255,255,0.05);
  border-radius: 50%;
}

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

.kpi-income { background: var(--income-bg); }
.kpi-expenditure { background: var(--expenditure-bg); }
.kpi-team { background: var(--team-bg); }
.kpi-beneficiary { background: var(--beneficiary-bg); }
.kpi-assets { background: var(--assets-bg); }
.kpi-liabilities { background: var(--liabilities-bg); }
.kpi-programs { background: var(--programs-bg); }
.kpi-donors { background: var(--donors-bg); }

.kpi-icon {
  width: 44px;
  height: 44px;
  background: rgba(255,255,255,0.18);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  backdrop-filter: blur(4px);
}

.kpi-body { flex: 1; min-width: 0; }

.kpi-value {
  font-family: 'DM Serif Display', serif;
  font-size: 22px;
  font-weight: 400;
  line-height: 1.2;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-label {
  font-size: 12px;
  font-weight: 500;
  opacity: 0.85;
  margin-top: 3px;
  letter-spacing: 0.2px;
}

.kpi-trend {
  font-size: 11px;
  font-weight: 600;
  margin-top: 6px;
  opacity: 0.9;
  background: rgba(255,255,255,0.15);
  display: inline-block;
  padding: 2px 8px;
  border-radius: 20px;
}

.kpi-sparkline {
  position: absolute;
  bottom: 10px;
  right: 10px;
  width: 70px;
  height: 35px;
  opacity: 0.5;
}

/* ============ CHARTS ============ */
.charts-row {
  display: grid;
  gap: 16px;
}

.charts-row:nth-child(2) {
  grid-template-columns: 2fr 1fr;
}

.charts-row:nth-child(3) {
  grid-template-columns: 1fr 1.5fr 1fr;
}

.chart-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s ease;
}
.chart-card:hover { box-shadow: var(--shadow-md); }

.chart-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 20px;
}

.chart-header h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 400;
}

.chart-header p {
  font-size: 12px;
  color: var(--text-muted);
  margin-top: 2px;
}

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

.chart-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition);
}
.chart-btn.active, .chart-btn:hover {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.donut-legend {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 11.5px;
  color: var(--text-secondary);
  font-weight: 500;
}

.legend-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

/* ============ BOTTOM ROW ============ */
.bottom-row {
  display: grid;
  gap: 16px;
}

.bottom-row:nth-of-type(1) {
  grid-template-columns: 2fr 1fr;
}

.bottom-row:nth-of-type(2) {
  grid-template-columns: 1.5fr 1fr 1fr;
}

/* ============ TABLE CARD ============ */
.table-card, .inventory-card, .donors-card, .activity-card {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 22px;
  box-shadow: var(--shadow-sm);
  border: 1px solid var(--border);
  transition: box-shadow 0.2s ease;
}
.table-card:hover, .inventory-card:hover,
.donors-card:hover, .activity-card:hover { box-shadow: var(--shadow-md); }

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.card-header h3 {
  font-family: 'DM Serif Display', serif;
  font-size: 16px;
  color: var(--text-primary);
  font-weight: 400;
}

.view-all-btn {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  background: var(--accent-light);
  border: none;
  padding: 5px 12px;
  border-radius: 20px;
  cursor: pointer;
  font-family: 'Plus Jakarta Sans', sans-serif;
  transition: var(--transition);
}
.view-all-btn:hover { background: var(--accent); color: white; }

.table-wrapper { overflow-x: auto; }

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

.data-table thead th {
  text-align: left;
  padding: 10px 12px;
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--text-muted);
  border-bottom: 2px solid var(--border);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid var(--border);
  transition: background 0.15s ease;
}
.data-table tbody tr:last-child { border-bottom: none; }
.data-table tbody tr:hover { background: var(--bg-tertiary); }

.data-table tbody td {
  padding: 11px 12px;
  color: var(--text-secondary);
  font-size: 13px;
}

.data-table tbody td:first-child { color: var(--text-muted); font-size: 12px; }
.data-table tbody td:nth-child(2) { color: var(--text-primary); font-weight: 500; }

.badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 20px;
  font-size: 11px;
  font-weight: 600;
}
.badge-income { background: #E8F5E9; color: #2E7D32; }
.badge-expense { background: #FFEBEE; color: #C62828; }
.badge-success { background: #E8F5E9; color: #2E7D32; }
.badge-pending { background: #FFF8E1; color: #F57F17; }
.badge-failed { background: #FFEBEE; color: #C62828; }

[data-theme="dark"] .badge-income { background: #1B5E20; color: #A5D6A7; }
[data-theme="dark"] .badge-expense { background: #B71C1C; color: #FFCDD2; }
[data-theme="dark"] .badge-success { background: #1B5E20; color: #A5D6A7; }
[data-theme="dark"] .badge-pending { background: #E65100; color: #FFE0B2; }
[data-theme="dark"] .badge-failed { background: #B71C1C; color: #FFCDD2; }

.amount-positive { color: #2E7D32; font-weight: 600; }
.amount-negative { color: #C62828; font-weight: 600; }
[data-theme="dark"] .amount-positive { color: #81C784; }
[data-theme="dark"] .amount-negative { color: #EF9A9A; }

/* ============ INVENTORY ============ */
.inventory-list { display: flex; flex-direction: column; gap: 12px; }

.inventory-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.inv-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 16px;
  flex-shrink: 0;
}

.inv-info { flex: 1; min-width: 0; }
.inv-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.inv-qty { font-size: 11.5px; color: var(--text-muted); margin-top: 1px; }

.inv-bar-wrap { flex: 1; }
.inv-bar-bg {
  height: 6px;
  background: var(--bg-tertiary);
  border-radius: 3px;
  overflow: hidden;
}
.inv-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 1s ease;
}
.inv-pct { font-size: 11px; font-weight: 600; color: var(--text-muted); margin-top: 3px; }

/* ============ DONORS ============ */
.donors-list { display: flex; flex-direction: column; gap: 12px; }

.donor-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  transition: var(--transition);
}
.donor-item:hover { background: var(--accent-light); }

.donor-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 13px;
  font-weight: 700;
  color: white;
  flex-shrink: 0;
}

.donor-info { flex: 1; min-width: 0; }
.donor-name { font-size: 13px; font-weight: 600; color: var(--text-primary); }
.donor-type { font-size: 11px; color: var(--text-muted); }
.donor-amount { font-size: 13px; font-weight: 700; color: var(--accent); }

/* ============ ACTIVITY FEED ============ */
.activity-feed { display: flex; flex-direction: column; gap: 0; }

.activity-item {
  display: flex;
  gap: 12px;
  padding: 10px 0;
  border-bottom: 1px solid var(--border);
  position: relative;
}
.activity-item:last-child { border-bottom: none; }

.activity-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  margin-top: 5px;
  flex-shrink: 0;
}

.activity-content { flex: 1; }
.activity-text { font-size: 13px; color: var(--text-primary); font-weight: 500; line-height: 1.4; }
.activity-time { font-size: 11px; color: var(--text-muted); margin-top: 3px; }

/* ============ SIDEBAR COLLAPSED ============ */
.sidebar.collapsed {
  width: 68px;
}
.sidebar.collapsed .logo-text,
.sidebar.collapsed .nav-item span,
.sidebar.collapsed .nav-section-label,
.sidebar.collapsed .user-info { display: none; }
.sidebar.collapsed .nav-item { justify-content: center; padding: 10px; }
.sidebar.collapsed .logo-icon { margin: 0 auto; }
.sidebar.collapsed .sidebar-logo { justify-content: center; padding: 24px 12px; }
.sidebar.collapsed .user-card { justify-content: center; }
.sidebar.collapsed + .main-content { margin-left: 68px; }

/* ============ SCROLLBAR ============ */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--text-muted); }

/* ============ RESPONSIVE ============ */
@media (max-width: 1400px) {
  .kpi-grid { grid-template-columns: repeat(4, 1fr); }
}

@media (max-width: 1200px) {
  .kpi-grid { grid-template-columns: repeat(2, 1fr); }
  .charts-row:nth-child(3) { grid-template-columns: 1fr 1fr; }
  .bottom-row:nth-of-type(2) { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 900px) {
  :root { --sidebar-width: 68px; }
  .sidebar .logo-text,
  .sidebar .nav-item span,
  .sidebar .nav-section-label,
  .sidebar .user-info { display: none; }
  .sidebar .nav-item { justify-content: center; padding: 10px; }
  .sidebar .logo-icon { margin: 0 auto; }
  .sidebar .sidebar-logo { justify-content: center; padding: 24px 12px; }
  .sidebar .user-card { justify-content: center; }
  .charts-row:nth-child(2) { grid-template-columns: 1fr; }
  .bottom-row:nth-of-type(1) { grid-template-columns: 1fr; }
  .search-box { display: none; }
}

@media (max-width: 600px) {
  .kpi-grid { grid-template-columns: 1fr 1fr; }
  .page { padding: 16px; gap: 16px; }
  .topbar { padding: 0 16px; }
  .charts-row:nth-child(3) { grid-template-columns: 1fr; }
  .bottom-row:nth-of-type(2) { grid-template-columns: 1fr; }
}

/* ============ FILTER BAR ============ */
.filter-bar {
  background: var(--bg-secondary);
  border-radius: var(--radius-md);
  padding: 18px 22px;
  border: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.filter-bar-top {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}

.filter-bar-title {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  font-weight: 700;
  color: var(--text-primary);
}

.active-filter-count {
  background: var(--accent);
  color: white;
  font-size: 10px;
  font-weight: 700;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
}

.filter-bar-actions {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}

.filter-preset-btn {
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-tertiary);
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.filter-preset-btn:hover, .filter-preset-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

.filter-reset-btn {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 5px 12px;
  border-radius: 20px;
  border: 1px solid #EF5350;
  background: #FFEBEE;
  color: #C62828;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
}
.filter-reset-btn:hover { background: #EF5350; color: white; }
[data-theme="dark"] .filter-reset-btn { background: #B71C1C; color: #FFCDD2; border-color: #EF5350; }

.filter-controls {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 12px;
  align-items: end;
}

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

.filter-label {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 11px;
  font-weight: 700;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.6px;
}

.filter-input, .filter-select {
  width: 100%;
  padding: 8px 11px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  background: var(--bg-tertiary);
  color: var(--text-primary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 500;
  outline: none;
  transition: var(--transition);
  cursor: pointer;
}
.filter-input:focus, .filter-select:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px var(--accent-light);
  background: var(--bg-secondary);
}
.filter-input::placeholder { color: var(--text-muted); }

.filter-apply-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  width: 100%;
  padding: 9px 16px;
  border-radius: var(--radius-sm);
  border: none;
  background: var(--accent);
  color: white;
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  transition: var(--transition);
  box-shadow: 0 4px 12px rgba(25,118,210,0.3);
}
.filter-apply-btn:hover {
  background: #1565C0;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(25,118,210,0.4);
}

.active-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 14px;
}

.filter-tag {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px 4px 12px;
  background: var(--accent-light);
  border: 1px solid var(--accent);
  border-radius: 20px;
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  animation: tagIn 0.2s ease;
}

@keyframes tagIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

.filter-tag-remove {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: var(--accent);
  color: white;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  line-height: 1;
  transition: var(--transition);
  flex-shrink: 0;
}
.filter-tag-remove:hover { background: #C62828; }

/* ============ SUB-DASHBOARDS ============ */
.sub-dash-header {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.back-btn {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 8px 16px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--bg-secondary);
  color: var(--text-secondary);
  font-family: 'Plus Jakarta Sans', sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition);
  align-self: flex-start;
}
.back-btn:hover {
  background: var(--accent-light);
  color: var(--accent);
  border-color: var(--accent);
}

.sub-dash-kpis {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 12px;
}

.sub-kpi {
  background: var(--bg-secondary);
  border: 1.5px solid var(--border);
  border-top: 3px solid var(--c, var(--accent));
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 4px;
  transition: var(--transition);
  cursor: default;
}
.sub-kpi:hover {
  box-shadow: var(--shadow-md);
  transform: translateY(-2px);
}

.sub-kpi-val {
  font-family: 'DM Serif Display', serif;
  font-size: 20px;
  color: var(--text-primary);
  line-height: 1.2;
}

.sub-kpi-lbl {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

/* KPI cards clickable */
.kpi-card {
  cursor: pointer;
}
.kpi-card .kpi-click-hint {
  position: absolute;
  bottom: 8px;
  left: 20px;
  font-size: 10px;
  font-weight: 600;
  opacity: 0;
  transition: opacity 0.2s ease;
  background: rgba(255,255,255,0.2);
  padding: 2px 8px;
  border-radius: 10px;
}
.kpi-card:hover .kpi-click-hint { opacity: 1; }

/* Progress bar in table */
.prog-bar-wrap { display: flex; align-items: center; gap: 8px; }
.prog-bar-bg { flex: 1; height: 6px; background: var(--bg-tertiary); border-radius: 3px; overflow: hidden; }
.prog-bar-fill { height: 100%; border-radius: 3px; }
.prog-pct { font-size: 11px; font-weight: 700; color: var(--text-secondary); min-width: 32px; }

/* Table search */
.table-search { display: flex; align-items: center; }

@media (max-width: 1200px) {
  .sub-dash-kpis { grid-template-columns: repeat(3, 1fr); }
  .filter-controls { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); }
}
@media (max-width: 700px) {
  .sub-dash-kpis { grid-template-columns: repeat(2, 1fr); }
  .filter-bar-top { flex-direction: column; align-items: flex-start; }
}

/* ============ LOADING ANIMATION ============ */
@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

.skeleton {
  background: linear-gradient(90deg, var(--bg-tertiary) 25%, var(--border) 50%, var(--bg-tertiary) 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite;
  border-radius: 4px;
}

/* ============ COUNTER ANIMATION ============ */
.kpi-value.counting {
  animation: pulse 0.1s ease;
}

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

/* ============ TOOLTIP ============ */
.tooltip {
  position: absolute;
  background: var(--text-primary);
  color: var(--bg-secondary);
  padding: 6px 10px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  pointer-events: none;
  z-index: 1000;
  white-space: nowrap;
  box-shadow: var(--shadow-md);
}